AVEVA InTouch for System Platform Archives - Industrial Software Solutions https://industrial-software.com Your "Select" digital transformation & sustainability experts - let us take you there Mon, 06 Nov 2023 16:14:14 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.4 https://industrial-software.com/wp-content/uploads/cropped-iss-favicon_wordpress-size_20220121-32x32.png AVEVA InTouch for System Platform Archives - Industrial Software Solutions https://industrial-software.com 32 32 Utilizing the ShowGraphic() Function https://industrial-software.com/training-support/training-documents/td013/ Fri, 13 Oct 2023 17:53:23 +0000 https://industrial-software.com/?post_type=wwpw_training_doc&p=27448 The Show/Hide Graphic script functions allows you to use QuickScript .NET to display a graphic as a pop-up window and close the pop-up window. The functionality is similar to the Show Symbol animation, but improves upon the limitations of the animation. This training document will walk you through how to use the ShowGraphic() function.

The post Utilizing the ShowGraphic() Function appeared first on Industrial Software Solutions.

]]>
OVERVIEW

The Show/Hide Graphic script functions allows you to use QuickScript .NET to display a graphic as a pop-up window and close the pop-up window. The functionality is similar to the Show Symbol animation, but improves upon the limitations of the animation. This training document will walk you through how to use the ShowGraphic() function in two sections:

  • Basic ShowGraphic Usage
  • Advanced ShowGraphic Usage

This document assumes basic knowledge of WindowMaker, Industrial Graphics, and Graphic Editor.

APPLIES TO

  • InTouch HMI (all versions), Operations Management Interface

EXPLANATION

With ShowGraphic, you can create a more navigable application, call multiple graphics with a single button click, drill down on specific processes, and more. The function consists of a number of properties that allow for further specifications to be made.

Required ShowGraphic Script Lines

The minimum ShowGraphic script must contain the following four lines:

Dim graphicInfo as aaGraphic.GraphicInfo;
graphicInfo.Identity = "<Identity>";
graphicInfo.GraphicName = "<SymbolName>";
ShowGraphic( graphicInfo );
  1. GraphicInfo is a structure that holds the definitions, configuration options, and properties that describe the popup window. This line defines an instance of GraphicInfo named “graphicInfo”.

2. Identity is a required property that needs a unique string value. The Identity holds the configuration options for a single pop-up window, and multiple scripts can use the same Identity. For each new set of configuration options, a new Identity must be defined.

    • You can use ShowGraphic to open an existing native InTouch window by using the syntax:
      graphicInfo.Identity  = InTouch:WindowName

3. GraphicName is the name of the graphic to be shown in the pop-up window. This line is optional, as the Identity property can be used to call an already existing window.

    • It is also possible to call an existing window using the Identity property and still call a new symbol into that window by using the GraphicName property. This can be useful if you want to specify the dimensions/location of the window within WindowMaker, instead of setting those properties within the script.

4. The ShowGraphic(graphicInfo) line invokes the function with the specified properties defined for our instance of GraphicInfo, “graphicInfo” This must be the last line after all other parameters are set, as this is the line that actually invokes the function.

Script Function Browser

For a full list of Properties, open a graphic in Graphic Editor and open the QuickScript .NET editor by right-clicking the canvas -> Scripts:

Then from the Edit Scripts window, click the Display Script Function Browser button to display the Script Function Browser:

In the Script Function Browser window, expand Graphic Client -> ShowGraphic and click the Help button:

This opens the ShowGraphic() documentation which contains a full list of Properties with their Data Type, Default Value, list of acceptable values, and an example. You can also click the OK button instead of Help to load the specified function into the QuickScript .NET editor. You can also view the full list of properties in “Working with the Show/Hide Graphics Script Functions,” in the Creating and Managing Industrial Graphics User Guide.

Any properties used in this training document will be defined within the step as well.


IMPLEMENTATION

Section 1 – Basic ShowGraphic Usage

