Programs can have different lifetimes. Some Programs may always be present on a Server while others are created and removed. Creation and removal can be controlled by a Client or may be restricted to local means.
A Program can be Client creatable. If a Program is Client creatable, then the Client can add the Program to the Server. The Object Create Method defined in OPC 10000-3, is used to create the Program instance. The initial state of the Program can be Halted or Ready. Some Programs, for example, may require that a resource becomes available after its creation and before it is ready to run. In this case, it would be initialized in the Halted state and transition to Ready when the resource is delivered.
A Program can be Client removable. If the Program is Client removable, then the Client can delete the Program instance from the Server. The DeleteNodes Service defined in OPC 10000-4 is used to remove the Program Instance. The Program shall be in a Halted state to be removed. A Program may also be auto removable. An auto removable Program deletes itself when execution has terminated.
Programs can be multiple instanced or single instanced. A Server can support multiple instances of a Program if these Program Instances can be run in parallel. For example, the Program may define a Start Method that has an input argument to specify which resource is acted upon by its Functions. Each instance of the Program is then started designating use of different resources. The Client can discover all instances of a Program that are running on a Server. Each instance of a Program is uniquely identified on the Server and is managed independently by the Client.
Programs can be run once or run multiple times (recycled). A Program that is run once will remain in the Halted state indefinitely once it has run. The normal course of action would be to delete it following the inspection of its terminal results.
Recyclable Programs may have a limited or unlimited cycle count. These Programs may require a reset step to transition from the Halted state to the Ready state. This allows for replenishing resources or reinitializing parameters prior to restarting the Program. The Program Control Method “Reset” triggers this state transition and any associated actions or effects.