Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
115 views

Creating and Configuring A Script Program Tutorial Guide

Uploaded by

Thinh Lê
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

Creating and Configuring A Script Program Tutorial Guide

Uploaded by

Thinh Lê
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

StruxureWare Building Operation

Creating and Configuring a Script Program


Tutorial Guide
04-15035-01-en
July 2014
StruxureWare Building Operation
Creating and Configuring a Script Program
Tutorial Guide
04-15035-01-en
July 2014
Copyright © 2014 Schneider Electric. All rights reserved.
The Schneider Electric brand and any registered trademarks of Schneider Electric Industries SAS referred to in this guide are the sole property of Schneider
Electric SA and its subsidiaries. They may not be used for any purpose without the owner's permission, given in writing. This guide and its content are
protected, within the meaning of the French intellectual property code (Code de la propriété intellectuelle français, referred to hereafter as "the Code"), under
the laws of copyright covering texts, drawings and models, as well as by trademark law. You agree not to reproduce, other than for your own personal, non-
commercial use as defined in the Code, all or part of this guide on any medium whatsoever without Schneider Electric's permission, given in writing. You also
agree not to establish any hypertext links to this guide or its content. Schneider Electric does not grant any right or license for the personal and non-
commercial use of the guide or its content, except for a non-exclusive license to consult it on an "as is" basis, at your own risk. All other rights are reserved.
Trademarks and registered trademarks are the property of their respective owners.
Contents

Introduction
1 About This Guide ........................................................... 9
1.1 Purpose of This Guide ................................................................. 11
1.2 How This Guide is Organized ...................................................... 12
1.3 Typographical Conventions ......................................................... 13

2 Additional Information .................................................. 15


2.1 Where to Find Additional Information ........................................... 17
2.2 Regulatory Notices ...................................................................... 18

Tutorial
3 Our Case Study ........................................................... 21
3.1 University X ................................................................................. 23
3.2 Requirements and Specifications ................................................ 26
3.2.1 Devices Used for This Case Study ............................................. 26
3.2.2 Software Used in This Tutorial ................................................... 26
3.2.3 Specifications ........................................................................... 26
3.3 Focus of This Tutorial .................................................................. 27
3.3.1 Pre-existing Project Database Folders and Programs ................ 30
3.3.2 Pre-existing Project Database Objects ...................................... 32
3.3.3 Pre-existing WorkStation for Projects User Accounts ................. 33

4 Creating and Configuring a Script Program .................. 35


4.1 Logging on to WorkStation for Projects ....................................... 38
4.2 Opening a Project ....................................................................... 40
4.3 Creating a Script Program ........................................................... 41
4.4 Opening a Script Program or Function ........................................ 42
4.5 Declaring a Variable .................................................................... 43
4.6 Adding a Line .............................................................................. 44
4.7 Adding an Instruction .................................................................. 45
4.8 Adding a Comment ..................................................................... 47
4.9 Checking and Saving a Script Program ....................................... 48

5 Using a Script Function ................................................ 49


5.1 Creating a Script Function ........................................................... 52

04-15035-01-en, July 2014 Creating and Configuring a Script Program


5
5.2 Opening a Script Program or Function ........................................ 53
5.3 Inserting a Code Library Item in a Script Program or Function ...... 54
5.4 Checking and Saving a Script Function ....................................... 56
5.5 Declaring a Variable .................................................................... 57
5.6 Declaring and Calling a Script Function ....................................... 58
5.7 Adding an Instruction .................................................................. 61
5.8 Adding a Comment ..................................................................... 63
5.9 Checking and Saving a Script Program ....................................... 65

6 Finishing the Script Program ........................................ 67


6.1 Declaring a Variable .................................................................... 70
6.2 Adding an Instruction .................................................................. 71
6.3 Adding a Comment ..................................................................... 73
6.4 Checking and Saving a Script Program ....................................... 75

7 Creating Bindings to I/O Points and Programs .............. 77


7.1 Binding Values in Script Editor Using a Binding Template ............ 80
7.2 Summary .................................................................................... 83

Creating and Configuring a Script Program 04-15035-01-en, July 2014


6
Introduction

The Introduction part contains information on the purpose


of this guide, how this guide is organized, where to find
more information, and information on regulatory notices.
1 About This Guide

Topics
Purpose of This Guide
How This Guide is Organized
Typographical Conventions
1 About This Guide
1.1 Purpose of This Guide

1.1 Purpose of This Guide


This tutorial provides step-by-step instructions for creating and configuring Script
programs, declaring variables in Script programs, adding line labels, instructions,
and comments in Script programs, creating Script functions, declaring and calling
Script functions in Script programs, inserting code library items in Script programs
or functions, checking and saving Script programs and functions, and creating
bindings.
This tutorial focuses on the following Building Operation Engineering Certification
objectives:
• Use WorkStation to:
– Create a Script program
– Create a Script function
• Use Script Editor to:
– Declare variables in a Script program or function
– Add line labels in a Script program
– Add instructions in a Script program or function
– Add comments in a Script program or function
– Declare and call a Script function in a Script program
– Insert a code library item in a Script program or function
– Check and save a Script program or function
– Create bindings between a Script program and other objects

04-15035-01-en, July 2014 Creating and Configuring a Script Program


11
1 About This Guide
1.2 How This Guide is Organized

1.2 How This Guide is Organized


This Building Operation Guide is divided into the following parts:

Introduction
The Introduction part contains information on the purpose of this guide, how this
guide is organized, where to find more information, and information on regulatory
notices.

Tutorial
The Tutorial part contains a step-by-step description of how to carry out different
tasks. If you want more information, see WebHelp or the corresponding Building
Operation Guide.
The Tutorial part includes a case study for a fictional customer called University X.
You can decide if you want to follow the example or use the described procedures
as reference information. The case study in this tutorial is an example of a typical
way of configuring Building Operation for a customer. When reading through this
tutorial, you might not have access to the devices, programs, and other files that
are needed for the fictional customer University X. However, the purpose of having
a case study is to see the procedures put in context, so you see how the
procedures could be used when configuring Building Operation, devices, or
programs for your customer.

Note
The programs and files that are used for the fictional customer University X are
intended for training purposes only.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


12
1 About This Guide
1.3 Typographical Conventions

1.3 Typographical Conventions


Building Operation Guides use the following specially marked texts:

Tip
Helps you understand the benefits and capabilities of the product.

Note
Provides you with supplementary information.

Important
Alerts you to supplementary information that is essential to the completion of a
task.