In this section, we will call the ClockAnalogWall Industrial Graphic from the Industrial Graphics Library into a pop-up window, retaining all the default ShowGraphic() settings.

  1. To start, create a new symbol called OpenClock and open this symbol for editing. The Graphic Editor opens.

2. Place a button element on the canvas named OpenClock, with the text property set to “Open Clock”.

3. Double-click OpenClick to open the Edit Animations window. Click the + button to create a new Action Scripts animation. Here, you can either load in the Required ShowGraphic Script Lines using the Script Function Browser or by typing/copy and pasting these four lines:

Dim graphicInfo as aaGraphic.GraphicInfo;
graphicInfo.Identity = "<Identity>";
graphicInfo.GraphicName = "<SymbolName>";
ShowGraphic( graphicInfo );

4. Since we are not calling an existing window, we can configure the Identity property as follows:
graphicInfo.Identity = "ClockPopup";

In addition, we know we want to show the ClockAnalogWall symbol in the window, so we can configure the GraphicName property as follows:
graphicInfo.GraphicName = "ClockAnalogWall";

5. Save and Close the symbol. Embed the OpenClock symbol into a window of your choosing and open WindowViewer. With the specified window open, click the “Open Clock” button and observe the ClockPopup window appear with the default size and location.


Section 2 – Advanced ShowGraphic Usage – Setting Window Location and Dimensions

In Section 1we called the AnalogClockWindow in a default pop-up window, meaning we did not define any specific location or dimensions. In this section, we will provide a specific location and size for the pop-up window. We will configure ShowGraphic() to open the ClockAnalogWall symbol in a 500×500 window at the top of the screen.

  1. Open the OpenClock symbol for editing and duplicate the OpenClock button element to create a new button called OpenClockTop with Text = “Open Clock at Top”.

2. Double-click OpenClockTop to open the Edit Animations window. The previous ShowGraphic() script is present. Since we want this to open a brand new window, we will need to specify a new Identity. Modify the Identity line as follows:
graphicInfo.Identity = "ClockPopupTop";

Our new lines will be added after line 3, but before line 4. The ShowGraphic(graphicInfo); line must always be the last line.

3. First we will specify the window location. We will have our window pop-up in the top-center, relative to the desktop. To accomplish this, we will use the WindowLocation property.

WindowLocation

Specifies the location of the pop-up window.

Data Type
Enum

Default Value
Center

Valid Range
One of 0–12. Each WindowLocation option has an associated integer that can be used to define the Property, as seen in the table below:

Enumerations
WindowLocation Integer
Center 0
Above 1
TopLeftCorner 2
Top 3
TopRightCorner 4
LeftOf 5
LeftSide 6
RightSide 7
RightOf 8
BottomLeftCorner 9
Bottom 10
BottomRightCorner 11
Below 12
Additional Information
If you have selected Desktop as the window relative position, Above, LeftOf, RightOf, and Below are invalid. 

Enter a new line after Line 3, and type the following to have the pop-up appear at the top of the screen:

graphicInfo.WindowLocation = 3;

NOTE: The default relative window location is “Desktop”, so we do not need to add a line to specify the WindowRelativePosition parameter. If you did not want the window location to be relative to the desktop, you could specify the WindowRelativePosition parameter in conjunction with WindowLocation as follows:

WindowLocation

Specifies the location of the pop-up window.

Data Type
Enum

Default Value
Desktop

Valid Range
One of 0–8. Each WindowRelativePosition option has an associated integer that can be used to define the Property, as seen in the table below:

Enumerations
WindowRelativePosition Integer
Desktop 0
Window 1
ClientArea 2
ParentGraphic 3
ParentElement 4
Mouse 5
DesktopXY 6
WindowXY 7
ClientAreaXY 8
Examples
graphicInfo.WindowRelativePosition = aaGraphic.WindowRelativePosition.<WindowRelativePosition>;
graphicInfo.WindowRelativePosition = 1;

