You are on page 1of 636

Pcvue Basics Introduction

Contents

1. 2. 3. 4. 5.

Welcome Convention Interact with the guide Schedule Prepare your computer for the training

3 4 6 7 9

Copyright Statement
2009, 2010 & 2011 by Arc Group. All rights reserved. No part of the contents of this workshop manual may be reproduced or transmitted in any form or by any means without the written permission of Arc Group. All product names included in this workshop guide are trademarked by their respective companies. Pcvue Basics - Introduction Page 2/9

1. Welcome
Welcome to your PcVue Training course. This course was designed for new or inexperienced PcVue users. It focuses on how to create an application implementing the most common features of SCADA software. This course guide is provided in a USB stick which contains: Folder Tools: contains all 3rd party tools needed. Folder Modules: contains all course modules.

This course is organized in modules. Each module is a folder named Module_XX_Name where XX is a number and Name the modules name. Each of the modules folders contain: A folder named 3rd Party (optional): Contains any third party tools needed for the module. A folder named Project (optional): Contains a PcVue project. This project can be used in exercising the actions the module describes. File Module XX Name Basics.pdf: This is the course guide teaching the basics for the module. File Module XX Name Advanced.pdf (optional): This is the course guide teaching some advanced features for the module.

This training course is based on version 10.0 of PcVue. We make every effort to have an up-to-date guide but if the current version is more recent than the one you are using, you may see minor differences in some screenshots. Please let the trainer know about these and we will make a note for the next revision of the guide. The operating system used was Microsoft Windows 7. If you are using another operating system you will find some differences in various screenshots (mainly in the look and feel).

Pcvue Basics - Introduction

Page 3/9

2. Convention
In each module you will see keywords and the path that you can use to search for additional information in our online Help documentation. We encourage you to use the Help both during and after the course since that is the most comprehensive and up-to-date source of information about how to use PcVue. When you are learning about a feature you will need to follow the trainers instructions. To facilitate this, the trainer will describe the feature in a series of steps. In this guide each step is represented by this header:

Step 1.

Title of the step

a. Action to take b. Action to take Sometimes you have to select an option or click on a particular button, etc. This guide highlights with an underline the text you have to select or click.

Pcvue Basics - Introduction

Page 4/9

The guides use the following icons: Icon Name Reminder Description An important point to remember, or advice.

Warning

An important point to be aware.

Trick

A trick or tip.

Help

Keywords or path for further details in the Help.

Exercise

An exercise or action to do during the module.

Challenge!

A more difficult exercise for advanced trainees.

Question

A question related to the current module, asked by the trainer at the end. An area in the document for writing your answer.

Answer

Pcvue Basics - Introduction

Page 5/9

3. Interact with the guide


Each course guide is a PDF file. Because each trainer has a style and tricks you will probably want to add some notes. We recommend using the PDF-XChange Viewer which is free software for reading PDF files. This tool makes it easy to add notes and comments directly to the file. Of course your files will be readable later with any PDF viewer such as Adobe PDF Reader. PDF-XChange Viewer is provided in the Training USB key in this folder: \Tools\PDFXchangeViewer. This version is the Portable version. It means you dont have to install it. To use it you have only to copy this folder to your computer and launch PDFXCview.exe To display the Comment toolbar select View/Toolbars/Comment and Markup toolbar.

Main actions available: Icon Action Add a sticky note Add a free text Add a text box Add a text box with an arrow Highlight the selected text Add a Shape

Pcvue Basics - Introduction

Page 6/9

4. Schedule
The complete training course lasts 5 days. This is the proposed schedule: DAY 1 Introduction Module 01 - Introduction - PcVue Setup Module 02 - PcVue Solutions presentation Morning (9:30 12:00) Note: This module can be done during the PcVue Setup. Module 03 - Introduction - Version policy and licensing Module 04 - Introduction - PcVue and project concepts Module 05 - Introduction - Case Study Afternoon (13:00 17:00) Module 06 - Variables Real time Database Module 07 - Communication - Common drivers Module 08 - Communication - OPC Day 2 Module 09 - HMI - Mimics Morning (9:00 12:00) Module 10 - HMI - Basic graphical objects Module 11 - HMI - Animations Module 11 - HMI - Animations (continued) Afternoon (13:00 17:00) Module 12 - Alarms Module 13 - Labels, attributes and filtering

Pcvue Basics - Introduction

Page 7/9

Day 3 Morning (9:00 12:00) Module 14 - HMI - Generic HMI Module 15 - Tools - Automated application generation Module 16 - Communication interfaces - WebVue overview Day 4 Module 17 - Communication interfaces - Multistation overview Morning (9:00 12:00) Module 18 - Archives - Archive Unit Module 19 - Archives - HDS Module 20 - Archives - Logs Afternoon (13:00 17:00) Module 21 - Archives - Trends Module 22 - Services - User rights Module 23 - Services - Expressions Day 5 Morning (9:00 12:00) Afternoon (13:00 16:00) Module 24 - Scripting - SCADA Basic Module 25 - Scripting - VBA & AiGrid Training catalogue presentation

Afternoon (13:00 17:00)

Pcvue Basics - Introduction

Page 8/9

5. Prepare your computer for the training


Now we can start our training! The first thing to do is to copy all the modules on to your computer. Open Windows Explorer. Create the Folder My Documents\ PcVue Training. Copy from the USB key the Folder Modules in My Documents\ PcVue Training\

..... and lets go to Module 01!

Pcvue Basics - Introduction

Page 9/9

Introduction

Module 01 Setup

Contents

1. 2. 3. 4. 5.

Setup help System requirements Install PcVue Uninstall PcVue Reminder

3 4 5 7 8

Module 01 - Setup

Page 2/8

1. Setup help
The complete set-up (installation) process is well documented in the Help. The best way of installing PcVue for the first time is to follow the procedures and screenshots described here. Insert the DVD and run the Setup.exe. The following dialog appears.

Figure 1

Select Installation and Help for installation.

Figure 2

Module 01 - Setup

Page 3/8

2. System requirements
Before installing you must check the System Requirements in the topic Operating System and PC Requirements.

Module 01 - Setup

Page 4/8

3. Install PcVue
Insert the Supervisor DVD into the DVD drive. If you have Auto Run enabled, the set-up program will automatically start, otherwise you can start the installation manually by locating and running SETUP.EXE from the DVD.

Step 1. Select Supervisor type


Click Installation. Here you can select installation of the Normal Supervisor or the Web Supervisor. Click Install Supervisor.

If you need to use PcVue as a Web Server you must select Web Supervisor.
Step 2. Setup Pre-requisites
The set-up program checks the pre-requisites needed by PcVue and displays a dialog listing the pre-requisite that will be installed. All the pre-requisites are on the distribution media. Click Install to continue.

Figure 3

The list of pre-requisites is in this Help topic: Installing the Software / Starting the Installation and Installing the Pre-requisite Components The set-up program doesnt install SQL Server Express Edition.
Module 01 - Setup Page 5/8

During the installation process for pre-requisites the PC may have to be restarted one or more times. When the installation of the components is complete, the main Supervisor installation procedure starts.

Step 3. Main PcVue set-up


Select the language for the installation. As this course is in English, select English and then OK to continue. You may then be asked to install the protection key driver (Sentinel). Click Install to continue. The main PcVue Installation Wizard then starts. Click Next button until you reach the dialog box with the title: Product and Projects Folders. Click the Change button and select C:\Pcvue projects. Click the Next buttons until you reach the Ready To Install dialog and click the Install button The PcVue installation now proceeds.

Figure 4

We recommend that the default location is not used for the project folder. If you have more than one drive on your PC it is recommended that the project folder is NOT on the system drive. Don't select a network drive as a project location as it may result in erroneous behavior.
Module 01 - Setup Page 6/8

4. Uninstall PcVue
You can uninstall PcVue, like any software, by using the Add/Remove tool of Windows.

The set-up program doesnt uninstall any pre-requisties, the Sentinel driver (the dongle driver) or the BacNet server. These must be uninstalled separately.

Module 01 - Setup

Page 7/8

5. Reminder
How to install PcVue? Select Supervisor type. Setup Pre-requisites. Main PcVue.

Module 01 - Setup

Page 8/8

Introduction

Module 02 PcVue Solutions

Contents

1.

PcVue Solutions

Module 02 - PcVue Solutions

Page 2/5

1. PcVue Solutions
PcVue Solutions is an integrated suite of software and hardware for visualization, control, management and data analysis for industrial, building, energy, infrastructure and utilities applications. It includes the following software: PcVue PcVue is a complete suite of SCADA software (Supervisory Control And Data Acquisition). Its role is to: Collect the data from equipment, Manage alarms, Archive data, Display the real time and /or archived data in an attractive HMI.

WebVue The Web access solution: Compatible with all Java compliant Web browsers, No need to design a special Web application, Some graphical limits are described in the Help.

PlantVue An HMI software. The main characteristics are: It is an OPC client only, It is stand-alone (no client/server architecture and no Web access), It is limited in number of I/Os.

FrontVue An independent GUI for gathering data via OPC (OLE for Process Control). Dream Report A complete reporting tool running independently or communicating with PcVue. You can see an overview here: http://www.pcvuesolutions.com/index.php?option=com_content&view=article&i d=8&Itemid=21&lang=en IntraVue Automatic Topology and Graphical representation assists local resources who are not network TCP/IP experts easily respond to Ethernet communication issues. You can see an overview here: http://www.pcvuesolutions.com/index.php?option=com_content&view=article&i d=9&Itemid=158&lang=en Web Scheduler Scheduler with a Web interface. This product is bundled with PcVue. Module 02 - PcVue Solutions Page 3/5

Alert Software for industrial On-call management. It is able to call people on-duty by phone, SMS, email etc. You can see an overview here: http://www.pcvuesolutions.com/index.php?option=com_content&view=article&i d=7&Itemid=156&lang=en

Module 02 - PcVue Solutions

Page 4/5

... and the following hardware: Brad Communication (Molex): Communication boards Moxa: communication switches for Industrial Ethernet.

Module 02 - PcVue Solutions

Page 5/5

Introduction

Module 03 Versions policy and Licensing

Contents

1 Versions policy
1.1 Component registration tool

3
4

2 Licensing
2.1 2.2 2.3 2.4 License type I/O limits Options Dedicated licenses

5
5 5 5 5

3 Updating the license

Module 03 - Versions policy and Licensing

Page 2/7

1 Versions policy
Each PcVue release is represented by a version number. The current version is 10.0.2476 where: 10 is the major version. A new major version is released when new important features are added. 0 is the minor version. A new minor version is released when new features are added. 2476 is the build number.

Several service packs (SP) can be added when we discover anomalies. For example we will have 10.0.xxxx SP1.

You dont need to update the license when you add a service pack.

An application designed in a particular PcVue version is compatible with any more recent PcVue version.

Module 03 - Versions policy and Licensing

Page 3/7

1.1 Component registration tool


If several PcVue versions have been installed in the same computer there is a problem with sharing their components. Each version uses a set of components registered with Microsoft Windows. The components have the same names irrespective of version and so before you start PcVue you have to be sure that the appropriate set is registered with Windows.

Figure 1

If you want to run PcVue in version X but the latest version that was run was version Y, you must run the Component Registration tool for version X before you run version X. To run the Component Registration tool click on: Start Menu\Programs\ARC Informatique\PcVue version\Tools\Component Registration

Module 03 - Versions policy and Licensing

Page 4/7

2 Licensing
The price of a license depends on various factors, of which we will consider the most common. Please contact our Sales Department for further details. The license is coded in a physical protection key (also known as a dongle). USB and parallel port versions are available. Which you require is normally specified at order time.

2.1 License type


Runtime: Run-time environment only. You cannot modify the application. Complete: Run-time and development environments. Usually each system integrator has at least one Complete dongle. Development: Development environment with a time limited run-time dongle.

2.2 I/O limits


Data collected from an external device is considered as input/output (I/O) irrespective of the communication method used or the type of data. The various licenses reflect to the quantity of I/O: 75 I/O, 250 I/O, 500 I/O, 1,000 I/O, 2,000 I/O, 5,000 I/O, 65,000 I/O, Unlimited.

During startup PcVue counts the I/O configured in the application. If it is higher than the license, PcVue stops. Then you have to order an upgrade.

2.3 Options
Various options are available. The most common are: SV_NET: Able to manage a networked architecture (Client/Server), WEBVUE: Web server and/or Web Services,

2.4 Dedicated licenses


We provide licenses dedicated to specific uses. For example there is the Server license that is dedicated to a Server (no HMI). Module 03 - Versions policy and Licensing Page 5/7

If you start PcVue without any dongle, it runs in Demo mode. In this mode PcVue operates as a Development license managing 25 I/O maximum and having 1 hour of communication.

Module 03 - Versions policy and Licensing

Page 6/7

3 Updating the license


If you have to update the license, there is no need to change the dongle. Instead there is a procedure for upgrading it by software. This software is called the Remote License Manager. You can install it using the Drivers and utilities menu on the PcVue DVD. Then select Remote License Manager and follow the instructions. The procedure to update a license is: Plug in the dongle to be updated. Start the Remote License Manager and select Ask for license upgrade. A file should be generated. Send it to our Sales department (with an order of course!). You will be sent a new file containing the upgraded license. Start the Remote License Manager and select Upgrade my license now. Configure the path for the file. Your license has been updated!

Module 03 - Versions policy and Licensing

Page 7/7

Introduction

Module 04 PcVue and project concepts

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

Project concepts
2.1 Deploy a project

4
4

Run PcVue
3.1 Shortcuts 3.2 Command line 3.3 Create a project 3.4 What is running? 3.5 Traces & logs

5
5 7 8 9 10

4 5

PcVue architecture The Application Explorer


5.1 Main features 5.2 Using the Application Explorer 5.2.1 Opening and closing the Application Explorer 5.2.2 Changing the appearance of the Application Explorer 5.3 What can be configured from the Application Explorer?

11 12
12 13 13 13 14

Module 04 - PcVue and project concepts

Page 2/15

1 Introduction
1.1 In this module you will learn how to
Run PcVue using various shortcuts, Collect the traces, Create a new PcVue project, Manage the Application Explorer.

1.2 Files used in this module


None.

1.3 Third party software used in this module


None.

Module 04 - PcVue and project concepts

Page 3/15

2 Project concepts
A PcVue application is named a Project. Each project is contained within a Windows folder. All project folders are located in the root folder that you specified during the set-up or the one specified in the command line with the option b. Because we have configured C:\Pcvue projects our projects must be located in C:\Pcvue projects\USR\. PcVue can run only 1 project at the same time.

Figure 1

The set-up program automatically installs the Demo project - SvHmiDemo

2.1 Deploy a project


Because each project is in its own folder, deployment is very easy. You have only to copy the project folder to the target computer - thats all!

Module 04 - PcVue and project concepts

Page 4/15

3 Run PcVue
3.1 Shortcuts
Several shortcuts are installed by the set-up program.

Figure 2

Hmi sample project: Run a demo which highlights the features of the HMI. PcVue: Run PcVue. Web sample project: Run a demo implementing WebVue access.

Module 04 - PcVue and project concepts

Page 5/15

Communication folder: Include shortcuts relative to the BACnet communication.

Figure 3

Documentation folder: The documentation in your chosen language. Documentation for other languages can be installed by re-starting the PcVue installation and selecting the Modify option.

Figure 4

Tools folder: Include shortcuts to launch extra tools.

Figure 5

Components registration: Launch the registration tool (described in Module 03 Versioning and licensing). Database Import: Launch the software used to restore database archives. Database Manager: Launch the software used to manage the database archives. Remote License Manager: Launch the software used to upgrade the license (described in Module 03 Versioning and licensing).

Module 04 - PcVue and project concepts

Page 6/15

3.2 Command line


The command line for PcVue is "C:\Program Files\ARC INFORMATIQUE\PCVUE \bin\sv32.exe" -b "C:\Pcvue Projects" s where: "C:\Program Files\ARC INFORMATIQUE\PCVUE ...\bin\sv32.exe" is the path of the executable. This folder is the one you selected during set-up. -b "C:\Pcvue Projects" is an option indicating to PcVue the path of the projects folder. This folder is the one you selected during set-up. s opens a dialog box when PcVue starts so that the user can select an existing, or create a new, project. The main options are: Option -s -b Folder_path -p project_name Description PcVue opens a dialog box for the user to select the project. This option is recommended for the designer. PcVue uses the projects located in the folder Folder_path. PcVue automatically loads the project project_name. This option is recommended on site.

Exercise 1.

Select the PcVue shortcut on your desktop. Check the options configured by default. Run PcVue. (In the Select Project dialog, select Demo version then OK).

Module 04 - PcVue and project concepts

Page 7/15

3.3 Create a project


For our training we are going to create a new project named TRAINING. There are several ways to do it. Using Windows Explorer to create a new folder in C:\Pcvue projects\USR\TRAINING, Using the PcVue HMI. Run PcVue. Select Demo version. In the Select Project dialogs Project field, type TRAINING.

Figure 6

Click the OK button and confirm. Switch off PcVue by pressing the F10 key or by selecting the menu File/Exit or clicking the icon .

Now a new project has been created. We can see a new folder C:\Pcvue projects\USR\TRAINING. Each project has several sub-folders. The list of the folder structure is described in the Help file here: About the Supervisors projects \ About projects.

Module 04 - PcVue and project concepts

Page 8/15

3.4 What is running?


When PcVue is running you can see:

Figure 7

[A] PcVue workspace. [B] Event viewer icon located in the taskbar. (See the Traces chapter.) [C] HDS icon located in the System Tray. (See the Module Archives HDS.)

Module 04 - PcVue and project concepts

Page 9/15

3.5 Traces & logs


The PcVue Event Viewer is a vital tool because it is the place where all important information is displayed. When something is not working as you expect you must check the Event Viewer. It should be your first recourse. The traces are recorded in the following file: "C:\ARC INFORMATIQUE\PCVUE ...\bin\Log Files\trace.dat" If you check this folder you can see many files. These traces and logs are useful for helping our developers to analyze any problem. If you have a crash you must send the complete Log Files folder to our Technical Support.

Module 04 - PcVue and project concepts

Page 10/15

4 PcVue architecture
PcVue is modular software running several processes. Each process is in charge of a function. The following diagram shows the processes and features.

Figure 8

Module 04 - PcVue and project concepts

Page 11/15

5 The Application Explorer


The Application Explorer is a new way to manage the configuration of a PcVue application. It replaces the old style one-at-a-time configuration dialogs with a tool that allows you to visualize the configuration of the entire application in one Windows Explorer style view.

5.1 Main features

Figure 9

[A]: Main menu. [B]: Main toolbar. [C]: Task pane. Displays tasks relevant to both the selected configuration folder and the item selected in the contents pane. [D]: Configuration window. The main configuration window from where the configuration tree is navigated and the configuration modified.

Module 04 - PcVue and project concepts

Page 12/15

[E]: Configuration tree. Displays all the configuration items, available to the Application Explorer, in a tree display. Each major configuration aspect is represented by a folder. [F]: Contents pane. Displays the contents (either configuration sub folders or configuration items) of the folder selected in the configuration tree. [G]: Tool bar. Displays icons representing the tasks relevant to both the selected configuration folder and the item selected in the contents pane. In general, a copy of what is displayed in the task pane. [H]: Behaviors pane. Only displayed when the Variables Tree is selected in the configuration tree. Displays any associated behavior for the variable selected in the contents pane. (Events, trending etc.) [I]: Behaviors tool bar. Only displayed when the Behaviors Pane is displayed. Displays icons that represent the tasks that add, modify and delete variable behaviors.

5.2 Using the Application Explorer


This topic explains how you use the Application Explorer in general, not how you create a particular configuration using it.
5.2.1 Opening and closing the Application Explorer

The Application Explorer is opened from PcVues main menu using the command Configure / Application Explorer. To close the Application Explorer use the File.Exit command on the Application Explorers menu or the Exit tool on the toolbar. Although it can only be started from within PcVue, the Application Explorer runs as a separate task within Windows. If you click in PcVues Workspace while the Application Explorer is open, PcVue is moved to the front and takes focus. The Application Explorer remains open but is hidden by the Workspace.
5.2.2 Changing the appearance of the Application Explorer

The size of the Application Explorer can be changed by dragging its borders or corners. The size of any of its three panes can be changed by dragging the border separating it from the adjacent pane. The position of the Application Explorer is changed in the normal way by dragging its title bar. You can select the columns that appear in the Contents Pane from a pop-up menu that is displayed by right clicking in it (outside of any items it is displaying). The columns that are available depend on the type of configuration folder that is selected. Changes that you make to the Application Explorer's appearance are remembered. If you close and then re-open the Application Explorer it appears in the same position, with the same panes sizes etc. Module 04 - PcVue and project concepts

Page 13/15

5.3 What can be configured from the Application Explorer?


Communication o Data acquisition - OPC, DDE, LNS, BACnet, IEC 104 & IEC 61850 o Networking - Inter-station networking for client-server applications o Servers - When using the Supervisor as an OPC server or Web server. Variables o Variables tree - Branches, Bit, Register and Text variables o Associated behaviors - Overflow processing, Thresholds, Discrepancy checking, Chronometer, Counter and Events o Domain and Nature o Expressions o Alarm synthesis Archives o Archive units - Free, Proprietary and Database o Databases o Trend Groups Actions o Messages - Email and SMS o Cyclics o Events User accounts o Users o Profiles

Exercise 2.

To open and become familiar with the operation of the Application Explorer a. Open the Application Explorer using the main menu command Configure.Application Explorer. b. Expand the configuration tree and observe what is available. c. Note how the tasks available in the Task List change depending on which configuration aspect is selected.

Module 04 - PcVue and project concepts

Page 14/15

With the Application Explorer open, click into the PcVue Worskspace. The Application Explorer disappears. Try opening it again using the menu command Configure / Application Explorer. What happens? Why?

It appears faster than the first opening. Thats normal because the Application Explorer stays opened.

Module 04 - PcVue and project concepts

Page 15/15

Introduction

Module 05 Study case

Contents

1 2 3

Study case Design process Study


3.1 Specifications and needs 3.2 Architecture proposed 3.3 HMI navigation proposed 3.4 Functional blocks

3 4 5
5 5 6 7

Module 05 - Study case

Page 2/7

1 Study case
During this training course we will create a complete project implementing the common features needed for most real projects. SCADA software is used in various industries (power supply, water treatment, manufacturing etc.). We have selected a building management project because it can be understood without specialist knowledge.

Figure 1

Module 05 - Study case

Page 3/7

2 Design process
You can design a PcVue project in several ways but, because PcVue is object oriented, there is one best way represented by the following diagram.

Figure 2

We will try to follow this procedure to design our study case.

Module 05 - Study case

Page 4/7

3 Study
3.1 Specifications and needs
Our imaginary customer requires a project with the following features: This building has three floors. The first floor has three rooms. The second and third floors have five rooms and are identical. All rooms have one air conditioner and one light. One room on the first floor has two air conditioners and two lights. Collect the data from one PLC and one OPC server. The same layout for each mimic. Good, clear navigation among mimics. Display all data about all the air conditioners and lights. Manage the alarms. Archive the data and display them on trends and logs. Display the status of the devices we are communicating with. Manage several User Accounts.

Specifically for the training we want to have mimics to display some basic features such as animations. Later when you design an actual project you can come back to these mimics to remind you.

3.2 Architecture proposed


This project will implement a single PcVue station in stand-alone mode. The following diagram represents the architecture:

Figure 3

Module 05 - Study case

Page 5/7

3.3 HMI navigation proposed


We can represent the navigation by the following diagram:

Figure 4

Module 05 - Study case

Page 6/7

3.4 Functional blocks


We can identify 3 functional blocks. Air conditioners. The data involved are: o Temperature value, o On/Off, o Temperature set point, o Temperature High/Low limit, o Brand, model, vendor details. Lights. The data involved are: o On/Off, o Luminosity value, o Control. The mimic layout. The common objects we want to display are: o Logo, o Navigation bar, o Login/Logout button, o Date, time and current user, o Current alarms.

Module 05 - Study case

Page 7/7

Variables

Module 06 Real time database Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PCVUE architecture Basics


3.1 Mandatory properties 3.1.1 Type 3.1.2 Name 3.1.3 Source 3.2 Main optional properties 3.2.1 Description 3.2.2 Command 3.2.3 Properties related to variable type 3.3 Managing variables using Application Explorer 3.3.1 Creating a branch 3.3.2 Creating a variable 3.4 Variable Selector 3.4.1 The variables tool bar

4 5
5 5 5 7 7 7 7 7 8 9 10 12 13

4 5

Run-time properties Summing-up

15 16

Module 06 - Real time database Basics

Page 2/16

1 Introduction
1.1 In this module you will learn
About the main properties of PcVues variables, How to manage variables using the Application Explorer, How to use the Variable Selector.

1.2 Files used in this module


None

1.3 Third party software used in this module


None

Module 06 - Real time database Basics

Page 3/16

2 This feature in PCVUE architecture

Figure 1

Module 06 - Real time database Basics

Page 4/16

3 Basics
Real-time data is the engine of PcVue. It is managed as a collection of tags. In PcVue terminology a tag is called a Variable. The collection of variables in a project is known as the Variables Tree because of the tree-like structure of the variable naming scheme. When each variable is created it is given characteristics selected from a range of properties which determine its behaviour. Some properties are mandatory and some are optional.

3.1 Mandatory properties


The mandatory properties are: Type Name Source 3.1.1 Type PcVue supports three types of variables: Bit: Digital value Register: Analogue value Text: Text value 3.1.2 Name The variable's name is the identity by which it is known throughout PcVue. The name of a variable is a string composed of up to twelve fields delimited by the character .. All but the last part of the variable name is also known as its branch. Using branches you can group a set of variables together as they would be in the outside world. For example a Bit, two Registers and a Text variable could be grouped together to represent a simple temperature controller. For example: BUILDING.FLOOR_01.AC_01.INFO BUILDING.FLOOR_01.AC_01.ON BUILDING.FLOOR_01.AC_01.SETPOINT BUILDING.FLOOR_01.AC_01TEMP If the variables in the example above are represented in a (horizontal) tree format the grouping becomes more apparent. In the example that follows there are two temperature controllers plus two lights making a total of 14 variables.

Module 06 - Real time database Basics

Page 5/16

Figure 2

Arranging variables in hierarchical groups simplifies development and maintenance as tools in the Application Explorer allow you to cut, copy and paste entire branches with their variables. The main benefit however lies in how the variables tree is used in conjunction with graphical objects to accelerate the development of your project.

The main limits are: The name can contain a maximum of 12 fields. The maximum total size of a name is 255 characters including the delimiters ..

Module 06 - Real time database Basics

Page 6/16

3.1.3 Source To determine the source of a variable you ask yourself the following question: Where is the value for this variable coming from? The various sources are: Equipment: The value is collected from a device using one of the native drivers (i.e. Modbus TCP/IP), OPC: The value is collected from an OPC Server, Lonworks: The value is collected from a Lonworks network, DDE: The value is collected from a DDE Server, BACNet: The value is collected from a BACNet network, IEC: The value is collected from either an IEC 61850, or IEC 60870-104 network, Internal: The value is not collected from any outside source but the variable still belongs to the real-time database. (The value may be calculated using an expression or script.)

3.2 Main optional properties


Here are the main optional properties. During the training we will discover several more. 3.2.1 Description A string describing a variable. You can display the description in the HMI instead of the variables name.

We recommend that you always use the Description property.


3.2.2 Command The Command property is used to determine whether a variable can be set by PcVue or not. 3.2.3 Properties related to variable type Some optional properties depend on the variable type. For example when a variable is a Register it has a Units property and a Minimum/Maximum range.

Module 06 - Real time database Basics

Page 7/16

3.3 Managing variables using Application Explorer


There are two stages to creating a variable with the Application Explorer (AE). First you must create the branch to which it belongs. Then you can create the variable itself. Of course the same branch can have several variables and once you have created all the variables for a branch it is easy to create another similar branch using copypaste.

The term Branch can refer to the entire branch to which a variable belongs, or just part of it. The same as in a real tree where you can have a big branch made of several smaller branches. The term Variable Name is sometimes used to refer to just the last part of the name (for example SETPOINT or ON) or as an abbreviation for the Complete Variable Name meaning the Branch plus the Variable Name. (for example BUILDING.FLOOR_01.AC_01.ON).
The following steps all take place within the Application Explorer that is opened using the menu command Configure / Application Explorer.

Module 06 - Real time database Basics

Page 8/16

3.3.1 Creating a branch Expand the configuration tree and select the Variables Tree.

Step 1. From the task list select Add a branch. The Branch Creation dialog
opens. Enter the Branch name and click OK. A new branch is created.

Figure 3

Step 2. Select the newly created branch and repeat the process to create its
sub branch .

Step 3. Repeat this procedure until you have created the complete branch.

Module 06 - Real time database Basics

Page 9/16

3.3.2 Creating a variable

Step 1.

Select the branch that has just been created, and from the task list select Add bit. The Bit Creation dialog opens.

Figure 4

Step 2. Step 3.

Enter the variable name and click the OK button to confirm the configuration. You should now have a Bit variable.. Save the configuration using the Application Explorers menu command File / Save.

Save makes a backup of the configuration on the hard drive.

You must have at least one variable on a branch otherwise the branch is not remembered when the Application Explorer is closed. The branch will disappear only if you restart PcVue, not the
Application Explorer.

Module 06 - Real time database Basics

Page 10/16

Exercise 1.

Now we can start our project. Determine a variable naming scheme for our project. Create the variables for one Air Conditioner.

1. Determine the naming scheme Field 1: BUILDING Field 2: FLOOR_XX where XX is the Floor number Field 3: DeviceType_DeviceID where - DeviceType is AC for air conditioners and LT for lights. - DeviceID is the identifier of the device. Field 4: The information itself (Temp for temperature, etc.) Of course this naming scheme is not the only appropriate one. With some experience you will know what suits a particular project. 2. Create the following variables (with all other properties at their default settings): Name BUILDING.FLOOR_01.AC_01.TEMP BUILDING.FLOOR_01.AC_01.SETPOINT BUILDING.FLOOR_01.AC_01.ON BUILDING.FLOOR_01.LT_01.LUM BUILDING.FLOOR_01.LT_01.ON BUILDING.FLOOR_01.LT_01.CMD Type Register Register Bit Register Bit Bit Source Internal Internal Internal Internal Internal Internal Description Temperature Set point Air cond. On Luminosity Light On Command

Note that the Complete Variable Name is given. Using the Application Explorer you will first have to add the branches and then the variables.

Module 06 - Real time database Basics

Page 11/16

3.4 Variable Selector


The Variable Selector is the tool provided to browse the variables. It can be opened from the menu using the command Configure / Variables / Selector.

Figure 4

The Selector is useful to find a variable and to display and edit its properties.

Figure 5

Module 06 - Real time database Basics

Page 12/16

The Selector has four functional areas: [A]: Menu. [B]: Variables tool bar. (See below) [C]: Left pane. Displays the variables tree. [D]: Right pane. Displays branches and variables sub-ordinate to the branch that is currently selected in the variables tree. The display of a variable includes its main properties and real time value and status (See the section on Run-time properties). [E]: Associated behaviours toolbar. Tools to add modify and delete a variables associated behaviour. The tools that are available depend on the type of variable that is selected. [F]: Lower pane. Displays any associated behaviour for the selected variable.

You can change the properties that are displayed in the right pane by right clicking in the pane and selecting them from a context menu.
3.4.1 The variables tool bar The commands available in the tool bar change depending on what is currently selected. Here is a complete list. Add a new sub-branch to the branch selected in the variables tree. Add a new bit variable to the branch selected in the variables tree. Add a new register variable to the branch selected in the variables tree. Add a new text variable to the branch selected in the variables tree. *Display the selected variables properties. *Delete the selected variable or branch. Copy the selected variable or branch. Cut the selected variable or branch. Paste the selected variable or branch. * The icon that is displayed depends on the type of variable or branch selected. Module 06 - Real time database Basics

Page 13/16

Exercise 2.

Make the following modifications.

Name BUILDING.FLOOR_01.AC_01.TEMP BUILDING.FLOOR_01.AC_01.SETPOINT BUILDING.FLOOR_01.AC_01.ON BUILDING.FLOOR_01.LT_01.LUM BUILDING.FLOOR_01.LT_01.ON BUILDING.FLOOR_01.LT_01.CMD

Command /Control No Yes Yes No No Yes

Unit Celsius Celsius

Min/Max 0/40 0/40

0/100

Module 06 - Real time database Basics

Page 14/16

4 Run-time properties
Each variable is represented at run-time by three properties: Value: The possible values for each type are: o Bit: 1 (True), 0 (False) o Register: -3.37E+38 to +3.37E+38, o Text: 1 to 32,000 characters. Timestamp: The timestamp usually gives the time when PcVue receives the variable value from a device. When PcVue is using a time stamped protocol (like OPC) the timestamp is provided by the device. Status: There are 2 main statuses: o S (Set): The variable is valid. We can be sure that the value is usable. o NS (Not Set): The variable is not valid. We are not sure whether the value is usable. For example when a sensor is out of order, the value given by the device may be out of range. For PcVue the status is then NS.

A list of the statuses is available in the online Help in the topic: Application Explorer / Variables / Variables tree / Using the Variable Selector.

Module 06 - Real time database Basics

Page 15/16

5 Summing-up
Real-time data is the engine of PcVue. The Variable Tree is made up of Branches and Variables. You must decide on a suitable naming scheme. A variable has many properties. The status of a variable indicates its validity.

Module 06 - Real time database Basics

Page 16/16

Variables

Module 06 Real time database Advanced

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PCVUE architecture Advanced


3.1 Use the deadband 3.2 Opening the Variable Selector using a shortcut key 3.3 Edit variables using a third-party tool

4 5
5 7 8

Summing-up

11

Module 06 - Real time database Advanced

Page 2/11

1 Introduction
1.1 In this module you will learn how to
Optimise your project using the deadband. Reduce design time by: Using a shortcut key, Editing the Variable Database file using Microsoft Excel.

1.2 Files used in this module


Project started with the Basics module.

1.3 Third party software used in this module


Windows Notepad, Microsoft Excel 2003 or later.

Module 06 - Real time database Advanced

Page 3/11

2 This feature in PCVUE architecture

Figure 1

Module 06 - Real time database Advanced

Page 4/11

3 Advanced
3.1 Use the deadband The deadband is the value by which the source of the variable must vary before the change is recognised by PcVue. It applies to Register variables only.
The deadband property is very important and must be set for each Register variable that has a lot of activity. In practice, unless you have an unusually stable source, that applies to all Register variables where the value is generated externally to PcVue. Each time you create a Register variable, ask yourself: Am I interested in all changes in value of this register no matter how small?. For example when a Temperature shifts from 15.15 degrees to 15.16 degrees, perhaps you dont want to record this change. In this case you have to configure the deadband for this temperature. You will then optimise your application by decreasing the activity in PcVue. You configure the deadband of a Register variable from the Advanced tab of its Properties dialog.

Figure 2

There are three types of deadband: Absolute Range percent Value percent.

The deadband property does not appear if the variable has an Internal source.

Module 06 - Real time database Advanced

Page 5/11

The differences are explained in the following diagram. Here we assume that the current value is 15 and the deadband configured is 1.

Figure 3

Module 06 - Real time database Advanced

Page 6/11

3.2 Opening the Variable Selector using a shortcut key


The Variable Selector is a tool that you will use frequently. By default there is no shortcut key to open it. To configure it: Use the menu Configure / Actions / Function Key...

Figure 4

Click Create... button Configure the dialog as shown below. Click the OK button.

Figure 5

Click the Save button and then the OK button. Module 06 - Real time database Advanced

Page 7/11

3.3 Edit variables using a third-party tool


If you have a large number of variables, creating them using PcVue can be a long process. Fortunately you can use a third-party tool such as Microsoft Excel to create variables quickly.

The complete Variables Tree is in one ASCII file in CSV* format. It is located in the following path: <Project Name>\C\Varexp.dat
*Comma Separated Variable Whatever tool is used for editing, the procedure is the same:

Step 1. Stop PcVue, Step 2. Make a copy of the Variables Tree file (just in case of any problems
when editing),

Step 3. Open the Variables Tree file, Step 4. Make your modifications and save, Step 5. Re-start PcVue.
Because the file Varexp.dat is an ASCII file you can use any text editor such as Notepad to edit the Variables Tree.

Module 06 - Real time database Advanced

Page 8/11

Exercise 1.

Add the following variables using Notepad.

Name BUILDING.FLOOR_01.AC_02.TEMP BUILDING.FLOOR_01.AC_02.SETPOINT BUILDING.FLOOR_01.AC_02.ON

Type Register Register Bit

Source Internal Internal Internal

Description Temperature Set point Air cond. On

The best way to do is to copy the existing variables and change their names.

Modify the file Varexp.dat while PcVue is running and then shut down PcVue. What happened?

Module 06 - Real time database Advanced

Page 9/11

Of course Notepad is not very useful for this and the best tool to modify the PcVue Variables Tree is Microsoft Excel.

The format to save the Varexp.dat in Excel is very specific. You must name the file Varexp.dat and select the CSV format (MS-DOS, *.csv).

Exercise 2.

Add the variables for the first floor using Excel.

Reminder of the specifications: This building has three floors. The first floor has three rooms. The second and third floors have five rooms and are identical. Most rooms have one air conditioner and one light. One room has two air conditioners and two lights. It is on the first floor. That means we will have: Floor Floor 1 Floor 2 Floor 3 Air conditioners 4 5 5 Lights 4 5 5

The second line of the file Varexp.dat contains the title of each column. You can find the detailed format of the file Varexp.dat in DVD\Sv\Documentation\Addenda\English\VAREXP_100_ENU.pdf.

Module 06 - Real time database Advanced

Page 10/11

4 Summing-up
You can dramatically improve your applications performance using the deadband feature. With Microsoft Excel, you can accelerate creation of the Variables Tree.

Module 06 - Real time database Advanced

Page 11/11

Communication

Module 07 Usual drivers - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 Communication concepts 3.1.1 Network, protocol and node 3.1.2 Master/Slave and Frame 3.1.3 Variable mapping 3.2 Configuration in PcVue 3.2.1 Communication configuration 3.2.2 Variable mapping 3.3 Optimisation and maintenance 3.3.1 PcVue Communication Manager 3.3.2 Maintenance and debugging 3.3.3 Start automatically after PcVue start-up

4 5
5 5 6 12 13 13 22 26 26 29 32

Summing-up

33

Module 07 - Usual drivers - Basics

Page 2/33

1 Introduction
1.1 In this module you will learn
Some communication concepts, How to configure communication in PcVue, How to optimize and maintain it.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_07\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


We will use the Modbus Poll and Modbus Slave (Evaluation license). These files can be found here: My Documents\Pcvue Training\Module_07\Third party\.

Module 07 - Usual drivers - Basics

Page 3/33

2 This feature in PcVue architecture

Figure 1

Module 07 - Usual drivers - Basics

Page 4/33

3 Basics
3.1 Communication concepts
3.1.1 Network, protocol and node

PcVue uses a set of communication protocols to communicate with the process equipment across a network or several networks. There are three types of industrial networks: Serial link: RS232 or RS485 cables. PcVue uses the computers COM port or a dedicated communication board such as Applicom. For example Modbus RTU, Mitsubishi MELSEC-A Series etc. Ethernet: PcVue uses the computers Ethernet card. For example Modbus TCP/IP, Siemens S7 etc. Dedicated: A proprietary medium, for example Modicon Modbus+, Profibus etc. The following diagram describes the classic architecture.

Figure 2

When two systems are communicating they need to speak the same language. A protocol is a standard language used by two systems to communicate together. PcVue supports a wide and increasing range of industrial protocols. During this training course we will use Modbus TCP/IP as an example but what you will learn also applies to many other protocols. In PcVue vocabulary, the PLC is called a Node.

Module 07 - Usual drivers - Basics

Page 5/33

3.1.2 Master/Slave and Frame

Usually a protocol implements two types of talkers: The Master and the Slave(s). The Master is the one that makes the requests to the Slave(s) to read and/or write the data. The Slave listens on the network waiting for a request sent by the Master.

In the Ethernet environment the Master is sometimes called the Client and the Slave is called the Server.
In most cases, PcVue is the Master and the PLC is the Slave. In PcVue vocabulary, the request is called a Frame. A frame is a message containing all the parameters needed to read or write data. For example a Modbus frame contains the Node address, the function code (read or write, bit or words, input or output etc.), the data address and quantity and a CRC (Cyclic Redundancy Check used to check that the message hasnt been corrupted). The process used by the master to collect the data is always the same: it periodically sends a frame to the slave, waits for the answer, sends another frame and so on. The following diagram represents the typical Master/Slave process.

Figure 3

The Master sends a frame to read some bits and waits for the reply. The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on

Module 07 - Usual drivers - Basics

Page 6/33

The period configured for one frame is called the polling period.
Of course a Master can read different types of data in the same Slave. The following diagram represents this process.

Figure 4

The Master sends a frame to read some bits and waits for the reply. The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on...

The Master sends a frame to read some words and waits for the reply. The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on...

Module 07 - Usual drivers - Basics

Page 7/33

Exercise 1.

Create basic communication using the third party tools

1. Install Modbus tools package a. Run My Documents\Pcvue Training \Module_07\Third party\ModbusPollSetup.exe and follow the instructions. b. Run My Documents\Pcvue Training\Module_07\Third party\ ModbusSlaveSetup.exe and follow the instructions. 2. Start the Modbus TCP/IP Slave. a. Run the shortcut Modbus Slave located on the desktop. b. By default one Slave is configured. Close it by selecting File / Close. c. Load the Training slave configuration by selecting File / Open. In the dialog, select My Documents\Pcvue Training \Module_07\Third party\ Slave 1 - 10 Bits.mbs. d. Repeat the same operation by opening the file My Documents\Pcvue Training \Module_07\Third party\ Slave 1 10 Words.mbs. e. Select Connection/Connect, the Register Later button, then the OK button. f. Select the TCP/IP option.

Module 07 - Usual drivers - Basics

Page 8/33

g. Finally you should have the Slave HMI with these settings:

Figure 5

h. You can change the data values by double-clicking on the corresponding cell.

Module 07 - Usual drivers - Basics

Page 9/33

3. Start the Modbus TCP/IP Master. a. Open the shortcut Modbus Poll located on the desktop. b. By default a frame is configured. It is set for reading 10 words from address 0 to Slave no.1. So you only have to select Connection / Connect Now you are able to read and write the Words. c. We are going to create a frame to read the bits. Select File / New. Select Setup / Read/Write definitions and configure the dialog as follows:

Figure 6

d. Select Connection / Connect... Select TCP/IP. Now you are able to read and write the bits. 4. Check the frames using Display / Communication.

Module 07 - Usual drivers - Basics

Page 10/33

Try to read data to an Illegal Address (i.e. address 11) and check the frame reply. Try to send an Illegal Function (i.e. Write Input Registers) and check the frame reply. What do you see?

Module 07 - Usual drivers - Basics

Page 11/33

3.1.3 Variable mapping

When the Communication Manager receives a reply it needs to dispatch the various values to the PcVue variables. This means that it needs to know which PcVue variable corresponds with each Slave address. This is the purpose of variable mapping. The following diagram shows a mapping example for a frame requesting 10 Words starting at address 0.

Figure 7

Module 07 - Usual drivers - Basics

Page 12/33

3.2 Configuration in PcVue


There are two main steps: Configure the communication itself, Configure the variable mapping.
3.2.1 Communication configuration

Communication is defined in terms of these communication objects: Network, Node, Frame.

Each communication object has common parameters and sometimes specific ones also. You can find the specific parameters for a protocol in the Help here: F1/Configuration/Communication/Native communication drivers/Configuring a protocol.
The configuration is done using the Communication Objects dialog. You can open it via Configure / Communication / Equipment.

Figure 8

Module 07 - Usual drivers - Basics

Page 13/33

Figure 9

[A]: Three columns displaying the configured communication objects: Network, Node and Frame. Of course by default it is empty. [B]: Status of the communication objects. Used for maintenance. [C]: On / Off buttons. Used to start and stop the entire communication manually. [D]: Validate / Cancel buttons.

Module 07 - Usual drivers - Basics

Page 14/33

3.2.1.1 Network

The Network object defines the protocol and the board used. You can have up to 16 different protocols on the same project. To create a network:

Step 1. Step 2. Step 3. Step 4.

Open the Communication Objects dialog. Double-click the Network / Creation field. The dialog Network board and protocol selection appears.

In the left-hand column, select the appropriate protocol provider and the protocol in the right-hand column. Click OK button.

Figure 10

We advise you always to select the MULTI PROTOCOL board. Step 5. Step 6.
The Network Parameters dialog appears. Type the Network object name in the Network field.

Module 07 - Usual drivers - Basics

Page 15/33

Figure 11

Step 7.

Click the Validate button then Cancel to close the dialog.

Now a new Network has been added in the Network column. To edit a Network object, double-click on it.

Exercise 2.

Create a new Network with the following parameters:

Parameters Protocol Network name

Value 1 Modbus TCP/IP (XBUS-IP-MASTER) XBUS_IP

Module 07 - Usual drivers - Basics

Page 16/33

3.2.1.2 Node

The node object of a Network defines a device communicating with the corresponding protocol. To create a Node:

Step 1. Step 2. Step 3. Step 4.

Select the Network. Double-click the Node / Creation field. Type the Node object name in the Equipment field. Enter any other parameters that are needed. The parameters depend on the protocol and the PLC type.

Figure 12

Step 5.

Click the Validate button then Cancel to close the dialog.

Now a new Node has been added in the Node column. To edit a Node object, double-click on it.

You must keep the message time-out parameter at the default value (0) except with some particular old devices.

Module 07 - Usual drivers - Basics

Page 17/33

Create a new Node with the following parameters:

Exercise 3.

Parameters Node name Equipment type TCP/IP address Slave address

Value 1 PLC1 MODBUS DEC 127.0.0.1 (your computers address) 1

Module 07 - Usual drivers - Basics

Page 18/33

3.2.1.3 Frame

The Frame object defines the request to be sent to the node. To create a Frame:

Step 1. Step 2. Step 3. Step 4.

Select the Node. Double-click the Frame / Creation field. Type the Frame objects name in the Frame field. Select the Frame format and Access grant.

Figure 13

Module 07 - Usual drivers - Basics

Page 19/33

Step 5.

Select the address by clicking on this button: . The Address selection dialog appears. Each line displayed corresponds with an address zone in the Node, so it depends on the protocol and the node type. The address zone corresponds to the Function configured in the Modbus Poll tool as shown below.

Figure 14

Step 6. Step 7. Step 8.

Select the appropriate Address zone, the Starting address and Quantity of data then click the OK button. Configure the scan rate (polling period). Click the Validate button then Cancel to close the dialog.

Now a new Frame has been added in the Frame column. To edit a Frame object, double-click on it.

The parameter Priority mode is used in particular cases. Misuse can cause problems with performance.

Module 07 - Usual drivers - Basics

Page 20/33

Exercise 4.

Create two new Frames with the following parameters:

Parameters Frame name Frame format Access grant Address zone Starting address Quantity of data Polling period

Frame 1 R_BITS BIT Read Bit I/O 1 10 1 second

Frame 2 R_WORDS WORD Read Word I/O 1 10 1 second

For one frame, select the starting address 0. What happened? Why?

Module 07 - Usual drivers - Basics

Page 21/33

3.2.2 Variable mapping

To configure the mapping for a variable:

Step 1. Step 2.

Open the Properties dialog of a variable.

In the Source tab select the communication network name. The dialog changes appearance to display an Equipment sub-tab. Click the Link button.

Figure 15

Module 07 - Usual drivers - Basics

Page 22/33

Step 3.

The Equipment Mapping dialog appears.

Figure 16

[A] Communication objects, [B], Address.

Step 4. Step 5. Step 6.

Select the frame object [A] you want to map the variable.

Double click the address [B] to which you want to map the variable. The Equipment Mapping dialog closes and the mapping information appears in the Source tab of the Properties dialog. Confirm the configuration and close the Properties dialog by clicking the OK button.

Module 07 - Usual drivers - Basics

Page 23/33

Exercise 5.

Communicate with PcVue and the Modbus Slave tool.

1. Create two equipment variables with the following properties: Name FROM_PLC.BIT1 FROM_PLC.WORD1 Type Bit Register Source Equipment Equipment 0 100 Min Max

2. Map these 2 variables by selecting a valid address. 3. Start the Modbus Slave. 4. Start the communication and check the variables values.

Disconnect the Modbus Slave. What are the variables values?

Module 07 - Usual drivers - Basics

Page 24/33

In the Modbus Slave, set the Word value to 150. What is the value of the PcVue variable? Why?

When does the following Timestamp change?

Module 07 - Usual drivers - Basics

Page 25/33

3.3 Optimisation and maintenance


Unfortunately it is unusual to implement communication successfully the first time!
3.3.1 PcVue Communication Manager

The Communication Manager is the module that manages the processing of frames as shown below.

Figure 17

Here we have two frames: Frame2 and Frame10 have polling periods of 2 and 10 seconds respectively. Each polling period, the frame is added to the communication stack. When at least one frame is in the stack it is sent to the Slave. When the slave reply is received the frame is removed from the stack. When you are configuring communication you must try to optimize it as much as possible. To do that you must tune these three parameters: The number of frames, The polling period, The write data.

Module 07 - Usual drivers - Basics

Page 26/33

3.3.1.1 Number of frames

Its usual to suppose that a frame requesting 10 words is faster than a frame requesting 100 words. Actually this is wrong. The time used to read 10 or 100 word is the same. This is because during an exchange, most of the time consumed is used to build and transmit the frame. Therefore most of the time spent in the communication process is to manage the frames whatever their size. To understand that, try to solve this basic problem: 100 people want to travel from a point A to point B linked by a highway. This highway has a toll at the beginning and a toll at the end. The question is: Which is the faster? 100 cars transporting one person each or one bus transporting 100 persons (assuming the speed of the car and the bus is the same of course)?

Figure 18

Of course its faster using the bus as it is only processed once at the tolls, whereas each car must be processed individually. So using one frame transporting 100 data items is faster than 100 frames transporting 1 data item.

To have smooth traffic you must configure the communication to have the minimum number of frames.
3.3.1.2 Polling period

The polling period is also an important parameter to optimise the communication. If the Master is polling too fast it will increase the traffic on the network. For example we know that when you are using a Modbus serial link communication with 19,200 baud and one frame needs around 100ms to go and back to the Master. Module 07 - Usual drivers - Basics Page 27/33

It means you can have up to 10 frames per second. What will happen if you configure 15 frames with a polling period of 1 second each?
3.3.1.3 Write data

Some projects need to write data to the PLC. In theory there is no problem with sending a frame to write data in the Slave. But a performance problem occurs when you send many controls at a fast rate. The following figure helps you to understand why:

Figure 19

You can see that PcVue is managing two stacks: the read frames stack and the write frames stack. The write frames stack is always in priority because a control can be very important. If you send a control every second then PcVue will add the write frame every second on the top of the write frames stack. Therefore the frames from the read frames stack will never be sent and the HMI never refreshed!! A classical mistake is to send a heartbeat to the PLC too frequently.

Dont send controls that are too many and/or too fast. If you need to send many values in one shot to the PLC you must use the Recipe function. Check the Recipe module in this training course.

Module 07 - Usual drivers - Basics

Page 28/33

3.3.2 Maintenance and debugging

In case of failure, PcVue provides some status information to help you to find the problem. When a communication object is selected, the system supplies a set of states and counters. Two hexadecimal state codes and two error counters are associated with each network, equipment and frame. You can select them in real time by selecting the required network, equipment and frame. The figure below shows the State/Counter for the selected network.

Figure 20

Module 07 - Usual drivers - Basics

Page 29/33

Its important to understand the difference between the Status and the Protocol Status. The Status is set by the Communication Manager and informs you of whether this object is communicating well or not. Here you can see various status values: Network 0700 0700 Node 0700 0700 Frame a000 e000 Meaning The communication is fine! The communication is working but the unstacking is slower than the stacking (See Figure 17). Solution: Increase the scan period. 0413 Network error: PcVue cannot communicate with the selected COM channel. Solution: COM port problem, Ethernet card disabled etc. 0701 0701 xxxx Communication out of order for this frame. Solution: Check the Protocol status and check the frame parameters. The protocol status is a code sent by the equipment or by the protocol driver. For example if you try to read data which is outside of the PLCs range it will send back a code. PcVue will display this code in the Protocol status.

This code depends on the drivers implementation. Check the driver documentation (in PcVues online Help) or the PLCs documentation.
When a communication failure occurs, PcVue adds a new log in the Event Viewer. Then you can debug in Runtime mode as well. The following message is an example: Status a021 - 2 - 1658 - 562, (1.XBUS_IP.PLC1.R_WORDS) with Status a021: Frame status 2: protocol status 1658: State counter 1 562: State counter 2 (1.XBUS_IP.PLC1.R_WORDS): Frame name

Module 07 - Usual drivers - Basics

Page 30/33

Exercise 6.

Disconnect the Modbus Slave and check the different Communication status. Also check the Event viewer.

Module 07 - Usual drivers - Basics

Page 31/33

3.3.3 Start automatically after PcVue start-up

By default the native driver communication is off when PcVue starts up. To start the communication automatically:

Step 1. Step 2. Step 3.

In the Application Explorer configuration tree, select the node representing the project. From the task list select Settings. In the left pane, select the Station start-up node. Tick the Equipment option.

Figure 21

Module 07 - Usual drivers - Basics

Page 32/33

4 Summing-up
PcVue is able to communicate with many protocols on a serial network, an Ethernet network or proprietary networks. The communication configuration uses three objects: network, node and frame. You can debug failed communication using the communication objects status. The communication MUST be optimised.

Module 07 - Usual drivers - Basics

Page 33/33

Communication

Module 07 Usual drivers - Advanced

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Communication System variables 3.2 Manage double words 3.3 Manage redundant PLCs with Ethernet protocols 3.4 How to map variables using MS Excel

4 5
5 7 10 13

Summing-up

14

Module 07 - Usual drivers - Advanced

Page 2/14

1 Introduction
1.1 In this module you will learn how to
Use the communication system variables, Manage double words, Manage redundant PLCs with Ethernet protocols, Map variables using Microsoft Excel.

1.2 Files used in this module


PcVue project developed in the Basics module.

1.3 Third party software used in this module


We will use the Modbus Poll and Modbus Slave (Evaluation license). These files can be found here: My Documents\Pcvue Training\Module_07\Third party\.

Module 07 - Usual drivers - Advanced

Page 3/14

2 This feature in PcVue architecture

Figure 1

Module 07 - Usual drivers - Advanced

Page 4/14

3 Advanced
3.1 Communication System variables
Normally, the end user requires a System view to display the state of all devices. PcVue automatically generates one system variable for each network object that is configured.

Figure 2

A list of the communication system variables is available in the online Help in: Application Explorer / Variables / System Variables / Communication Status Variables.

Module 07 - Usual drivers - Advanced

Page 5/14

Exercise 1.

Check the system variables generated by PcVue. Start the Modbus Slave and check the system variable values. Stop the Modbus Slave and check the system variable values.

Module 07 - Usual drivers - Advanced

Page 6/14

3.2 Manage double words


A classic communication problem occurs when you are reading double words and you dont know how the data is coded. A Double Word contains four bytes with the bytes at its ends known as the MSB (Most Significant Byte) and the LSB (Least Significant Byte). Unfortunately there is no standard for this and, according to the device, sometimes the LSB is transmitted first and the MSB last and sometimes it is the reverse. This coding is called LMsb:

LSB B31 B30 B29 B24 B7

MSB B2 B1 B0

Figure 3
MSB B0 B1 B2 B7 B24 LSB B29 B30 B31

Figure 4

PcVue supports both formats. When you create a frame using the Double Word format, the address zones are as follows:

Figure 5

Module 07 - Usual drivers - Advanced

Page 7/14

Exercise 2.

Check the difference between the MLsb address zone and the LMsb address zone.

1. Create a frame with the following parameters: Parameters Frame name Frame format Access grant Address zone Starting address Quantity of data Polling period Frame 2 R_DOUBLEWORDS DOUBLE WORD Read DWord I/O LMsb 1 5 1 second

2. Create a variable having the following properties and map it on the R_DOUBLEWORDS frame Name FROM_PLC.DOUBLEWORD1 Type Register Source Equipment Min 0 Max 4294967295

Module 07 - Usual drivers - Advanced

Page 8/14

3. Start the Modbus Slave and change the values as follows. For each step check the variable value.

Figure 6

4. Change the address zone for the frame R_DOUBLEWORDS to MLsb. 5. Redo step 3 and observe the difference.

Module 07 - Usual drivers - Advanced

Page 9/14

3.3 Manage redundant PLCs with Ethernet protocols


Because some customers require exceptional reliability of their system, they will use redundant PLCs. PcVue is able to manage redundant PLCs but only using an Ethernet protocol. In this configuration, when PcVue detects a communication failure with the Slave On Duty it switches automatically to the Standby Slave.

Figure 7

To configure a redundant PLC:

Step 1. Step 2.

Open the Node properties and click the Redundancy button.

Tick the Enable option for each Standby node needed (maximum 3). Then enter the parameters (TCP/IP address etc.).

Module 07 - Usual drivers - Advanced

Page 10/14

Figure 8

Module 07 - Usual drivers - Advanced

Page 11/14

Exercise 3.

Configure a Standby node and test it using the Modbus Slave.

1. The Standby node must have the following parameters: TCP/IP address 127.0.0.1 Port number 502 Slave address 2

2. Load the Slave 2 configuration file in Modbus Slave using File/Open. In the dialog select My Documents\Pcvue Training \Module_08\Third party\ Slave 2 10 Words.mbs. 3. Close down the On Duty slave to simulate a communication failure.

Module 07 - Usual drivers - Advanced

Page 12/14

3.4 How to map variables using MS Excel


If you have a large number of equipment variables, mapping them using PcVue can be a long process. As PcVues variable configuration files are in CSV (comma separated value) format you can use a third party tool such as Microsoft Excel to map variables faster.

You can find the format of the Varexp.dat file in DVD\Sv\Doc\English\VAREXP_100_ENU.pdf in the chapter Equipment Variables.

Module 07 - Usual drivers - Advanced

Page 13/14

4 Summing-up
You can display the communication status using the system variables. PcVue can manage redundant PLCs when using an Ethernet network for communication. You can configure the variable mapping using Microsoft Excel.

Module 07 - Usual drivers - Advanced

Page 14/14

Communication

Module 08 OPC - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 Theory 3.2 How does it work? 3.3 Configure it in PcVue 3.3.1 OPC SERVER 3.3.2 OPC Client

4 5
5 6 14 14 14

Summing-up

21

Module 08 - OPC - Basics

Page 2/21

1 Introduction
1.1 In this module you will learn
Overview of the OPC technology. Configure PcVue as an OPC Client. Configure PcVue as an OPC Server.

1.2 Files used in this module


PcVue project developed in the previous module. If you dont have it you can find it in My Documents\Pcvue Training\Module_08\Project.

1.3 Third party software used in this module


We will use the Kepware OPC server and client (Evaluation license). The Kepware files can be found here: My Documents\Pcvue Training\Module_08\Third party\.

Module 08 - OPC - Basics

Page 3/21

2 This feature in PcVue architecture

Figure 1

Module 08 - OPC - Basics

Page 4/21

3 Basics
3.1 Theory
OPC is an acronym for OLE for Process Control. OPC is a communication standard based on OLE/COM technology. OPC is a widely accepted industrial communication standard that enables the exchange of data between multi-vendor devices and control applications without any proprietary restrictions. An OPC server can communicate data continuously among PLCs on the shop floor, RTUs in the field, HMI stations, and software applications on desktop PCs. Even when the hardware and software are from different vendors, OPC compliance makes continuous real-time communication possible. OPC provides interoperability between applications for SCADA, command control and industrial equipment control (communication card, API, etc.). The OPC concept is based upon the COM models client/server architecture. A client application can call upon several OPC servers simultaneously. Those servers may be located either on the local station or on remote stations via DCOM (Distributed COM). The OPC Foundation is dedicated to ensuring interoperability in automation by creating and maintaining open specifications. The Foundation has many members some of which are main players in automation. Arc Informatique is an OPC Foundation member. The OPC Foundation has released many OPC specifications: OPC Data Access (OPC DA): Dedicated to real time data. OPC Alarms & Events (OPC AE): Dedicated to alarm management. OPC Historical Data Access (OPC HDA): Dedicated to managing archives. OPC XML Data Access (OPC XML-DA): Dedicated to real time data. It uses SOAP XML technology.

PcVue is an OPC DA Client and Server. PcVue is an OPC XML-DA Client.

PcVue does not implement OPC AE or OPC HDA.


Module 08 - OPC - Basics Page 5/21

3.2 How does it work?


Here is a standard architecture:

Figure 2

Communication takes place via the following steps: 1. Connection. The Client connects to the Server. 2. Group creation. The Client creates an OPC group using particular parameters: a. Group Name, b. Polling Period, c. Deadband, d. Others. 3. Item subscription. The Client subscribes OPC item(s) that are to be in the group. An OPC item corresponds to one data item in the PLC 4. Notification. The Server starts the communication (according the polling period) with the device and sends to the client the value of each subscribed item. Then each time an items value changes (according the deadband) the server will notify the client.

Module 08 - OPC - Basics

Page 6/21

When the Server notifies the Client it sends several pieces of information: Item name, Value (V) Timestamp (T): PcVue will display and archive the timestamp given by the server. Quality (Q): This property indicates the validity of the item. A quality is good or bad. For example if the server loses communication with the device, the quality of the item is bad. Item type: Boolean, integer, text. etc.

Of course you can implement more complex architectures using OPC. A Server can notify many Clients.

Figure 3

Module 08 - OPC - Basics

Page 7/21

A Client can be connected to many Servers.

Figure 4

A Client can be located in a computer other than that of the Server.

Figure 5

Module 08 - OPC - Basics

Page 8/21

Exercise 1.

Create a basic architecture (see Figure 2) using Kepware OPC Server and Client.

1. Install the Kepware package: a. Launch My Documents\Modules\Module_08\Third party\KepServerEX.exe. b. In the Select features dialog box, collapse the Drivers item.

Figure 6

c. Select the Simulation Suite driver and click the Next buttons until the end of the Wizard.

Figure 7

Module 08 - OPC - Basics

Page 9/21

2. Load the Server configuration file: a. Select File / Open. b. Select: My Documents\Modules\Module_08\Third Party\Server_Configuration.opf You should have the following screen:

Figure 8

If you click on Channel_0_User_Defined / User you see in the right-hand panel that three items have been configured:
Table 1

Name On_Off Setpoint Temperature

Type Boolean Word Float

Simulated Yes No Yes

Access mode Read only Read / Write Read only

We will configure the Client to read these items. 3. Start the Client: Windows Start button / All programs / Kepware Products / KepServerEx / OPC Quick Client.

Module 08 - OPC - Basics

Page 10/21

4. Connection: a. Edit / New Server connection. b. Select Kepware Server. OK.

Figure 9

5. Create a Group: a. Edit / New Group. b. Configure Name = Group 1 and Update rate = 1000.

Figure 10

Module 08 - OPC - Basics

Page 11/21

6. Item subscriptions: a. Edit / New item. b. Browse the Server and select Temperature.

Figure 11

c. Follow the same procedure for the On_Off and Setpoint items. You should then have the following configuration:

Figure 12

Module 08 - OPC - Basics

Page 12/21

What do you see when the values are refreshed?

What happens if you switch off the server?

Module 08 - OPC - Basics

Page 13/21

3.3 Configure it in PcVue


3.3.1 OPC SERVER

To use PcVue as an OPC Server the configuration is very easy. There is nothing to do!
3.3.2 OPC Client

PcVue is a standard OPC Client, so the configuration procedure is similar to that of the Kepware Quick OPC Client.

Step 1. Connection:
a.

Figure 13

b.

Figure 14

Module 08 - OPC - Basics

Page 14/21

c.

Figure 15

d. A new server is added. The state must be Connected.

Figure 16

Step 2. Create a group:


a.

Figure 17

Module 08 - OPC - Basics

Page 15/21

b.

Figure 18

c. A new group is added.

Figure 19

Step 3. Create variables:


Now we must create some variables Name FROM_OPC.ON_OFF FROM_OPC.TEMP FROM_OPC.SETPOINT Type Bit Register Register Control/Command No No Yes Source SRV1 SRV1 SRV1

Module 08 - OPC - Basics

Page 16/21

Step 3. Item subscription:


a.

Figure 20

b.

Figure 21

c.

Figure 22

Module 08 - OPC - Basics

Page 17/21

d.

If you double-click in the Variable Selector, the variable is automatically added in the mapping window and the next item is selected. That is useful if you have many items to map in a row! You can find more details in the PcVue Help file: F1\Application Explorer\Communication\Data acquisition\OPC
You should end up with the following configuration:

Figure 23

Module 08 - OPC - Basics

Page 18/21

Exercise 2. a. Connect PcVue to the Kepware Server.


b. Create three PcVue variables as described in the following table: Name FROM_OPC.ON_OFF FROM_OPC.TEMP FROM_OPC.SETPOINT Type Bit Register Register Control/Command No No Yes Source SRV1 SRV1 SRV1

c. Using the Variables Selector, check the value of each OPC variable.

Open the Variables Selector. What is the meaning of (PLC)?

Module 08 - OPC - Basics

Page 19/21

Switch off the Kepware Server. What happens in PcVue?

Exercise 3.

Create a text item in the Kepware Server then configure PcVue to see the text value.

Module 08 - OPC - Basics

Page 20/21

4 Summing-up
OPC provides interoperability between applications. PcVue is a OPC DA Server and Client and also an OPC XML-DA Client. There are three steps to configuring any OPC Client: Connection, Group creation, Item subscription. All items subscribed in single group will be refreshed according the polling period and the deadband of the group. The OPC Server notifies the client(s) only when the item value changes according the deadband. An item notification includes three main properties: Value, Timestamp, Quality (VTQ).

Module 08 - OPC - Basics

Page 21/21

Communication

Module 08 OPC - Advanced

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Optimize the communication with OPC 3.2 Display the Status of the OPC Communication 3.3 Advanced settings 3.3.1 Server Advanced parameters 3.3.2 Group Advanced parameters 3.4 Activate the OPC Traces 3.5 How to map variables using Microsoft Excel

4 5
5 5 7 7 8 9 10

Summing-up

11

Module 08 - OPC - Advanced

Page 2/11

1 Introduction
1.1 In this module you will learn
How to optimize the OPC communication. How to display the status of the OPC communication. How to tune the OPC communication. How to add logs.

1.2 Files used in this module


PcVue project developed in the Basic module.

1.3 Third party software used in this module


We will use the Kepware OPC server and client (Evaluation license). Kepware files are located here: My Documents\Pcvue Training\Module_08\Third party\. Install the Kepware server if it is not already installed.

Module 08 - OPC - Advanced

Page 3/11

2 This feature in PcVue architecture

Figure 1

Module 08 - OPC - Advanced

Page 4/11

3 Advanced
3.1 Optimize the communication with OPC
As you know a SCADA project must consume as little bandwidth as possible. You can optimize the communication by managing several OPC groups. A starting point is to create at least three groups. Fast: Here you subscribe the items you want to be refreshed as fast as possible. We usually configure critical alarms only. Medium: Here you subscribe the general items. Most items of the application will be in this group. Slow: Here you subscribe the items that you dont need to refresh very often.

3.2 Display the Status of the OPC Communication


A set of System variables is automatically created after the OPC Configuration.

You can find the complete list in the PcVue Help file: F1\Application Explorer\Variables\System Variables\OPC status variables or click here.
Check the System variables created after your configuration.

Figure 2

Module 08 - OPC - Advanced

Page 5/11

Exercise 1.

Switch off Kepware Server. Check the value of the following variables:

Name SYSTEM.OPC.SRV1.STATUS SYSTEM.OPC.SRV1.ON SYSTEM.OPC.SRV1.GRP1.STATUS

Value

Can you explain the value of SYSTEM.OPC.SRV1.ON?

Module 08 - OPC - Advanced

Page 6/11

3.3 Advanced settings


There are many advanced options in OPC configuration dialog boxes. In this topic we will describe the most commonly used.
3.3.1 Server Advanced parameters

To open the Server Advanced Parameters, open the Server properties and display the Advanced Parameters tab.

Figure 3

Connection/Reconnection The parameter is used to change the time to detect a lost connection and to manage the reconnection. By default PcVue sends a ping to the server every 10 seconds. If there is a failure Pcvue tries to reconnect every 60 seconds. Of course you can change these parameters.

Exercise 2.

Change the reconnection period to 20 seconds and check the result by switching off the Kepware server.

Module 08 - OPC - Advanced

Page 7/11

3.3.2 Group Advanced parameters

Figure 4

Deadband Some OPC Servers have a global Deadband parameter that applies the same deadband value to all items. In this case you have nothing to do except if you want to change it for a particular group.

If the Server doesnt manage a global Deadband you must configure it in each OPC group in Pcvue.
Timestamp By default the timestamp used by PcVue is the one from the OPC Server. If you want you can keep the Local timestamp by clicking the Local option.

Exercise 3.

Change the Deadband of the OPC group to 30% and check the value of the variables in the Variables Selector.

Module 08 - OPC - Advanced

Page 8/11

3.4 Activate the OPC Traces


If you have a problem it is always good to have some logs (traces). You can analyze the log and use it to help find the problem. PcVue can generate traces for the Server connection and for each group. Whatever the traces, the output is always shown in the Event Viewer (<Pcvue Folder>\Bin\Log Files\Trace.dat). To enable the traces for the Server / Group object:

Step 1. Step 2. Step 3.

Open its Properties and select the Traces tab. Select each available option. Click Save button.

Figure 5

Exercise 4.

Activate the traces and check the event viewer.

Module 08 - OPC - Advanced

Page 9/11

3.5 How to map variables using Microsoft Excel


If you have a large number of OPC variables, mapping them using PcVue can be a long process. Fortunately you can use a third party tool such as Microsoft Excel to create variables faster.

You can find the format of the file Varexp.dat in DVD\Sv\Doc\English\VAREXP_100_ENU.pdf in the chapter OPC variables.

Module 08 - OPC - Advanced

Page 10/11

4 Summing-up
Always try to optimize the communication. OPC System variables are automatically generated and can be used to create a system mimic. There are many advanced options in the OPC dialog boxes. If there is any problem the first action is to activate the OPC Traces.

Module 08 - OPC - Advanced

Page 11/11

HMI

Module 09 Mimics - Basics

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 The Workspace 3.2 The mimic object 3.2.1 Create a mimic 3.2.2 Operational modes 3.2.3 Mimic properties 3.2.4 How to open a mimic automatically on start-up

4 5
5 8 9 11 11 13

Summing-up

14

Module 09 - Mimics - Basics

Page 2/14

1 Introduction
1.1 In this module you will learn how to
Customize the workspace, Use the main properties of mimics, Make the Homepage mimic.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_09\Project to C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 09 - Mimics - Basics

Page 3/14

2 This feature in PcVue architecture

Figure 1

Module 09 - Mimics - Basics

Page 4/14

3 Basics
3.1 The Workspace
The workspace is the name given to the area occupied by the Supervisor on the PC screen. The workspace contains all the tools necessary to develop Supervisor applications and is the container for the windows that form the User Interface at runtime. Within the workspace you will find the following features:

Figure 2

The Menu Bar: The Menu Bar provides access, using either the keyboard or the mouse, to all the development tools. By using the mouse, the menu bar can be dragged and docked to any outside edge of the workspace, or it can be left floating anywhere on the screen. The menu bar may be opened and closed from a pop-up menu displayed by clicking with the right mouse button anywhere within the workspaces background. A tick indicates that the menu bar is visible.

Module 09 - Mimics - Basics

Page 5/14

