You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing email@example.com.
We are experiencing playback issues from our video hosting provider. Please check back shortly.
Here is a detailed explanation of how the Transition element functions in a Sequential Function Chart.
Video recorded using: Ignition 7.9
Transcript(open in window)
[00:00] The transition element is another fundamentally important element for sequential function charts. The transition element is pretty simple. The value of an expression is used to control whether or not the chart can move past the transition and execute what's beneath it or whether it'll stay executing what's above it. For example, if put some steps in here, this transition will control whether or not this step S1 continues to run, if the expression in this transition is evaluates to false. And once the expression evaluates to true, S1 will stop, and S2 will begin executing. The expression that you can edit here for the transition will be evaluated as a Boolean, but the value doesn't need to strictly be a Boolean. For example, if this expression evaluates to an integer, anything that's nonzero is considered to be true, whereas zero is considered to be false. Inside this expression, you can use curly braces, the standard expression, curly brace notation, to reference tags as well as chart scope variables like that. I have a chart over here that shows how this is done. These expressions are referencing the built-in runningTime variable, which is a built-in variable on chart scope that just represents the number of seconds the chart has been running. And you can see that it compares it to a number of different seconds, and so if we start this chart and monitor it, we can see the effect that the transition has on the chart. When the transition is false, which is this empty red rectangle, the step above it continues to run, and when it's true, flow continues down through it. When using a tag reference inside of a transition expression, you need to make sure to include the tag's provider in its tag path. For example, if I were to simply right-click on a tag and copy its tag path from the default provider here and paste it in, it wouldn't have the correct provider, which you're going to need because, of course, sequential function charts aren't part of the project, so they can't take advantage of the project's default tag provider. One convenient thing to know is that the transitions are drop targets for tags. You can simply drag a tag on top of a transition, and the transition will automatically be bound to that tag, including the correct tag provider in its path. Things get more interesting when charts are used for conditional logic. When a chart branches, transitions can be used to pick which branch of the chart will execute. The chart will evaluate all of these conditions with a bias from left to right. For example, it will evaluate this transition before this transition. If all the transitions are false, whichever one becomes true first will be picked, but if some of the transitions are already true when the chart reaches this section, the one on the left will be picked. Let's see an example of how to use tags to control how a chart flows. I'm going to bind them both to the Choice tag and then say Choice='A', Choice='B'. And if we run this chart, we can see that Choice is neither A or B because the Choice is just empty string. And if I were to edit this tag, let's go for Choice B. This branch of the chart has been executed. You can think of these multiple transitions off of a split kind of like an if block. We're saying if this condition, else if this condition. And if you want a catchall else block, you can do something like this where you have the rightmost transition set up to just the simple expression of true. Let's go ahead and name this step ELSE. That way if we get to that section and the choice is neither A nor B, that rightmost branch is going to be followed. Transitions also have a Timeout option. The Timeout option if enabled will set a flag on chart scope to be true after the specified amount of delay in milliseconds has elapsed. For example, let's say we only want to wait for the Choice to become A for five seconds, and after that five seconds is up, we want to set the flag, let's call it Other. And then this transition might watch for that flag to be set. If the Choice doesn't become A or B for five seconds, we're going to follow this rightmost branch. Nothing's true, so we're just waiting here at the begin step, and then after five seconds, we follow the other rightmost branch here. It's important to realize that when you enable the Timeout condition on a transition, it doesn't make that transition just become true after that amount of time. It simply sets a flag. You can use that flag to trigger a different transition on the chart, or if you wanted to trigger in the transition that you're on, you could simply use an OR operator and watch for your own flag right inside of this condition.