Skip to content

ET200_sensor_adapter json configuration

Introduction

The main responsibility of the adapter is to read the input sensor binary data, collected and sent by the ET200 remote I/O unit, transform it to csv format and to push it to the databus.

The input data structure described in the configuration should be consistent with the device setting of the ET200 remote I/O unit.

The content of the specificConfig block in the configuration json file can be edited and changed using the ET200_sensor_adapter Configurator UI via miniweb.

Hint: It is the easier and recommended way of the setting of the specificConfig part of the configuration.


Contents:

  1. Important notice
  2. JSON structure
  3. ET200_sensor_adapter JSON

Very Important!

The ET200_sensor_adapter configuration needs deep and thorough knowledge about ET200 remote I/O unit device settings and has to be totally consistent with it. You must only configure ET200_sensor_adapter with care and attention, any inconsistent, random setting is almost sure to cause invalid operation.


JSON structure

The scope of the configuration json is strongly limited to ET200_sensor_adapter, it absolutely has no effect on the settings and behavior of the ET200 unit at the moment. The ET200 unit can be configured separately via the TIA portal. For the proper settings, gaining some knowledge about the relevant entities and fields in the corresponding json configuration file is mandatory.

The most important configuration entries in the json file:
The specifigConfig block controls the processing of the incoming binary sensor data and also determines the structure of its csv output.

specificConfig:

  • watchdog_timeout_s: If no packet has been received for more than watchdog_timeout_s seconds the application exits and its container is restarted.

  • gapfill_max_timegap_microsec: Naturally, timegaps beween AP timestamps vary. The ET200 data series may have larger gaps and they are filled in using a kind of interpolation: based on the ET200 device's frequency, there is a calculated ideal timegap between the consecutive AP timestamps. Larger gaps are filled up using primitive interpolation (repetition) of the sensor data, however, as this interpolation needs some resources (cpu), even larger gaps, which are over gapfill_max_timegap_microsec, are filled up with predefined error lines (gapfill_error_value).

  • gapfill_error_value: The predefined error line in csv format that is used to fill up the timegaps larger than the value of gapfill_max_timegap_microsec. This line does not contain the value for the timestamp, because that is generated using primitive interpolation. Any other value can be used to define this error line, the only exception is the value associated with the Source field which must be 2.

  • output_order: The preferred order of columns and the header of the output csv file.

    • For instance: timestamp;a1ch1;a1ch2;a2ch1;a2ch2;D1;T1;DBID;PackageID;Source and the output csv is built of these fields.

The two rows below are a possible output_order and gapfill_error_value pair:
"output_order": "timestamp;a1ch1;a1ch2;a2ch1;a2ch2;D1;T1;DBID;PackageID;Source"
"gapfill_error_value": "-1234567890;-1234567890;-1234567890;-1234567890;-1;-1234567890;0;0;2"
For instance, we use -1234567890 value as an analog error value. The timestamp of the error line is calculated by the ET200 adapter so you must not include it in gapfill_error_value. As the output is in csv format, it is important that the order of the fields, the content of the error line and is consistent with output_order which determines the output fields and the header of the output csv. The error line implicitly contains the timestamp field, so its field count must be less with 1 than the field number of the output_order entry. If you break this rule the result csv will have rows with different field counts which might cause problems during the csv processing.

  • package_config: Describes the content, the structure and the data types of the incoming binary ET200 sensor data. The correct setting is crucial for the proper operation of ET200_sensor_adapter. It should be consistent with the ET200 device's settings which are set separately via TIA portal.

  • cycle_count_per_package: This value describes how many cycles data are in an incoming ET200 sensor package. Using oversampling the acquisition of data may occur from sub-cycles (constant bus cycle segments) too, so we can get more sample data during a cycle.

  • header: Contains blocks describing the header of an ET200 package. Every block contains:

    • name: The name of the module

    • data_size: The size of the header in Bytes.

    • data_type: The type of the corresponding binary data. Supported data types are: ubyte, byte, uint, int, float and DTL

    header used: - DBID: This block shows from which buffer the sensor data of a package is received. The ET200 unit uses double buffering to collect and send sensor data packages. After cycle_count_per_package cycles, the buffers are swapped. Its value is 1 or 2, respectively. - TIA type: BYTE - ET200_sensor_adapter type: ubyte - PackageID: It is the unique identifier of an ET200 package. Its value is incremented each package, so any gap may mean an interruption of the ET200 data stream happened. - TIA type: DWORD - ET200_sensor_adapter type: int

    • PackageTimestamp: Timestamp of the ET200 package provided in microsecond precision.
    • TIA type: DTL
    • ET200_sensor_adapter type: DTL
  • modules: Lists the input modules which are plugged onto the ET200 BaseUnit. An element of the modules array contains the following mandatory entries:

    • type: The type of the module (e.g.: analog, digital).

    • oversampling: The oversampling rate of the module. Oversampling makes the acquisition of data in sub-cycles possible. An oversampling value of 5, for example, means that the module acquires samples 5 times each cycle.

    • channels: A module might have several channels. A channel has the following properties:

      • id: The unique ID of a channel. This ID must be used as a reference in the output_order config entry.

      • channel_type: The channel type. Supported channel types are: analog and digital

      • data_size: The size of the binary data in Bytes.

      • data_type: The type of the corresponding binary data. Supported data types are: ubyte, byte, uint, int, float and DTL

      • conversion: Conversion entry is only used in analog type modules. To calculate its values, see explanation below.

