Getting Started Sparkplug B Edge of Network Node

OAS is can act as a Sparkplug B Edge of Network Node and Host Application.

The following guide are the steps to define OAS as a Sparkplug B EoN Node to enable OAS Tags as Metric values to Sparkplug B clients acting as a Host Application for Edge Node and Device control and client applications to send and receive tag values of any OAS Data Source.

If you would like OAS to act as a Host Application to control and send and receive data from other Edge of Network Node Devices see the Getting Started Sparkplug B Host Application guide.

You can view the Getting Started with Sparkplug B Video to familiarize yourself with the following steps to setup Sparkplug B communications.

Step 1 – Check MQTT License

OAS

Start the Configure OAS application from the program group Open Automation Software.

Select Configure-License and verify that MQTT is one of the available Drivers in the lower left of the form.  If you do not see the MQTT driver available contact support@oasiot.com to update your license.

NOTE: To configure remote OAS Engines enter the IP Address or node name in the Network Node field and click on Select.

Network Node
Enabled Drivers

NOTE: You will need to be running Open Automation Software Version 19.0.0.54 or greater to support Sparkplug B communications.  Use Configure-Options-System Status to check the version of the running OAS Engine.  You can download the latest version at www.openautomationsoftware.com/downloads/open-automation-software/ or use the Update Version button under Configure-License to update to the latest version of OAS.

Step 2 – Configure Sparkplug B Edge of Network Node Driver

Select Configure-Drivers.

Configure Drivers

Define the properties for the desired Sparkplug B Edge Node.

Enter a meaningful Driver Interface Name.

Set the Driver property to Sparkplug B.

Enter the Host property to the IP Address of the of the host broker or just use localhost for a local broker. 

Set the Port property of the host broker to connect to.  The default port is 1883 or 8883 for SSL.

Note: The OAS MQTT Broker can be used to host data locally.  To use another broker on the default ports on the same computer change the OAS MQTT Broker Port under Configure-Options-MQTT Broker.

Enter the User Name and Password if required.

Keep Alive Time – Default is 60 Seconds.

Reconnect Time – Default 1 Second. If the connection to the broker is lost the Reconnect Time determines how long to wait before attempting to reconnect.

To connect with Transport Layer Security enable the property SSL / TLS.

Specify the Private Key File and Certificate File to use.

Uncheck the property Create Certificate to specify a PFX Certificate File and PFX Certificate Password.

Set the MQTT Protocol Version to V311 or V500.

Set the Client ID to a unique value, each driver interface must have a specific value different than all other clients connecting to the host.

Optionally define a secondary failover Host Broker if the primary Host Broker fails with the property Enable Failover.

If both the primary and secondary broker are offline the Return to Online settings determines the retry frequency.

View Driver Interface Failover for more information and and video demonstrating communications failover.

Set the Mode to Edge Node.

Set the Hode Mode to Remote Hosted if a Host Application to control the state of this Edge Node including another OAS driver set as Host App.  Set to Self Hosted to have this OAS driver control the state of the Edge Node.

Set the Host ID to the specific value that the Edge of Nodes will be using as the Host Application ID.

Set the Sparkplug B Version to 2.2 or 3.0.

Set the Group ID and Edge Node ID that defines this EoN Node.

NOTE: This Group ID and Edge Node ID values will be used to define which OAS tags will be enabled for hosting values in the next step to Define OAS Tags as EoN Node using the Host Group ID and Host Edge Node ID tag properties.

Optionally set the Device ID Filter to include only a specific device defined by the Tag property Host Device ID.  Leave blank to include all tags with all Host Device IDs defined with same Group ID and Edge Node ID.

Select the Add Driver button in the left part of the window to add the Driver Interface as an available selection when defining Tags in the next step.

Add Driver

NOTE: If you need to define several Driver Interfaces you can use the CSV Export and CSV Import on the toolbar in the upper right together with Microsoft Excel.

CSV Import and Export

You can also programmatically define drivers using the .NET OASConfig assembly or OAS REST API.

Step 3 – Configure OAS Tags as Sparkplug B EoN Node and Device Metrics

Select Configure-Tags.

Menu Configure Tags

Select an existing tag or add a new tag.

To update an existing tag jump to the step to specify the Host Group ID and Host Edge Node ID.

To add a new tag select Add Group to add a group to place tags in.

Add Group
Add Tag Group

NOTE: You can add organizational Groups as many levels deep as you prefer and add tags to groups.  To do this first add a Group to the root level, then right click on the Group in the right window to add additional Groups or Tags.

Tag Group Options

Select Add Tag to add a tag to the group selected.

Add Tag
Add Tag to Group

The Data Source can be any OAS Data Source including Allen Bradley PLCs, Siemens controllers, Modbus devices or masters, OPC UA servers and clients, OPC DA servers and clients, MQTT brokers and clients, MTConnect, Calculations, Simulation, or other Sparkplug B Node Metrics.

Specify the Host Group ID and Host Edge Node ID to match the Group ID and Edge Node ID defined in the Edge Node Driver Interface.

Set the Host Device ID and Host Metric Name to any value you desire.  Optionally leave the Host Device ID blank if you want the Metric to appear directly in the Edge Node.  Each OAS tag must have a unique combination of Host Group ID, Edge Node ID, Device ID, and Metric Name.  Two or more tags cannot share the same combination.

Select Apply Changes and the OAS tag value will be published to the specified Host anytime the tag value changes. 

Apply Changes

The value can also be updated with a NCMD or DCMD command to the specific Metric Name.  If the OAS Tag is defined to another Data Source the value will be written to that source.

To define multiple tags use the CSV Export and CSV Import on the toolbar in the upper right together with Microsoft Excel.

CSV Import and Export

When exporting tags choose which columns to include in the CSV file. There are over 800 properties available for use in each tag and reducing the amount of data can help to focus on the properties of interest.

Sparkplug B CSV Export

NOTE: You can also programmatically define Tags using the free to use .NET OASConfig assembly or OAS REST API.

Step 4 – Save Sparkplug B Tags and Drivers

Select the Save button on the toolbar at the top.

Load and Save

Enter a file name to be saved in C:\ProgramData\OpenAutomationSoftware\ConfigFiles directory on Windows or ConfigFiles subdirectory on Linux.

When prompted to set the file as the default configuration to load on startup select Yes.

Set Default Tag File

NOTE: The tags and and drivers are both saved into one file.

The tags defined are now ready for use in all OAS features like Data Logging, Data Route, and Open UIEngine.

Getting Started Sparkplug B Host Application

OAS is can act as a Sparkplug B Edge of Network Node and Host Application.

If you would like OAS to act as an Edge of Network Node view the Getting Started Sparkplug B EoN Node setup guide.

The following guide are the steps to define OAS as a Sparkplug B Host Application to receive and update Edge Node Metric values.  The interface can control the online state of each Edge of Node or just act as a client.

You can view the Getting Started with Sparkplug B Video to familiarize yourself with the following steps to setup Sparkplug B communications.

  • 00:00 – Introduction
  • 01:10 – Download OAS
  • 01:46 – Quick Start
  • 02:08 – Edge of Network Node
  • 05:52 – EoN Tags
  • 07:04 – Host Application
  • 09:20 – SpB Client Tags
  • 10:22 – Programatic Interface
  • 10:59 – CSV Export / Import
  • 12:27 – Multiple Metric Tags
  • 13:46 – Modbus
  • 16:10 – DCMD Metric Write
  • 17:00 – Data Route
  • 17:58 – Networking
  • 18:17 – Save Configuration
  • 18:56 – OAS Platform

Step 1 – Check MQTT License

OAS

Start Configure OAS application from the program group Open Automation Software.

Select Configure-License and verify that MQTT is one of the available Drivers in the lower left of the form.  If you do not see the MQTT driver available contact support@oasiot.com to update your license.

NOTE: To configure remote OAS Engines enter the IP Address or node name in the Network Node field and click on Select.

Network Node
Enabled Drivers

NOTE: You will need to be running Open Automation Software Version 19.0.0.54 or greater to support Sparkplug B communications.  Use Configure-Options-System Status to check the version of the running OAS Engine.  You can download the latest version at www.openautomationsoftware.com/downloads/open-automation-software/ or use the Update Version button under Configure-License to update to the latest version of OAS.

Step 2 – Configure Sparkplug B Host Driver

Select Configure-Drivers.

Configure Drivers

Define the properties for the desired Sparkplug B Host.

Enter a meaningful Driver Interface Name that you will refer to this physical connection when defining Tags with Sparkplug B source.

Set the Driver property to Sparkplug B.

Enter the Host property to the IP Address of the of the host broker or just use localhost for a local broker. 

Set the Port property of the host broker to connect to.  The default port is 1883 or 8883 for SSL.

Note: The OAS MQTT Broker can be used to host data locally.  To use another broker on the default ports on the same computer change the OAS MQTT Broker Port under Configure-Options-MQTT Broker.

Enter the User Name and Password if required.

Keep Alive Time – Default is 60 Seconds.

Reconnect Time – Default 1 Second. If the connection to the broker is lost the Reconnect Time determines how long to wait before attempting to reconnect.

To connect with Transport Layer Security enable the property SSL / TLS.

Specify the Private Key File and Certificate File to use.

Uncheck the property Create Certificate to specify a PFX Certificate File and PFX Certificate Password.

Set the MQTT Protocol Version to V311 or V500.

Set the Client ID to a unique value, each driver interface must have a specific value different than all other clients connecting to the host.

Optionally define a secondary failover Host Broker if the primary Host Broker fails with the property Enable Failover.

If both the primary and secondary broker are offline the Return to Online settings determines the retry frequency.

View Driver Interface Failover for more information and and video demonstrating communications failover.

Set the Mode to Host App for OAS to control the online state of each Edge of Node defined to the shared Host Application ID.

Note: To enable a communication interface to Edge of Nodes, but not set the state of the Host ID set the mode to Client App.

Set the Host ID to the specific value that the Edge of Nodes will be using as the Host Application ID.

Set the Sparkplug B Version to 2.2 or 3.0.

To automatically add tags for each Metric from the matching Group, Edge of Nodes, and Devices enable the property Add Client Tags Automatically.

When enabled optionally set the Filter Groups, Edge Nodes, and Devices that tags should be added from for each of their Metrics.  Leave the Filter fields blank to include all Edge of Nodes publishing data to the broker.

Select the Add Driver button in the left part of the form to add the Driver Interface as an available selection when defining Tags in the next step.

Add Driver

NOTE: If you need to define several Driver Interfaces you can use the CSV Export and CSV Import on the toolbar in the upper right together with Microsoft Excel.

CSV Import and Export

You can also programmatically define drivers using the .NET OASConfig assembly or OAS REST API.

Step 3 – Configure Tags to Define Metric Data from Edge Nodes

Select Configure-Tags.

Menu Configure Tags

NOTE: If the Driver Interface property Add Client Tags Automatically was enabled tags will be created for you, you can skip this step to add tags manually.

Select Add Group.

Add Group
Add Tag Group

NOTE: You can add organizational Groups as many levels deep as you prefer and add tags to groups.  To do this first add a Group to the root level, then right click on the Group in the right window to add additional Groups or Tags.

Tag Group Options

Select Add Tag to add a tag to the group selected.

Add Tag
Add Tag to Group

Change the Data Source Tag property to Sparkplug B.

Select the correct Driver Interface from the Driver Interface pull down list.

Specify the Client Group ID, Client Edge Node ID, Client Device ID, and Client Metric Name for the Edge of Node Metric value to read and write.

Select the Data Type of the Tag to match the data type of the Metric.

Select Apply Changes and the current value for the Metric should appear with Good Quality.

Apply Changes

NOTE: The above tag was automatically created using the Sparkplug B Test Compliance Kit as an Edge of Node source.

To define multiple tags use the CSV Export and CSV Import on the toolbar in the upper right together with Microsoft Excel.

CSV Import and Export

When exporting tags choose which columns to include in the CSV file. There are over 800 properties available for use in each tag and reducing the amount of data can help to focus on the properties of interest.

Sparkplug B CSV Export

NOTE: You can also programmatically define Tags using the free to use .NET OASConfig assembly or OAS REST API.

Step 4 – Save Sparkplug B Tags and Drivers

Select the Save button on the toolbar at the top.

Load and Save

Enter a file name to be saved in C:\ProgramData\OpenAutomationSoftware\ConfigFiles directory on Windows or ConfigFiles subdirectory on Linux.

When prompted to set the file as the default configuration to load on startup select Yes.

Set Default Tag File

NOTE: The tags and and drivers are both saved into one file.

The tags defined are now ready for use in all OAS features like Data Logging, Data Route, and Open UIEngine.

To setup automated data transfer of any OAS Tag to and from the Sparkplug B Tags see Getting-Started – Data Route.

Videos – Azure Event Hubs

Azure IoT Connector

Publish data to Azure Event Hubs and Azure IoT Data Hub.

Azure IoT Event Hubs

How to setup communications to Azure Event Hubs

  • 00:00 – Introduction
  • 00:45 – Getting Started Guide
  • 01:10 – Create Event Hub
  • 01:44 – Azure Portal
  • 02:25 – Setup Driver
  • 04:00 – Publish Select Tags
  • 07:15 – Save Configuration
  • 08:00 – Monitor Data
  • 10:20 – IoT Publish

IoT Publish

How to publish data to Azure IoT Hub, AWS IoT Gateway, and MQTT Brokers.

  • 00:00 – Introduction
  • 00:23 – Set up Tags in OAS
  • 00:41 – Configure Azure IoT
  • 01:53 – Publish Selected Tags
  • 05:31 – Visual Studio Code
  • 08:00 – Step by step instructions
  • 08:12 – Bulk Publish to AWS IOT
  • 09:21 – Step by step instructions / Publish Data to AWS IOT Gateway
  • 09:33 – Bulk Publish to mqtt broker
  • 10:29 – MQTT Explorer
  • 11:20 – Step by step instructions/ Getting Started MQTT
  • 11:34 – Save button of the OAS Configuration tool

Getting Started Azure Event Hubs

View the following video on how to setup publishing data to Azure Event Hubs.

  • 00:00 – Introduction
  • 00:45 – Getting Started Guide
  • 01:10 – Create Event Hub
  • 01:44 – Azure Portal
  • 02:25 – Setup Driver
  • 04:00 – Publish Select Tags
  • 07:15 – Save Configuration
  • 08:00 – Monitor Data
  • 10:20 – IoT Publish

Create an Event Hub

You need to create an Event Hub for your device to connect to. The following steps show you how to complete this task using the Azure portal:

Step 1

Sign in to the Azure portal.

Step 2

From the left menu, click Create a resource, then click Analytics, and then click Event Hubs.

Create Azure Event Hub

Step 3

On the Basic tab of the Create Namespace step that appears enter your Project Details.

Create Azure Namespace

  • Select the Azure Subscription to use for the Event Hub.
  • Select existing or create a a new Resource group.
  • Enter a Namespace name.
  • Select Location.
  • Select a Pricing tier.
  • Set the Throughput Units.

Select Review + create

Azure Namespace Validation

Then the Create button after the Validation succeeded.

You will see Deployment is in progress for a minute, then when finished you will see Your deployment is complete and the resource will be ready for use.

Azure Event Hub Deployment

Select Go to resource.

Step 4

Add Azure Event Hub

In Event Hubs Namespace select + Event Hub to add an Event Hub to publish data to.

Azure Event Hub Settings

Set the Event Hub Name and select Review + create.

Azure Event Hub Validation

Select Create when the prompt of Validation succeeded appears.

The Event Hub is now ready for use with OAS to publish data to.

Step 5

Next click Shared access policies from the left menu.  In the pane that appears to the right, click RootManageSharedAccessKey or use + Add to create a new key.

Azure Shared Access Policies

In the panel that appears to the right, select the Copy to clipboard icon next to Connection string – primary key.  Save this as well, you will need it later.

You have now created your Event Hub the connection string you need to complete the rest of this tutorial.

Step 6 (Optional Schema)

If you wish to transfer data with an Avro schema define a Schema Group in the Schema Registry.  Azure Event Hub Schemas provide a serialization to reduce the message size during transmit.  Note: Schemas are not available for use in a Basic Azure Event Hubs account, a Standard, Premium, or Dedicated account is required to use schemas.

It is important to note that the data type in the schema definition must match the value data type of the tag.

Following is example.  

{
    “namespace”: “com.oasiot.oas-data”,
    “type”: “record”,
    “name”: “oas-data”,
    “fields”: [
        {
            “name”: “Ramp”,
            “type”: “double”
        },
        {
            “name”: “Sine”,
            “type”: “double”
        },
        {
            “name”: “Pump”,
            “type”: “boolean”
        },
        {
            “name”: “Status”,
            “type”: [
                “string”,
                “null”
            ],
            “default”: null
        }
    ]
}

Notice the Status field that include a definition of both the data type and null to allow transfer if the data quality is bad.

“type”: [
                “string”,
                “null”
            ]
 
In the example above if Ramp, Sine, or Pump is bad quality the complete message will be rejected and not transfer.  While the tag defined to the Status field could be bad quality.

Create an Azure IoT Driver

Step 1

Open Configure OAS application.

Step 2

Select Configure – Drivers from the top menu.

Configure Drivers

Step 3

Select your Network Node, either localhost or remote.

Step 4

Enter the Driver Interface Name you wish to use.

Select Azure IoT from the Driver combo box.

OAS Azure Type Event Hubs

Select Event Hubs from the Type combo box.

OAS Azure Event Hub Settings

Copy the Connection string – primary key previously save from the Azure portal and past in the Azure IoT Connection property.  This typically begins with Endpoint=sb://.

(Optional) Schema Type: Avro

Note: If Avro Schema is to be used for serialization the following connection properties are required instead of the Azure IoT Connection.

  • Event Hub Host
  • Tenant Id
  • Client Id
  • Client Secret
  • Schema Group
  • Schema GUID

Azure Event Hubs Schema Driver Properties

Set the Azure IoT Hub property to the Event Hub Name previously defined.

Step 5

To enable data buffering when communication failure occurs check Enable Store and Forward. Values will be stored in the directory specified under Configure >> Options >> Store and Forward.

Step 6

Optionally define a secondary failover Connection and Hub if the primary server fails with the property Enable Failover.

If both the primary and secondary servers are offline the Return to Online settings determines the retry frequency.

View Driver Interface Failover for more information and and video demonstrating communications failover.

Step 7

Click Add Driver on the top left.

Add Driver

Publish Live Data to your Azure IoT Hub.

There are 2 ways to publish data from OAS to Azure IoT Hub.  Both require Tags to be setup first for the data sources you want to transfer.

Option 1 – Publish Selected Tags to your Azure Event Hub.

View the following video for a complete demonstration of how to publish data to Azure IoT Data Hub.

  • 00:00 – Introduction
  • 00:23 – Set up Tags in OAS
  • 00:41 – Configure Azure IoT
  • 01:53 – Publish Selected Tags
  • 05:31 – Visual Studio Code
  • 08:00 – Step by step instructions
  • 08:12 – Bulk Publish to AWS IOT
  • 09:21 – Step by step instructions / Publish Data to AWS IOT Gateway
  • 09:33 – Bulk Publish to mqtt broker
  • 10:29 – MQTT Explorer
  • 11:20 – Step by step instructions/ Getting Started MQTT
  • 11:34 – Save button of the OAS Configuration tool

Step 1

Enable Publish Selected Tags at the bottom of the Driver configuration.

Step 2

Select to publish data continuously at a specified interval, based on event, or at a specific time of day.

IoT Publish Type

If Event Driven browse for a local or remote OAS tag that will trigger the publish.  Select a Boolean tag that will change state from false to true, true to false, or both.  Or choose an Integer tag that trigger a publish anytime the value changes other than 0.

IoT Publish by Event

Step 3

Enable Publish Latest Value Only to send only the latest value of each tag when published or disable to send all value changes since the last time a publish occurred.

Enabled Include All Tags Each Publish to send at least the latest value of each tag when published or disable to only send the tags that have changed since the last publish.

Enable Publish All Tags As One Topic to publish all tag values as one topic or disable to send each tag as its own topic.

IoT Publish Options

See examples in Step 6 below for each selectable option.

Step 4

Specify the Publish Topic Id if choosing to Publish All Tags As One Topic.

Specify the Tag Id, Value Id, an optional Quality Id, and Timestamp Id for each tag value that is sent.

IoT Publish Ids

When including the Timestamp Id also specify the timestamp format, use Custom to specify your own date and time format.

Step 5

Specify local and remote OAS tag variables to include in each publish and specify the Id.  Value is the current value from the data source or you can select any of the over 600 tag variables of each tag to publish.

IoT Publish Tags

Optionally use CSV Export and CSV Import buttons to set up additional tags to publish using Microsoft Excel.

When selecting remote tags use Basic Networking syntax or Live Data Cloud syntax in the tag path.

Step 6

Select Apply Changes to begin publishing to Azure Event Hub.  Select Save to save the new driver configuration within the tag file.

Examples:

Examples of publishing every 2 seconds with each tag value changing every second:

IoT Publish Options

{

  “deviceId”: “OASIOT”,
  “topic”: “oas_tags”,
  “values”: [
    {
      “id”: “Ramp”,
      “value”: 39,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.8090169943749475,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    },
    {
      “id”: “Random”,
      “value”: 10,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    }
  ]
}
 
IoT Publish All Value Chagnes

{

  “deviceId”: “OASIOT”,
  “topic”: “oas_tags”,
  “values”: [
    {
      “id”: “Ramp”,
      “value”: 16,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.587785252292473,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Random”,
      “value”: 96,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Ramp”,
      “value”: 17,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.6691306063588583,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    },
    {
      “id”: “Random”,
      “value”: 26,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    }
  ]
}
 
IoT Publish Tag Id Topics

{

  “deviceId”: “OASIOT”,
  “id”: “Ramp”,
  “value”: 35,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}
{
  “deviceId”: “OASIOT”,
  “id”: “Sine”,
  “value”: -1,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}
{
  “deviceId”: “OASIOT”,
  “id”: “Random”,
  “value”: 83,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}
 

Option 2 – Use Data Route to Send Data to Azure Event Hub

Step 1

Select Configure >> Tags from the top menu.

Step 2

Select your Network Node, either local or remote.

Step 2

From the demo tags select the Ramp Tag.

Step 3

Select the Target tab.

Step 4

Enable Write to target.

Step 5

Select the Azure IoT in the Target Type dropdown.

Step 6

Select the Driver interface you created.

Step 7

Apply the Changes and you should now be writing to your Event Hub.

Step 8

The message is formatted as follows.

{“deviceId”:”myFirstDevice”,”TagName”:”Ramp”,”Value”:66,”DataType”:”DoubleFloat”,”Quality”:true,”TimeStamp”:”2016-04-11T14:38:53.7125255″}

Use Visual Studio Code to Monitor Events.

Visual Studio Code can be used to monitor the events published to Azure Event Hubs.

Sign in to your Azure account and connect Visual Studio to your Azure account.

Visual Studio Code Azure Event Hubs Monitor

Select View-Command-Palette to select EventHub: Select Event Hub.

When prompted select your subscription, namespace, and Event Hub.

Select View-Command-Palette to select EventHub: Start Monitoring Event Hub Message.

Azure Event Hub Data

 

Time On and Time Off – Data Route

To define a time on or time off conditions use the Data Route feature with a Route Type of Destination Change

Step 1 – Configure Data Route

 Start the Configure OAS application and select Configure-Data Route.

Configure Data Route

If prompted enter the Admin user and password defined in the security setup and select OK.

Log In

Step 2 – Define Route Execution

Enter a unique Route Name to identify the routing configuration.

Route Name

Specify the Route Type as Destination Change.

Data Route Destination Change

Step 3 – Define Tags to Set

Select the Tags tab of the data route to setup each destination tag and the source value that will be written to the tag.

Data Route Tags

Select the ADD button to add a destination tag and variable to write to.

Add Button

Browse for the tag and variable on the local or remote OAS Engine to reset after a time delay.

Define the Source Value as True for time on delay and False for time off delay and Data Type as Boolean.

Data Route Time On

Data Route Time Off

Specify a Delay Time to wait after the execution is triggered to write the value to the tag.

Continue to define additional tags using the ADD button.

CSV Import / Export

Optionally use the CSV Export button to export the existing list to a CSV file, then modify with Excel, then save and close Excel to use the CSV Import button to import the modified list of tags.

Select the ADD GROUP button to add the route to the data route configuration.

Add Group

The data route is now active and will execute based on the Route Type selected.

Data Route List

The data route can be disabled by unchecking the Route Active property under the Common tab or controlled dynamically with enabling the property Activate Route with Tag.

Data Route Active

Data Route Activate with Tag

Step 4 – Save Configuration

Select the Save button on the toolbar at the top.

Save

If this is the first time saving you will be prompted to make this the default configuration to load when the OAS Engine restarts.

Data Route Default File

This can be changed under Configure-Options-Default Files.

 

Multiple Tags – Data Route

Multiple Tags Data Route Configuration

View the following video demonstrating multiple tag data route configuration and uses.

View the following steps to define event driven, data change, or continuous execution to trigger setting multiple tag values with defined values or values from other tags.

Step 1 – Configure Data Route

 Start the Configure OAS application and select Configure-Data Route.

Configure Data Route

If prompted enter the Admin user and password defined in the security setup and select OK.

Log In

Step 2 – Define Route Execution

Enter a unique Route Name to identify the routing configuration.

Route Name

Specify the Route Type.

Route Type

  • Event Driven: A Boolean Tag that transactions from False to True, True to False, or both will trigger the data route. An Integer Tag can also be used to Trigger the data route when its value changes and is not a value of 0.
  • Continuous: The data route will execute continuously at the rate specified in seconds.
  • Specific Time Of Day: The data route will occur once per day at the time specified.
  • Destination Change: A change in value on a destination tag will trigger a write from the sources defined for that particular tag.
  • Source Change: A change in value on a source tag will trigger a write to all destination tags with that tag as a source tag.

Event Driven

For Event Driven execution define the Trigger Tag property to a Boolean or Integer tag by browsing for a local or remote network tag.

If the Trigger Tag is a Boolean tag specify the Digital Triger Type to execute on a value change from False to True, True to False, or Both.

Data Route Event Driven

Continuous

For Continuous execution the Route Rate to set the frequency of execution.

Data Route Rate

Specific Time of Day

For Time of Day execution set the Time of Day to execute the data route.

Data Route Time of Day

Step 3 – Define Source to Destinations

Select the Tags tab of the data route to setup each destination tag and the source value that will be written to the tag.

Data Route Tags

Select the ADD button to add a destination tag and variable to write to.

Add Button

Browse for the destination tag and variable on the local or remote OAS Engine.

Data Route Browse Tag

The source of the value to write can be a fixed value or dynamic value from another tag variable.

Define the Source Value and Data Type to write to the Destination.

Data Route Source

Or enable Value from Tag and browse for the local or remote tag variable to use as the source value.

Data Route Source Tag

Optionally specify a Delay Time to wait after the execution is triggered to write the value to the tag.

Note: The Delay Time is the property to use to create Time On or Time Off resets using a Route Type of Destination Change. 

Continue to define additional tags using the ADD button.

CSV Import / Export

Optionally use the CSV Export button to export the existing list to a CSV file, then modify with Excel, then save and close Excel to use the CSV Import button to import the modified list of tags.

Data Route Tags Excel

Select the ADD GROUP button to add the route to the data route configuration.

Add Group

The data route is now active and will execute based on the Route Type selected.

Data Route List

Data Route Configuration

The data route can be disabled by unchecking the Route Active property under the Common tab or controlled dynamically with enabling the property Activate Route with Tag.

Data Route Active

