Versions Compared

Key

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

Overview

In FactoryStudio, an advanced SCADA and HMI software, it is possible to establish a robust and secure connection with a PostgreSQL database using the TagHistorian feature. The TagHistorian allows for the collection and storage of tag data, providing a real-time, accurate history of your process data. The steps to achieve this involve renaming databases, creating and testing the PostgreSQL connection, configuring tags and tasks, and writing specific queries for select, insert, update, and delete operations. By effectively using this feature, users can send values to the PostgreSQL database and successfully execute different queries, leading to an efficient and accurate real-time data management system.


On this page:

Table of Contents
maxLevel3


Configuration PostgreSQL via TagHistorian

In this example, we present the configuration of Postgre using TagHistorian.

First, you can access Datasets>DBs and need to rename the SQLite database "TagHistorian" to "TagHistorian2" or another name.

?Image Modified


Now you can access Datasets>DBs, select the PostgreSQL Data Provider option and click on "Create new..." and create the Postgre with the name TagHistorian.

Image Modified


In the ConnectionString column, you can configure the Server parameter with the IP of the Postgre Server, the Port, and the name of the Database configured on the Postgre server.

Don't forget to configure the LogonName and LogonPassword column.

Note

Note: to modify the password column, you need to switch to Administrator.

Image Modified

Click Test and check the connection with the Postgre Server.

In Datasets>Queries, some queries were created as shown in the image below. We use Select, Insert, Delete, and Update in this example.

Image Modified


Now, in Tags>Objects, it is possible to create some Tags to use in this example. The Integer01, Integer02, and Integer03 are Tags that we will use to send values to the Postgre DB.

The "TriggerUpdate", "TriggerSelect", "TriggerInsert" and "TriggerDelete" are used to trigger some task scripts that we will create in the next steps.

The tag "QuerySelect" is used to receive the result of the Select query.

Image Modified


In Tags>Historian, it is necessary to configure Integer01, Integer02, and Integer03 Tag, Table1 is standard and is configured to use PostgreSQL.

Image Modified


Now, in Scripts>Tasks you can create some tasks to Select, Delete, Update, Insert, and configure the Trigger column with marks created before.

Image Modified


The scripts are:

Select Query:

Image Modified


Insert query:
Image Modified


Update Query:

Image Modified


Delete query:

Image Modified


We can run the project and give some different values to the Tags. thus, within pgAdmin 4 we can see that Table 1 was created with values that were given.

Image Modified

?


Thus, we trigger tasks through Trigger Tags, all Queries were successfully performed.

Image Modified


Our Table within Postgre is updated with the Queries we created before.

Image Modified



In this section...

Page Tree
root@parent
spacesV10