How to Log Remote Tags to a Database

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.

Data logging remote tags

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 Two OAS Instances

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.

OAS Service Control

Click on each START SERVICE button to start each of the three OAS services.

2 - Configure Two OAS Instances

Configuration of the OAS server is performed from the built-in Web Configuration Application. If you are managing multiple OAS instances you can use the application on one of those instances and configure all local and remote instances that are accessible via the network.

OAS Logo

Repeat the following steps on each of your workstations or laptops where you have the OAS instance running to configure the initial admin password:

  1. Open your browser to http://<your server>:58725/app/config. If you are browsing from the OAS machine itself, you can use localhost, otherwise use the IP address of the machine.

    Important

    If this is the first time you have installed OAS, the engine has no accounts yet and the Create Admin Account screen is displayed in place of the sign in screen. Enter an Admin user name and a Password, enter the same password again in Confirm password, then click on the Create admin & sign in button. This creates an admin account that will have full permissions in the OAS platform.

    For further information see Getting Started - Security.

  2. Provide the Network node, Username and Password, and click on Sign in.

    Log In Dialog

Info

To configure the Network node where the OAS instance 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 a browser tab against each OAS instance to configure them side by side.

3 - Connect to Edge OAS Instance

Using the OAS Web Configuration Application, you can connect to any Edge OAS instance as long as the machine you are browsing from is on the same network:

  1. Open your browser to http://<edge server>:58725/app/config. If you are not signed in, the login screen is displayed.

  2. Set the Network node to the IP address or hostname of the edge OAS instance, provide the Username and Password, and click on Sign in.

    Login dialog edge

  3. To check your connection, select Tags in the sidebar. The Node in the header shows the instance you are connected to and the status shows Running, and you should see your Tags.

    Remote edge

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.

  1. Select Tags in the sidebar.

  2. If you want to add a Tag at the root of the tag list, make sure no Tag Group is selected and click on the + button, then choose Add tag.

    Add tag button

    If you want to add a Tag to a Tag Group, select the Tag Group first and then click on the + button and choose Add tag here.

    You can also add Tag Groups by choosing Add group.

  3. Provide a Tag Name such as Random and click the Create button.

    Add tag to root node dialog

  4. Set the Data Source to Simulation and the Simulation Type to Random.

    Simulation data source

  5. Click on Apply changes to apply the changes.

5 - Connect to Central OAS Instance

Using the OAS Web Configuration Application, you can connect to the Central OAS instance as long as the machine you are browsing from is on the same network:

  1. Open your browser to http://<central server>:58725/app/config. If you are not signed in, the login screen is displayed.

  2. Set the Network node to the IP address or hostname of the central OAS instance, provide the Username and Password, and click on Sign in.

    Login dialog central

  3. To check your connection, select Tags in the sidebar. The Node in the header shows the instance you are connected to and the status shows Running, and you should see your Tags.

    Remote central server

6 - Configure Data Logging of a Remote Tag

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.

  1. Select Data Logging in the sidebar.

  2. Click + Add, enter a meaningful Logging Group Name to give this data logging group a unique name, and click Create. Once created, the data logging group name should appear in the list of logging groups. A data logging group is simply a data logging configuration for a set of Tags.

  3. In the Common section 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.

    Configure data logging common section

  4. In the Tags section 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 Browse for Tag window.

  5. 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 press Enter. You will be prompted for the Username and Password of that instance; enter them and click on Connect.

    Once connected, you should 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 at the bottom of the window:

    \\<your_edge_ip>\Random.Value

    Now click on the Use this tag button.

    Tag browser remote tag

    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.

  6. 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.

    The Field name is filled in for you from the Tag name. Let's replace it with Random. You will see the Tag(s) property is already set to the remote Tag path.

    Now click on the OK button.

    Database tag

  7. The Tag will appear in the list of Tags to be logged.

    Configure data logging tags section

  8. In the Database section turn on Log to Database, then configure the database provider and connection parameters:

    You can choose from one of the following providers:

    • SQL Server MDSE
    • SQL Server
    • MS Access
    • Oracle
    • ODBC
    • mySQL
    • MSMQ
    • 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.

    Configure data logging database section

  9. Return to the Common section and turn on Logging Active. New logging groups are created inactive, so this is what starts the group logging.

    Logging active

  10. Click on the Apply changes button to apply the data logging group configuration.

    Apply changes button

  11. 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 that has a Save button, click on it.

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 on those screens.

The Security, Users and Options screens have no Save button. Changes you make there are written to disk as soon as you make them, so there is nothing further to save.

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.

Ready to get started?

See how OAS fits your environment, or get pricing for your project.