The integrated ADC (analog-to-digital converter) of the analog input module digitizes the analog signal. digital_min, digital_max and analog_min, analog_max values determine the nominal range of the analog values and the corresponding digitized value ranges respectively. We use linear mapping to get the digital value of an analog input. To set the proper bounds you should consult the related manual of the analog module.
For instance, Analog input module AI 2xU/I 2-/4-wire HS digital lower and upper bounds of the bipolar digital nominal range is -27648 (0x9400) and 27648 (0x6C00) respectively.
The resolution of the digital input is 16 so it can represent data from the overrange or the overflow intervals.

Representation of analog values in the current measuring ranges (Analog input module AI 2xU/I 2-/4-wire HS): https://support.industry.siemens.com/cs/mdm/73108737?c=67389795083&t=1&s=27648&lc=en-WW
Representation of analog values in voltage measuring ranges (Analog input module AI 2xU/I 2-/4-wire HS): https://support.industry.siemens.com/cs/mdm/73108737?c=67389691787&t=1&s=10v&lc=en-WW

An input range of -10V to +10V means: -27648 to +27648 units.

NB: - +27649 to +32511 are used for over-range. (which is equivalent to +10.004 to +11.758V) - up to +32767 are used for over-flow. (which is equivalent to up to +11.759V) - -32511 to -27649 are used for under-range. (which is equivalent to -10.004 to -11.758V) - down to -32768 are used for under-flow. (which is equivalent to down to -11.759V)

From the above explanation, we can conclude: For the 16 bit resolution, the minimum increment / decrement units = 1 (please revise the attachments in the above thread link).
- +27648 = +10 V
- 0 = 0 V
- -27648 = -10 V
- Each 1 unit = 10 / 27648 = 0.00036169 V


ET200_sensor_adapter.json