4. Now we will specify the Width and Height of the window to make it a 500×500 window. To accomplish this, we will need to use the RelativeTo, Width, and Height parameters, defined below.

RelativeTo

Specifies the size of the pop-up window relative to the graphic, desktop, or customized width and height.

Data Type
Enum

Default Value
Graphic

Valid Range
One of 0–2. Each RelativeTo option has an associated integer that can be used to define the Property, as seen in the table below:

Enumerations
WindowRelativePosition Integer
Graphic 0
Desktop 1
CustomizedWidthHeight 2
Width

Specifies the width of the pop-up window.

Data Type
Integer

Default Value
100

Valid Range
0–10000

Additional Information
Applicable only if RelativeTo is CustomizedWidthHeight. You can specify either the height or the width of the pop-up window. The system calculates the other, based on the aspect ratio of the symbol. If you enter an out-of-boundary value, the system shows an "Out of range" message at run time. If the value > 10000, it is set at 10000. If the value < 0, it is set at 0.
Height

Specifies the height of the pop-up window.

Data Type
Integer

Default Value
100

Valid Range
0–10000

Additional Information
Applicable only if RelativeTo is the value of the CustomizedWidthHeight parameter. You can specify either the height or the width of the pop-up window. The system calculates the other, based on the aspect ratio of the symbol. If you enter an out-of-boundary value, the system shows an "Out of range" message at run time. If the value > 10000, it is set at 10000. If the value < 0, it is set at 0.

Using the above parameters to create a 500×500 window, enter a new line after line 4, and type the following:

graphicInfo.RelativeTo = 2;
graphicInfo.Width = 500;
graphicInfo.Height = 500;

5. Click OK. Then Save and Close the graphic. In WindowMaker, note that the OpenClock graphic embedded in a window of your choosing has updated to show the new button.

6. With the specified window open, click the “Open Clock at Top” button and observe the ClockPopup window appear at the Top-Center of the screen in a 500×500 window.

Since the two buttons have different Identity properties defined, it is possible to click each button and have two clock windows show simultaneously.

If the same Identity had been used, each button would respectively close the other window that had opened before.

The ShowGraphic() function is the most versatile option for displaying windows. As a reminder, you can also view the full list of properties as their definitions and examples in “Working with the Show/Hide Graphics Script Functions,” in the Creating and Managing Industrial Graphics User Guide.

The post Utilizing the ShowGraphic() Function appeared first on Industrial Software Solutions.

]]>
Using Scripting to Enhance the AVEVA Alarm Client Control https://industrial-software.com/training-support/training-documents/td008/ Sun, 08 Oct 2023 22:15:28 +0000 https://industrial-software.com/?post_type=wwpw_training_doc&p=27323 The AVEVA Alarm Client Control is a .NET control available in all Standalone + Symbols and Managed InTouch applications in 2020 and newer. Since it is a .NET control, it has a number of built-in properties and functions that can be used to enhance the basic Alarm Client functionality. In this training document, we will utilizes these options and create several buttons to perform Alarm Acknowledgement and Alarm Filtering.

The post Using Scripting to Enhance the AVEVA Alarm Client Control appeared first on Industrial Software Solutions.

]]>
OVERVIEW

The AVEVA Alarm Client Control is a .NET control available in all Standalone + Symbols and Managed InTouch applications in 2020 and newer. Since it is a .NET control, it has a number of built-in properties and functions that can be used to enhance the basic Alarm Client functionality. In this training document, we will utilizes these options and create several buttons to perform the following functionality:

  • Alarm Acknowledgement
    • Acknowledge all alarms
    • Acknowledge selected alarms
  • Alarm Filtering
    • Call a pre-defined Query/Filter

This document assumes you have knowledge on alarms, alarm groups, creating button elements, and configuring animations in the Industrial Graphic editor. For information on configuring a basic AVEVA Alarm Client Control, please see ISS TN 95. A full list of the properties and scripts can be found in the Alarm Client Control Guide starting on Chapter 4.