The toolbars: The toolbars give you quick access to the most commonly used tools for window development and run-time operation. As with the menu bar, the toolbars may be floating or docked. You can select which toolbars are open from a pop-up menu displayed by right-clicking anywhere on the menu bar. A tick indicates that a toolbar is open. The Status bar: The status bar is located at the bottom of the workspace, above any toolbars you may have docked there. It provides information on the current state of the workspace including the current cursor position and zoom level of the active window.

You can show and hide these bars using the Function keys F6 and F8.

The workspaces appearance and behaviour are changed using the Display/Workspace Properties command.

Figure 3

The following properties may be changed. The size of the workspace and its location on the screen. The workspace colour. The appearance of the title bar and its contents. The tools that are available from the title bar. The number of monitors used (in the Regions tab) Module 09 - Mimics - Basics Page 6/14

Exercise 1.

Change some of the Workspaces properties and check the effect. Then customize it as follows:

Figure 4

The # character is a special character in PcVue. It is used to substitute a string. You will use this character many times in your design.

A list of the various substitutions for the title bar is available in the online Help in: The configuration environments / The HMI / Changing the Workspace Properties.

Module 09 - Mimics - Basics

Page 7/14

3.2 The mimic object


The User Interface for your Project is developed as a set of mimics. Mimics are easily and quickly developed to form Menus, Overviews, Process Diagrams, Trend Displays and so on. Mimics may be linked together to form a hierarchical display. Of course you can have several mimics opened in the same time. The list of the opened mimics is displayed using the Window menu.

Figure 5: In this figure one mimic is open. Its name is Mimic1 and its title is Mimic1.

Figure 6: In this figure two mimics are open.

Each PcVue mimic is saved in a file of the same name - the mimic and file are effectively one and the same. For this reason the main commands associated with mimics are found in the File menu.

Figure 7

Module 09 - Mimics - Basics

Page 8/14

3.2.1 Create a mimic

Step 1.

To create a new mimic, use the File / New command or Control + N keys. A dialog opens to request the template you want to use for this mimic. Templates will be covered in another module. Click the OK button.

Figure 8

Step 2.

To save this mimic, use the File / Save command or Control + S keys. The Save mimic dialog appears. Enter the name and click the OK button.

Figure 9

Module 09 - Mimics - Basics

Page 9/14

Exercise 2.

Create the Homepage mimic.

Where is the Homepage file physically located?

What happens if I copy the Homepage file to another project?

Module 09 - Mimics - Basics

Page 10/14

3.2.2 Operational modes

Mimics can be displayed in a number of modes selected from the Mode toolbar. Run: In Run mode the animated properties of drawing elements in the mimic are updated in real time. Design: In Design mode the properties of drawing elements do not update in real time. Drawing elements may be added, modified and deleted and the support window modified. This is the mode of operation used while you are developing a mimic.
3.2.3 Mimic properties

Each mimic (as with any object in PcVue) has a set of properties. You can display them using the command Window / Window properties.... Because there are many properties they are organised in a range of tabs.

Figure 10

Module 09 - Mimics - Basics

Page 11/14

Exercise 3.

Change the properties of the Homepage mimic as in the following screenshot.

Figure 11

Module 09 - Mimics - Basics

Page 12/14

3.2.4 How to open a mimic automatically on start-up

Step 1. Step 2. Step 3. Step 4. Step 5.


field.

Open the Application Explorer and, in the configuration tree, select the node representing the project. (Top of the tree) From the task list select Settings. Select Station startup. Tick the First window option. Select the mimic name by clicking the button adjacent to the Mimic

Figure 12

Exercise 4.

Configure the TRAINING project to open the Homepage mimic automatically. Restart PcVue to test it.

Module 09 - Mimics - Basics

Page 13/14

4 Summing-up
The Workspace can be customized. One mimic is one file. A mimic has many properties which can be customized.

Module 09 - Mimics - Basics

Page 14/14

HMI

Module 09 Mimics - Advanced

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Mimic and window 3.2 Managing a big mimic 3.2.1 Scaling the mimic 3.2.2 Using scroll bars 3.2.3 Using the Navigator 3.3 Managing screen resolutions 3.4 Useful options 3.4.1 Mimic opening mode

4 5
5 6 6 7 9 11 13 13

Summing-up

14

Module 09 - Mimics - Advanced

Page 2/14

1 Introduction
1.1 In this module you will learn
The difference between a mimic and a window, How to manage big mimics, How to adapt a mimic to different screen resolutions, Other kinds of tuning.

1.2 Files used in this module


PcVue project developed in the Basic module.

1.3 Third party software used in this module


None.

Module 09 - Mimics - Advanced

Page 3/14

2 This feature in PcVue architecture

Figure 1

Module 09 - Mimics - Advanced

Page 4/14

3 Advanced
3.1 Mimic and window
The terms window and mimic are used many times throughout this manual and are generally interchangeable. However there is a subtle difference between a window and a mimic that is important to understand, particularly if you are manipulating windows and mimics programmatically. For readers who are familiar with the classic Microsoft Document/View architecture, Mimic is equivalent to Document and Window equivalent to View. We can sum up the difference between a mimic and a window as follows: The mimic is the content (the data) and the window is what you see on the screen. In following diagram you can see a mimic and a window. The mimic contains many graphical objects. The window displays only a part of this mimic so the rest of it would not be visible in the HMI.

Figure 2

Module 09 - Mimics - Advanced

Page 5/14

3.2 Managing a big mimic


A mimic can be larger than the screen (or the window). PcVue can manage it in three ways.
3.2.1 Scaling the mimic

To scale the mimic to the window size you must set the option Scale mimic to fit window in the tab Window properties / Display.

Figure 3

This option can produce some graphical side effects mainly with text and bitmaps. Use it only in specific cases.

Module 09 - Mimics - Advanced

Page 6/14

Exercise 1.

Open the mimic BigMimic_Scale. Check the properties and the effect.

3.2.2 Using scroll bars

To use the scroll bars you must set the option Allow mimic to be larger than window in the tab Window Properties / Display.

Figure 4

Module 09 - Mimics - Advanced

Page 7/14

Exercise 2.

Open the mimic BigMimic_Scroll. Check the properties and the effect.

You can navigate using the panning tool by pressing and holding down Shift + the mouses middle button.

Module 09 - Mimics - Advanced

Page 8/14

3.2.3 Using the Navigator

The Navigator is a useful tool that allows the user to navigate graphically in the mimic. To activate it you must set the option Enable Navigator in the tab Window Properties / Navigator.

Figure 5

In Design mode you can use the Navigator via the Display / Navigator command (Menu bar).

Figure 6

Module 09 - Mimics - Advanced

Page 9/14

In Run mode the Navigator is automatically embedded in the window.

Figure 7

Exercise 3.

Open the mimic BigMimic_Navigator. Check the properties and the effect.

Module 09 - Mimics - Advanced

Page 10/14

3.3 Managing screen resolutions


Sometimes you design a project in one resolution but the target computer has another resolution. PcVue can manage this situation by adapting the mimic automatically to the new resolution. By default this option is not activated. To activate it you must set the option Screen Resolution / Adapt mimic size to screen resolution in the dialog Configure / HMI Options....

Figure 8

Module 09 - Mimics - Advanced

Page 11/14

You can check in which resolution a mimic has been created in the tab Windows Properties / Advanced.

Figure 9

Exercise 4.

Activate the option Adapt mimic size to screen resolution. Change the resolution of your screen. Open the Homepage mimic.

Module 09 - Mimics - Advanced

Page 12/14

3.4 Useful options


3.4.1 Mimic opening mode

By default, a mimic opens in Run mode. This is not convenient when you are developing your project. You can configure PcVue to open the mimic always in Design mode using the option Mimics open mode / <Design mode> in the dialog Configure / HMI Options.... Remember to change it back when you have completed your development!

Figure 10

Exercise 5.

Activate the option Mimics open mode / <Design mode>. Test it.

Module 09 - Mimics - Advanced

Page 13/14

4 Summing-up
PcVue provides several features for handling large mimics. PcVue can manage different resolutions for the same project.

Module 09 - Mimics - Advanced

Page 14/14

HMI

Module 10 Basic graphical objects Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 The basic graphical objects 3.1.1 Insert a shape 3.1.2 Select multiple objects 3.1.3 Duplicate a graphical object 3.1.4 Properties of objects 3.2 The Arrange tools 3.2.1 Using groups 3.2.2 Lock objects 3.2.3 Managing the ordering objects 3.2.4 Moving and resizing objects 3.3 Create a button 3.4 Using images 3.4.1 Insert an image 3.4.2 Transparent color 3.4.3 Image from the PcVue Library

4 5
5 5 6 7 9 11 12 12 12 12 13 15 15 16 18

Summing-up

19

Module 10 - Basic graphical objects - Basics

Page 2/19

1 Introduction
1.1 In this module you will learn
About the basic shapes, About the main properties of shapes, About the Arrange tools, How to create a button, How to insert an image in a mimic.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_10\Project to C:\Pcvue projects\Usr\..

1.3 Third party software used in this module


None.

Module 10 - Basic graphical objects - Basics

Page 3/19

2 This feature in PcVue architecture

Figure 1

Module 10 - Basic graphical objects - Basics

Page 4/19

3 Basics
3.1 The basic graphical objects
All graphical objects available in PcVue are located in the Drawing toolbar.

Figure 2

[A] Selection tools: also in the Draw Menu. [B] Properties tools: also in the Edit Menu. [C] Basic graphical objects (shapes): also in the Draw Menu. [D] Special objects: also in the Insert Menu. [E] Macro animation objects: also in the Insert Menu. This module covers only [A], [B] and [C].
3.1.1 Insert a shape

To insert a shape in a mimic:

Step 1. Step 2. Step 3. Step 4. Step 5.

Open the mimic in Design mode. The mouse is in Select mode: Select the command Draw / <object to include> or click the objects or Click and drag the mouse in the mimic to draw the selected object.

icon in the Drawing toolbar. The mouse switches to drawing mode:

The mouse stays in drawing mode. Select the command Draw / Select to switch the mouse to Select mode.

The best way to switch the mouse to Select mode is to press the ESC key.

Module 10 - Basic graphical objects - Basics

Page 5/19

Figure 3

Drag one of the black handles to resize the graphical object. You can move an object with the mouse after selection. By default when moving, the object snaps to the grid. You can disable this function in the Windows properties (option Display tab / Grid / Enable).

You can move a selected object one pixel at a time using the arrow keys.
3.1.2 Select multiple objects

There are several ways to select multiple objects: Drag the mouse over the objects you want to select, Select one object, press and hold the Shift key, select another object and so on. When several objects are selected you can move them together.

Module 10 - Basic graphical objects - Basics

Page 6/19

3.1.3 Duplicate a graphical object

There are several ways to duplicate an object. You can select the object and copy it by: Clicking the Edit / Copy command or Pressing the Ctrl + C key combination or Right-clicking the object and selecting the Copy command. Then you can paste the object by: Clicking the Edit / Paste command or Pressing Ctrl + V key combination or Right-clicking where you want to paste it and using the Paste here command.

The best way to copy/paste is as follows: Press the Ctrl key, Select the object and hold down the left mouse button, Drag and drop the object.
Of course, these methods also work when several objects are selected (multiple selections).

Module 10 - Basic graphical objects - Basics

Page 7/19

Exercise 1.

Create a new mimic: Basic objects. Insert several basic graphical objects. Play with them (copy, paste, multiple selections).

Draw a polygon representing a triangle, How many points have been created? Why?

Right-click on one point of this polygon. What is displayed?

Module 10 - Basic graphical objects - Basics

Page 8/19

3.1.4 Properties of objects

Every graphical object has various properties: color, size, position etc. There are several ways to display the properties of an object. Select the object and: Use the Edit / Properties command or Right-click and select the Properties command or Double-click on it. PcVue opens the Properties dialog.

Figure 4

Here, you can change any property you want and click the OK button. To change the background or the line color:

Step 1.
palette.

Click (dont double-click) the color icon. PcVue displays the Colors

Figure 5

Module 10 - Basic graphical objects - Basics

Page 9/19

Step 2.

Left-click (dont double-click) the color you want to apply.

There are also Advanced Properties which are hidden by default. To display the Advanced Properties of an object:

Step 1. Step 2.

Open the Object properties. Click the Advanced Properties button.

Figure 6

This feature will be covered in the Advanced module.

Exercise 2.

Change properties of several objects.

Module 10 - Basic graphical objects - Basics

Page 10/19

3.2 The Arrange tools


The most of the Arrange tools are located in the Menu Arrange, the Arrange toolbar and via a right-click on a selected object / Arrange.

Figure 7

Figure 8

A description of the Arrange tools is available in the online Help in: Developing the HMI / Drawing / Moving and arranging drawing elements / Arrange toolbar.
Module 10 - Basic graphical objects - Basics Page 11/19

3.2.1 Using groups

After making a multiple selection you can group the objects. Then if you change a property of the group it is applied to all objects belonging to the group.
3.2.2 Lock objects

If you dont want to move an object by mistake you can lock it using this tool.
3.2.3 Managing the ordering objects

Every time you insert a new object it is automatically displayed in the top level of the hierarchy of objects. You can use these tools to change the level of an object.

When one or more objects are drawn on top of one another so that the objects underneath are invisible, you can select each object in turn by positioning the mouse over the objects and using the TAB key.
3.2.4 Moving and resizing objects

When you are manipulating several objects you often need to align, centre or resize them in bulk with respect to each another. These tools allow you to do so. To align, resize or centre objects you must have a reference object. It is highlighted by black handles as follows:

Figure 9

In this example if you select Align Top the result will be as follows:

Figure 10

Module 10 - Basic graphical objects - Basics

Page 12/19

Exercise 3.

Use the Arrange tools to group/ungroup, lock/unlock, align, order and resize objects.

3.3 Create a button


To create a button you must select the Button or Colored Button 0ption in the tab section object properties / Aspect tab / Appearance list.

Figure 11

If you want to change the color of a button in Runtime mode you must select Colored button.

Module 10 - Basic graphical objects - Basics

Page 13/19

Exercise 4.

Create a normal button.

Try to change the background of the button. Why are you unable to do so?

Module 10 - Basic graphical objects - Basics

Page 14/19

3.4 Using images


The HMI supports the use of images in BMP, JPG, WMF, GIF and animated GIF formats. The use of images can greatly enhance the appearance of your application, however there are two points which you must always take into account. Images, particularly those with many colors, use large amounts of memory. Images frequently use different color palettes. If you display two or more images at the same time with different palettes, and the graphic adapter you are using does not have sufficient colors to display them, then you will get bizarre effects with the displayed colors changing from their usual appearance.
3.4.1 Insert an image

Before you can insert an image you must copy it to the correct folder: Project path\B. To insert an image:

Step 1. Step 2.

Select the command Insert / Image or click the objects icon the Drawing toolbar. The Insert Image dialog appears.

in

Select the image needed and click the OK button or drag and drop it directly on the mimic.

When you copy an image into the project subfolder Project path\B while PcVue is running you will not see it in the Insert Image dialog!! You must refresh the image list using the Refresh button.

Figure 12

Module 10 - Basic graphical objects - Basics

Page 15/19

3.4.2 Transparent color

You can define one of the colors that is used in an image as transparent. That is, you can see the background of the mimic or any drawing elements under it through any area of that color. To select the transparent color:

Step 1. Step 2. Step 3.

Open the tab Properties / Picture of the image object. Select the Transparent color option.

Click the color icon to select the transparent color in the colors palette (see Figure 13) or click directly on the image. The corresponding pixels color will become the transparent color (see Figure 14).

Figure 13 & Figure 14

Module 10 - Basic graphical objects - Basics

Page 16/19

Exercise 5.

Using images:

1. Insert the image ICO_OK.bmp in the mimic. Select the background as the transparent color. Using the Aspect tab, change the image to the Button appearance so that it looks like a button. 2. For our project: Create a new mimic: Floor 1 and save it. Insert the image Floor1.jpg

Module 10 - Basic graphical objects - Basics

Page 17/19

3.4.3 Image from the PcVue Library

PcVue provides a large library of images. To insert an image from the library select the Library drop-down list in the Insert Image dialog.

Figure 15

Then the way to manipulate the image is the same as described.

You can recognize an image that is from the library by its path displayed in the Image properties / Picture tab.

Figure 16

Exercise 6.

Insert the image Misc_Image15.bmp from the MISCELLANEOUS library.

Module 10 - Basic graphical objects - Basics

Page 18/19

4 Summing-up
Using the basic graphical objects you can draw the most common mimics used in a traditional SCADA project. There are many Arrange tools that enable you to make a complete mimic. The most common image formats are supported by PcVue.

Module 10 - Basic graphical objects - Basics

Page 19/19

HMI

Module 10 Basic graphical objects Advanced

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Use the image effect properties 3.2 Color Palette and Color Picker 3.3 Zoom and Layers properties 3.3.1 Zoom 3.3.2 Layers 3.4 The Drawing Properties Manager 3.5 The Graphic Explorer

4 5
5 6 8 8 10 12 14

Summing-up

16

Module 10 - Basic graphical objects - Advanced

Page 2/16

1 Introduction
1.1 In this module you will learn how to
Use the image effect, Customize the Color Palette, Use the Zoom and the Layers properties, Use the Drawing Properties Manager, Use the Graphic Explorer.

1.2 Files used in this module


PcVue project developed in the Basics module.

1.3 Third party software used in this module


None.

Module 10 - Basic graphical objects - Advanced

Page 3/16

2 This feature in PcVue architecture

Figure 1

Module 10 - Basic graphical objects - Advanced

Page 4/16

3 Advanced
3.1 Use the image effect properties
You can add some special effects when using images in a mimic. A classic one is to make the image change its appearance when the mouse is over it. This effect (known as a rollover) is often used when making a navigation tool bar. To make a rollover:

Step 1. Step 2.

Open the tab image properties / Effects.

In the Mouse hover box, click on the Image selector button and select the image you want to display.

Figure 2

Step 3.

Click the OK button.

Exercise 1.

Insert the image bulb_off.bmp. Configure the Rollover effect using the bitmap bulb_on.bmp. Switch the mimic to Runtime mode and test.

Module 10 - Basic graphical objects - Advanced

Page 5/16

3.2 Color Palette and Color Picker


The Color Palette is displayed each time you select a color property from any properties box and may also be displayed using the Display / Color Palette command. It is essential to understand the use of each area of the Color Palette before starting any drawing.

Figure 3

Selected colors: The colors currently in use. Transparent color: When you use a transparent color for a drawing, the background will be seen through it. Color picker and dropper tools: Used to copy a color from an object (picker tool) and apply it to one or several objects (dropper tool). These tools are also available on the Drawing Toolbar. Normal colors: When you color a drawing using one of the colors from this area the color is saved in the drawing. If you change the color in the palette the color in the drawing is not affected. Indexed colors: When you color a drawing using one of the colors from this area the color is inserted as a reference. If you change the color in the palette the color of all drawings using it will also change.

Module 10 - Basic graphical objects - Advanced

Page 6/16

To change a color in the palette:

Step 1. Step 2.

Double-click on the corresponding cell. The Color Picker appears. Select the fill mode and then the color needed.

Situation: You want to change the color of a shape but you need a specific color which is not in the Color Palette and you will use it only once. No need to add this color in the palette for single use. You can directly double click in the color cell in the shapes properties. PcVue will open the Color Picker and you can select the color directly.

Exercise 2.

Customize the Color palette by adding some solid, blinking and gradient colors. Use the Color Picker and Dropper tools.

Apply an indexed color to a shape. Change this color in the Color Palette. What happens?

Module 10 - Basic graphical objects - Advanced

Page 7/16

3.3 Zoom and Layers properties


3.3.1 Zoom

PcVue allows the user to zoom in a window: In Design mode: The designer can zoom to adjust the position of graphical objects accurately. In Runtime mode: The operator can zoom to see more detail of a mimic. You can zoom by: Ctrl key + mouse wheel: Available in Design and Runtime modes, The Mode toolbar: Available in Design mode,

Figure 4

Right-click on the mimic: Available in Runtime mode.

Figure 5

By default a window has the zoom level of 100%. This zoom level is displayed in the Workspaces status bar. The Zoom range is from 2% to 6400%.
Figure 6

You can attach a zoom level to any graphical object (Visibility bound). Using this method you can show or hide an object according to the zoom level. The Visibility bound for an object is in its Advanced Properties.

Module 10 - Basic graphical objects - Advanced

Page 8/16

Figure 7

In this example the selected object will be shown between 200% and 6400%.

In Design mode, you can display a hidden object using the command Display / Show Hidden Objects.

Exercise 3.

Configure 200% to 450% as a zoom range for the shape. Zoom the window to 200%, 238% and 476%.

Module 10 - Basic graphical objects - Advanced

Page 9/16

3.3.2 Layers

A window is composed of 16 (drawing) layers which are all active by default. You can change the active layers on a window using the Layers Toolbar.

Figure 8

Each graphical object belongs to one or more layers. Using the layers you can show or hide objects by category. For example you could use Layer 1 for Air Conditioning data and Layer 2 for Lighting data. By default an object belongs to all 16 layers. The layers of an object are displayed in its Advanced Properties.

Figure 9

Module 10 - Basic graphical objects - Advanced

Page 10/16

Exercise 4.

Assign the Layers 0, 1 and 2 to any shape. Display the Layers toolbar and change the active layers to 0 only, then 3 only.

Module 10 - Basic graphical objects - Advanced

Page 11/16

3.4 The Drawing Properties Manager


The Drawing Properties Manager gives you greater control over the way in which properties are applied to drawing elements, both individually and in multiple selections. It also allows you to copy the properties of one element (called the reference element) to others. Select the menu command Display / Drawing Properties Manager to open The Drawing Properties Manager dialog.

Figure 10

The Drawing Properties Manager operates in three modes. The mode is selected using the Mode drop-down list. Global: To define the initial property settings of all subsequently drawn drawing elements.

This is very useful but it ONLY works while the Drawing Properties Manager is opened.
Selection: To modify the properties of selected drawing elements. Reference: To copy the properties of the reference drawing element (i.e. the most recently selected) to the other elements in the selection.

More details about the Drawing Properties Manager are available in the online Help in: Developing the HMI / Drawing / Drawing Properties Manager.

Module 10 - Basic graphical objects - Advanced

Page 12/16

Exercise 5.

Exercise the Drawing Properties Manager in the three modes.

Module 10 - Basic graphical objects - Advanced

Page 13/16

3.5 The Graphic Explorer


The Graphic Explorer provides you with a hierarchical view of the elements forming a window. Select the menu command Display / Graphic Explorer to open it.

Figure 11

[A] Filter by object category, [B] Show/Hide and Search buttons, [C] Objects tree. You can display and change the properties of any drawing element by double-clicking on the corresponding icon in the tree. The benefit of this tool is that you can edit the objects properties in Runtime mode.

More details about the Graphic Explorer are available in the online Help in: Developing the HMI / Drawing / Graphic Explorer.

Module 10 - Basic graphical objects - Advanced

Page 14/16

Exercise 6.

Exercise the Graphic Explorer in Design and Runtime modes.

Create a group including several shapes. What do you see in the Graphic Explorer?

Module 10 - Basic graphical objects - Advanced

Page 15/16

4 Summing-up
There are many HMI tools to increase your productivity. You can show or hide graphical objects using the Zoom and Layers features. The Graphic Explorer is useful to edit a graphical object in Runtime mode.

Module 10 - Basic graphical objects - Advanced

Page 16/16

HMI

Module 11 Animations - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 Animation concept 3.2 Edit an animation 3.2.1 Create an animation 3.2.2 Modify an animation 3.2.3 Delete an animation 3.3 Basic animations 3.3.1 Color Bit 3.3.2 Send Bit 3.3.3 Text Display register 3.3.4 Send Register 3.3.5 Use different register display formats 3.3.6 Text Text 3.3.7 Color Bargraph 3.3.8 Link Open 3.3.9 Link Close

4 5
5 6 6 7 7 8 8 9 11 12 15 18 19 21 22

Summing-up

24

Module 11 - Animations - Basics

Page 2/24

1 Introduction
1.1 In this module you will learn
What an animation is, How to create an animation, How to edit or delete an animation, About the most commonly used animations.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_11\Project to Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


Because we are starting to animate the graphical objects we need to use a basic simulator which changes the values of variables. The simulator is located here: My Documents\Pcvue Training\Tools\Simulator.. Please switch off PcVue then install the simulator by copying the files SvSimulator.dll and usrmgr.dat to the folder C:\Program Files\Arc Informatique\Pcvue <version>\Bin. Also copy the file Confini.xml to C:\Pcvue_Projects\Usr\Training\C. Start PcVue.

Module 11 - Animations - Basics

Page 3/24

2 This feature in PcVue architecture

Figure 1

Module 11 - Animations - Basics

Page 4/24

3 Basics
3.1 Animation concept
Animation is the process by which a drawing element is given the capability of interacting with the operator visually or mechanically using the keyboard and mouse, or both. There are three types of animations: Property animation: To change one or several properties of a graphical object according the value of one or several variables. This type has various categories: Color: Change the colors of a graphical object. For example change the background according to the value of a bit variable. Text: Change the characters displayed in a text object. For example display the value of a register variable. Symbols: Exchange a symbol (not covered by this module). Position: Change the position of a graphical object. For example move an object according to the value of a register variable. Visibility: Change the visibility of a graphical object. For example show or hide an image according to the value of a bit variable.

Control animation: To enable the operator to take an action such as changing the value of a variable, opening or closing a mimic etc. This type has different categories: Send: Send a control by clicking the graphical object. For example set the value of a register variable that represents a set point. Run: Create an action such as running a script or an external application. For example to run Microsoft Excel. Link: Open or close a mimic. Security: Execute a security related action. For example log in.

You can highlight all control animations if you select the command Display / Show commands. PcVue will display this icon .
Composite animations: the Viewers (Trend, Log and Alarm) and Form Controls. This module will not cover these animations.

Module 11 - Animations - Basics

Page 5/24

3.2 Edit an animation


3.2.1 Create an animation

To create an animation:

Step 1. Step 2. Step 3.

Select the graphical object you want to animate. Select Animate in the menu bar or right-click / Animate. Select the category.

Figure 2

Step 4.

Select the required animation.

Figure 3

Module 11 - Animations - Basics

Page 6/24

Step 5.

PcVue opens the graphical objects Properties dialog and adds to it a new tab containing the animations properties. Enter the Animation properties and click the OK button.

Figure 4

3.2.2 Modify an animation

To modify an animation:

Step 1.

Open the Graphical objects Properties by double-clicking.

A usual mistake when editing an animation is to open the animation menu again and click on the same animation. By doing that you will add a new animation and not edit the current one. We will cover this feature in the Advanced module. Step 2. Step 3.
Select the tab for the animation. Modify the animation and click the OK button.

3.2.3 Delete an animation

To delete an animation:

Step 1. Step 2. Step 3.

Open the Graphical objects properties. Select the Animation tab. Click the Delete button (trashcan) and click the OK button.

Figure 5

Module 11 - Animations - Basics

Page 7/24

3.3 Basic animations


3.3.1 Color Bit

You use this animation to change the color of a graphical object according the values of a bit variable.

Figure 6

[A]: Bit variable used for animation. Click the button to select the variable. [B]: Background colors. You can select a color for each value and for the NS state. [C]: Line colors. You can select a color for each value and for the NS state.

The color used to represent the NS state should be the same for all animations of the project. Then the operator is warned quickly (because its visual) when information is not valid.

Module 11 - Animations - Basics

Page 8/24

3.3.2 Send Bit

You use this animation to set (force) a bit variable.

Figure 7

[A]: Bit variable to send. Click the button to select the variable. [B]: Value to send. Reversed: Send the reverse of the current value. To 0: Always send to 0. To 1: Always send to 1. Variable: Send the same value as that of another bit variable. [C]: Sending mode: Direct: Send the value without any confirmation. Label: Send the value with confirmation. Handled: Send the value while the mouse button is clicked and held down. When the button is released the value reverts to the original. Pulse: Send the value for a time (configurable period after which it reverts to its original value). Accelerator: Keyboard shortcut. Click on this field and type a key combination. At run-time the animation is executed when the operator uses that combination. This feature is also available in other animations. Module 11 - Animations - Basics Page 9/24

Exercise 1.

Manipulate the basic Bit animations.

1. Create a new mimic: Animations. Add a rectangle and a text button Switch the light. Animate these objects as described in the following table:

Rectangle Animation Color / Bit Variables


BUILDING.FLOOR_01.LT_01.ON

Text Button Send / Bit


BUILDING.FLOOR_01.LT_01.CMD

Properties Default

Default

The Simulator you have installed must set the bit BUILDING.FLOOR_01.LT_01.ON with the same value as the bit BUILDING.FLOOR_01.LT_01.CMD. Switch to run-time mode and test by clicking the button. Now modify these animations as follows: Rectangle Properties Bit Off -> Red Bit On -> Green NS -> Purple 2. For our project: Open the mimic Floor1. Add some graphical objects in two of the rooms to display the Light state and control it. Text Button Command: Reversed Sending mode: Label

Module 11 - Animations - Basics

Page 10/24

3.3.3 Text Display register

You use this animation to display the value of a register variable.

Figure 8

[A]: Register variable to display. Click the button to select the variable. [B]: Property to display. You can select the Value (default), Unit, Minimum or Maximum. [C]: Format in which the value is displayed. The format feature is explained in the chapter 3.3.5.

Module 11 - Animations - Basics

Page 11/24

3.3.4 Send Register

You use this animation to set a register variable.

Figure 9

[A]: Register variable to send. Click the button to select the variable. [B]: Options to display the register value using the same graphical object. [C]: Sending mode: Keyboard: Enter the value using the keyboard. Step: Increase/decrease the value on each click. Keypad: Enter the value using the keypad displayed on the screen. Used mostly for touch screens. Default: Send a particular pre-configured value.

Module 11 - Animations - Basics

Page 12/24

Exercise 2.

Manipulate the basic register animations.

1. In the Animations mimic add a text XXXX and a text button Set Temperature. Animate these objects as described in the following table: Text Animation Text / Display register Variables
BUILDING.FLOOR_01.AC_01.TEMP

Text button Send / Register


BUILDING.FLOOR_01.AC_01.SETPOINT

Properties Default

Default

The Simulator you have installed must set the register BUILDING.FLOOR_01. AC_01.TEMP with the same value as the register BUILDING.FLOOR_01.AC_01.SETPOINT. Switch to run-time mode and test by clicking the button. Now modify these animations as follows: Text Properties Display -> Unit Text Button Display value -> Not selected. Sending mode: Keypad. 2. For our project: Open the mimic Floor1. Add some graphical objects to two rooms to display and control the temperature.

Module 11 - Animations - Basics

Page 13/24

Add a rectangle and try to animate it to display a register value. What happened? Why?

Module 11 - Animations - Basics

Page 14/24

3.3.5 Use different register display formats

When you are using an animation which is displaying a register value you can select the display format.

Figure 10

Auto (Default): The format displayed is the one configured in the variable properties. The form of the format string is ##.##, where the number of #'s specifies the number of significant figures before and after the decimal point. The displayed value is automatically rounded up or down as necessary. Other characters may also be used in the format string to signify special options, for example #u to display the units text. If a format is not specified, then the display of the variable will attempt to show its exact value up to 100 million (100000000) after which the value will be displayed in exponential form.

Figure 11

Module 11 - Animations - Basics

Page 15/24

Custom...: You can customize the format using the Custom Display Format dialog.

Figure 12

Some format examples are available in the online Help in: Developing the HMI / Animation / Using custom display formats/ Format Examples.

Module 11 - Animations - Basics

Page 16/24

Exercise 3.

Copy/Paste the animated Text several times. Change the format as follows:

Text ##.00 00.00 #b #X dd/mm/yyy hh:nn:ss@s

Module 11 - Animations - Basics

Page 17/24

3.3.6 Text Text

You must use this animation when you want to display a text variable.

Figure 13

[A]: Text variable to display. Click the button to select the variable.

Exercise 4.

Add a Text Time. Animate it as follows:

Text Animation Variable Properties Text / Text TIME Default

Module 11 - Animations - Basics

Page 18/24

3.3.7 Color Bargraph

You use this animation to display a register variable as a Bar graph.

Figure 14

[A]: Register variable to be used by the bargraph. [B]: Colors for the bar and the background. [C]: Bounds (range) of the variable corresponding to an empty and full Bargraph. Auto (default): Use the minimum or maximum defined in the variable properties. : Type the value you want to use as minimum or maximum. : Use the value of another register variable as the minimum or maximum. [D]: Direction of fill for the bargraph.

Module 11 - Animations - Basics

Page 19/24

Exercise 5.

Add a rectangle. Animate it as follows: Animate it using the Color / Bargraph animation. Rectangle Animation Variable Properties Color / Bargraph BUILDING.FLOOR_01.AC_01.TEMP Default

Module 11 - Animations - Basics

Page 20/24

3.3.8 Link Open

You use this animation to open another mimic.

Figure 15

[A]: Mimic: Click the button to select the mimic to open. [B]: Caller mimic behavior options. Keep: The current mimic remains open. Close: The current mimic is closed.

Module 11 - Animations - Basics

Page 21/24

3.3.9 Link Close

You use this animation to close a mimic.

Figure 16

[A]: Mimic: Click the button to select the mimic to close.

Module 11 - Animations - Basics

Page 22/24

Exercise 6.

Add two text buttons: Open a mimic and Close a mimic. Animate these objects as follows: Text button Close a mimic Link / Close Homepage Default

Text button Open a mimic Animation Mimic Properties Link / Open Homepage Default

Switch to run-time mode and try it out.

Edit the Text button Open a mimic and select Close option. What happened? Why?

Module 11 - Animations - Basics

Page 23/24

4 Summing-up
An animation is just an extra tab added to the Graphical Object properties. You can easily configure an animation to change the color, open a mimic or set a value.

Module 11 - Animations - Basics

Page 24/24

HMI

Module 11 Animations - Advanced

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Multiple animations 3.2 Operator actions 3.2.1 Operator tips 3.2.2 Interlock condition 3.3 Embedded Mimics 3.4 Other animations 3.4.1 Color Bit group 3.4.2 Visibility Bit 3.4.3 Position Single axis positioning

4 5
5 7 7 9 11 15 15 17 19

Summing-up

22

Module 11 - Animations - Advanced

Page 2/22

1 Introduction
1.1 In this module you will learn
What is multiple animation, How to use an interlock condition, How to help an operator take the correct action, How to embed one mimic in another one, Some other important animations.

1.2 Files used in this module


PcVue project developed in the Basics module.

1.3 Third party software used in this module


We need to use a basic simulator for changing the values of variables. The simulator is located here: USB key\Tools\Simulator. Please install it by running the Setup.exe file and following the instructions.

Module 11 - Animations - Advanced

Page 3/22

2 This feature in PcVue architecture

Figure 1

Module 11 - Animations - Advanced

Page 4/22

3 Advanced
3.1 Multiple animations
A graphical object can have more than one animation. For example a button can send a bit command and display the state of the bit. The way to do it is very easy. You have only to add the animations needed as usual! Each new animation that is applied will result in a tab in the graphical object properties.

Figure 2

[A]: Animation 1: Colors Bit [B]: Animation 2: Bit / Send By default, PcVue executes the animations in the order in which they were created (from left to right). You can re-order them by right clicking on the latest (rightmost) animation tab.

Figure 3

Module 11 - Animations - Advanced

Page 5/22

Exercise 1.

Create a Text colored button. Animate it as specified in the following table:

Text colored Button Animation1 Animation2 Color / Bit on variable BUILDING.FLOOR_01.LT_01.ON Send / Bit on variable BUILDING.FLOOR_01.LT_01.CMD

Create a new colored button and animate it using Send / Bit with Color. What happened?

Create a new button and animate it using Link Close and Send / Bit. Did the bit value change? Why?

Module 11 - Animations - Advanced

Page 6/22

3.2 Operator actions


Every animation involving an operator action (such as opening a mimic, sending a control etc.) implements two useful properties: Operator Tips and Interlocking Condition.
3.2.1 Operator tips

You can help the operator by displaying a (tool) tip when the mouse is over the control area.

