You are on page 1of 23

Course T301, Engineering an 800xA System - Advanced

Chapter 3 Type design

TABLE OF CONTENTS
Chapter 3 Type design ................................................................................................................................................................... 3-1
3.1 General Information ............................................................................................................................................................. 3-3
3.1.1 Description .................................................................................................................................................................... 3-3
3.1.2 Objectives...................................................................................................................................................................... 3-3
3.1.3 Reference Documentation............................................................................................................................................. 3-3
3.1.4 Steps to go ..................................................................................................................................................................... 3-3
3.2 Control Library..................................................................................................................................................................... 3-4
3.2.1 General .......................................................................................................................................................................... 3-4
3.2.2 Create Control Library.................................................................................................................................................. 3-4
3.2.3 Connect a Library to an Application ............................................................................................................................ 3-5
3.2.4 Versioning ..................................................................................................................................................................... 3-5
3.2.5 Protection ...................................................................................................................................................................... 3-9
3.2.6 Import/Export Library................................................................................................................................................. 3-10
3.3 User Defined Structured Data Types................................................................................................................................. 3-11
3.3.1 Components................................................................................................................................................................. 3-11
3.3.2 Dot Notation................................................................................................................................................................ 3-12
3.3.3 Project Constants......................................................................................................................................................... 3-12
3.4 Function Blocks Types....................................................................................................................................................... 3-14
3.4.1 Creating a Function Block Type................................................................................................................................. 3-14
3.4.2 Function Block Type Editor ....................................................................................................................................... 3-14
3.4.3 Code Block.................................................................................................................................................................. 3-15
3.4.4 Languages.................................................................................................................................................................... 3-15
3.4.5 Protection of code ....................................................................................................................................................... 3-15
3.4.6 Create Function Block Type from existing one ......................................................................................................... 3-17
3.5 Control Modules Types...................................................................................................................................................... 3-18
3.5.1 Create new Control Module Type .............................................................................................................................. 3-18
3.5.2 Open POU editor......................................................................................................................................................... 3-18
3.5.3 Parameters ................................................................................................................................................................... 3-18
3.5.4 Variables...................................................................................................................................................................... 3-18
3.5.5 External Variables....................................................................................................................................................... 3-18
3.5.6 Code Blocks ................................................................................................................................................................ 3-18
3.5.7 Languages.................................................................................................................................................................... 3-19
3.5.8 Protection of code ....................................................................................................................................................... 3-19
3.5.9 Interaction Window..................................................................................................................................................... 3-19

3-1

Course T301, Engineering an 800xA System - Advanced

3-2

Engineering an 800xA System - Advanced

3.1 General Information


3.1.1 Description
The 800xA system provides a lot of predefined control libraries which include
function block types and control modules types for valves, motors, pid, . You can
use these ones to create your control logic for your plant.
But additional to that you can create your own specialized libraries. Here you can use
function block types or/and control module types. In this course we will call this Type
Design.

3.1.2 Objectives
After completion of this chapter you will be able to

Create Control Libraries

Close and release libraries

Create a new version of libraries

Design user defined structured data types

Design Function Block Types

Design Control Module Types

Create Interaction Windows

3.1.3 Reference Documentation

Control Builder online help Contents Project Explorer Libraries


Program Organization Units

800xA System Configuration user guide Configuration Section 2


Concepts Aspect Object Concept Libraries

Create a new library in the Control Builder

Design your types in the library

Test your library

Close and release your library

Create a new version of the library

Add a new type to the library or change an existing one

Close and release the new version of the library

3.1.4 Steps to go

3-3

Engineering an 800xA System


Chapter 3 Type design

3.2 Control Library


3.2.1 General
It is recommended to create own libraries when you work in a larger project, because
then you get a better structure of the project. Another major advantages of creating
own libraries are that it is possible to reuse the Data types, Function Block types and
Control Module types in other projects.
The Industrial IT 800xA System supports development, distribution and management
of versioned libraries. The Process Portal is the base place for the library handling, but
some operations are also available in the Control Builder.
Two aspects are necessary for the operations with Control Libraries on the Process
Portal side:

Library Aspect

Library Type Definition Aspect

