IO-Extension card¶
Example scenario¶
We have Integral controller with 2 IO-cards in slots 1 and 4.
Slot 1 io-card contains:
AI-Res |
channels 2 and 4 |
AO |
channel 6 |
AI-V |
channel 8 |
Slot 4 io-card contains:
DO |
channels 2 4 6 8 |
DI-ext |
channels 10 12 |
IO-port setup¶
We need to create ioPorts for each card.
Slot 1:
pointName:
ioPorts/rpc/P1:
- alias:
IOM1
- device:
/dev/slots/internal/M1_RPC
Slot 4:
pointName:
ioPorts/rpc/P4:
- alias:
IOM4
- device:
/dev/slots/internal/M4_RPC
With this information we can build following dataSources and -targets:
M1¶
sources:
rpc://ioPorts%2Frpc%2FP1/readch/2/2
rpc://ioPorts%2Frpc%2FP1/readch/4/2
rpc://ioPorts%2Frpc%2FP1/readch/8/3
targets:
rpc://ioPorts%2Frpc%2FP1/setch/6/4
M4¶
sources:
rpc://ioPorts%2Frpc%2FP4/readch/10/6
rpc://ioPorts%2Frpc%2FP4/readch/12/6
targets:
rpc://ioPorts%2Frpc%2FP4/setch/2/8
rpc://ioPorts%2Frpc%2FP4/setch/4/8
rpc://ioPorts%2Frpc%2FP4/setch/6/8
rpc://ioPorts%2Frpc%2FP4/setch/8/8
To use the channel as source for point, just add the datasource or datatarget
To use the channel as source for point, just add the datasource or datatarget
datasource/-target logic¶
dataSources and dataTargets (later just also just dataurls) use following logic, to read/write to correct place: rpc://device/method/channel/mode:
device:Pointname of the ioPort
channel:is the channel number
mode:is the mode which is used for the channel
Note
Note: the pointname needs to be URL-encoded.
In short it means that if the dataurl contains the character / needs to be
replaced with %2F. Otherwise parsing of the dataurl will not work correctly.
Channel Mode Name |
Value |
|---|---|
CH_MODE_UNINIT |
0 |
CH_MODE_GND |
1 |
CH_MODE_AI_RES |
2 |
CH_MODE_AI_VOLTAGE |
3 |
CH_MODE_AO_VOLTAGE |
4 |
CH_MODE_DI |
5 |
CH_MODE_DI_EXT |
6 |
CH_MODE_PULSE |
7 #Not yet implemented |
CH_MODE_DO |
8 |
CH_MODE_NTC10 |
9 |
CH_MODE_PT1000 |
10 |
CH_MODE_NI1000 |
11 |
CH_MODE_NI1000_LG |
12 |
Note
The logic differs from magioRTU in few ways: Magio io-modules needs different registers for setting the channel mode and for the actual value of the channel, so you need two database points to handle that behavior. You also need 2 different IO-profiles: 1 for channel modes and 1 for the actual value. With RPC IO-modules, it is possible bundle channel mode and method in one request.