NetLogic
You can use C# code in a project to extend its functionalities.
TIP:
For useful C# snippets that you can use in your NetLogics, see FactoryTalk Optix NetLogic cheat sheet.
NetLogic object
A NetLogic object contains C# code to execute at runtime or design time.
You can use the following NetLogic templates:
- Runtime NetLogic
- Develop runtime logic linked to the lifecycle of the node that contains it.TIP: The lifecycle of a runtime NetLogic (or its existence at runtime) is equivalent to the lifecycle of the node that contains it. It exists from the time the parent node is created (for example, a Panel object) to the time when the same node is removed. TheStart()andStop()methods represent node creation and removal in the C# code of a NetLogic. In these methods, you can define the logics to be executed at runtime when the parent node is created and removed.
- Define new OPC UA methods. See Methods and events in C# .TIP: The OPC UA methods are exposed by NetLogic and can be referenced at any point of the project at design time. The OPC UA methods can then be invoked at runtime according to the project logic or by an OPC UA client.
- Design-time NetLogic
- Enables you to develop scripts to execute at design time to automate specific operations. For example, you can implement a script that reads a CSV file that contains alarm descriptions to write automatically in the project.
NetLogic and C# classes
A NetLogic contains a C# class with the same name in its code, automatically created at design time. When a NetLogic object is renamed, the corresponding contained C# class is renamed.