Figure 4

To configure a tip you must enter the text in the Comment field in the animation properties dialog.

Figure 5

The character @ is mandatory. If you omit it the comment is for the Designer only and will not appear at run time.

Module 11 - Animations - Advanced

Page 7/22

Exercise 2.

Select any graphical object with a control animation and add a comment. Switch to run-time mode and try it out.

Module 11 - Animations - Advanced

Page 8/22

3.2.2 Interlock condition

You can enable or disable an animation with an action by using an interlock condition. The condition is always the state of a bit variable. To configure the interlock condition:

Step 1. Step 2.
dialog).

Open the animations Properties dialog. Click the Advanced button (the wide button at the bottom of the Configure the Interlock condition parameters

Step 3.

Figure 6

[A]: Bit Variable used as the Interlock. [B]: State authorizing the control. [C]: Action to take if there is attempted use of the control when interlocked.

Module 11 - Animations - Advanced

Page 9/22

Exercise 3. a. Create the bit variable GENERAL.CONTROL_OK (in


command mode).

b. Configure an interlock condition for any graphical object


with a control animation.

c. Switch to run-time mode and try it out. When the action is not authorized, a dialog box displays two messages: - An interlock condition prohibits this action - and another text. How do you change the second text?

Module 11 - Animations - Advanced

Page 10/22

3.3 Embedded Mimics


Consider the following situation:

Figure 7

If we click in Mimic1 we may want one of three different behaviors: Mimic2 moves behind Mimic1. You can bring Mimic2 to the front again using the Window menu. Mimic2 stays in foreground but you can use the action buttons in Mimic1 (for example Switch the light). For this you must select the Foreground option in Mimic2s Properties dialog. Mimic2 stays in the foreground and you cannot click any action button in Mimic1. You must close Mimic2 to access Mimic1s graphical objects. For this you must select the Modal option in Mimic2s Properties dialog.

Figure 8

Module 11 - Animations - Advanced

Page 11/22

Exercise 4.

Reproduce the situation described in chapter 3.3 Try the foreground and modal options.

Module 11 - Animations - Advanced

Page 12/22

Now if we close Mimic1 we can see that Mimic2 is still open. You will find that often you will have this situation but you will also want to close Mimic2 when you close Mimic1. To do this you must include Mimic2 in Mimic1. In PcVues terminology we say that Mimic1 is the Mother (or Parent) window and Mimic2 is the Child window. To include mimic: Open the Link / Open animations Properties dialog. Click the Advanced button. Configure the field Included in / Mimic.

Figure 9

Module 11 - Animations - Advanced

Page 13/22

Exercise 5. a. Create a small mimic called Mimic embedded.


Save and close it.

b. Add a Text button Open an included mimic. c. Configure it to open the Mimic embedded mimic. d. Switch to run-time mode and try it out.

Module 11 - Animations - Advanced

Page 14/22

3.4 Other animations


3.4.1 Color Bit group

You can use this animation when you need to change the color of a graphical object according a combination of several bits. This animation is limited to four bits.

Figure 10

If one or more of the configured variables is NS, the animation displays the Not Available color.

Module 11 - Animations - Advanced

Page 15/22

Exercise 6. a. Copy the text Button Switch the light three times. b.

Modify the three new objects to switch all lights on the first floor. Add a rectangle and animate it according to this customer requirement: Gray -> No lights on.Green -> One light on. Orange -> Two lights on. Dark red -> Three lights on. Red -> All lights on.

We can deduce the following truth table:


LT_04 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 LT_03 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 LT_02 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 LT_01 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Color

Switch to run-time mode and try it out.

Module 11 - Animations - Advanced

Page 16/22

3.4.2 Visibility Bit

You use this animation to show or hide a graphical object according a Bit variables values.

Figure 11

[A]: Bit variable used. Click the button to select the variable. [B]: Visibility parameters. Select Show, Hide or Blinking.

Module 11 - Animations - Advanced

Page 17/22

Exercise 7.

For our project: a. Open the mimic Floor1. b. Insert the images Bulb_off.bmp and Bulb_on.bmp in one room. c. Animate these objects as follows: Bulb_off.bmp Bulb_on.bmp
BUILDING.FLOOR_01.LT_01.ON

Variable animated Visibility

BUILDING.FLOOR_01.LT_01. ON

Off Show On Hide

Off Hide On Show

d. Do the same for the second room.

Module 11 - Animations - Advanced

Page 18/22

3.4.3 Position Single axis positioning

You use this animation to change the position of a graphical object according the values of a register variable. You can also use this animation to make a slider control.

Figure 12

[A]: Register variable used. Click on the button to select it. [B]: Scaling. Start point value and End point value specify the range taken in account to position the graphical object. X axis moving and Y axis moving give the number of pixels to move. You normally select either X or Y because it is a single axis animation. [C]: Slider parameters. Select these options if you want to use the graphical object as a slider.

The Direct send option should only be used if the register variable is an internal source. For every pixel you move a new value is generated. If the variable had an equipment, OPC, Lonworks or DDE source, moving by 100 pixels would result in 100 controls being sent to the equipment!

Module 11 - Animations - Advanced

Page 19/22

When the option Cursor behavior is selected and not the Direct send option, the value to be sent when the mouse button is released is displayed in the Workspaces status bar.
Figure 13

Module 11 - Animations - Advanced

Page 20/22

Exercise 8. a. Add any graphical object. b. Animate it to move according to values of the variable
@BUILDING.FLOOR_01.AC_01.SETPOINT

c. Switch to run-time mode and try it out. d. Modify it to become a slider. Exercise 9.Challenge!

Try to make a slider follow the vertical bargraph.

Module 11 - Animations - Advanced

Page 21/22

4 Summing-up
You can have more than one animation on a graphical object. A mimic can be embedded in another mimic. It becomes the child mimic. This feature is important to make pop-up mimics. We will see this feature in a later module. Every control animation has an interlock condition property. The Color-Bit group animation is very useful when you want to combine up to four bits.

Module 11 - Animations - Advanced

Page 22/22

Alarms

Module 12

Alarms - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Basics


3.1 Alarm concepts 3.2 Alarm life cycle 3.3 Create an alarm 3.3.1 Alarm properties in the Advanced tab 3.3.2 Alarm associated behaviours 3.4 Display an alarm 3.4.1 Alarm animation 3.4.2 The Alarm Viewer

4 5
5 6 7 8 9 11 11 13

Summing-up

20

Module 12 - Alarms - Basics

Page 2/20

1 Introduction
1.1 In this module you will learn
What the alarm life cycle is, How to create an alarm, How to display an alarm in a mimic, How to interact with an alarm.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_12\Project to Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 12 - Alarms - Basics

Page 3/20

2 This feature in PcVue architecture

Figure 1

Module 12 - Alarms - Basics

Page 4/20

3 Basics
3.1 Alarm concepts
An alarm variable is a special case of a bit variable. Reminder: A bit has two values (0 or 1). A bit has two statuses (S or NS). When a bit is configured as an alarm, PcVue adds five statuses that are managed according to events and operator actions. The behavior for an alarm is: An alarm has two values (0 or 1) because it is a bit. An alarm has these five statuses: OFF, NOACKON, ACKON, NOACKOFF, NS: the status NS can, as usual, be caused by lost communication (NS COM). But, in case of alarm, it can also be caused by a masking action. NS OP: Masked by operator. NS M[1 to 4]: Masked by a script. NS DE: Masked by another variable.

Module 12 - Alarms - Basics

Page 5/20

3.2 Alarm life cycle


The best way to understand the various alarm status is to examine the Alarm Life Cycle. The following diagram describes it:

Figure 2

OFF: Alarm Off and acknowledged (no alarm). NOACKON: Alarm On not acknowledged. ACKON: Alarm On and acknowledged. NOAKOFF: Alarm Off not acknowledged.

Module 12 - Alarms - Basics

Page 6/20

3.3 Create an alarm


As mentioned in the previous section an alarm is a special kind of bit. To create an alarm:

Step 1. Step 2.

Create or select an existing bit. Tick the Alarm option in the General tab of the bit Properties dialog.

Figure 3

Step 3. Step 4.
toolbar.

Configure the alarm properties in the Advanced tab. Configure associated behaviors using the Associated Behaviors

Module 12 - Alarms - Basics

Page 7/20

3.3.1 Alarm properties in the Advanced tab

Figure 4 Figure 5

[B]: Activation. Select the transition of the alarm source that is to cause the Alarm to change to NOACKON. [C]: Priority. The priority is a number in the range 0 to 29. The priority is used by PcVue features such as the User rights, alarm viewer etc. You can apply the priority to hierarchies and/or filter alarms. [D]: Levels. By default the user level required to acknowledge, maintain and mask an alarm are the same as the priority, but they can be changed here. [E]: Temporization. A period in seconds between the alarm source becoming active and the alarm changing state to NOACKON.

Module 12 - Alarms - Basics

Page 8/20

3.3.2 Alarm associated behaviours

Figure 6

Acknowledgment trace. Select a bit that can be used to trace the acknowledgement. Program action. Add an option to click a button to run a program. This topic is covered in the Advanced module. Window action. Add an option to click a button to open a window. This topic is covered in the Advanced module. Mask by a variable. Feature used to inhibit the alarm. The Alarm is inhibited if the Bit is set. This topic is covered in the Advanced module. Mask by expression variable. Feature used to inhibit the alarm. The Alarm is inhibited if the result of the expression is true.

Module 12 - Alarms - Basics

Page 9/20

Exercise 1. a. Create a Bit variable called GENERAL.ALARM1 b. Configure it as an alarm and a command.

(Command allows you to force it at run-time from a Send animation. Alarms do not normally have the Command property set.)

Module 12 - Alarms - Basics

Page 10/20

3.4 Display an alarm


There are two ways to display an alarm: The Alarm animation and the Alarm Viewer. 3.4.1 Alarm animation The Alarm animation is used to display the different states of a particular alarm. To create the alarm animation:

Step 1. Step 2. Step 3.

Select the graphical object to apply the animation. Select the animation Color / Alarm. Configure the animations properties.

Figure 7

[A]: Alarm variable. Click the button to select it.

Module 12 - Alarms - Basics

Page 11/20

[B]: Color mode. Dynamic: The colors used are those configured in the General Preferences. You can modify the colors for each alarm status and by alarm priority selecting the command Configure /Preferences / Colors....

Figure 8

Select the Alarm on text tab if the graphical object is a text. Select the Alarm tab for other graphical objects. Static: The colors are configured in this dialog in the Colors area [C]. [C]: Colors. Select a color for each alarm state.

Module 12 - Alarms - Basics

Page 12/20

3.4.2 The Alarm Viewer The Alarm Viewer is used to display a list of alarms. It also allows the user to interact with the alarms by acknowledging or masking them.

The Alarm Viewer macro animation displays only real time alarms and alarms that are NOT logged (archived).
The Alarm Viewer uses a buffer of 100 lines by default. The following diagram represents the Alarm Viewer mechanism:

Figure 9

The Alarm Viewer can display a maximum of eight columns.

Module 12 - Alarms - Basics

Page 13/20

3.4.2.1 Insert Alarm Viewer To insert an Alarm Viewer:

Step 1.

Select the command Insert / Alarm viewer....

Figure 10

Step 2. Step 3. Step 4.

Resize the Alarm Viewer according your needs. Double click on it to open the Alarm Viewer Properties dialog. Configure the properties.

Module 12 - Alarms - Basics

Page 14/20

3.4.2.2 Alarm Viewer at run time

Figure 11

[A]: Toolbar. You can customize the Toolbar by right-clicking on it.

Use of the tools is described in the online Help: The macro animations / Alarm Display / Using the Alarm Display at run-time / Using the toolbar.
[B]: Headers. [C]: Alarms list. [D]: Filter button, for the operator to filter the list at run time.

You can insert more than one Alarm Viewer in the same mimic.

Module 12 - Alarms - Basics

Page 15/20

Exercise 2. a. Create a new mimic called Alarms and save it. b. Insert a Text button and animate it to set the variable
GENERAL.ALARM1 alarm statuses.

c. Insert a graphical object and animate it to display the d. Insert an Alarm Viewer macro animation in the mimic.
Keep all the default parameters.

Check the value of the alarm in the Application Explorer. What do you see?

Module 12 - Alarms - Basics

Page 16/20

3.4.2.3 Alarm Viewer properties The Alarm Viewers properties are divided across four tabs. We will focus on the main properties. Display Tab

Figure 12

[A]: Configure to Display the toolbar, the Scroll bars and the header. [B]: Configure the Background color and the text/Line font. [C]: The eight fields represent the eight headers. The Alarm Viewer automatically adds a column at run time for each header that is configured. [D]: Each field configures what is displayed in the corresponding column using substitution characters.

The formats are specified in the online Help: The macro animations / Alarm Display / Creating and configuring an Alarm Display / Configuring the Line Format.
Aspect Tab: You can configure the common Aspect properties in this tab.

Module 12 - Alarms - Basics

Page 17/20

Execution Tab

Figure 13

[A]: Realtime buffered. Select the number of lines you want to manage. [B]: Start mode. List mode: List mode is the normal mode of operation of an Alarm Viewer. A change in the status of any of the alarms will cause the following actions: If the alarm is visible, its status, time and date will be updated, but its position in the list does not change at this time. If an alarm is not visible, the Mode button will flash until the list has been scrolled to display the new alarm status. On line mode: On-line mode provides the User with a real-time list of alarm transitions in the order in which they occurred. The alarm transitions are stored in the display buffer which may be navigated using the scroll bar. Selecting an alarm automatically switches the display to List mode. [C]: Allowances. Select the actions the operator is allowed to take at run time. [D]: Printing. If this option is selected, the operator can print the selected alarm by clicking the Print icon in the toolbar. Filters Tab This tab represents the filter applied to the Alarm Viewer list when the mimic is opened. The operator can change this filter by clicking the Filter button.

Module 12 - Alarms - Basics

Page 18/20

Figure 14

[A]: Domain and Nature. This topic is covered in another module. [B]: Alarm status. Filter by alarm status. [C]: Alarm level. Filter by alarm priority.

Exercise 3.

Modify some Alarm Viewer properties and check what happens at run time.

Challenge!

Try to change the colors of the alarm statuses in the Alarm Viewer.

Module 12 - Alarms - Basics

Page 19/20

4 Summing-up
An alarm is a special case of a bit with extra statuses. You can display an alarm using an animation and the Alarm Viewer macro animation.

Module 12 - Alarms - Basics

Page 20/20

Alarms

Module 12 Alarms - Advanced

Contents

Introduction
1.1 In this module you will learn how to 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Threshold alarms 3.2 Associated behavior 3.3 Alarm counters

4 5
5 8 10

Summing-up

12

Module 12 - Alarms - Advanced

Page 2/12

1 Introduction
1.1 In this module you will learn how to
Create an alarm threshold, Use an alarms associated behavior, Use the built-in alarm counters,

1.2 Files used in this module


PcVue project developed in the Basics module.

1.3 Third party software used in this module


None.

Module 12 - Alarms - Advanced

Page 3/12

2 This feature in PcVue architecture

Figure 1

Module 12 - Alarms - Advanced

Page 4/12

3 Advanced
3.1 Threshold alarms
The threshold system is nearly always used on a project. From the PcVue point of view a threshold system is only a mechanism for setting a bit. The bit can then be configured as an alarm if that is what is required. To configure a threshold:

Step 1. Step 2.

Open the Application Explorer and select the Register variable on which you want to add the threshold. Select the Add threshold associated behavior and choose the threshold system to use.

Figure 2

Ppphigh, pphigh, hihi and high are high (increasing value) thresholds. Low, lolo, pplow and ppplow are low (decreasing value) thresholds.

Step 3.

Tick the box for each threshold that is to be active and then enter the threshold value and click the OK button.

Figure 3

Module 12 - Alarms - Advanced

Page 5/12

Step 4.

PcVue creates a new bit which is named by default <Variable name>_<Type selected>. This is the threshold bit. You can see that this bit is a threshold of a register because when you select the register variable the bit variables name appears in a new section called Thresholds, in the Associated Behaviors pane.

Figure 4

Step 5.

Validate.

Configure this new bit. Here you can configure it as an alarm and

Of course you can define the thresholds in the Varexp.dat file using MS Excel. You can find the format of the Varexp.dat in DVD\Sv\Doc\English\VAREXP_100_ENU.pdf in the chapter Threshold.

Module 12 - Alarms - Advanced

Page 6/12

Exercise 1. a. Create high (30) and low (15) alarm thresholds for
the variable BUILDING.FLOOR_01.AC_01.TEMP Temperature value.

b. Add a Text button to the mimic Alarms to set the c. Switch to run-time mode and try it out.

Module 12 - Alarms - Advanced

Page 7/12

3.2 Associated behavior


There are several associated behaviors that you can configure for an alarm. Here we will cover those that produce an action of some sort. You can configure these actions for each alarm. There are two types of action: Manual action. This action is triggered when the user selects an alarm in the Alarm Viewer and right-clicks on it. There is a maximum of two actions and you can: Open a mimic known as a Window action. Run a script known as a Program action. Acknowledgment trace Set a bit when the alarm is acknowledged. Useful if you want to send the acknowledgment to the PLC. Known as an Acknowledgment transmission.

Automatic action

There are no automatic associated actions for opening a warning pop-up or playing a sound when an alarm occurs. To do this you must write a script.
To configure an associated behavior:

Step 1. Step 2. Step 3.

Open the Application Explorer and select the alarm variable.

Select the required behavior from the tools in the Associated Behavior toolbar. Configure the behavior properties.

Figure 5

Module 12 - Alarms - Advanced

Page 8/12

Exercise 2. a. Configure an associated action to allow the operator


to open the Floor1 mimic when the high or low temperature limits occur. Switch to run-time mode and try it out.

b.

Module 12 - Alarms - Advanced

Page 9/12

3.3 Alarm counters


Often you want to know how many alarms are active. PcVue manages a range of alarm counters that let you accurately display the number of active alarms. The Alarm Counters are managed in SYSTEM register variables. The syntax name of these variables is SYSTEM.<State>.<Level> where: <State> is the status needed: ACKOFF (OFF status) NOACKON NOACKOFF ACKON NS USERMASK (NS OP status)

<Level> is the priority. To remind you: its a number from 0 to 29. If you want all levels then <Level> = ALL. For example: SYSTEM.NOACKON.ALL: Counter of alarms that are On not acknowledged, whatever the priority. SYSTEM.NOACKOFF.1: Counter of alarms that are Off not acknowledged with priority 1. By default these variables dont exist and you must create them manually if you need to use them.

These SYSTEM counters allow filtering by Domain and Nature but if you want to filter by Text Attributes or variable name you must use an advanced feature called Variable Treatments.

You can find more details in the online Help in: Application Explorer / Variables / System Variables / Alarm Counter Variables.

Module 12 - Alarms - Advanced

Page 10/12

Exercise 3. a. Create the registers SYSTEM.NOACKON.ALL and


SYSTEM.ACKON.ALL

b. Add two Texts in the Alarms mimic and animate


them to display the counters.

Module 12 - Alarms - Advanced

Page 11/12

4 Summing-up
PcVue manages four threshold systems. The associated behavior for an alarm is a good feature for improving the operators reactivity. You can use SYSTEM variables to count the active alarms.

Module 12 - Alarms - Advanced

Page 12/12

HMI

Module 13 Labels, attributes and filtering

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Associated labels


3.1 For bits 3.2 For alarms 3.3 Display the associated labels 3.3.1 To display the animation pair of an associated label: 3.3.2 To display the Command pair of an associated label:

4 5
5 7 9 9 10

Text attributes
4.1 Domain and Nature attributes 4.2 Extended text attributes 4.3 Using text attributes 4.3.1 Displaying in a mimic 4.3.2 Displaying in a Viewer 4.3.3 Filter in a Viewer

11
11 13 15 15 16 17

Summing-up

18

Module 13 - Labels, attributes and filtering

Page 2/18

1 Introduction
1.1 In this module you will learn
How to manage the associated labels. How to use the Domain and Nature attributes. How to use the extended attributes.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_13\Project to Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None

Module 13 - Labels, attributes and filtering

Page 3/18

2 This feature in PcVue architecture

Figure 1

Module 13 - Labels, attributes and filtering

Page 4/18

3 Associated labels
3.1 For bits
Pairs of Text strings may be associated with each Bit Variable. These are substituted for the 1 and 0 states to provide more meaningful information to the User.

At the time of writing you were unable to create Associated Labels in the Application Explorer, they have to be created from the Configuration menu.
To create an associated label:

Step 1. Step 2.
a name.

Select the command Configure / Variables / Associated label... Create a new label by clicking in the * CREATION * field and typing Configure the text pairs that are needed. Click on the Validate button

Step 3. Step 4.

Figure 2

[A]: Animation text pair. Used to display a text representing the state of the Bit in a mimic. For example you may want to display OFF when a Bit value is 0 and ON when the value is 1. [B]: Log text pair. Used together with the Bit title when Bit changes of state are logged to disk or printer. That topic is not covered in this module but in the Logs module. [C]: Command text pair. Displayed along with the Bit title in the dialog box used to confirm the forcing of a Bit's state by the User.

Module 13 - Labels, attributes and filtering

Page 5/18

Step 5. Step 6.

From the Application Explorer open the Properties of the Bit to which you want to apply the associated label. Select the associated label needed in the Associated labels box.

Figure 3

Exercise 1. a. Create the associated label ON_OFF and configure it as


displayed in Figure 2.

b.

Apply it to the variables BUILDING.FLOOR_01.LT_01.ON and BUILDING.FLOOR_01.LT_01.CMD

Module 13 - Labels, attributes and filtering

Page 6/18

3.2 For alarms


By default each alarms states have the following associated text: OFF: Alarm off NOACKON: Alarm on not ack. ACKON: Alarm on ack. NOACKOFF: Alarm off not ack. NS: Alarm unavailable NS OP: Alarm operator masked You can see these texts in the Alarm Viewer animation. If you want to change them you must create an associated label for the alarm. To create an associated label for alarm:

Step 1. Step 2.
a name.

Select the command Configure / Variables / Associated label... Create a new label by clicking on the * CREATION * field and typing Tick the Alarm option.

Step 3.

Figure 4

Step 4. Step 5. Step 6.

Click the Validate button.

Open the properties of the alarm variable to which you want to apply to the associated label. Select the associated label needed in the Associated labels box.

Module 13 - Labels, attributes and filtering

Page 7/18

Exercise 2. a. Create the associated label ALARMS and configure it as


shown in the Figure 4.

b. Apply it to the variables

BUILDING.FLOOR_01.AC_01.TEMP_high and BUILDING.FLOOR_01.AC_01.TEMP_low mimic Alarms.

c. Switch to Run-time mode and check these alarms in the

Module 13 - Labels, attributes and filtering

Page 8/18

3.3 Display the associated labels


3.3.1 To display the animation pair of an associated label:

Step 1. Step 2. Step 3.

Select the Text object you want to animate. Select the animation Text / Label. Select the Associated label option.

Figure 5

Exercise 3. a. Open the mimic Animations. b. Add a text object and display the associated label for the
variable BUILDING.FLOOR_01.LT_01.ON

Module 13 - Labels, attributes and filtering

Page 9/18

3.3.2 To display the Command pair of an associated label:

Step 1. Step 2.

Open the properties of a button with the Send / Bit animation. Select the Sending Mode Label.

Figure 6

Step 3.

Switch to Run-time mode and click the button to send the control. The associated label for the command is displayed in the confirmation box.

Figure 7

Exercise 4. a. Open the mimic Animations. b. Add a text button object and animate it to set the variable
Module 13 - Labels, attributes and filtering Page 10/18 BUILDING.FLOOR_01.LT_01.CMD with a confirmation box.

4 Text attributes
For each variable PcVue manages a set of 16 text attributes. The Domain and the Nature are the first two such attributes. The other 14 attributes have no particular name. They are just Attribute 3 to Attribute 16.

4.1 Domain and Nature attributes


The use of Domain and Nature is a way to categorize data. Then you can filter by these categories. At the beginning of a project you may not know what Domains and Natures to create. Its not a problem because you can add them at any time. A good way to know what Domains and Natures you need is to ask the end user these questions: Do you want to filter your alarms? For example do you want to display only the alarms of one Floor or only the Air Conditioning alarms? The Domain and Nature attributes are limited to 12 characters and only the alphanumerical characters are allowed, plus the underscore character _). To create a Domain:

Step 1. Step 2. Step 3.

Open the Application Explorer and select the Domain node. Click Add a Domain... in the task pane or tool-bar. Enter the Domain name.

Figure 8

Module 13 - Labels, attributes and filtering

Page 11/18

To create a Nature:

Step 1. Step 2. Step 3.

Open the Application Explorer and select the Nature node. Click Add a Nature... in the task pane or tool-bar. Enter the Nature name.

To apply a Domain or a Nature to a variable:

Step 1. Step 2.

Open the variables Properties. Select the Domain and/or Nature to apply.

Figure 9

Exercise 5.
a. Create the Domains FLOOR1, FLOOR2 and FLOOR3. Create the Natures AIRCOND and LIGHT. b. Configure the Domain and Nature attributes for the variables: BUILDING.FLOOR_01.AC_01.ON BUILDING.FLOOR_01.AC_01.TEMP_high BUILDING.FLOOR_01.AC_01.TEMP_low

Module 13 - Labels, attributes and filtering

Page 12/18

4.2 Extended text attributes


The extended text attributes are used to add detail or characteristics to a variable. A typical use is to manage hardware characteristics for a maintenance team. For example the project may be managing several types of Air conditioners and the end user wants to be able to display the type, model, serial number, etc. of one selected unit. To configure text extended attributes for a variable:

Step 1. Step 2. Step 3.

Open the variables Properties. Select the Extended Attributes tab. Enter the text for the extended attributes required.

Figure 10

Its possible to have a variable value as an attribute. For this you have only to enter the variables name in the attributes field.

Module 13 - Labels, attributes and filtering

Page 13/18

Exercise 6.
a. Create the Bit variable BUILDING.FLOOR_01.AC_01._INFO b. For our project we must display the make, model and serial number details. So we will use extended text attributes 3, 4 and 5. Add the following extended text attributes:

Attributes 3 4 5

Content MITSUBISHI AC-100 SN - 12 99876

Module 13 - Labels, attributes and filtering

Page 14/18

4.3 Using text attributes


You can use these attributes in two ways: Display them in a mimic or in a macro animation such as the Alarm Viewer. Use them for filtering in a macro animation such as the Alarm Viewer.
4.3.1 Displaying in a mimic

Step 1. Step 2. Step 3. Step 4.

Select the text object in a mimic. Select the animation Text / Label. Select the Format option. Type #A1 for Domain, #A2 for Nature and #A3 to #A16.

Figure 11

Exercise 7.
a. Open the mimic Animations. b. isplay the Domain and the Nature of the variable BUILDING.FLOOR_01.AC_01.ON c. witch to Run-time mode and test it. d. Display the extended text attributes of the variable BUILDING.FLOOR_01.AC_01._INFO

Module 13 - Labels, attributes and filtering

Page 15/18

4.3.2 Displaying in a Viewer

Step 1. Step 2. Step 3.

Open an Alarm Viewers Properties / Display tab. Add a suitable column title in the Column titles frame.

Add #@A1 for Domain, #@A2 for Nature and #@A3 to #@A16 in the section Column display format.

Figure 12

You can also use the shortcuts #d for Domain and #n for Nature.

Exercise 8.
a. Open the mimic Alarms. b. Modify the Alarm Viewer properties to display the Domain and the Nature. c. Set the temperature of BUILDING.FLOOR_01.AC_01.TEMP to trigger an alarm and check the Alarm Viewer.

Module 13 - Labels, attributes and filtering

Page 16/18

4.3.3 Filter in a Viewer

You can configure a default filter for Domain and/or Nature in the Macro animation:

Step 1. Step 2.

Open the Macro animations Properties / Filters tab. Select the Domain and/or Nature.

Figure 13

The operator can use the filter at Run time by clicking the Filter button.

Figure 14

There is no HMI for filtering by extended text attributes but you can do it by script.

Exercise 9.

Use the filtering function in the Alarm Viewer.

Module 13 - Labels, attributes and filtering

Page 17/18

5 Summing-up
The Associated Labels are useful to associate text with the various states of a bit and/or an alarm. The Domain and Nature attributes can be used to categorize the data and to filter items in macro animations.

Module 13 - Labels, attributes and filtering

Page 18/18

HMI

Module 14

Generic HMI

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4

This feature in PcVue architecture PcVue objects Mimic templates


4.1 Create/Edit a mimic template 4.2 Linking a mimic with a template

4 5 6
6 12

Generic mimic
5.1 The branch concept 5.2 Open a mimic with branch 5.3 Create a Popup mimic

14
14 21 23

Symbols
6.1 Create a Symbol 6.2 Insert a Symbol in a mimic 6.3 Modify a Symbol 6.4 Delete a Symbol 6.5 Animated Symbol 6.6 Generic Symbol 6.7 Add a symbol from the PcVue Library 6.8 Forwarding the current branch

25
26 26 28 28 29 31 34 36

Summing-up

37

Module 14 - Generic HMI

Page 2/37

1 Introduction
1.1 In this module you will learn
How to have the same layout in your project, What is a branch, How to manage generic objects.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_14\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 14 - Generic HMI

Page 3/37

2 This feature in PcVue architecture

Figure 1

Module 14 - Generic HMI

Page 4/37

3 PcVue objects
Whatever the application may be, it is usual for many items to be repeated in a SCADA project. If its a project for a water treatment plant you will have to manage many valves, motors etc., if its for electric distribution you will have many power meters, whilst for a BMS you will have many air conditioners and lights. So the result is similar: you will have to manipulate the same objects many times. Because PcVue is object-oriented software it allows you to design your project in a generic way, thus saving you development time. Thats why this module is actually the most important of the training course because if you dont use objects in PcVue the time for developing your project will be dramatically longer! PcVue manages three types of objects: Mimic template, Generic mimic, Symbol.

Module 14 - Generic HMI

Page 5/37

4 Mimic templates
A basic ergonomic rule states that you should use the same layout across the whole project. The best examples are found in web sites on Internet. Whatever the page you are reading on a web site the way to present it is always the same. PcVue allows the designer to create a template and linking any mimic to this template. Its a dynamic link because later on, if you modify the template, the mimic will be updated automatically.

Figure 2

4.1 Create/Edit a mimic template


To create a mimic template:

Step 1. Step 2.

Create a new mimic. Design the layout required as for a normal mimic.

Module 14 - Generic HMI

Page 6/37

Step 3.

Save the mimic in the Mimic Templates folder.

Figure 3

To modify a mimic template:

Step 1. Step 2. Step 3. Step 4.

Select the command File / Open. Select the Mimic Templates folder. Select the template and open it. Make your modification and save it.

Figure 4

Module 14 - Generic HMI

Page 7/37

Note that you manipulate a mimic template as you do a normal mimic. The only difference is the location where it is saved. You can insert any graphical object (animated or not) , Viewer or Form Control in a Template the same as in any normal mimic.

If you switch a template in run-time, the animations are played normally. But if you have configured an action animation (for example Send / Bit) and try to run it in the template then it will not work.

Module 14 - Generic HMI

Page 8/37

Exercise 1.

Create the template MyTemplate according the following specifications: 1. Window properties / Display tab / Window Style frame

Figure 5

2. Graphics

Figure 6

Module 14 - Generic HMI

Page 9/37

3. Animations

Figure 7

[A]: Alarm viewer. No header, no toolbar, no scrollbars. Display only active alarms. [B]: Alarm counters. Display the number of NOACKON and ACKON alarms. [C]: Home button. Opens the Homepage mimic. [D]: Shapes button. Opens the Basic objects mimic. [E]: Animations button. Opens the Animations mimic. [F]: Floors button. Opens the Floor 1 mimic. [G]: Alarms button. Opens the Alarms mimic.

Module 14 - Generic HMI

Page 10/37

Switch the template into Run-time mode and click the Home button. What happened? Why?

Module 14 - Generic HMI

Page 11/37

4.2 Linking a mimic with a template


When a mimic is linked with a template it inherits the templates main properties such as size and position and, of course, the content of the template (the graphical objects and their animations). When you are developing the mimic, the objects belonging to the template cannot be selected or changed. Selecting a template on mimic creation:

Step 1. Step 2. Step 3.

Select the command File / New. PcVue opens the New mimic dialog. Click the template button to select the template.

Figure 8

Selecting a template for an existing mimic:

Step 1. Step 2.

Open the mimics dialog tab Window properties / Template. Enter the Template name or click the button to select the template.

Module 14 - Generic HMI

Page 12/37

Step 3.

Configure the properties you want to inherit from the template.

Figure 9

[A]: Template name. Click the None button if you want the mimic not to be linked with any template. [B]: Properties inherited from template. Using these options you can select some properties independently from the template. For example if you want all properties to be like those of the template except the size, you must deselect the Size option.

Exercise 2.

Link the following mimics with the template MyTemplate: Homepage, Basic objects, Animations, Floor 1 and Alarms. You can select all the properties inherited from the template.

Module 14 - Generic HMI

Page 13/37

5 Generic mimic
Consider the following situation: The end user wants to see a detailed view for each device on the project and you have 100 of these devices. You can design this in two ways: Create 100 mimics displaying the details for each device. Create one generic mimic. Of course, youll prefer the second solution which is much faster. Fortunately PcVue allows you to do that in a very simple way.

5.1 The branch concept


To understand the generic mimic mechanism we have to use an example. Open and check the Mimic Test.

Figure 10

Module 14 - Generic HMI

Page 14/37

These two text objects have a normal Color / Bit animation like this:

Figure 11

Now we can open the mimic Test_Branch and animate the text field as follows:

Figure 12

Module 14 - Generic HMI

Page 15/37

When we validate the animation, PcVue displays an error message.

Figure 13

This is normal because the variable ON doesnt exist in the Variables Tree. But we ignore this error, confirm, save and close the mimic. Now we open it again using the command File / Open but in the dialog we select the Branch BUILDING.FLOOR_01.LT_01 in the Branch combo box.

Figure 14

Module 14 - Generic HMI

Page 16/37

We redo the same operation with the Branch BUILDING.FLOOR_01.LT_02 (move down this new mimic). We should have the following:

Figure 15

You can see that we have the same mimic (Test_Branch) opened twice. Actually we say that we have two windows opened having two different branches. You can see the branch used for a mimic in the Window menu.

Figure 16

[A]: Mimic branch. [B]: Mimic title.

You can display the current mimic branch on the Title bar by using the special substitution string #B in the mimic Title of the windows properties.
Now if we click on the SET buttons we can see that the first windows animation is working for the variable BUILDING.FLOOR_01.LT_01.ON and the second windows animation is working for the variable BUILDING.FLOOR_01.LT_02.ON. The final result is: we have created only one mimic and, by opening it with different branches, it is working for all Lights! Module 14 - Generic HMI Page 17/37

How does this work? Actually when the HMI opens a mimic it tries to connect each animation to the corresponding variables according the following algorithm: START OPEN MIMIC FOR EACH Animation IF Mimic is opened with a Branch THEN CONNECT <Mimic_Branch>.<Variable_animated> to the Variables Tree ELSE CONNECT <Variable_animated> to the Variables Tree END IF END FOR EACH END OPEN MIMIC If we apply this algorithm to our example we have: For the mimic Test we have four animations therefore <Variable_animated> = BUILDING.FLOOR_01.LT_01.ON <Variable_animated> = BUILDING.FLOOR_01.LT_01.CMD <Variable_animated> = BUILDING.FLOOR_01.LT_02.ON <Variable_animated> = BUILDING.FLOOR_01.LT_01.CMD For the first mimic Test_Branch we have: < Mimic_Branch> = BUILDING.FLOOR_01.LT_01 <Variable_animated> =ON For the second mimic Test_Branch we have: < Mimic_Branch> = BUILDING.FLOOR_01.LT_02 <Variable_animated> =ON

Module 14 - Generic HMI

Page 18/37

If the CONNECT operation fails then the following error message appears:

Figure 17

