Communication driver
Models the communication with the gateway in order to connect to different software.
Mandatory children
- type: The type of driver. Each driver has its required setup data.
- Var: smtk_comm_driver_choice
- Type: constant
- Possible values: allenbradley_logix | abb_driver | cprog_cri | development | fanuc_roboguide | hokuyo_uam | kuka_varproxy | micro800_http | modbustcp_master | mqtt_client | omron_nexsocket | opcda_client | opcua_client | plcsim | plcsim_advanced | robodk_driver | rosbridge | s7protocol | simit | simulink_udp | sqlite3_conn | twincat_ads | udp_driver | ur_driver
- Default value:
opcua_client
- enable: Enable or disable the driver.
- Var: smtk_bool
- Doc: (bool)
- Type: input
- Default value:
false
- setup_data: Setup for the driver in JSON (more info below).
- Var: smtk_string
- Type: input
- Default value:
{}
- update_input: Update the inputs to the driver from the system in JSON. It contains the variables names as keys and their values.
- Var: smtk_string
- Type: input
- Default value:
{}
- update_output: Update the outputs from the driver to the system in JSON. It contains the variables names as keys and their values.
- Var: smtk_string
- Type: output
- Default value:
{}
- status: The status of the driver (connecting, connected, standby, running, error).
- Var: smtk_string
- Type: output
- Default value:
none
- info: Debug messages from the driver.
- Var: smtk_string
- Type: output
- Default value:
none
Setup data
The setup data is a JSON string that must contain two mandatory items:
Parameters
These values exposes the configuration or context used by the drivers to connect to other platforms. All the drivers share three common parameters (rpi
, force_write
and auto_reset
). Except for these, each driver has its own specific parameters, which can be found on their pages here in the user manual.
The parameters are defined by a dict that may include several items following the next format {parameter_name: parameter_value}, i.e:
{
"rpi": 35,
"force_write": 0.5,
"auto_reset": 5.0
}
Common parameters
- rpi: How often vars are read and write in ms. Default: 50
- force_write: Used to periodically (in s) re-write variables. Default: 1.0
- auto_reset: Used to define the time (in sec) to try reset the driver when the state is ERROR. Default: 5.0
Variables
These are the variables to be accessed in the controller, read and written through the driver. They are defined by a dict that may include several definitions following the next format {address: {'datatype':str, 'size':int, 'operation':str}:
- address (str): It can be used as name, tag, id, or simply to identify the variable.
- datatype (str): It is used to define the variable data type (bool, byte, int, word, dword, qword, float, str).
- size (int): It defines if the variable is an array. If not defined it is asumed is not an array or dimension 1.
- operation (str): It defines if the variable should be written or read by the driver in the controller (read, write).
An example of two variables input
and output
definition:
{
"input": {
"datatype": "byte",
"size": 1,
"operation": "write"
},
"output": {
"datatype": "byte",
"size": 2, "operation": "read"
}
}
Result
Now, combining these two blocks together, a complete SETUP msg would look like the following example:
{
"parameters": {
"rpi": 35,
"force_write": 0.5,
"ip": "192.168.0.1",
"port": 1234
},
"variables": {
"input": {
"datatype": "byte",
"size": 1,
"operation": "write"
},
"output": {
"datatype": "byte",
"size": 2,
"operation": "read"
}
}
}
Tip
You will find specific examples of the setup_data, update_input and update_output in the different drivers documentation