Data Route Activate with Tag

Step 4 – Save Configuration

Select the Save button on the toolbar at the top.

Save

If this is the first time saving you will be prompted to make this the default configuration to load when the OAS Engine restarts.

Data Route Default File

This can be changed under Configure-Options-Default Files.

 

IoT Publish – Data Route

Publish Tag Values to IoT Cloud

View the following steps to enable Tag Publish feature to Kafka Brokers, MQTT Brokers, Azure IoT, and AWS IoT Gateway.

View the following video for a complete demonstration of how to publish data to Kafka Brokers, MQTT Brokers, Azure IoT, and AWS IoT Gateway.

  • 00:00 – Introduction
  • 00:23 – Set up Tags in OAS
  • 00:41 – Configure Azure IoT
  • 01:53 – Publish Selected Tags
  • 05:31 – Visual Studio Code
  • 08:00 – Step by step instructions
  • 08:12 – Bulk Publish to AWS IOT
  • 09:21 – Step by step instructions / Publish Data to AWS IOT Gateway
  • 09:33 – Bulk Publish to mqtt broker
  • 10:29 – MQTT Explorer
  • 11:20 – Step by step instructions/ Getting Started MQTT
  • 11:34 – Save button of the OAS Configuration tool

Step 1 – Configure Driver

Select Configure-Drivers to select Kafka, MQTT, Azure IoT, or AWS IoT Gateway depending on when destination you want to publish tag values to.

Configure Drivers

Step 2 – Define Tag Variables to Publish

Enable Publish Selected Tags at the bottom of the Driver configuration.

Select to publish data continuously at a specified interval, based on event, or at a specific time of day.

IoT Publish Type

If Event Driven browse for a local or remote OAS tag that will trigger the publish.  Select a Boolean tag that will change state from false to true, true to false, or both.  Or choose an Integer tag that trigger a publish anytime the value changes other than 0.

IoT Publish by Event

Enable Publish Latest Value Only to send only the latest value of each tag when published or disable to send all value changes since the last time a publish occurred.

Enabled Include All Tags Each Publish to send at least the latest value of each tag when published or disable to only send the tags that have changed since the last publish.

Enable Publish All Tags As One Topic to publish all tag values as one topic or disable to send each tag as its own topic.

IoT Publish Options

See Data Example at the end of this step for each selectable option.

Specify the Publish Topic Id if choosing to Publish All Tags As One Topic.

When publishing as one topic to optimize communications with Kafka multiple messages are sent for each publish when the number of tag value changes exceeds the Max Tags Per Publish limit.

Max Tags per Publish

Specify the Tag Id, Value Id, an optional Quality Id, and Timestamp Id for each tag value that is sent.

IoT Publish Ids

When including the Timestamp Id also specify the timestamp format, use Custom to specify your own date and time format.

Specify local and remote OAS tag variables to include in each publish and specify the Id.  Value is the current value from the data source or you can select any of the over 600 tag variables of each tag to publish.

IoT Publish Tags

Optionally use CSV Export and CSV Import buttons to set up additional tags to publish using Microsoft Excel.

When selecting remote tags use Basic Networking syntax or Live Data Cloud syntax in the tag path.

Select Apply Changes to begin publishing.

Data Examples:

Examples of publishing every 2 seconds with each tag value changing every second:

IoT Publish Options

Topic: oas_tags
{
  “values”: [
    {
      “id”: “Ramp”,
      “value”: 39,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.8090169943749475,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    },
    {
      “id”: “Random”,
      “value”: 10,
      “quality”: true,
      “timestamp”: “2022-03-21T08:55:39.000Z”
    }
  ]
}
 
IoT Publish All Value Chagnes
 
Topic: oas_tags
{
  “values”: [
    {
      “id”: “Ramp”,
      “value”: 16,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.587785252292473,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Random”,
      “value”: 96,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:36.000Z”
    },
    {
      “id”: “Ramp”,
      “value”: 17,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    },
    {
      “id”: “Sine”,
      “value”: 0.6691306063588583,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    },
    {
      “id”: “Random”,
      “value”: 26,
      “quality”: true,
      “timestamp”: “2022-03-21T09:03:37.000Z”
    }
  ]
}
 
IoT Publish Tag Id Topics
 
Topic: Ramp
{
  “value”: 35,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}
Topic: Sine
{
  “value”: -1,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}
Topic: Random
{
  “value”: 83,
  “quality”: true,
  “timestamp”: “2022-03-21T09:07:15.000Z”
}

Step 4 – Save Configuration

Select the Save button on the toolbar at the top.

Save

If this is the first time saving you will be prompted to make this the default configuration to load when the OAS Engine restarts.

This can be changed under Configure-Options-Default Files.

 

Tag to Tag – Data Route