The Library Handling in the Process Portal is handled in two structures:

Library Structure is the main place where to deal with the operations of the
libraries like open, close or where to connect different libraries to the library.

Object Type Structure is the structure where to build the single object types,
like Function Block Types, Control Module Types and Data Types.

3.2.2 Create Control Library


Use the Control Builder to create a new Control Library.
Open the Control Builder with the project where you want to create a Control Library.
Select the Library folder from the tree and open the Context Menu for it (right click
onto the Library object). Select the entry New Library from the list.
Type in the new library name and click OK.

Connect other Libraries to a Library


Use the Control Builder to connect other libraries to a library.
1. Open the Library folder in the Control Builder. Select the library Advanced
1.0/0 and open its folder as well.
2. Select the Connected Libraries folder and open the Context Menu for it.

3-4

Engineering an 800xA System - Advanced

3. Select the library which should be connected from the list and click OK.

3.2.3 Connect a Library to an Application


To get access to library elements (like a function block type) in your application you
have to connect the library first. Use the Control Builder to connect a library to an
application.
1. Open the Control Builder project.
2. Select the Application for which you want to connect a Control Library.
3. From the Application folder select the object Connected Libraries and open
the Context Menu for it. Please select the entry Connect Library.

4. Select the Library from the list and click OK. The Library is now connected to
the Application.

3.2.4 Versioning
3.2.4.1 Library States
A Library Version has a state. This state is used to describe how a library (version) can
be used. The states a library can be in are: Open, Closed or Released.
In the open state the contents of the Library Version may be edited. When editing
temporarily is completed, the library can be closed.
When a Library is closed then it cannot be edited but it can be reopened to allow
additional edits.
When a Library Version has been released then it can no longer be changed. If any
modifications are necessary then a new version of the library must be created.
Note that a library cannot be released unless all libraries it depends on are released.

3-5

Engineering an 800xA System


Chapter 3 Type design

Open
Create

Edit

Closed

Release

Released

Close

New Version

3.2.4.1.1 Release
Use the Process Portal to release a library.
1. Open the Object Type Structure and here the library Advanced 1.0-0. Select
the aspect Library Version Definition and open the Config View for it.
2. Select the tab card General from the Config View. Close the library by the
state close and click Apply to save the changes.

3. In this state you are able to open the library again. Please try this and after this
select the Close state like before.
4. After a library was set to close the Release state is freed. Please select the
Release state. After clicking Apply the other states of this library are locked
and will not get active again. The only way to change something in this library
is to create a new version of it.
5. Please click Apply to release the library.

3.2.4.2 Create new Version


Use the Process Portal and the Library Structure to create a new version of a library.
1. Open the Library Structure. Select the object Advanced and create a new
object for it. In the New Objectdialog the name field is grayed out. Because
the system knows that we want to create a new version of our library we do
not need the name field. What we need is the Version field. If we have a look
to it we can see that the version was already increased to version 1.1-0 (the old
version is 1.0-0).

3-6

Engineering an 800xA System - Advanced

2. Please accept all this by clicking Create.

3. In the Object Type Structure there is a new version object Advanced 1.1-0
existing as well. If we compare the old version with the new we can see that
the new version is a copy of the old. The difference is that the new version got
the state Open.

3-7

Engineering an 800xA System


Chapter 3 Type design

3.2.4.3 Work with different versions


Right now we have two versions of the library Advanced connected to the project
Boiler. What is different now?

Control Application: Each library can only be connected to an application


ones (!!!). There can not be two versions of a library connected to one
application.

Instantiation: If you want to instantiate an object, e.g. a Function Block, you


have to choose this version of the library, from where you want to get your
Function Block Type.

3.2.4.4 Upgrade Library


The object types of the previous and the new versions coexist in the Object Type
Structure. The customer has a possibility to carry out an upgrade of the chosen
instances of the previous Library Version to the new one.
This can be done using the Library tab in the Config View of the Application aspect of
a Control Application or using the Control Builder connect library function. The
upgrade process is a simple connect to a newer or older version of this library.
The upgrade process changes the old object type of the instances to the new one. The
Downgrade function is offered as well. This means that the older version of the library
can be activated again.
Use the Control Builder to upgrade a library:

3-8

Engineering an 800xA System - Advanced

1. Select the Control Application Appl_Tank1 in the Control Builder and open
the Context menu for the child object Connected Libraries.
2. Select the entry Connect Library from the list.
3. Connect the new library version by selecting the fitting item from the list.

4. Click OK to connect the library.

3.2.5 Protection
You can protect your library so that no other is able to view the content of it.
1. Right click on the library and select Properties Protection

2. Set the password for the protection of the library if necessary

3-9

Engineering an 800xA System


Chapter 3 Type design

3.2.6 Import/Export Library


The Import/Export of libraries is managed by the Import Export tool. Please have a
look to the chapter 11 Import/Export of this T301 course

3-10

Engineering an 800xA System - Advanced

3.3 User Defined Structured Data Types


It is possible to create a Data Type in an Application or in a Library. The Data Type
can be of a structured type, making nested structured data types possible. The picture
below shows the data type editor.

3.3.1 Components
The variables in the structured Data Type are called Components.

3.3.1.1 Name
It is best to give the components simple and explanatory names.

3.3.1.2 Data Type


Press < Ctrl+J > in the Data Type column, to find a suitable Data Type depending on
the operation that should be done.

3.3.1.3 Attributes
Press < Ctrl+J > in the Attribute column, to find a suitable attribute to be assigned.
Attributes
Name

Description

No attribute

The value of the variable is not maintained after a restart. Instead it is set
to the initial value of the variable. If the variable has no initial value
assigned to it, it will get the default value of the data type (see table in
page 6.3)

retain

The value of the variable is maintained after a warm restart. The system
sets retain on all variables by default. To override this the attribute must be
left empty.

coldretain
constant

The value of the variable is maintained after a warm or cold restart.


This attribute overrides the retain attributes in a structured data type.
You cannot change the value of the variable once given.
This attribute overrides the coldretain and retain attributes in a structured

3-11

Engineering an 800xA System


Chapter 3 Type design
data type.
hidden

The variable will not be visible to the OPC server, and therefore not
available in the HMI system.

3.3.1.4 Initial Value


You can specify initial values for simple data types only, not for the whole structured
data type. To assign initial values to a structured data type, specify initial values for
the separate components. If the components are also structured, then you must go on
to a deeper level until you reach the level where the simple data type is defined. In that
respect the initial values are bound to the data type definition and cannot be reset at
the declaration of a structured type variable.

3.3.1.5 Description
In the description fields a short description can be written at declaration of the Data
Type component.

3.3.2 Dot Notation


To get access to the values, you cannot use the tank variable as is, because it is a name
for the entire (main) structure. To gain access to the components, use the syntax
<main_identifier>.<component>

If you want to set the Full component of the Tank variable to 1 (i.e. "True"), write:
tank.full := true ;

The rest of the subordinate variables are accessed in a similar way. A structured data
type is a data type that contains several components and can thus have several values,
one for each component.

3.3.3 Project Constants


Use project constants for useful software settings you want to make globally available
to libraries and applications. With project constants, you can adapt such settings to an
individual project without having to modify any source code or having to introduce
parameters passing values to all concerned types.
Project constants are declared at the top level of libraries and projects. They are
globally visible, and can be used wherever a constant value is permitted, e.g., in
program code and for variable initialization.
Typically, project constants are declared in a library and given default values. They
are then used, for example, in code inside function block types. In a project that
includes the library, the project constant settings can be overridden by project specific
settings, which are kept and saved with the project.

3.3.3.1 Defining User Defined Project Constants


You can insert, edit and group project constants in the Project Constant editor. It is
possible to define your own Project Constants in a library or project. Select Tools>
Project Constants from the menu in the project explorer or right click on the Library

3-12

Engineering an 800xA System - Advanced

(must be a user defined library) and select Project constants. Any project constant
declared in a library will be a part of that library. They will however also be
incorporated in the main list of project conctants in the Tools>Project Constants
menu.

3-13

Engineering an 800xA System


Chapter 3 Type design

3.4 Function Blocks Types


By creating your own Function Blocks you can encapsulate code for commonly used
functions in your process. These Function Blocks can then be re-used in your project
to reduce engineering and improve readability.