To simplify this you can keep in mind the following temporary formula: MIMIC BRANCH + .VARIABLE ANIMATED = VARIABLE

Module 14 - Generic HMI

Page 19/37

Exercise 3.

Manipulate branches.

1. Redo the procedure described in chapter 5. 2. For our project, create a generic control panel for the air conditioner: a. Create a new small mimic POP_Ac panel b. Insert the image Remote_Regulator.jpg. c. Add a text to display the current temperature, add a text to display and control the set point, and add a button to control the air conditioner. 3. For our project specify Floors 2 & 3: a. Create a new mimic using the template MyTemplate. Save it as Floor. b. Add the image Floor_Standard.jpg. c. Display the current Light status and a button to control the Lights 1 & 2.

Module 14 - Generic HMI

Page 20/37

5.2 Open a mimic with branch


To open a mimic with a branch:

Step 1. Step 2. Step 3.

Add a graphical object and select the animation Link / Open. Select the mimic to open. Select the branch by clicking the Branch selector button.

Figure 18

Module 14 - Generic HMI

Page 21/37

Exercise 4.

Open a mimic with a branch:

1. For our project add a link to open the Panel: a. Open the mimic Floor 1. b. Replace every Air Conditioners object by two buttons displaying the Air Conditioner state and opening the control panel POP_Ac panel as a child of Floor 1. 2. For our project add the Floors navigation: a. Create a small new mimic POP_OpenFloor. Set the Popup behavior. b. Add three buttons to open Floor 1 and Floor (for the floors 2 and 3). Dont forget to set the option Close the caller in the Link / Open animation. c. Change the Navigation button Floors (in MyTemplate) to open the POP_OpenFloor mimic. Save the template.

In Floor 1 add a button with the animation Link / Close to close the mimic POP_Ac panel. Open POP_Ac panel by clicking on one of the buttons you have created in this exercise. Click the Close button. What happened? Why?

Module 14 - Generic HMI

Page 22/37

5.3 Create a Popup mimic


In the previous exercise you probably had a problem with closing the Panel mimics. In this situation the best way is to use the Popup behavior of the mimic. What is popup behavior? When you right-click on the Windows Desktop background, Windows opens a small form displaying some contextual options. Now if you rightclick in another place Windows closes this form and opens a new one. This is the popup behavior. Each PcVue mimic has the same feature but uses the left click only and for embedded mimics only. To configure the Popup behavior for a mimic:

Step 1. Step 2. Step 3. Step 4.

Open the mimics Properties. Select the Included mimic tab. Tick the Popup behavior property

Select the position you want that mimic to open in by clicking one of the predefined positions.

Figure 19

Module 14 - Generic HMI

Page 23/37

Exercise 5. a. Open the mimic POP_Ac panel. b. Configure it to use the Pop-up behavior.

Module 14 - Generic HMI

Page 24/37

6 Symbols
Consider the following situation: The site that you are supposed to monitor and control employs 100 Lights. You have two solutions: Create 100 animated graphical objects. Create one generic object. Again, you prefer the second solution since it is much faster. Fortunately PcVue allows you to do it in a very simple way by creating a Symbol.

Figure 20

The Symbol is a graphical object model which is saved in the Symbols library. Then you can insert an instance of this symbol in each of several mimics. If you modify the model all instances are modified in real time.

Module 14 - Generic HMI

Page 25/37

6.1 Create a Symbol Step 1. Step 2. Step 3. Step 4. Step 5.


In a mimic, draw one or several graphical objects. Select the objects that are included in the symbol.

Select the Edit / Group menu or right-click / Group. Of course if the symbol contains only one object there is no need to group it. Select Edit / Create Symbol or right-click / Create Symbol. PcVue opens the Symbols Library dialog. Enter the Symbols name in the Name field. Click the OK button.

Figure 21

Step 6.

The Symbol is created and an instance is automatically inserted in

the mimic.

6.2 Insert a Symbol in a mimic Step 1.


dialog. Select the Insert / Symbol menu. PcVue Opens the Symbols Library

Step 2.

Select the Symbol and drag & drop it on the mimic or click the Insert button.

Module 14 - Generic HMI

Page 26/37

Exercise 6. a. Open the mimic Symbols. b. Draw a rectangle and create the symbol Light.obj. c. nsert several instances of Light.obj. Double-click on the Symbol instance. Are the properties normal?

Module 14 - Generic HMI

Page 27/37

6.3 Modify a Symbol Step 1. Step 2. Step 3.


Select any instance of the Symbol and ungroup it. Now the link between the instance and the model is broken. The instance reverts to its component graphical objects. Modify the graphical object as usual. Redo the Symbol creation procedure from Step 1 to Step 6 by entering the Symbols name you want to update.

You can also use the Graphic Explorer (via the Display menu) to modify the symbol. Advantages: - You dont need to ungroup it. - You can also do it in Run-time mode!

Exercise 7.

Modify the Light.obj Symbol: - Change its background color. - Add a button.

6.4 Delete a Symbol Step 1.


dialog. Select the Insert / Symbol menu. PcVue Opens the Symbols Library Select the Symbol to delete and press the Delete key.

Step 2.

Module 14 - Generic HMI

Page 28/37

6.5 Animated Symbol


Of course a Symbol can be animated (as it is, more often than not!). The procedure to make an animated symbol is exactly the same as described previously. But we can see a difference in the Symbol properties:

Figure 22

The variables animated in the Symbol are displayed.

Module 14 - Generic HMI

Page 29/37

Exercise 8.

Modify the Light.obj Symbol: - Animate the rectangle to display the status of BUILDING.FLOOR_01.LT_01.ON - Animate the button to set the variable BUILDING.FLOOR_01.LT_01.CMD

Modify the Symbol by animating one object with a variable that does not exist. Open the Symbol Properties / Symbol tab. What do you see?

Module 14 - Generic HMI

Page 30/37

6.6 Generic Symbol


Now you may have 100 Lights so you dont want to create 100 symbols. Instead you create a Symbol Light.obj which applies to all Lights of the application. To do this you must use Branches. To use a Branch in a Symbol:

Step 1.

Create an animation and dont enter the complete variable but just the part corresponding to the information you want to animate.

Figure 23

Step 2.

Create the Symbol as usual.

Module 14 - Generic HMI

Page 31/37

Step 3.

Every time you insert an instance you must select the branch in the

Local field.

Figure 24

[A]: Branches / Context. Mimic branch. [B]: Branches / Local. Symbol branch. [C]: Variables configured in the animations.

To simplify this you can keep in mind the following formula:


MIMIC BRANCH + .SYMBOL BRANCH + .VARIABLE ANIMATED = VARIABLE

If the result is not the name of an existing variable then animations will be not connected and a warning sign will appear.

Module 14 - Generic HMI

Page 32/37

Exercise 9. a. Modify the Light.obj Symbol:

- Animate the rectangle to display the status of ON - Animate the button to set the variable CMD

b. Insert two instances of Light.obj and configure the


branches: - BUILDING.FLOOR_01.LT_01 - BUILDING.FLOOR_01.LT_02 Switch to Run-time mode and try it out.

Create a new mimic with the branch BUILDING.FLOOR_01 and insert the Symbol Light.obj. What local branch do you have to configure?

Module 14 - Generic HMI

Page 33/37

6.7 Add a symbol from the PcVue Library


PcVue is supplied with a large number of predefined symbols saved in various libraries according to type. Some symbols are animated while others are not. To insert a symbol from the Library:

Step 1. Step 2.

Open the Symbols Manager dialog. Select the library needed via the Library dropdown box.

Figure 25

Module 14 - Generic HMI

Page 34/37

Step 3.
.ani.

Select the symbol needed. Animated symbols have the extension

Figure 26

Step 4.

Double-click the variable name with which the symbol was created and select the actual variable to be used by this particular instance. The original variable is replaced (substituted) by the new one.

Figure 27

Module 14 - Generic HMI

Page 35/37

Exercise 10. a. Insert the symbol GENERAL_LIGHT_03.ani from the LIGHTS


library.

b. Substitute the CMD variable by

BUILDING.FLOOR_01.LT_01.ON

6.8 Forwarding the current branch


PcVue has a powerful feature for forwarding the current branch. How to use it? In our example we want to open a pop-up panel when the user clicks on a symbol. The panel is a branched mimic containing some details about the selected symbol. How does PcVue know the correct branch to open the panel? It just forwards the current symbols branch. To do this PcVue uses the * character.

The * character is an important special character meaning Me or The current. When * is configured in a branch field it means The current branch.

Exercise 11.

Create the symbol Ac.obj with following parameters

Graphical Object Text Rectangle

Animation Displays the temperature Displays the status Opens the mimic POP_AC Panel as a popup.

Module 14 - Generic HMI

Page 36/37

7 Summing-up
Use Mimic Templates to have the same look and feel for the whole application. Use Branches to create generic mimics. Use Symbols to create generic graphical objects. A Symbol can be animated and it can use Branches. The * character means Me and it is used to forward the current branch. To connect all animations of a mimic, PcVue applies this formula: MIMIC BRANCH + .SYMBOL BRANCH + .VARIABLE ANIMATED = VARIABLE

Module 14 - Generic HMI

Page 37/37

Services

Module 15 Automated application generation

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

4
4 4 4

2 3

This feature in PcVue architecture Modeling your application


3.1 The Templates 3.2 Study case 3.3 Application Architect 3.3.1 Architect overview 3.4 Create Templates 3.4.1 Create a Template Category 3.4.2 Create a Template 3.4.3 Add Variables to a Template 3.4.4 Included Templates 3.5 Describe the Instances 3.5.1 Create Topology elements 3.5.2 Create Instances 3.6 Generate the Elements 3.7 Behaviors 3.8 Dynamic Properties 3.8.1 Property by Input 3.8.2 Property by Parameters 3.9 Graphical Elements 3.9.1 Associate a Mimic with a Template 3.9.2 Associate a Symbol with a Template

5 6
6 7 7 8 9 10 10 11 14 15 17 19 21 23 25 25 26 32 32 33

The Smart Generators


4.1 Input files 4.1.1 Configuration files

35
36 36 Page 2/44

Module 15 - Automated application generation

4.1.2 CAD files 4.1.3 XML files 4.2 Smart Generator output 4.3 Open a Smart Generator 4.4 A typical Smart Generator WAGO CODESYS

36 36 37 38 38

Summing-up

44

Module 15 - Automated application generation

Page 3/44

1 Introduction
1.1 In this module you will learn
Why modeling a project is good. Using the Application Architect. Using the Smart Generator.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_15\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 15 - Automated application generation

Page 4/44

2 This feature in PcVue architecture

Figure 1

Module 15 - Automated application generation

Page 5/44

3 Modeling your application


As mentioned in module 4 PcVue and project concepts, most of the time, a SCADA project contains repetitive or common features which are hardware (valve, pumps) or geographically (Floors, Areas) related. We called them Functional blocks. In the last module we have seen how to manage these repetitive objects thereby creating a generic application. But what we did was purely graphic. For all the configuration elements such as Variables we created them using the old fashioned one-at-a-time way. Even using the Application Explorer or a third party product like Excel it can be a very long process. It could be good to have a similar feature as used for the Mimic templates, branch & Symbols for the Variables Tree.

3.1 The Templates


PcVue 10.0 implements a new feature called Templates. The Templates concept is quite similar to the Symbols: First create a template (model) then instantiate it as required. If you modify the template then all instances will be updated automatically. The Templates feature has been done mainly to manage variables but we will see that it can also manage some graphics. The object oriented approach of templates encourages and helps the developer to structure applications in a way that makes modification and maintenance much easier and quicker. The following diagram describes the Templates concept:

Figure 2

Module 15 - Automated application generation

Page 6/44

Dont confuse Templates and Mimic Templates! 3.2 Study case


You noticed, maybe, that the project you ran generates many error messages on PcVue startup. Thats to be expected because we have deleted the Variables Tree (the file Varexp.dat). In this module we are going to redo the Variables Tree completely using the Templates feature. We have also deleted the floor mimics - we will redo those as well. You will see that we will generate the same application but much faster. And to prove it we change the specifications increasing dramatically the floors number. So far, we designed a building having 3 floors. The first one is special but the Floors 2 and 3 are strictly the same. Now we have: 7 Floors Each floor is different in term of rooms meaning the amount of Lights and Air conditioners are different on each floor. The following table lists the number of rooms number per floor. FLOOR 01 02 03 04 05 06 07 Rooms 3 5 6 5 4 3 2

We still have 1 Light and 1 Air conditioner per room.

3.3 Application Architect


The Application Architect (The Architect) is a tool allowing the designer to: Create the Templates, Describe all Instances, Generate the data, Configure Parameters (We will see at the end of this module what a Parameter is). And much more Page 7/44

Module 15 - Automated application generation

3.3.1 Architect overview

Step 1.
menu.

To open the Architect left click Configure / Application Architect

Figure 3

Figure 4

[A] Menu bar: Allows the designer to save the current configuration, Exit, Customize the view and generate the data. [B] Left Pane: Allows the designer insert quickly a Template or a Parameter. [C] Right Pane: Allows the Designer to create the Templates, Instances or Parameters. You can switch these Configuration modes by clicking the Tabs located in the Right Pane.

Figure 5

If you are distracted by all libraries being displayed you can disable them by renaming the file C:\PcVue Projects\LIB\Library.dat to Library_BAK.dat.
Module 15 - Automated application generation Page 8/44

3.4 Create Templates


The following diagram describes the different parts of the Right Pane in Templates Mode.

Figure 6

[A] Tool bar: Allows Copy/Paste any selected item, creating Template Categories and creating TemplatesThis Tool bar is dynamic and adapts itself to the context. [B] Templates configuration tree: Manage the Templates declared. They are classified by Libraries and Categories. [C] Secondary navigation tree (Elements tree): Used to edit Elements defined for the selected Template. [D] Properties grid: Display the properties of the selected item. Create a Template using the Architect is quite easy but you must follow some basic rules. For a Template you can define the following Elements: Configuration Elements: Variables, thresholds, trends Graphics: Symbols and Mimics, Included Templates: Used to structure the Templates. Parameters: Used for dynamic properties (Advanced) Page 9/44

Module 15 - Automated application generation

A Template can belong to a Template Category. This is optional but recommended to have a clear picture of your different Templates. 3.4.1 Create a Template Category

Step 1.

In the Templates configuration tree, right click the node (Local) (your project), select Add a Category and type the Category name.

Figure 7

Figure 8

Exercise 1.

Create the Categories: Devices and Locations.

3.4.2 Create a Template

Step 1.

In the Templates configuration tree, right click the Category, select Add Template and type the Template name.

Figure 9

Module 15 - Automated application generation

Page 10/44

A new Template has been created. If you select it the Item list is displayed on the Elements tree and the Template properties in the Properties grid.

Figure 10

Exercise 2.

Create the LIGHT and AIRCOND Templates.

3.4.3 Add Variables to a Template

Step 1.

In the Elements tree, right click Configuration elements, select Add Bit/Register/Text and type the Variable name.

Figure 11

Module 15 - Automated application generation

Page 11/44

Step 2.

The Variable is automatically selected and its main properties are displayed in the Properties grid.

Figure 12

Step 3.

You can change any property directly in the grid.

Figure 13

Note the Properties grid displays the main properties only. If you want to display all properties you must right click any property and select Advanced. Module 15 - Automated application generation Page 12/44

Figure 14

When you change a property from the default value it appears in bold font. If you want to come back to the default value dont delete the value but right click the Property name and select Reset.

Figure 15

Exercise 3.
Name Type

Create the following variables for the LIGHT Template.


Description Command Unit Min/Max

LUM ON CMD

Register Luminosity Bit Bit Light On Command

No No Yes

0/100

Create the following variables for the AIRCOND Template.


Name Type Description Command Unit Min/Max

TEMP

Register Temperature No Yes Yes

Celsius 0/40 Celsius 0/40

SETPOINT Register Set point ON Bit Air cond. On

Module 15 - Automated application generation

Page 13/44

Copy the SETPOINT data and Paste it. Is it working? Copy the CMD from LIGHT Template to AIRCOND Template. Is it working? Yes it works in both cases! Note that all properties are copied even the one you customized.

3.4.4 Included Templates A Template contains Variables but it can contain . Another template too! Thats the way to structure them. For example, in a project a Tank has always 1 Valve and 1 Pump installed. You can imagine the VALVE and PUMP Templates and the TANK Template containing the VALVE and the PUMP included Templates. The following procedure describes how to create Included Templates.

Step 1.

In the Elements tree, right click Included templates, select Add an included template / <Library> / <Category> / <Template>.

Figure 16

Step 2.

A new Template is added in the Included templates item.

Figure 17

Note the Branch property on the Properties grid. Later, in the exercise, we will see where this parameter applies. Module 15 - Automated application generation Page 14/44

Exercise 4.

Create the ROOM Template including the AIRCOND and LT Templates.

3.5 Describe the Instances


The following diagram describes the different parts of the Right Pane in Instances Mode.

Figure 18

[A] Tool bar: Allows Copy/Paste any selected item, creating InstancesThis Tool bar is dynamic and adapts itself to the context. [B] Instances tree: Contains all instances and topology items. [C] Instances Properties grid: Displays the properties of the selected item in the Instances tree. [D] Instance Elements tree: Displays the Elements which will be generated for the item selected in the Instances tree. [E] Property Input area: Used to set the value of the Dynamic properties (see Chapter 3.8). Instantiation is the process of defining the instances tree from which your application will be generated.

Module 15 - Automated application generation

Page 15/44

During the instantiation process you will do some or all of the following. Create and name topology elements, Add and name template instances.

Module 15 - Automated application generation

Page 16/44

3.5.1 Create Topology elements A Topology element is like an empty template. It is implemented only to add a structure to your data. The Topology element will generate only 1 field of the final branch of the data. The root of the Instance tree is always the Project name. The following procedure describes how to create a Topology element.

Step 1.

In the Instances tree, right click a node, select Add a topology element and type its name.

Figure 19

Step 2.

A new node appears having the Topology element icon.

Figure 20

By default, the Branch field displayed on the Instances Properties grid has the same value than the Topology element Name value. It is common than the Branch value is different than the Topology element. You can change it in the Instances properties grid.

Figure 21

Module 15 - Automated application generation

Page 17/44

Exercise 5.

Add the Topology elements The_Building and Floor_1 having respectively the branches properties BUILDING and FLOOR_01.

Imagine we generate now, what branch will be created? BUILDING.FLOOR_01

Module 15 - Automated application generation

Page 18/44

3.5.2 Create Instances The following procedure describes how to create a Template Instance.

Step 1.

In the Instances tree, right click a node, select Add instance / <library> / <Category> / <Template name> and type its name.

Figure 22

Step 2.

A new Instance has been added in the Instances tree.

Figure 23

Note the content of the Instance Elements tree. It contains the Elements to generate for this instance.

Module 15 - Automated application generation

Page 19/44

Adding a Template Instance that contains Included Templates is exactly the same operation.

Figure 24

Note the content of the Instance Elements tree. It contains the Elements to generate for this instance, but here the Elements belong to the Included Templates.

Exercise 6. a. Add the Instances LIGHT01 and AIRCOND01.

Check the content of the Instance Elements tree. instance. Check the content of the Instance Elements tree.

b. Now, remove these 2 instances and add the ROOM_101

Module 15 - Automated application generation

Page 20/44

3.6 Generate the Elements


Generation is the process of producing PcVues configuration elements from the Application Architect. The following procedure describes how to generate the Elements.

Step 1.

Select Task / Generate in the Menu bar or press the F7 keystroke.

Figure 25

Step 2.

The Generation options dialog opens.

Figure 26

Step 3.

Select the appropriate options and click Continue button.

Check consistency before generation: If you have a complex structure (Included Templates inside another Included Templates inside .) then it is recommended that you allow the Architect to check if everything is OK before the Generation. Synchronization type: In case of big project we advise using the Fast synchronization.

Module 15 - Automated application generation

Page 21/44

Step 4.

The Architect opens the Generation dialog and launches the Generation. When it is done a message indicates that it has been generated successfully. Clicking the >> button will display the Generation logs.

Figure 27

Exercise 7.

Generate. Check in the Application Explorer the Variables generated.

In the Application Explorer, change the Format property of the variable BUILDING.FLOOR_01.ROOM_101.AC.TEMP to #u then come back to the Architect and generate again (Full synchro). Finally check again the Format property, what is its value? #u The property has not been overwritten.

Module 15 - Automated application generation

Page 22/44

Now, change the Unit property of the variable BUILDING.FLOOR_01.ROOM_101.AC.TEMP to Farhenheit then come back to the Architect and generate again (Full synchro). Finally check again the Unit property, what is its value? Celsius. The property has been overwritten.

Synchronization Rule: The generation process overwrites all properties which have been customized in the Architect (in bold). 3.7 Behaviors
As you know already, Variables have behaviors. From the Architects point of view behaviors are just more Elements to generate. The following procedure describes how to create a behavior.

Step 1.

On the Elements tree, right click the Variable you want to add a behavior to, select the behavior and type its name.

Figure 28

Step 2. Step 3.

A new behavior has been added to the Variable. Complete the behavior properties on the Properties grid. Page 23/44

Module 15 - Automated application generation

Figure 29

Exercise 8.

Add the Thresholds behavior to the Variable TEMP of AIRCOND Template. Disable the limits hihi & lolo. Configure a High (=30) and Low (=15) limits.

Select the instance ROOM_101. What Variables will be generated if we select a Fast synchronization? Then Generate using a Fast synchronization and verify. BUILDING.FLOOR_01.ROOM_101.AC.TEMP_high BUILDING.FLOOR_01.ROOM_101.AC.TEMP_low

Module 15 - Automated application generation

Page 24/44

3.8 Dynamic Properties


So far, all the properties configured are static. This means that the property value is the same for all instances. But, in many cases, we need to have a dynamic property. This means the property value changes according to the conditions. A typical case is the Domain property. Often, the domain must change according the instance. For example, if the Domain value is the Floor number of a building we cant configure it in the Template. In this case we will have to type the Domain properties when we describe the Instances. There are 3 types of dynamic properties: Input: The user types the property value during the Instances description. Expression: The propertys value is calculated during the instantiation. This type is not covered by this module. Parameter: Next chapter. 3.8.1 Property by Input The following procedure describes how to create a dynamic property by Input.

Step 1.

In the Template Elements grid, select the variable. In the Properties grid, right click the property you want to be dynamic and select Define by / Input.

Figure 30

Module 15 - Automated application generation

Page 25/44

Step 2.

The special string {?} appears in the property value field.

Figure 31

Step 3.

Now we are able to change the Property value. In the Instances tree select the Instance. You will see the Dynamic Property displayed in the Input area. Enter the property value required.

Figure 32

Exercise 9.

Change the Domain property to an Input property for all variables of Templates AIRCOND and LIGHT. Select the Domain FLOOR1 for all variables of the ROOM_101 in the Instantiation panes. Save, generate and check the result using the Application Explorer.

3.8.2 Property by Parameters There are 2 situations when you will have to use Parameters: A Property is not really defined clearly during the design time. May be it will change later. If this property is common then you will have to change it in every Element. This can take a long time. For example, during the design, you dont what Nature you will use. As you understood a Dynamic property by Input is useful for a single instance of a property but not for a large number. So as not to have to change too many elements during the Instantiation phase we must configure a Parameter. Module 15 - Automated application generation Page 26/44

There are two types of Parameters: Input: The Property value of the Parameter is typed during the instantiation phase. We use this type in the first situation. Expression: The Property value is calculated automatically during the instantiation. We use this type in the second situation. This type is not covered in this module. 3.8.2.1 Parameters HMI The following diagram describes the different parts of the Right Pane in Parameters Mode.

Figure 33

[A] Tool bar: Allows Copy/Paste any selected item, creating ParametersThis Tool bar is dynamic and adapts itself to the context. [B] Parameters tree: Parameters tree. Displays all Parameters sorted by libraries/Categories. For adding/selecting a Parameter. [C] Properties grid: Displays the properties of the selected Parameter

Module 15 - Automated application generation

Page 27/44

3.8.2.2 Create an Input Parameter

Step 1.

In the Parameters tree, right click a library and select Add a parameter then type the Parameters name.

Figure 34

Step 2.

In the Properties Grid complete the properties.

Type: Input or Expression. Default value: Value if the user doesnt change it. Must match property value: Yes/No. It allows you to restrict the value of the Parameter so that it respects the same rules that are applied to the property for which it will be used. If Yes, you must select the Element type (Variable, Trends) and the Property to match (Domain, Nature).

Module 15 - Automated application generation

Page 28/44

3.8.2.3 Apply a Parameter to a Property The following procedure describes how to configure a property using a Parameter.

Step 1.

In the Template Elements tree, right click Parameters / Add a parameter / <Library name> / <Parameter name>.

Figure 35

Step 2.

Now a new Parameter is added as an Element of the Template. We can call it the Templates Parameter.

Figure 36

Step 3.

In the Template Property grid, right click the Property and select Define by / Parameter / Local / <Parameter name>.

Figure 37

Module 15 - Automated application generation

Page 29/44

Step 4.

Now the Parameter is added as a value of the Property. We can call it the Propertys Parameter.

Figure 38

Step 5.

Now we are able to change the Parameter value. In the Instances tree select the Instance required. The Parameters to input are displayed in the Instances Input Parameters area.

Figure 39

Step 6.

Now you can:

Change the Templates Parameter value. The value will apply to all Properties of the Template having the same Parameter. Change the Propertys Parameter value of one specific property. The value entered will apply to the Property only.

Parameter Input Rule: The Propertys Parameter input generation is prioritized. If it is not entered then the Templates Parameter value will be applied.

Module 15 - Automated application generation

Page 30/44

When you enter a value for the Templates Parameter the Properties Parameter are not updated automatically. To update all you must select any other item in the Instances tree and select again your original instance. Now you can see what will be generated. Here is the Input Areas screenshot after applying this trick.

Figure 40

You can also switch the Instances Input Area to Normal (not Advanced) so as not to see the Properties Parameters.

Exercise 10.
a. Apply the Parameter _pDomain to the Templates AIRCOND and LIGHT and to all variables of these 2 Templates. b. In the Instances tree, select the ROOM_101 instance. In the Instances Input Area select FLOOR1 for the AC._pDomain and LT._pDomain items. c. Generate and check the result using the Application Explorer.

In the Architect, change the Propertys Parameter AC.ON._pDomain to FLOOR2, generate and check the Domain property of the variable BUILDING FLOOR_01.ROOM_101.AC.ON Whats the value? How do you correct this mistake? FLOOR2. The rule described below explains why. In the Instances Input Area, right click AC.ON._pDomain and select Reset then generate.

Module 15 - Automated application generation

Page 31/44

3.9 Graphical Elements


As you probably guessed, the Architect doesnt generate only Configuration but graphical Elements as well. It can generate 2 types of graphical Elements: Mimics, Symbols inserted in mimics. 3.9.1 Associate a Mimic with a Template The following procedure describes how to associate a mimic Element with a Template.

Step 1.
mimic.

In the Template Elements tree, right click Graphic elements / Add

Figure 41

Step 2.

Complete the mimic properties in the Property grid.

Figure 42

Title: Title of the generated mimic. Mimic template: Mimic template created previously in the HMI. Use context branch: If yes, we assume this mimic will be opened with a branch. If it contains symbols, they will be generated with the Local branch only. Module 15 - Automated application generation Page 32/44

Exercise 11.
a. Create the Template FLOOR (Locations category). b. Add the Mimic FLOOR. Template = MyTemplate Use context branch = No c. In the Instances tree right click on the Floor_1 Instance and select Transform into template instance / (local) / Locations / FLOOR. d. Generate. Check the mimic created. 3.9.2 Associate a Symbol with a Template The following procedure describes how to associate a mimic Element with a Template.

Step 1.
symbol.

In the Template Elements tree, right click Graphic elements / Add

Figure 43

Module 15 - Automated application generation

Page 33/44

Step 2.

Complete the symbol properties in the Property grid.

Figure 44

Symbol: You must select the name of the symbol previously created in the HMI.

Exercise 12.
a. Add a symbol to the Template ROOM. Symbol = Room.obj b. Generate. Check the mimic created.

Exercise 13.
Using the Templates previously created and the Specifications written on chapter 3.2, create the complete application.

Module 15 - Automated application generation

Page 34/44

4 The Smart Generators


The Smart Generators are tools for generating the Supervisor's project configuration by importing it from files created by third party software such as PLC programming packages. They work by communicating directly with PcVue to generate the configuration. The following diagram describes the main feature:

Figure 45

Module 15 - Automated application generation

Page 35/44

4.1 Input files


There are three types of input files: Configuration files CAD (Computer-Aided Design) files, XML files. 4.1.1 Configuration files These files are generated by programming software provided by particular manufacturers (mostly PLC manufacturers). There are Smart Generator for the following: Schneider Electric: Unity Pro. WAGO: CoDeSys. (programming tool for WAGO programmable coupler) ICS Triplex: ISaGRAF. (A control software environment that enables you to create local or distributed control systems.) LonWorks: the network management software for Echelon's LonWorks-based networks. FactoryLink: the HMI and SCADA software suite. Siemens SIMATIC Step 7 (the software suite for creating programs for the SIMATIC range of PLCs). WAGO DALI (Digital Addressable Lighting Interface (for use with WAGO PLCs supporting DALI technology using a specific program and modules). YOKOGAWA STARDOM: Solution using the software Logic Designer as a programing tool. 4.1.2 CAD files Files generated by Computer Aided Design software. There is a Smart Generator for CAD files created by AutoCAD from Autodesk. Versions 12, 13, 14, 2000, 2004, 2007 and 2010 are supported. 4.1.3 XML files These files can be created by any software able to generate XML format. Even Notepad can do it, if you provide the XML mark-up! In PcVue vocabulary this is called the Generic XML Import. The format of the Generic XML Import file is available here: DVD\ Sv\Development kits\Import Toolkit\XML_Import 1.70_ENU.pdf

Module 15 - Automated application generation

Page 36/44

4.2 Smart Generator output


The Smart Generators are able to generate almost any PcVue objects. However, what is produced will be limited by the type of files being imported. The following table lists the PcVue objects generated according the input file type: Input file type Schneider Electric: Unity Pro WAGO: CoDeSys ICS Triplex: ISaGRAF LonWorks Factory Link AutoCAD XML Generic Import Variables Communication Mimics Others

OPC Modbus TCP/IP OPC LonWorks OPC


S7 Protocol Modbus TCP/IP OPC

Trends,
logs etc.

Siemens STEP7 WAGO DALI Yokogawa STARDOM

Module 15 - Automated application generation

Page 37/44

4.3 Open a Smart Generator


To open the Smart Generators Management dialog:

Step 1.

Select Configure /

Figure 46

Step 2.

The Smart Generator Management dialog is displayed.

Figure 47

