Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

For SmartServer 3.3 and higher, see Setting Up up Datapoint Connections.

For SmartServer 3.0-3.2, see Defining Datapoint Connections (Release 3.0-3.2)

You can define connection rules that specify how datapoint outputs are connected to datapoint inputs. A connection rule specifies how an update from one or more datapoints is automatically routed to one or more datapoint inputs. You define connection rules in a connection requirements (CON) file. The file is a manually-generated CSV file defining one or more connection rules for datapoints. A connection rule comprises two or more lines in the CSV file. All lines in the connection file that apply to the same connection rule will have the same rule ID. Each rule ID specifies one or more source datapoints and one or more destination datapoints.

...

Point-to-Point connections can be used to convert data from different protocols, different datapoints types (scalar to structure, or structure to scalar) using the CON file map, or localization parameters. You can also specify that only certain values be sent to the destination datapoint by using presets (e.g., ON or OFF). Connection rules that use map, presets, or localization are point-to-point connections. 

Point-to-point connections rely on the SmartServer receiving datapoint updates. In order to get datapoint updates, you typically configure the datapoint properties for all the datapoints you use for a connection using the Datapoint Properties widget (or DLA file) and set up monitoring (polling or event-driven). Updates will also occur and can be monitored on the Datapoint Browser widget as it received updates, or any other application that does on-demand GETs.

...

A CON file contains the following columns (not case sensitive):

Parameter                      Description
Rule IDUnique identifier

There may be multiple entries with the same Rule ID. All entries with the same Rule ID are part of the same connection rule.
Area Scope

Leave blank when specifying Device name.

When specifying Device Type this is the first part of the geozone path, with optional wildcards, to which the connection rule applies. First instance found for the rule is used and others are ignored silently. If no area scope is found in any rule line, the connection rule is ignored silently. 

Zone Scope

Leave blank when specifying Device name.

When specifying Device Type this is the second part of the geozone path, with optional wildcards, to which the connection rule applies. First instance found for the rule is used and others are ignored silently. If no zone scope is found in any rule line, all zones in the area scope are used. 

Device NameDevice name or wild card
Device TypeXIF file name (not required if Device_Name is specified and not a wildcard). When using Device Type you need always need to specify area scope (either the area scope name or * for all area scope).  
Datapoint NameDatapoint XIF name 

Each datapoint has a Datapoint Instance name and a datapoint XIF name (datapoint XIF name is shown in CMS Datapoint Browser Widget Details view or Datapoint Properties). Specify the datapoint XIF name.
DirectionSource or Destination
Map

Mapping formula where $ is source value . Source Map only. For destination mapping use Localization or Preset Map.  $ is source value and map formula

Examples:

Scalar (temperature in Celsius to temperature in Fahrenheit):

{"transform": "$ * 1.8 + 32"}

Map formula to go from scalar to  structure datapoint (SNVT_count to SNVT_Switch which has two fields, state and value):   

{"state":{"transform":"$ ? 1 : 0"},"value":"$"} 

If doing a FAN IN connection, and the source datapoints have different map formulas, then you need to create separate rules for each source datapoint and include the same list of destination for each rule.

(optional parameter)

Presets

Presets that both the source and destination must contain in order for the data to be transferred.

Source and destination can have a different list of presets, but source value is only sent to destination if both source and destination have matching presets. All other values that do not have matching presets are not sent. To do destination mapping, do the map as part of the destination preset formula or use destination.

"onlyPreset" - should always be set to true, means only connections with matching source and destination presets are transferred to destination. 

(optional parameter)

Repeat Presets

If set to true, all subsequent source or destinations use the same localization.

(optional parameter)

Localization

Localization formula: For source $ is the source value, for destination $ is the connection value, and the localization formula value is what the CMS Datapoint Browser shows. 

Examples:

Source localization for scalar (SNVT_count to SNVT_temp_p in deg F):

Source localization: {"transform": "$ * 1.8 + 32"}

Destination formula to go from scalar to  structure datapoint (SNVT_count to SNVT_Switch):   

{"state":{"transform":"$ ? 1 : 0"},"value":"$"} 

{"value":{"transform": "$ + 10"}, "state":{"$ > 0 ? 1 : 0"}}

(optional parameter)

Repeat Localization

If set to true, all subsequent source or destinations use the same localization.

(optional parameter)

...

Using Presets, Localization, and Map

Presets and localization can be applied to source and destinations datapoints. Leave the cell blank in the CON file for any rule not using preset, localization or map.

Map, presets and localization is typically only used if the datapoint type is different. That is, if both the source and destination datapoints are the same datapoint type, then in most cases you would not use map, preset, or localization for the connection rules.   

Map, preset and localization allow you to create a connection that translates values from one datapoint type to another (e.g., SNVT_switch to SNVT_count), or to manipulate the source or destination values. For example, if the source and destination datapoints are SNVT_count, but the source has a range of -100 to 300 and the destination only allows a range of 0 to 100, you can use use map or localization to change the allowed destination range.

The following scenarios are supported:

Localization
(Source,
Destinations, or Both)

Presets
(Source,
Destinations,
or Both) 

Map
(Source only)

yesnono
noyesno
nonoyes
yesyesno
yesnoyes
noyesyes
yesyesyes

The order of the transformation for the source datapoint is IAP value → Localization → Presets → Map.

  • If the source localization is defined, the datapoint is transformed to a localized value. 
  • If the source presets is not NULL, the IAP value (or the local value) is transformed to a preset value.
  • If the map is defined, the last transformation value, which could be a preset value, a local value or an IAP value, is transformed according to the map rules.

The reverse transformation order for the destinations datapoint is Presets → Localization → IAP valuePresets (if defined) are specified using the local values. The localization rule must be specified to reverse transform the preset value to the IAP value.

The map is specified in source and will be applied to the source datapoint for all destinations. Only one map per connection rule ID is supported. Map should be left empty for destinations as it is not supported. Mapping for individual destinations is defined in presets or localization.  

If the datapoint value does not map to any of the presets, then the value is not sent if the onlyPreset property is set to trueOtherwise, the native value will be sent instead. If both transformation map and presets are defined on the source datapoint, then the transformation map is ignored. Only one preset can be defined in the datapoint source. If you have more than one source that has different presets, you have to split it into different connection objects. 

The CON file has an option to specify whether to skip sending datapoint values if the presetValue is not defined or the source presetValue does not map to any of the destination presets.

...

FunctionFunction NameDescriptionFormula
min(x,y)Min 

Min is used to limit a maximum value

(e.g., to limit a scalar value high value to 100 or lower)

{"transform":"min($, 100)"}
max(x,y)Max

Max is used to limit a minimum value

(e.g., to positive numbers)

{"transform":"max($, 0)"}
sqrt(x)Square RootCalculates the square root of a value{"transform":"sqrt($.value)"}

Example formula to limit a datapoint value to a value between 10 and 100:

...

#filetype,con,,,,,,,,,,
Rule ID,Area Scope,Zone Scope,Device Name,Device Type,Datapoint Name,Direction,Map,Presets,Repeat Presets,Localization,Repeat Localization
22,,,PulseGen1,,device/0/nvoPulseOut,Source,"{""state"":{""transform"":""$ ? 1 : 0""},""value"":""$""}",,,,
22,,,PulseGen1,,device/0/nviLamp1,Destination,,,,,
23,,,PulseGen2,,device/0/nvoPulseOut,Source,"{""state"":{""transform"":""$ > 0 ? 1 : 0""},""value"":""$""}",,,,
23,,,PulseGen1,,device/0/nviLamp2,Destination,,,,,

With Two Sources and One Destination (Different Source Mapping)

Note
Note: Requires two source rules, one for each destination.

The following CON file example shows two sources that are connected to, and one destination, with each source having a different mapping transformation. In this case, you need to create multiple rules (i.e., separate rules for each mapping transformation), or specify the mapping rules in Presets column, where presets and the mapping rules are defined, similar to the following:

  • create a rule for sourceA/destA
  • create another rule for sourceB/destA
#filetype,con
Rule ID,Area Scope,Zone Scope,Device Name,Device Type,Datapoint Name,Direction,Map
8,,,NcMultiSensor112.860,,Switch/0/nvoValue,Source,"{""value"": {""transform"":""sqrt($.value)""}, ""state"": {""transform"": ""$.state ? 0 : 1""}}"
8,,,NcMultiSensor112.860,,Switch/0/nviValueFb,Destination,,
9,,,NcMultiSensor112.860,,Switch/0/nvoValue,Source,"{""value"": {""transform"":""3.5*($.value%25)""}, ""state"": {""transform"": ""$.state ? 1 : 0""}}"
9,,,NcMultiSensor112.860,,Switch/1/nviValueFb,Destination,,

...

#filetype,con,,,,,,,,,,
Rule ID,Area Scope,Zone Scope,Device Name,Device Type,Datapoint Name,Direction,Map,Presets,Repeat Presets,Localization,Repeat Localization
3,,,PulseGen1,,device/0/nvoLamp1,Source,,"{""$"": {""transform"": ""$.value == 100 && $.state == 1 ? 'ON' : $.value == 50 && $.state == 1 ? 'MID' : $.value == 0 && $.state == 0 ? 'OFF' : ' ' ""}}",,,
3,,,PulseGen2,,device/0/nviTemp,Destination,,"{""$"": {""enumeration"":{""source"": ""$"", ""map"": {""ON"": 100,""MID"": 50, ""OFF"": 0}}}}",,"{""transform"": ""$ * 2""}",
3,,,PulseGen2,,device/0/nviLamp1,Destination,,"{""$"": {""value"":{""enumeration"":{""source"": ""$"", ""map"": {""ON"": 90,""MID"": 50,""OFF"": 0}}},""state"":{""enumeration"":{""source"":""$"",""map"":{""ON"": 1,""MID"": 1,""OFF"": 0}}}},""onlyPreset"": true}",,"{""value"":{""transform"": ""$.value + 10""},""state"":{""transform"": ""$.state""}}",

Clear Connections

The following CON file example shows the format to clear all connections (using a connection file with no rules).

...