How to Log Remote Tags to a Database
An Open Automation Software (OAS) Engine can use the Distributed Network Architecture (DNA) features to read tags from or write tags to another OAS engine.
This type of architecture typically consists of one or more edge devices running OAS. To achieve data logging at a central location, each edge instance is licensed for the required number of Tags, one or more Connectors and the Data Historian product. An additional OAS instance is then typically located at a central location with network access to all of the edge locations. This central location can be used to log data, log alarms and allow clients to connect without any additional license costs as long as only remote Tags are used and no local Tags need to be created.
To understand how a central OAS instance accesses remote Tags see the following diagram. This illustrates a central OAS instance referencing the IP address, Tag name and Value property within the data logging configuration. Note how the central OAS instance doesn't need any Tags configured for this to work.
In this guide you will configure two OAS instances, one with a simulation Tag and another with a data logging group configured to log this Tag data to SQLite.
To complete this guide you will need:
- Two separate workstations or laptops connected to the same network
1 - Download and Install OAS
If you have not already done so, you will need to download and install the OAS platform on two independent workstations or laptops connected to the same network.
Fully functional trial versions of the software are available for Windows, Windows IoT Core, Linux, Raspberry Pi and Docker on our downloads page.
On Windows, run the downloaded setup.exe file to install the Open Automation Software platform. For a default installation, Agree to the End User License Agreement and then click the Next button on each of the installation steps until it has completed.
If you'd like to customize your installation or learn more, use the following instructions:
The OAS Service Control application will appear when the installation finishes on Windows.
Click on each START SERVICE button to start each of the three OAS services.
2 - Configure OAS
Configure OAS is the main application used to configure local and remote OAS instances. If you are managing multiple OAS instances you can use Configure OAS on one of those instances and configure all local and remote instances that are accessible via the network.
Repeat the following steps on each of your workstations or laptops where you have the OAS instance running to configure the initial admin password:
From your operating system start menu, open the Configure OAS application.
Select the Configure > Tags screen.
Important
If this is the first time you have installed OAS, the AdminCreate utility will run when you select a screen in the Configure menu. This will ask you to create a username and password for the admin user. This user will have full permissions in the OAS platform.
For further information see Getting Started - Security.
If this is the first time you are logging in, you will see the AdminCreate utility. Follow the prompts to set up your admin account. Otherwise, select the Log In menu button and provide the Network Node, username and password.
Info
To configure the Network Node where Configure OAS is running, you can use either localhost or the IP address or host name of the workstation or laptop.
If you have installed OAS on a remote instance you can connect to the remote instance by setting the relevant IP address or host name in the Network Node field.
Tips
You can open multiple instances of Configure OAS to connect to different OAS instances.
3 - Connect to Edge OAS Instance
Using the Configure OAS application, you can connect to any Edge OAS instance as long as the machine where you have the Configure OAS application installed is on the same network:
Select Log In from the main menu.
In the Log In window provide the IP address or hostname of the edge OAS instance, the username and the password. Click on OK to continue.
To check your connection, select the Configure menu and select Tags. You should see the green Running status and your Tags.
4 - Add Simulation Tag
In this section you will create a Tag to represent your data source on the Edge OAS instance.
We will use a simulation Tag that generates a random value every second. In a real system you can connect this Tag to any one of the supported data sources.
Info
This guide assumes that you do not currently have any Tags configured, but if you already have the default demo Tags configured you can use the existing Random Tag and skip this section.
Select Configure > Tags from the top menu.
If you want to add a Tag to the root Tags group make sure the Tags node is selected in the tag list and click on the ADD TAG button.
If you want to add a Tag to a Tag Group, select the Tag Group first and then click on the ADD TAG button.
You can also add Tag Groups by using the ADD GROUP button.
Provide a Tag Name such as Random and click the OK button.
Set the Data Source to Simulation and the Simulation Type to Random.
Click on Apply Changes to save the changes.
5 - Connect to Central OAS Instance
Using the Configure OAS application, you can connect to the Central OAS instance as long as the machine where you have the Configure OAS application installed is on the same network:
Select Log In from the main menu.
In the Log In window provide the IP address or hostname of the central OAS instance, the username and the password. Click on OK to continue.
To check your connection, select the Configure menu and select Tags. You should see the green Running status and your Tags.
6 - Configure Data Logging
In this section you will configure the Central OAS instance to log a Tag that is configured on the Edge OAS instance. You will use a remote Tag path to reference the Tag. You will need to know:
- The IP or host name of the Edge OAS instance
- The name of the Tag (in this case Random)
- The parameter you want to log (usually always Value)
You will now create a data logging configuration to log the Random Tag to an SQLite database. You can also use any other of the supported database providers.
Select Configure > Data Logging from the top menu.
Enter a meaningful Logging Group Name to give this data logging group a unique name. A data logging group is simply a data logging configuration for a set of Tags.
On the Common tab leave all the default values. This will create a configuration that uses Continuous logging with a 1 second Logging Rate. This simply means, log data at a rate of 1 second.
On the Tags tab you will add all of the Tags that you want to log. Each Tag will be a field (column) in the database. Click on the ADD button to bring up the Tag Browser.
You will now need to browse the *Edge OAS instance so you can find the remote Tag. Provide the edge IP address or host name in the Network Node field and click on SELECT. You may be prompted for the username and password.
You should now be able to see the Random Tag that we created earlier. Select this Tag. By default the Value property will already be selected. You should now see the full remote Tag path:
\\<your_edge_ip>\Random.Value
Tips
Each Tag has dozens of properties that are available for you to access. The Value property is the most commonly used property as it presents the Tag's current value. This is what we want to log to the database.
The Database Tag window will appear. This is where you set the database field name (column name) and the database data type that will be used. The most common types will be Double Float, Boolean, Integer and String.
Let's set the field name to Random. You will see the Tag(s) property is already set the the remote Tag path.
Now click on the OK button.
The Tag will appear in the list of Tags to be logged.
On the Database tab you will configure the database provider and connection parameters:
You can choose from one of the following providers:
- SQL Server
- MS Access
- Oracle
- ODBC
- mySQL
- MongoDB
- Cassandra
- PostgreSQL
- MariaDB
- SQLite
- InfluxDB
- Redshift
- Firebase
Once you have selected the provider (for example SQL Server) you then need to fill out the required parameters such as database server, database name, table name and security credentials.
Click on the ADD GROUP button to add the data logging group. Once added, the data logging group name should appear in the list of logging groups.
Your database logging group is now active.
Your Tag data at the Edge OAS instance should now be logged at the Central OAS instance based on the data logging group you configured.
7 - Save Changes
Once you have successfully configured your OAS instances, make sure you save your configuration.
On each configuration page, click on the Save button.
If this is the first time you are saving the configuration, or if you are changing the name of the configuration file, OAS will ask you if you want to change the default configuration file.
If you select Yes then OAS will make this configuration file the default and if the OAS service is restarted then this file will be loaded on start-up.
If you select No then OAS will still save your configuration file, but it will not be the default file that is loaded on start-up.
Important
Each configuration screen has an independent configuration file except for the Tags and Drivers configurations, which share the same configuration file. It is still important to click on the Save button whenever you make any changes.
For more information see: Save and Load Configuration
Info
- On Windows the configuration files are stored in C:\ProgramData\OpenAutomationSoftware\ConfigFiles.
- On Linux the configuration files are stored in the ConfigFiles subfolder of the OAS installation path.