One Smart Generator action exists already! Where its coming from? Actually the Application Architect generates a XML Generic Import file and uses the Generic Smart Generator to generate the PcVue objects! 4.4 A typical Smart Generator WAGO CODESYS
WAGO (http://www.wago.com) is a German PLC manufacturer using the CoDeSys platform (http://www.3s-software.com) to program their PLCs. CoDeSys for Wago generates *.SYM configuration files. Smart Generator for Wago uses a *.SYM file as the input file. To import a WAGO file: Module 15 - Automated application generation Page 38/44

Step 1.

Open the Smart Generator Management dialog and select New Wago Import in the left-hand panel.

Figure 48

Step 2.

Complete the Select project dialog and click the Next button.

a. File name: Input file name. b. Alias: Equipment name in PcVue. c. IP: TCP/IP address of the PLC.

Figure 49

Module 15 - Automated application generation

Page 39/44

Step 3.

Smart Generator reads the file and displays the number of items found. You can select: a. Full import: Smart Generator will generate all items. b. Custom import: You can select the items to import.

Figure 50

Step 4.

If you select a Custom import, Smart Generator opens the Select variables dialog. This is a standard dialog and you will see it in other Smart Generator wizards. a. Select a filter and click the Apply button. Smart Generator displays the variables matching the filter in the left-hand list. b. Select the variables you want to import and click the button -> or doubleclick on the variable. You can select several items using the usual Windows multi selection (Shift key). c. Click the Next button. Smart Generator displays the Wordbits dialog.

Figure 51

Module 15 - Automated application generation

Page 40/44

Step 5.

WAGO PLCs support Wordbits. Smart Generator detects all Words available for Wordbits. a. In the left-hand list, select the Word you want to use for Wordbits and click the -> button or double-click on the item. b. Click the button BitSet if you only want to select some of the bits. c. Click the Next button. Smart Generator displays the Branch dialog.

Figure 52

Module 15 - Automated application generation

Page 41/44

Step 6.

The Branch dialog is a standard one that you will see in other Smart Generator wizards. a. Global branch: All variables generated will have this branch. b. WAGO uses the branch concept but not all other programming software does. So when you are programming, you might create a naming rule and use the character _ (for example) as a branch separator. If you enter _ Smart Generator will substitute the _ character by .. c. Click the Next button. Smart Generator displays the Generate variables dialog.

Figure 53

Step 7.

All generated variables are listed. Click the Finish button to

generate.

Figure 54

Module 15 - Automated application generation

Page 42/44

Exercise 14.

Import a WAGO CoDeSys project using the following parameters. After generation check the configuration of the communication and variables. XML Text

File Name Alias IP Full / Custom Import Wordbits Global branch

C:\Pcvue Projects\Usr\TRAINING\TP\Wago.SYM. WAGO1 125.10.1.1 (fake address) Custom Import (play with the filter) No FROM_WAGO

Restart PcVue. What happened? Why?

Its not possible to start because the Demo version accepts 25 equipment variables.

Module 15 - Automated application generation

Page 43/44

5 Summing-up
The Application Architect is a powerful tool with which you can create Templates to model your application. You can dramatically reduce development time using the Application Architect and the Smart Generators. Many manufacturers formats are already supported and we are adding new ones regularly. Even if a manufacturers format is not supported by a Smart Generator, you can still use the Generic XML Import.

Module 15 - Automated application generation

Page 44/44

Communication interfaces

Module 16

WebVue Overview

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4 5 6 7

This feature in PcVue architecture The concepts The limitations Configuring WebVue in PcVue Connect to WebVue from a Web Client Summing-up

4 5 6 7 9 10

Module 16 - WebVue Overview

Page 2/10

1 Introduction
1.1 In this module you will learn
The concepts of WebVue, About the WebVues limitations, How to configure it, How to connect from a Web Client.

1.2 Files used in this module


None.

1.3 Third party software used in this module


None.

Module 16 - WebVue Overview

Page 3/10

2 This feature in PcVue architecture

Figure 1

Module 16 - WebVue Overview

Page 4/10

3 The concepts
Web Services is the technology used by the Supervisor to enable access from an external application connected via the Internet or an intranet. PcVue uses Microsoft's Internet Information Services (IIS) to exchange XML/SOAP messages with local or remote web clients. IIS is an HTTP server supplied with Windows. XML/SOAP Web Services are used by PcVue for connectivity to the following external applications: WebVue client using a private web service called the WebPropertyServer WebVue is designed to display the Supervisor's mimics on a Web browser (Internet Explorer, Netscape etc.). The WebVue Client and the Supervisor's Web Services communicate using HTTP (HyperText Transfer Protocol). The WebVue client is implemented as a Java applet that runs in a Java virtual machine in any Java-enabled web browser. Third party web client using the Supervisors Web Services Toolkit The Web Services Toolkit is a server-side API (Application Programming Interface). It allows a third party to develop programs that can access information in the Supervisor including the real-time values of variables, alarms status and historic data.

Figure 2

Module 16 - WebVue Overview

Page 5/10

4 The limitations
Because the mimics are displayed in the Web Browser by a Java Applet there are several limitations. The main ones are: No ActiveX, No Timetable animation, No Recipe animation, Limited support for SCADA Basic instructions and modes, No VBA script code.

The complete list of WebVue limits is available in the online help: Web Services / WebVue / Designing mimics for WebVue / Restrictions.

Module 16 - WebVue Overview

Page 6/10

5 Configuring WebVue in PcVue


To configure WebVue in PcVue:

Step 1. Step 2.

Open the Application Explorer and expand the configuration tree to select the Servers node. In the right pane select WebVue & Web Services Toolkit. Then, from the task pane:

Figure 3

Step 3.

Select Setup IIS virtual directories.

Module 16 - WebVue Overview

Page 7/10

Step 4.

Then select Settings to configure WebVues behavior.

Figure 4

Step 5.

Configure the WebVue access for each user profile to have access from a Web Client. This is covered in another module (User Rights).

If the WebVue & Web Services toolkit icon, in the right pane of the Application Explorer, has a red stop symbol against it - it probably means that you didnt select the Web Supervisor during the setup.

Module 16 - WebVue Overview

Page 8/10

6 Connect to WebVue from a Web Client


Its very easy to connect to the WebVue server from a Web Client. You need only type this address: http://Server address/project name. A login dialog appears; type the login / password and you are in!

Module 16 - WebVue Overview

Page 9/10

7 Summing-up
WebVue is based on Microsofts Web Services technology WebVue uses IIS as a Web Server. The Web Client must have the Java Runtime module installed.

Module 16 - WebVue Overview

Page 10/10

Communication interfaces

Module 17 Network architectures Overview

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4

This feature in PcVue architecture The concepts Architectures


4.1 1 SERVER N CLIENTS 4.2 N SERVERS 1 CLIENT 4.3 N SERVERS N CLIENTS

4 5 7
7 8 9

Redundancy
5.1 Single Active Association 5.2 Multiple Active Association

10
10 11

6 7 8

Archives Server

12

Configuring the network architecture in PcVue 13 Summing-up 16

Module 17 - Network architectures - Overview

Page 2/16

1 Introduction
1.1 In this module you will learn
How PcVue manages a networked architecture, The various classical architectures, How to configure a PcVue network.

1.2 Files used in this module


None.

1.3 Third party software used in this module


None.

Module 17 - Network architectures - Overview

Page 3/16

2 This feature in PcVue architecture

Figure 1

Module 17 - Network architectures - Overview

Page 4/16

3 The concepts
The following diagram describes the most basic networked architecture.

Figure 2

In this architecture the PcVue SERVER is communicating with the equipment using classical industrial communication (built-in drivers, OPC etc.). The PcVue CLIENT is connected to the PcVue SERVER and collects the data using the Networking Interface. The protocol used between PcVue SERVER and CLIENT is proprietary over TCP/IP. The communication between PcVue SERVER and CLIENT is similar to OPC and its done in these steps:

Step 1. Step 2. Step 3. Step 4.

On start-up the CLIENT connects to the SERVER.

Once its connected, the CLIENT attempts to subscribe to all the variables that it requires. The SERVER registers the subscription for each variable and returns the current value to the CLIENT. For each subscribed variable, the SERVER notifies the CLIENT when the value or the status changes.

Module 17 - Network architectures - Overview

Page 5/16

The most important points to remember are: The PcVue project is the same in both stations. Therefore the deployment is very easy: you only have to copy the project folder to each computer. Each variable is owned by a PcVue Station. In PcVue terminology we say the variable is produced by a SERVER and consumed by a CLIENT. Only the Producer (Owner) of a variable can set its value or change its status.

When the operator clicks on a button to set a variable on the CLIENT station (Consumer) PcVue sends a SET request to the SERVER (Producer). The SERVER manages setting the value. When the value changes it will notify the CLIENT in the normal manner. When the operator acknowledges an alarm on the CLIENT station (Consumer) PcVue sends an ACK request to the SERVER (Producer). The SERVER manages the acknowledging of the alarm. When the status changes it notifies the CLIENT in the normal manner. Each PcVue station is identified by a unique station number, station name and TCP/IP address (or Host name). The station number is configured in the file <PcVue path>\Etc\ini.dat (1st line 2nd field, 1 by default).

Module 17 - Network architectures - Overview

Page 6/16

4 Architectures
PcVue supports many different architectures as described in the following diagrams.

4.1 1 SERVER N CLIENTS

Figure 3

Several CLIENTS are connected to the SERVER. When a value or a status changes all CLIENTS are notified by the SERVER.

Module 17 - Network architectures - Overview

Page 7/16

4.2 N SERVERS 1 CLIENT

Figure 4

Each SERVER collects data from the various sources and notifies the same CLIENT.

Module 17 - Network architectures - Overview

Page 8/16

4.3 N SERVERS N CLIENTS

Figure 5

Each SERVER collects data from the various sources and notifies: CLIENT1, CLIENT2, CLIENT3 for SERVER1 CLIENT3, CLIENT4, CLIENT5 for SERVER2

Module 17 - Network architectures - Overview

Page 9/16

5 Redundancy
For maximum reliability the end user often requires a redundant system. PcVue supports several redundant configurations.

5.1 Single Active Association

Figure 6

An ASSOCIATION is a Cluster of two (or more) redundant SERVERS. The Active server (represented by the star above) is the one communicating with the equipment. The Active SERVER is always the first started. The second one is in Standby mode (or Passive). A Standby SERVER behaves as a normal CLIENT. When the Active SERVER is off, the Standby SERVER becomes Active automatically. The CLIENTS are always connected to the Active SERVER.

Module 17 - Network architectures - Overview

Page 10/16

5.2 Multiple Active Association


The Single Active Association is most common. But for some users the switch-over time can be a problem as during the switch-over the new Active SERVER has to start its communication. The time required to refresh all variables can be very long depending on the protocol, the number of devices, etc. Therefore during the switch-over time you can miss some events. To avoid this problem you must implement a Multiple Active Association.

Figure 7

The disadvantage of using Multiple Active Servers is that you must use equipment that supports simultaneous communication from both servers.

Module 17 - Network architectures - Overview

Page 11/16

6 Archives Server
Networked architectures are normally used for Real Time Data but can also be used for Historic (Archive) Data as well. The following diagram describes a typical architecture implementing an Archives SERVER.

Figure 8

CLIENT 3 is a Real-time Data CLIENT but an Archives SERVER. CLIENT 1 and CLIENT 2 are Real-time data CLIENTS and Archives CLIENTS. For smaller projects with limited real-time data, the Real-time SERVER and the Archives Data SERVER can be on the same Station. For maximum reliability of the Archives, you can implement an Archives Association to manage the redundancy.

Module 17 - Network architectures - Overview

Page 12/16

7 Configuring the network architecture in PcVue


The easiest way to configure your network is to use the Network Wizard.

Step 1.

Open the Application Explorer and expand the configuration tree to select the Networking node.

Figure 9

Step 2.

Click Networking Wizard... in the task pane. PcVue opens the Wizard. Click the Next button.

Module 17 - Network architectures - Overview

Page 13/16

Step 3.

In the Clients/Servers Creation panel click the Add... button for each PcVue station. The Wizard opens the Station Properties dialog.

Figure 10

Step 4. Step 5.

Configure the station and click the OK button. When all stations are created click the Next button. The Wizard opens the Real-time server association dialog. Click the Add button if you have a redundant architecture. Type a Name and select the Servers belonging to this association. Click the OK button and then the Next button.

Figure 11

Step 6.

The Wizard opens the Historical Servers Association Properties dialog. Type a name and select the servers belonging to this association. Click the OK button and then the Next button.

Module 17 - Network architectures - Overview

Page 14/16

Figure 12

Step 7.

The dialog Client and Server List Generation gives a summary of the lists that have been created. Click on Finish to return to the Networking Explorer.

Module 17 - Network architectures - Overview

Page 15/16

8 Summing-up
Theoretically all architectures are possible with PcVue. The PcVue project is the same on every station. Redundancy is managed by a Server Association. An Association manages real-time or archive data.

Module 17 - Network architectures - Overview

Page 16/16

Archives

Module 18

Archive units

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4

This feature in PcVue architecture Archives The Proprietary Archive Unit


4.1 Properties 4.2 File management 4.3 Backup management 4.4 Configuration in PcVue

4 5 8
8 8 10 12

Summing-up

15

Module 18 - Archive units

Page 2/15

1 Introduction
1.1 In this module you will learn
What an Archive Unit is, About the different types of Archive Unit, About the proprietary Archive Unit.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_18\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 18 - Archive units

Page 3/15

2 This feature in PcVue architecture

Figure 1

Module 18 - Archive units

Page 4/15

3 Archives
The Supervisor supports two distinct data recording systems. Native - records to, and replays from, the Supervisor's native data storage system. The native system is available in all versions of PcVue. HDS - records to, and replays from, an industry standard database such as Microsoft SQL Server. With both systems, PcVue records data using an Archive Unit. The Archive Unit type determines which system you are using. The following table lists the available Archive Unit types and compares them in terms of strong and weak points:

Type

System

Proprietary

Native

Good performance Integrated backup/restore Very compact recording uses the minimum disk space. Size management Free of charge

No date/time management. Format not easily readable by third party software. No native export function. No synchronization between redundant archive servers.

Database

HDS

SQL Server format Good performance Automatic backup Size management Date/Time management Format readable by third party Export function Disconnection management Customizable tables. Synchronization between redundant archives servers

Requires much more space than the equivalent Proprietary unit. Restoration not automatic. Not free of charge (except the limited Express Edition).

Free

Native

Format readable by third party (CSV files)

Not readable by PcVue.

Module 18 - Archive units

Page 5/15

Type ODBC

System Native Can record in all Database types supporting ODBC. Poor performance when PcVue extracts the data No disconnection management Tables not customizable

VCR

Native

Used only to replay data through PcVue mimics (very specific use).

The process that records data is the same for all Archive Unit types. It is described in the following diagram.

Figure 2

Of course you can configure several Archive Units of the same or different types.

Figure 3

Module 18 - Archive units

Page 6/15

By the way: the same event can be recorded to several Archive Units at the same time.

Figure 4

Module 18 - Archive units

Page 7/15

4 The Proprietary Archive Unit


4.1 Properties
The Proprietary Archive Unit is a folder located, by default, here: <PcVue Project path>\TH\<Archive unit Name>. It has several properties, the main ones being: Name: The name by which the Archive Unit is referred to in PcVue and also the name of the folder in which the physical files are located. Folder size (10MB by default): The maximum size of the folder. File Size (1MB by default): The maximum size of each file within the folder. Back-up path: Folder destination for back-up data. Back-up trigger: Bit variable for triggering the back-up.

4.2 File management


To record data PcVue, creates a file (i.e. h0000000.dat) in the Archive Unit folder and write the data to it. When the file reaches the <File size> limit, PcVue close it and create a new one (i.e. h0000001.dat) and so on. When the folder size reaches the <Folder size> limit, PcVue discards the oldest file (i.e. h0000000.dat) and creates the next one in the sequence.

Module 18 - Archive units

Page 8/15

For example the Archive Unit properties are: Name: Prop_Unit Folder size: 100 MB File size: 1 MB Event First startup Data to record File size reached File size reached C:\Pcvue File size projects\TH\PROP_UNIT\ h0000000.dat h0000000.dat h0000000.dat h0000001.dat h0000000.dat h0000001.dat h0000002.dat Folder size reached h0000000.dat h0000001.dat h0000002.dat h0000099.dat h0000100.dat File size reached h0000000.dat h0000001.dat h0000002.dat h0000099.dat h0000100.dat h0000101.dat 1 MB 1 MB 0 MB 1 MB 0 MB 1 MB 1 MB 1 MB 99 MB 0 MB 0.1 MB 1 MB 0 MB 1 MB 1 MB 0 MB 1 MB 1 MB 1 MB 100 MB 2 MB Folder size

0 MB 0.1 MB

1 MB

Module 18 - Archive units

Page 9/15

4.3 Backup management


The Archives Backup is a "basic" copy of the archives files from the local folder to the backup folder. The backup is triggered by a bit Variable. For example the Archive Unit properties are: Name: Prop_Unit Folder size: 100 MB File size: 1 MB Backup Folder: D:\Backup Backup trigger: GENERAL.BACKUP Here we assume the trigger bit is set every day at 01:00. Event Day 1 00:59 C:\Pcvue projects\TH\PROP_UNIT\ D:\BACKUP\PROP_UNIT\ h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB) Day 1 01:00 h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB) h0000003.dat PcVue closes h0000002, creates h0000003 and copies the three files. Day 2 00:59 h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB) h0000003.dat (1MB) h0000004.dat (1MB) h0000005.dat (1MB) h0000006.dat (1MB) h0000007.dat (1MB) h0000008.dat (1MB) h0000009.dat (10KB) h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB)

Module 18 - Archive units

Page 10/15

Event Day 2 01:00

C:\Pcvue projects\TH\PROP_UNIT\ D:\BACKUP\PROP_UNIT\ h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB) h0000003.dat (1MB) h0000004.dat (1MB) h0000005.dat (1MB) h0000006.dat (1MB) h0000007.dat (1MB) h0000008.dat (1MB) h0000009.dat (10KB) h0000010.dat h0000000.dat (1MB) h0000001.dat (1MB) h0000002.dat (650KB) h0000003.dat (1MB) h0000004.dat (1MB) h0000005.dat (1MB) h0000006.dat (1MB) h0000007.dat (1MB) h0000008.dat (1MB) h0000009.dat (10KB)

PcVue closes h0000009, creates h0000010 and copies the seven files. Day 10 01:00 h0000000.dat h0000001.dat h0000002.dat h0000099.dat h0000100.dat h0000101.dat If the user makes an archive request involving data located in h0000000.dat then PcVue will automatically retrieve the data from the backup folder without any manual operation. h0000000.dat h0000001.dat h0000002.dat h0000099.dat h0000100.dat

Dont trigger the backup too often because if you do you will have many small archives files and the performance will decrease.

Module 18 - Archive units

Page 11/15

Restoring archives is a sensitive operation. Please contact your PcVue Technical Support before doing it.

4.4 Configuration in PcVue


To create an Archive Unit in PcVue:

Step 1.

Open the Application Architect and expand the configuration tree to select the Archive units node.

Figure 5

Step 2.

In the task pane select Add a proprietary unit PcVue opens the Archive Unit Creation dialog.

Module 18 - Archive units

Page 12/15

Step 3.
tab.

Enter the Name, Archive capacity and Archive file size in the General

Figure 6

Module 18 - Archive units

Page 13/15

Step 4.

If you want to use back-up tick the Back-up archive files option and enter the name of the Back-up folder and Triggering bit in the Back-up tab.

Figure 7

Exercise 1. a. Create a proprietary Archive Unit. b. onfigure the parameters according to the following table.
Parameter Unit Name Folder size File size Back-up Folder Triggering bit Value PROP_UNIT1 100 MB 1000 KB C:\BACKUP GENERAL.BACKUP

Module 18 - Archive units

Page 14/15

5 Summing-up
PcVue supports several recording formats. The proprietary format is the most popular. PcVue can manage several Archive Units in parallel whatever the format.

Module 18 - Archive units

Page 15/15

Archives

Module 19

HDS Overview

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4 5 6

This feature in PcVue architecture Historical Data Server (HDS) Configure HDS in PcVue HDS at Run-time Maintaining the Database
6.1 The Database Manager 6.1.1 Overview 6.1.2 Use the Database Manager 6.2 The Maintenance Plan 6.2.1 Overview 6.2.2 Configure a Maintenance Plan 6.2.3 Configure the tasks

4 5 6 11 12
12 12 13 14 14 15 16

Summing-up

18

Module 19 - HDS Overview

Page 2/18

1 Introduction
1.1 In this module you will learn
What is the HDS, How to configure a database Archive Unit, How to maintain the Archives database.

1.2 Files used in this module


None.

1.3 Third party software used in this module


None.

Module 19 - HDS Overview

Page 3/18

2 This feature in PcVue architecture

Figure 1

Module 19 - HDS Overview

Page 4/18

3 Historical Data Server (HDS)


The HDS collects and records real-time data from PcVue variables in an industry standard database such as a SQL Server. The recorded data can be retrieved by PcVue using the trend or log viewers or by a third party product compatible with the selected database. This version of the software has been tested for use with the following database standards. Microsoft Access 2000 (using Jet 4.0) Microsoft SQL Server 2000, 2005 and 2008 (using ADO) Microsoft's freely distributable SQL Server Express software is included with the Supervisor's distribution media. Data is recorded in configurable tables of which there are two types. Trend tables Used for recording register and bit variables. You can configure one or more trend tables in each database. Recorded data may be played back through a Trend Viewer. Log tables Used for event recording of bit and alarm changes of state and user actions. You can configure one or more log tables in each database. The following diagram represents the data recorded in a database mechanism.

Figure 2

Module 19 - HDS Overview

Page 5/18

4 Configure HDS in PcVue


There are several steps required to create a database Archive Unit: Configure the Database connection, Create the Database and the tables, Create the Archive Unit. Each step can be done separately but the simplest way is to use the Database Wizard.

Step 1. Step 2.

Open the Archives Configuration dialog. Select the command Database creation wizard from the left pane.

Figure 3

Module 19 - HDS Overview

Page 6/18

Step 3.

Enter the Database Name to be created (or the name of an existing one). Click the Next > button.

Figure 4

The name of the Database created is <Project name>_<Name configured in the Wizard>

Module 19 - HDS Overview

Page 7/18

Step 4.

This dialog is used to create the Database connection. Select the target Database in the Data Source drop-down box and click the Configure button.

Figure 5

Step 5.

This dialog depends on the Data Source selected. For Microsoft SQL Server: a. Enter the Server Name which is of the format: MachineName\Sql Server instance name.

We recommend using the character . instead of the Machine Name. This character means The current machine name. So, it will still work if you use your project in another computer.
b. Select the Authentication type you want. c. Click the Test connection button. It must be successful. Click the OK button. Click the Next > button.

Module 19 - HDS Overview

Page 8/18

Step 6.

This dialog is used to customize the Trend and Log tables.

a. Enter the Trends table Name and select the Select Columns button if you want to customize it. b. Enter the Log table Name and select the Select Columns button if you want to customize it.

Figure 6

Module 19 - HDS Overview

Page 9/18

Step 7.

This dialog is used to declare the Archive Unit and the Log list.

a. Enter the Archive unit Name. b. Enter the Log List Name and click the Select events button.

Figure 7

Step 8.

Click the Finish button.

Module 19 - HDS Overview

Page 10/18

5 HDS at Run-time
The HDS is a component which is represented by the following icon in the Windows Notification Area.

Figure 8

The default path where the HDS stores its databases is C:\Program Files\Arc Informatique\Pcvue Version\Databases folder. You can change this path in the Archive configuration dialog.

A classic mistake is to delete these files when you want to delete a SQL Server database. Unfortunately the database is still registered in SQL Server. You must use the Database Manager (see chapter 6.1) to do that.
If you use Microsoft SQL Server it is mandatory to configure the Security Access of this folder to give Full Access to the SQL user. For example if you use SQL Server 2005 Express Edition the SQL User is included in the Group SQLServer2005MSSQLUser$ComputerName$SQLEXPRESS The following screen-shot shows the configuration of the Databases Folders security.

Figure 9

Module 19 - HDS Overview

Page 11/18

6 Maintaining the Database


When in use a Database will be constantly growing and, after a while, the performance will degrade. For this reason it should be constantly maintained. PcVue provides two complementary tools to maintain a Database: The Database Manager, The Maintenance Plan.

6.1 The Database Manager


6.1.1 Overview The purpose of the Database Manager is to provide easy access to databases that are regularly administered. The tools it provides may be used with any Access or SQL Server database. The Database Manager provides these capabilities: Local and remote navigation and browsing to select database files. Keeping an index of the locations of the databases you administer. Replicating databases. Viewing and maintaining database properties. Viewing and maintaining database contents. File compaction and deletion. Administering security measures. Moving a SQL Server Database from one computer to another.

Module 19 - HDS Overview

Page 12/18

6.1.2 Use the Database Manager The Database Manager is a stand-alone tool that does not require any other application to be running.

Step 1. Step 2.

To run it click the shortcut Windows Start button / All Programs / Arc Informatique / PcVue Version/ Database Manager. On the left-hand panel, right-click the database you want to check and select the Add command.

Figure 10

Step 3.

Complete the form giving all details to connect with the Database then click the Add button.

Figure 11

Module 19 - HDS Overview

Page 13/18

Step 4.

Expand the new database item. You can select the Tables item to check the contents of the tables.

Figure 12

6.2 The Maintenance Plan


6.2.1 Overview A Maintenance Plan is used to execute maintenance tasks automatically on one or more of the databases used by the Supervisor. Each Maintenance Plan consists of a schedule and a list of tasks. The schedule decides when and how often the Maintenance Plan runs. The list of tasks determines what the Maintenance plan does. The tasks are executed in a configured sequence. The first task in the sequence starts when the Maintenance Plan runs; the second task starts when the first has finished and so on. The following tasks are available. Purge: Limits the age of records in the database by deleting those older than a defined period. Export: Exports data from the database, for a defined period, in text, ADTG or XML formats. Defrag: Defragments the database's index. Only available for SQL Server databases. Custom: Executes a custom Transact-SQL script. Only available for SQL Server databases. Shrink: Removes unused space in the Database's files thus reducing the space occupied on the hard drive. Only available for SQL Server databases. Each task is attached to a particular database. A single Maintenance Plan can execute tasks on one or more databases.

Module 19 - HDS Overview

Page 14/18

6.2.2 Configure a Maintenance Plan

Step 1. Step 2. Step 3.

Open the Archives configuration dialog. Select Databases / Maintenance Plan in the central panel. Click the command Add a Maintenance Plan in the left panel.

Figure 13

Step 4.

Type the Maintenance Plans Name. Click the Apply button and click the Schedule button.

Figure 14

Module 19 - HDS Overview

Page 15/18

Step 5.

PcVue opens the Schedule for Database dialog. Double-click the Trigger on the bottom panel and configure the trigger. Click the OK buttons (3 buttons). A new Maintenance plan has been added.

6.2.3 Configure the tasks

Step 1. Step 2.

Select the Maintenance Plan on the right-hand panel. Click the Add a maintenance task command in the left-hand panel.

Figure 15

Module 19 - HDS Overview

Page 16/18

Step 3.

Type a tasks name and select the task via the Task drop-down button. According to the task selected a new tab can appear. Click this tab to configure the task.

Figure 16

If your Maintenance Plan is not correct, the Database cannot become full because there is a default emergency purge mechanism. You can check it in the Database properties.

Module 19 - HDS Overview

Page 17/18

7 Summing-up
The HDS is a server component that manages the writing and retrieval of real time data in a Database from PcVue. You can customize the Database using several tables. PcVue provides tools to maintain the Database.

Module 19 - HDS Overview

Page 18/18

Archives

Module 20

Event logs

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4

This feature in PcVue architecture Record an event mechanism Events and Log list in PcVue
4.1 Events 4.2 Log lists

4 5 7
7 9

The Log Viewer


5.1 Insert Log Viewer 5.2 The Log Viewer at Run-time 5.3 The Log Viewer properties

12
14 15 17

Summing-up

19

Module 20 - Event logs

Page 2/19

1 Introduction
1.1 In this module you will learn
What is a Log list, How to record events, How to use the Log Viewer.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_20\Project to Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 20 - Event logs

Page 3/19

2 This feature in PcVue architecture

Figure 1

Module 20 - Event logs

Page 4/19

3 Record an event mechanism


PcVue is able to record three kinds of event: Bit event: When a Bit value or status changes. Alarm event: When an Alarm status changes. User action event: Login/Logout, Acknowledge an alarm, Mask an alarm, Set a value, Execute a program.

PcVue cannot record register and text value changes as events.

Whatever the event the way to record it is the same, as follows.

Figure 2

When the event occurs it is sent to the Log List which is a filter. If the event matches the filter it is sent to the output. That can be an Archive Unit and/or a printer.

Module 20 - Event logs

Page 5/19

You can configure several Log Lists having different outputs. Each event is sent to all Log Lists as follows.

Figure 3

In this example: If the event is a bit change value it is recorded in the Proprietary Archive Unit. If the event is an alarm change status it is recorded in Proprietary Archive Unit (via the All Events filter), in the HDS Archive Unit and printed. If the event is a Login or Logout it is recorded in the Proprietary archive unit (via the All Events filter) and printed.

Module 20 - Event logs

Page 6/19

4 Events and Log list in PcVue


4.1 Events
By default the User action events are sent to the Log lists but the bits/alarms are not. You must configure each bit/alarm in a template separately to enable recording. To configure a bit/alarm:

Step 1. Step 2.

Open the Application Architect and select the template and then the

variable. Change the Log property to Yes. By default both the 0>1 and 1>0 properties are set to Yes. These can be changed if the Advanced properties are displayed.

Figure 4

Dont forget that after making any changes using the Application Architect, the application must be re-generated.

Module 20 - Event logs

Page 7/19

Using the Application Architect configure the following variables so as to generate events. Template AIRCOND Variables ON

Exercise 1.

Module 20 - Event logs

Page 8/19

4.2 Log lists Step 1. Step 2.


Open the Application Explorer and expand the configuration tree to display the Archive units node. Expand the Archive units node and select Log lists under the previously created archive unit.

Figure 5

Step 3.

From the task list select Add a log list.

Module 20 - Event logs

Page 9/19

Step 4.

Type the Log list Name in the General tab

Figure 6

Step 5.
tab.

Configure the Event filter by clicking each Events item in the Filter

Figure 7

Module 20 - Event logs

Page 10/19

Exercise 2. a. Create one Log List (Name = ALL_EVENTS) for recording


all events in the Proprietary archive unit PROP_UNIT1.

b. Open Floor 1 and create some events. c. Switch off PcVue and check the Archive Unit folder.
What is the use of the Archive Unit named (Printers)?

Module 20 - Event logs

Page 11/19

5 The Log Viewer


PcVue lets the operator view the events using a specific tool: the Log Viewer. The following diagram represents the Log Viewer mechanism:

Figure 8

When the mimic opens, the Log Viewer makes a request for the latest 100 records (by default). These records are stored in a buffer. You can shift the contents of the Log Viewer using the scroll bar buttons. If you click on a scroll bar button the behavior changes according to the Log Viewers viewing position. If it is focused on the top or bottom of the buffer it makes a new request otherwise it moves within the buffer.

Module 20 - Event logs

Page 12/19

The main features are: Log Viewers may be embedded in any window. Unlimited number of Log Viewers in each project. Size of Log Viewer configurable from 1 line to the maximum legible at screen resolution. Each Log Viewer is attached to a specific Log Filter. Data may be filtered by Domain and Nature. Optional toolbar and scrollbar. The format of entries in the display list is 100% configurable. May be accessed by SCADA BASIC or VBA to add extra features. The Log Viewer is an ActiveX component and is registered with the operating system on start-up.

The Log Viewer can display a maximum of eight columns.

Module 20 - Event logs

Page 13/19

5.1 Insert Log Viewer Step 1. Step 2.


Open the mimic. Select the command Insert / Log Viewer.

Figure 9

Step 3.

PcVue opens the Log Viewer Properties / Filters tab. Select the List name for the Log list you want to display by default. The filter is copied from the Log list but you can customize it.

Figure 10

Step 4. Step 5.

Select each tab to configure the properties. Click the OK button. Place it and resize it if necessary.

Module 20 - Event logs

Page 14/19

5.2 The Log Viewer at Run-time


The Log Viewers behavior is similar to that of the Alarm Viewer.

Figure 11

[A]: Toolbar. You can customize the Toolbar by right-clicking on it.

The tools are described the online Help in: The macro animations / Log Viewer / Using the Log Viewer at run-time / Using the toolbar.
[B]: Headers. [C]: Events. [D]: Filter button. For the operator to filter the list at Run time.

You can insert one or more Log Viewers in a mimic, each displaying a different Log List.

Module 20 - Event logs

Page 15/19

Exercise 3. a. Create a new mimic called Logs using the template


MyTemplate.

b. Insert a Log Viewer macro-animation. c. Switch to Run-time mode and check it.

Module 20 - Event logs

Page 16/19

5.3 The Log Viewer properties


The Log Viewers properties are divided into four tabs. We will focus on the main properties. Display Tab: The behavior is exactly the same as that of the Alarm Viewer macro animation.

The display formats are available in the online Help in: The macro animations / Log Viewer / Creating and configuring a Log Viewer / Configuring the Line Format.
Aspect Tab: You can configure the common aspect properties in this tab. Execution Tab

Figure 12

[A]: Display buffer. Select the number of lines you want to manage. [B]: Printing. If the option is selected the operator can print the selected records by clicking the Print icon in the Tool bar. [C]: Allowances. Select which actions are available to the operator at Run time.

In practice, the maximum number of lines in the display buffer is limited by the Log Viewers internal buffer which is 32 K characters.

Module 20 - Event logs

Page 17/19

Filter Tab

Figure 13

[A]: List Name. Select the Log list to display. [B]: Filters. Customize the filter you want to display by default.

Exercise 4. a. Modify some Log Viewer properties and check the results in
run-time.

b. Add two columns displaying the floor (Domain) and the


device type (Nature).

Exercise 5. Challenge

Try to change the colors of the some events in the Log Viewer.

Module 20 - Event logs

Page 18/19

6 Summing-up
PcVue can record the same event in different archive units. A Log List is a filter with two possible outputs: Archive Unit and Printer. The Log Viewer macro animation is the component for displaying Events.

Module 20 - Event logs

Page 19/19

Archives

Module 21 Trends

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4 5

This feature in PcVue architecture Trend mechanism Configure a trend in PcVue The Trend Viewer
5.1 Overview 5.2 Insert Trend Viewer in a mimic 5.3 Trend Viewer at Run-time 5.4 Trend Viewers main properties

4 5 6 9
9 12 13 15

Summing-up

18

Module 21 - Trends

Page 2/18

1 Introduction
1.1 In this module you will learn
About the trending mechanism, How to configure a trend, How to use the Trend Viewer.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_21\Project to C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 21 - Trends

Page 3/18

2 This feature in PcVue architecture

Figure 1

Module 21 - Trends

Page 4/18

3 Trend mechanism
PcVue can record Bit and Register variables. Whatever the type, the mechanism is the same. By default every value change is recorded in the Archive Unit. But if the data flow rate is high the Archive Unit can fill quickly. Thats why you can configure a filtering period.

Figure 2

The filtering period mechanism is as follows.

Figure 3

Here the filtering period = 10s. At hh:mm: 10 a value of 3 is recorded with a timestamp of hh:mm:10. At hh:mm: 20 nothing is recorded as the most recent value is 3 (same as last value recorded). At hh:mm: 30 a value of 6 is recorded with a timestamp of hh:mm:30. At hh:mm: 40 nothing is recorded.

If the Filtering period is 0 (by default) then every point is recorded. The Filtering period is NOT a sampling period. You cannot record a point periodically.
Module 21 - Trends Page 5/18

4 Configure a trend in PcVue


To configure a variable to record as a trend:

Step 1. Step 2.

Open the Application Architect and select the template and then the

variable. Right click the variable and, from the context menu, select Add trend and then the type of archive unit (Proprietary in the example).

Figure 4

Enter a name for the new trend. Unless you are configuring multiple trends on the same variable you can accept the default name.

Step 3.

Figure

Module 21 - Trends

Page 6/18

Step 4.

Using the properties grid select the archive unit in which the trend will be recorded.

Figure 5

Step 5.

Using the properties grid configure the Filtering Period and other trend properties.

Module 21 - Trends

Page 7/18

Exercise 1.

Create some trends.

a. Configure the TEMP variable of the AIRCOND template to trend record in the Proprietary archive unit PROP_UNIT1. b. Create the Parameter _pTrendPeriod, with a default value of 0, for the Filtering Period. c. Using the Parameter, change the Filter Period for the instance Building.Floor_1.Room_103 to 5 seconds.

d. Create a new mimic Trends using the template MyTemplate. Add three graphical objects animated to change the value of these variables (SETPOINT variables). BUILDING.FLOOR_01.ROOM_101.AC.SETPOINT BUILDING.FLOOR_01.ROOM_102.AC.SETPOINT BUILDING.FLOOR_01.ROOM_103.AC.SETPOINT

e. Switch off PcVue and check the Archive Unit folder.

Module 21 - Trends

Page 8/18

5 The Trend Viewer


5.1 Overview
The Trend Viewer is a special animation which produces a display of the value of up to 8 variables (Register or Bit) plotted against time.

The Trend Viewer can ONLY display a function of time, y=f(t) and NOT y=f(x).
The Trend Viewer mechanism is as follows.

Figure 6

When the mimic opens, the buffer is empty and starts to fill with the points coming from the right-hand side. When a point reaches the left-hand side it is sent out of the buffer.

Module 21 - Trends

Page 9/18

The Trend Viewer operates in three distinct modes: Run mode: to display the trend in real time. The Trend Viewer is on the right-hand position and displays the points that are coming in.

Figure 7

Pause mode: to view the recent points. The Trend Viewer can move its focus within the buffer to display points more recent than Now-Time capacity.

Figure 8

Module 21 - Trends

Page 10/18

Historic mode: to display recorded points. The Trend Viewer adjusts the period to the Time capacity value.

Figure 9

The main features are: Up to 8 Register and/or Bit variables may be displayed on each Trend. Historic and real-time modes. Y axis (range) independently configurable for each trace. X axis (time) configurable from 1 second to 32,767 days. Toolbar to change run-time configuration. Zoom on both X and Y axes. Scroll bar on both X and Y axes. Configurable Legend area displaying detail of each trace. Highly configurable appearance. Trend Viewers may be embedded in any mimic Unlimited number of Trend Viewers in each project. May be accessed by SCADA BASIC or VBA to add extra features. The Trend Viewer is an ActiveX component and is registered with the operating system on start-up.

Module 21 - Trends

Page 11/18

5.2 Insert Trend Viewer in a mimic Step 1. Step 2.


Open the mimic. Click the Insert / Trend command.

Figure 10

Step 3.

PcVue inserts the component and opens the Curves tab. Select the variable(s) to display in the Trend Viewer and type a short description of this trend. Click the OK button.

Figure 11

Step 4.

Position the Trend Viewer in the mimic and resize it according your requirements.

Module 21 - Trends

Page 12/18

5.3 Trend Viewer at Run-time

Figure 12

[A]: Tool bar. You can customize the Toolbar by right clicking on it. The main tools are: Switch in Run mode. Switch in Pause mode. Switch to Historic mode. Open the Calendar to select the Start/End date.

A full description of all tools is available in the online Help in: Developing the HMI / The viewers / Trend Viewer / Using the Trend Viewer at run-time / Using the toolbar.
[B]: Time axis. Display timestamp information. It can be customized in the Trend Viewer properties / Display tab. [C]: Scrollbar. Used to move the Trend Viewer display within the buffer.

Module 21 - Trends

Page 13/18

[D]: Toolbox Button. Click to open the Trace Toolbox for information about each of the curves.

Figure 13

[E]: Trend zone.

Exercise 2.

Use the Trend Viewer animation.

a. Insert a Trend Viewer in the Trends mimic. Configure three traces to display the following values BUILDING.FLOOR_01.ROOM_101.AC.TEMP BUILDING.FLOOR_01.ROOM_102.AC.TEMP BUILDING.FLOOR_01.ROOM_103.AC.TEMP Switch to Run time, change the Temperature values b. Change the value of the SETPOINT variable for ROOM_101.AC and ROOM_103.AC for a period of about 30 seconds. Make a Historic request to display the values recorded during the latest minute.

Why is the temperature trend for ROOM_101.AC different to ROOM_103.AC?

Module 21 - Trends

Page 14/18

5.4 Trend Viewers main properties


The Trend Viewer configuration is divided into many tabs. We will focus on the main properties. Display Tab

Figure 14

[A]: Period. [B]: Time capacity. [C]: Start mode. Set the default mode when mimic opens. [D]: Display the Legend. Aspect Tab: You can configure the common aspect properties in this tab. Execution Tab: Configure what the operator can do at run-time.

Module 21 - Trends

Page 15/18

Curves Tab

Figure 15

[A]: Curve slot. Enable a curve. [B]: Curve Description. [C]: Curve Variable.

You can use the branch mechanism in the Trend Viewer.


[D]: Curve Line color. [E]: Curve Type. There are three types available: Each point representing a change in value is connected to the previous one with a vertical and horizontal line. Each point representing a change in value is connected to the previous one with a single line. Each point representing a change in value is plotted with no interconnecting lines.

