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 8.1

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 charts starting point, the begin step is also where you can define your charts 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 dot sfc dot start chart. 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.

[01:12] 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 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 parameter. 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.

[02:05] 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're 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. They are also very valuable for use in the chart's logic. So for example, this indirection demonstration chart, it uses the motor number as a key parameter, and then throughout the chart itself, it uses that motor number for indirection so that it can write to tags that represent the correct motor. For example, if you take a look at this action step, you can see that it's using motor number to build out an indirect tag path. So we may have many motors and each instance uses indirection to make sure that the chart instance is reading and writing to the correct set of tags.

[03:06] 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.