Caution
Alerts you to a condition that can cause loss of data.

Warning
Alerts you to a condition that can cause product damage or physical harm.

Bold texts:
User interface items, such as property names and buttons, are written in bold, for
example "On the File menu, select New."
Example texts:
All the example related information is indicated by blue lines and bullets.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


13
2 Additional Information

Topics
Where to Find Additional Information
Regulatory Notices
2 Additional Information
2.1 Where to Find Additional Information

2.1 Where to Find Additional Information


All the technical Building Operation information is available online, on WebHelp.
You also find additional information in the Building Operation Guides:
• Hardware Reference Guide
• Plain English and Script Difference Guide
• Function Block Editor and Menta Editor Difference Guide
• WebReports Reference Guide
• WebReports Operating Guide
• System Reference Guide
• Technical Reference Guide
• WorkStation Operating Guide
• IT Reference Guide
• WebStation Operating Guide
• System Upgrade Reference Guide
• Architectural Guidelines
• IT Planning Guide
• Administering Reports Tutorial Guide
• Configuring an Automation Server as a Controller Tutorial Guide
• Creating and Configuring a LonWorks Network with Xenta LonWorks Devices
Tutorial Guide
• Creating and Configuring a Modbus Network Tutorial Guide
• Creating and Configuring Alarms Tutorial Guide
• Creating and Configuring Graphics Tutorial Guide
• Creating and Configuring Schedules Tutorial Guide
• Creating and Configuring Trend Logs Tutorial Guide
• Creating and Configuring Users Tutorial Guide
• Starting a Project Tutorial Guide
• Finishing a Project Tutorial Guide
• Creating and Configuring a BACnet Network with b3 BACnet Devices Tutorial
Guide
• Creating and Configuring a LonWorks Network with MNL LonWorks Devices
Tutorial Guide
• Creating and Configuring a Function Block Program Tutorial Guide
• Creating and Configuring a Script Program Tutorial Guide

04-15035-01-en, July 2014 Creating and Configuring a Script Program


17
2 Additional Information
2.2 Regulatory Notices

2.2 Regulatory Notices

UL 916 Listed products for the Unites States and Canada, Open
Class Energy Management Equipment.

WEEE - Directive of the European Union (EU)


This equipment and its packaging carry the waste of electrical and electronic
equipment (WEEE) label, in compliance with European Union (EU) Directive
2002/96/EC, governing the disposal and recycling of electrical and electronic
equipment in the European community.

CE - Compliance to European Union (EU)


2004/108/EC Electromagnetic Compatibility Directive
This equipment complies with the rules, of the Official Journal of the European
Union, for governing the Self Declaration of the CE Marking for the European Union
as specified in the above directive(s) per the provisions of the following standards:
IEC/EN 61326-1 Product Standard, IEC/EN 61010-1 Safety Standard.

Industry Canada
ICES-003
This is a Class B digital device that meets all requirements of the Canadian
Interference Causing Equipment Regulations.

C-Tick (Australian Communications Authority (ACA))


AS/NZS 3548
This equipment carries the C-Tick label and complies with EMC and radio
communications regulations of the Australian Communications Authority (ACA),
governing the Australian and New Zealand (AS/NZS) communities.

Federal Communications Commission


FCC Rules and Regulations CFR 47, Part 15, Class B
This device complies with part 15 of the FCC Rules. Operation is subject to the
following two conditions: (1) This device may not cause harmful interference. (2) This
device must accept any interference received, including interference that may cause
undesired operation.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


18
Tutorial

The Tutorial part contains a step-by-step description of


how to carry out different tasks. If you want more
information, see WebHelp or the corresponding Building
Operation Guide.
The Tutorial part includes a case study for a fictional
customer called University X. You can decide if you want to
follow the example or use the described procedures as
reference information. The case study in this tutorial is an
example of a typical way of configuring Building Operation
for a customer. When reading through this tutorial, you
might not have access to the devices, programs, and other
files that are needed for the fictional customer University X.
However, the purpose of having a case study is to see the
procedures put in context, so you see how the procedures
could be used when configuring Building Operation, devices,
or programs for your customer.
3 Our Case Study

Topics
University X
Requirements and Specifications
Focus of This Tutorial
3 Our Case Study
3.1 University X

3.1 University X
We are going to install Building Operation as the building management system for
University X. The university is a campus of buildings for which heating and cooling
are supplied from a Central Plant with an underground distribution system. The
case study focuses on the renovation of the Central Plant and the expansion of the
School of Business.

Figure: The School of Business and the Central Plant


The Cooling Plant consists of a single chiller with a primary-secondary pumping
system. The secondary water loop serves four VAV air handling units with chilled
water coils located in the School of Business. The secondary loop has two water
pumps. Only one pump is required for 100 % of the load. The second pump
provides 100 % backup. The secondary pumps are variable speed. The primary
chilled water loop has a single constant volume chilled water pump. The condenser
loop rejects heat by means of a cooling tower. The condenser loop has a single
constant volume condenser water pump. The tower has two constant speed, draw-
through fans to increase the capacity of the tower above the natural draft capacity.
A diverting valve can be used to protect the chiller from condenser water thermal
shock. The water leaving the condenser can be diverted back to the inlet of the
condenser without any cooling effect.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


23
3 Our Case Study
3.1 University X

Figure: Cooling Plant diagram


The heating plant consists of two boilers in parallel, each with their own inline
pumps. Much of the time only one boiler is required to meet the load but under
greater load, both boilers will operate at the same time. The flow from the two
boilers comes together in a common supply header. There is a line from the supply
header to the mechanical systems that require a source of hot water. This line has
two constant volume distribution pumps in parallel. Only one is required to meet
the load. The second is back-up and lead-lag is used to alternate which pump
runs. The water returning from the mechanical systems flows into the return header
where it can be pumped by the inline pumps through the boilers. There is a
common line between the supply header and the return header. When the inline
pumps are flowing at a rate that exceeds the distribution pump flow rate, the water
flow in the common line is from the supply header to the return header. When the
distribution pump is flowing at a rate that exceeds the combined inline pump flow
rates, flow in the common line is from the return header to the supply header. Each
boiler has its own self contained control system that interfaces with Building
Operation through a combination of binary electrical control and network variables.
The inline pumps are locally controlled by the self contained control system.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


24
3 Our Case Study
3.1 University X

Figure: Heating Plant diagram

Note
The programs and files that are used for the fictional customer University X are
intended for training purposes only.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


25
3 Our Case Study
3.2 Requirements and Specifications

3.2 Requirements and Specifications


To be able to configure Building Operation for University X, the following devices
and software are used in this tutorial.

3.2.1 Devices Used for This Case Study


The following devices are used for this case study:
• Power Supply, PS-24V
• Automation Server
• I/O Modules:
– 1 x DI-16
– 1 x DO-FA-12
– 2 x UI-8/AO-4

3.2.2 Software Used in This Tutorial


The following software is used in this tutorial:
• License Administrator, and a valid license
• Enterprise Server
• WorkStation
• Project Configuration Server

3.2.3 Specifications
You find specifications in the Building Operation datasheets for Enterprise Server,
WorkStation, Project Configuration Server, PS-24V Power Supply, Automation
Server, and I/O Module Family.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


26
3 Our Case Study
3.3 Focus of This Tutorial

3.3 Focus of This Tutorial


University X wants the Air Handling Unit (AHU) for the School of Business to be
controlled in an efficient way to save energy. The air conditioning equipment
consists of fans for the supply air (SA) and return air (RA), air dampers for the
outside air (OA), return air, and exhaust air (EA), a filter for the mixed air (MA), and a
Chilled Water (CW) cooling coil as shown in the figure below.

Figure: Air Handling Unit with air condition equipment


The AHU is controlled by an Automation Server, which is programmed to perform
the following control requirements:
• Fans start/stop control
• Fans speed control
• Cooling coil control
• Dampers control
In this tutorial, you create and configure a Script program to control the dampers.
You create the Script program off site using WorkStation for Projects. Script
programs for controlling the fans start/stop, fans speed, and cooling coil are already
in place in the project database.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


27
3 Our Case Study
3.3 Focus of This Tutorial

The functional description for the dampers control program describes the following
requested behavior:
• A single analog output (DprPos) shall be used to control all three AHU
dampers. The position of the OA and EA dampers shall be equal to DprPos.
The position of the RA damper shall be equal to 100 - DprPos. The relationship
between DprPos and the individual OA, EA, and RA damper position shall be
configured within the respective damper actuator.
• The dampers shall be used to provide a free cooling mode when the outside air
temperature (OaTmp) is 1 °C (2 °F) or more below the return air temperature
(RaTmp). When in free cooling mode, the mixed air temperature (MaTmp) is
measured and the dampers shall be modulated to maintain an adjustable
mixed air temperature setpoint. The mixed air temperature setpoint shall be the
same as the supply air temperature setpoint (SaTmpSpt). Under normal
conditions, when the building is occupied, the dampers (DprPos) must never
go below a lower limit defined by an adjustable minimum position value
(MinPos).
• When the outside air temperature is equal to or greater than the return air
temperature, the dampers shall be placed in recirculation mode and shall stay
in this mode until the outside air temperature has fallen to 1 °C (2 °F) or more
below the return air temperature. When the AHU is in recirculation mode, the
dampers (DprPos) shall be set to the minimum position value (MinPos).
• When the AHU is off, the fire signal is active, or the AHU lockout mode is
active, the OA and EA dampers shall be closed, and the RA damper shall be
opened. This requirement means that DprPos shall be set to 0 %.
The dampers control is dependent on the fans being operational. For this reason,
the fans start/stop control program provides a digital interlock value (DprIntlk),
which the dampers control program needs to connect to and read.
The review of the functional description and the previous design work indicate that
the dampers control program will need to connect to the inputs, outputs, and
values shown in the following figure.

Figure: Connections for the Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


28
3 Our Case Study
3.3 Focus of This Tutorial

The review of the functional description also indicates that there are three control
states for the dampers:
• Control Off
• Free Cooling
• Recirculate Mode
The three control states can be represented in a control matrix, which shows each
of the states and the required output for each state. The dampers control program
needs to reflect the control matrix shown below. To meet the requirement to have
different control states, the program needs to be a looping type program.

Table: Control Matrix for the Dampers Control Program


Control State DprPos

Control Off 0%

Free Cooling Modulate based on mixed air temperature


(MaTmp) and supply air temperature
setpoint (SaTmpSpt) with a lower limit
defined by an adjustable minimum position
value (MinPos)

Recirculate Mode Minimum position value (MinPos)

In our example, you develop the program step by step, by successively refining the
program until all parts of the control matrix are implemented. You check and save
the program after each step to ensure that there are no syntax errors. You also add
comments in the program after each step to document what you have added or
modified.
You first develop the basic framework of the program. You use WorkStation for
Projects to create a Script program. You enter the program code using Script
Editor. You declare the input and output variables, add line labels that represent the
three control states for the dampers, add instructions that set the required damper
output for each state, and add conditional instructions that enables the program to
move from one line label (control state) to the other.
You then refine the program to deal with the requirement that the DprPos output
shall be modulated based on MaTmp and SaTmpSpt when the dampers are in free
cooling mode. To achieve this you use a PID loop function from the Script Editor
code library. You first create a Script function called PIDLoop, open it in Script
Editor, and insert the complete PID loop function from the code library. You then
declare the PIDLoop function in the program and modify the instruction for setting
the DprPos output to call the PIDLoop function instead. You also need to declare
some variables and set their values, which are passed into and out of the PIDLoop
function.
You finish the program by declaring an input variable and by adding and modifying
instructions that ensures that the DprPos output never falls below a lower limit when
the dampers are in the free cooling or recirculation mode. The lower limit is defined
by a minimum position value (MinPos), which can be adjusted outside the program.
Finally, you create the required bindings between the Dampers Control program
and the PIDLoop function, Fan Start Stop program, temperature input points,
temperature setpoint, minimum position value, and voltage output point.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


29
3 Our Case Study
3.3 Focus of This Tutorial

3.3.1 Pre-existing Project Database Folders and


Programs
For University X, a project called University X Project has been created in the Project
Configuration Server on the off-site computer. The University X Project includes an
Enterprise Server and an Automation Server.
The Enterprise Server called University X ES1 has the following folder structure:

Figure: University X ES1 and its folder structure


The Automation Server called CPlant AS has the following folder structure:

Creating and Configuring a Script Program 04-15035-01-en, July 2014


30
3 Our Case Study
3.3 Focus of This Tutorial

Figure: CPlant AS and its folder structure


CPlant AS has the following programs for the AHU 01 Application:

04-15035-01-en, July 2014 Creating and Configuring a Script Program


31
3 Our Case Study
3.3 Focus of This Tutorial

Figure: CPlant AS and its programs for the AHU 01 Application

3.3.2 Pre-existing Project Database Objects


For University X the following objects are available in the project database on the
off-site computer prior to the creation and configuration of Script programs:
• ...University X ES1/Servers/CPlant AS/IO Bus/Position05:UI8AO4/DprPos
(Voltage Output on output channel 4 of the UI-8/AO-4 I/O module, for which
Electrical scale bottom=0 V, Electrical scale top=10 V, Engineering scale
bottom=0 %, and Engineering scale top=100 %)
• ...University X ES1/Servers/CPlant AS/IO Bus/Position05:UI8AO4/MaTmp
(Temperature Input on input channel 5 of the UI-8/AO-4 I/O module, for which
the unit of measurement is °C or °F)
• ...University X ES1/Servers/CPlant AS/IO Bus/Position05:UI8AO4/OaTmp
(Temperature Input on input channel 6 of the UI-8/AO-4 I/O module, for which
the unit of temperature is °C or °F)
• ...University X ES1/Servers/CPlant AS/IO Bus/Position05:UI8AO4/RaTmp
(Temperature Input on input channel 7 of the UI-8/AO-4 I/O module, for which
the unit of measurement is °C or °F)
• ...University X ES1/Servers/CPlant AS/AHU 01 Application/Values/SaTmpSpt
(Analog value for which the unit of measurement is °C or °F)

Creating and Configuring a Script Program 04-15035-01-en, July 2014


32
3 Our Case Study
3.3 Focus of This Tutorial

• ...University X ES1/Servers/CPlant AS/AHU 01 Application/Values/MinPos


(Analog value for which the unit of measurement is %)
• ...University X ES1/System/Binding Templates/IO Points (custom binding
template)

3.3.3 Pre-existing WorkStation for Projects User


Accounts
For University X, the following WorkStation for Projects user account is available on
the off-site computer:
• Pete

04-15035-01-en, July 2014 Creating and Configuring a Script Program


33
4 Creating and Configuring a
Script Program

Topics
Logging on to WorkStation for Projects
Opening a Project
Creating a Script Program
Opening a Script Program or Function
Declaring a Variable
Adding a Line
Adding an Instruction
Adding a Comment
Checking and Saving a Script Program
4 Creating and Configuring a Script Program

Our Example
In this chapter, you create a Script program that deals with the easier parts of the
dampers control requirements. The basic framework of the dampers control
program that you develop in this chapter reflects a simplified control matrix, as
shown below. In this control matrix, the damper outputs (DprPos) for the free
cooling and recirculation modes are replaced with temporary values, which are
easier to implement at this stage. You will deal with the remaining and more
complex requirements in the following chapters.

Table: Simplified Control Matrix for the Dampers Control Program


Control State DprPos

Control Off 0%

Free Cooling 100 % (Temporary value)

Recirculate Mode 0 % (Temporary value)

You first log on to WorkStation for Projects on the off-site computer and open the
University X Project. You create the new Script program in the Automation Server.
The program is called Dampers Control. You then use Script Editor to enter the
program code.
You declare the required program variables at the beginning of the Script program.
These binding variables will be used to later connect the program to the
corresponding inputs, outputs, and values outside the program.
You add the line labels ControlOff, FreeCooling, and RecirculateMode in the
program to represent the three control states for the dampers. You add an
instruction for each line label that sets the DprPos output for the control state,
according to the above control matrix.
You then add the conditional instructions that will enable the program to move
between the line labels (control states) in response to the changes in the outside air
temperature (OaTmp), return air temperature (RaTmp), and interlock value (DprIntlk)
from the fans start/stop program. The program is a looping type program, which
means the program will continuously execute all instructions that belong to a line
label until the program is instructed to go to a different line label.
Additionally, you add comments to the program.
Finally, you check and save the program to the project database.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


37
4 Creating and Configuring a Script Program
4.1 Logging on to WorkStation for Projects

4.1 Logging on to WorkStation for Projects


You use WorkStation for Projects to access the Project Configuration Server.
For more information, see the Log on to WorkStation for Projects topic on
WebHelp.
In this example, you log on to the Project Configuration Server on the off-site
computer, using the project user account “Pete”.

To log on to WorkStation for Projects


1. In the Building Operation WorkStation for Projects window, in the User
name box, type the user name. In this example, type “Pete.”

Note
The first time you log on to WorkStation for Projects you need to use
the administrator user account to create a project user account. For
more information, see the Creating a Project Configuration Server
User Account topic on WebHelp.

2. In the Password box, type the password. In this example, type “Pete.”
Continued on next page

Creating and Configuring a Script Program 04-15035-01-en, July 2014


38
4 Creating and Configuring a Script Program
4.1 Logging on to WorkStation for Projects

3. In the Server box, select the hypertext transfer protocol you want to use and
then enter a server name or an IP address. In this example, click HTTPS
and then enter localhost.
4. Select Remember me to have WorkStation for Projects remember your
settings.
5. Click Log on.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


39
4 Creating and Configuring a Script Program
4.2 Opening a Project

4.2 Opening a Project


You open a project to configure a project or to deploy a project to a server.
For more information, see the Projects topic on WebHelp.
In this example, you open the University X Project on the off-site computer.

To open a project
1. In WorkStation for Projects, in the WorkStation for Projects - Projects
view, select the project that you want to open. In this example, select
University X Project.

2. On the toolbar, click the Open Project button .


The project opens in WorkStation for Projects.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


40
4 Creating and Configuring a Script Program
4.3 Creating a Script Program

4.3 Creating a Script Program


You create a Script program to import existing program code or to program new
logic for an Automation Server using Script Editor.
For more information, see the Script Programs topic on WebHelp.
In this example, you create the Dampers Control Script program in the CPlant AS.

To create a Script program


1. In WorkStation, in the System Tree pane, select the server or folder where
you want to create the Script program. In this example,
select ...University X ES1/Servers/CPlant AS/AHU 01
Application/Programs.
2. On the File menu, point to New and then click Program.
3. In the object type list, select Script Program.

4. In the Name box, type a name for the Script program. In this example, type
“Dampers Control.”
5. Click Create.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


41
4 Creating and Configuring a Script Program
4.4 Opening a Script Program or Function

4.4 Opening a Script Program or Function


You open a Script program or function in Script Editor to enter program
instructions.
For more information, see the Script Programs topic on WebHelp.
In this example, you open the Dampers Control program.

To open a Script program or function


