Description

Chart scope is used to store information for a chart instance that can be used in any Step or Transition. The variables are stored in a Python dictionary.

Video recorded using: Ignition 7.9

Transcript

(open in window)

[00:00] Each Chart Instance gets its own Chart Scope. A Chart Scope is a place where variables can be stored for the lifespan of the Chart Instance. Even if a single Chart definition has many instances running, they each get their own separate Scope Object. The variables inside the Chart Scope are accessed by the steps and transitions of the Chart. Let's see a quick example of this. So, first I'm going to create an Action step that initializes a new variable in Chart Scope. So, I'm going to write an On Start Action, and you can see that the On Start Action is given a variable named chart. This is a reference to the Chart Scope. A Chart Scope is stored as a Python Dictionary Object, and creating a new variable in it is very easy. I can just type chart dot MyValue, is equal to five. This defines a new variable called MyValue, and assigns it to the value five, which is an integer. Now, the values inside of the Chart Scope don't have to be scale or values like integers or floats. They could be complex data types, they could be Python lists or Ignition data sets, really anything that you could store in a Python Dictionary. So, this is how we can create a new variable in Chart Scope. Now, let's use this variable to control the Chart flow by referencing it in a Transition. So, I'm going to have two Transition here. The left one is going to be a reference to my variable. So, in a Transition expression, I can reference variables in Chart Scope directly using squiggly brackets. So, I can just say MyValue not equaled five, versus, I'll just copy this, MyValue equal to five. And, when we run this chart, we will see that it followed the MyValue equals five branch because I initialized it to be five in Step S1. You can also see here in the Chart Monitoring Panel, this shows you the Chart Scope, all of the variables in Chart Scope. So, you can see there's MyValue equal to five, as well as some other values that are automatically placed in Chart Scope for you. If we bring up the User Manual here, under Sequential Function Charts, Scripting Reference, you can see a definition of all of the variables that you get automatically in your Chart Scope, and what they all mean.

You are editing this transcript.

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