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

Even the best designed chart isn't any good unless it is started correctly. You can start a chart in four different ways: from scripting (using system.sfc.startChart and the Callable execution mode), from an Enclosing Step, automatically (using the RunAlways execution mode when the Gateway starts), and from the Designer.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we're going to learn all of the different ways in which you can start a sequential function chart. The first way is within the SFC designer interface. If you have a chart open and that chart is valid and the execution mode is set to callable, then you can start an instance of that chart using the chart control panels start button. So I can go ahead and start this looper chart up and you can see I've got a running instance of it. If I click start again, it starts a second instance. This method of starting a chart is also compatible with parameters to a limited extent. This looper count chart has two parameters, one of which the loop total is a key parameter. So you can pass this chart the total number of times in which to execute this loop, and then it also initializes an internal variable count. So if I start this chart, it's going to ask me to provide a value for the key parameter. I'll go ahead and give it a value of 100, and you can see that the loop total key parameter is 100 and that this chart is going to loop a hundred times after which point it simply ends.

[01:07] Now let's see how to use scripting to start a chart. You can use the function system.sfc.startChart() to start a chart via scripting. The chart needs to be in the callable execution mode and be aware that you're starting whatever chart you saved last. So if you have edits in the designer, those aren't going to take effect until you've saved them. You can call system.sfc.startChart from anywhere in the system. In this case, I'm just going to use the script console. So I'll call system.sfc.startChart, and then I'll pass the path to the chart looper count, and then you give it a Python dictionary with all the parameters you want to pass. In this case, I'm going to pass one parameter, my key parameter, which is loop total. The keys of your dictionary should be strings representing the parameter names, and the values can be whatever values you want to pass. So I'm going to go ahead and pass 50 to loop 50 times. Then I'll execute the script and we should see that we've got a new instance of looper count running and it's going to loop 50 times because that's what I passed for the key parameter.

[02:06] A chart can also be started by the gateway itself. If the chart is set to the run always execution mode. To see this, I'll change over to the looper chart. Again, I'll cancel these instances I already started and set the execution mode to run always. When I save this chart, the system will start up one instance of this chart. Of course, with run always charts, it doesn't make any sense to have a key parameter because nobody is manually invoking an instance of the chart. So there's no parameters to be passed. The final method of starting a chart that we're going to look at is starting a chart with an enclosing step. I'll open up this enclosed looper count chart. If we look at its enclosing step, it's going to run looper count in block mode because we want to wait for all the loops to complete and it has to pass the loop total, which is set to 100. I'll start it up and here you can see that the chart is running. But if we go back to looper count, you can see that our instance of looper count with a loop total of 100 is also running.

[03:02] And if you monitor this chart, you'll notice that the chart scope is pretty much the same as we saw before, except that now we have a parent entry for the parent value. This is a reference to the parent chart scope. And those are all the different ways that you can start a sequential function chart.

You are editing this transcript.

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