modbus_tc.yml
Options:
PeriodMs: 1000
ModbusSetup:
Type: TcpClient
Ip: 127.0.0.1
Port: 502
SlaveId: 0
MaxReadBufferAgeMs: 3000
ReadRegister: Input
# Type: TcpClient | TcpServer | SerialClient | SerialServer
# ReadRegister: Input | Holding # Only for ..Clients
# MaxReadBufferAgeMs: 3000 # Lifespan of readbuffer before clearing it
##Serial{Client,Server}:
# Baud: 9600
# Parity: N
# Databit: 8
# Stopbit: 1
# SlaveId: 0
# Port: /dev/ttyS7
##SerialServer:
# Invalidserver: 18 # Optional. Default: 18. Unknown setting, ModbusSerialServer.cpp line 123
# ReadRegisterSize: 10 # Size of read register to be allocated. Optional: The application allocates necessary memory if this number is insufficient. Default: 0
# WriteRegisterSize: 10 # Size of write register. Optional: The application allocates necessary memory if this number is insufficient. Default: 0
##TcpClient:
# Ip: 192.168.1.56
# Port: 502
# SlaveId: 0
##TcpServer:
# Port: 502
# MaxNumConnections: 10
# ReadRegisterSize: 10
# WriteRegisterSize: 10
ModbusRead:
# Example
# - {
# Index: [0, 4], # Can be scalar. Note that Modbus register 30001 -> ReadRegister: Input, Index: 0, (FC=04). and 40001 -> ReadRegister: Holding, Index: 0, (FC=03).
# RegisterHandler: { Type: double, BigEndian: false }, #Optional. Default: { Type: uint16 }. Word size of register: 16 bit. Alternative: Sequence specifying each field: [ { Type: double, BigEndian: false }, { Type: BigEndian: true }]
# Type: Double2,
# Topic: DoubleVec2,
# Partition: Example, # Optional, Default: blank.
# Fields: [x, y], # Optional. Default: n-to-n uniform mapping
# Scale: [0.5 -10], # Optional. Default: [1.0, 0] -> [scale, offset], ModbusRead: modbusvalue*scale + offset. ModbusWrite: (modbusvalue - offset)/scale
## ModbusRead only:
# LifespanMs: 3000 # Optional. Default: 60000
## ModbusWrite only:
# ReadNotTake: true # Optional. Default: false. Read: Sample and hold. Take: Consume sample
# }
# Example: Minimal ModbusRead for bool
# - {
# Index: 8,
# RegisterHandler: { Type: bit, Bit: 7}, # Bit: [0-15]
# Type: BoolVal,
# Topic: StateBit7
# }
- { Index: 0, RegisterHandler: { Type: uint32 } , Type: Uint64Val , Topic: Out_TestCounter , LifespanMs: 3000 }
- { Index: 2, RegisterHandler: { Type: int16 } , Type: Int8Val , Topic: Out_int8 , LifespanMs: 3000 }
- { Index: 3, RegisterHandler: { Type: int16 } , Type: Int16Val , Topic: Out_int16 , LifespanMs: 3000 }
- { Index: 4, RegisterHandler: { Type: int32, BigEndian: true } , Type: Int32Val , Topic: Out_int32_BigE , LifespanMs: 3000 }
- { Index: 6, RegisterHandler: { Type: int32, BigEndian: false } , Type: Int32Val , Topic: Out_int32 , LifespanMs: 3000 }
- { Index: 8, RegisterHandler: { Type: uint16 } , Type: Uint8Val , Topic: Out_uint8 , LifespanMs: 3000 }
- { Index: 9, RegisterHandler: { Type: uint16 } , Type: Uint16Val , Topic: Out_uint16 , LifespanMs: 3000 }
- { Index: 10, RegisterHandler: { Type: uint32, BigEndian: true } , Type: Uint32Val , Topic: Out_uint32_BigE , LifespanMs: 3000 }
- { Index: 12, RegisterHandler: { Type: uint32, BigEndian: false } , Type: Uint32Val , Topic: Out_uint32 , LifespanMs: 3000 }
- { Index: 14, RegisterHandler: { Type: int16 } , Type: Int8Val , Topic: Out_int8 , LifespanMs: 3000 }
- { Index: 15, RegisterHandler: { Type: double, BigEndian: true} , Type: DoubleVal , Topic: Out_double_BigE , LifespanMs: 3000 }
- { Index: 19, RegisterHandler: { Type: double, BigEndian: false} , Type: DoubleVal , Topic: Out_double , LifespanMs: 3000 }
- { Index: 23, RegisterHandler: { Type: float, BigEndian: true} , Type: FloatVal , Topic: Out_float_BigE , LifespanMs: 3000 }
- { Index: 25, RegisterHandler: { Type: float, BigEndian: false} , Type: FloatVal , Topic: Out_float , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 0} , Type: BoolVal , Topic: Out_bool , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 1} , Type: BoolVal , Topic: Out_i8neg , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 2} , Type: BoolVal , Topic: Out_i16pos , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 3} , Type: BoolVal , Topic: Out_i32neg , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 4} , Type: BoolVal , Topic: Out_ui64neg , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 5} , Type: BoolVal , Topic: Out_false5 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 6} , Type: BoolVal , Topic: Out_true6 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 7} , Type: BoolVal , Topic: Out_false7 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 8} , Type: BoolVal , Topic: Out_true8 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 9} , Type: BoolVal , Topic: Out_false9 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 10} , Type: BoolVal , Topic: Out_true10 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 11} , Type: BoolVal , Topic: Out_false11 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 12} , Type: BoolVal , Topic: Out_true12 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 13} , Type: BoolVal , Topic: Out_false13 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 14} , Type: BoolVal , Topic: Out_true14 , LifespanMs: 3000 }
- { Index: 27, RegisterHandler: { Type: bit, Bit: 15} , Type: BoolVal , Topic: Out_true15 , LifespanMs: 3000 }
# Casted and scaled values
- { Index: 28, RegisterHandler: { Type: int16 } , Type: DoubleVal , Topic: Out_intToScldDblSine , Scale: [0.01, 0] , LifespanMs: 3000 }
- { Index: 29, RegisterHandler: { Type: int32 } , Type: Int16Val , Topic: Out_int16Rescld , Scale: [0.01, 0] , LifespanMs: 3000 }
# Numeric limits and truncation
- { Index: 31, RegisterHandler: { Type: uint16 } , Type: Int16Val , Topic: Out_int16Truncd , LifespanMs: 3000 }
- { Index: 32, RegisterHandler: { Type: double } , Type: DoubleVal , Topic: Out_NaN_double , LifespanMs: 3000 }
- { Index: 36, RegisterHandler: { Type: float } , Type: DoubleVal , Topic: Out_NaN_float , LifespanMs: 3000 }
- { Index: 38, RegisterHandler: { Type: int16 } , Type: DoubleVal , Topic: Out_NaN_int16 , LifespanMs: 3000 }
- { Index: 39, RegisterHandler: { Type: uint16 } , Type: DoubleVal , Topic: Out_NaN_uint16 , LifespanMs: 3000 }
- { Index: 40, RegisterHandler: { Type: int32 } , Type: DoubleVal , Topic: Out_NaN_int32 , LifespanMs: 3000 }
- { Index: 42, RegisterHandler: { Type: uint32 } , Type: DoubleVal , Topic: Out_NaN_uint32 , LifespanMs: 3000 }
- { Index: 44, RegisterHandler: { Type: double } , Type: DoubleVal , Topic: Out_inf_double , LifespanMs: 3000 }
- { Index: 48, RegisterHandler: { Type: float } , Type: DoubleVal , Topic: Out_inf_float , LifespanMs: 3000 }
- { Index: 50, RegisterHandler: { Type: int16 } , Type: DoubleVal , Topic: Out_inf_int16 , LifespanMs: 3000 }
- { Index: 51, RegisterHandler: { Type: uint16 } , Type: DoubleVal , Topic: Out_inf_uint16 , LifespanMs: 3000 }
- { Index: 52, RegisterHandler: { Type: int32 } , Type: DoubleVal , Topic: Out_inf_int32 , LifespanMs: 3000 }
- { Index: 54, RegisterHandler: { Type: uint32 } , Type: DoubleVal , Topic: Out_inf_uint32 , LifespanMs: 3000 }
- { Index: 56, RegisterHandler: { Type: double } , Type: DoubleVal , Topic: Out_infneg_double , LifespanMs: 3000 }
- { Index: 60, RegisterHandler: { Type: float } , Type: DoubleVal , Topic: Out_infneg_float , LifespanMs: 3000 }
- { Index: 62, RegisterHandler: { Type: int16 } , Type: DoubleVal , Topic: Out_infneg_int16 , LifespanMs: 3000 }
- { Index: 63, RegisterHandler: { Type: uint16 } , Type: DoubleVal , Topic: Out_infneg_uint16 , LifespanMs: 3000 }
- { Index: 64, RegisterHandler: { Type: int32 } , Type: DoubleVal , Topic: Out_infneg_int32 , LifespanMs: 3000 }
- { Index: 66, RegisterHandler: { Type: uint32 } , Type: DoubleVal , Topic: Out_infneg_uint32 , LifespanMs: 3000 }
- { Index: [68,70,72], RegisterHandler: { Type: float } , Type: Float3 , Topic: Out_float3, Scale: [1.0, 0] , LifespanMs: 3000 }
- { Index: [74,75,76], RegisterHandler: [{ Type: int16 }, { Type: int16 }, { Type: int16 }], Type: Float3, Topic: Out_float3viaInt16, Fields: [x, y, z], Scale: [[0.01, 0], [0.01, 0], [0.01, 0] ], LifespanMs: 3000, Partition: All }
ModbusWrite: