This lesson is part of the Transaction Groups in Ignition course. You can browse the rest of the lessons below.

Supplemental Videos

Description

Learn how to build a recipe system using Standard or Block Transaction Groups. Recipe Groups use bi-directional communication to pass database information to the PLC when requested.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In the manufacturing industry, it is common to have product recipes stored in a database. Since transaction groups can bidirectionally read and write to and from a database, it is possible to have a group load recipe information from a database table into OPC tags. What do I mean exactly? Here in front of us, I have the database query browser, querying a table in my database called recipes. Here I have five recipes for making ice cream. For each recipe, I see different columns with different integer values which can be quantities for ice cream ingredients, like sugar, milk, water, as well as the string column for my recipe name. I want to load these ice cream recipes into OPC tags, so I will create a brand new standard transaction group. I chose this group type, because it allows me to not only write tag data to a database, but it works bidirectionally, meaning I can also write database data to OPC tags, which is what we want.

[01:14] Now, my recipe requires three integer values for my ingredient quantities, and one string value for my recipe name. I will grab three integer tags from my tag browser, and bring them into my group by simply dragging them over like so. I will also drag in a string tag for my recipe name. I will leave the execution timer at the default one second. I will then configure my table name to point to my recipes table in my database and press enter. Remember, this is where my recipes are stored, and I need this group to fetch this data and write it to my OPC tax year. Because of this, I also need to set my groups update mode to DB to OPC. Now, for my table action, I will not be inserting new records to this recipes table, I will be selecting data from this table, so I will configure the update select table action, and choose key value pairs.

[02:16] I need to tell the transaction group which recipe to select from my recipes table, so I will add a key value pair. I will select the string one column as my key, and my string one tag as my value. In other words, I want this transaction group to select the recipe information that has a string one column value, that is equal to my string one tag value. We will see what this looks like in a second. But before we test it, let's talk about the target name column here. I will bring up my database query browser again, to aid in my explanation. My first tag, integer one, has a target name of integer one. This means that the recipe value in the integer one column will be written to this integer one tag.

[03:09] Similarly, my integer three tag has a target name of integer three, which again means that the recipe value in the integer three column will be written to this integer three tag. Now the string one tag value is how we tell the group which recipe values to write to our OPC tags. For this reason, it does not require a target name, and it can be made read only. You can think of this string one tag as a recipe selector. Now, let's enable the group and save our changes. I will set my string tag here to say chocolate. And you will notice that the chocolate recipe values are now loaded into my OPC tags. If I set my string tag to vanilla, the vanilla recipe values will be loaded to my OPC tags. This is because remember, my group is selecting the recipe that has a string one column value that is equal to my string one tag value.

[04:13] You will note that every second, the group will execute, even though my selected recipe does not really change. This constant execution is inefficient, and can add overhead to a network, a database, or your PLC. What I can do is head over to the group's trigger tab, and I can configure the group to execute on a trigger. I will select my string one tag as my trigger item, and select the active on value change trigger condition. This means that this group will only ever execute when my string one tag value changes. If I save my project and write a different recipe name to my string one tag, you will notice that the group will only write to OPC once every time I change this string one tag value. As we just saw, thanks to the flexibility of transaction groups, we're able to fetch data from a database, and load it into OPC tags.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.