Description

Learn about the different execution modes (Callable and RunAlways) that charts can run in, as well as options (Persist State, Redundancy Sync) and events scripts (On Start, On Stop, On Cancel, On Abort, On Redundancy Failover) that are attached to the chart.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we're going to look at the overall properties of a chart itself. Whenever you open up a chart, you can click on any empty space in the background and the Elements Property Editor will switch to editing the properties of the chart itself. Anytime you're editing a chart, you can just go ahead and click right on the background and get back to those chart properties. The first setting to look at is the execution mode of the chart. By default, all charts start in Callable execution mode. Callable execution mode means that any number of instances of the chart can be executed or called from anywhere. You might have 0 instances running or you might have 100 instances running of your chart. Run Always mode means that the Ignition system itself is going to automatically start a single instance of your chart. The idea here is that you always want just one instance of a chart running.

[01:05] So for example, if we open this chart, we notice that when it's in Callable mode, it has no instances running. But if we switch it to Run Always mode, then save that change, the system is going to go ahead and start one instance of the chart. But if we try to start another instance, it'll tell us we can't because it's in Run Always mode. Whenever we start up a gateway, it's going to start one instance of all of its Run Always charts, but it's up to us to design each chart to stay running. So for example, this chart is designed to stay running forever. It will just loop around forever and ever. But if we had a chart that had an End Step on it and the chart reached that End Step, the instance would stop and the system's not going to start another instance for you. So it's up to us to design a chart that just runs continually.

[02:05] Now that we've seen how this chart starts up, we'll go ahead and cancel execution of this chart. It may take a moment or two for it to halt execution. The last execution mode is Disabled, which means that no instances of that chart are going to be able to be started. The next property to discuss is Persist State. Persist State means that upon shutdown, the gateway is going to pause all of the charts that are in persist state mode, and then remember what they were doing. It will save the state of the chart to a file on disk so that when the gateway starts back up, it can try and start up all of those instances where they had left off. Now, in order for this to work well, you need to design your charts to be responsive, which is something we're going to cover in a later lesson about chart best practices. It's also important to understand that by having Persist State checked, obviously your chart isn't going to be running when the gateway is stopped, it's going to be paused, and then when the gateway is started again, it will be resumed.

[03:10] Also, if the gateway stops for an unexpected reason like a power loss, it's not going to record the state in that case. So if you need a chart that's going to be running across unexpected shutdowns, you're going to want to set up a redundant system. The next property to discuss is Redundancy Sync. Its default setting is false, but if it is selected, the chart state and parameters will be synchronized across a redundant cluster, allowing a backup node to continue after chart execution. For more specifics, please refer to the user manual section on SFC chart properties. Finally, we have various events scripts. These are scripts that are specified on the chart that can respond to changes in the chart lifecycle. Let's expand this pane just a bit to examine them. We have an On Start script that of course runs when the chart is started.

[04:08] On Stop is run when the chart stops, which means it has reached an end step. On Cancel is run when the chart is canceled. For example, if somebody were to click on a running chart in the Chart Control panel and then click its Cancel option, the On Cancel script would be invoked. On Abort is called if there's an unexpected error somewhere else in chart execution. In this script, you will see that there is a new variable in your chart scope called abortCause, and that's going to be the exception that caused the chart to abort. So using this event, you can detect why the chart aborted. Finally, for On Redundant failover, this script gets called once if the chart is activated due to a redundancy failover. So now we know a bit about the various chart properties available for Sequential Function charts. Again, for more specifics, please refer to the User Manual section on SFC chart properties.

You are editing this transcript.

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