The Tag-to-Tag Data Route is applied at the individual Tag level. It allows you to point a Tag to any other local or remote Tag. A Tag can only have one Data Route target Tag. This type of Data Route is good for simple requirements where you just need to copy one or more Tags to another set of Tags with a one-to-one relationship. Any data writes on the source Tag will be written to the target Tag.

View the following video for a demonstration of transferring a value from one tag to another.

Step 1 – Define Source Tag

Create the driver see the appropriate data source in the Data Sources Section  (If using Classic OPC or Calculations as a source skip this step)

Create the source Tag. Refer to Configure – Tags for additional information on tag configuration.

Data Route

Step 2 – Define Destination

Select the Target Tab

Data Route

On the target tab check Enable Write to Target

Select the Target Type (Tag, OPC, Azure IoT, or MQTT )

Select the destination for the value to be sent.

If Tag is selected then select Browse and select the desired OAS tag.

Tag Browse

Value is the most commonly used Variable.  See Tag Variables for a complete list of all Variables possible.

Note: You can also browse remote tags on other services to transfer data over a network.

\\192.168.0.1\TagName.Value

If OPC Item is selected select browse and select the OPC server and Item

Target Type

If Azure IoT or MQTT is selected then select Browse and select the desired  Driver

Driver Interface

Enter the desired Deadband in the Float Deadband field. Enter 0 for no deadband.

If you want to specify a desired update frequency for the target check Write Continuously and enter the desired frequency. If Write Contentiously is unchecked the the target will be updated every time the source tag changes.

Click Apply Changes

Apply Changes

The data route from tag to tag is now active.

Step 3 – Save Configuration

Select the Save button on the toolbar at the top to save the updates to the tag configuration.

Save

If this is the first time saving you will be prompted to make this the default configuration to load when the OAS Engine restarts.

This default file location can be changed under Configure-Options-Default Files.

 

Total

View the following video for explanation of each parameter and how to enable Total for a tag:

  • 00:00 – Introduction
  • 00:17 – Define Properties
  • 00:30 – Create a New Tag
  • 03:30 – Totalization Process
  • 06:42 – Reset Function
  • 08:34 – Control the active state
  • 09:53 – Set the initial value
  • 11:10 – Persist the total when system is restarted
  • 12:51 – More Questions

When this feature is enabled the current value will be summed at the sample rate specified with each value multiplied by the total gain before addition to the total.

Total Variables:

The Total feature will keep track of the following:

  • Total – The summation of all sampled values.
  • TotalSamples – The number of samples added since the last total reset.
  • TotalAverage – The total divided by the number of samples.
  • TotalPrevious – The previous total when the last reset was performed.
  • TotalPreviousSamples – The previous number of samples when the last reset was performed.
  • TotalAverage – The previous average when the last reset was performed.

The following image shows how the points will appear for connection in a client.

Browsing Total Variables

Configuration Properties:

Total Properties

The following configuration properties are used to enable and control the summation of values.

Enable Total

Enables the summation of the current value to update the Total variables.

Total Active

When enabled totalizing is active at the specified sample rate.
When disabled totalizing is paused.

Total Active by Tag

When enabled Active state is controlled by a Boolean tag value.

Total Sample Rate

The rate at which the value * gain is added to the total in seconds.

Total Gain

The gain will be multiplied to the value before adding to the total.
Use a negative gain or value if you want the total to decrease on each sample.

Total Gain by Tag

When enabled the gain to multiply to value is controlled by Tag.

Total Initial Value

The value that the total will be initialized to when the total is reset.

Total Reset Daily

When enabled the total is set to the Total Initial Value on the reset hour and minute.

Total Reset Monthly

When enabled the total is set to the Total Initial Value on the reset hour and minute on the first day of the month.

Total Reset by Tag

When enabled a Boolean tag transition from false to true will set the total to the Total Initial Value.

 

Retain Totals on Service Restart

To retain the total values after a system restart go to Configure-Options-Retain Values and enable to retain Totals to a file.

Retain Totals

You can optionally specify a save frequency in hours to save the live total values at a specified rate.  If the save Frequency is left at 0 the totals are only saved when the runtime is stopped or an orderly system shutdown.

WINNAT Blocking Port

On Windows only the WINNAT service may be reserving a port range on your system that includes one or more of the ports that OAS uses.

To check your system use the Windows Command Prompt running in Administrator mode and type the following.

netsh interface ipv4 show excludedportrange protocol=tcp

WINNAT Show Exclusions

If any of the OAS ports are listed in in the exclusions type the following.

netsh int ipv4 add excludedportrange protocol=tcp startport=58720 numberofports=20

Ports 58720 to 58739 should now have an asterisk listed showing that range of ports is now allowed in the WINNAT service.

WINNAT Exclusions