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

LESSON

Begin Step and Using Parameters

Description

Here is a detailed explanation of how the Begin Step functions in a Sequential Function Chart. We also take a look at using parameters in a chart.

Video recorded using: Ignition 7.7

Transcript

(open in window)

[00:00] When you create a new sequential function chart, it starts with the Begin Step already on it. The Begin Step is where the chart will begin executing. You can't remove the Begin Step, and so there's no Begin Step up on the pallet, because you won't ever need to add another one. In addition to being the chart's starting point, the Begin Step is also where you can define your chart's parameters. These parameters define default values for chart scope variables. If the parameters are received when a chart is started, through, for example, the scripting function system.sfc.startchart, if those parameters are passed to a new instance, the default value won't be used, the value that was passed in as a parameter will be used instead. But if nobody passes a value for a parameter, its default value will be used. This chart here uses the parameters for two purposes; the loop total is expected to be received as a parameter, and defines how many times this chart will execute a loop, whereas the count isn't expected to be passed as a parameter. Rather, it's just used here to define an initial value for the chart's scope variable count. It's important to remember that the default values are defined as expressions. So if I had made a new parameter here, and I wanted it to be a string, I can't just type in something like this, because that's not a valid expression. I would need to put it in quotes in order to make this default value a valid expression. You can optionally pick one of your parameters to be what's known as the key param. The key parameter is used to identify a chart. So for example, if we take this chart here, it has no parameters at all, and if we start it up, a new instance starts, and the instance here, you can see is identified by its instance ID, which isn't very friendly to look at. But if we take our looper count chart, which does define a key parameter, and we start it up, it'll ask us for a value to use for the key parameter loop total. So let's say, we'll give it a value of five, and now you can see that this instance is identified by the value of its key parameter, which makes it easier for a chart that may have many instances running to be identified. So for example, suppose your chart was being used to process a batch, you could define the batch number as the key parameter, and then when you were looking at all of your instances, it would be clear which chart instance was processing which batch. The parameters aren't just useful for identifying instances though, of course. They're also very valuable for use in the chart's logic. So for example, this batch vessel demonstration chart, it uses the vessel number as its key parameter, and then throughout the chart itself, it uses that vessel number for indirection, so that it can write to the tags that represent the correct vessel. For example, if you take a look at this transition expression, you can see that it's reading the value of the heat exchange or input temperature for this specific vessel number that this chart instance is representing. So we may have, you know, many vessels, and each instance uses indirection to make sure that the chart instance is reading and writing to the correct set of tags. So in summary, the Begin Step, while obviously crucial to mark the beginning of your chart, is also a very important place where you can define chart parameters, which can be used for instance identification, as well as chart indirections, so that you can make one chart that can be used to control many similar things.

You are editing this transcript.

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