0% found this document useful (0 votes)
27 views

Module 48 - The Grid Control

This document provides an overview of using grid controls in PcVue HMI software. It describes how to insert and configure grid controls, including setting the number of rows and columns. It also explains how to populate grid cells using SCADA Basic programming, specifically using the SELECTOR instruction. Examples are given to demonstrate populating a grid from a text file and saving the grid contents to a file. Additionally, the document outlines using grid controls in variable tracking and historical modes.

Uploaded by

Rafaael Castro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Module 48 - The Grid Control

This document provides an overview of using grid controls in PcVue HMI software. It describes how to insert and configure grid controls, including setting the number of rows and columns. It also explains how to populate grid cells using SCADA Basic programming, specifically using the SELECTOR instruction. Examples are given to demonstrate populating a grid from a text file and saving the grid contents to a file. Additionally, the document outlines using grid controls in variable tracking and historical modes.

Uploaded by

Rafaael Castro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

HMI

Module 48
The Grid Control
Contents

1 Introduction 3
1.1 PcVue version 3
1.2 In this module you will learn 3
1.3 Files used in this module 3
1.4 Third party products used in this module 3

2 This function in the PcVue architecture 4


3 The Grid Control 5
3.1 Overview 5
3.2 Inserting a Grid Control in a mimic 5
3.3 Configuring the rows and columns 6
3.4 Other options 7
3.5 Manually configuring the rows and columns 7

4 Populating a Grid using SCADA Basic 9


4.1 Introduction to the SELECTOR instruction 9
4.2 Demonstration of simple example 10

5 Using the Grid in Variable tracking mode 12


5.1 Options in the Variables tab 12
5.2 Configuring a filter including some common examples 13
5.3 Forcing a variables value 14
5.4 Exercise 14

6 Using the Grid in Historical mode 15


6.1 Historic mode main features 15
6.2 Configuring a grid using historical mode 15
6.3 The historical mode grid at run-time 19
6.3.1 The grid toolbar 19
6.3.2 Making a new historical request 20
6.4 Exercise 21

7 Resume 22

Module 48 – Grid Control Page 2/22


1 Introduction
1.1 PcVue version
This module is for PcVue version 12.

1.2 In this module you will learn


How to draw a Grid Control,
How to use a grid control with SCADA Basic
How to use a grid control in variable tracking mode
How to use a grid control in historical mode

1.3 Files used in this module


Copy the project MODULE_48 (Start) to the project folder USR. This is a copy of the
project as at the end of the main training but with a few additions for this module.

1.4 Third party products used in this module


Excel or Excel Viewer must be installed to view data exported in Excel format.
Notepad can be used to view data in comma separated variables (CSV) format.

Module 48 – Grid Control Page 3/22


2 This function in the PcVue architecture

Figure 1

Module 48 – Grid Control Page 4/22


3 The Grid Control
3.1 Overview
The Grid Control is a special animation that produces a grid of cells arranged in rows
and columns. The cells can be populated using one of four mechanisms.
Manually by the user at run-time.
Programmatically using SCADA Basic or VBA.
By using the grid in variable tracking mode.
By using the grid in historical data mode.
The following screen shot is of a grid populated programmatically.

Figure 2

The main features are:


No limit to the number of cells*
Optional scroll bars
Optional top and side headers (Fixed rows and columns)
Cells can be read only or used for data entry
Single or multiple cell selection at run-time.
Programmatic access to look and feel as well as cell contents
* There is no coded limit to the number of cells but for performance reasons it is
recommended that it is 10,000 or less.

3.2 Inserting a Grid Control in a mimic


Step 1. Open the mimic in design mode.
Step 2. Click the Insert / Grid… command.
Step 3. PcVue inserts the grid and opens the configuration dialog displaying
the Aspect tab.

Module 48 – Grid Control Page 5/22


Figure 3

Step 4. Close the configuration dialog and drag and resize the Grid to suit
your requirements. Note that in design mode the grid just appears as a grey
rectangle – no cells are displayed.

3.3 Configuring the rows and columns


The number or rows and columns of a grid control are configured from the General
tab of its configuration dialog.

Figure 4

You configure the total number of rows and columns using Rows / Columns and the
number of rows and columns behaving as headers using Fixed Row / Col. The fixed
rows and/or columns can be set to 0 if not required.
The size of the rows and columns are normally configured at run-time by dragging the
header cell borders. Once you have done this you can de-select the Editable property
which will prevent anyone changing them accidentally at some later time.

Module 48 – Grid Control Page 6/22


Figure 5

3.4 Other options


The General tab contains several properties that affect run-time operation. A full list
can be found in the help.
Developing the HMI > The Viewers > The Grid Control > Creating and configuring a
Grid Control > Configuring the run-time behavior.
The most important properties are:
Selectable – Allows the run-time user to select a cell by clicking on it.
Editable – Allow the run-time user to edit the contents of a cell.

