Animated Graphics

 

PSCAD includes the ability to animate graphic objects and text labels. The Animated Graphics feature functions by re-evaluating the graphical state of a component during the course of a simulation run, where the value of a parameter that is marked as animated is updated periodically by EMTDC. These parameter value updates in turn, change the state of the graphics or text, to which it is linked, creating an animated effect.

 

There are three aspects involved in setting up animated graphics:

NOTE: Before running and testing your animated graphics design, ensure that the animated graphics feature is enabled in the project settings.

Parameters

Parameters, involved in the Animated Graphics feature, are identified and setup within the component definition parameter section. It is recommended of course that the parameter data type corresponds with the data type that is being returned from EMTDC.

 

The following parameters are supported for use with animated graphics:

NOTE: Only real and integer field parameter values are supported for use when working with multiple instance modules (text is not). For example a breaker component, which indicates its state with a green or red graphic, and that existed in a multi-instanced module, is saved and updated even when not being viewed.

Every parameter that is used in graphics animation, must be labelled as such. This is done so by setting its Animated property to True.

 

 

See Value Fields for more on setting parameter field properties.

The Parameter Is Just a Vessel

When real or integer Value Field parameters are identified for use with Active Graphics, the actual value entered in the parameter field is just a place holder, and not actually considered during the simulation run. The parameter instead acts as a vessel, through which internally stored values from EMTDC are passed. These values from EMTDC are defined within the component script, which is discussed later in this topic.

Graphics

A text label can be used to display the value of an animated parameter, in the same way as it displays the value of a non-animated parameter, including being part of expression statements. To indicate that a text label should display the contents of a parameter use the substitution operator.

 

 

 

EXAMPLE 1:

 

A user adds three text labels to a component definition graphic canvas, whose contents are defined by a parameter value field with Symbol name ani_val.

 

ani_val Parameter Properties

Three Text Labels on the Graphic Canvas

 

Where the text label contents are specified as follows:

 

Text Label 1 Properties

Text Label 2 Properties

Text Label 3 Properties

 

The resulting display on the component graphics would appear as:

 

 

 

 

At this point, we still have not setup a full animated graphics control: So far we have simply linked some text labels to a parameter value field that has been identified as Animated. Full implementation is discussed later on in this topic. When fully implemented, the value of the parameter ani_val may updated during the simulation run, and the text label text will change accordingly (that is, be animated).

 

 

 

EXAMPLE 2:

 

Continuing from EXAMPLE 1, a user now adds a second animated parameter value field with Symbol name ani_sel, along with an arrow graphic object, whose visibility is to be controlled by the state of ani_sel.

 

ani_sel Parameter Properties

New Arrow on the Graphic Canvas

 

Where the graphic object contents are specified as follows:

 

Arrow Graphic Properties

 

In this case the arrow will appear only when ani_sel is equal to 1.

 

 

Script

The final step in setting up Animated Graphics, is to instruct to EMTDC to provide the required quantities to pipe through the parameters, and thereby control any graphic objects or text label contents.

 

There are several EMTDC intrinsic subroutines that can be utilized to update the animated parameters during runtime:

The arguments of these subroutines are described as follows:

 

 

EXAMPLE 3:

 

Continuing from EXAMPLE 2, a user now adds script to provide the final step in automating the text labels in EXAMPLE 1 and the arrow graphic in EXAMPLE 2.

 

! My Animated Component

!

#LOCAL REAL    REAL_VALUE

#LOCAL INTEGER INT_VALUE

!

      IF (TIME .LT. 0.25) THEN ! If the simulation time is less than 0.25 seconds...

         REAL_VALUE = 2.0

         INT_VALUE  = 0

      ELSE                     ! Otherwise...

         REAL_VALUE = 3.0

         INT_VALUE  = 1

      ENDIF

!

      CALL COMPONENT_ID(ICALL_NO,$#Component)  ! Get the component call number ICALL_NO.

!

      CALL PSCAD_AGR2(ICALL_NO,$#Component,REAL_VALUE,"ani_val")  ! Define ani_val value.

      CALL PSCAD_AGI2(ICALL_NO,$#Component,INT_VALUE,"ani_sel")   ! Define ani_sel value.

!

 

The above code will change the value of the ani_val and ani_sel parameters during the run. The change in these values will affect the text labels and arrow graphic during the run.