[F]: Min/Max. If both Min and Max are set to the default of zero, the range is taken from the variables properties at Run-time. [G]: Scale. Show/Hide the scale. Invalid curves Tab: Change the curves aspect when the variable is NS.

Module 21 - Trends

Page 16/18

Legend Tab The Legend is used to display configurable information about each curve. Unlike the Trace Toolbox in previous versions, which it supersedes, it is printed when you make a hard copy (print).

Figure 16

[A]: Columns: properties displayed in the Legend. [B]: All columns: properties available to display in the Legend.

The User data fields are used to display Text attributes in the Legend. Enter #A3 for the Text attribute 3.
Other Tabs Grid Tab: Change the Grid properties. Print Tab: Change the Print properties. Format Tab: Change the Timestamps display format. Touch screen Tab: Configure large tool icons for when a touch screen is used. Advanced: Advanced parameters.

Exercise 3.

Modify some Trend Viewer properties and check the results in Run-time mode.

Module 21 - Trends

Page 17/18

6 Summing-up
PcVue can trend-record all value changes of bit and register variables, or filter by time. PcVue doesnt support sampling (periodic recording). The Trend Viewer can display up to eight curves. The Trend Viewer has many properties that you can customize.

Module 21 - Trends

Page 18/18

Services

Module 22

User rights

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3 4

This feature in PcVue architecture The User Rights concept Configure a user account in PcVue
4.1 Create a Profile 4.2 Create a User

4 5 8
8 9

User rights in run-time


5.1 Log in 5.2 Log out 5.3 User logged on 5.4 Access rights error

12
12 13 14 14

Summing-up

16

Module 22 - User rights

Page 2/16

1 Introduction
1.1 In this module you will learn
About the User rights mechanism, How to create a classical security configuration.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_22\Project to C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 22 - User rights

Page 3/16

2 This feature in PcVue architecture

Figure 1

Module 22 - User rights

Page 4/16

3 The User Rights concept


Before using PcVue, a User must log on using a user account. The configuration of the user account determines what project features are available at Run time (for example the windows a User can open) and access to the configuration tools and operating system. Each user account consists of a User and a Profile: A Profile has several sets of access rights. A User belongs to one Profile. When a new project is created PcVue creates the Profile DEFPROFILE having all rights and DEFUSER belonging to DEFPROFILE. DEFUSER has no password. The following diagram depicts the Login/Logout mechanism.

Figure 2

There is always one User logged in to PcVue. When a User logs out PcVue automatically logs DEFUSER in. Thats why before you implement the project on site, you must disable all rights of the DEFPROFILE except the Window access rights.

Module 22 - User rights

Page 5/16

The various access rights are: Administration Access to the configuration menus and operating system, password configuration, user configuration rights. Programs Selection of SCADA BASIC programs to run when a User logs in and/or out. Mimics Selection of the mimic that opens when a User logs in. Command - Selection of command level rights. The command level is found in a Variables advanced properties.

Figure 3

Alarm acknowledgement and masking Selection of acknowledgment and masking rights by alarm level. The alarm levels are found in the Variables advanced properties.

Figure 4

Module 22 - User rights

Page 6/16

Window - Selection of window (mimic) level rights. The window level is configured in the dialog tab Mimic properties / Access rights.

Figure 5

Layer - Selection of display layer rights. Recipe - Selection of recipe rights. WebVue - Selection of options for when a User logs in from a Web browser including initial mimic, language, alarm filter etc. Advanced - Automatic logoff and password lifespan.

There is no hierarchy in the levels (command, alarms or window). You can use them as you wish and create your own hierarchy. For example: Alarm level 2 = Critical alarm. Alarm level 1 = Important alarm. Alarm level 0 = Normal alarm.

Module 22 - User rights

Page 7/16

4 Configure a user account in PcVue


4.1 Create a Profile Step 1. Step 2.
Open the Application Explorer and expand the configuration tree to select the User Accounts node. Expand the User Accounts node to select the Profiles node. Click Add a profile in the task list.

Figure 6

Step 3.

Enter the Profiles Name.

Figure 7

Step 4.

Configure each tab as required by the project specifications. Click the OK button.

Module 22 - User rights

Page 8/16

4.2 Create a User Step 1. Step 2.


Open the Application Explorer and expand the configuration tree to select the User Accounts node. Expand the User Accounts node to select the Users node. Click Add a user in the task list.

Figure 8

Step 3.

Enter the Name and the Password for the user. Click the OK button.

Figure 9

Module 22 - User rights

Page 9/16

We recommend that you always use a strong password. The Supervisor uses the following criteria to determine whether a strong password has been configured. It must contain eight or more characters. (The maximum is 16.) It cannot contain the User name. It must contain three out of the four following types of characters: Lower case alphabetic. Upper case alphabetic. Numeric. Non alphanumeric characters (although you cannot use any Ctrl characters). Step 4.
In the central panel, select the newly created User and select the command Add a user profile in the left-hand panel.

Figure 10

Step 5.
button.

Select the Profile Name to be linked with this User. Click the OK

Figure 11

Module 22 - User rights

Page 10/16

Exercise 1.
a. Create a classical security configuration. b. Create the Profiles and Users according the following table. ADMINISTRATORS / Access rights Administration Administrator (12345) All MAINTAINERS / Maintenance (12345) All except: - Create profiles - Delete profiles - Change profile rights Mimics Command Alarm Acknowledgement Alarm Masking Window Layer Recipe All All All All All All All All All OPERATORS / Operator (12345) Nothing but: - Modify their password

All All All All

All All All Depends on site policy

All All All Depends on site policy

Module 22 - User rights

Page 11/16

5 User rights in run-time


5.1 Log in
The Logon / Logoff dialog allows logging in.

Figure 12

There are two ways to display it: Press the F2 function key, Use the animation Security / Login.

Figure 13

Module 22 - User rights

Page 12/16

5.2 Log out


The Logon / Logoff dialog allows logging off.

Figure 14

There are two ways to display it: Press F2 function key, Use the animation Security / Logout.

Figure 15

Exercise 2.

Add the buttons Login and Logout in the left-hand panel of the template MyTemplate.

Module 22 - User rights

Page 13/16

5.3 User logged on


PcVue manages a System Text variable called USER. This variable displays the current user. For DEFUSER it doesnt display anything.

Exercise 3.

Add a text field in the left-hand panel of the template MyTemplate to display the current user.

5.4 Access rights error


When the operator tries to perform a forbidden action, an error message appears.

Exercise 4.
a. Change the mimic level of the mimic Welcome to level 1. b. Modify the Window rights for the OPERATORS Profile to exclude Level1. c. Log in as Operator and try to open the Welcome using a Link/Open animation.

Module 22 - User rights

Page 14/16

Exercise 5.(Challenge!)

Try to match the Study cases specifications in terms of navigation.

Reminder:

Module 22 - User rights

Page 15/16

6 Summing-up
A Profile has access rights. A User belongs to a Profile. The function key F2 is used to login/logout. The function key F3 is used to open the User Rights configuration.

Module 22 - User rights

Page 16/16

Services

Module 23 Expressions

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Expression concepts


3.1 Expression in an animation 3.2 Expression on a Variable 3.3 Expression template

4 5
5 6 9

Summing-up

11

Module 23 - Expressions

Page 2/11

1 Introduction
1.1 In this module you will learn
About the different uses of expressions, How to create an expression.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_23\Project to C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 23 - Expressions

Page 3/11

2 This feature in PcVue architecture

Figure 1

Module 23 - Expressions

Page 4/11

3 Expression concepts
An expression is used to calculate a value using the real-time value of one or more variables and operators. For example: (TEMP1 + TEMP2) / 2

The complete list of operator functions for expressions is available in the online Help in: The Application Explorer / Variables / Expressions / Expression syntax.
An expression is automatically evaluated each time any of the variables within it changes.

The result of an expression is NS if any variable within the expression is NS.

Expressions may be defined and used in three ways: By entering it directly in an animation By attaching an expression to a variable. By entering an expression template.

3.1 Expression in an animation


You can directly enter an expression in the field normally used for the variable in any animation. The expression must be preceded by the character =. The following screen-shot represents an expression increasing the temperature value by 1.

Figure 2

The animation must match the expression result. In this example you cannot enter this expression in a Color / Bit animation because the result is a register.

Module 23 - Expressions

Page 5/11

Exercise 1.
a. Open the mimic Animations. b. Insert a text and add the animation Text / Display register. c. Configure the expression: =@BUILDING.FLOOR_01.ROOM_101.AC.TEMP + 1 d. Switch to Run-time mode and check it.

3.2 Expression on a Variable


We want often have the result of an expression in a variable, for example if we want to record it in an Archive Unit. To configure an Expression to a Variable:

Step 1. Step 2.

Open the Application Explorer and expand the configuration tree to select the Expressions node. Right click the node and, from the context menu, select Add an expression on a variable..

Figure 3

Module 23 - Expressions

Page 6/11

Step 3.

The Expression on Variables dialog opens. Enter a name for the expression of accept the default.

Figure 4

Step 4.

Select the Result variable and then select the Expression tab to enter the expression.

Figure 5

Step 5.
dialog.

Click the OK button to confirm the configuration and close the

Module 23 - Expressions

Page 7/11

Exercise 2.
a. Create the variable BUILDING.FLOOR_01.TEMP_AVG as an internal register. b. Create an expression to make this variable the average Temperature of Floor 1. c. Open the mimic Floor_01 and display the average value of Temperature. PcVue allows a Branch to be used in an Expression. The branch is applied to every member of the expression including the Result.

Figure 6

Exercise 3.
a. Create the variables BUILDING.FLOOR_02.TEMP_AVG and BUILDING.FLOOR_04.TEMP_AVG as internal registers in control. b. Create two expressions using branch to make these variables the temperature average of Floor 2 and Floor 4. c. Open the mimics for the floors and display the average value.

Module 23 - Expressions

Page 8/11

3.3 Expression template


When you need to create the same expression several times its better to make an Expression template. The principle is the same as that of the symbol. Several expressions are using a template; if you modify the template the expressions are updated. You can use this template in an animation or in the Expression to Variable as for any parameter. To create an expression template:

Step 1. Step 2. Step 3.

Open the Application Explorer and expand the configuration tree to select the Expressions node. Right click the node and, from the context menu, select Add an expression template. Enter a Name for the template.

Figure 7

Module 23 - Expressions

Page 9/11

Step 4.

Enter the Expression. Click the OK button.

Figure 8

Step 5. Step 6.

If you use this in an animation you must enter =<ExpressionTemplate>. If you the template in another expression you must enter only the Expression Templates name (there is no need for the = character).

Module 23 - Expressions

Page 10/11

4 Summing-up
The result of an Expression can be used directly in an animation or it can provide a variables value. PcVue lets you use Expression templates to manage repetitive expressions.

Module 23 - Expressions

Page 11/11

SCRIPTING

Module 24 Scada Basic - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

4
4 4 4

2 3 4

This feature in PcVue architecture SCADA Basic vs. VBA SCADA Basic Basics
4.1 Programs 4.1.1 SCADA basic workspace 4.1.2 Create a program 4.1.3 Manage programs 4.1.4 To load the Global program automatically 4.2 Functions 4.2.1 Overview 4.2.2 Syntax 4.2.3 The Main Function 4.2.4 Run a Function 4.2.5 Passing arguments 4.2.6 Return a result 4.2.7 Function visibility 4.2.8 Trigger a Function by an animation 4.3 Variables 4.3.1 Working variables 4.3.2 Database Variable 4.4 Special Instructions 4.4.1 If Instruction 4.4.2 Loops 4.5 Classic mistakes and errors 4.5.1 Comparing two variables

5 6 8
8 8 10 11 13 14 14 14 14 17 19 20 21 23 24 24 30 32 32 34 37 37 Page 2/47

Module 24 - Scada Basic - Basics

4.5.2 Infinite loop 4.5.3 Set a database variable and test it 4.6 Built-in Instructions 4.6.1 Find the right Instruction 4.6.2 Using an instruction

39 40 43 43 43

Summing-up

47

Module 24 - Scada Basic - Basics

Page 3/47

1 Introduction
1.1 In this module you will learn
About the SCADA Basic program structure, About the SCADA Basic syntax, How to create a simple script, How to run a script, About the classical mistakes, How to trigger a script by clicking a button, How to use the Help.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_24\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 24 - Scada Basic - Basics

Page 4/47

2 This feature in PcVue architecture

Figure 1

Module 24 - Scada Basic - Basics

Page 5/47

3 SCADA Basic vs. VBA


PcVue supports two different scripting languages: SCADA Basic and VBA. These languages are not competitors; instead they are complementary. It can be difficult for a PcVue project developer to select which language to use, because of not knowing the capabilities of each language. The following diagram can help you to understand the scope of each language. The diagonal hatching indicates the language with which each feature can be used: SCADA Basic , VBA or both

Figure 2

Module 24 - Scada Basic - Basics

Page 6/47

You can see that the SCADA Basic language is more comprehensive than VBA in terms of the type of PcVue objects you can access. When you want to access a PcVue object supported by both VBA and SCADA Basic you can select either. It's best to select the one that you are more comfortable with.

To manipulate HMI objects and for Windows file access we advise the use of VBA which has more capability in this area.

Module 24 - Scada Basic - Basics

Page 7/47

4 SCADA Basic Basics


4.1 Programs
Scripts are organized as a set of programs. If you are familiar with the Visual Basic language you can compare a program to a module. One program is one text file containing a script. You can use PcVue's built-in editor or any text editor to edit this file.

There is no specific file extension for SCADA Basic programs but we suggest that you use one. We like to use the extensions .scb or .svb.

Before it can run, a program must be loaded


There is a special program that is called the Global program. This unique program contains all PcVue's built-in SCADA Basic Instructions. Therefore if you want to use one or more of the built-in instructions (and it's difficult to develop a program without any!) you must create and load a Global program. 4.1.1 SCADA basic workspace The SCADA Basic Workspace is used to manage programs. You can create, modify, delete, load, unload and run any program from the Workspace. To open the SCADA Basic Workspace you select the command Configure / Actions / Programs or use the function key F9.

Figure 3

Module 24 - Scada Basic - Basics

Page 8/47

Figure 4

[A]: Show or Clear the results displayed in the Output area. [B]: Output area. It displays any error messages and the output of the built-in Print function which can be used as a debugging aid. [C]: Manage the Global program. [D]: Manage any Programs. [E]: List of loaded programs. [F]: Action buttons.

Module 24 - Scada Basic - Basics

Page 9/47

4.1.2 Create a program To create a program:

Step 1. Step 2.

Open the SCADA Basic Workspace. Enter the program name in the program field (Global or normal).

Figure 5

Step 3. Step 4.

Click the Ellipsis () button to edit the program. PcVue opens the SCADA Basic Editor. Type in the script. Select the command File / Exit or the Exit button. Click the Yes button to save the script.

Figure 6

Module 24 - Scada Basic - Basics

Page 10/47

4.1.3 Manage programs To delete a program:

Step 1. Step 2. Step 3. Step 4.

Open the SCADA Basic Workspace. Select the button Select the program. Click the Delete button. to open the program selector.

To load a program:

Step 1. Step 2. Step 3. Step 4.


list.

Open the SCADA Basic Workspace. Select the button to open the program selector.

Select the program. Click the OK button. Click the Load button. PcVue adds a new line in the loaded program

Figure 7

Step 5.

Click the Show results button to display any syntax error. (By default the Output area is not updated automatically.)

Module 24 - Scada Basic - Basics

Page 11/47

Exercise 1. a. Create the GLOBAL.SCB program with the following string


(comment): This is my first program.

b. Load it. c. Check whether there is a syntax error.


Add a deliberate error (for example delete the comment character) then load the program. What happened?

Module 24 - Scada Basic - Basics

Page 12/47

4.1.4 To load the Global program automatically To load the Global program automatically during the PcVue start-up:

Step 1. Step 2. Step 3.

Select the command Configure / Project / General operation then open the Start-up tab. Select the option Run user programs. Enter (or select) the Global program in the Declarations field. Click the OK button.

Exercise 2. a. Configure b. Restart


loaded.

PcVue automatically.

to

load

the

GLOBAL.SCB

program

PcVue and check whether the Global program is

Module 24 - Scada Basic - Basics

Page 13/47

4.2 Functions
4.2.1 Overview A program is a collection of functions. Each function contains a script to run. In various programming languages there are two distinct types of script block: one type returns a result (function), the other not (procedure). In SCADA Basic there is no distinction and there are only functions. A SCADA Basic function may, or may not, return a result. There is no limit to the number of functions in a program. 4.2.2 Syntax The syntax for declaring a function is: Sub <Function name> ([argument1 [, argument2,]]) ---Script-----

End Sub

Some rules:
The SCADA Basic language is not case sensitive. Function names can contain alphanumeric characters and the underscore. The space character is not permitted. A Function name must be unique within the program. The maximum number of arguments is 12. It is not necessary to declare the type of an argument. (Arguments are covered in another section.) The syntax requires each instruction to be terminated with the character ; except for the Sub, End Sub, If, For, Next, While and Wend Instructions.

4.2.3 The Main Function There is a special function called the Main function. It is run when no other function is specified. Main is the only function you can run directly from the SCADA Basic Workspace. To run the Main function of a program from the SCADA Basic Workspace:

Step 1.

Write the Main Function

Module 24 - Scada Basic - Basics

Page 14/47

Figure 8

Step 2. Step 3.

Load the program. Select the program in the Programs Loaded list.

Module 24 - Scada Basic - Basics

Page 15/47

Step 4.

Click the Execute button.

Figure 9

Step 5.

Click the Show results button to check whether any error occurred.

Exercise 3. a. Create the program GENERAL.SCB. b. Enter the program code described in Figure 8. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 16/47

4.2.4 Run a Function A function can be executed from various triggers. Two examples are clicking a special animation in the HMI and a database changing value (known as event). We will cover all the possible triggers in the Advanced module. The only way to run a Function using the SCADA Basic Workspace is to run the Main Function which can then be used to call the Function you want to run. Actually you can call a Function from any another Function. The calling Function waits for called Function to end before it continues.

Figure 10

In this script the following result is expected:

Figure 11

Module 24 - Scada Basic - Basics

Page 17/47

It is not necessary to declare the Functions in the order in which they are called. For example Function2 can be before Function1.

Exercise 4. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 10. c. Run it and check the result.

You can use a Snippet in the SCADA Basic Editor to create a new Function. Select the command Edit / Advanced / Insert code Snippet (or CTRL + I, CTRL + X keys) and select the line SUB. END SUB.

Module 24 - Scada Basic - Basics

Page 18/47

4.2.5 Passing arguments As seen in chapter 4.2.2 a Function can receive a set of arguments as input. Each argument is treated as a variable. (We will cover variables later.)

Figure 12

In this script the following result is expected: 15 As you can see, the type of the argument is not specified - the SCADA Basic interpreter determines the type by how it is used.

Exercise 5. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 12. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 19/47

4.2.6 Return a result As previously mentioned a Function can return a result. The caller can store the result in a variable or use it as an argument for another function. To return a result you must use the built-in Instruction: Return (Value).

Figure 13

Here Function1 returns the value 10. This value is passed as an argument to the built-in instruction Print.

Exercise 6. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 13. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 20/47

4.2.7 Function visibility We have seen that we can call a function from another function, but that was in the same program. What about calling a Function of another program? Actually it is not really possible to do it directly. But if you have a Function you want to share with several Programs then you can put it in the Global program.

Figure 14

It is a good idea to prefix the name of any Functions in the Global Program with GBL_. Using this method avoids potential conflicts if you have two Functions with the same name. In our example, you can imagine what would happen when running Main() of GENERAL.SCB if you also had Function1 declared in the GLOBAL.SCB. Besides, anyone looking at the Program in the future can see at a glance the origin of the Function.

Module 24 - Scada Basic - Basics

Page 21/47

Exercise 7. a. Edit the programs GLOBAL.SCB and GENERAL.SCB. b. Create the program PROG2.SCB. c. Reproduce what is described in Figure 14. d. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 22/47

4.2.8 Trigger a Function by an animation You can trigger a Function when the user clicks on a graphical object. To do it you must use the Run Program animation.

Step 1. Step 2. Step 3.

Select the graphical object. Select the Animate / Run / Program command. Enter the Program and the Function to run. Click the OK button.

Exercise 8. a. Open the Mimic Animations. b. Add a button. c. Animate it to run Function1 in GENERAL.SCB Program. d. Switch to Run-time and try it.

Module 24 - Scada Basic - Basics

Page 23/47

4.3 Variables
As in any programming language, SCADA Basic needs to manipulate variables. You can consider a variable as a memory space allocated for a certain time. There are two types of variables: Working variables, Database variables. 4.3.1 Working variables 4.3.1.1 Working variables types

Working variables are for internal use within a program. They do not form part of the Variables Database. A variable has a type which is defined when it is created. The following table lists the various working variable types. Type Integer Long Single Double Str Const Description 2 Bytes integer 4 Bytes integer 4 Bytes real 8 Bytes real Character string Numeric constant Range -32768 to +32768 -2147483648 to +2147483648 -3.37E+38 to +3.37E+38 -1.67D+308 to +1.67D+308 up to 255 characters -1.67D+308 +1.67D+308

Module 24 - Scada Basic - Basics

Page 24/47

4.3.1.2

Declare a working variable

You must declare a variable before writing the code (actually just after the Sub declaration). To declare a working variable you must use the following syntax: Dim <Variable name> as <Variable type>; The Constant type is an exception and you must use the following syntax: Const <Constant name> = <Value>; After it is created the value of a variable is 0 or, if it is a string, null (empty string).

Figure 15

In this script the following result is expected: 0 10

Exercise 9. a. Edit the program GENERAL.SCB. b. Enter the program code described in the Figure 15. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 25/47

4.3.1.3

Using working variables

You can use a working variable in several ways: Assign a value, Set another variable, Pass an argument, Return a result.

Figure 16

In this script the following result is expected: 110

Module 24 - Scada Basic - Basics

Page 26/47

Exercise 10. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 16. c. Run it and check the result.
Add a deliberate error in Function1 (For example, declare iValue as type STR). Load and run the script. What happened? Why?

Module 24 - Scada Basic - Basics

Page 27/47

4.3.1.4

Working variable's visibility

The variable's visibility to the program environment is determined by where it is declared. A working variable can be: Local: Declared in a Function and available for this Function only. Global: Declared at the beginning of the Program. This variable is available for all Functions of the Program. Public: Declared at the beginning of the Global program. This variable is available for all Functions of all Programs.

Figure 17

Module 24 - Scada Basic - Basics

Page 28/47

If we run GLOBAL.SCB then PROG2.SCB the following result is expected:

Figure 18

It is a good idea to prefix the Global working variables by G_ and the Public working variables by GBL_. This avoids potential conflicts if you have two Variables with the same name. Also any reader can see at a glance the origin of the Variable.

Exercise 11. a. Edit the programs GLOBAL.SCB, GENERAL.SCB and


PROG2.SCB.

b. Reproduce what is described in Figure 17. c. Run it and check the result.

When a program is loaded its Global Variables are reset.

Module 24 - Scada Basic - Basics

Page 29/47

4.3.2 Database Variable You can manipulate Database Variables in the same way as working variables but there are some rules to apply. Database variables may be referenced directly using their full name. If a variable is to be changed from within a program then it must have the Control option set. All database variables are available to all programs. They are Public. When referring to database variables within a program, you must ensure that your program manages the variable type correctly as described below: Bit: Integer, Register: Single (by default, though it can be changed to Double in the Advanced options), Text: String (Str).

Figure 19

You can insert a Database Variable using the command Edit / Advanced / Variable or CTRL + I, CTRL + V keys. Then double-click on the variable you want to insert.
Module 24 - Scada Basic - Basics Page 30/47

Exercise 12. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 19. c. Run it and check the result in the mimic Floor1.

Module 24 - Scada Basic - Basics

Page 31/47

4.4 Special Instructions


4.4.1 If Instruction This causes conditional execution of instructions according to the result of a logical expression. There are two possible syntaxes: If (Condition) Then [instruction block 1] End If OR Else [instruction block 2] End If If (Condition) Then [instruction block 1]

Figure 20

In this script the following result is expected: iValue1 less or equal than iValue2

Module 24 - Scada Basic - Basics

Page 32/47

Exercise 13. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 20. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 33/47

4.4.2 Loops 4.4.2.1 For Instruction

Repeat a block of instructions a specified number of times. FOR (expression1; expression2; [expression3]) [Block of instructions] NEXT Expression1 is evaluated when the Execution of the loop starts and it provides the initial state of the loop. Expression2 is the loop test. The loop will repeat while the condition is true. Expression3 provides the update or increment for the loop. 4.4.2.2 While Instruction

Execute a series of instructions in a loop while a given condition remains true. WHILE (expression) [Block of instructions] WEND If the expression is true, all instructions included between WHILE and WEND are executed, then the expression is evaluated again. If the expression is still true, the process is repeated. If the expression is false, execution continues at the instruction following WEND.

Module 24 - Scada Basic - Basics

Page 34/47

Figure 21

In this script the following result is expected: The variable i goes from 1 to 5 then the variable i goes from 0 to 5. Note that they are different i's as they are declared at the top of each function (local variables).

Module 24 - Scada Basic - Basics

Page 35/47

Exercise 15. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 21. c. Run it and check the result.

Module 24 - Scada Basic - Basics

Page 36/47

4.5 Classic mistakes and errors


As in any programming language, there are traps and tricks in SCADA Basic. Here we try to mention the most common mistakes. 4.5.1 Comparing two variables When you are using the If or While Instructions you often encounter the situation where you have to compare two variables.

Figure 22

If you consider this code dont you expect the result Not equal? Actually that is not the case; the SCADA Basic script will print Equal!! Using the instruction iValue1 = iValue2 will set iValue1 with iValue2 value instead of comparing. To compare them you must use the operator "=="; i.e. iValue1 == iValue2.

To compare two strings you must use the built-in Instruction CMPSTRING.

Module 24 - Scada Basic - Basics

Page 37/47

Exercise 15. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 22. c. Run it and check the unexpected result. d. Fix the problem.

Module 24 - Scada Basic - Basics

Page 38/47

4.5.2 Infinite loop An infinite loop is quite usual and in certain circumstances can generate a dramatic situation.

Figure 23

Consider this perfect infinite loop. If we run it the HMI will be frozen!! If you have a look to the Figure 2 you can see that the SCADA Basic feature is in the HMI process. Therefore a very long script or an infinite loop will freeze the HMI. Fortunately PcVue monitors SCADA Basic and stops a script if it runs for more than 30 seconds.

Exercise 16. a. Edit the program GENERAL.SCB. b. Enter the program described in Figure 23. c. Run it and try to close the SCADA Basic Workspace. d. Wait for 30 seconds. e. Show the result.

Module 24 - Scada Basic - Basics

Page 39/47

4.5.3 Set a database variable and test it Sometimes appearances can be deceptive!

Figure 24

If you consider this code, dont you expect the result OK? Actually it is not so; the SCADA Basic will print NOT OK!! As already mentioned, SCADA Basic is part of the HMI process. Therefore to set a Database Variable cannot be a synchronous action. The SCADA Basic processor sends a request to the real-time Database to set the value. Then the complete process setoff setting a value is done and it can be very long. The following diagram represents the complete process of a control when the variable is set from a PcVue Client station. This variable is managed by an OPC server communicating with a PLC.

Module 24 - Scada Basic - Basics

Page 40/47

Figure 25

You can understand why the SCADA Basic interpreter doesnt wait but continues to execute the subsequent instructions.

Module 24 - Scada Basic - Basics

Page 41/47

Exercise 17. a. Edit the program GENERAL.SCB. b. Enter the program code described in Figure 24. c. Run it and check.

Module 24 - Scada Basic - Basics

Page 42/47

4.6 Built-in Instructions


PcVue provides over 150 built-in instructions (usually referred to as Instructions). Because they are loaded with the Global program they are available for all Programs. In term of syntax using a built-in Instruction is no different to using a function you have written. The purpose of this training course is not to learn all of the built-in Instructions but to teach you how to find the Function you need and how to use it. Actually we are going to learn how to use the SCADA Basic Help. 4.6.1 Find the right Instruction A common problem when you are programming (whatever the language) is to find the Instruction that does what you want. In the SCADA Basic Help there is one book which can help you: Instructions by category. You can find it here: Programming languages / Scada Basic / Language reference / Instructions by category. If you display the Topic Instructions by category / About the instructions you can see the list of categories. Then clicking in a category you can see the list of all instructions within this category. For example if you want to include in your script the current date and time you can probably find the function in the Time and Date category. If you have a look you can suppose that the DATETIME Instruction will match your needs.

Figure 26

4.6.2 Using an instruction After finding the correct Instruction you need to know how to use it. In the SCADA Basic Help there is a book that can help you: Instruction reference A to Z. You can find it here: Programming languages / Scada Basic / Language reference / Instruction reference A to Z.

Module 24 - Scada Basic - Basics

Page 43/47

When you select an Instruction its help is displayed in the right-hand panel. The structure of this page is always the same: At the start, a See also hyperlink displays other Instructions relevant to this one and an Example hyperlink displays a concrete example when it exists. At the start, there is a brief description of the Function. Then there are the various modes of the Function. The mode is always the first parameter of the Function. The mode is represented by number or a mnemonic.

We recommend that you ALWAYS use the mnemonic. In this way readers can know at a glance which mode you are using. Otherwise they will lose time searching for the meaning of the mode number in the Help.
For each mode, the syntax is specified. Complete explanation for each syntax. Syntax displaying the optional arguments represented by the [ ] characters, The return type, The meaning of each mode using this syntax,

An example of using this Function. The following screen-shot shows the first Help page for the DATETIME Function, with the index of modes and the first syntax.

Module 24 - Scada Basic - Basics

Page 44/47

Figure 27

Module 24 - Scada Basic - Basics

Page 45/47

Exercise 18. a. Edit the program GENERAL.SCB. b. Create the Function OpenWindow for opening the mimic
Floor 1.

c. Load the Program and check there is no error. d. Open the mimic Animations, add a button and animate it to
run the Function OpenWindow of GENERAL.SCB Program.

e. Switch to Run-time mode and try it. Exercise 19.


Challenge! Modify the Function OpenWindow to open the Floor 1 mimic but close the current mimic. You must be able to copy and use the button and program in any mimic in your application without modification.

Module 24 - Scada Basic - Basics

Page 46/47

5 Summing-up
SCADA Basic is a complete and powerful scripting language that provides programmatic access to almost all objects of PcVue. SCADA Basic scripts are a set of Programs. A Program is a set of Functions. A Function can receive arguments as Input and can return a value as Output. The Global program is mandatory as soon you want to use built-in instructions. All Functions and Variables declared in the Global program are Public. With proper use the Help can find and assist you to use any built-in Instruction.

Module 24 - Scada Basic - Basics

Page 47/47

SCRIPTING

Module 24 Scada Basic - Advanced

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture Advanced


3.1 Load several Programs automatically 3.2 Customize Viewers 3.3 Using a Branch in a script 3.3.1 The concept 3.3.2 How to run a Function with a Branch? 3.4 Trigger a Function in different ways? 3.4.1 Events 3.4.2 Keystroke combination 3.4.3 Cyclic 3.4.4 Scheduler 3.4.5 Call a Function from another program

4 5
5 8 11 11 12 12 13 16 17 19 21

Summing-up

23

Module 24 - Scada Basic - Advanced

Page 2/23

1 Introduction
1.1 In this module you will learn
How to load one or more Programs at start-up, How to customize an Alarm, Log or Trend Viewer, How to use the Branch in a script, About the different ways to trigger a Function.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_25\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 24 - Scada Basic - Advanced

Page 3/23

2 This feature in PcVue architecture

Figure 1

Module 24 - Scada Basic - Advanced

Page 4/23

3 Advanced
3.1 Load several Programs automatically
PcVue is able automatically to run the Main Function of one, and only one, Program after start-up. PcVue can also run one program during start-up. It means the external variables (equipment, DDE, OPC and Lonworks) are still NS COM when this program starts. To automatically run a Program after start-up:

Step 1. Step 2.

Select the command Configure / Project / General operation then select the Start-up tab. Enter the Program name in the User Programs section, Programs after initialization.

Figure 2

Step 3.

Click the OK button.

But what do you do if you have more than one Program to load? There is a built-in Instruction named PROGRAM which is able to start another Program. Extract from the Help:

Module 24 - Scada Basic - Advanced

Page 5/23

Figure 3

The trick is to run the Main Function of a Program after start-up. Then we use the PROGRAM Function to load all other Programs needed by your application. The PRELOAD mode matches our requirements. This mode has two possible syntaxes: Syntax 1: PROGRAM(Mode, ProgName, Branch) ; Syntax 3: PROGRAM(Mode, ProgName, Branch, [,Dynamic]) ; Mode: PRELOAD ProgName: Name of the Program to load. Branch: Branch of the Program to load. Dynamic: Optional parameter. If 1 the program is loaded even if a copy of it is already loaded. We will use Syntax 1 because we dont need the dynamic option.

Figure 4

Module 24 - Scada Basic - Advanced

Page 6/23

We call this Program the Loader. Its name is usually LOADER.SCB.

Exercise 1. a. Create the program LOADER.SCB. b. Copy the script from Figure 4. c. Load it and run it. d. Configure PcVue to run LOADER.SCB automatically. e. Restart PcVue and check whether the Programs are loaded.

Module 24 - Scada Basic - Advanced

Page 7/23

3.2 Customize Viewers


The Alarm, Log and Trend Viewers provide a tool bar with many icons allowing the user to take actions. Perhaps the toolbar's look and feel is not to your taste or does not match your client's specification? For example, you dont want to use the Alarm Viewer toolbar but just two buttons instead: one to acknowledge the selected alarm and one to print it.

Figure 5

To solve this problem, PcVue provides three built-in Instructions for customization of the Viewers. Viewer Alarm Viewer Log Viewer Trend Viewer Built-in Instruction ALARMDISPLAY LOGDISPLAY TREND

In the PcVue version that was current at the time of writing, the Function ALARMDISPLAY has 41 modes!! Extract from Help:

Figure 6

Module 24 - Scada Basic - Advanced

Page 8/23

After a quick look we can see that the modes ACK_SELECTED and PRINT_SELECTED correspond to our requirements. ACK_SELECTED uses Syntax 1: ALARMDISPLAY(Mode, Window, Branch, Identity); Mode: ACK_SELECTED or PRINT_SELECTED, Window: The mimic containing the Alarm Viewer, Branch: The mimic branch, Identity: Identifier of the Alarm Viewer. Each viewer has an identifier because you can have more than one viewer on the same mimic. To find it you must use the Graphic Explorer tool. You can change the Identifier by clicking it.

Figure 7

PRINT_SELECTED also uses Syntax 1: ALARMDISPLAY (Mode, Window, Branch, Identity); or alternatively Syntax 11: ALARMDISPLAY (Mode, Window, Branch, Identity [, PrintFormat]); This syntax is similar to Syntax1 except that it includes the optional parameter PrintFormat to change the way the alarm is printed. In our example we will use Syntax 1.

Module 24 - Scada Basic - Advanced

Page 9/23

Figure 8

Exercise 2. a. Edit GENERAL.SCB program. b. Copy the script from Figure 8. c. Add two buttons in the mimic Alarms. d. Animate them to run the Functions AckAlarm and
PrintAlarm.

e. Check whether it is working.

Module 24 - Scada Basic - Advanced

Page 10/23

3.3 Using a Branch in a script


3.3.1 The concept

As with the mimics and symbols, a SCADA Basic Function can be written so that it is generic and uses the Branch concept. A Function can be run with a Branch which is its context.

Keep in mind the following formulae: CONTEXT BRANCH + .VARIABLE = DATABASE VARIABLE
Consider the following code:

Figure 9

If the Function is run with the context BUILDING.FLOOR_01.AC_01 the Database variable BUILDING.FLOOR_01.AC_01.SETPOINT will be increased by 1. If the Function is run without any context an error will be generated as the variable SETPOINT does not exist.

Module 24 - Scada Basic - Advanced