3.4.1 Creating a Function Block Type


Right click on the Function Block Types icon and select New Function Block
Type to create a new Function Block Type. This could be done in an application or
a library. Creating the Function Block Type in an application means that this type can
only be used in this application. Creating the type in a library makes it possible to use
it also in other applications or even other projects.

3.4.2 Function Block Type Editor


The content of the function block type is displayed in an editor. You can define
function block types, which can be used in other POU:s. Parameters, variables and
function blocks that are used must be declared in the declaration pane. Code is entered
in the code pane. A function block type typically uses the following elements, which
are declared in separate tabs in the declaration pane:

3-14

Parameters Variables that passes values in or out from the program. The
parameters have Directions, indication if the parameter is read or written by the
Function Block. The options are: in, out and in_out. N.B.It is not allowed to assign
an initial value to a parameter

Local Variables used in the function block.

External variables Globally defined variables in the application editor must be


specified as external variables to be accessible by the function block.

Function blocks. You must explicitly declare function blocks to use them inside
the Function Block Type editor. Remember: when using the FBD or LD
languages, the declaration of the function block instance will be made
automatically when the function block is inserted.

Move FB between libraries. It is possible to move functions or function blocks


between libraries or applications, by using the copy/paste function.

Attributes
Name

Description

No attribute

The value of the variable is not maintained after a restart. Instead it is set

Engineering an 800xA System - Advanced

to the initial value of the variable. If the variable has no initial value
assigned to it, it will get the default value of the data type (see table in
page 6.3)
retain

coldretain

The value of the variable is maintained after a warm restart. The system
sets retain on all variables by default. To override this the attribute must be
left empty.
The value of the variable is maintained after a warm or cold restart.
This attribute overrides the retain attributes in a structured data type.
You cannot change the value of the variable once given.

constant

hidden

This attribute overrides the coldretain and retain attributes in a structured


data type.
The variable will not be visible to the OPC server, and therefore not
available in the HMI system.

Direction
Available: IN, OUT and IN_OUT.

Initial Value
The initial values of this function block type.

3.4.3 Code Block


Write the programming code in the code block of the function block type. The
800xA system supports different languages which can be used to establish code
block functionality.
The code block handling is described in the T300 course: Engineering an 800xA
system.

3.4.4 Languages
The Code Block supports five different languages.
The languages are described in the T300 course: Engineering an 800xA system.

3.4.5 Protection of code


The internals of a Function Block Type can be hidden by the protection function. In
protection mode only external parameter connections are visible.
1. Right click onto a function block type and select Properties Protection and
Scope.
2.

A dialog box becomes visible on screen.

3-15

Engineering an 800xA System


Chapter 3 Type design

3. The properties of the dialog box are described as follows:

3-16

Engineering an 800xA System - Advanced

3.4.6 Create Function Block Type from existing one


To create a function block type from an existing function block type:
1. Select the function block type to be copied.
2. Right-click the type and select Copy.
3. Select the Function Block Types folder into which the function block type is to
be copied.
4. Right-click the folder and select Paste.
5. Design your own type by adding new parameters and functionality. Select the
Parameters tab in the Declaration pane and add one or more parameters (and
variables) according to your needs. You must add code that is associated with
the new parameters (via the code pane).

3-17

Engineering an 800xA System


Chapter 3 Type design

3.5 Control Modules Types


3.5.1 Create new Control Module Type
You can create a new, empty Control Module Type in a library of your own or directly
within an application. A Type created on Application level can only be reached from
this Application itself, whereas a library Type can be reached from any Application.
You may also create a new Control Module Type from an already existing Control
Module Type. Right-click on the Control Module Types icon in one of your own
libraries or in an application and select New Control Module Type... Assign a name
to the new Type and click OK.

3.5.2 Open POU editor


Double click on the new Control Module type to go to the POU editor

3.5.3 Parameters
The Parameters of a Control Module Type are approximately identical to the
parameters of a Function Block Type. Chapter 3.4 Function Blocks Types provides
detailed information.
Two additional parameter properties exist for Control Module types, Attributes and
Direction.