For the purposes of this Training Document, you can download and use the AlarmClientTraining application which contains a basic Alarm Client which we will be building on and 5 tags in alarm state for testing purposes.

The application can be downloaded Here

NOTE: The training application can be used in InTouch version 2020 and newer. You can also use your own basic Alarm Client as a starting point.

APPLIES TO

  • InTouch HMI (all versions)

EXPLANATION

Overview on .NET Control Properties and Methods

A Property is used to access or set a value of a particular component of the .NET control. A Method is used to perform some action for the control. Methods sometimes require Parameters which are values to provide to the Method so that it can do something with these values. You can pass Arguments to the Parameters by typing the values to pass within parentheses.

For example, let’s look at the Ack.All() method:

The Ack.All method acknowledges all alarms in the Alarm Control, including those not shown.

Syntax
AlarmClient.Ack.All(AckComment);
Parameters
AckComment
A string indicating the alarm acknowledgement comment.

So if we wanted to utilize this method, we would need to provide a string value Argument that the Method would utilize for the AckComment Parameter.

Example
AlarmClient1.Ack.All("Alarm is acknowledged");

This script acknowledges all alarms and provides each alarm the alarm comment: “Alarm is acknowledged”.

 

Scripting .NET Controls in QuickScript .NET

When scripting the .NET controls, you must make note of their Graphic Name in the Industrial Graphic Editor. In our example, our Alarm Client retains the default name AlarmClient1.

Any scripting of .NET controls follows this basic format:
AlarmClientGraphicName.Property
or

AlarmClientGraphicName.Method

or, when the method is built-in to another property

AlarmClientGraphicName.Property.Method

The QuickScript .NET editor provides a way to view the properties and methods once you’ve typed in the Graphic Name in the script editor. If you type AlarmClientGraphicName, the QuickScript .NET editor will provide a list of properties and/or methods.