1. In WorkStation, in the System Tree pane, select the Script program or
function. In this example, select ...University X ES1/Servers/CPlant
AS/AHU 01 Application/Programs/Dampers Control.
2. On the Actions menu, click Edit.
The Script program or function is now open and ready for input.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


42
4 Creating and Configuring a Script Program
4.5 Declaring a Variable

4.5 Declaring a Variable


You declare local program variables at the beginning of the Script program or
function where the variables are used.
For more information, see the Local Program Variables topic on WebHelp.
In this example, you declare the required binding variables in the Dampers Control
program. You declare the Numeric Input variables OaTmp, RaTmp, MaTmp,
SaTmpSpt, and DprIntlk as well as the Numeric Output variable DprPos.

To declare a variable
1. In Script Editor, declare the variable you want to use in the program or
function:
• Declare the variable using the type keyword Numeric, String, or DateTime
before the name of the variable.
• Declare the variable using the binding keyword Input, Output, or Public
after the type keyword, and before the name of the variable, to enable
bindings to the variable.
In this example, type the variable declarations that are highlighted by the
yellow oval in the following figure.

You have now declared the variables in your Script program or function. These
declarations are then followed by one or more program lines or instructions that
specify the operations to perform.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


43
4 Creating and Configuring a Script Program
4.6 Adding a Line

4.6 Adding a Line


You add lines to specify the type of action you want your Script program to perform.
A line is an instruction or series of instructions that belong together under one line
label.
For more information, see the Lines and Line Numbers topic on WebHelp.
In this example, you add three line labels, ControlOff, FreeCooling, and
RecirculateMode, in the Dampers Control program to represent the three control
states for the dampers. For each line label, you add an instruction that sets the
damper output (DprPos) for the state.
As a temporary solution, you set the DprPos output to 100 % for the FreeCooling
line label and to 0 % for the RecirculateMode line label. You will later replace these
two values.

To add a line
1. In Script Editor, type a line label that is preceded by the Line keyword or
followed by a colon, and then add the instructions that belong to the line label.
In this example, type the line labels and instructions that are highlighted by
the yellow oval in the following figure.

You have now added line labels and instructions in your program.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


44
4 Creating and Configuring a Script Program
4.7 Adding an Instruction

4.7 Adding an Instruction


You add an instruction in a Script program or function to command a server to take
some type of action to control a building.
For more information, see the Lines and Line Numbers topic on WebHelp.
In this example, you add the conditional instructions that enable the Dampers
Control program to move from the ControlOff line label to the other two line labels in
response to the changes in the outside air temperature (OaTmp), return air
temperature (RaTmp), and interlock value (DprIntlk) from the fans start/stop
program. You use the If…Then…Else instruction for directing the program flow.

To add an instruction
1. In Script Editor, type the instruction you want to add. In this example, type
the instructions that are highlighted by the yellow oval in the following figure.

For this example, repeat the procedure to add the If…Then instructions that enable
the program to move from the FreeCooling line label to the other two line labels.
Type the instructions that are highlighted by the yellow oval in the following figure.

Add the If…Then instructions that enable the program to move from the
RecirculateMode line label to the other two line labels. Type the instructions that are
highlighted by the yellow oval in the following figure.

The Dampers Control program should now look like the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


45
4 Creating and Configuring a Script Program
4.7 Adding an Instruction

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


46
4 Creating and Configuring a Script Program
4.8 Adding a Comment

4.8 Adding a Comment


You use optional comments to help document the operation and purpose of a
Script program or function.
For more information, see the Comments in Script Programs topic on WebHelp.
In this example, you add comments at the beginning of the Dampers Control
program to explain the purpose of the program.

