NetLogic
You can use C# code in a project to extend its functionalities.
NetLogic object
A NetLogic object contains C# code to execute at runtime or design time.
- 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
PanelLogic
NetLogic contains this declaration that defines the PanelLogic
class:
public class PanelLogic : BaseNetLogic
BaseNetLogic
class. The base class supplies the most of the methods to NetLogic, including the Start
and Stop
methods.All C# classes are grouped in a .NET project created and automatically updated.
NetLogic placement
- In a type
- At runtime, the NetLogic exists in each instance of the type (for example, in a
MotorType
) until the instance is removed. - Outside a type
- At runtime, the NetLogic is created at project start and deleted at project closure. For example, inside a folder, inside other instances, or inside the root node of the project.
NetLogic security warning
The NetLogic security warning displays if the project NetLogics reference .NET assemblies that may be critical for the project security when you deploy the project, run the project, or execute design-time NetLogics.
- I/O operations on the filesystem
- Execution of external processes and tracing
- Network communication
- C# reflection
- Invocation of external default libraries
- Security and cryptography
The NetLogic security warning also includes information about any NuGet packages and third-party .NET assemblies used and referenced by the C# code in the project.