Transaction Group Update Modes
Transaction Groups are generally used to store OPC data into a database. Transaction Group Update Modes give users additional flexibility as to whether data should flow from an OPC server to a database or from a database to an OPC server. Additionally, it is possible to configure data to be synchronized between a database and an OPC server via Bi-directional Update Modes.
All update modes do not work for all Transaction Group types. For example, Historical Transaction Groups can only insert data to a database table and not update it. In addition, Historical Transaction Groups also cannot write back to OPC items so Bi-directional Update Mode will not be an option for users using the Historical Transaction Group type.
The different Update Modes:
- OPC to DB - Only read from the OPC server and write to the database.
- DB to OPC - Only read from the database and write to the OPC Server.
- Bi-directional OPC wins - Read and Write to both the database and OPC Server. On group start, write OPC values to the database.
- Bi-directional DB wins - Read and Write to both the database and OPC Server. On group start, write database values to OPC items.
OPC to DB​
The OPC to DB Update Mode allows a Transaction Group to store OPC data to a Database Ignition that it has a connection to as shown in the following example.
Create a Standard Transaction Group and from your Tag Browser, drag a single tag into your Transaction Group's Basic OPC/Group Items section. For this example, the tag is called 'tag1.'
Set the Update Mode on 'tag1' to OPC to DB and set its Target Name to be 'tag1.' The Target Name will correlate to the name of the column in your database table where 'tag1' will be stored.
This configuration will allow for tag1's value to be stored into a database table called 'group_table' every 1 second to a column called 'tag1.' We can see this working now through the Database Query Browser.
DB to OPC​
DB to OPC Update Mode allows you to write data from your Database to an OPC tag. This can be done by configuring the following:
Create a Standard Transaction Group and from your Tag Browser, drag a single tag into your Transaction Group's Basic OPC/Group Items section. For this example, the tag will be called 'tag1.'
Set the mode of the Transaction Group to DB to OPC and set the Mode for tag1 to DB to OPC.
Set the Transaction Groups Table Action to 'update/select' and check the 'last' option. What this will do is ensure that we do not have a new value inserted to the database. What we will have instead is a single row of data in the table group_table where the value of the 'tag1' column will control tag1's OPC value.
Testing these settings, we can see that when the value in the Database Query Browser for column 'tag1' is 22, the value for 'tag1' is also 22. When we change the value on column 'tag1' to 29, we see tag1's value change to 29 as well.
tag1 Value: 22
tag1 Value: 29
Bi-directional OPC Wins​
Bi-directional OPC wins means that Ignition will Read and Write to both the database and OPC Server. However, on initial group start, if the OPC and database values are different, the OPC value will win and the Transaction Group will write OPC values to the database.
Create a Standard Transaction Group and from your Tag Browser, drag a single tag into your Transaction Group's Basic OPC/Group Items section. For this example, the tag will be called 'tag1.'
Set the mode of the Transaction Group to 'Bi-directional OPC wins' and set the Mode for tag1 to 'Bi-directional OPC wins'.
Set the Transaction Groups Table Action to 'update/select' and check the 'last' option. What this will do is ensure that we do not have a new value inserted to the database. What we will have instead is a single row of data in the table group_table where the value of the 'tag1' column will control tag1's OPC value and similarly, 'tag1's OPC value will control the value of the 'tag1' column database side.
What you will have at this point is a bi-directionally controlled Transaction Group where any change to tag1's value will be reflected on the database and any change database side for the 'tag1' column value will be reflected on your 'tag1' tag.
In the event that the OPC and database values do not match on Transaction Group start, the OPC value will win and it will be written to the database. For instance, if Transaction Group is disabled and the 'tag1' value is 20 and the 'tag1' column value is 880, the Update Mode 'Bi-directional OPC wins' means the 'tag1' column value will be set to 20 when the Transaction Group starts.
Bi-directional DB Wins​
Bi-directional DB wins means that Ignition will Read and Write to both the database and OPC Server. However, on initial group start, if the OPC and database values are different, the database value will win and the Transaction Group will write database data to your OPC data points.
Create a Standard Transaction Group and from your Tag Browser, drag a single tag into your Transaction Group's Basic OPC/Group Items section. For this example, the tag will be called 'tag1.'
Set the mode of the Transaction Group to 'Bi-directional DB wins' and set the Mode for 'tag1' to 'Bi-directional DB wins'.
Set the Transaction Groups Table Action to 'update/select' and check the 'last' option. What this will do is ensure that we do not have a new value inserted to the database. What we will have instead is a single row of data in the table group_table where the value of the 'tag1' column will control tag1's OPC value and similarly, tag1's OPC value will control the value of the 'tag1' column database side.
What you will have at this point is a bi-directionally controlled Transaction Group where any change to tag1's value will be reflected on the database and any change database side for the 'tag1' column value will be reflected on your 'tag1' tag.
In the event that the OPC and database values do not match on Transaction Group start, the database value will win and it will be written to the OPC data point. For instance, when the Transaction Group is disabled and 'tag1' value is 10, and the 'tag1' column value is 20, the Update Mode being 'Bi-directional DB wins' means the tag1 tag value will be set to 20 when the Transaction Group starts.