This lesson is part of the Sequential Function Charts in Ignition course. You can browse the rest of the lessons below.

LESSON LIST

Autoplay Off

Description

Here is a detailed explanation of how the Enclosing Step functions in a Sequential Function Chart.

Video recorded using: Ignition 7.9

Transcript

(open in window)

[00:00] The enclosing step is another kind of step available for use in NSFC. Unlike an action step, which ran scripts when the action step is running, the enclosing step actually runs another sequential function chart when it runs. This is a really powerful concept because it allows you to use the concept of encapsulation, while designing your sequential function charts. So you can design charts that act like reusable pieces that can get called like functions from other charts. The main piece of configuration that you need to understand about the enclosing step other than of course picking which chart you want to run as your enclosed chart is the difference between block execution mode and cancel execution mode. If you remember back to our lesson about steps and transitions, you'll remember that a chart will move on past a transition when the transition is true, and the step is ready to be stopped. When an enclosing step is in cancel execution mode, and the transition beneath it becomes true, the enclosed chart is simply canceled right away and as soon as that canceling is finished, flow will move past. If the enclosing step is in block execution mode, the step will refuse to move on until the enclosed chart is finished. So it will block the flow of this chart until the enclosed chart that it's running has reached an end step. Let's see this in action. So I'm going to go ahead and bind our transition to a tag I've made. It's just a Boolean tag, it's called move on. We're going to use that to control whether or not the transition is true or false. And we're going to have our enclosing step, run a chart that I've made called delay chart. Delay chart simply waits for 15 seconds, so it just takes 15 seconds to complete. And let's start it first in block mode. So if I start this chart, we can see that it's running, and now our delay chart is running, but it will take 15 seconds to complete. Now I'm going to tell the transition to become true. And you'll see that the enclosing step is still running and this yellow indicates as the legend will remind us that it's in the stopping state. Now it's finished because the 15 seconds has elapsed. But the important thing to realize here is that even though my transition became true, the enclosing step, stayed in a stopping state, which prevented the chart from moving to the end step until the enclosed chart was finished. Compare that to if we ran the enclosing step in cancel mode. And let's clear our Boolean again and run the chart. It's now same situation we're running our delay chart, but if I toggle the transition now in cancel mode, it moves through instantaneously because the delay chart was canceled. Besides block versus cancel mode, the other configuration on the enclosing step is configuring how information is passed to the enclosed chart and how information is collected from the enclosed chart. So to explain this, I'm going to use another example. I have a chart here called write and wait. This is a very simple chart that simply writes to a tag and it writes to whatever tag has been sent to this chart as a tag path parameter and it writes whatever value was sent to the chart as well. And then it waits for the value at that tag path to be confirmed as the value that was written, so it writes to advice and then waits until that value has been read back from the device. The action step here also records the amount of time the write took by comparing the current time to the time the chart started, and it stores that as a string that represents the milliseconds that the write took as a chart scope variable, called write time. So I can use my enclosing step to call this chart, my write and wait chart, and this chart it makes the most sense to use block execution mode since I want to wait for the write to complete or not just the write to complete but I want to wait for the write to be confirmed and read back from the device. And so I need to pass the tag path into this chart as a parameter. The tag path is at expressions I need to use quotes, I need the tag, provider. And I need the value to write to the tag. To write the value 3.14 and I can take that write time variable that the write and wait chart is calculating and store it as a local chart variable, let's call it, write time Millis. Alright, so let's save our configuration here and run the chart. See the chart is already finished. My example flow is 3.14 and my right time millis is 12 milliseconds. So you can see how the concept of encapsulation can be used to create a series of utility charts that can then be used at single steps from other charts that you have.

You are editing this transcript.

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