avatar  

Log out

Recently viewed tickets

Modbus TCP collector



The Collectors



(array of objects, mandatory ) list elements contains the following fields:

  • CollectorName (string, mandatory ) which is unique name (within this confguration file) of a device to collect data from. (This is the name used in the agent configuration). Follows the normal rules for names.
  • CollectorDesription (string, optional) description of this collector.
  • CollectorIPAddr (string, optional) provides a default IP address (or DNS name) for the device to be polled. The agent Target IP address will take precedence over this.
  • CollectorPortno (integer > 0 and < 65535, optional) provides the default port number for the device to be polled. The agent Target Port number will take precedence over this. If neither CollectorPortno , nor agent Target Port Number is specified, the appropriate port will be used, depending on the Protocol parameter value.
  • Alias (string, optional). This is the CollectorName of another collector, from which, all the parameters (expect CollectorName , CollectorDescription , CollectorIPAddr and CollectorPortno ) are copied from. An alias cannot refer to another alias.
  • Protocol (string-enum, mandatory ) the protocol used to collected data. Currently 3 possible values exists: "OPC-UA/TCP", "Modbus/TCP", "Http/GET" and "Simulator".
  • ConnectRetryMin (integer > 0, mandatory ) Minimum number of seconds before trying to reestablish a connection to the device being sampled. An exponential backoff algorithm is used to retry connection establishment, starting after ConnectRetryMin and increasing to ConnectRetryMax .
  • ConnectRetryMax (integer > 0, mandatory ) Maxumin number of seconds before trying to reestablish a connection to the device being sampled.
  • ModbusAccess (Object, optional) collection of parameters needed to access a given Modbus server.
  • SamplePoints (Array of objects, mandatory ) List of samples to be collected, possibly aggregated and stored in the Store'n'Forward database.

Partial example:

{
"CollectorName": "ModbusGOT",
"CollectorDescription": "My first modbus",
"Protocol": "ModBus/TCP",
"ConnectRetryMin": 2,
"ConnectRetryMax": 240,
"ModbusAccess": {



Modbus collector items

The ModbusAccess objects contains the following elements:

  • ModbusFCs (Array of objects, mandatory ) List of modbus functioncode (FCs) to be performed during collection of data if the Protocol is "Modbus/TCP".
  • ModbusTimeout (integer > 0, optional). Timeout (in millisecs) for all modbus FC requests. If not present, the value 500 is used.
  • ModbusRegswap (bool, optional). If true, the 16bit register values retrieved will be byteswapped before being used. If not specified the value is false.

The ModbusFCs objects contains the following elements:

  • ModbusFCID (integer >= 0, mandatory ) is a unique ID (within this Collectors element) for this entry. (Used by the SamplePoints entries.
  • ModbusFCSlaveAddress (integer >= 0 and <= 247, mandatory ) The Modbus Slave Address for this access.
  • ModbusFC (string-enum, mandatory ) is the type of Modbus function code used collecting data. Possible values are: "coils" (FC 1), "inputs" (FC 2), "holding-registers" (FC 3) and "input-registers" (FC 4)
  • ModbusFCStart (integer >= 0, mandatory ) Start address on the Modbus for this access.
  • ModbusFCCount (integer >= 0, mandatory ) Number of units (bits or registers) to read in one access.
  • ModbusFCSampleInterval (integer >= 0, mandatory ) Number of seconds between each collection of data using this FC. If the interval is 0, only eventdriven polling is used.
  • ModbusFCTimeout (integer > 0, optional). Timeout (in millisecs) for this modbus FC requests. If not present, the value is that of ModbusTimeout ' referenced by the ModbusFCID .
  • ModbusFCRegswap (bool, optional). If true, the 16bit register values retrieved will be byteswapped before being used. If not specified the value is that of the ModbusRegswap referenced by the ModbusFCID.

Partial Example:

"ModbusAccess": {
"ModbusFCs": [
{
"ModbusFCID": 1,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "coils",
"ModbusFCStart": 27,
"ModbusFCCount": 64,
"ModbusFCSampleInterval": 5
},
{
"ModbusFCID": 2,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "inputs",
"ModbusFCStart": 3,
"ModbusFCCount": 53,
"ModbusFCSampleInterval": 3
},
{
"ModbusFCID": 3,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "holding-registers",
"ModbusFCStart": 40001,
"ModbusFCCount": 10,
"ModbusFCSampleInterval": 1
}





Samplepoint items

The SamplePoints objects contains the following elements:

  • SampleName (string, mandatory ) Name of this sampled value (sometimes called a tagname). Follows the normal rules for names.
  • SampleDescription (string, optional) is a text description of this sample value.
  • SampleUnit (string, optional) is a description of the unit of messurement for this sample.
  • SampleGroup (string, optional) designates (in some datasrvs) that all samplepoints in that group should be handled (displayed) together. The DCM system itself places no meaning on this group affiliation.
  • ' SamplesSaved (integer > 0, mandatory) is the number of values collected that is saved in the Store'n'Forward database.
  • OnlySaveOnChanged (bool, optional) control is new sample values should only be saved to the store-and-forward database if the values have changed since last sample. If not set, it is false.
  • SampleDataType (string-enum, mandatory ) is the type of data collected. The possible values are: "bool" (1 bit), "sbyte" (8 bit signed), "byte" (8 bit unsigned), "int16" (16 bit signed), "uint16" (16 bit unsigned), "int32" (32 signed), "uint32" (32 bit unsigned), "int64" (64 bit signed), "uint64" (64 bit unsigned), "float" (32 bit), "double" (64 bit), "string" (variable text up to 24575 bytes. Includes terminating NUL), "data" (variable variable data up to 24575 bytes).
  • SampleLowerLimit (integer/double, optional) Is the lower limit for the collected data. If the collected data value is less than SampleLowerLimit it is discarded.
  • SampleUpperLimit (integer/double, optional) Is the upper limit for the collected data. If the collected data value is more than SampleUpperLimit it is discarded.
  • SampleLimitDiscard (bool, maybe-optional). Controls if a sample limit violation results in the sample value being discarded. Mandatory if either SampleLowerLimit or SampleUpperLimit is present.
  • SampleLimitAlarm (bool, maybe-optional). Controls if a sample limit violation generates an alarm. Mandatory if either SampleLowerLimit or SampleUpperLimit is present.
  • ModbusValue (object, maybe-optional) is a description of how to extract a collected datavalue from a FC collected value. Mandatory if the protocol type is "Modbus/TCP".
  • OPCUAObject (Object, maybe-optional) is a description of how to address a specific OPC-UA object, when collecting values from it. Mandatory if the protocol type is "OPC-UA/TCP".
  • HTTPGETValue (Object, maybe-optional) is a description of how to address a specific HTTPGET value, when collecting values from it. Mandatory if the protocol type is "Http/GET".
  • SimulatorData (Object, maybe-optional) is a description of the simulation behaviour of this sample point. Mandatory if the protocol type is "Simulator".
  • Aggregation (object, optional) is a description of how to create a new sample value by performing an aggregation function of other sample values, either physically sample values or other aggregation created sample values.


Partial example:

{
"SampleName" : "Int16Array",
"SampleDescription" : "Int16 array",
"SamplesSaved" : 1000,
"SampleDataType" : "data",
"OPCUAObject" :

Modbus samplepoint

The 'ModbusValue object contains the following elements:

  • FCREF (integer >= 0, mandatory ) This is a reference to the ModbusFCs element with the same value of it's field ModbusFCID .
  • FCOffset (integer >= 0, mandatory ). This is the adressing offset (relative to the referenced ModbusFCs's ModbusStart address. It must be lower than ModbusCount field for that same ModbusFCs element.
  • FCDataMask (integer >= 0, optional) This is the value that is bitwise AND'ed with the collected value.
  • FCDataShift (integer, optional). This is the number of bits the collected value is shifted right.

Together the 4 ModbusValue fields performs the calculation: datavalue = (FCvalue & FCDatamask) >> FCShift. This is traditionally called extracting a bitfield.



Partial example:

"ModbusValue": {
"FCREF": 3,
"FCOffset": 0
},



Examples:

Collecting

64 coils from 27 to 90

53 input registers from 3 to 55

33 holding registers from 100 to 132

{
"CollectorName": "Test1ModbusDevice",
"CollectorDescription": "My first modbus",
"Protocol": "ModBus\/TCP",
"ConnectRetryMin" : 2,
"ConnectRetryMax" : 240,
"ModbusAccess" : {
"ModbusFCs": [
{
"ModbusFCID": 1,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "coils",
"ModbusFCStart": 27,
"ModbusFCCount": 64,
"ModbusFCSampleInterval": 5
},
{
"ModbusFCID": 2,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "inputs",
"ModbusFCStart": 3,
"ModbusFCCount": 53,
"ModbusFCSampleInterval": 3
},
{
"ModbusFCID": 3,
"ModbusFCSlaveAddress": 1,
"ModbusFC": "holding-registers",
"ModbusFCStart": 100,
"ModbusFCCount": 33,
"ModbusFCSampleInterval": 2
}
],
"ModbusTimeout" : 1000
},
"SamplePoints": [
{
"SampleName": "test1",
"SampleDescription": "First coil",
"SamplesSaved": 10,
"SampleDataType": "bool",
"ModbusValue": {
"FCREF": 1,
"FCOffset": 0
},
"SampleLowerLimit": 0,
"SampleUpperLimit": 1,
"SampleLimitDiscard": false,
"SampleLimitAlarm": false
},
{
"SampleName": "input1",
"SampleDescription": "first input",
"SamplesSaved": 10,
"SampleDataType": "int16",
"ModbusValue": {
"FCREF": 2,
"FCOffset": 0
},
"SampleLowerLimit": 0,
"SampleUpperLimit": 1000,
"SampleLimitDiscard": false,
"SampleLimitAlarm": false
},
{
"SampleName": "Holding1",
"SampleDescription": "first holding register",
"SamplesSaved": 10,
"SampleDataType": "int16",
"ModbusValue": {
"FCREF": 3,
"FCOffset": 0
},
"SampleLowerLimit": 0,
"SampleUpperLimit": 1000,
"SampleLimitDiscard": true,
"SampleLimitAlarm": true
}
]
}
Creation date: 11/12/2019 14:07 (skr@secomea.com)      Updated: 18/03/2020 08:25 (tvo@secomea.com)