Some properties are not available when using the Variable Tracking or
Historical modes.

The only way to stop a user resizing the columns is by setting the
Fixed row/col to 0. In which case there is no header.

3.5 Manually configuring the rows and columns


Sometimes it is more convenient to manually enter the row heights and cell widths.
You can do this by saving the mimic as ASCII and then opening the file using a text
editor. The entry for the grid will look something like this.
O,BEGIN,GRDNEW,"AIGrid1"
B,520,280,1160,760,10,210,65535,0,6400,0,1,1,1,0,1
ST,5,1,COLOR,1,COLOR,1,1,0,COLOR,2,0,COLOR,2,0,COLOR,1,0,COLOR,1
PP,20,4,1,1,FONT,2,COLOR,3,COLOR,1,COLOR,2,4,1,1,0,1,0,0,0,0
RH,24,24,24,24,24,24,24,24,24,24
RH,24,24,24,24,24,24,24,24,24,24
CW,100,180,180,180
HIS_GEN,0,0,1,1,1,2,1,2,1,1,0,0,0,0,"","","",1,0
A,BEGIN,VAR,"Anim1",0,0,"",""
PP,0,".*",15,2,1,1,1,1,1,1,0,0,0,1,2
A,END
O,END

This example has 20 rows. All the rows have a height of 24.
And there are 4 columns. The column widths are 100, 180, 180 & 180.

Module 48 – Grid Control Page 7/22


Only manually edit a mimic file if you are confident not to make
any mistakes! In any case it is wise save your configuration and
make a backup copy of the mimic first.
Manually editing a mimic file and making an error can cause the
mimic not to display and in the very worst case crash PcVue!

Module 48 – Grid Control Page 8/22


4 Populating a Grid using SCADA Basic
When using the grid in its basic mode the only way to populate the cells is to use
SCADA Basic. The instruction used for this is SELECTOR. It is not difficult to use.

You can also populate the cells using VBA should you prefer that.

4.1 Introduction to the SELECTOR instruction


