Description

Learn the rules of what makes an SFC structure valid or invalid. When the chart is invalid, compilation errors are displayed.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we'll discuss and demonstrate a number of rules that must be followed in order for any Sequential Function Chart to compile correctly. If a chart doesn't compile, we'll see this Chart Invalid indicator over on the right in the Chart Design section, and the chart won't be able to start executing. The first rule to keep in mind is that each element in your chart must have a valid connection to another element. Whenever there's an element that has dangling connections, that creates a compilation error. To make this chart valid, let's create a few Action Steps. We'll add an End Step, and then connect them all together from top to bottom. Now it shows that the chart is valid, because there are no elements awaiting a connection to another element. Another thing to make sure to always do is to ensure that all scripts and transition expressions don't have any syntax errors. If we drop a Transition element in between Action Steps S1 and S2, then in the condition for it, let's say we try to reference a variable, but forget we don't use a double equals in our Expression Language, it will show that the chart is now invalid.

[01:17] And if we go up here and click Show Errors, it will show right where the error is, and if we mouse over it, it will tell us it's an invalid syntax and right where the error is. So if we go back and fix that, make it a single equals, instead, we see it once again becomes a valid chart. One other thing to be mindful of, Transition Elements, use the Expression Language syntax, whereas Action Step scripts use the Python-like syntax, or Jython. Another rule we need to follow is that whenever the chart branches into multiple directions, all of the branches must lead to a transition First. To demonstrate, let's first delete the transition Action Step S2 and its adjacent connection. Then add branching like so. Then if we add transitions on the left and in the middle, we can't add an Action Step on the right.

[02:17] This will create a compilation error, because the chart can't execute an Action Step at the same time as waiting for the transitions to become true. And if we mouse over the error, it will remind us that the elements must lead to another element or a group of transitions. But if we delete the Action Step and replace it with another Transition, we see that the chart is valid once more. Another rule to know is that for any Parallel elements like this one, any parallel branches that we start must reach the bottom. So if we add one Action Step and connect it, this results in a valid chart, since this path reaches the bottom. But if we start a parallel branch, but leave it dangling, that will cause a compilation error.

[03:08] We can fix this by simply adding a Transition to complete the path. Finally, the last thing that's good for us to know is, charts do not need an End Step. They can loop back upon themselves. So if we delete this End element, the chart is now invalid since the parallel section is awaiting a connection beneath it. But that connection can if we'd like loop back up to the top. So let's do that, using a combination of a Jump and an Anchor. Now our chart is valid again because now we have a closed loop path. So now we've seen the basic rules we need to keep in mind, in order to make sure our charts compile successfully.

You are editing this transcript.

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