3.5.4 Variables
The Variables of a Control Module Type are identical to the Variables of a Function
Block Type. Chapter 3.4 Function Blocks Types provides detailed information.

3.5.5 External Variables


The External Variables of a Control Module Type are identical to the External
Variables of a Function Block Type. Chapter 3.4 Function Blocks Types provides
detailed information.

3.5.6 Code Blocks


The Code Blocks of a Control Module Type are identical to Code Blocks of a Function
Block Type. Chapter 3.4 Function Blocks Types provides detailed information.

3-18

Engineering an 800xA System - Advanced

3.5.7 Languages
The Code Block Languages of a Control Module Type are identical to a Function
Block Type. Chapter 3.4 Function Blocks Types provides detailed information.

3.5.8 Protection of code


The Protection of code of a Control Module Type is identical to a Function Block
Type. Chapter 3.4 Function Blocks Types provides detailed information.

3.5.9 Interaction Window


3.5.9.1 The concept of Control Module graphics.
The CMD editor makes it possible to add graphical contents to a Control Module. A
number of interaction objects such as push buttons, input fields etc. can be used. For
status indication, color-coded circles, polygons etc. can be used. Control Module
graphics is a useful feature in for example the following cases:

During the development of the application, an interaction window makes it easy to


manipulate variable and parameter values.

During commissioning, the graphics can be used for simulating the response from
parts of the plant that may not be available yet.

As a maintenance tool for process objects, a graphical faceplate can show the
status of interlocks, allow manual operation etc.

By creating hierarchic graphical structures, navigation in the application becomes


very quick. As soon as the wanted Control Module is located, the POU editor for
this CM is directly available by pressing [Ctrl+M] and right clicking on it.

Hierarchic structures, where you zoom into a Control Module to see any objects
within, is accomplished by allowing each Control Module to have two layers of
graphical content: one directly visible to the user and one hidden beneath. The latter is
then reached by using the zoom tool or by using an interaction object on the first layer.
The picture below shows two examples of interaction windows, one for manual
operation of a process object and the other for tuning a PID controller..
Note that the Control Module graphics is not intended as a substitute to an HMI. It is
meant to be a complementary tool, to be used for testing, maintenance and navigation.

3-19

Engineering an 800xA System


Chapter 3 Type design

3.5.9.2 Open CMD Editor


Right click on the Control Module type and choose CMD editor to reach the
graphical interface for the Control Module type.

3.5.9.3 Tools in the CMD Editor


A number of tools are available in the CMD editors toolbox. Some of the more
important are mentioned here:

Command button

Input field

Text tool

. Used for creating static or dynamic texts.

Oval tool

. Used for drawing circles and ovals.

Polygon tool

. Used for manipulating Boolean variables.

, for input of string or real values.

. Used for drawing triangles etc.

Interaction objects make it possible for the user to change the value of variables, open
and close windows or open (not close) any text editor/word processor in online mode.
Interaction objects used for changing values of variables are available as two types;
graphical and non-graphical.
This chapter introduces the setup of a graphical Interaction Window.

3-20

Engineering an 800xA System - Advanced

3.5.9.4 Create an Interaction Window


This lesson describes how to create an interaction window for a control module type
and how to create a simple Input Field with an assigned variable from the control
module type.
1. Right click on the Control Module Type and select the entry CMD Editor.
2. Click the Input Field button and move the mouse into the Draw-Area. The
mouse arrow changes indicating drawing mode has been initiated.
3. Click into the Draw-Area and move the mouse, while the button is clicked, to
create a new Input Field.

4. Right click on the outline of the new Input Field and select the menu item
Interaction Attributes

3-21

Engineering an 800xA System


Chapter 3 Type design

5. The Interaction Attributes defines the kind of data (property) the Input Field
should be connected to.
6. Select the Input Field data type Real
7. Click on the question mark for Variable. All variables with the data type real
are shown in a window. These variables are localized in our Control Module
Type CM_GenGeneration.

8. Select a variable click the button Replace

3-22

Engineering an 800xA System - Advanced

9. The allocation to the variable Output is placed. Please accept the dialog by
clicking the OK button.
10. Close the CMD Editor by clicking the Windows Close Icon
11. The setup of our Interaction Window is finished now

3-23

You might also like