The described functionality requires eva crate feature.
The default action pool size is 1, meaning there can be only a single action running. Despite context actions are atomic (they only set context variables to specified values), the pool can be increased with the top-level field in PLC YAML configuration:
eapi: action_pool_size: 4
EAPI I/O should be defined in PLC config YAML as:
io: - id: someblock # id must be 14 chars as max kind: eapi input: # input block configurations (array) output: # output block configurations (array)
rPLC process can be connected only to one EVA ICS node so the only one I/O block should be used.
Input blocks (actions) should be defined as:
io: - id: someblock # id must be 14 chars as max kind: eapi input: - action_map: - oid: unit:tests/u1 value: u1_val - oid: unit:tests/u2 value: u2_val output: # ....
The variables are set as soon as the PLC process receives an action from the connected EVA ICS node.
Actions do not synchronize variables/items with EVA ICS automatically. To synchronize a variable it must be present in an output block.
Output blocks should be defined as:
io: - id: someblock # id must be 14 chars as max kind: opcua config: # ..... input: # ..... output: - oid_map: - oid: sensor:tests/outvar1 value: outvar1 - oid: sensor:tests/outvar2 value: outvar2 sync: 500ms - oid_map: - oid: unit:tests/u1 value: u1_val - oid: unit:tests/u2 value: u2_val sync: 1s # shift I/O loop if required #shift: 100ms cache: 30s
The field sync is mandatory and specifies how frequently the block must be synchronized.
The field cache is optional. If an output variable is cached, its state is not synchronized with EVA ICS node until the cache expires.
EAPI threads usually do not require to be set as real-time-ones.
EVA ICS node connection settings are not compiled into rPLC process as this configuration may be changed in production from time to time.
To connect a process to EVA ICS node, launch it with PLC_EAPI environment variable set:
The variable also may contain additional parameters:
# the buf_ttl is in microseconds PLC_EAPI=192.168.1.11:7777,timeout=5,buf_size=8192,queue_size=8192,buf_ttl=10 ./myplc
eva edit config/bus
The processes are connected to EVA ICS node bus as:
The connected processes can be listed with e.g. eva-shell:
eva broker client.list -x fieldbus
The connected PLC processes are not native EVA ICS services so they are not listed in the node service list.
To use rPLC as an action handler for EVA ICS units, set the unit action handler as:
eva item edit unit:tests/u1
action: svc: fieldbus.HOSTNAME.plc.PROCESSNAME
rPLC internal API methods can be accessed via EAPI as well:
eva svc call fieldbus.mws1.plc.all info