Documente Academic
Documente Profesional
Documente Cultură
3QPL4H
VERSION CREATED ON / VERSION / STATUS
IT Technical Specifications
Author
CoAuthor
Reviewers
Approver
Read Access
Name
Evrard B.
Approval Process
Action
09-Feb-2011:signed
Klotz W.- D.
Wallander A.
Bora D.
Affiliation
IO/DG/DIP/CHD/CODAC/CDC
15-Mar-2011:recommended
IO/DG/DIP/CHD/CODAC
09-Feb-2011:recommended
IO/DG/DIP/CHD/CODAC/CDC
18-Mar-2011:approved
IO/DG/DIP/CHD
Document Security: level 1 (IO unclassified)
RO: Journeaux Jean-Yves
AD: ITER, AD: External Collaborators, AD: Section - CODAC, project administrator, RO, LG: PLC group,
LG: CODAC team
Version
v1.3
v1.2
Latest Status
Approved
Signed
Date
09 Feb 2011
10 Jan 2011
v1.1
Signed
04 Jan 2011
v1.0
In Work
06 Dec 2010
Change Log
Description of Change
Version after external review of PCDH V6.
Integration of John Poole Comments.
Ready for External Review.
Version after CODAC internal review.
Version ready for external review.
Status
Date
Summary of Changes
1.0
Draft
13/12/2010
Draft
1.1
Issued
04/01/2011
1.2
Issued
10/01/2011
Page 1 of 58
Table of Contents
Table of Contents ........................................................................................................................2
Table of Figures...........................................................................................................................5
1
Introduction.........................................................................................................................6
1.1
PCDH Context.............................................................................................................6
1.2
1.3
Scope.............................................................................................................................6
1.4
Organization of document..........................................................................................7
1.5
Acronyms .....................................................................................................................7
1.6
Definitions....................................................................................................................8
1.7
4.2
4.3
Hardware input/output interface ............................................................................15
4.3.1 General Description ................................................................................................15
4.3.2 Input/Output Wrapper.............................................................................................17
4.3.3 Interface Switch ......................................................................................................18
4.3.4 Anti-Rebounce ........................................................................................................18
4.3.5 Engineering Limits..................................................................................................18
4.3.6 FBS Wrapper ..........................................................................................................18
4.3.7 Electrical Signal to Engineering/Engineering to Electrical Signal Conversion......18
4.3.8 Standardization .......................................................................................................18
4.3.9 Forcing ....................................................................................................................19
4.4
4.5
4.6
System Monitoring....................................................................................................20
5.2
Block Naming Convention .......................................................................................22
5.2.1 Core Application Blocks naming convention .........................................................22
5.2.2 Peripheral Blocks and Generic Functions naming convention ...............................25
5.3
Variables naming convention ..................................................................................25
5.3.1 Imput and Output variables.....................................................................................25
5.3.2 DB variables............................................................................................................25
6
Page 2 of 58
6.1
6.2
Project Config............................................................................................................31
Symbol Table.....................................................................................................................37
SPSS Description.......................................................................................................38
9.2
SPSS Creation Procedure.........................................................................................39
9.2.1 Hardware Configuration .........................................................................................39
9.2.2 Import the Standard PLC Software Structure from external source files............40
9.2.3 Import the Standard PLC Software Structure from STEP7 Archive...................41
10
10.3
10.4
10.5
10.6
11
10.2
Languages ..................................................................................................................48
11.3
11.4
11.5
Siemens Libraries......................................................................................................52
11.6
ITER library..............................................................................................................53
11.7
11.8
12
13
Version Control.................................................................................................................56
14
Annexes ..............................................................................................................................57
14.1
14.2
Page 3 of 58
14.3
Page 4 of 58
Table of Figures
Figure 1: CODAC Architecture ________________________________________________9
Figure 2: PLC Conceptual Architecture_________________________________________11
Figure 3: PLC Core Application Environment____________________________________12
Figure 4: Simple Example of CODAC HMI ______________________________________13
Figure 5: Collaborative Data _________________________________________________14
Figure 6: Hardware Inputs/Outputs Interface Block Diagram _______________________15
Figure 7 : Control Block of a FBS Level 4 Function._______________________________23
Figure 8 : Step 7 Language Setting. ____________________________________________27
Figure 9 : Step 7 Date and Time of Day Format. _________________________________28
Figure 10 : LAD/FBD Layout. ________________________________________________29
Figure 11 : Block Sources. ___________________________________________________30
Figure 12 : Symbol Editor Import. _____________________________________________31
Figure 13 : Address .Priority._________________________________________________32
Figure 14 : STEP 7 HW Config Screen for a CPU Stations with 3 Remote IO
Racks. _______________________________________________________33
Figure 15 : CPU Config Clock Memory Setup____________________________________34
Figure 16 : CPU Config Startup_______________________________________________34
Figure 17 : CPU Time-of-Day Synchronization. __________________________________35
Figure 18 : Remote IO Rack Board organization. _________________________________36
Figure 19 : Main Cycle Loop Standard Structure _________________________________38
Figure 20 : 100ms Cycle Loop Standard Structure ________________________________39
Figure 21 : Warm Restart Block Standard Structure _______________________________39
Figure 22: Hardware configuration compiled to generate System data. ______________40
Figure 23: Add standard software structure as external source. ______________________41
Figure 24:UDTs and DBs organisation and dependencies for Control Function
CWS-DHLT-WFC. ___________________________________________44
Figure 25:UDTs and DBs organisation and dependencies for TCP connexion
parameters. ___________________________________________________44
Figure 26: Core Application Development Life Cycle ______________________________47
Figure 27: Closed Loop Control Example _______________________________________52
Figure 28: Conceptual Design of a Control Function in the Core Application ___________53
Figure 29: Standard Implementation of a Control Function in the Core Application______54
Page 5 of 58
1 Introduction
1.1 PCDH Context
The Plant Control Design Handbook (PCDH) [RD1] defines methodology, standards,
specifications and interfaces applicable to ITER plant systems Instrumentation & Control
(I&C) system life cycle. I&C standards are essential for ITER to:
PCDH comprises a core document which presents the plant system I&C life cycle and recaps
the main rules to be applied to the plant system I&Cs for conventional controls, interlocks and
safety controls. Some I&C topics will be explained in greater detail in dedicated documents
associated with PCDH as presented in Figure 1.1. This document is one of them.
PS CONTROL DESIGN
Plant system I &C architecture (32GEBH)
Methodology for PS I &C specifications (353AZY)
CODAC Core System Overview (34SDZ5)
I&C CONVENTIONS
I&C Signal and variable naming (2UT8SH)
ITER CODAC Glossary (34QECT)
ITER CODAC Acronym list (2LT73V)
Legend
This document
Available and approved
Expected
( XXXXXX) IDM ref.
Provide rules to establish a standard approach for the development of control functions.
1.3 Scope
PLC Software Engineering Handbook
Page 6 of 58
This document covers the development of software for PLC conventional controllers. It does
not cover SIL-3 PLCs, Simatic F/FH Series, interlock (PIS) or safety (PSS) controllers.
Interfaces
1.5 Acronyms
CFC
COS
DB
FB
FBD
FBS
FC
I/Q
Page 7 of 58
LAD
PBS
PCDH
PLC
PSH
SDD
SFB
SFC
SSPS
UDT
Ladder Diagram
Plant Breakdown Structure
Plant Control Design Handbook
Programmable Logic Controller
Plant System Host
Self Description Data
System Function Block
System Function Chart
Standard Software PLC Structure
User Data Type
1.6 Definitions
PLC Application
PLC Core Application
Shared DB variable
Process Variable
Plant System I&C
Programmer
Peripheral Blocks
Configuration
Configuration Variable
States
State Variable
Standard Control Block
Interface
Control Function
Control Block
[RD 1]
[RD 2]
[RD 3]
[RD 4]
[RD 5]
IDM Number
2UT8SH
28QDBS
34V362
353AZY
2FJMPY
[RD 6]
32GEBH
Title
I&C Signal and Process Variable Naming Convention
PLC Software Engineering
The CODAC Plant System Interface
Methodology for PS I&C design
ITER Function Category and Type for ITER Numbering
System
Plant System I&C Architecture
Page 8 of 58
[RD 7]
[RD 8]
[RD 9]
[RD 10]
[RD 11]
32Z4W2
35W299
34BVGT
333J63
27LH2V
Page 9 of 58
Page 10 of 58
Flexibility.
o During integration and commissioning, all interfaces may be not available. The
application should allow some signals to be forced, or the partial simulation of
the missing interface.
Maintainability
o Sufficient system information should be provided.
o The PLC application should be built in a way that modifications have only local
impact.
Ability to be tested.
o Unit testing of PLC functions should easy.
o Control systems software should be tested independently from the system. The
idea is to test the control system when it is connected to a simulator rather than
the system. The plant system designer has to define beforehand which
controllers have to be tested together.
Readability
o Every information transformation should be easy to track.
Page 11 of 58
PLC
2
CODAC interface
8
12
11
System
Monitoring
PLC Core
Application
6
10
13
PLC
Interface
Fast
Controller
Interface(s)
PLC(s)
Fast
Controller(s)
11
5
Equipments
PIS
PSS
COTS
Simulator
A Master Controller, in an I&C architecture (see [RD 6]) will not have any hardware
Input/Output interface but will have a lot of interfaces with other PLCs in the plant system.
Fast controller interfaces will probably be very rare and may use the CODAC interface, as
Fast Controllers are running EPICS and are consequently connected to Channel Access.
TBD
Except for the PLC core application, the internal structure of all other blocks will be standard
for all PLCs deployed on the project. Only the volume and structure of the data computed in
these blocks will be different. As far as possible, these blocks will be generated automatically,
using the configuration database as input. The CODAC interface (2on Figure 2) will be fully
generated by the SDD package. The static internal structure for the other blocks will be
described in this document. Further generation activities will be based on these structures.
Page 12 of 58
Collaborative
Datas
States Variables
Outputs
Controller
Interface(s)
Inputs
Page 13 of 58
Easy Comparaison of
Configuration and State
Easy Comparaison of
Configuration and State
Power Supply
Power Supply
State
Configuration
Configuration
ON
Amps
ON
95.00
Amps
95.00
State
ON
Amps
95.00
Interlocks
OFF
Amps
0.00
Interlocks
Temperature OK
Temperature OK
24 VDC OK
24 VDC OK
Fuse OK
Fuse OK
Power OK
Power OK
Normal Operation
Page 14 of 58
Directly from the hardware I/O interface (6in Figure 2 ). This direct link is necessary
as the CODAC core applications use these variables without requiring computing in the
PLC core application.
It is important to note here that these variables are in engineering units, and they can
also can be forced or simulated.
From the computed variables issued by the PLC core application (7in Figure 2 ).
From the system monitoring (9in Figure 2 ).
Simple commands are variables set to TRUE during one cycle in the PLC. These simple
commands are used in the cases where it is not necessary to memorize the action related to this
command, as is the case for configuration variables. Typical examples are Reset of some
devices. Reset is not a stable configuration, it is a transient command.
Collaborative data are state variables transmitted between plant system I&Cs. A strong
requirement of the PCDH is a that no transverse physical link is allowed between plant system
I&Cs. Any such link must be in the form of a software link between 2 PLCs from 2 different
plant system I&Cs. This collaborative data will be state variables with the specific
classification of Collaborative Data.
Note, that if several controllers have to share the same information (e.g. a temperature, or a
pressure) it is important that this information has exactly the same origin.
Page 15 of 58
Codac Interface
Configuration
States
Hardware Inputs
interface
Hardware Outputs
interface
Forcing
Forcing
Analog
Electrical Signal
to Engineering
Conversion
Digital
Analog
Digital
Engineering
Limits
Standardization
Digital
Analog
Engineering to
Electrical Signal
Conversion
FBS Wrapper
Standardization
Digital
Analog
Analog
Anti-Rebounce
FBS Wrapper
Digital
Interface Switch
Inputs Wrapper
Wiring
Plant System
Interface Switch
Simulator
Interface
Outputs
Wrapper
Wiring
RawSocket
Simulator
Interface
RawSocket
The signal is wired between the plant system and the input board of the PLC .
Page 16 of 58
In a first software function called the Inputs Wrapper (2), the signal is copied from an
I/O addressing area to a DB addressing area, e.g. Input I0.0 is copied to
DB1.DBX0.0.
Note: PLC absolute addressing is used here for better understanding, but symbols
should be used. The signal now becomes a shared DB variable.
If the signal is Boolean (originally coming from a digital signal), the variable goes
through through an Anti-Rebounce layer.
The shared DB variable is transmitted to an Interface Switch block where the
decision is made to use the wired signal or a signal coming from a simulator. Another
shared DB variable is issued.
The shared DB variable issued is transmitted to an FBS Wrapper, where the variable
is copied from a component naming convention (PPPPPP-TTT-NNNN:AAAASSSS)
to an FBS Level 3 convention (FBS-L3.variable). See [RD 1]. Another shared DB
variable is issued.
From the FBS Wrapper, the shared DB variable can be processed, depending if it is a
numerical (originally form an analog signal) or a boolean variable (originally from a
digital signal).
o Numerical variable: is transformed to an engineering value according to a linear
regression, or a look up table, etc (Signal to Engineering Conversion (5)).
Another shared DB variable is issued.
o Boolean variable: here the Boolean value can be negated or not, depending on
the logic the developer wants to use in the core application. For example, in
order to have fail-safe logic, the status of a device could be notified by a 0V
signal, which is more convenient for encoding a TRUE. (Standardization
Layer (6)). Another shared DB variable is issued.
The variable goes through a Forcing layer (7), where its value can be forced by the
user for commissioning or maintenance purposes. The variable is issued by the
hardware input interface.
The variable is systematically transmitted to the States Variables (8) transmission
mechanism of the CODAC Interface and can be used by the PLC core application (9).
Page 17 of 58
system transmits these variables to the CODAC interface. The purpose is to have CODAC raw
values available on a system screen for debugging purposes.
4.3.4 Anti-Rebounce
TBD
4.3.8 Standardization
The idea here is to standardize the code in the PLC core application as much as possible. The
same type of devices should always be controlled with the same PLC function. In reality, the
same type of devices will sometimes be wired with different logic. For example, a valve: the
limit switches of some valves will be wired with positive logic (24VDC position reached)
and some with negative logic (0VDC position reached) whilst control of the valve is
identical.
Page 18 of 58
The function of this standardization block would be to process the negation required for all
discrete signals, in order to present a standard signal interface for the different types of devices
to the PLC core application.
All the negation parameters will be provided by CODAC configuration variables.
4.3.9 Forcing
During integration, commissioning and sometimes during maintenance, it is normal that
engineers will want to force some signal variables to a specific value, because the related signal
is not connected, missing, is not operational or has failed. It is better to take this fact into
account in the software design, so that this irregular (and possibly dangerous) behaviour will
be controlled. The aim is to avoid dangerous temporary-permanent practices like forcing a
signal with PLC hardcoded modifications, hardwired modifications, strapping of relays etc.
This forcing layer has to be developed and in particular:
- some signals cannot be forced at any time because this could be destructive.
- The control unit (or the all I&C) may not be able to reach an operational state as long as
signal variables are forced.
- Inhibiting this forcing feature.
All permanent and runtime parameters will be provided by CODAC configuration variables.
Page 19 of 58
In a master/slave architecture, the master will send orders to the slaves. A communication
paradigm has to be defined for these orders. TBD
The technology used will be defined in a later paragraph.
Page 20 of 58
Siemens Default
UDT
System
CODAC Reserved
Application Specific
1..99
100..299
300..65535
DB
CODAC Reserved
Shared
Instance
Application Specific
Shared
Instance
1..49
50..99
100..299
300..999
FC
System
CODAC Reserved
Application Specific
Siemens Default:1..99
100..199
200..999
System
CODAC Reserved
Application Specific
Siemens Default:1..99
100..199
200..999
FB
SFC
Siemens Default
Page 21 of 58
SFB
Siemens Default
There will be one FC in the PLC for control of the WFC. An FBD representation of a Siemens
control block for the WFC is presented in Figure 7. The figure illustrates an example with an
FC and an example with an FB.
Page 22 of 58
FC WFC
(FB WFC": iWFC01)
"CodacConfiguration".WFC.CAConf
CIConf
CIStates
"CodacCommands".WFC
CICmd
PIOut
"dWFC".PIIn
PIIn
"CodacStates".WFC.CAStates
"dWFC".PIOut
...
...
In core application blocks, FCs will be named according to the lowest FBS level
control function they implement. The upper levels are not required in the name.
.
In many cases, the same control function will be instantiated many times. In this case, the use
of a unique FB with several instances is more adapted. In the hypothetical case where there are
several WFCs, an FB called WFC would be defined and the instance DBs would be named
iWFC01, iWFC02, the control function names were WFC01, WFC02, etc. In Figure 7
this is represented by the block name in brackets.
[NR 5]
In core application blocks, FBs will be named according to the FBS level function
type they implement. The instance DB will be named according to the lowest FBS
level function instance.
.
The following will be developed in 11 but every core application control block will have the
same interface, decomposed in 5 connexions. This interface will be known as the standard
control block interface.
CIConf, the configuration variables sent by the CODAC.
CICmd, the simple commands sent by the CODAC.
CIStates, the state variables sent to the CODAC.
PIIn, the process interface inputs. All input signals of the controlled device.
PIOut, the process interface outputs. All output signals of the controlled device.
[NR 6]
In control blocks, the 5 connections of the standard control interface will be named :
CIConf, CICmd, CIStates, PIIn, PIOut.
.
Each connexion is defined by a UDT. These 5 UDTs are specific to the function or function
type. Each UDT will be composed of the variable of the interface it is defining. The name of
the UDT is subject to rules. In the example of the CWS, one would have:
For CIConf:
UDT
PLC Software Engineering Handbook
Variable
Page 23 of 58
"_WFC_CIConf"
Name
CWFC
HSRQ
PT2SP
LFSP
HFSP
Type
BOOL
BOOL
REAL
REAL
REAL
For CICmd:
UDT
"_WFC_CICmd"
Variable
Name
Type
dummy
BYTE
For CIStates:
UDT
"_WFC_CIStates"
Variable
Name
Type
STOPWFC
BOOL
LFST
BOOL
HFST
REAL
For PIIn:
UDT
"_WFC_CIStates"
Variable
Name
PL1_CY
PL1_YT
VC8_FVY
MP2_PT
MF1_FT
PL1_SY
Type
BOOL
BOOL
BOOL
BOOL
BOOL
REAL
For PIOut:
UDT
"_WFC_CIStates"
Variable
Name
Type
PL1_CZ
BOOL
VC8_FVZ
BOOL
PL1_CS
REAL
UDTs related to the standard control block interface will be named according to the
following pattern:
_+<Control Block Name>+_+<Connection Type>.
<Connection Type> can be the names defined in [NR 6].
Inside these UDTs, the variable names are those defined in [RD 8]. These names follow the
naming rules defined in [RD 1] for signals.
Page 24 of 58
[NR 8]
In UDTs defining the PIIn and PIOut interfaces, the variable names have to
follow the FBS signal name rules, defined in [RD 1].
For UDTs defining CIConf, CICmd and CIStates, no strict convention is applied as yet,
except that they have to be in capital letters.
Peripheral blocks and generic blocks will be named with an undefined number of
fields, each field beginning with a capital letter. The rest of the field will be in lower
case letters.
Inputs and outputs will be named according to their full PBS name. As the PBS
name begins with a number and this is not accepted by STEP 7, the name will begin
with a p. Dashes and colons will be replaced by underscores ( _).
Examples:
p26PHDL_PL_1_CY_CCC;
p26PHDL_PL_1_YT_CCC;
p26PHDL_VC_8_FVY_CCC;
p26PHDL_MP_2_PT_CCC;
p26PHDL_MF_1_FT_CCC;
p26PHDL_PL_1_SY_CCC;
p26PHDL_PL_1_CS_CCC;
p26PHDL_PL_1_CZ_CCC;
p26PHDL_VC_8_FVZ_CCC;
5.3.2 DB variables.
Naming rules of variables inside DBs will be detailed in 10, along with the details of
peripheral block development.
Page 25 of 58
Page 26 of 58
Page 27 of 58
3. LAD/FDB Layout
In LAD/FBD/STL editor menu, choose Options/Customize/LAD/FBD. Choose DIN A4
Landscape as Layout.
Page 28 of 58
4. LAD/FDB/STL Sources.
In LAD/FBD/STL editor menu, choose Options/Customize/Sources. Check Generate
Sources automatically, Symbolic Identifier of the Block., Symbolic Adresses.
Page 29 of 58
Page 30 of 58
Page 31 of 58
7 Hardware Config
When creating a PLC STEP7 application, the first step is to create the S7 Project and
configure the hardware. This chapter gives the rules to be applied when choosing
parameters. Most of the parameters are the default ones. The rules below address the
exceptions.
All hardware components must be chosen in the PCDH Catalog. See [RD 10].
Figure 14 : STEP 7 HW Config Screen for a CPU Stations with 3 Remote IO Racks.
1. CPU Configuration
Immediately a CPU is inserted in a Rack, (Figure 14 1) the first parameter
requested is the IP address on the network. This interface is connected to the PON.
CODAC manages the IP address plan of the PON and will provide the information.
The rest are the default parameters. There is no need to configure a network. It will
be required when PLCs are interconnected in the plant system and this is discussed
in 10.3.
Double-Click on the CPU in the hardware config (Figure 14 1) and choose the
General tab. In the Comment text field, introduce the PBS number of the PLC,
the cubicle PBS and location.
Choose the Cycle/Clock Memory tab. Check Clock Memory and introduce
100 in the Memory Byte field. (Figure 15)
Page 32 of 58
Choose the Startup tab. Check Cold Restart for Startup after Power On. (Figure
16)
Page 33 of 58
Page 34 of 58
1: Digital
Inputs
2: Digital
Outputs
3: Analog Inputs
3.1: 0..10V,
4-20mA, ...
Rack 1:
IM
Inputs:
0..3
512..
527
4..7
8xAI
528..
543
4: Analog
Outputs
3.2:
RTD
3.3:
TC
8xAI
8xAI
RTD
TC
544..
559
560..
575
8xAQ 8xAQ
0..3
4..7
512..
527
528..
543
Page 35 of 58
8 Symbol Table
Most of the rules for editing activities in the symbol table are covered by the naming and
numbering rules. However, an important additional rule is to declare all numerical inputs and
outputs as INT or DINT. The symbol table declares them as WORD by default. This only
makes sense for a few status information. If these signals are declared as WORD, it requires an
additional conversion WORD-> INT before processing.
This concerns: PIW, IW,PQW and QW address types.
Page 36 of 58
CodacTimeStamp (FB105)
// Read System Clock of PLC
READ_CLK
.
InputsProcessing
CodacTimeStamp
Process (FC200)
// Core Applications
// Example : WFC
// Operationnal functions
Process
OutputProcessing (FC102)
// Post operationnal functions
// TBD
.
OutputsProcessing
ResetDB
ResetDB (FC116)
// Reset of All Simple
Commands Received from
CODAC
CYCL_100ms (OB35)
CodacInterface
Page 37 of 58
WARM_START (OB100)
CodacConnectionInit(FC115)
CodacConnectionInit
// Initialization of TCP
Communication port at
Startup
Page 38 of 58
2. Edit the hardware of this station using HwConfig which is opened by double-clicking the
Hardware. Add a rack and populate the rack with appropriate power supply and CPU.
Refer to the PLC catalog for appropriate references [RD 10]. Other CPUs can be used as
long as they have an ethernet interface and they support Open IE Communication.
Nethertheless, CPUs not included in the catalog will not be supported by CODAC.
3. Using NetPro specify the IP addresses of the CPU and CP modules in the rack (see
7).The IP addresses must be same as previously configured in the CPU.
4. The hardware configuration should be saved and compiled either in HwConfig or
NetPro. After the hardware configuration is compiled it is reflected as system data in
the CPU | S7 Program | Blocks folder under the Simatic Station. See Figure 22.
9.2.2 Import the Standard PLC Software Structure from external source
files.
Page 39 of 58
4. Insert the external source from the "StandardSWStructure.AWL" file in the CPU | S7
Program | Sources folder and compile. The compilation should not give any errors if steps
2 and 3 are performed correctly.
5. For S7-400 CPU, insert the "StandardSWStructure400.AWL" file in the CPU | S7
Program | Sources folder and compile to perform the S7-400 specific initialization.
6. For S7-300 CPU, insert the "StandardSWStructure300.AWL" file in the CPU | S7
Program | Sources folder and compile to perform the S7-300 specific initialization.
9.2.3 Import the Standard PLC Software Structure from STEP7 Archive
1. In Simatic Manager open the codacstd.zip file (File | Retrieve) to create a STEP7
project which includes the S7 Program folder containing SPSS.
2. Configure the PLC hardware as described in 9.2.1.
3. Drag and drop the S7 Program folder to the PLC-CPU.
4. Compile the hardware through HwConfig or NetPro.
5. For S7-400 CPU, compile the "StandardSWStructure400" in the CPU | S7 Program |
Sources folder to perform the S7-400 specific initialization.
6. For S7-300 CPU, compile the "StandardSWStructure300" in the CPU | S7 Program |
Sources folder to perform the S7-300 specific initialization.
Page 40 of 58
CodacStatesHeader (UDT)
cWBS (UDT)
+ FixedPattern=0x02F08000 : DINT
+ Length: INT
+ InterfaceVersion: String[40]
sWFC (UDT)
+ CWFC : BOOL;
+ HSRQ : BOOL ;
+ PT2SP : BOOL;
+ LFSP : REAL;
+ HFSP : REAL;
...
+ Header : CodacStatesHeader
+ WFC : sWFC
+
+ AliveCounter: INT
+ TimeStamp: DATE_AND_TIME
+ Footer : CodacStatesFooter
c<FBSL[2,3,4]> (UDT)
cmWBS (UDT)
Footer (UDT)
CodacConf (DB101)
+ WBS : cWBS
...
CodacStates (DB100)
+ PL1_CY : BOOL;
+ PL1_YT: BOOL;
+ VC8_FVY: BOOL;
+ MP2_PT: BOOL;
+ MF1_FT: BOOl;
+ PL1_SY: REAL;
+ STOPWFC: BOOL;
+ LFST: BOOL;
+ HFST: BOOL;
...
s<FBSL[2,3,4]> (UDT)
n
CodacCmd (DB102)
+ INIT : BYTE;
+RESET : BYTE;
+ ACK : BYTE;
...
1
cm<FBSL[2,3,4]> (UDT)
+ WBS : cmWBS
+ ...
+ FixedPattern=0xFD0F7FFF : DINT
Page 41 of 58
Figure 24:UDTs and DBs organisation and dependencies for the Control Function CWSDHLT-WFC.
_CodacConnection (UDT)
+ CONN_ID : INT;
+ DEV_ID : BYTE;
+ PORT : INT;
+ INIT_COM : BOOL;
+ SEND_DB : BYTE;
+ RECV_DB : BYTE;
_CodacChannel (UDT)
+ SEND_LEN : INT;
+ RECV_LEN : INT;
CodacConnections (DB103)
+ Channel1 : _CodacConnection;
+ Channel2 : _CodacConnection;
CodacChannels (DB104)
+ Channel1 : _CodacChannel;
+ Channel2 : _CodacChannel;
Figure 25:UDTs and DBs organisation and dependencies for TCP connexion parameters.
10.1.2Generation procedure
The different STEP 7 components described in the previous chapter will be integrated in source
files automatically generated by the SDD. SDD is a CODAC toolkit used to describe the
interface with a PLC and the STEP 7 and PSH files required to build this interface are
generated automatically. The SDD toolkit generates a set of plant system specific symbol table
(*.sdf) files and an STL (*.awl) file. These files implement the CodacStates,
CodacConfiguration and CodacCommands data blocks and initialize the CodacChannels
data block. The following screenshot shows an example of SDD editor-generated files for the
Cooling Water System. The use of SDD is described in [RD 7]
Page 42 of 58
Figure 3: Adding a plant system specific STL file generated by SDD Editor.
After the SPSS is built, the symbol table (*.sdf) file and the STL (*.awl) file should be
imported to the STEP 7 project as described below.
1. Open the symbol table and import the plant system specific symbol table (*.sdf) file and
save.
2. Insert external source from the plant system specific SDD generated *.AWL file in the
CPU | S7 Program | Sources folder and compile.
10.5Simulator interface
TBD
Page 43 of 58
Page 44 of 58
Project
Design
Phase
Requirements Specifications
Functionnal
Analysis
Coverage
Design
Project
Manufacture
Phase
Coding/Unit Testing
Facultative
Project
FAT
Phase
Integrated Validation Testing
Project
SAT
Phase
Page 45 of 58
Usually, a PLC developer is in charge of one (or several) high-level function, distributed on
one or several PLCs (*). It is suggested that one life-cycle is covers the activity of one highlevel function, and thus the activity of one PLC developer.
The life cycle is nothing more than the different steps followed in a normal software
engineering life cycle. The only originality here is in the addition of an integrated validation
testing stage.
As the detailed design of the plant system I&C will be completed as the software development
begins, a full set of documents will be available, broken down in 9 deliverables as defined in
the PCDH. These deliverables will include the I&C hardware architecture, a functional
analysis, a list of Inputs/Outputs, etc.
(*) Note that it is also recommended not to have more than one PLC developer on one PLC.
PLC development environments are not well suited to collaborative development.
11.1.1Requirements Specification
Software requirements are fully covered during the I&C design phase. They will be mainly
covered in the functional analysis, but other inputs such as state machines and control
philosophy will also be used (see PCDH).
11.1.2Design Specification
2 phases in the Software Design are considered: an architectural design and a detailed design.
The architectural design will be also covered by the functional analysis, as it will define the
main treatment blocks inside the core application. It is not required that the peripheral blocks
are defined, as they will all be developed according to templates or will be generated
automatically.
The detailed design consists of defining how all the functions will be implemented. The
following information should be provided for each controller at this step:
- The naming and numbering of each programming block: OB,FC,FB,DB
- The full program structure of each OB, for the core application section.
- Any specific hardware, network, project or configuration used.
- Any deviation from the rules defined in this handbook.
All this information will be gathered in PCDH [D31]
11.1.3Coding/Unit Testing
Coding and unit testing will be performed simultaneously. It has been proved that unit testing
drastically improves the reliability and robustness of the code produced.
This means that every FB and FC has to be tested independently. The standard architecture
makes this easier, as the core application has no direct external interface. So any interface of a
block programmed in the core application can be replaced by a variable in order to simulate the
behaviour of the interface.
Unit testing doesnt require a formal document. However, if too many mistakes are noticed
during the validation phases, a formal unit test document may be requested by IO
Page 46 of 58
The principle is to have a simulation test performed before the test with the system connected.
There are several purposes:
- The real system does not even have to be connected/ready for testing activities. Their
life cycles can be desynchronised until connection.
- Tracking of as many functional problems as possible before connecting to the real
system. The software will be more mature at the time of the connection, so less time
will be lost in software troubleshooting during system testing.
- When the I&C is composed of several controllers, it will be possible to test the I&C in
its integrality even when the systems have been procured separately.
- If simulation is available, corrective and adaptative maintenance will be possible
without having the system connected.
This phase is optional, as it may not make a lot of sense for small plant systems.
For large plant systems with many controllers, simulation will cover only low level
functionality. The development of complex algorithms with multiple couplings is too time
consuming and does not add value.
However, it is strictly recommended and the simulation strategy is described in PCDH [D30].
The development of the simulator and the development of the control units will be done by
different people. Thus different understandings of how the control system should operate will
be brought face to face at an early phase of the project.
The simulator will be connected to the controllers through the field network. It will read/write
the shared DB variables defined in the controller simulation layer. These variables will replace
the controllers real I/Os . There is no requirement so far concerning the technology to be used
for development of the simulator, but the simulator will be delivered to IO after FAT. [D
TBD].
A validation book for this phase has to be provided before the beginning of validation. [D
TBD]: Validation book
11.2Languages
The languages allowed in the application will be those defined in IEC 61131-3:
IEC61131-3 Language Name
Siemens Equivalent
Page 47 of 58
Siemens CFC (Flow Charts) will not be allowed in conventional controllers. Firstly, they are
not defined in IEC 61131-3 and secondly, there is the major drawback that CFCs cannot be
mixed with other languages. TBC. However, CFC will be used for redundant architectures,
deployed in interlock and safety systems. This topic is not covered in this document.
Siemens HiGraph (Petri Nets) will not be allowed either, because they are not defined in
IEC 61131-3.
It is almost possible to implement anything in any language, however, every language has its
own characteristics and has been created in order to solve particular problems. The following
rules have to be applied in order to keep the PLC program as clean and readable as possible:
LAD and FBD will be used to implement boolean logic and interlocking. Typically all
the logic required to start/stop a device will be implemented in LAD. No complex
numerical computation is allowed in LAD and FBD. The choice of LAD or FBD is left
to the programmer. Usually electrical engineers use LAD and electronic engineers use
FBD. The choice is arbitrary since the representation can be switched LAD to FBD in
STEP7 (see below).
SCS will be used to implement sequences (GRAFCET), but output will not be written
directly in GRAFCETS (See 11.4).
SCL will be used to implement complex numerical algorithms, loop algoritms, complex
state machines or Petri nets where a sequence (SCS) is insufficient. As SCL is a
structured language, quite close to Pascal, it is much more readable than STL.
STL will be avoided as far as possible because assembler is not easy to read or maintain
by people who did not write the code. It will be used only in cases where, for example,
a specific instruction is not available in SCL or optimization of performance is required.
Mixing of languages in one block is allowed as long as it respects the rules defined in 11.4.
and in 11.8.
Page 48 of 58
SCL uses a specific text editor. After editing, the code is compiled in uncommented LIST
blocks. These blocks can be viewed in STL, but any modification done in STL will corrupt the
text representation. SCL is a particular case as the code is first saved in the project Sources
folder and stored in the Blocks folder after compilation.
Controller
System
Configuration
Variable
Configuration
Variable
Configuration
Variable
Open Loop
Mode
Open Loop
Setpoint
Setpoint
State
Variable !!
PID
Actuator
System
Captor
State
Variable
Page 49 of 58
The interlocks and control logic part mainly manages the digital process outputs of the
control function. It is influenced by the state management and the process inputs. The
principle is that the command of an actuator is written only at one place in the code, in
order to make the code easier to read and maintain. A logic diagram gathers:
o All process conditions required to ensure that the actuator is technically ready.
o State conditions.
The control loop manages the continuous (analog) process outputs. It is influenced by
the continous process inputs and the state management. It is very often necessary to
change the configuration of the control loop according to the operational state, e.g.
change the setpoint, open the loop, inhibit the integral action, etc..
State Management
Process
Inputs
CODAC
Process
Inputs/
Outputs
Control Loop
Process
Inputs/
Outputs
Page 50 of 58
Control loop
State Management
Control Loop
Control Loop
11.5Siemens Libraries
Page 51 of 58
Siemens STEP 7 provides a System Library. Some blocks are allowed, some other ones are
prohibited.
TBD
11.6ITER library
ITER will provide a library for most of the common standard functions deployed on the
project.
TBD
11.7Alarms Management
Alarms are managed in CODAC. No specific programming is required regarding alarms. If a
combination of information is required in order to generate an alarm in CODAC, it will be
included in the regular control blocks and this information will be transmitted to CODAC in a
state variable.
11.8Coding Rules
[CR 1]
[CR 2]
[CR 3]
[CR 4]
The passing or arguments from one block to another will be done through the
interface of the FBs or FCs: Input Variable, Output Variable. Use of shared DB
global variables directly in the control block is prohibited. However, this is not
always technically possible, so exceptions will be clearly stated in PCDH [D31].
This rule will:
- make the code portable
- shorten the length of variables inside blocks, as local variables names do not have
to include name of the block.
- make unit testing of blocks easier.
Page 52 of 58
[CR 5]
Use only shared DB variables, instead of mementos. The advantage of using DBs is
that variables can be grouped functionally. This helps in the structuring the code.
Consequently the use of mementos is prohibited.
[CR 6]
Use clock memories as far as possible. Clock memories can be used to generate up
to 50 ms delay. This is delay is sufficient to manage most industrial control
problems.
This makes the code more portable and easier to unit test. This is an enforcement of
[CR 1].
[CR 7]
Organization blocks will include only calls to control blocks. The implementation
of logic in the OBs is prohibited.
[CR 8]
[CR 9]
[CR 10]
[CR 11]
The use of the Enable inputs of LAD and FBD blocks is prohibited.
[CR 12]
[CR 13]
Page 53 of 58
12 Simulator Development
TBD
Page 54 of 58
13 Version Control
TBD
Page 55 of 58
14 Annexes
14.1Already Reserved Blocks and for CODAC
Block Symbol
_CodacStatesHeader
_CodacStatesFooter
_CodacConnection
_CodacChannel
CodacStates
Block
Number
UDT 100
UDT 101
UDT 110
UDT 111
DB 100
Bloc Type
UDT
UDT
UDT
UDT
DB
100
101
110
111
100
CodacConfiguration
CodacCommands
DB
DB
101
102
DB
DB
101
102
CodacConnections
DB
103
DB
103
PlcHwiWiredInputs
DB
DB
PlcHwiWireOutputs
DB
DB
PlcHwiSimInputs
DB
DB
PlcHwiSimOutputs
DB
DB
PlcHwiInputs
PlcHwiOutputs
iCodacChannel1
DB
DB
DB
5
6
50
DB 5
DB 6
FB 110
iCodacChannel2
DB
51
FB
110
CodacTimestamp
CodacChannel
FB
FB
105
110
FB
FB
105
110
CodacInterface
InputsProcessing
OutputsProcessing
FC
FC
FC
100
101
102
FC
FC
FC
100
101
102
Process
CodacSetTcpEndPointx
FC
FC
103
111
FC
FC
103
111
CodacConnectionInit
ResetDB
FC
FC
115
116
FC
FC
115
116
Description
CodacStatesHeader
CodacStatesFooter
Codac Connection
Codac Insterface States
Communications
Codac Interface Simple
Command Communications
Communication Parameters of
Codac Interface
Plc Hardware Interface Wired
Inputs
Plc Hardware Interface Wired
Outputs
Plc Hardware Interface Simulated
Inputs
Plc Hardware Interface Simulated
Outputs
Plc Hardware Interface Inputs
Plc Hardware Interface Outputs
Codac Interface States and
Configuration Channel (1)
Codac Interface Simple
Commands Channel (2)
Codac Interface Open
Communication Control
Codac Interface Communications
Hardware interface Outputs
Processing Block
Process Function Blocks
Codac Interface TCP Endpoint
Setting
Page 56 of 58
Variable Name
Address
Type
Description
SystemClockMemory
SysClock100ms
MB 100
M 100.0
BYTE
BOOL
SysClock200ms
M 100.1
BOOL
SysClock400ms
M 100.2
BOOL
SysClock500ms
M 100.3
BOOL
SysClock800ms
M 100.4
BOOL
SysClock1s
SysClock1600ms
M 100.5
M 100.6
BOOL
BOOL
SysClock2s
M 100.7
BOOL
FBS L2
PHTS
FBS L3
DHLT
FBS L4
WFC
Type
Digital Input
Digital Input
Digital Input
Digital Input
Digital Input
I&C Name
PL1-CY
PL1-YT
VC8-FVY
MP2-PT
MF1-FT
Speed measurement
Analog Input
PL1-SY
Digit Output
Digit Output
PL1-CZ
VC8-FVZ
Speed command
Analog Output
PL1-CS
Note that all the signals from the hardware interface are tramsmitted to CODAC as states.
The Water Flow Control Function will have the following interface with CODAC:
CODAC Classification
PLC Software Engineering Handbook
Signal
Type
I&C Name
Page 57 of 58
Configuration Variables
States Variables
Simple Commands (*)
WFC start/stop
High speed request
Delta P pump set point, range [2- 6 bars]
Low flow set point, range [100- 400
m3/h]
High flow set point, range [400- 800
m3/h]
Stop state achieved
Low flow state achieved
High flow state achieved
dummy
BOOL
BOOL
REAL
REAL
CWFC
HSRQ
PT2SP
LFSP
REAL
HFSP
BOOL
BOOL
BOOL
BYTE
STOPWFC
LFST
HFST
dummy
(*) WFC doesnt require any simple commands. A dummy one has been added to make the
example complete.
A single PLC will assume the DHLT Control. So the PLC will be a part of FBS level 3.
Page 58 of 58