30805_LAB HMIWeb Display Builder Basic Scripting
30805_LAB HMIWeb Display Builder Basic Scripting
Contents
Create a Script to Restrict Operator Action.......................................................................................... 3
The purpose of this lesson is to demonstrate script writing to restrict Operator actions.
After completing this LAB, you will be able to:
Create scripts to restrict Operator actions that exceed SP operating limits.
Prerequisites
An Experion PKS Server and HMIWeb Display Builder (for completion of lab exercises)
All points downloaded and active in Control Builder
Introduction
TIP
Step Action
1 If you have performed the previous lab as per pre-defined course sequence then open
dynamic shape Loop.sha which you have built from C:\ProgramData\Honeywell\
Experion PKS\Client\Abstract, else open the Loop.sha shape from C:\ProgramData\
Honeywell\Experion PKS\Client\DisplayDB
This shape will be modified to call a Popup that resembles a custom faceplate.
(The Popup will be scripted to restrict the amount of SP change allowed.)
2 In Object Explorer, expand the loop.sha group to expose the individual components that
make up the group.
Step Action
3 Working in Object Explorer, select the alphanumeric that represents the SP value, right
click and select Property pages. (Your SP alphanumeric may have a different name.)
4 On the Behaviors tab of the SP alphanumeric, deselect Faceplate and Hover and select
the Popup option.
Step Action
5 Select the Popup tab and browse to the file 11_FC01_SP.htm in your Abstract folder:
C:\ProgramData\Honeywell\Experion PKS\Client\Abstract\11_FC01_SP.htm
(This is a pre-built Popup that resembles the standard faceplate – it’s located in your
Abstract folder.)
6 Close the Properties window and Save As this shape display as Loop_Restrict.sha in
the abstract folder.
Close the Loop_Restrict.sha display.
ATTENTION
Step Action
ATTENTION
Step Action
8 On the Script Data tab, Select the Add button and enter the data shown.
Close the Properties window when finished.
9 Open Windows Explorer, browse to your abstract folder and, using notepad, open the
text file “RestrictScript.txt”. (This text file contains the script/code that will be used in
this scripting exercise.)
NOTE: The script written in the text file is for 3 different events i.e. onchange,
ondatachange, ondeactivate. You need copy the script content from the text file
"RestrictScript.txt" and paste it in the particular event in the script editor.
Step Action
10 Return to HMIWeb Display Builder and right-click the SP alphanumeric on the custom
faceplate; select Edit Script from the context menu.
Script will be added to the SP field that will restrict the amount of SP change to less than
5% of the point’s range.
Step Action
11 Using the Event Browser drop-down arrow, select onchange as the event.
Copy the script mentioned in onchange section from the text file” RestrictScript.txt”
and paste it in the onchange event in script editor.
TIP
NOTE: When reading a value from the system, as in checking if the mode is “AUTO”,
the value you are reading is a string which looks for an exact match. Therefore, the
value must be typed in CAPS as the system enumerations are capitalized.
12 Select ondatachange as the event and copy the script content for ondatachange
section from the text file "RestrictScript.txt" and paste it in the ondatachange event in
the script editor.
1 Select ondeactivate as the event and copy the script content for ondectivate section
from the text file "RestrictScript.txt" and paste it in the ondectivate event in the script
editor.
2 Close the script window, and save your Popup display in the Abstract folder.
4 Open the Properties of the inserted shape and enter the following details on the Custom
Properties tab:
5 Close the shape Properties window and add dashed lines for the new shape
connecting to Heavy Feed.
9 Select the SP field on the Popup and enter a value less than ± 5% of the SP range
(range 0 – 600).
If the change is less than the restricted amount, a message similar to the following is
displayed.
Click OK. The SP value for 11_FC01 is changed as shown in your T_100_SCP display.
You have restricted an Operator entry of more than the allowed limit, and the change is
cancelled.
To create a Popup, with bar indicators, showing critical temperature process values.
Prerequisites
An Experion PKS Server and HMIWeb Display Builder (to complete the lab exercises).
Introduction
It is essential to watch the tower temperatures to achieve optimum top-to-bottom product quality.
The following table lists 7 temperature sensors. These points provide critical process values.
Unit
Tag Description Range Units
11_TI26 D-100 Reflux 0 - 260 °C
11_TI25 T-100, Overheads 0 - 260 °C
11_TI24 T-100, Tray 23 0 - 260 °C
11_TI23 T-100, Tray 4 0 - 260 °C
11_TI22 E-100, Reboiler Inlet 0 - 260 °C
11_TI21 E-100, Reboiler Outlet 0 - 260 °C
11_TI20 T-100, Bottoms 0 - 260 °C
Create a Popup similar to the one illustrated below. Use bar indicators to show the temperature of
each tag. The tags are arranged from bottom to top on the Y-axis. The X-axis represents the
temperature range.
Textboxes on the left represent the tagnames of the points being represented by the indicator bars in
the center of the Popup. (The bars are indicating the tag’s DACA.PV parameter.)
In a real process environment, indicators bring in values from the field and do not permit data entry.
However, because we are in a “simulated” lab environment, add alphanumerics to the right side of
your Popup to allow a change to be made to the indicator values for testing purposes. (The
alphanumerics you add will access the tag’s NUMERICA.PV parameter on the Data tab and have
data entry enabled).
Step Action
2 Access the Properties of the display and modify the size to 400 x 400.
Change the color of the display to silver.
3 Select the Indicator tool and draw an object similar to the following example:
Step Action
4 Open the Properties of the indicator and select the Data tab.
Enter points and parameters from the Temperature Profile Example on the
page10.
Step Action
Step Action
8 Using script, we will assign the color lightslategray to the indicator bars if the
temperature exceeds 190 Deg C, and assign the color dimgray if the temperature goes
below 10 Deg C.
Using the Event Browser drop-down arrow, select OnUpdate as the event. (By
default, onactivate is the first event shown – be sure to select OnUpdate.)
Copy the script content from the text file (NotePad) “TempProfileScript.txt” located
in your abstract folder and paste it in the script editor OnUpdate event.
TIP
Step Action
9 Using the “me” syntax (as shown below) allows the script to be generic in regard to the
object it’s attached to copying script from one object to another requires no modification
to the object name because the script is directly attached to the new object and uses the
“me” identifier to refer to itself.
NOTE: In the above example script, elseif is written as one word. It can be written as
one word or two. However, if you write elseif as two words (i.e. else if), then you must
add another end if to comply with script syntax rules.
Also note the event being used: OnUpdate
10 Since the generic “me” identifier is used, all you need to do is create the first indicator
and add the script, then duplicate the Indicator and change the point in the Data tab.
11 When finished, close any open script window, and position the indicators on your display
similar to the Temperature Profile Display shown prior to Step 1 in the Introduction.
12 Save your display as TempProfile in the Abstract file. (It’s good practice to save your
displays periodically.)
Step Action
13 Add textboxes to show the tagnames on the left as shown below (or enter the tagname
in the tool tip field of each indicator.)
Create the X and Y-axis markers using lines and text.
Your textboxes and indicators should be positioned similar to the illustration below.
14 Add alphanumerics to the right of the indicators to show the temperature values. The
next step provides data tab details for the added alphanumerics.
Step Action
15 Modify the Data tab for each alphanumeric to display the relevant tag and parameter
NUMERICA.PV (remember to allow data entry for all alphanumeric.)
Step Action
17 Close the Properties window and save your display as TempProfile in your abstract
folder.
Step Action
20 On the Details tab, change the label from Button to Temp Profile.
21 On the Colors tab, use the Custom Color you defined in a previous lab exercise for the
button’s fill color.
23 Close the Properties window and save T_100_SCP in your Abstract folder.
Step Action
24 Call T_100_SCP in Station and test your PopUp by entering values => 190 and <= 10
in the numerics on the right side of the popup.
Open Detail Display for Alphanumeric at the right side of Pop up display, then select
chart. Enter the values for NUMERICA block (PV) which you wish to check.
ATTENTION
The color change of the indicators was done using script primarily
for the purpose of showing methods and scripting syntax.
However, using breakpoints on the Animation tab of the indicator
objects could also accomplish a color change and would be more
per-formant.
Breakpoint animation can also be done using Cascade Style sheets,
as shown in an earlier lab exercise.
The purpose of this lesson is to use the Script Data Tab and access the point/parameters in script.
After completion of this LAB, you will be able to:
Add points and parameters to the Script Data Tab and access these values using script.
Prerequisites
Introduction
When you need point data in your scripts, you normally read the “value” property of a data bound
object in your display (e.g. alpha001.value). The Script Data Tab lists point/parameters that can be
directly accessed by scripts (e.g., 11_FC17.OP) without requiring the object to be in the display.
Adding a point/parameter to one object’s Script Data Tab makes it accessible to all scripts in the
display. (However, it is generally more convenient to add point/parameters and the scripts that
access them to the same object.)
In the case of a dynamic shape, you can add custom properties to the Script Data Tab. (This enables
scripts to access point/parameters that have been mapped to custom properties.)
In this lab, you will modify a previously created dynamic shape (TempInd.sha) and add two alarm
parameters to the Script Data Tab. Script will then be written that uses the point/parameters listed on the
tab.
When the new dynamic shape is used for an indicator and there is an alarm on that point, clicking the tag
name calls a word document that provides temperature stabilization/recovery instructions. The new
shape, with the added script, will be saved with the name TempIndScript.sha.
Procedure
Step Action
1 If you have performed the previous lab as per pre-defined course sequence then open
dynamic shape TempInd.sha which you have built from C:\ProgramData\Honeywell\
Experion PKS\Client\Abstract, else copy the TempInd.sha shape from C:\
ProgramData\Honeywell\Experion PKS\Client\DisplayDB and paste it in Abstract
folder.
Note: In a previous lab, a dynamic shape (TempInd.sha) was created for analog
indication. TempInd will be modified in this lab exercise.
In HMIWeb Display Builder, open the shape TempInd.sha Save As this display as
TempIndScript.sha in your abstract folder.
2 Open the Properties of the shape display and select the Custom Properties tab.
Custom Properties make a dynamic shape flexible; database points are linked
with Custom Properties when the dynamic shape is inserted into a display.
Step Action
ATTENTION
Step Action
4 Point/parameters will now be added to the Script Data tab to enable direct script access.
In Object Explorer, expand the grouped shape; select the alphanumeric representing
the tagname, right-click and select Property pages…
NOTE: If your alphanumeric representing the tagname is named something other than
alpha001, modify your script or rename your object accordingly.
When scripting, pay particular attention to object names.
Rename your alphanumeric from its current name (i.e. txtName) to alpha001.
(This renaming is being done because the script refers to an object in the display
as alpha001. In reality you should give meaningful names to all objects added to
your displays.)
Step Action
Note the description shown for the script data selection. When scripting in
HMIWeb Display Builder, you normally read the “value” property of a data bound
object. (The value property accesses the point and parameter listed on the Data
tab.) Using the script data access feature allows scripts to access process data
directly.
Step Action
6 If the point that is linked to this shape has either an unacknowledged or acknowledged
alarm and the point name is clicked, a word document will be called. (The word
documents that will be accessed for this lab exercise have already been placed in
Student folder on your C: drive).
Two point/parameters will be added to the Script Data tab for use in script;
UnackAlarmExists and TotalAckAlarms.
Step Action
7 Select Add again and enter the Point Details shown for the parameter
“TotalAckAlarms”.
Step Action
9 By default, the scripting window opens with an onactivate event for the object.
Select the drop-down arrow to the right of the event browser and select
“onclick” for the script execution event.
Step Action
10 In Windows Explorer, browse to your abstract folder and copy the script content from
“ScriptDataTabScript.txt” and paste it in alpha001’s “onclick” event.
Close the script window when finished entering the above script.
TIP
Step Action
13 First ungroup and then regroup all the objects in the display.
Step Action
15 In HMIWeb Display Builder, open T_100_SCP from Abstract folder. We will now
replace the temperature indicators currently in T_100_SCP (TempInd.sha) with the new
TempIndScript.sha
Select Tools > Replace Shapes.
Using the drop-down arrow for “Current shape file” select TempInd.sha as the shape to
be replaced. Then browse to the new shape file TempIndScript.
Select Replace.
Step Action
17 Open the Properties of each newly inserted shape, select the Custom Properties tab,
and verify that the appropriate value for Tag was retained. (Note: For PathStr the
default value of c:\Student\ is used; the word document to be called is located at Student
folder on C: drive.)
Step Action
To create an alarm, select the alphanumeric on the Temperature Profile for 11_TI20 and
enter a value of 225.
The alarm icon of the tag 11_TI20 should start flashing in yellow color. This
shows that the tag 11_TI20 is in alarm condition.
Step Action
ATTENTION
21 Close the word document and create additional alarms using your TempProfile display.
When finished testing the indicators, close the word document.
Return the indicator values to a normal condition (not in alarm) and close the
Temperature Profile popup display when finished. Acknowledge any alarms that
were generated.
Step Action
22 Return to HMIWeb Display Builder and open T_100_SCP (if not already open) from
Abstract folder. We will now test some enhanced error handling features for Script Data.
Open the Properties of the TempIndScript shape that is linked to 11_TI20.
23 On the Custom Properties tab, clear the Value entered for Tag -- leave the tag value
field blank as shown below.
ATTENTION
Step Action
ATTENTION
Step Action
Step Action
27 Open the Script Editor for alpha001. Modify the script to add the highlighted statements
as shown below.
ATTENTION
Step Action
29 In HMIWeb Display Builder, open T_100_SCP from Abstract folder. We will now
replace the temperature indicators currently in T_100_SCP (TempIndScript.sha) with
TempIndScript1.sha
Select Tools > Replace Shapes.
Using the drop-down arrow for “Current shape file,” select TempIndScript.sha as the
shape to be replaced. Then browse to the new shape file TempIndScript1.
Select Replace.
Step Action
31 Open the Properties of the 11_TI20 upgraded shape and verify that the Custom
Properties tab does not have any Value for Tag.
ATTENTION
32 Close the Properties window and save your display T_100_SCP in the Abstract folder.
Step Action
33 Test the display by calling T_100_SCP in Station. One TempIndScript1.sha shape will
show a value of “------“in Station.
Click on the TempIndScript1 shape that is not showing a value. A message box will
be displayed “Point not defined in Custom Properties or Script Data Tab” as
shown below.
Click OK.
Step Action
36 Test the T_100_NAV display by calling it in Station. The shape for 11_TI20 will be
showing a blinking yellow color alarm icon if the tag is in alarm state.
The purpose of this lesson is to use System Custom Properties and access the properties in script.
By using System Custom Properties, you can create generic displays that can be used across your
plant.
After completion of this LAB, you will be able to:
Make use of the Display Data Repository using the system custom properties.
Prerequisites
Introduction
System custom properties are like variables. Instead of binding an object on a display directly to a
single point, you can bind the object to system custom properties.
At run time, the value of system custom properties can be changed and stored in either the Station
data repository or the Display data repository. When you create a system custom property, you set
where the value of the property will be stored by setting the scope.
A Custom Trend display will be created in this lab exercise. The display will have a system
custom property defined, and buttons will be added to your display to pass a tagname to the Display
Data Repository. A dynamic shape display containing a trend will also be created – the dynamic
trend shape will use custom properties and get its trace values from the Display Data Repository.
The trend shape will be inserted into the parent Custom Trend display; the plots in the trend will
change based on script written on the pushbuttons. When a button is selected, a tagname will be
written to the display data repository, which the trend and alphanumerics use to populate their data.
An example of the finished display is shown below.
Procedure
Step Action
Step Action
Step Action
ATTENTION
Step Action
5 Using the Textbox tool, place a textbox in front of the first alphanumeric as illustrated.
Step Action
6 Replace the word Text with SP, and modify the following properties:
Text Color: dimgray
Font Size: 8, bold
Copy the textbox and move the copy in front of the next alphanumeric.
Modify the text to PV as shown.
Step Action
7 Five objects have now been added to your display: two textboxes and three
alphanumeric.
Arrange your objects so that your display is similar to the one shown.
Step Action
Name: alpha002
Data base link
Point: <PNT>
Parameter: PIDA.SP
Name: alpha003
Data base Link
Point: <PNT>
Parameter: DACA.PV
Note: Recall that a system custom property <PNT> was defined on the display to store
“point” data. The data-bound objects in your graphic will retrieve their point information
from <PNT>.
9 It’s a good idea to save periodically. Save your display as CustomTrend in the abstract
folder.
Step Action
10 Using the Pushbutton tool, add a pushbutton object to your display as shown in the
following example. Open the properties window; select the Details tab and enter
11_FC01 as the button label.
Change the following pushbutton properties:
Fill color: Silver
Font size: 8, bold, center
Step Action
12 By default, the scripting window opens with the onactivate event for the object.
Select the drop-down arrow in the event browser and select “onclick” for the
script execution event.
13 Copy the script content from “CustomPropertiesScript.txt” in your abstract folder and
paste it in the first pushbutton’s onclick event in the script editor.
The following illustration shows a completed script in the Script Editor.
Step Action
14 Make 7 copies of the pushbutton 11_FC01. Open the properties of each button, and on
the Details tab label them as shown in the following table.
Note: It’s good practice to rename objects in your display for easy identification. For
example, because pushbutton001 will pass point information for tag name 11_FC01, this
object could be renamed to btnFC01.
Step Action
16 In previous labs you learned how to build dynamic shapes. We will now create a new
dynamic trend shape.
Open a blank dynamic shape display.
Add custom properties to the dynamic shape display as follows:
Custom Property 1
Name: TrendPNT
Type: Point
Custom Property 2
Name: Param1
Type: Parameter
Custom Property 3
Name: Param2
Type: Parameter
Step Action
17 Select the Trend tool on the toolbar and add a Trend object to your display.
Open the properties of the Trend. On the General tab, modify the size of the trend
object to 800 x 235.
Select the Plots tab and (using the drop-down point and parameter lists) assign the
following plot colors, point and parameters:
Plot -- Blue
Point ID: <TrendPNT>
Parameter: <Param1>
Plot 2 -- White
Point ID: <TrendPNT>
Parameter: <Param2>
(To assign a color, click the colored square, and select the desired plot color.)
Select the View Tab, and for the Trend’s legend type, select “No legend”.
When finished, close the properties window and save your dynamic shape with the name
ChartShape.sha in the abstract folder.
Step Action
18 Open your CustomTrend display (if not already opened) and insert the ChartShape into
your CustomTrend display.
Position the inserted trend as shown below. (You may need to reposition the
objects already in your CustomTrend display).
TrendPNT: <PNT>
Param1: PIDA.SP
Param2: DACA.PV
Step Action
20 Open the Script for each Pushbutton and change the reference of the point in the
script to the correct tag name as shown on the pushbutton label.
(Remember that all the pushbuttons were copied or duplicated from the first pushbutton
11_FC01.)
Example:
Open the Script for the pushbutton showing the label 11_FC02.
Change the reference given in the script from point 11_FC01 to 11_FC02 as shown in
the following.
Repeat the above for all pushbuttons to enter the correct point data.
Step Action
Step Action
24 Due to our database simulation process, the SP and the PV values may be exactly the
same; you may not see two plots in the trend chart.
Navigate to the detail display of 11_LC16 (double-click the tag name at the top left of
your trend display to call up its detail display).
Change the SP value.
Recall your Custom Trend display. Click on the 11_LC16 pushbutton.
Change the Time Period to 5 minutes, and you will see two plots in the Chart area.
Note: Two points (11_TI20 and 11_PI14) are analog indicators. Therefore, a SP value
will not be shown. When a button associated with an analog indication points is
selected, your display will show “--------” in the SP field.
Step Action
26 Practice using the Show Legend toggle icon at the top left of the chart area. The legend
at the bottom of the trend will appear and disappear.
Practice removing the checkmarks in the Pen column to view the individual parameters
being plotted on your trend.