Page 11/23

3.3.2 How to run a Function with a Branch?

When you run a Function using the animation Run / Program you can specify the Branch to be passed as the context.

Figure 10

Exercise 3. a. Edit GENERAL.SCB program. b. Copy the script from Figure 9. c. Add a button in the mimic Animation. d. Animate it to run the Function IncreaseSetpoint. e. Check whether it is working.
3.4 Trigger a Function in different ways?
There are many ways to trigger a Function By event, By a keystroke combination, Periodically (cyclically), Using a schedule, From another Program.

Module 24 - Scada Basic - Advanced

Page 12/23

3.4.1 Events

To configure an event to run a SCADA Basic program:

Step 1.

Select the command Configure / Actions / Event.

Figure 11

Note: You can do it also in the Application Explorer

Step 2.

Click the command Add event to trigger a program.

Figure 12

Step 3. Step 4.

Select the Trigger tab. Select the variable for triggering the Function.

Module 24 - Scada Basic - Advanced

Page 13/23

Step 5.

In the Trigger tab, configure the transition.

Figure 13

A description of the available transitions is available in the online Help in: Configuration / Cyclic and event actions / Event trigger expressions.

Module 24 - Scada Basic - Advanced

Page 14/23

Step 6.

In the Program tab, select the Program tab. Name the Program, Branch and Function.

Figure 14

Step 7.

Click the OK button.

Use of the built-in Instruction DELAY is strictly forbidden in a function called by an event.

Exercise 4. a. Create the Mimic POP_Message. Add a text. Save and close
it.

b. Create an event for opening the mimic POP_Message when


the variable BUILDING.FLOOR_01.LT_01.ON is set to 0.

c. Check whether it is working.

Module 24 - Scada Basic - Advanced

Page 15/23

3.4.2 Keystroke combination

To configure a keystroke to trigger a Function:

Step 1.

Select the command Configure / Actions / Function Key.

Figure 15

Step 2. Step 3. Step 4. Step 5.

Click the Create button. Select the option Function to execute. Select the trigger. Name the Program, Branch and Function.

Figure 16

Module 24 - Scada Basic - Advanced

Page 16/23

Step 6.

Click the OK button and the Save button.

Exercise 5. a. Create a Key action for triggering the Function b. Check whether it is working.
3.4.3 Cyclic

OpenPopup from the Program GENERAL.SCB.

To configure a cyclic action for triggering a Function:

Step 1.

Select the command Configure / Actions / Cyclic.

Figure 17

Note: You can do it also in the Application Explorer

Module 24 - Scada Basic - Advanced

Page 17/23

Step 2.

On the toolbar, click the Add a cyclic button.

Figure 18

Step 3.

In the Trigger tab, enter the Period to trigger the Function.

Figure 19

Step 4.

In the Program tab, name the Program, Branch and Function.

Figure 20

Step 5.

Click the OK button and the Save button. Page 18/23

Module 24 - Scada Basic - Advanced

Use of the built-in Instruction DELAY is strictly forbidden in a function called by a cyclic action.

Exercise 6. a. Create a Cyclic action for triggering the Function b. Check whether it is working.
3.4.4 Scheduler

OpenPopup from the Program GENERAL.SCB.

To configure a scheduled action for triggering a Function:

Step 1.

Open the command Configure / Actions / Scheduler.

Figure 21

Step 2. Step 3. Step 4. Step 5.

Click the Create button. Select the Function action type. Name the Program, Branch and Function.

In the Agenda box, select how often and when you want to trigger the Function.

Module 24 - Scada Basic - Advanced

Page 19/23

Figure 22

Step 6.

Click the OK button and the Save button.

Exercise 7. a. Create a Scheduled action for triggering the Function b. Check whether it is working.

OpenPopup from the Program GENERAL.SCB every day at the same time.

Module 24 - Scada Basic - Advanced

Page 20/23

3.4.5 Call a Function from another program

You can call a Function which is in another Program using the built-in Instruction PROGRAM. But take care; the Function will only be called when the calling Function ends. We say it is an asynchronous call. Extract from the Help:

Figure 23

The mode we must use is FUNCTION which uses Syntax 2. Syntax 2: PROGRAM(Mode, ProgName, Branch, Function[,Farg]) Mode: FUNCTION. ProgName: Program where the Function is located. Branch: Branch with which the Program is loaded. Function: Function to execute. Farg: Optional parameter. List of arguments.

Module 24 - Scada Basic - Advanced

Page 21/23

Figure 24

In this code the expected result is: Continue this function until the end Open the popup

Exercise 8. a. Edit the Programs GENERAL.SCB and PROG2.SCB. b. Copy the code from Figure 24. c. Add a button in the mimic Animations. d. Animate the button to execute the Function
CallAnotherProgram of PROG2.SCB.

e. Check whether it is working.


Module 24 - Scada Basic - Advanced Page 22/23

4 Summing-up
You can easily customize the Viewers by using the Functions ALARMDISPLAY, LOGDISPLAY and TREND. You can make a script generic by using the Branch. There are many ways to trigger a Function.

Module 24 - Scada Basic - Advanced

Page 23/23

SCRIPTING

Module 25 VBA - Basics

Contents

Introduction
1.1 In this module you will learn 1.2 In this module you will NOT learn 1.3 Files used in this module 1.4 Third party software used in this module

4
4 4 4 4

2 3

This feature in PcVue architecture VBA Concepts


3.1 Introduction 3.2 The COM concept 3.3 COM Objects available 3.4 The VBA Workspace 3.5 VBA Projects 3.6 The Object browser 3.7 Trigger a script using events

5 6
6 6 7 8 9 11 12

The PcVue Objects


4.1 The PcVue Objects tree 4.2 The ThisProject Object 4.2.1 Properties 4.2.2 Methods 4.2.3 Events 4.3 The ThisMimic Object 4.3.1 Properties 4.3.2 Methods 4.3.3 Events 4.4 The Collection Object 4.4.1 Concept 4.4.2 Manipulate a Collection 4.5 The Mimics Collection Object 4.6 The Window Object

15
15 16 16 16 17 18 18 19 19 21 21 21 23 24 Page 2/32

Module 25 - VBA - Basics

4.6.1 Properties 4.6.2 Methods 4.6.3 Events 4.7 The Graphic Objects 4.7.1 Properties 4.7.2 Methods 4.7.3 Events 4.8 The Variable Object 4.8.1 Properties 4.8.2 Methods 4.8.3 Events

24 24 25 25 25 25 25 28 28 29 29

Summing-up

32

Module 25 - VBA - Basics

Page 3/32

1 Introduction
1.1 In this module you will learn
About the VBA Workspace, How to manipulate a PcVue graphical object.

1.2 In this module you will NOT learn


The time allocated for this module is too short to learn the Visual Basic language. In several examples you will see VB keywords, syntax, statements etc. if you have no Visual Basic skills you will have some difficulties in understanding VBA. In this case we advise you to buy a book after wards to cover the basics of Visual Basic language. The best should be a book covering VBA for Excel. Then you can refer back to this module!

1.3 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_25\Project into C:\Pcvue projects\Usr\.

1.4 Third party software used in this module


None.

Module 25 - VBA - Basics

Page 4/32

2 This feature in PcVue architecture

Figure 1

Module 25 - VBA - Basics

Page 5/32

3 VBA Concepts
3.1 Introduction
Visual Basic for Application (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic and its associated integrated development environment (IDE) which is also built into most Microsoft Office applications. As its name suggests, VBA is closely related to Visual Basic, but can normally only run code within a host application rather than as a standalone application. It has the ability to use ActiveX/COM objects and can be used to control one application from another using OLE Automation. For example, it is used to create a Word or Excel report automatically. VBA is functionally rich and extremely flexible but it does have some limitations. The main one is performance due to the fact that it is not a compiled language. By embedding the VBA IDE into PcVue, we allow the designer to build custom solutions using Microsoft Visual Basic which is a very popular language. VBA is a Microsoft product so you can find a lot of information and resources in Microsofts web site for developers: http://msdn.microsoft.com/enus/isv/bb190538.aspx .

3.2 The COM concept


The Component Object Model (COM) is a standard interface that enables any compliant application to access objects without any knowledge about their content. A COM object exposes its information as follows, in these categories: Properties: Attributes of an object. These attributes can be static (read-only) or dynamic (read and write). For example: Color, size, status. Methods: An Objects abilities. A method is a function that can be performed by the object. A method can be invoked by the application in manipulating the Object. For example Move, Change the size, Logoff. Events: "Output of the Object. An Object can warn the application about a particular event. For example: Application started, user logged, size changed.

Module 25 - VBA - Basics

Page 6/32

3.3 COM Objects available


There these types of Objects available to VBA: PcVue Objects, ThisSystem Object: Windows version, resolution etc. ThisProject Object: Project name, User logged etc. Graphical objects: Shapes, mimics etc. ActiveX: Trend viewer, Grid etc.

Third-party ActiveX that are embedded in a mimic, OLE Applications.

PCVUE
System Object Project Object Graphical Com Objects Active X OLE Automation Application (Word, Excel...)

VBA

Figure 2

VBA itself embeds some COM Objects including Microsoft Forms 2 components.
Each set of Objects is stored in one library. By default the following libraries are available: Frontvue: Library containing all PcVue graphical Objects. Main: Library containing ThisSystem and ThisProject Objects. stdole: Common Objects provided by VBA. VBA: Common Objects provided by VBA.

Module 25 - VBA - Basics

Page 7/32

3.4 The VBA Workspace


To display the VBA Workspace you use the command Display / Visual Basic Editor.

Figure 3

Module 25 - VBA - Basics

Page 8/32

Figure 4

[A]: Project Explorer. It lists all VBA projects. [B]: Properties Window. It displays the properties of the selected Object . [C]: Menu and Toolbars. [D]: Editor Area. It is used to edit the code.

3.5 VBA Projects


In the same way as SCADA Basic is organized in Programs, VBA is organized into Projects. Dont mistake a VBA project for a PcVue project that is different. PcVue implements only three types of project: Main: This VBA project is always available. Mimic project: This VBA project is available only when the mimic is open. Symbol project: This topic will be covered in the Advanced module. The Project Explorer is the tool for displaying the available VBA projects. A VBA project can contain: Module 25 - VBA - Basics Page 9/32

One or more Objects. For example the Main Project contains the Objects "ThisProject and "ThisSystem.

Figure 5

If you select an Object its properties are displayed in the Properties Window.

Figure 6

Modules: This topic will be covered in the Advanced module. UserForm: This topic is not covered. Classes: This topic is not covered.

Exercise 1. a. Close all mimics. b. Display the VBA Workspace. c. Check the Main project. d. Select the ThisProject Object and check its properties. e. Return to the PcVue HMI and open the "Homepage mimic. f. Return to the VBA Workspace and check the VBA projects. g. Change the Property Name of the Mimic "Homepage.

The complete Help for using the VBA Workspace is available here: F1 (from the VBA Workspace) / Microsoft VBA Help / Visual Basic User Interface Help.

Module 25 - VBA - Basics

Page 10/32

3.6 The Object browser


One of the most important tools provided by the VBA Workspace is the Object Browser. This lets you see the complete list of properties, methods and events of all Objects available. To display the Object Browser, press the F2 function key or select the command View / Object Browser.

Figure 7

[A]: Libraries box. [B]: Objects available. [C]: Properties, methods and events for the selected Object. [D]: Help (optional) for the selected property, method or event. During this training course we will often use this tool.

Module 25 - VBA - Basics

Page 11/32

3.7 Trigger a script using events


The only way to trigger a script is to use an event. To use it you must know where you can find it. To map an event:

Step 1. Step 2.

Select an Object in the Project Explorer. Right click and select View code.

Figure 8

Step 3.

The Workspace opens the Code window in the Editor area.

Figure 9

[A]: Object box. Module 25 - VBA - Basics Page 12/32

[B]: Procedures/Events box. [C]: Code window

Step 4.

Select the Object required in the Object box.

Figure 10

Step 5.

Select the Event required in the Procedures/Events box.

Figure 11

Step 6. Step 7.

A new procedure is added in the Code window, corresponding to the event selected. You can now write your script in this procedure.

Figure 12

Exercise 2. a. Add an event and script to display a message after PcVue


start-up.

b. Restart PcVue to check it.

Module 25 - VBA - Basics

Page 13/32

For more information about the Code window, Help is available here: F1 (from the VBA Workspace) / Microsoft VBA Help / Visual Basic User Interface Help / Windows / Code window.

Module 25 - VBA - Basics

Page 14/32

4 The PcVue Objects


PcVue embeds a lot of Objects that are scriptable. Of course we cannot cover all the objects on this training course, but only the main ones. The goal here is to give you a way of find the right information as quickly as possible. The only actions VBA can do are: Read and write an Objects properties, Execute an Object method, Map an event to be triggered when it occurs.

4.1 The PcVue Objects tree


The architecture of the Objects is tree-structured.

The complete PcVue Objects tree is available on the Help here: F1 (from the VBA Workspace) / HMI VBA Language Reference / About the HMI Objects / The HMI Object Tree.
The following diagram represents the Object tree when this book has been written.

Figure 13

You may note that the Objects are organized in a hierarchy. On the Root there is the Application object that represents PcVue. Module 25 - VBA - Basics Page 15/32

The Application contains the object ThisProject which is the PcVue project (of course!). The ThisProject Object contains variables and mimics. The Mimic Object contains Graphics which are the graphical objects inserted on the mimic. A very important point to understand is the difference between a Collection and a single Object. We will see later how to manipulate a Collection. We are going to describe the most usual PcVue Objects. Every Object has a lot of properties, methods and events. This training course covers only the most used or most useful ones. For more details you must read the online Help.

4.2 The ThisProject Object


This Object belongs to the Main Project therefore it is always available.
4.2.1 Properties

Path Description: Returns the complete path of the project. It is used when the application has to manipulate files located in the TP folder. Example:

MsgBox "My project is located here: "& ThisProject.Path


4.2.2 Methods

LogonUser Description: This method allows logging-on directly or by opening the Logon dialog. Syntax: Function LogonUser([ShowDialog As Boolean = True], [UserName As String], [Password As String]) As Boolean Example:

ThisProject.LogonUser False, "Nico, "12345 LogoffUser Description: This method allows logging-off directly or using the Logoff dialog. Syntax: Function LogoffUser([ShowDialog As Boolean = True]) As Boolean Example: Page 16/32

Module 25 - VBA - Basics

ThisProject.Logoff True Quit Description: This method allows quitting of the PcVue project. It is possible to prompt to save the changes and prompt to confirm the exit. Syntax: ThisProject.Quit([SaveChanges as fvSaveAction = fvPromptToSaveChanges], [PromptExit as Boolean = True]) Example:

ThisProject.Quit False, True


4.2.3 Events

StartupComplete Description: Occurs when project loading is complete. Useful if you need to initialize Objects or Variables. Syntax:

fvProject.StartupComplete() UserChanged Description: Occurs when the user currently logged on has changed or if user information database has changed. Syntax:

fvProject.UserChanged BeforeQuit Occurs when the user attempts to quit the project. Useful if you want to save some data before leaving PcVue. Syntax:

fvProject.BeforeQuit()

Exercise 3.

Use the ThisProject Object.

a. Display in a dialog the Path of the PcVue project. b. Display in a dialog the name of the User logged automatically
after a login. Module 25 - VBA - Basics Page 17/32

All Objects located in the Main Project are available from any VBA Project. 4.3 The ThisMimic Object
When a mimic is opened, PcVue automatically adds a new VBA project in the Project Explorer. This VBA project has the same name as the Mimics name (by default) and it contains only one object: ThisMimic.

Figure 14

ThisMimic is an Object having the type Mimic. You can check the complete list of Properties/Methods/Events using the Object Browser.
4.3.1 Properties

Name Description: Used to identify the mimic.

We advise you to change the Name property to that of the Mimic file.
It has the same name as the mimic file. Example:

MsgBox "The name of this mimic is: " & ThisMimic.Name

Module 25 - VBA - Basics

Page 18/32

4.3.2 Methods

Close Description: Closes all windows of the Mimic object. Syntax: ThisMimic.Close([SaveChanges As fvSaveAction]) Example:

ThisMimic.Close True
4.3.3 Events

Open Description: Occurs when the Mimic object is opened. Useful if you want to initialize some Objects or Variables. Syntax: Mimic_Open()

Exercise 4.

Use the ThisMimic Object.

a. Create the Mimic "VbaScript using the template


"MyTemplate.

b. Change the Property Name to "VbaScript. c. Display a dialog automatically when the mimic opens. The
dialog displays the name of the mimic.

d. Close the mimic then open it to check it.

It doesnt work. Why? How to solve it?

Module 25 - VBA - Basics

Page 19/32

In your code, replace ThisMimic.Name by Me.Name. Is it working? Why? Then replace Me.Name by Name. Is it working? Why?

Close all mimics, open the mimic "VbaScript" and display the Graphic Explorer. What do you see below the mimic name?

Module 25 - VBA - Basics

Page 20/32

4.4 The Collection Object


4.4.1 Concept

A commonly used COM object is the Collection. You can consider a Collection as an array with these properties: It has only one dimension. Each cell contains one object. It is dynamic. By default it is empty but the array changes its size according the number of instances of the Objects. It has a standard naming rule. It always has the same name as the Object plus an "s. For example a Collection of Car Objects is named Cars. It has at least the following properties and methods: Cars Car1 Car2 Car3 Car n Property Count: Get the number of Objects in the Collection. Method Item(index): Return the Object corresponding to the index.

4.4.2 Manipulate a Collection

For the following example we assume that we are manipulating the Collection Cars. It is populated with four Car Objects. Each Car Object has a Name Property: Car1, Car2 and Car3 plus a Color Property: Green, Yellow and Red. There are two common situations: You need to get a specific Object from a Collection. Here we want to get the color of the Car2 Object. Sub GetObjectFromCollection() Dim sCarColor as String sCarColor = Cars.Item(1).Color End Sub The Method Item usually uses an Index which is a number corresponding to the cell number (starting from 0). But this not very useful, since you are not suppose to know which cell contains Car2. Thats why the Index can be replaced by the Name Property.

Module 25 - VBA - Basics

Page 21/32

Sub GetObjectFromCollection() Dim sCarColor as String sCarColor = Cars.Item("Car2).Color End Sub This code works well but there is another syntax which is shorter and more common: Sub GetObjectFromCollection() Dim sCarColor as String sCarColor = Cars("Car2).Color End Sub Here we are not using the Item method directly but, in the background, VBA is using it because a Collection always implements the Item method as the default method. You need to parse a Collection because you dont know the name in advance. Here we want to know the name of the Cars having the Red color. Sub ParseCollection() Dim oCar as Object Dim sName as String For each oCar in Cars If oCar.Color = "Red then sName = oCar.Name end if Next End Sub The "For each loop is very useful because you dont have to manage the size of the Collection. Everything is "magic!

Module 25 - VBA - Basics

Page 22/32

4.5 The Mimics Collection Object


Mimics is a Collection containing Mimic Objects. Every time PcVue opens a mimic a new instance of Mimic Object is inserted in the Mimics Collection. When the Mimic is closed the Mimic Object is deleted from the Collection and destroyed. As you can see in the Object Tree (Figure 13) the Mimics Collection is a child of ThisProject. Actually it is a Property. We can see it in the Object Browser.

Figure 15

You must use the Mimics Collection when you want to access the Properties or methods of a Mimic but you cannot access it directly. For example if you write the following script located in the Main Project: MsgBox "The name of this mimic is: " & ThisMimic.Name an error will be generated by VBA because the Object ThisMimic doesnt exist in the Main project. You must write: Sub GetMimicName() Msgbox "The name of this mimic is: " & Mimics("Homepage).Name End Sub

Exercise 5.

Use the Mimics Collection Object.

a. Open the "Homepage and "VbaScript mimics. b. In ThisProject Object add a script to display the file name of
the "Homepage. Execute and check it.

c. In ThisProject Object add a script displaying the file name of


every mimic opened. Execute it and check.

Module 25 - VBA - Basics

Page 23/32

4.6 The Window Object


You probably remember the difference between a Mimic and a Window - yes? You can refresh your memory by checking Module 09 Mimics Advanced document. To summarize: the Mimic is the document containing the data and the Window is the view of these data. The Mimic Object has a Windows property which is a Collection of Window Objects. When PcVue opens a Mimic it actually opens a Mimic plus a Window. The Window Object is inserted in the Windows collection. This is clearer in the Objects Tree (Figure 13).
4.6.1 Properties

Top and Left Description: Return the Y and X position of the Window. Example:

MsgBox "The coordinates of this Window are: " & Me.Windows(1).Top & " " & _ Me.Windows(1).Left You may note that we are using the Index as a number. Actually a Window Object has no name property! Width and Height Description: Return the Width and Height of the Window. Example:

MsgBox "The sizes of this Window are: " & Me.Windows(1).Width & " - " & _ Me.Windows(1).Height Again you may note that we are using the Index as a number.
4.6.2 Methods

PrintOut Description: Print a hard copy of the Window and all its contents. Syntax: Me.Windows(1).PrintOut([copies As Integer], [orientation As fvOrientation], [printer As String]) Example:

Me.Windows(1).PrintOut 1, fvPortrait

Module 25 - VBA - Basics

Page 24/32

4.6.3 Events

None.

Exercise 6.

Use the Window Object.

a. Open the "VbaScript mimic. b. In ThisProject Object add a script displaying the coordinates
of "VbaScript" mimic.

4.7 The Graphic Objects


The Mimic Object has a Graphics Property which is a Collection of Graphic Objects. Every graphical object inserted in a mimic is a Graphic Object.
4.7.1 Properties

BackColorPrimary Description: Returns or sets the primary background color of the shape. Example:

Me.Graphics("Shape1").BackColorPrimary = RGB(0,0,0)
4.7.2 Methods

None.
4.7.3 Events

Click Description: Occurs when the user presses and then releases a mouse button over the object. Syntax: GraphicName.Click()

Using the Click Event of any object is a common way to trigger a script. But you cannot use this event in the normal manner. Why not? To understand that we can use a short experiment:

Step 1. Step 2. Step 3.

Open a Mimic. Insert any graphical object in a mimic.

Check its name using the Graphic Explorer. It should be "ShapeX". Rename it to "MyButton". Page 25/32

Module 25 - VBA - Basics

Step 4.
Mimic.

Switch to the VBA Workspace and display the Code Window for the Open the Objects box to find the "MyButton" Object. It is not here!!

Step 5.

Figure 16

By default, PcVue does not expose the graphical Objects. Consider that a mimic can include thousands of graphical Objects and if PcVue exposes all Objects, VBA will "explode"! If you want to add an Object in the Object box, you must specify it. Actually you must configure this Object in a VBA Control. To configure a graphical Object in a VBA Control:

Step 1. Step 2.

Select the graphical Object. Right-click and select the VBA Control command.

Figure 17

Now "MyButton" is available in the Objects list and you can use the Click event.

Figure 18

Module 25 - VBA - Basics

Page 26/32

There is a shortcut for achieving the same result:

Step 1. Step 2.

Select the graphical Object. Right click and select the View script command.

PcVue automatically configures the graphical Object as a VBA Control and creates the Click Event in the Code Window.

Exercise 7. 1. Use the Graphic Object a. Open the "VbaScript mimic. b. Add a button and change its name to "Mybutton". c. Create a script triggered by "MyButton" displaying its
width and height.

2. Use the Graphics Collection Object a. Add another graphic Object (rectangle for example). b. Rename it to "MySecondButton". Dont click the option
VBA Control.

c. Modify the previous script to display the coordinates of


MySecondButton.

3. Use the Graphics Collection Object a. Open the "Homepage" mimic. b. Modify the previous script to display
Module 25 - VBA - Basics Page 27/32

4.8 The Variable Object


VBA is also able to manipulate PcVue Database variables. Each variable declared in PcVue is a Variable Object which is embedded in the Variables Collection. There are two ways to access a Variable: The normal way using the Variables Collection. For example: Variables("BUILDING.FLOOR_01.AC_01.TEMP").property Shortcut using the characters "[" and "]". For example: [BUILDING.FLOOR_01.AC_01.TEMP] = 23

This shortcut is available only for the Value Property.


4.8.1 Properties

Type Description: Returns the type of the variable as it was returned by the server. The possible types are: fvVariableTypeAny, fvVariableTypeBit, fvVariableTypeRegister, fvVariableTypeText

Example:

Sub CheckVarType()
If Variables("BUILDING.FLOOR_01.AC_01.TEMP").Type = fvVariableTypeRegister then

MsgBox "This variable is a register" End if End Sub

Module 25 - VBA - Basics

Page 28/32

Value Description: Returns or sets the Value of the variable Example:

Sub CheckValue() Dim sgValue as single sgValue = Variables("BUILDING.FLOOR_01.AC_01.TEMP").Value


MsgBox "The temperature is: " & sgValue

End Sub Status Description: Returns the status of the variable. The possible status are: fvVariableStatusWaiting, fvVariableStatusGood, fvVariableStatusBad, fvVariableStatusConfigError, fvVariableStatusNotConnected.

Example:

Sub CheckStatus() If Variables("BUILDING.FLOOR_01.AC_01.TEMP").Status <> fvVariableStatusGood then


MsgBox "The variable is NS"

End If End Sub


4.8.2 Methods

None.
4.8.3 Events

ValueChange Description: Occurs when the value of the variable has changed. Page 29/32

Module 25 - VBA - Basics

This event is "linked" with the Property EnableEvents of the Variable Object. If EnableEvents = False the Event is NOT triggered. By default EnableEvents = False.
Syntax: VariableName.ValueChange()

Dim WithEvents oMyVar as Variable Sub Mimic_Open() Set oMyVar = Variables("BUILDING.FLOOR_01.AC_01.TEMP") oMyVar.EnableEvents = True End Sub Sub oMyVar_ValueChange() MsgBox "The Event has been triggered. Value = " & oMyVar.Value End Sub

Exercise 8. 1. Use the Variable Object. Check the Type. a. Open the "VbaScript mimic. b. Add a button and change its name to
"btn_CheckVariableType".

c. Create a script triggered by "btn_CheckVariableType"


to display the type of the variable BUILDING.FLOOR_01.AC_01_TEMP

2. Use the Variable Object. Check the Value. a. Add a button and change its name to
"btn_ReadWriteVariable".

b. Create a script triggered by "btn_ ReadWriteVariable"


to display the value of the variable BUILDING.FLOOR_01.AC_01_TEMP and test.

c. Modify the code to set the value and test.

Module 25 - VBA - Basics

Page 30/32

3. Use the Variable Object. Check the Status. a. Add a button and change its name to
"btn_ReadWriteVariable".

b. Create a script triggered by "btn_ ReadWriteVariable"


to display the value of the variable BUILDING.FLOOR_01.AC_01_TEMP and test.

4. Use the Variable Object. Check the Event. a. Add a button and animate it to change the value of the
variable BUILDING.FLOOR_01.AC_01.SETPOINT

c. Modify the code to set the value and test.

b. Create a script to display the value of the variable

BUILDING.FLOOR_01.AC_01_TEMP This script is triggered when this variable changes its value. Test.

Try to parse the Collection Variables? What happened?

Module 25 - VBA - Basics

Page 31/32

5 Summing-up
The VBA environment is powerful and able to manipulate COM Objects, ActiveX and OLE Automation application. All Objects belong to a single Library. The Main Project is always available. Each mimic opened adds a new VBA Project in the Project Explorer. The Object Browser is an important tool that lets you check the properties, methods and events of all available Objects. The HMI Objects Tree represents the hierarchy of PcVue Objects.

Module 25 - VBA - Basics

Page 32/32

SCRIPTING

Module 25

VBA - Advanced

Contents

Introduction
1.1 In this module you will learn 1.2 Files used in this module 1.3 Third party software used in this module

3
3 3 3

2 3

This feature in PcVue architecture ActiveX in PcVue


3.1 Concept 3.2 Some points of clarification 3.2.1 Licensing 3.2.2 ActiveX not working in PcVue 3.2.3 Responsibilities 3.3 Manipulate an ActiveX in PcVue 3.3.1 Add an ActiveX in the Favorites list 3.3.2 Add an ActiveX in a mimic 3.3.3 Use the ActiveX 3.4 ActiveX available "for free"

4 5
5 5 5 6 6 6 6 7 8 9

Using Libraries
4.1 Read and write a CSV file 4.2 Manipulate an Excel file

10
11 12

Summing-up

14

Module 25 - VBA - Advanced

Page 2/14

1 Introduction
1.1 In this module you will learn
How to manipulate ActiveX, How to read and write a CSV file, How to manipulate an external application such as Excel.

1.2 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_25\Project in C:\Pcvue projects\Usr\.

1.3 Third party software used in this module


None.

Module 25 - VBA - Advanced

Page 3/14

2 This feature in PcVue architecture

Figure 1

Module 25 - VBA - Advanced

Page 4/14

3 ActiveX in PcVue
3.1 Concept
ActiveX is a set of components that perform a particular function or a set of functions in a way that is independent of the programming language used to implement them. There are two main types of ActiveX: With HMI: This is the most common. For example: a Combo box. Windowless: This ActiveX has no HMI. For example: a Timer. An ActiveX is a file with the extension .OCX (most common), .EXE or .DLL. An ActiveX must be registered on the computer where it is used. Usually installation of the software does this. But sometimes you have to register yourself. In that case you must use the Windows command Regsvr32.exe. The syntax is: To register: regsvr32 <ActiveXPath> To unregister: regsvr32 u <ActiveXPath> You can consider an ActiveX as a library implementing a set of COM Objects and having usually an HMI which is also a COM Object.

3.2 Some points of clarification


3.2.1 Licensing

Somebody developed the ActiveX and they dont do usually that for free! You must take care about the licensing. An ActiveX developed by a serious company embeds two types of licenses: Design and Runtime. When you buy it, you buy the right to design and to distribute the run-time version. Consider the following situation: The toolbars of PcVue are actually an ActiveX we bought long time ago. Of course we buy the updates periodically. Our developers are using this component in Design mode for adding icons and so on. Then we compile PcVue which includes the run-time of the Toolbar ActiveX. Now, when you install PcVue on your computer, you are using the ActiveX in run-time mode. And you do not have the right to use it in Design mode. If you do that, the ActiveX provider can sue you!

Module 25 - VBA - Advanced

Page 5/14

3.2.2 ActiveX not working in PcVue

Sometimes we have customers calling our Technical Support claiming that they bought an ActiveX which is not working in a PcVue mimic although it is working perfectly in Visual Basic. Our answer is always the same: did you try it in Excel? Visual Basic is a special environment and you have to know that some ActiveX are created only for Visual Basic (or to be more accurate: only for User Forms).

You can keep in mind this rule: If it is working in an Excel sheet it must work in a PcVue mimic.
3.2.3 Responsibilities

You have to take care about the ActiveX you are using because if the ActiveX crashes PcVue will crash. Indeed, the ActiveX is running in the PcVue process therefore they are "linked".

3.3 Manipulate an ActiveX in PcVue


Usually an ActiveX has an HMI. Therefore you must insert it in a mimic to manipulate it. There are two main steps to inserting an ActiveX in a mimic: Add the ActiveX in your favorites list, Add the ActiveX in the mimic.
3.3.1 Add an ActiveX in the Favorites list

Step 1.

Select the command Configure / Preferences / ActiveX controls.

Figure 2

Step 2.

PcVue browses the Windows Registry and opens the ActiveX controls configuration dialog.

Module 25 - VBA - Advanced

Page 6/14

Step 3.

Double-click the ActiveX in the left-hand list to add it in the righthand list. Select the OK button.

Figure 3

3.3.2 Add an ActiveX in a mimic

Step 1.

Select the command Insert / Favorites ActiveX controls.

Figure 4

Step 2.

Select the ActiveX you want to insert.

The option VBA Control is set automatically for any ActiveX that is inserted.
Module 25 - VBA - Advanced Page 7/14

3.3.3 Use the ActiveX

Once an ActiveX is inserted in a mimic you can use it like any COM Object. That means you must have the help of the ActiveX.

Exercise 1. a. Open the mimic "VbaScript". b. Insert the ActiveX MsForms2 ComboBox and ListBox. c. Add a script to behave as follows: i. Fill the ComboBox with some items when the mimic
opens.

ii.

When the user double-clicks on one item it is added in the ListBox.

Open the Object Browser. Click the Library box. Do you see something new?

Try to insert the ActiveX MS Forms2 Frame for embedding one Option button. Is it working? Why?

Module 25 - VBA - Advanced

Page 8/14

3.4 ActiveX available "for free"


PcVue provides the following ActiveX: Alarm Viewer, Log Viewer, Trend Viewer, Grid Control (Insert Aigrid command). VBA provides the following ActiveX: Microsoft Forms 2: Combo box, List box, Option button Windows provides some ActiveX as well. The most commonly used are: Windows Media Player, Microsoft Web Browser.

Module 25 - VBA - Advanced

Page 9/14

4 Using Libraries
As you already know, the COM Objects are stored in a Library. Some libraries are implemented by default, some of them are implemented dynamically (insert ActiveX) but you can insert a library manually. To insert a library:

Step 1. Step 2.

Open the VBA Workspace. Select the command Tools / References.

Figure 5

Step 3. Step 4.
button.

VBA browses all Libraries available on the system and displays the References dialog. Select one or more References (or Libraries) and click the OK

Figure 6

Module 25 - VBA - Advanced

Page 10/14

4.1 Read and write a CSV file


To manipulate hard drives, folders and files, Windows provides a Library that is called the Microsoft Scripting Runtime. It has the following Object Tree:

Figure 7

The following script writes a CSV file to the TP folder of the current PcVue project. Private Sub btn_WriteFile_Click() Dim oFs As New Scripting.FileSystemObject Dim oTxt As Scripting.TextStream Dim i As Integer Set oTxt = oFs.CreateTextFile(thisproject.Path & "\TP\Training.txt", True) For i = 1 To 3 oTxt.WriteLine "LINE_" & CStr(i) & ",Field1,Field2" Next oTxt.Close End Sub

Module 25 - VBA - Advanced

Page 11/14

We may note these points: Some Objects can be instanced by the New instructions (FileSystemObject) and some need the instruction Set (Textstream). The FileSystemObject and Textstream are declared using the namespace Scripting. It is not necessary to use it but we advise you to do it. Using this method a reader can more easily understand your code. You must always close a Textstream otherwise the file remains open.

Exercise 2. a. Add a button in the mimic "VbaScript" named


"btn_WriteFile".

b. Add a script triggered by "btn_WriteFile" for creating the CSV


file "Training.txt". Test it.

c. Add a button in the mimic "VbaScript" named "btn_ReadFile". d. Add a script triggered by "btn_ ReadFile " for reading the CSV
file "Training.txt". Test it

4.2 Manipulate an Excel file


During set-up, Excel (or any Microsoft Office application) will install its own Library. Therefore manipulating an Excel file amounts to manipulating the Excel Library. The only thing you have to do is to insert the Excel Library in the VBA environment and read the Excel Help of course!! The following script reads one cell in an Excel file located in the TP folder of the current PcVue project. Private Sub btn_ReadExcel_Click() Dim oXapp As New Excel.Application Dim oWk As Excel.Workbook Set oWk = oXapp.Workbooks.Open(ThisProject.Path & "\TP\Training.xls", , True) Debug.Print oWk.Worksheets("Sheet1").Range("B2").Value oWk.Close End Sub

Module 25 - VBA - Advanced

Page 12/14

Exercise 3. a. Add a button in the mimic "VbaScript" named


"btn_ReadExcel".

b. Create an Excel file. c. Add a script for reading a cell in an Excel file. Test it.
Change the line where you close the Workbook into a comment. Execute the script two or three times. Open the Windows Task Manager. What do you see?

Module 25 - VBA - Advanced

Page 13/14

5 Summing-up
Manipulating an ActiveX is no more complex than manipulating a PcVue Graphic Object. You can easily add a Library into VBA. Then you are able to manipulate its Objects as you would any other COM Object. The way to manipulate an Excel file is exactly the same for Microsoft Word, Access, SQL Server etc.

Module 25 - VBA - Advanced

Page 14/14