You can also use this auto-complete feature to view any Parameters required for a particular Method, by typing “MethodName(”


IMPLEMENTATION

Alarm Acknowledgement

Section 1 – Acknowledge All Alarms

There are several properties and methods you could use to acknowledge all alarms. In this document, we will be using the Ack.All() method, previously discussed in the Overview on .NET Control Properties and Methods section.

  1. Open AlarmClientTraining in WindowMaker. Open the Live_Alarms window and then right-click the Alarm Client symbol -> Industrial Graphic “Alarm_client” -> Edit Symbol… to open the Alarm Client symbol for editing.

2. Create a Button element named AckAll. In Properties -> Appearance -> Text, enter Ack All. Position it below the Alarm Client element.

3. Double-click AckAll to open the Edit Animations window. Click the button to add a new Interaction -> Action Scripts animation.

4. In the body of the script, type:

AlarmClient1.Ack.All(“Acknowledging all alarms.”);

And then click OK to save/close the Edit Animations window. Save and close the graphic editor.

5. To test the button, open WindowViewer and open the Live_Alarms window. 5 alarms should appear. Click the Ack All button and observe the behavior.

All alarms become acknowledged, and the AlarmComment field is set to our specified Argument, “Acknowledging all alarms.”. Close and reopen WindowViewer to regenerate the alarms for further testing if you choose.

 

Section 2 – Acknowledge Selected Alarms

You can acknowledge individual alarms in the Alarm Client by right-clicking an alarm record -> Ack Selected. However, this functionality can also be added to a button. We will use the Ack.Selected() function.

Syntax
AlarmClient.Ack.Selected(AckComment);

Parameters
AckComment
A string indicating the alarm acknowledgement comment.

Example
AlarmClient1.Ack.Selected("This selected alarm is acknowledged");
  1. Open AlarmClientTraining in WindowMaker. Open the Live_Alarms window and then right-click the Alarm Client symbol -> Industrial Graphic “Alarm_client” -> Edit Symbol… to open the Alarm Client symbol for editing.

2. Add a new button named AckSelected to the right of Ack All, or a place of your choosing below the Alarm Client if you did not make the Ack All button. In Properties -> Appearance -> Text, enter Ack Selected.

3. Double-click AckSelected to open the Edit Animations window. Click the button to add a new Interaction -> Action Scripts animation.

In the body of the script, type:

AlarmClient1.Ack.Selected(“Alarm acknowledged”);

And then click OK to save/close the Edit Animations window. Save and close the graphic editor.

4. To test the button, open WindowViewer and open the Live_Alarms window. 5 alarms should appear. Select one or more (ctrl + click) alarms and then click the Ack Selected button and observe the behavior.

In this example, I used ctrl + click to select “Bool_Alarm3” and “Int_Alarm2”. Then I clicked the Ack Selected button, and they became acknowledged. In addition, the AlarmComment field is set to our specified Argument, “Alarm acknowledged”. Close and reopen WindowViewer to regenerate the alarms for further testing if you choose.

Alarm Filtering

Section 3 – Call a Pre-Defined Query/Filter

One way that we can set our Alarm Client to show a specific Alarm Group is to use a pre-defined Query/Filter. For Live Alarms, Queries are used to filter alarms. For Historical Alarms, Filters are used.

We can then call that Query/Filter by using the Favorite Property.

The Favorite property is a read-write string property that gets or sets the name of the current query filter favorite.

Syntax
QueryFilterName = AlarmClient.Favorite;
AlarmClient.Favorite = QueryFilterName;

Parameters
QueryFilterName
The name of a query filter favorite.

Example
The following example sets the current Alarm Control grid to the Query Filter Favorite with the name "All Hi Priority Alarms".
AlarmClient1.Favorite = "All Hi Priority Alarms";

  1. Open AlarmClientTraining in WindowMaker. Open the Live_Alarms window and then right-click the Alarm Client symbol -> Industrial Graphic “Alarm_client” -> Edit Symbol… to open the Alarm Client symbol for editing.

2. Double-click AlarmClient1 and choose Queries and Filters from the Configuration options.

3. Since this is a Live Alarms client, click the + button above Queries to add a new one. The Add Query or Filter window opens.

4. Name the Query “Discretes”. Select Group from the list and click the green right arrow. Then select Group from the middle pane, type “BooleanTags” in the value field, and click Set.

In the AlarmClientTraining application, BooleanTags is a defined Alarm Group. The three Discrete tags have BooleanTags configured for their alarm group, whereas the two Integer tags have $System set for their alarm group.

5. For Live Alarms, a provider must also be specified. Select Provider from the and click the green right arrow. Then select Provider from the middle pane, type “InTouch” in the value field, and click Set.

Click OK to close the Add Query or Filter popup. Then click OK again to close the Edit Animations window.

6. Add a new button named Discretes to the right of Ack Selected, or a place of your choosing below the Alarm Client if you did not make the Ack Selected button. In Properties -> Appearance -> Text, enter Discretes.

7. For the purposes of this document, we will create a Discretes button that utilizes a pushbutton “Toggle” animation. Clicking the button will set the Query to “Discretes”. Clicking the button again will set our filter to back to “Default”. Double-click Discretes to open the Edit Animations window. Then click the button to add a new Interaction -> Action Scripts animation.

In the body of the script, type:

AlarmClient1.Favorite = “Discretes”;

And then click OK to save/close the Edit Animations window. Save and close the graphic editor.

8. To test the button, open WindowViewer and open the Live_Alarms window. 5 alarms should appear. Then click the Discretes button. The Alarm Client should now show 3 alarms from the discrete tags only, and the Query is set to “Discretes”.

 

The post Using Scripting to Enhance the AVEVA Alarm Client Control appeared first on Industrial Software Solutions.

]]>