RTServer#

class RTServer(opts)[source]#

Bases: object

Real Time Server. The RTServer class extends do-mpc with an easy to setup opcua server.

Configuration and setup:

Configuring and setting up the RTServer client involves the following steps:

  1. Use do_mpc.opcua.ServerOpts dataclass to specify server name as well as IP adress and port for the server.

  2. Initiate the RTServer class with the ServerOpts dataclass.

  3. Use the namespace_from_client() to automatically generate a namespace from a do_mpc.opcua.RTBase instance (optional).

  4. Start the OPC UA server by calling start()

Note

Remember to properly stop the server afterwards using the stop() method.

Parameters:

opts (ServerOpts) – Server options.

Methods#

add_variable_to_node#

add_variable_to_node(self, namespace_entry, namespace_url)#

Adds a variable to a registered node on the OPC UA server.

Parameters:
  • namespace_entry (NamespaceEntry) – A OPCUA node ID. Contains the variable as well as the target node name.

  • namespace_url (int) – The namespace index identifying the namespace on the OPC UA server

Return type:

None

namespace_from_client#

namespace_from_client(self, client)#

Takes an instance of do_mpc.opcua.RTBase as input and registers an OPC UA namespace for the namespace stored in the RTBase class.

Parameters:

client (RTClient) – A client with a stored namespace.

Return type:

None

start#

start(self)#

Starts the OPC UA server.

Return type:

None

stop#

stop(self)#

Stops the OPC UA server

Return type:

None