The syntax of the SELECTOR instruction for all modes follows the same pattern:
Selector(MODE, Window, Branch, Identity,...more parameters
Window and Branch reference the mimic concerned and Identity is the name given
to the Grid it is drawn. You can check and/or change the name using the Graphic
Explorer. The default grid name is AIgrid1.

Figure 6

Here are some of the more commonly used modes.


Selector("PUTCELL", Window, Branch, Identity, Line, Column, Chain);
Put the string from Chain in the cell selected by Line and Column.
Selector("GETCELL", Window, Branch, Identity, Line, Column);
Return the contents of the cell selected by Line and Column.

Module 48 – Grid Control Page 9/22


Selector("SELECTCOL", Window, Branch, Identity);
Selector("SELECTLINE", Window, Branch, Identity);
Return the number of the selected line or column.

The normal lines and columns start at 0.


The fixed (header) lines and columns start at -1.

Selector("PUTARRAY", Window, Branch, Identity, Hbuf, StartLine,


StartCol, EndLine, EndCol, CLsepa);
Populate the cells from StartLine, StartCol to EndLine, EndCol using the
contents of the memory buffer referenced by Hbuf. The two characters used to
delimit the columns and lines are supplied by CLsepa.

4.2 Demonstration of simple example


An exercise to populate a Grid using SCADA basic would take more time than this
module allows for so instead we have provided you with a simple example. The mimic
is GRID_BASIC.ASC. You can examine the program functions in detail at a later time
if you wish. They are all contained with the program GRID_EX.SCB. F9 displays the
SCADA Basic program editor. The example uses some of the more commonly used
modes.

Figure 7

Load – Runs the function LoadGrid which uses mode PUTARRAY to populate the
grid using the contents of a text file.

Module 48 – Grid Control Page 10/22


Save – Runs the function SaveGrid which uses mode GETARRAY to save the
contents of the grid in a text file.
Sort – Runs the function SortGrid which uses mode SORT to sort the grid
contents by column.
Clicking on any cell displays its column, line and contents.
Put Cell – Runs the function PutCell which uses mode PUTCELL to write to a
specific cell.
Color cells – Just to show the versatility of the SELECTOR instruction. Try it!

Module 48 – Grid Control Page 11/22


5 Using the Grid in Variable tracking mode
In variable tracking mode the grid displays a list of eligible Variables Tree variables
and their values. By eligible, we mean those variables which pass the (configurable)
filter. Variables which have the command property set can have their value forced
directly from the grid making it a very useful tool both for the normal user and when
commissioning.

Figure 8

To use tracking mode you must select the property Variable Tracking in the grid
configuration dialog, Variables tab. See picture below.

5.1 Options in the Variables tab

Figure 9

Variable tracking – The most important property as it enables the variables


tracking mode.

Module 48 – Grid Control Page 12/22


Display – Configures what is displayed and in which column. You can chose to
display the variable name, the variable label (description) or both. You can also
choose to display bits and alarms as a value, 0 or 1, or using their associated
label.
Other options
 No send on name – Only allow forcing a variable’s value by clicking on the
value (not on its name or label). Set by default.
 Disable cell modification by program – Inhibits setting cell values by
program. Set by default.
 Automatic adjustment of number of lines. – Automatically changes the
number of lines (rows) to accommodate all eligible variables. Set by
default.

Use Automatic adjustment… carefully. Imagine what would


happen on a project with 20,000 variables if this property is
selected!

5.2 Configuring a filter including some common examples


You almost certainly won’t want to display all the variables in a single grid. It could
take some time to scroll to the one you are looking for. The Filter allows you to filter
by variable type but also, and most importantly, using either a regular or SQL
expression. Most applications using the SQL expression as that is what people tend to
be familiar with. Regular expressions are included for backwards compatibility.
In an SQL expression you compare variable properties like the name, description and
extended attributes, against a value using one or more SQL operators. For a full list of
properties and operators see the help topic:
Developing the HMI > The Viewers > The Grid Control > Using the Grid to display
variables > Using an SQL Expression to Filter the List of Variables
Explaining all the SQL expression syntax is outside of the scope of this module but
here are some examples.
Name Unlike "SYSTEM.*" - Will display all variables except those starting
with SYSTEM (Excludes all the system variables).
Name Like "Building.Floor_01.*" - Will display all variables starting with
Building.Floor_01.

You can dynamically change the filter using the SCADA Basic SELECTOR
instruction mode VARIABLE.

Module 48 – Grid Control Page 13/22


5.3 Forcing a variables value
You can use the grid at run-time to force the value of any displayed variable that has
the command attribute set. The normal command level attributes are respected.

5.4 Exercise

Exercise 1.
Configure a Grid Control in variable tracking mode.

a. Create a new mimic using the template AATemplate.


b. Insert a Grid Control configured as follows:
I. In the General tab, Rows/columns: 35 and 3, and Fixed
rows/cols: 0 and 0.
II. In the Variables tab, set Variables tracking.
III. In the Variables tab, set the Display to show the Name
and Label (column 1 and 2) and the value in column 3.
IV. In the Variables tab configure a Filter to display only
variables starting Building.Floor_01.Room_001.
c. Save the mimic. You can add a button to the AA Template to
open it if you wish.
d. Select Run mode and observe the result in the Grid Control.

Challenge !
Develop a SCADA Basic program to allow the filter to be changed
dynamically.

Module 48 – Grid Control Page 14/22


6 Using the Grid in Historical mode
When used in historical mode the Grid uses the same Data Export engine as used by
the main Data Export tool to populate the cells with sampled historical data. The main
Data Export tool is covered in Module 104. The data can also be exported in Excel or
CSV format, at run-time, using the same Data Export Wizard as in the Trend Viewer.

Figure 10

For more information on using the Grid in historical mode see the help:
Developing the HMI / The Viewers / Grid control / Historical mode

6.1 Historic mode main features


Generates and displays sampled historical data for one or more variables in a
table. (Variables must be trend recorded.)
Fixed or variable time period.
Configurable sampling period.
Threshold system to color cells. Can be linked to register variable thresholds.
Run time tools for new historical request, export to file…

6.2 Configuring a grid using historical mode


Step 1. Draw a new grid control.
a. Create a new mimic
b. Draw a new grid control. When in historical mode the grid control
automatically adjusts the number of rows and columns to suit the
number of variables and samples. Most of the other options in the

Module 48 – Grid Control Page 15/22


General tab are also deprecated due to the way in which the grid behaves
at run-time when in historical mode.

Figure 11

c. Save the mimic. The mimic in the project is called grid_hiso.asc. It is


saved in ASCII but that doesn’t really matter when using the grid in
historical mode.
Step 2. Select historical mode by ticking the option in the Historical tab.

Figure 12

Module 48 – Grid Control Page 16/22


Step 3. Configure the time period. You choose the number of, and type of
(minutes, hours, days….), time unit, and the period type. The use of period type
is best illustrated by an example.
If you selected Current period and 1 Day the grid control would display data for
today starting at the time that the mimic, containing the grid control, was
opened. The number of samples would depend on the time of day.
If you selected Completed period and 1 Day you would get data for the entire
previous day which would always be the same number of samples.

Figure 13

Step 4. Configure the sampling. You choose the number of, and type of
(milliseconds, seconds, minutes…), time unit. For example 1 minute would
generate a sample every 1 minute. (1440 for 24 hours.). In this module we will
only use basic data mode, Sample. For information about the other data mode,
Sample with synchronization, please refer to the help.

Figure 14

Module 48 – Grid Control Page 17/22


Step 5. Add the variables. Variables are added using a child dialog that is
opened from the Data button on the General tab. When configuration is
complete it is closed using the OK button.

Figure 15

a. The left pane - contains the list of variables. At run-time, in the grid, each
variable is displayed in a column starting with the variable at the top of
this list as the leftmost.
Clicking Add new trend opens a dialog displaying a list of available (trend
recorded) variables for selection.
The buttons below the pane allow you to modify the position of variables
within the list or even delete them completely. The maximum number of
variables that can be added is 128 but you must keep in mind the number
of samples that will be generated.
b. The header pane – selects what will be displayed in the header for each
variable. The Custom option allows you to enter free format text.
c. The threshold pane allows you to apply a threshold system to each
variable to color the cells whenever the value goes outside of a
configurable range. If the variable already has a threshold system you
can use that by selecting Automatic. Or, you can manually enter the
thresholds.

Module 48 – Grid Control Page 18/22


The default threshold colors are set in the color preferences.
Configure.Preferences.Colors.Thresholds.

6.3 The historical mode grid at run-time


When the mimic, containing the grid, is opened the grid makes a historical request
appropriate to its configuration, calculates the samples, and populates the cells. This
may take a noticeable period of time if many 1000’s of samples are produced. The
number of rows and columns adjusts automatically to accommodate the data. You
can turn off this automatic request by de-selecting the property Request data at
mimic open. You will then have to make the request manually using the toolbar.

The format in which the samples are displayed is not configurable.


The format of the date and time, is taken from the Project Language Settings.

6.3.1 The grid toolbar


At run-time, when in historical mode, the grid displays a toolbar. The toolbar position
can be changed, and its contents modified, using the usual method of right clicking on
it.

Figure 16

The following tools are available (starting from the top).


Historical request - Configure and initiate a new historical request. See below.
Last request - Repeat the previous historical request.
Initial request - Repeat the initial (as configured) historical request.
Cancel historical request - Cancel the historical request. Very useful if you have
made a poorly configured historical request and it is taking too long!
Export data to file - Open the Trend Data Export Wizard. See help for the Trend
Data Export Wizard for information:
Developing the HMI > The Viewers > The Trend Export Wizard

Module 48 – Grid Control Page 19/22


6.3.2 Making a new historical request
The Historical Request tool displays a dialog which allows a new historical request to
be configured and made at run-time. You can make a new request between two times
and dates, or by period. You can also change the sample rate.
To make a historical request between two dates you use the Date tab.

Figure 17

To make a historical request by period you use the Period tab.

Figure 18

In either case Apply generates the request leaving the dialog open and OK generates
the request and closes the dialog.

If a warning triangle appears during a historical request it means


you have exceeded the capabilities of the mechanism!

Module 48 – Grid Control Page 20/22


6.4 Exercise

Exercise 2.
Configure a Grid Control in historical mode.

a. First we need to generate some historic data!


I. Open the Import mimic. Click the button Open project TP
folder and locate the file ImportTrend.dat.
II. Open ImportTrend.dat with a text editor and change the
time and date stamp so that the date is yesterday. Save
the file and close the editor.
III. Return to PcVue and use the Import button to import the
historical data. This may take a few seconds. If successful
the Trend Viewer will update to display the data.
b. Create a new mimic using the template AATemplate.
c. Insert a Grid Control and configure the Historical tab as follows
(all other properties left at default):
I. Historical mode – selected.
II. Period – 1 day, Completed period.
III. Sampling – Sampling rate 1 minute.
d. In the Grid Control Data dialog:
I. Add the three variables:
BUILDING.FLOOR_01.ROOM_001.AC.TEMP_IMPORT
BUILDING.FLOOR_01.ROOM_002.AC.TEMP_IMPORT
BUILDING.FLOOR_01.ROOM_003.AC.TEMP_IMPORT
II. Configure the thresholds for each variable as Automatic.
Choose appropriate colors for the High and Low
thresholds.
e. Close all the dialogs and save the mimic. You can add a button
to the AA Template to open it if you wish.
f. Select Run mode and observe the operation of the Grid Control.

Challenge !
Modify the format of the date and time displayed in the first
column of the Grid Control.

Module 48 – Grid Control Page 21/22


7 Resume
The Grid Control is a special animation that produces a grid of cells arranged in
rows and columns.
A Grid Control can be used in one of three ways.
 As a general purpose table populating the cells programmatically using
SCADA Basic or VBA.
 To display a list of variables and their values. To make the display more
useable, the list of variables displayed can be filtered using an SQL
expression.
 To display, and export, sampled historical data.

Module 48 – Grid Control Page 22/22

You might also like