+ All Categories
Home > Documents > C03 - Type Design V2-1

C03 - Type Design V2-1

Date post: 07-Jul-2018
Category:
Upload: zvonkomihajlovic4891
View: 218 times
Download: 0 times
Share this document with a friend

of 10

Transcript
  • 8/19/2019 C03 - Type Design V2-1

    1/23

    Course T301, Engineering an 800xA System - Advanced

    3-1

    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

  • 8/19/2019 C03 - Type Design V2-1

    2/23

    Course T301, Engineering an 800xA System - Advanced

    3-2

  • 8/19/2019 C03 - Type Design V2-1

    3/23

    Engineering an 800xA System - Advanced

    3-3

    3.1 General Information

    3.1.1 Description

    The 800xA system provides a lot of predefined control libraries which includefunction block types and control modules types for valves, motors, pid, … . You canuse these ones to create your control logic for your plant.

    But additional to that you can create your own specialized libraries. Here you can usefunction 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 2Concepts Aspect Object Concept Libraries

    3.1.4 Steps to go

    • 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

  • 8/19/2019 C03 - Type Design V2-1

    4/23

    Engineering an 800xA SystemChapter 3 Type design

    3-4

    3.2 Control Library

    3.2.1 General

    It is recommended to create own libraries when you work in a larger project, becausethen you get a better structure of the project. Another major advantages of creatingown libraries are that it is possible to reuse the Data types, Function Block types andControl Module types in other projects.

    The Industrial IT 800xA System supports development, distribution and managementof versioned libraries. The Process Portal is the base place for the library handling, butsome operations are also available in the Control Builder.

    Two aspects are necessary for the operations with Control Libraries on the ProcessPortal 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 thelibraries 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 clickonto 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 LibraryUse the Control Builder to connect other libraries to a library.

    1. Open the Library folder in the Control Builder. Select the library Advanced1.0/0 and open its folder as well.

    2. Select the Connected Libraries folder and open the Context Menu for it.

  • 8/19/2019 C03 - Type Design V2-1

    5/23

    Engineering an 800xA System - Advanced

    3-5

    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 youhave to connect the library first. Use the Control Builder to connect a library to anapplication.

    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 openthe 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 tothe 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 editingtemporarily is completed, the library can be closed.

    When a Library is closed then it cannot be edited but it can be reopened to allowadditional edits.

    When a Library Version has been released then it can no longer be changed. If anymodifications 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.

  • 8/19/2019 C03 - Type Design V2-1

    6/23

    Engineering an 800xA SystemChapter 3 Type design

    3-6

    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 . Selectthe 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 thestate 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 thisselect 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 lockedand will not get active again. The only way to change something in this libraryis 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 Object… dialog the name field is grayed out. Becausethe system knows that we want to create a new version of our library we donot need the name field. What we need is the Version field. If we have a lookto it we can see that the version was already increased to version 1.1-0 (the oldversion is 1.0-0).

    Open Closed Released

    New Version

    ReleaseEdit

    CreateClose

  • 8/19/2019 C03 - Type Design V2-1

    7/23

    Engineering an 800xA System - Advanced

    3-7

    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 thatthe new version is a copy of the old. The difference is that the new version gotthe state Open .

  • 8/19/2019 C03 - Type Design V2-1

    8/23

    Engineering an 800xA SystemChapter 3 Type design

    3-8

    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 applicationones (!!!). There can not be two versions of a library connected to oneapplication.

    • Instantiation : If you want to instantiate an object, e.g. a Function Block, youhave to choose this version of the library, from where you want to get yourFunction Block Type.

    3.2.4.4 Upgrade Library

    The object types of the previous and the new versions coexist in the Object TypeStructure. The customer has a possibility to carry out an upgrade of the choseninstances 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 ofa Control Application or using the Control Builder connect library function. Theupgrade 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. TheDowngrade function is offered as well. This means that the older version of the librarycan be activated again.

    Use the Control Builder to upgrade a library:

  • 8/19/2019 C03 - Type Design V2-1

    9/23

    Engineering an 800xA System - Advanced

    3-9

    1. Select the Control Application Appl_Tank1 in the Control Builder and openthe 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

  • 8/19/2019 C03 - Type Design V2-1

    10/23

    Engineering an 800xA SystemChapter 3 Type design

    3-10

    3.2.6 Import/Export Library

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

  • 8/19/2019 C03 - Type Design V2-1

    11/23

    Engineering an 800xA System - Advanced

    3-11

    3.3 User Defined Structured Data Types

    It is possible to create a Data Type in an Application or in a Library. The Data Typecan 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 onthe 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 setto 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 inpage 6.3)

    retainThe value of the variable is maintained after a warm restart. The systemsets retain on all variables by default. To override this the attribute must beleft empty.

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

    This attribute overrides the retain attributes in a structured data type.

    constantYou cannot change the value of the variable once given.

    This attribute overrides the coldretain and retain attributes in a structured

  • 8/19/2019 C03 - Type Design V2-1

    12/23

    Engineering an 800xA SystemChapter 3 Type design

    3-12

    data type.

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

    3.3.1.4 Initial Value

    You can specify initial values for simple data types only, not for the ‘whole’ structureddata type. To assign initial values to a structured data type, specify initial values forthe separate components. If the components are also structured, then you must go onto a deeper level until you reach the level where the simple data type is defined. In thatrespect the initial values are bound to the data type definition and cannot be reset atthe 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 DataType component.

    3.3.2 Dot Notation

    To get access to the values, you cannot use the tank variable as is, because it is a namefor the entire (main) structure. To gain access to the components, use the syntax

    .

    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 datatype 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 availableto libraries and applications. With project constants, you can adapt such settings to anindividual 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 areglobally 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 thatincludes the library, the project constant settings can be overridden by project specificsettings, 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

  • 8/19/2019 C03 - Type Design V2-1

    13/23

    Engineering an 800xA System - Advanced

    3-13

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

  • 8/19/2019 C03 - Type Design V2-1

    14/23

    Engineering an 800xA SystemChapter 3 Type design

    3-14

    3.4 Function Blocks Types

    By creating your own Function Blocks you can encapsulate code for commonly usedfunctions in your process. These Function Blocks can then be re-used in your projectto 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 BlockType… to create a new Function Block Type. This could be done in an application ora library. Creating the Function Block Type in an application means that this type canonly be used in this application. Creating the type in a library makes it possible to useit 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 definefunction block types, which can be used in other POU:s. Parameters, variables andfunction blocks that are used must be declared in the declaration pane. Code is enteredin the code pane. A function block type typically uses the following elements, whichare declared in separate tabs in the declaration pane:

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

    • Local Variables used in the function block.

    • External variables Globally defined variables in the application editor must bespecified as external variables to be accessible by the function block.

    • Function blocks . You must explicitly declare function blocks to use them insidethe Function Block Type editor. Remember: when using the FBD or LDlanguages, the declaration of the function block instance will be madeautomatically 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 DescriptionNo attribute The value of the variable is not maintained after a restart. Instead it is set

  • 8/19/2019 C03 - Type Design V2-1

    15/23

    Engineering an 800xA System - Advanced

    3-15

    to the initial value of the variable. If the variable has no initial valueassigned to it, it will get the default value of the data type (see table inpage 6.3)

    retainThe value of the variable is maintained after a warm restart. The systemsets retain on all variables by default. To override this the attribute must beleft empty.

    coldretain

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

    This attribute overrides the retain attributes in a structured data type.

    constantYou cannot change the value of the variable once given.

    This attribute overrides the coldretain and retain attributes in a structureddata type.

    hiddenThe variable will not be visible to the OPC server, and therefore notavailable 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. The800xA 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 800xAsystem.

    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.

  • 8/19/2019 C03 - Type Design V2-1

    16/23

    Engineering an 800xA SystemChapter 3 Type design

    3-16

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

  • 8/19/2019 C03 - Type Design V2-1

    17/23

    Engineering an 800xA System - Advanced

    3-17

    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 theParameters tab in the Declaration pane and add one or more parameters (andvariables) according to your needs. You must add code that is associated withthe new parameters (via the code pane).

  • 8/19/2019 C03 - Type Design V2-1

    18/23

  • 8/19/2019 C03 - Type Design V2-1

    19/23

    Engineering an 800xA System - Advanced

    3-19

    3.5.7 Languages

    The Code Block Languages of a Control Module Type are identical to a FunctionBlock 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 BlockType. 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. Anumber of interaction objects such as push buttons, input fields etc. can be used. Forstatus indication, color-coded circles, polygons etc. can be used. Control Modulegraphics is a useful feature in for example the following cases:

    • During the development of the application, an interaction window makes it easy tomanipulate 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 thestatus of interlocks, allow manual operation etc.

    • By creating hierarchic graphical structures, navigation in the application becomesvery quick. As soon as the wanted Control Module is located, the POU editor forthis 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 objectswithin, is accomplished by allowing each Control Module to have two layers ofgraphical content: one directly visible to the user and one hidden beneath. The latter isthen 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 manualoperation 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 ismeant to be a complementary tool, to be used for testing, maintenance and navigation.

  • 8/19/2019 C03 - Type Design V2-1

    20/23

    Engineering an 800xA SystemChapter 3 Type design

    3-20

    3.5.9.2 Open CMD Editor

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

    3.5.9.3 Tools in the CMD Editor

    A number of tools are available in the CMD editor’s toolbox. Some of the moreimportant are mentioned here:

    • Command button . Used for manipulating Boolean variables.

    • Input field , for input of string or real values.

    • Text tool . Used for creating static or dynamic texts.

    • Oval tool . Used for drawing circles and ovals.

    • Polygon tool . Used for drawing triangles etc.

    Interaction objects make it possible for the user to change the value of variables, openand 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 .

  • 8/19/2019 C03 - Type Design V2-1

    21/23

    Engineering an 800xA System - Advanced

    3-21

    3.5.9.4 Create an Interaction Window

    This lesson describes how to create an interaction window for a control module typeand how to create a simple Input Field with an assigned variable from the controlmodule 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 D raw-Area . Themouse arrow changes indicating drawing mode has been initiated.

    3. Click into the Draw-Area and move the mouse, while the button is clicked, tocreate a new Input Field.

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

    Interaction Attributes

  • 8/19/2019 C03 - Type Design V2-1

    22/23

    Engineering an 800xA SystemChapter 3 Type design

    3-22

    5. The Interaction Attributes defines the kind of data (property) the Input Fieldshould 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 ModuleType CM_GenGeneration .

    8. Select a variable click the button Replace

  • 8/19/2019 C03 - Type Design V2-1

    23/23


Recommended