{
    "ET200_sensor_adapter": {
        "machineConfig": {
            "subscriptions": {}
        },
        "lifecycleConfig": {
            "appStart": true
        },
        "loggingConfig": {
            "appender": "JOURNAL_APPENDER",
            "severity": "INFO"
        },
        "specificConfig": {
            "watchdog_timeout_s":600,
            "gapfill_max_timegap_microsec": 2000,
            "gapfill_error_value": "-1234567890;-1234567890;-1234567890;-1234567890;-1;-1234567890;0;0;2",
            "output_order": "timestamp;a1ch1;a1ch2;a2ch1;a2ch2;D1;T1;DBID;PackageID;Source",
            "package_config": {
                "cycle_count_per_package": 500,
                "header": [
                    {
                        "name": "DBID",
                        "data_size": 1,
                        "data_type": "ubyte"
                    },
                    {
                        "name": "PackageID",
                        "data_size": 4,
                        "data_type": "int"
                    },
                    {
                        "name": "PackageTimestamp",
                        "data_size": 12,
                        "data_type": "DTL"
                    }
                ],
                "modules": [
                    {
                        "module_type": "high_speed_analog",
                        "oversampling": 5,
                        "channels": [
                            {
                                "id": "a1ch1",
                                "channel_type": "analog",
                                "data_type": "int",
                                "data_size": 2,
                                "conversion": {
                                    "digital_min": -27648,
                                    "digital_max": 27648,
                                    "analog_min": -10,
                                    "analog_max": 10
                                }
                            },
                            {
                                "id": "a1ch2",
                                "channel_type": "analog",
                                "data_type": "int",
                                "data_size": 2,
                                "conversion": {
                                    "digital_min": -27648,
                                    "digital_max": 27648,
                                    "analog_min": -10,
                                    "analog_max": 10
                                }
                            }
                        ]
                    },
                    {
                        "module_type": "high_speed_analog",
                        "oversampling": 5,
                        "channels": [
                            {
                                "id": "a2ch1",
                                "channel_type": "analog",
                                "data_type": "int",
                                "data_size": 2,
                                "conversion": {
                                    "digital_min": -27648,
                                    "digital_max": 27648,
                                    "analog_min": -10,
                                    "analog_max": 10
                                }
                            },
                            {
                                "id": "a2ch2",
                                "channel_type": "analog",
                                "data_type": "int",
                                "data_size": 2,
                                "conversion": {
                                    "digital_min": -27648,
                                    "digital_max": 27648,
                                    "analog_min": -10,
                                    "analog_max": 10
                                }
                            }
                        ]
                    },
                    {
                        "module_type": "digital",
                        "oversampling": 1,
                        "channels": [
                            {
                                "id": "D1",
                                "channel_type": "digital",
                                "data_type": "byte",
                                "data_size": 1
                            }
                        ]
                    },
                    {
                        "module_type": "high_feature_analog",
                        "oversampling": 1,
                        "channels": [
                            {
                                "id": "T1",
                                "channel_type": "analog",
                                "data_type": "int",
                                "data_size": 2,
                                "conversion": {
                                    "digital_min": -10000,
                                    "digital_max": 10000,
                                    "analog_min": -100,
                                    "analog_max": 100
                                }
                            }
                        ]
                    },
                    {
                        "module_type": "timestamp",
                        "oversampling": 1,
                        "channels": [
                            {
                                "id": "timestamp",
                                "data_type": "DTL",
                                "data_size": 12
                            }
                        ]
                    }
                ]
            }
        },
        "version": "0.10.0",
        "system_service": false,
        "databusConfig": {
            "credentials": {
                "username": "",
                "password": ""
            },
            "connectionstring": "rnd:databus.indapp-net.industrialedge.io:8883",
            "permissions": []
        },
        "webserverConfig": {
            "enable": true,
            "reverseProxyForward": {
                "to": "http://ET200_sensor_adapter.ET200_sensor_adapter.proxy-net.industrialedge.io:5000",
                "name": "ET200_sensor_adapter-ET200_sensor_adapter",
                "auth": "none",
                "base": "/ET200_sensor_adapter/",
                "requestParams": [
                    {
                        "name": "X-AppBaseUrl",
                        "value": "$MW_PROXY_BASE"
                    },
                    {
                        "name": "X-Logged-In-User",
                        "value": "$MW_USER_NAME"
                    },
                    {
                        "name": "X-User-Groups",
                        "value": "$MW_USER_GROUPS"
                    },
                    {
                        "name": "X-Real-IP",
                        "value": "$MW_LOCAL_ADDR"
                    },
                    {
                        "name": "X-Server-Software",
                        "value": "miniweb"
                    },
                    {
                        "name": "X-Forwarded-SSL",
                        "value": "$MW_HTTPS"
                    }
                ]
            }
        },
        "datasourceConfig": {
            "providedDatasource": [
                {
                    "datasourceId": "ET200_sensor",
                    "meta": {},
                    "services": {
                        "subscription-service/v1": {
                            "subscriptions": [
                                {
                                    "datapoints": [
                                        {
                                            "address": "all_inputs"
                                        }
                                    ],
                                    "merge": true,
                                    "messageId": "ET200_sensor_data",
                                    "quality": "not_defined_yet"
                                }
                            ]
                        }
                    },
                    "type": "ET200"
                }
            ]
        }
    }
}

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the The Siemens Inner Source License - 1.1.