Difference between revisions of "Edge Gateway Adapter Common Configuration"

From Datonis
Jump to: navigation, search
(datetime_tag_id related changes)
m (Fixed incorrect spelling.)
Line 1: Line 1:
  inter[[Datonis Edge Gateway|Edge Gateway Home]] > '''Adapter Common Configuration'''
+
  [[Datonis Edge Gateway|Edge Gateway Home]] > '''Adapter Common Configuration'''
  
 
== Overview ==
 
== Overview ==

Revision as of 09:07, 14 October 2018

Edge Gateway Home > Adapter Common Configuration

Overview

An adapter in Datonis Edge Gateway refers to an independent module/plugin that allows data to be fetched from an environment or protocol (e.g. Modbus, OPC UA) and pushes data to Datonis platform. The various adapters are available in Services sections of Gateway interface's left pane. 

Adapter Types

There are two types of adapters:

  • Pull Data Adapter (Scanning Adapter) These adapters poll the target device at regular frequency specified via scan-interval. Any changes in the target device tag status will be known only during scan interval. Supported Pull Data Adapters are
    1. Modbus Adapter
    2. OPC UA Adapter
    3. MTConnect Adapter
    4. Simulator Adapter (CSV)
  • Push Data Adapter (Listening Adapter) These adapters listen for the changes happened at target device. They specify scan-interval while subscribing change notification but target device may not honor it. Supported Push Data Adapters are
    1. OPC DA Adapter
    2. HttpListener Adapter

There are two ways to configure the adapter: Basic Configuration and Advanced Configuration. Basic Configuration can get start the adapter connectivity very quickly while Advanced Configuration allows finer control.

Basic Configuration

The Basic Configuration tab allows modifying the adapter configuration using CSV file. This is a simple way to import device tags to adapter configuration.

  • enabled - this property value is responsible for enabling or disabling an adapter. A true value enable the adapter and will start pushing data.
  • scan-interval-ms - In case of Pull Data Adapter (Modbus, OPC UA, MTConnect, Simulator), this frequency will be used to scan the target device. In case of Push Data Adapter, this frequency will be passed to target device.
  • send-interval-ms - This property will be displayed only in case of Pull Data Adapter. With this frequency data will be sent to Datonis always.
  • adapter specific connection properties - Rest of the properties are adapter specific and will be shown based on adapter selected.

Note that any change in above scan-interval-ms, send-interval-ms and adapter specific connection properties will be applied to all things.

Basic-config-edge.png

Advanced Configuration

The Advanced Configuration tab allows modifying the underlying json structure of adapter configuration. This is a powerful way to control fine aspects of configuration.

  • enabled - this property value is responsible for enabling or disabling an adapter. A true value enable the adapter and will start pushing data.
  • config-json - this property value holds actual configuration of any specific adapter. The value of this property has to be a valid json data. There is an in-built json editor embedded to modify the config-json. It has three modes - Tree, Code and View. Tree mode allows editing and searching json properties easiliy. Code mode is for advanced configuration where raw config-json can be modified. View mode is read-only where tree view of config-json can be analyzed.

Advanced-config-tree-edge.png

Generating sample config-json

To start creating a new configuration, its good idea to start with pre-populated configuration generated for all things. This is what precisely Generate config-json button does, it communicates with Datonis server, fetches all the things that belong to Cloud access key and secret key pair and creates mock configuration correctly mapped to all thing metrics.

Modifying config-json

The config-json is a special kind of property that holds entire configuration of the adapter. A valid value must be a proper JSON data structure. Elements of the JSON are described as below:

Root object

adapter_type String The type of the adapter, its generally a constant string and no need to modify
thing_configs thing_config Array An array of thing_config object. Each thing_config object contains mapping required to transform source data into metric data

thing_config object

thing_key String The thing key, Datonis UI location: Home → Things → Thing Key
name String Name of the thing, Datonis UI location: Home → Things → Name
description String Optional, Description of the thing, Datonis UI location: Home → Things → {thing name} → Description
bi_directional Boolean Signifies whether the thing can accept instructions, Home → Things → Bi-directional
send_interval_ms Number In pull data adapter case, this is a minimum interval (in milli seconds) at which thing metric data will be sent to Datonis
scan_interval_ms Number In pull data adapter case, at this interval (in milli seconds) the data will be scanned from underlying source
heartbeat_interval_ms Number The interval (in milli seconds) at which thing heart beat will be communicated to Datonis platform.
source_tags source_tag Array An array of source_tag object. Each source_tag object defines the source specific connection object and source specific tag object.
derived_tags derived_tag Array An array of derived_tag object. Each derived_tag object defined the expression based tag that is derived from either source_tag value or earlier defined derived_tag value.
monitor_tag_ids String Array An array of tag_id defined in source_tags or derived_tags section. This list will be used to monitor the tag values at each scan defined by scan_interval_ms. 

