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 training@inductiveautomation.com.
Version:
LESSON LIST
LESSON
Pause, Resume, and Cancel
Description
Learn how to pause and resume running charts, as well as cancel already running chart instances.
Video recorded using: Ignition 8.1
Transcript
(open in window)[00:00] After a chart has been started, we get access to additional chart controls, allowing us to pause, resume, and cancel a chart. On the screen I have this SFC named Looper and it has a running instance. I'll access the charts monitor so we can better see these controls. Let's start with seeing what happens when a chart is paused. When I click on pause here during the S two action step, the chart pauses very quickly and it enters the paused state, which is represented by this light blue fill color. When pausing a chart, the chart must wait for any currently executing actions to finish before becoming paused. So let me resume the chart here by clicking on resume. Once resumed, it will continue running as before. I'll pause the chart now on this S1 action step and you'll see it sits in the green active state for a few seconds before becoming paused. This is because the S1 action step contained some execution, whereas my S2 action step was empty. Canceling a chart also shares this functionality as it will allow for any currently executing actions to finish before becoming canceled.
[01:07] So if I decide to cancel this chart during the S1 action step, we'll see it stay in the green active state again for a few seconds before the chart becomes canceled. Canceling a chart will also make the chart stop, but it stops in a slightly different way than if the chart had reached the end step. When a chart reaches an end step, the on stop event script will run, whereas if a chart was canceled, then the on cancel event script will run. One last thing to note about canceling is that you can cancel an SFC regardless if a chart is in a running or a paused state. Now let's look at the other ways that pausing, canceling and resuming can be achieved. So we've already seen one of them here in the designer. Under the chart control panel, we have pause, resume and cancel buttons, which take effect on the selected SFC instance, but that's not the only way. We can also use the SFC monitor component within a vision client to pause, resume and cancel. I'll go ahead and start up two instances of the Looper chart and tab over to my vision window chart monitor one.
[02:04] When I go into preview mode, I can right click on a chart from the instance list, which provides me a context menu with the pause resume and cancel functions. I'll go ahead and pause this chart and we can see it come to a stop. I can open up the menu again and click on resume to continue the chart. And of course we always have the option to cancel the chart at any time. You can also pause, resume and cancel via scripting from anywhere in the system that you can run a script. In this case, I've mocked up a system that uses pause, resume and cancel scripts in a vision window named chart monitor two. On this window we see I have another SFC monitor component along with three buttons representing the pause resume and cancel functions. I'll go back into design mode to review the pause button script. I'll do so by right clicking into the scripting option for the button. The button's action perform script first gathers the instance ID from our SFC monitor component. The ID is pulled from whatever chart is currently being viewed by the component. That ID is then passed to the system function system.sfc.pauseChart(), which will pause the instance of the chart matching the instance ID.
[03:11] And for my other buttons they gather the instance ID in the same way as the pause chart button, but they use their corresponding SFC system function. So the resume button passes the ID to system.sfc.resumeChart(), and likewise the cancel button passes the ID to system.sfc.cancelChart(). So if I go into preview mode and select this running chart, you can see I can use the buttons to pause the chart, resume the chart, and finally cancel the chart. If you want more detailed information on how these SFC functions are working, check out our user manual system functions page within the appendix, and those are all the different ways in which you can pause, resume, and cancel an SFC.