To add a comment
1. In Script Editor, type a single quotation mark (') and then type a comment.
In this example, type the comments that are highlighted by the yellow oval in
the following figure.

You can add a comment at the beginning of the program or function to explain its
purpose. You can also add comments at the end of any statement in a Script
program or function.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


47
4 Creating and Configuring a Script Program
4.9 Checking and Saving a Script Program

4.9 Checking and Saving a Script Program


You check your Script program to ensure there are no syntax errors. You perform a
save operation to check and then save your Script program.
For more information, see the Script Programs topic on WebHelp.
In this example, you check and save the Dampers Control program.

To check and save a Script program


1. In Script Editor, click Check.
2. Click Save to check and save your Script program.
When you save a program that contains Input, Output, Public, Function and
WebService variables, the entries are automatically added to the
corresponding binding tabs in the Properties pane.
The Script Editor displays a Save Successful message, even if the program
contains errors and does not compile successfully.
If you save a program that contains errors, that program will not run. The program
must have a successful check prior to running.
You have now checked and saved your Script program.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


48
5 Using a Script Function

Topics
Creating a Script Function
Opening a Script Program or Function
Inserting a Code Library Item in a Script Program or
Function
Checking and Saving a Script Function
Declaring a Variable
Declaring and Calling a Script Function
Adding an Instruction
Adding a Comment
Checking and Saving a Script Program
5 Using a Script Function

Our Example
In this chapter, you refine the Dampers Control program to deal with the
requirement that the damper output (DprPos) shall be modulated based on the
mixed air temperature (MaTmp) and supply air temperature setpoint (SaTmpSpt)
when the dampers are in free cooling mode. You update the program to fulfill the
control requirement that is highlighted in bold in the following table.

Table: Simplified Control Matrix for the Dampers Control Program


Control State DprPos

Control Off 0%

Free Cooling Modulate based on mixed air


temperature (MaTmp) and supply air
temperature setpoint (SaTmpSpt)

Recirculate Mode 0 % (Temporary value)

To achieve the control requirement, you use a PID loop function. The Dampers
Control program calls the function, which calculates the required DprPos output
and returns the result back to program. MaTmp, SaTmpSpt, and the other required
values are passed to the PID loop function through the function call. After the
function has completed its task it shuts down until it is called again.
You first create a Script function in the Automation Server. The function is called
PIDLoop. You enter the code using Script Editor. A complete PID loop function is
provided in the Script Editor code library. You insert the code from the code library
into the PIDLoop function. You check the function before you save it to the project
database.
You then edit the Dampers Control program. You need to declare the PIDLoop
function because the function is external to the program. You modify the
FreeCooling line by replacing the temporary DprPos output value with a call to the
PIDLoop function. You will later create the required binding between program and
the function.
You also need to declare some other variables, which are used to store values that
passed back from the PIDLoop function. You modify the ControlOff and
RecirculateMode lines by adding instructions that set the required values for these
variables.
Additionally, you add comments to document the new instructions.
Finally, you check and save the program to the project database.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


51
5 Using a Script Function
5.1 Creating a Script Function

5.1 Creating a Script Function


You create Script functions so that you can program code that can be used in one
or several Script programs or functions.
For more information, see the Script Functions and Programs topic on WebHelp.
In this example, you create the PIDLoop Script function in the CPlant AS.

To create a Script function


1. In WorkStation, in the System Tree pane, select the server or folder where
you want to create the Script function. In this example, select ...University
X ES1/Servers/CPlant AS/AHU 01 Application/Programs.
2. On the File menu, point to New and then click Program.
3. In the object type list, select Script Function.

4. In the Name box, type a name for the Script function. In this example, type
"PIDLoop".
5. Click Create.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


52
5 Using a Script Function
5.2 Opening a Script Program or Function

5.2 Opening a Script Program or Function


You open a Script program or function in Script Editor to enter program
instructions.
For more information, see the Script Programs topic on WebHelp.
In this example, you open the PIDLoop function.

To open a Script program or function


1. In WorkStation, in the System Tree pane, select the Script program or
function. In this example, select ...University X ES1/Servers/CPlant
AS/AHU 01 Application/Programs/PIDLoop.
2. On the Actions menu, click Edit.
The Script program or function is now open and ready for input.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


53
5 Using a Script Function
5.3 Inserting a Code Library Item in a Script Program or Function

5.3 Inserting a Code Library Item in a Script


Program or Function
You insert a code library item in a Script program or function to add a frequently
used unit of text such as a single word, a program instruction, a program line or set
of instructions, or a complete function or program.
For more information, see the Collapsible Code Segments topic on WebHelp.
In this example, you insert the code library item named “PIDLoop(Short Version)” in
the PIDLoop function. The code comprises a complete Script function.

To insert a code library item in a Script program or function


1. In Script Editor, position the insertion point in the program or function where
you want to insert the item. In this example, position the insertion point in
the PIDLoop function.
2. Click Library.
3. In the Library pane, click the folder that contains the item. In this example,
click PID.
Continued on next page

Creating and Configuring a Script Program 04-15035-01-en, July 2014


54
5 Using a Script Function
5.3 Inserting a Code Library Item in a Script Program or Function

4. Right-click the item and click Insert in editor. In this example, right-click
PIDLoop(Short Version).

The item appears at your insertion point in the Script program or function.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


55
5 Using a Script Function
5.4 Checking and Saving a Script Function

5.4 Checking and Saving a Script Function


You check your Script function to ensure there are no syntax errors. You perform a
save operation to check and then save your Script function.
For more information, see the Script Functions and Programs topic on WebHelp.
In this example, you check and save the PIDLoop function.

To check and save a Script function


1. In Script Editor, click Check.
2. Click Save to check and save your Script function.
You have now checked and saved your Script function.
The Script Editor displays the Save Successful message, even if the function
contains errors and does not compile successfully.
If you save a function that contains errors, that function will not run. The function
must have a successful check prior to running.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


56
5 Using a Script Function
5.5 Declaring a Variable

5.5 Declaring a Variable


You declare local program variables at the beginning of the Script program or
function where the variables are used.
For more information, see the Local Program Variables topic on WebHelp.
In this example, you declare the Numeric variables LastErr and LastInt, and the
DateTime variable LastTime, in the Dampers Control program. The variable values
are passed into and out of the PIDLoop function through the program's function
call. The variables are needed to store the values that are passed back from the
function.

To declare a variable
1. In Script Editor, declare the variable you want to use in the program or
function:
• Declare the variable using the type keyword Numeric, String, or DateTime
before the name of the variable.
In this example, type the variable declarations that are highlighted by the
yellow oval in the following figure.

You have now declared the variables in your Script program or function. These
declarations are then followed by one or more program lines or instructions that
specify the operations to perform.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


57
5 Using a Script Function
5.6 Declaring and Calling a Script Function

5.6 Declaring and Calling a Script Function


You can declare and call a Script function in a Script program or another Script
function. For example, you include a function as a subroutine and access it
repeatedly in the same program or any other program.
For more information, see the Function Declarations and Statements topic on
WebHelp.
In this example, you declare the PIDLoop function in the Dampers Control program
to allow for the binding of the function. You then replace the temporary DprPos
output value for the FreeCooling line label with a call to the PIDLoop.
Within the brackets “()” of the function call you specify all the values (arguments) that
the PIDLoop function needs to calculate the required output. The PIDLoop function
requires the arguments in the following order: MaTmp, SaTmpSpt, kP (Proportional
gain), kI (Integral gain), kD (Derivative gain), Bias, Direction, LastErr, LastInt,
LastTime. In our example, kP=0.05, kI=0.017, kD=0, Bias=0 (No output bias), and
Direction=1 (Direct acting).
The result from the function call is in the range 0 to 1. You need to multiply this
result by 100 to obtain the required range 0 to 100 %.

To declare and call a Script function


1. In Script Editor, declare the function you want to call by using the keyword
Function before the name of the function. In this example, type the function
declaration that is highlighted by the yellow oval in the following figure.

Continued on next page

Creating and Configuring a Script Program 04-15035-01-en, July 2014


58
5 Using a Script Function
5.6 Declaring and Calling a Script Function

2. Add the function call. In this example, type the function call that is
highlighted by the yellow oval in the following figure.

You have now declared and called a function in a Script program or another Script
function.

The Dampers Control program should now look like the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


59
5 Using a Script Function
5.6 Declaring and Calling a Script Function

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


60
5 Using a Script Function
5.7 Adding an Instruction

5.7 Adding an Instruction


You add an instruction in a Script program or function to command a server to take
some type of action to control a building.
For more information, see the Lines and Line Numbers topic on WebHelp.
In this example, you add an instruction to the ControlOff line label in the Dampers
Control program to reset the PID loop's last error (LastErr) and integral (LastInt)
values to zero so that the previous values are not present when the equipment
starts up again. You also add an instruction to keep updating the PID loop's last-
time-called value (LastTime) with the latest date/time so that the function does not
think there has been a long delay since it was last called.

To add an instruction
1. In Script Editor, type the instruction you want to add. In this example, type
the instructions that are highlighted by the yellow oval in the following figure.

For this example, repeat the procedure to add the same instructions to the
RecirculateMode line label. Type the instructions that are highlighted by the yellow
oval in the following figure.

The Dampers Control program should now look like the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


61
5 Using a Script Function
5.7 Adding an Instruction

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


62
5 Using a Script Function
5.8 Adding a Comment

5.8 Adding a Comment


You use optional comments to help document the operation and purpose of a
Script program or function.
For more information, see the Comments in Script Programs topic on WebHelp.
In this example, you add comments at the end of the instructions that you
previously added to the ControlOff line label in the Dampers Control program.

To add a comment
1. In Script Editor, type a single quotation mark (') and then type a comment.
In this example, type the comments that are highlighted by the yellow oval in
the following figure.

You can add a comment at the beginning of the program or function to explain its
purpose. You can also add comments at the end of any statement in a Script
program or function.

For this example, repeat the procedure to add comments at the end of the
instructions you added to the RecirculateMode line label. Type the comments that
are highlighted by the yellow oval in the following figure.

The Dampers Control program should now look like the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


63
5 Using a Script Function
5.8 Adding a Comment

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


64
5 Using a Script Function
5.9 Checking and Saving a Script Program

5.9 Checking and Saving a Script Program


You check your Script program to ensure there are no syntax errors. You perform a
save operation to check and then save your Script program.
For more information, see the Script Programs topic on WebHelp.
In this example, you check and save the Dampers Control program.

To check and save a Script program


1. In Script Editor, click Check.
2. Click Save to check and save your Script program.
When you save a program that contains Input, Output, Public, Function and
WebService variables, the entries are automatically added to the
corresponding binding tabs in the Properties pane.
The Script Editor displays a Save Successful message, even if the program
contains errors and does not compile successfully.
If you save a program that contains errors, that program will not run. The program
must have a successful check prior to running.
You have now checked and saved your Script program.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


65
6 Finishing the Script Program

Topics
Declaring a Variable
Adding an Instruction
Adding a Comment
Checking and Saving a Script Program
6 Finishing the Script Program

Our Example
In this chapter, you finish the Dampers Control program. You refine the program to
deal with the requirement that the damper output (DprPos) must never fall below a
lower limit when the dampers are in the free cooling or recirculation mode. The
lower limit is defined by a minimum position value (MinPos), which can be adjusted
outside the program. You update the program to fulfill the control requirements that
are highlighted in bold in the following table.

Table: Complete Control Matrix for the Dampers Control Program


Control State DprPos

Control Off 0%

Free Cooling Modulate based on mixed air temperature


(MaTmp) and supply air temperature
setpoint (SaTmpSpt) with a lower limit
defined by an adjustable minimum
position value (MinPos)

Recirculate Mode Minimum position value (MinPos)

You first declare an input variable, which allows for an adjustable minimum position
(MinPos) for the damper output. This binding variable will be used to later connect
the program to a value that can be adjusted outside the program.
For the FreeColing line label, you modify the instruction for setting the DprPos
output. You use the system function called Maximum to restrict the value of DprPos
to MinPos or greater.
You also modify the corresponding instruction for the RecirculateMode line label by
replacing the temporary value of 0 % with the desired value of MinPos (adjustable).
Additionally, you add comments to explain the purpose of the modified instructions.
Finally, you check and save the program to the project database.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


69
6 Finishing the Script Program
6.1 Declaring a Variable

6.1 Declaring a Variable


You declare local program variables at the beginning of the Script program or
function where the variables are used.
For more information, see the Local Program Variables topic on WebHelp.
In this example, you declare the Numeric Input variable MinPos in the Dampers
Control program.

To declare a variable
1. In Script Editor, declare the variable you want to use in the program or
function:
• Declare the variable using the type keyword Numeric, String, or DateTime
before the name of the variable.
• Declare the variable using the binding keyword Input, Output, or Public
after the type keyword, and before the name of the variable, to enable
bindings to the variable.
In this example, type the variable declaration that is highlighted by the
yellow oval in the following figure.

You have now declared the variables in your Script program or function. These
declarations are then followed by one or more program lines or instructions that
specify the operations to perform.

Creating and Configuring a Script Program 04-15035-01-en, July 2014


70
6 Finishing the Script Program
6.2 Adding an Instruction

6.2 Adding an Instruction


You add an instruction in a Script program or function to command a server to take
some type of action to control a building.
For more information, see the Lines and Line Numbers topic on WebHelp.
In this example, you modify the instruction that sets the DprPos output for the
FreeCooling line label in the Dampers Control program. You modify the instruction
to ensure that the output to the dampers never goes below a lower limit, which is
defined by an adjustable minimum position value (MinPos). There is a system
function called Maximum that can be used for this purpose. You use the Maximum
function to restrict the value of DprPos to MinPos or greater.

To add an instruction
1. In Script Editor, type the instruction you want to add. In this example, type
the instruction that is highlighted by the yellow oval in the following figure.

For this example, repeat the procedure to modify the instruction that sets the
DprPos output for the RecirculateMode line label so that the AHU is in
RecirculateMode with the output to the dampers at minimum position value
(MinPos). Type the instruction that is highlighted by the yellow oval in the following
figure.

The Dampers Control program should now look like the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


71
6 Finishing the Script Program
6.2 Adding an Instruction

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


72
6 Finishing the Script Program
6.3 Adding a Comment

6.3 Adding a Comment


You use optional comments to help document the operation and purpose of a
Script program or function.
For more information, see the Comments in Script Programs topic on WebHelp.
In this example, you add a comment to explain the purpose of the instruction that
sets the DprPos output for the FreeCooling line label in the Dampers Control
program.

To add a comment
1. In Script Editor, type a single quotation mark (') and then type a comment.
In this example, type the comment that is highlighted by the yellow oval in the
following figure.

You can add a comment at the beginning of the program or function to explain its
purpose. You can also add comments at the end of any statement in a Script
program or function.

For this example, repeat the procedure to add a comment at the end of the
instruction that sets the DprPos output for the RecirculateMode line label. Type the
comment that is highlighted by the yellow oval in the following figure.

Add a comment also at the end of the instruction that sets the DprPos output for
the ControlOff line label. Type the comment that is highlighted by the yellow oval in
the following figure.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


73
6 Finishing the Script Program
6.3 Adding a Comment

The Dampers Control program should now look like the following figure.

Figure: Dampers Control program

Creating and Configuring a Script Program 04-15035-01-en, July 2014


74
6 Finishing the Script Program
6.4 Checking and Saving a Script Program

6.4 Checking and Saving a Script Program


You check your Script program to ensure there are no syntax errors. You perform a
save operation to check and then save your Script program.
For more information, see the Script Programs topic on WebHelp.
In this example, you check and save the Dampers Control program.

To check and save a Script program


1. In Script Editor, click Check.
2. Click Save to check and save your Script program.
When you save a program that contains Input, Output, Public, Function and
WebService variables, the entries are automatically added to the
corresponding binding tabs in the Properties pane.
The Script Editor displays a Save Successful message, even if the program
contains errors and does not compile successfully.
If you save a program that contains errors, that program will not run. The program
must have a successful check prior to running.
You have now checked and saved your Script program.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


75
7 Creating Bindings to I/O Points
and Programs

Topics
Binding Values in Script Editor Using a Binding Template
Summary
7 Creating Bindings to I/O Points and Programs

Our Example
In this chapter, you create the required bindings between the Dampers Control
program and the PIDLoop function, Fan Start Stop program, temperature input
points, temperature setpoint, minimum position value, and voltage output point.
You create the bindings to establish data flow into and out of the Dampers Control
program. The bindings are needed because the other objects are external to the
program. You use the Bindings view within Script Editor to create the bindings.
To save engineering time, you use binding templates to create the required
bindings. You use a custom binding template named IO Points to create the binding
to the I/O points, and you use the Default name matching template to create the
other bindings.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


79
7 Creating Bindings to I/O Points and Programs
7.1 Binding Values in Script Editor Using a Binding Template

7.1 Binding Values in Script Editor Using a


Binding Template
You use binding templates to reduce engineering time when creating bindings for
variables and functions within a Script program. Binding templates are defined and
created for binding patterns that are frequently reused. You can access the
Bindings view without leaving Script Editor.
For more information, see the Binding Templates topic on WebHelp.
In this example, you use the Default name matching template to create the bindings
between the Dampers Control program and the PIDLoop function, the Fans Start
Stop program's digital interlock value (DprIntlk), the temperature setpoint
(SaTmpSpt), and the minimum position value (MinPos).

To bind values in Script Editor using a binding template


1. In Script Editor, click Bindings to display the Bindings view for the Script
program.
2. In the binding point browser, drag the object or folder to the binding template
that you want to apply. In this example, drag ...University X
ES1/Servers/CPlant AS/AHU 01 Application folder to the Default
name matching template.

Continued on next page

Creating and Configuring a Script Program 04-15035-01-en, July 2014


80
7 Creating Bindings to I/O Points and Programs
7.1 Binding Values in Script Editor Using a Binding Template

3. Select the bindings that you want to create. In this example, keep all
bindings selected.

4. Click OK.
5. Verify that all bindings are correctly bound. In this example, verify the
bindings against the table below.

6. On the toolbar, click Save.

Dampers Control Program

04-15035-01-en, July 2014 Creating and Configuring a Script Program


81
7 Creating Bindings to I/O Points and Programs
7.1 Binding Values in Script Editor Using a Binding Template

Table: Results Verification – Dampers Control Program Bindings

Binding Point Binding

Input - DprIntlk .../CPlant AS/AHU 01


Application/Programs/Fans Start Stop
Control/DprIntlk

Input - MinPos .../CPlant AS/AHU 01


Application/Values/MinPos/Value

Input - SaTmpSpt .../CPlant AS/AHU 01


Application/Values/SaTmpSpt/Value

Function - PIDLoop .../CPlant AS/AHU 01


Application/Programs/PIDLoop

For this example, repeat the procedure to create the bindings between the
Dampers Control program and the I/O points MaTmp, OaTmp, RaTmp, and
DprPos:
• Drag the ...University X ES1/Servers/CPlant AS/IO Bus folder to the IO
Points template.

Table: Results Verification – Dampers Control Program Bindings

Binding Point Binding

Input - MaTmp .../CPlant AS/IO


Bus/Position05:UI8AO4/MaTmp/Value

Input - OaTmp .../CPlant AS/IO


Bus/Position05:UI8AO4/OaTmp/Value

Input - RaTmp .../CPlant AS/IO


Bus/Position05:UI8AO4/RaTmp/Value

Output - DprPos .../CPlant AS/IO


Bus/Position05:UI8AO4/DprPos/Requested
Value

Creating and Configuring a Script Program 04-15035-01-en, July 2014


82
7 Creating Bindings to I/O Points and Programs
7.2 Summary

7.2 Summary
You have now you created and configured a Script program called Dampers
Control, which is used to control the dampers of the AHU. The new program
enables the university to use cool outside air, under certain conditions, for free
cooling of indoor spaces in the School of Business. You created the program off
site using WorkStation for Projects.
The review of the functional description and the previous design work had clarified
the control requirements and connections the program needed to implement. Three
control states were identified: Control Off, Free Cooling, and Recirculate Mode. The
control states and the required damper output for each state were compiled into a
control matrix, which the program needed to reflect.
You developed the program step by step, by successively refining the program until
the control matrix were fully implemented. You checked and saved the program
after each step. You also added comments in the program after each step.
You first developed the basic framework of the program. You used WorkStation for
Projects to create the Script program in the Automation Server. You entered the
program code using Script Editor. You declared the inputs and outputs, added line
labels to represent the three control states for the dampers, added instructions to
set the required damper output for each state, and added conditional instructions
to enable the program to move from one line label to the other.
You then refined the program to deal with the requirement that the damper output
shall be modulated based on the mixed air temperature and supply air temperature
setpoint when the dampers are in free cooling mode. To achieve this, you used a
PID loop function from the Script Editor code library. You first created a Script
function called PIDLoop, opened it in Script Editor, and inserted the complete PID
loop code from the code library. You then declared the function in the program and
modified the instruction for setting the damper output to call the PIDLoop function
instead. You also declared and defined some variables, which are used to store
values that are passed back from the PIDLoop function.
You finished the program by declaring an input variable and by adding and
modifying instructions that deal with the requirement that the damper output must
never fall below a lower limit (an adjustable minimum position value) when the
dampers are in the free cooling or recirculation mode.
Finally, you created the required bindings between the Dampers Control program
and the PIDLoop function, Fan Start Stop program, temperature input points,
temperature setpoint, minimum position value, and voltage output point.

04-15035-01-en, July 2014 Creating and Configuring a Script Program


83
Schneider Electric | Buildings Division
www.schneider-electric.com/buildings

© 2014 Schneider Electric. All rights reserved.

04-15035-01-en
July 2014

You might also like