If any of the tag values change during a scan then the thing metrics will be sent at that scan interval other wise thing metrics will be sent at send_interval_ms irrespective of

any tag value change.

scan_tag_ids String Array An array of tag_id defined in source_tags or derived_tags section. This list will be used to send the tag values at each scan defined by scan_interval_ms triggered by change in 

monitor_tag_ids. An empty array or null value means all tag values will be sent during the scan interval. It does not affect send interval tags, at send interval all tags will be sent.

If specific tags are defined then those tags will be sent during scan interval rest other will be ignored. (Version 4.0.92 onwards supported)

datetime_tag_id String Optional, an already defined tag_id which value may be used as event date time instead of system current time.
metric_mappings metric_mapping Array An array of metric_mapping object. metric_mapping object defines the mapping between thing metric and source or derived tag. The mapping is kept as a separate object in order 

to evolve source_tag and derived_tag definitions  independent of thing metric relation.

source_tag object

protocol_connection Object This is an adapter specific JSON object. This will have adapter specific connection properties e.g. Modbus adapter may have properties like ip_address, port while OpcUA adapter may have

server_url, cert_alias properties.

read_tags Object Array An array of read_tag objects. A read_tag object is specific to adapter only the tag_id property is common, it is used for metric mapping and must be unique within a thing_config. E.g. Modbus 

adapter properties are device_id, read_count while OPC UA adapter have properties like node_id. These read_tag objects will be polled during each scan and send interval.

write_tags Object Array An array of write_tag objects. A write_tag object is specific to adapter only the tag_id property is common, it is used for writing values to the target device. These tags must be present in the Datonis instruction

json data along with the values to be written. During the instruction execution, writable tag value will be searched in the write_tags section and corresponding adapter address will be written.

derived_tag object

tag_id String The unique tag_id within a thing_config object. This is used further in metric_mapping object to map to thing metric
expression String In case of an expression, you can specify any simple mathematical formula. There are three context arrays available for the expression: latest, prev_scanned and prev_sent. Each context returns

tag values that are computed just now, last scanned (via scan_interval_ms) or last sent (via send_interval_ms). E.g.

metric_mapping object

metric_id String This is metric name of the thing mentioned at thing_config level. Datonis UI location: Home → Thing Templates → {template name} → Metric (Name column)
tag_id String The unique tag_id which is defined either in source_tags or derived_tags section
type Enum Allowed values are number, boolean and string. This type has to match with Datonis metric type. Datonis UI location: Home → Thing Templates → {template name} → Metric (Data Type column)

Aggregated Tag Values

From version 4.5.279 onward, if scan_interval_ms is different than send_interval_ms then along with raw read tag values, below aggregated tag values are available for usage in metric_mappings, derived_tags, monitor_tag_ids and datetime_tag_id.

Suppose a read_tag_id named tag_temperature is defined under read_tags then following aggregated tag values are available

  • tag_temperature : raw/original scanned tag_temperature value
  • tag_temperature$max : maximum scanned tag_temperature value between successful sent values
  • tag_temperature$min : minimum scanned tag_temperature value between successful sent values
  • tag_temperature$avg : average of scanned tag_temperature values between successful sent values
  • tag_temperature$count : count of scanned tag_temperature values between successful sent values
  • tag_temperature$sum : sum of scanned tag_temperature value between successful sent values
  • tag_temperature$prev_scanned : last scanned tag_temperature value
  • tag_temperature$prev_sent : last sent tag_temperature value

For example, if tag_temperature is being scanned with 1000 ms (1 second) and sent every 20000 ms (20 second) then tag_temperature$max value is maximum value among all 20 scanned values available at each send interval. Like wise tag_temperature$avg is average of all 20 scanned values that can be sent every 20 seconds if it is mapped in metric_mappings section.

If a monitor_tag_id is defined e.g. tag_pressure which forced tag_temperature to be sent after 7000 ms (during 7th scan interval) then tag_temperature$max is maximum value among 7 scanned values, like wise tag_temperature$avg is average of 7 scanned values that will be sent.