PCS 7 - Programming Instructions For Blocks
PCS 7 - Programming Instructions For Blocks
PCS 7 - Programming Instructions For Blocks
Preface,
Contents
Creating AS Blocks 1
Index
11/2006
A5E00807905-01
Safety Guidelines
This manual contains notices you have to observe in order to ensure your personal safety, as well as to
prevent damage to property. The notices referring to your personal safety are highlighted in the manual
by a safety alert symbol, notices referring to property damage only have no safety alert symbol. The
notices shown below are graded according to the degree of danger.
Danger
! indicates that death or severe personal injury will result if proper precautions are not taken.
Warning
! indicates that death or severe personal injury may result if proper precautions are not taken.
Caution
! with a safety alert symbol indicates that minor personal injury can result if proper precautions are not
taken.
Caution
without a safety alert symbol indicates that property damage can result if proper precautions are not
taken.
Notice
indicates that an unintended result or situation can occur if the corresponding notice is not taken into
account.
If more than one degree of danger is present, the warning notice representing the highest degree of
danger will be used. A notice warning of injury to persons with a safety alert symbol may also include a
warning relating to property damage.
Qualified Personnel
The device/system may only be set up and used in conjunction with this documentation. Commissioning
and operation of a device/system may only be performed by qualified personnel. Within the context of
the safety notices in this documentation qualified persons are defined as persons who are authorized to
commission, ground and label devices, systems and circuits in accordance with established safety
practices and standards.
Prescribed Usage
Note the following:
Warning
! This device and its components may only be used for the applications described in the catalog or the
technical description, and only in connection with devices or components from other manufacturers
which have been approved or recommended by Siemens.
Correct, reliable operation of the product requires proper transport, storage, positioning and assembly
as well as careful operation and maintenance.
Trademarks
All names identified by ® are registered trademarks of the Siemens AG.
The remaining trademarks in this publication may be trademarks whose use by third parties for their
own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and
software described. Since variance cannot be precluded entirely, we cannot guarantee full consistency.
However, the information in this publication is reviewed regularly and any necessary corrections are
included in subsequent editions.
Siemens AG
A5E00807905-01 Copyright © Siemens AG 2006
Automation and Drives
11/2006 Technical data subject to change
Postfach 4848
90437 NÜRNBERG
GERMANY
Preface
Audience
These programming instructions are intended for developers of automation blocks
(PLC blocks) and/or faceplates that will be used and fully integrated in the same
systems as the PCS 7 process control blocks supplied by Siemens.
Requirements
To use these programming instructions, you therefore require experience in the
development and application of PLC blocks and faceplates and should be familiar
with the relevant hardware and software. These instructions describe only the
measures necessary to achieve conformity between blocks you have created
yourself and the PCS 7 blocks. Where necessary, you will find further information
in the documentation listed in the References at the end of this manual.
You will find general information on the use of PCS 7 components in the PCS 7
Configuration Manual.
General Outline
These programming instructions provide you with an overview of the individual
components of a PCS 7-compliant block. The order in which they are introduced is
the same order you would follow to develop function blocks and faceplates.
• You develop the "CONTROL" PLC block, a simple controller block, step by
step by first defining the block header, the parameters of the block and its local
variables. You then create the source code.
• The next step is to develop a faceplate. You create this with the WinCC
Graphics Designer and the elements of the Faceplate Designer.
• The last step is to develop an online help system for the block and then a
shippable library MYLIB made up of all the components.
As you work through the instructions, you will see the sections of the sample block
required to understand the current topic. Section 1.11 contains a printout of the
entire sample PLC block.
In the appendix, you will find a sample source code for MEAS_MON, MOTOR and
VALVE blocks contained in the PCS 7 library, as an example of PCS 7-compliant
blocks. You can use this source code - or part thereof - as a template for your own
blocks.
Note
The use of the sample source code contained in the appendix is the responsibility
of the user. There is no guarantee for error-free display.
Further Support
If you have any technical questions, please get in touch with your Siemens
representative or agent responsible.
You will find your contact person at:
http://www.siemens.com/automation/partner
You will find a guide to the technical documentation offered for the individual
SIMATIC Products and Systems here at:
http://www.siemens.com/simatic-tech-doku-portal
The online catalog and order system is found under:
http://mall.ad.siemens.com/
Training Centers
Siemens offers a number of training courses to familiarize you with the
Process Control System PCS 7 automation system. Please contact your regional
training center or our central training center in D 90327 Nuremberg, Germany for
details:
Telephone: +49 (911) 895-3200.
Internet: http://www.sitrain.com
Technical Support
You can reach the Technical Support for all A&D products
• Via the Web formula for the Support Request
http://www.siemens.com/automation/support-request
• Phone: + 49 180 5050 222
• Fax: + 49 180 5050 223
Additional information about our Technical Support can be found on the Internet
pages http://www.siemens.com/automation/service
Index Index-1
1.1.1 Introduction
Requirements
Prerequisite for the creation of AS blocks:
• PCS 7 V6.1 or higher installation on S7-4xx CPU
• Software packages required to create the blocks:
- STEP 7 Basis V5.2 or higher
- SCL Compiler V5.1 SP4 or higher
- CFC V6.0 or higher
1.1.2 How to integrate the included block template into your project
Path
The "CONTROL" block described in this section represents the SCL source file
CONTx.SCL included on the PCS7 toolset DVD. Install it at one of the paths shown
below, depending on your language settings:
• German: ...\STEP7\EXAMPLES\zdt25_01\S7_CONTA.SCL
• English: ...\STEP7\EXAMPLES\zen25_01\S7_CONTB.SCL
• English with French installation:
...\STEP7\EXAMPLES\zfr25_01\S7_CONTC.SCL.
Procedure
To install the sample block in your project:
1. Select the source folder in your project, and then select Insert > External
Source…
The "Insert external source" dialog box opens
2. Select the folder which contains either the "S7_CONTA.SCL" or
"S7_CONTB.SCL" source file, and then click "Open"
Compile the SCL source file which is now in the source folder using the SCL
compiler
3. Verify that the "OP_A_LIM" block (FB 46) is located in the block folder of your
project before you run the compiler Copy it from the PCS 7 library to your
project if not available in this folder
4. Check the SCL compiler settings (see chapter Fehler! Verweisquelle konnte
nicht gefunden werden.)
5. Edit the entries shown below in the symbol table:
- Enter the symbolic name "CONTROL"
- Enter the FB501 address
- Save your entries
Always use numbers higher than 500 in order to avoid conflicts with the
numbers of the PCS 7 default blocks.
See also the "Entry in the symbol table" section in chapter 1.2.1.
6. Double-click the SCL source "S7_CONTA" or "S7_CONTB"
The program opens the required SCL source
7. Start compilation and close the SCL Compiler on successful completion
The sample block FB501 is now located in the block folder of your project.
Initial start
(see Section 1.3)
Technological section
(see Section 1.6.1)
Note
(for this example)
Always set the "Include system attribute "S7_server" check box because this block
contains messages. If the check box is not set the program returns an error
message and cancels any operation which imports a block and/or inserts a block
into a CFC chart.
"Compiler" settings
You can activate/deactivate the check boxes listed below in the SCL Compiler by
selecting Options > Customize > Compiler.
• "Monitor field limits"
• "Generate debug info"
• "Set OK flag"
It is advisable to activate all remaining check boxes. For further information on the
various options, refer to the SCL manual.
Make allowances for conditions outlined below when you activate/deactivate any of
these options:
• Monitor field limits
At runtime, the program validates the range of the array index and field length
declaration of any arrays used. The program toggles the OK bit and resets the
ENO output when an error is detected. This validation imposes a considerable
load on the runtime system.
Activate this option only as long as necessary when validating arrays, i.e. reset
it after you successfully completed the block test and verified that the index
matches the field length.
• Generate debug info
This option enables you to debug the compiled program after its download to
the CPU. However, this option increases memory requirements of the program
and load on AS runtime. You should therefore activate this option only for block
testing and deactivate it in its delivered version.
• Set OK flag
The OK flag is an internal system variable. When the system detects an error
such as overflow in mathematical operations during execution of an operation,
it toggles the OK bit and transfers this bit information to the ENO output. This
validation generates considerable load on system performance. You should for
this reason disable automatic setting of the OK flag and capture any illegal
operations or violation of limits in the actual block algorithm. You can explicitly
set the OK flag when the system returns an error in order to transfer the
information via the ENO output. The system accepts this operation without loss
of performance, as it always transfers the status of the OK flag to the output.
Note
The number of characters shown is limited by the width of the CFC blocks.
However, you can temporarily view the entire comment in a short info by
positioning the mouse pointer on the block header.
Block attributes
The block header contains the block management information (block attributes in
the following). The various PCS 7 tools deploy these attributes for different
purposes. SIMATIC Manager shows the attributes in the object properties of the
block and lets you edit these (cf. the KNOW_HOW_PROTECT attribute).
If the process value overshoots the high alarm limit the system sets error
output QH_ALM. In addition, it generates a message in ALARM_8P and outputs
it to the OS.
The message can be suppressed by setting the M_SUP_AH variable.
If the process value undershoots the low alarm limit the system sets error
output QL_ALM. In addition, it generates a message in ALARM_8P and outputs
it to the OS.
The message can be suppressed by setting the M_SUP_AL variable.
The block contains additional inputs which can be used to return information
about a delay function:
..****************************************************************************)
//****************************************************************************
// Block header
//****************************************************************************
FUNCTION_BLOCK "CONTROL"
TITLE = 'CONTROL'
TITLE
Fig. 1-2: Object properties of the block (General - part 1)
• FUNCTION_BLOCK
Define a block name with a maximum string length of eight characters at this
parameter. This name appears in the object properties of the block, in the
detail view of SIMATIC Manager, and in the CFC catalog. Assign this name a
block number in the symbol table before you compile the block.
• TITLE
PCS 7 does not evaluate this information. However, SIMATIC Manager shows
it in the comment field of the object properties of the block. SIMATIC Manager
includes comments entered directly below this attribute. All other comments in
the block headers can only be viewed in the SCL editor.
It is advisable to enter a brief description of the block in this dialog.
KNOW_HOW_PROTECT
• NAME
Enter the block name you already defined at "FUNCTION_BLOCK".
The NAME" and "FAMILY" strings are elements of the keywords used to find
help texts in the block's online help.
• VERSION
Enter a version ID from 0.00 to 15.15 at this parameter.
• FAMILY
Enter a group name for the block at this parameter when collecting your blocks
in a user-specific library and assigning these to different groups. Enter a name
with a maximum string length of eight characters
The "NAME" and "FAMILY" strings are elements of the keywords used to find
help texts in the block's online help (cf. chapter 3.3).
• AUTHOR
This attribute usually contains the name or department of the block's creator.
The attribute is also used for two other functions at PCS 7-compliant blocks:
- Enter a name shared by all blocks you want to group in your library Enter a
name with a maximum string length of eight characters
- This name is used to find the relevant help file in the online help system
• KNOW_HOW_PROTECT
You can read and write protect the block algorithm and attributes by setting this
attribute. Effects of this attribute:
- It sets the read only flag for the block attributes in the object properties
dialog of the block in SIMATIC Manager
- Offline of the project and if the corresponding source code is not available
you can only open the block in the STL editor. You can no longer open it in
SCL. Only the block parameters are displayed
The SCL Compiler is started within your project
SIMATIC Manager shows the system attributes in the object properties of the block
on the "Attributes" tab. You can edit the system attributes on this tab if the block is
not write-protected. The block is not write protected if the
"KNOW_HOW_PROTECT" attribute is disabled in the block header.
Note
You can view a list of all system attributes by calling the context-sensitive help or
the help topic "Attributes for blocks and parameters".
Block interface
The block's parameters define its interface to other blocks and to control and
monitoring tools such as CFC and WinCC.
Parameter types
Parameter types available:
• Input parameters
Operations for which input parameter functions must be declared for PCS 7-
compliant blocks:
- You want to fetch parameter values from another block
- You want to control parameters at the OS
- You want to define visualization of a faceplate on the OS with the help of
parameters. Example: range limits of the views.
- You want to be able to manipulate parameters in CFC for test purposes
- You need parameters such as Message Event-ID of the ALARM_8P block
to generate messages
- If you require bumpless changeovers between input values from the
program (CPU) and control values entered by the operator (OS), the input
parameters can be read back and written back (see in/out parameters) by
the block algorithm. By contrast to the in/out parameters, the input
parameters are not written back to the interconnected output parameters
• Output parameters
Operations for which output parameters must be declared for PCS 7-compliant
blocks:
- You want to transfer parameter values to another block
- You want to monitor parameters at the OS
- You want to monitor parameters in CFC when running tests
• In/out parameters
In/out parameters can be read back and written back by the block algorithm.
In/out parameters must be declared for PCS 7-compliant blocks when you
require a bumpless changeover between input values from the program (AS)
and manipulated values (OS). You need three parameters to implement this
functionality:
- One input parameter for changeover
- One input parameter for the interconnected value
- One in/out parameter for the manipulated value
This must be an in/out parameter, as the interconnected value must be
written back to the manipulated value This method ensures the bumpless
changeover from the interconnected to the manipulated value
//*****************************************************************************
// Declaration section: Block parameters
//*****************************************************************************
VAR_INPUT
SAMPLE_T {S7_sampletime:= 'true'; // Parameter of the block scan cycle
// (Task cycle)
S7_visible:='false'; // Parameter is hidden
S7_link:= 'false' // Parameter cannot be not interconnected
} :REAL := 1; // Delay [s] (default = 1 s)
M_SUP_AL {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:= 'Suppress LL=No'; // Message text for value (M_SUP_AL) = 0
S7_string_1:= 'Suppress LL=Yes' // Input text for value (M_SUP_AL)= 1
} :BOOL := 0; // Suppress low alarm message
M_SUP_AH {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:= 'Suppress HH=No';
S7_string_1:= 'Suppress HH=Yes'
} :BOOL := 0; // Suppress high limit alarm message
SP_OP_ON {S7_visible:='false';
S7_dynamic:='true' // CFC in test mode/IBS: Display of the actual
// value in the AS)
} :BOOL := 1; // 1 = enable setpoint input
SPBUMPON {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='SP bumpless=Off';
S7_string_1:='SP bumpless=On'
}
:BOOL := 1; // 1 = bumpless input of setpoint
SP_EXTON {S7_visible:='false';
S7_dynamic:='true' // CFC in test mode/IBS: Display of the actual
// value in the AS)
}
:BOOL := 1; // 1: Enable external setpoint
SP_EXT {S7_dynamic:='true'}
:REAL := 0; // External setpoint
SP_HLM {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='SP high limit'; // Text (max. 16 chars) for display on OS
S7_unit:=''} // Unit (max. 16 chars)
:REAL := 100; // High limit of setpoint input
SP_LLM {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='SP low limit';
S7_unit:=''}
:REAL := 0; // low limit of setpoint input
PV_IN {S7_dynamic:='true';
S7_m_c:='true';
S7_unit:='%'} : REAL := 0; // Process value (for Begleitwert_PR04)
GAIN {S7_link:='false';
S7_edit:='para'; // Parameterization in the IEA
S7_m_c:='true';
S7_shortcut:='Gain';
EV_ID {S7_visible:='false';
S7_link:='false';
S7_param :='false'; // Parameter cannot be programmed in CFC
S7_server:='alarm_archiv'; // Message no. assigned by server
S7_a_type:='alarm_8p' // Block reports with ALARM_8P
} :DWORD := 0; // Message number
// Parameters for SIMATIC BATCH
STEP_NO {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Batch step number
BA_ID {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Consecutive batch number
BA_EN {S7_visible := 'false'; // Parameter hidden in CFC chart
S7_m_c := 'true' // Parameter supports O&M
} :BOOL := 0; // Batch busy enable
BA_NA {S7_visible := 'false';
S7_m_c := 'true'} :STRING[32] := ''; // Batch name
RUNUPCYC {S7_visible:='false';
S7_link:='false'} :INT := 3; // Number of initial startup cycles
SUPPTIME :REAL := 0; // Delay time
SUPP_IN :REAL := 0; // Input value for delay time
END_VAR
VAR_OUTPUT
LMN {S7_shortcut:='pressure'; // Name of the parameter on OS
S7_unit := '%'; // Unit of the parameter
S7_m_c := 'true' // monitoring supported
} :REAL; // Manipulated value output
QSP_HLM {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1= Setpoint output high limit
// is active
QSP_LLM {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Setpoint output low limit
// is active
Q_SP_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1 = Setpoint input enabled
QOP_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1 = operator error
QMSG_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // ALARM_8P: Message error
MSG_STAT {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message error information
MSG_ACK {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Acknowledge messages
SUPP_OUT :REAL := 0; // Output value for delay
SP {S7_dynamic:='true';
S7_m_c:='true'} : REAL := 0; // Active setpoint
END_VAR
VAR_IN_OUT
SP_OP {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='Setpoint';
S7_unit:='%'} : REAL := 0; // Input of setpoint
END_VAR
Static variables
By contrast to temporary variables, the static variables retain their values across
several block calls. The value only changes when you edit it in the block algorithm.
These variables are of particular importance in PCS 7-compliant blocks if you want
to call either your own or default blocks within your block. In this case you should
implement a multiple instance block. This can be done by declaring an instance
of the called block within the static variable.
The called blocks must exist in the block folder of the S7 program in order to
successfully compile the calling block.
If you want to visualize and interconnect parameters of the called block, you must
copy these from your block algorithm or into parameters of your block. The
parameters of the called block itself are not visible to external functions.
Multiple instances
You will find examples of multiple instance applications in the chapter dealing with
CFC block types and in the relevant SCL code of the sample project.
Note
Called SFBs and SFCs, such as SFC 6 (RD_SINFO) or SFB 0 (CTU) are found
automatically in the standard library and are written to your S7 program when you
compile the calling block.
If the called FBs and the calling block are available in the same library, the
program copies the called FBs to the block folder when you install the calling block
in a CFC chart. You will otherwise have to copy the blocks manually.
Temporary variables
Temporary variables are valid only for the duration of one block call, i.e., they must
be calculated at each new block call.
There are no special features to observe for PCS 7-compliant blocks in this
context.
Extract from the block template:
//******************************************************************************
// Declaration section: Temporary variables
//******************************************************************************
VAR_TEMP
// Start info: Structure with info for the OB that has just called
// the block
TOP_SI: STRUCT
EV_CLASS :BYTE;
EV_NUM :BYTE;
PRIORITY :BYTE;
NUM :BYTE;
TYP2_3 :BYTE;
TYP1 :BYTE;
ZI1 :WORD;
ZI2_3 :DWORD;
END_STRUCT;
// Start info: Structure with info for the most recently called startup OB
START_UP_SI: STRUCT
EV_CLASS :BYTE;
EV_NUM :BYTE;
PRIORITY :BYTE;
NUM :BYTE;
TYP2_3 :BYTE;
TYP1 :BYTE;
ZI1 :WORD;
ZI2_3 :DWORD;
END_STRUCT;
The code section contains the actual block algorithm. This allows you to implement
the following features for PCS 7-compliant blocks:
• The technological functions of the block
• Block properties which can be used, for example, to report asynchronous
events and the block states to the OS, and to visualize these using a faceplate
of a WinCC message list
1.3 Initialization
//****************************************************************************
// Dependency on the calling OB
//****************************************************************************
IF sbRESTART THEN
// Initialization sequence
TOP_SI.NUM := 100; // Execution of the initialization sequence as restart
sbRESTART := FALSE; // Reset initialization sequence
END_IF;
// Which OB called the block?
CASE WORD_TO_INT(BYTE_TO_WORD(TOP_SI.NUM)) OF
//****************************************************************************
// Handling of error OBs
//****************************************************************************
//****************************************************************************
// Startup
//****************************************************************************
// OB100: Restart
100:
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
siRUNUPCNT := RUNUPCYC; // Save RUNUPCYC value
ELSE
....
/*****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
//****************************************************************************
// Declaration section: Static variables
//****************************************************************************
VAR
....
sSUPP_IN :REAL := 0; // Old value of sample delay input
ACT_TIME :REAL := 0; // Time counter
....
END_VAR
VAR_OUTPUT
....
SUPP_OUT :REAL := 0; // Output value for delay
....
END_VAR
//****************************************************************************
// Technological section
//****************************************************************************
Asynchronous event
The AS calls an asynchronous OB when asynchronous events such as restart,
removal/insertion and rack failure are detected. If your block has to react to such
events, install it in the corresponding OB and program the block algorithm for
detection of these events.
The content of the structure elements correspond with the temporary variables of
the calling OB. The names and data types of these elements may differ depending
on the OB. You therefore have to interconnect and appropriately evaluate the
various structure elements based on the corresponding OB description (cf. STEP 7
- System and Standard Functions manual). The table below and extract from the
block template show this based on the example of OB 80 (timeout error).
Table 1-4: Assignment of the elements of the TOP_SI start info to the temporary variables
of OB 80
TOP_SI/STARTUP_SI OB 80
Structure element Data type Temporary variable Data type
EV_CLASS BYTE OB80_EV_CLASS BYTE
EV_NUM BYTE OB80_FLT_ID BYTE
PRIORITY BYTE OB80_PRIORITY BYTE
NUM BYTE OB80_OB_NUMBR BYTE
TYP2_3 BYTE OB80_RESERVED_1 BYTE
TYP1 BYTE OB80_RESERVED_2 BYTE
ZI1 WORD OB80_ERROR_INFO WORD
ZI2_3 DWORD OB80_ERR_EV_CLASS BYTE
OB80_ERR_EV_NUM BYTE
OB80_OB_PRIORITY BYTE
OB80_OB_NUM BYTE
Note
In its temporary variables, each OB contains the date and time of the call.
However, these are not included in the startup information read with SFC6.
PCS 7-compliant blocks are not installed in the hot restart OB 101 or cold start OB
102.
The next extract from the block template shows how the OBs are handled.
//****************************************************************************
// Code section
//****************************************************************************
CASE WORD_TO_INT(BYTE_TO_WORD(TOP_SI.NUM)) OF
//****************************************************************************
// Handling of error OBs
//****************************************************************************
//****************************************************************************
// Startup
//****************************************************************************
// OB100: Restart
100:
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
siRUNUPCNT := RUNUPCYC; // Save RUNUPCYC value
ELSE
Note
The AS block and the faceplate interact in asynchronous mode, i.e. a value input
at the faceplate is written to the instance DB of the AS block and evaluated by this
AS block at a later time. As the relevant limits may already have changed at this
point in time, the manipulated value should be checked for errors both on the AS
and on the OS.
Input definition
The extract below shows an input definition:
//****************************************************************************
// Input of the setpoint SP_OP (REAL value) or of the interconnected
// setpoint SP_EXT
//****************************************************************************
Messages
You can define a multiple instance of an alarm block in the static variables to
enable the output of messages and/or events to the OS at your block. The
message and acknowledgment reactions, including the transfer of associated
values, are determined by the properties of the CPU (selectable acknowledgment-
triggered reporting) and of the integrated alarm block.
The "Standard Library" contains alarm block templates in the form of SFBs.
Blocks included, for example:
Using system attributes in the block header and for input EV_ID
The extract of the block template below shows applications for system attributes in
the block header and for input EV_ID which is to receive the message number.
//****************************************************************************
// Block header
//****************************************************************************
FUNCTION_BLOCK "CONTROL"
TITLE = 'CONTROL'
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
.... // Parameter EVENT ID for message number
EV_ID {S7_visible:='false'; // Parameter hidden in CFC
S7_link:='false'; // Parameter cannot be interconnected in CFC
S7_param :='false'; // Parameter cannot be programmed in CFC
S7_server:='alarm_archiv'; // Message no. assigned by server
S7_a_type:='alarm_8p' // Block reports with ALARM_8P
} :DWORD := 0; // Message number
...
END_VAR
Definition of ALARM_8P
The example below shows the definition of ALARM_8P:
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
// user-specific associated values of messages from ALARM_8P
AUX_PR05 {S7_visible := 'false'} : ANY; // Associated value 5
AUX_PR06 {S7_visible := 'false'} : ANY; // Associated value 6
AUX_PR07 {S7_visible := 'false'} : ANY; // Associated value 7
AUX_PR08 {S7_visible := 'false'} : ANY; // Associated value 8
AUX_PR09 {S7_visible := 'false'} : ANY; // Associated value 9
AUX_PR10 {S7_visible := 'false'} : ANY; // Associated value 10
....
//****************************************************************************
// Declaration section: Static variables
//****************************************************************************
....
//****************************************************************************
// Declaration section multiple instances
//****************************************************************************
OP_A_LIM_1: OP_A_LIM; // Control block 1
ALARM_8P_1: ALARM_8P; // Generation of max. 8 messages with max.
// 10 associated values
//****************************************************************************
// Reporting with ALARM_8P
//****************************************************************************
// STRING variables may not be interconnected as associated values with
// ALARM8_P and are therefore transferred in array of bytes
FOR DUMMY := 1 TO 16
DO
sbyBA_NA[DUMMY] := 0; //delete array as default
END_FOR;
Procedure
In order to reduce load on the AS during startup as a result of simultaneous
generation of several messages at different blocks you should define an input
parameter RUNUPCYC of the data type INT. At this parameter you can declare the
number of startup cycles during which messages should be suppressed. In the
block algorithm, you then count the number of calls and only enable the generation
of messages if the programmed number of cycles has been completed. The extract
from the block template below shows this procedure.
Example
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
...
H_ALM {S7_m_c := 'true'; // Parameter supports O&M
S7_visible:='false'; // Parameter is hidden
S7_link := 'false' // and cannot be interconnected
} :REAL := 100; // high limit alarm (default = 100)
//****************************************************************************
// Technological section
//****************************************************************************
IF siRUNUPCNT = 0 // RUNUPCYC cycle already completed?
THEN
IF (PV_IN > H_ALM) THEN // If the process value violates alarm high limits
QH_ALM := 1; // set error output
QL_ALM := 0; // reset error output
ELSIF (PV_IN < L_ALM) THEN // If the process value violates the alarm low
// limit
QL_ALM := 1; // Set error output,
QH_ALM := 0; // Reset error output
ELSE
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
END_IF;
ELSE
siRUNUPCNT := siRUNUPCNT - 1;
END_IF;
END_CASE;
Procedure
To suppress specific messages, for example, messages to be expected:
Define a BOOLEAN input parameter at your block and evaluate it in the block
algorithm in order to prevent an event from being passed to the SIG input of the
ALARM block when message suppression is active.
Inputs M_SUP_AL and M_SUL_AH are used in the example below to suppress a
single alarm.
Example
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
.....
// Suppress ALARM LOW
M_SUP_AL {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:= 'Suppress LL=No'; // Operator text for value (M_SUP_AL) = 0
S7_string_1:= 'Suppress LL=Yes' // Operator text for value (M_SUP_AL) = 1
} :BOOL; // Suppression of actual value low limit alarm
//****************************************************************************
// Reporting with ALARM_8P
//****************************************************************************
.....
ALARM_8P_1(EN_R := TRUE, // Update output ACK_STATE
ID := 16#EEEE, // Data channel for messages (always 16#EEEE)
EV_ID:= EV_ID, // Message number > 0
SIG_1:= NOT M_SUP_AH AND QH_ALM, // monitored Signal 1 -> Message
// high limit alarm
SIG_2:= NOT M_SUP_AL AND QL_ALM, // monitored Signal 2 -> Message
// low limit alarm
SIG_3:= 0, // monitored Signal 3 -> no message
SIG_4:= 0, // monitored signal 4
.....
.....
When you have completed programming, compile the source code using the SCL
Compiler. Select File > Compile. You can also click the corresponding toolbar
icon.
FB 501 is available in the block folder of the S7 program after you successfully
completed compilation.
For further information, refer to the "S7-SCL for S7-300 and S7-400" manual.
General information
You enable message output to the OS at the block by defining the multiple
instance of an alarm block in the static variables.
The ALARM_8/ALARM_8P block can be used to monitor up to eight signals you
declare as alarm block parameter. The block logs the actual signal states at each
call and outputs a message to the OS to report any change to one of the signals.
Start by entering the global message texts for this block. The individual texts
correspond to the user text blocks in AlarmLogging of WinCC.
Origin
Define the message origin at this parameter.
If you enter the origin keyword $$AKZ$$ the program initiates the following actions
when you transfer the data:
When you compile the OS, the program determines the path of the hierarchy
folder, the chart name and the block name, and saves these to the OS message
texts.
Note
The TH path is only entered if the name is derived from the relevant hierarchy
folders (properties of the THF or TH settings).
OS area
Define the message area at this parameter.
If you enter the area keyword $$AREA$$ or leave a blank input box, the program
initiates the following actions when you transfer the data:
When you compile the OS, the program evaluates the corresponding attribute of
the hierarchy folder and saves it to the OS message texts.
Batch ID
You can define a batch ID for the message at this parameter.
If you enter the batch ID the program initiates the following actions when you
transfer the data:
It evaluates the corresponding attribute and writes it to the "Charge name" column
of the WinCC message list when you compile the OS. However, instead of the
batch ID, this entry represents the batch name.
Enter the value @1%s@ if your block is to be compatible with the optional S7
package SIMATIC BATCH. This function assigns the BATCH charge identifier as
initial associated value to the message (cf. chapter 1.8).
If you do not use SIMATIC BATCH, do not make any entry here.
Message classes
Define the corresponding message classes in the next step. Click in a
corresponding message row in the "Message class" column to transform this into a
combo box in which you can select the message class. Assign all unused
messages the "< no message >" class. For detailed information on handling
messages, refer to the WinCC documentation.
Settings to be made:
• Enter a description of the error cause in the "Event" column The text length
should not exceed 40 characters, including any associated values
• Define these functions in the "Single acknowledgment" column:
- Set the check box to activate separate acknowledgment of messages
- Reset the check box to enable group acknowledgment for the message
• Define these properties at the "Locked" (blue lock icon) column:
- Deactivate the check box in order to allow instance-specific modification of
the message class in the CFC by the block users
- Activate the check box in order to prevent changes to the message class
Priority
You can assign different message priorities in this dialog.
Properties you can define at the "Locked" (blue lock icon) column:
• Deactivate the check box in order to allow instance-specific modification of the
priority class in the CFC by the block users
• Activate the check box in order to prevent changes to the priority class
Event
Enter a message text in this input box.
Note
The associated values of an ALARM_8P are of data type ANY, connection type
I/O. The data types supported for associated values are listed in the ALARM_8P
Online Help. If you define the associated values as an input and not as an I/O in
the block interface, you have to save the associated values to a variable in the
VAR section and transfer this variable as an associated value with ALARM_8P.
The data type STRING may not be transferred as an associated value. You have
to implement it as in the block template, by copying it to an ARRAY OF BYTE and
transferring this ARRAY as an associated value.
Single acknowledgment
Activate the check box if the message is to be acknowledged separately.
Info text
Enter an info text in this field.
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
....
// Parameters for SIMATIC BATCH
STEP_NO {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Batch step number
BA_ID {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Consecutive batch number
BA_EN {S7_visible := 'false'; // Parameter hidden in CFC chart
S7_m_c := 'true' // Parameter supports O&M
} :BOOL := 0; // Batch busy enable
BA_NA {S7_visible := 'false';
S7_m_c := 'true'} :STRING[32] := ''; // Batch name
Generating messages
In order to generate messages in a block of this type you need to implement inputs
BA_NA, STEP_NO and BA_ID as associated message values in the given order.
The associated values are used as shown below:
1.9.1 CFC
Task
The "CONTROL" block template is to be expanded by integrating a multiplier. The
product of the multiplication of the input values "IN1" and "IN2" forms the actual
value. The expanded block is to be generated as CONTROL2 (FB 601).
Procedure
1. Open a new CFC chart and then insert the "CONTROL" block template
2. Drag-and-drop a MUL_R (FC 63) multiplier from the CFC Library\ELEMENTA
to the chart
3. Interconnect output "OUT" of MUL_R with the process value (parameter
"PV_IN") of the block template
4. Select the View > Chart connectors command in the chart
The interface editor opens
Installation rule
OBs in which the CFC block type is installed:
• Cyclic OB (OB35, for example) to be used as default setting
• Each OB listed in a task list of a sublevel block, that is, the block's task list
represents the cumulative task list of all sublevel blocks The actual sublevel
blocks are only called in OBs which contain these blocks in their internal task
list Significance in terms of this example:
- The CONTROL block template is assigned the task list "S7_tasklist =
'OB80,OB100' "
- Multiplier MUL_R does not have a task list
- The CFC block type therefore has the task list "S7_tasklist = 'OB80,OB100'
" However, OB80 and OB100 only call CONTROL, without calling MUL_R.
In order to prevent the CONTROL block from being called in OB35, you should
either delete it from OB35 or move it to a different OB. The same applies to the
MUL_R block.
Range of numbers
In order to prevent numbering conflicts with the PCS 7 process control blocks of
Siemens, you should number the blocks starting at number 501. You should also
make allowances for performance data of the CPU types supported by your library
when you define the block numbers.
Names
Rule for naming block parameters:
Binary outputs start with Q. Examples: QH_ALM, Q_L_ALM.
//****************************************************************************
// Block header
//****************************************************************************
FUNCTION_BLOCK "CONTROL"
TITLE = 'CONTROL'
{ // List of system attributes
S7_tasklist:= 'OB80,OB100';//The block is called upon timeout error or restart
S7_m_c:= 'true'; // Block can be controlled and monitored
S7_alarm_ui:= '1' // PCS7 message dialog setting('0'= default message dialog)
}
AUTHOR: ABC
NAME: CONTROL
VERSION: '0.02'
FAMILY: XYZ
KNOW_HOW_PROTECT
//****************************************************************************
// Declaration section: Block parameters
//****************************************************************************
VAR_INPUT
SAMPLE_T {S7_sampletime:= 'true'; // Param. of the block sampling time
// (task cycle)
S7_visible:='false'; // Parameter is hidden
S7_link:= 'false' // Parameter cannot be not interconnected
} :REAL := 1; // Delay [s] (default = 1 s)
H_ALM {S7_m_c := 'true';
S7_visible:='false';
S7_link := 'false'} :REAL :=100; // high limit alarm
// (default = 100)
L_ALM {S7_m_c := 'true'; // Parameter supports O&M
S7_visible:='false'; // Parameter is hidden
S7_link := 'false' // and cannot be interconnected
} :REAL := 0; // low limit alarm (default = 0)
M_SUP_AL {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:= 'Suppress LL=No'; // Operator text for value (M_SUP_AL) = 0
S7_string_1:= 'Suppress LL=Yes' // Operator text for value (M_SUP_AL)= 1
} :BOOL; // Suppress low alarm message
M_SUP_AH {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:= 'Suppress HH=No';
S7_string_1:= 'Suppress HH=Yes'
} :BOOL; // Suppress high limit alarm message
SP_OP_ON {S7_visible:='false';
S7_dynamic:='true' // CFC in test mode/IBS: Display of the actual
// value in the AS)
} :BOOL := 1; // 1 = enable setpoint input
SPBUMPON {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='SP bumpless=Off';
S7_string_1:='SP bumpless=On'
}
:BOOL := 1; // 1 = bumpless input of setpoint
SP_EXTON {S7_visible:='false';
S7_dynamic:='true' // CFC in test mode/IBS: Display of the
// actual value in the AS)
}
:BOOL := 1; // 1: Enable external setpoint
SP_EXT {S7_dynamic:='true'}
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='SP high limit'; // Text (max. 16 chars) for display on OS
S7_unit:=''} // Unit (max. 16 chars)
:REAL := 100; // High limit of setpoint input
SP_LLM {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='SP low limit';
S7_unit:=''}
:REAL := 0; // low limit of setpoint input
PV_IN {S7_dynamic:='true';
S7_m_c:='true';
S7_unit:='%'} : REAL := 0; // Process value (for Begleitwert_PR04)
GAIN {S7_link:='false';
S7_edit:='para'; // Parameterization in the IEA
S7_m_c:='true';
S7_shortcut:='Gain';
S7_unit:=''} :REAL := 1; // Proportional gain
EV_ID {S7_visible:='false';
S7_link:='false';
S7_param :='false'; // Parameter cannot be programmed in CFC
S7_server:='alarm_archiv'; // Message no. assigned by server
S7_a_type:='alarm_8p' // Block reports with ALARM_8P
} :DWORD := 0; // Message number
// Parameters for SIMATIC BATCH
STEP_NO {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Batch step number
BA_ID {S7_visible := 'false';
S7_m_c := 'true'} :DWORD; // Consecutive batch number
BA_EN {S7_visible := 'false'; // Parameter hidden in CFC chart
S7_m_c := 'true' // Parameter supports O&M
} :BOOL := 0; // Batch busy enable
BA_NA {S7_visible := 'false';
S7_m_c := 'true'} :STRING[32] := ''; // Batch name
RUNUPCYC {S7_visible:='false';
S7_link:='false'} :INT := 3; // Number of initial startup cycles
SUPPTIME :REAL := 0; // Delay time
SUPP_IN :REAL := 0; // Input value for delay time
END_VAR
VAR_OUTPUT
LMN {S7_shortcut:='pressure'; // Name of the parameter on OS
S7_unit := '%'; // Unit of the parameter
S7_m_c := 'true' // monitoring supported
} :REAL; // Manipulated value
QSP_HLM {S7_visible:='false';
S7_dynamic:='true'} :BOOL := 0; // 1 = setpoint output high limit active
QSP_LLM {S7_visible:='false';
S7_dynamic:='true'} :BOOL := 0; // 1=Setpoint output low limit active
Q_SP_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} :BOOL := 0; // Status: 1 = Setpoint input enabled
QOP_ERR {S7_visible:='false';
S7_dynamic:='true'} :BOOL := 0; // 1 = operator error
QMSG_ERR {S7_visible:='false';
S7_dynamic:='true'} :BOOL := 0; // ALARM_8P: Message error
MSG_STAT {S7_visible:='false';
S7_dynamic:='true'} :WORD := 0; // Message error information
MSG_ACK {S7_visible:='false';
S7_dynamic:='true'} :WORD := 0; // Acknowledge messages
VAR_IN_OUT
SP_OP {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_shortcut:='Setpoint';
S7_unit:='%'} : REAL := 0; // Input of setpoint
// user-specific associated message values of ALARM_8P
//****************************************************************************
// Declaration section: Static variables
//****************************************************************************
VAR
sbRESTART :BOOL := TRUE; // Initial startup memory bit
siRUNUPCNT :INT := 0; // Counter for RUNUPCYC execution
sSUPP_IN :REAL := 0; // Old value of sample delay input
ACT_TIME :REAL := 0; // Time counter
//****************************************************************************
// Declaration section multiple instances
//****************************************************************************
OP_A_LIM_1: OP_A_LIM; // Operator control block 1
ALARM_8P_1: ALARM_8P; // Generation of max. 8 messages with
// max. 10 associated values
END_VAR
//****************************************************************************
// Declaration section: Temporary variables
//****************************************************************************
VAR_TEMP
// Start info: Structure with info for the OB that has just called the block
TOP_SI: STRUCT
EV_CLASS :BYTE;
EV_NUM :BYTE;
PRIORITY :BYTE;
NUM :BYTE;
TYP2_3 :BYTE;
TYP1 :BYTE;
ZI1 :WORD;
ZI2_3 :DWORD;
END_STRUCT;
// Start info: Structure with info for the most recently called startup OB
START_UP_SI: STRUCT
EV_CLASS :BYTE;
EV_NUM :BYTE;
PRIORITY :BYTE;
NUM :BYTE;
TYP2_3 :BYTE;
TYP1 :BYTE;
ZI1 :WORD;
ZI2_3 :DWORD;
END_STRUCT;
//****************************************************************************
// Code section
//****************************************************************************
//****************************************************************************
// Dependencies on the calling OB
//****************************************************************************
// Reading the start info by calling SFC6 (RD_SINFO)
DUMMY := RD_SINFO (TOP_SI := TOP_SI, START_UP_SI := START_UP_SI);
IF sbRESTART THEN
// Initialization sequence
TOP_SI.NUM := 100; // Execution of the initialization sequence as restart
sbRESTART := FALSE; // Reset initialization sequence
END_IF;
//****************************************************************************
// Handling of error OBs
//****************************************************************************
// OB80: Timeout error
80:
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
//****************************************************************************
// Startup
//****************************************************************************
// OB100: Restart
100:
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
siRUNUPCNT := RUNUPCYC; // Save RUNUPCYC value
ELSE
//****************************************************************************
// Input of setpoint SP_OP (REAL value) or interconnected setpoint SP_EXT
//****************************************************************************
//Multiple instance call OP_A_LIM
// (For information on the meaning of the parameters, refer to the
// Online Help OP_A_LIM)
OP_A_LIM_1(U := SP_OP, U_HL:= SP_HLM, U_LL:= SP_LLM, OP_EN:= SP_OP_ON,
BTRACK:= SPBUMPON, LINK_ON:= SP_EXTON, LINK_U:= SP_EXT);
ELSIF (PV_IN < L_ALM) THEN // If the process value violates the
// alarm low limit
QL_ALM := 1; // Set error output,
QH_ALM := 0; // Reset error output
ELSE
QH_ALM := 0; // Reset error outputs
QL_ALM := 0;
END_IF;
ELSE
siRUNUPCNT := siRUNUPCNT - 1;
END_IF;
END_CASE;
//*****************************************************************************
// Reporting with ALARM_8P
//*****************************************************************************
FOR DUMMY := 1 TO 32
DO
sbyBA_NA[DUMMY] := 0; //delete array as default
END_FOR;
The next chapters provide all information users need to create a faceplate for PCS
7. This comprises information about using the corresponding WinCC tools and in
particular about working with Faceplate Designer.
Note
The block icons and faceplates included in this description represent examples
which may deviate in certain details from actual objects visualized.
Representation
A faceplate represents the O&M interface to an AS block. There are two options of
visualizing a faceplate:
• Group display: Visualization of AS values in different views, with element for
selecting the loop display
• Loop display: Visualization of the elements of all views of the group display
System attributes
You define which particular input, output and in/out parameters of an AS block can
be controlled and monitored by configuring the system attributes when you create
the AS block. For detailed information about these system attributes, refer to the
chapter "AS block structure".
Parameters
Parameter selection criteria:
• Specific data the operators require to quickly and definitely register actual
states
• How to visualize these values
• Particular values which can be edited by operators
• User access rights
• Process-dependent interlocks of operator input
• Specific faceplate views for the visualization of values
Tip: Group the parameters based on functions. Insert essential elements and
in particular dynamic elements into the "Standard" view.
Design
After having defined the parameters and their visualization, continue with the
faceplate design:
• Select the faceplate elements
• Name the faceplate elements
• Program the faceplate elements
• Position the faceplate elements
Use pronounceable names which relate to the objects to be visualized.
Example
Assign the name "OCCUPIED" to the status view which is used to visualize the
"OCCUPIED" variable.
This procedure facilitates project documentation and maintenance.
Procedure
To test the faceplate:
1. In WinCC Explorer, check the properties of the pictures you created based on
the following criteria:
- Correct spelling of the parameter names
- Parameters visualized at multiple instances are assigned the same WinCC
cycle Different cycles are liable to cause confusion among operating
personnel, for example, due to inconsistency developing between the bar
graph and numerical displays, and also increase communication load on
the system
- Correct direct connections
- All event-controlled scripts are available
2. In WinCC Runtime, check the properties of the pictures created based on the
criteria listed below:
- The faceplate opens in the group display when the user clicks the block
icon
- The views can be toggled appropriately in the group display
- The faceplate opens in the loop display when the user clicks the "Loop
display" button
- The correct values of the AS block are returned
- Correct visualization of the message and trend view
- Proper functioning of the input enable function for controlling parameters
- Values input by the operator are written to the AS block
- Faultless operating log
The block icons for objects such as valves, drives, measured values and
controllers are available in the WinCC picture "@@PCS7Typicals.pdl".
• The user can quickly modify the templates, for example, in terms of their
shape, color and design, and adapt these to suit requirements of project-
specific faceplates
• The default call scripts for the faceplates are already included and do not need
to be configured
• Interconnections are quickly and easily configured using the "Interconnect
faceplate with process tag" Dynamics Wizard
For further information, refer to chapter 2.8, "Block icons".
Note
After having completed your changes, save the picture to the file named
"@PCS7Typicals*.pdl".
This name is the initial search criteria for the TH search engine. The program only
uses the templates in "@@PCS7Typicals.pdl" if the search is unsuccessful.
Object toolkit
The WinCC picture "@PCS7Elements.pdl" contains a number of object templates,
i.e. user objects such as IO fields and texts, which can be used to create a
faceplate.
The picture is available in "Siemens\WinCC\options\pdl\FaceplateDesigner_V6"
and is copied from there to the "GraCS" subfolder of the project folder when you
run the OS Project Editor session.
For further information, refer to chapter 2.3, "Basic elements".
Global scripts
Runtime functions or faceplate calls are available as global scripts in the
"WinCC\aplib\FaceplateDesigner_V6" folder.
For further information, refer to chapter 2.4, "Scripts".
Notes re configuration
To observe when configuring faceplates:
• The faceplates created in Faceplate Designer are initially saved to the "GraCS"
folder of your currently active project
User-specific faceplates can be saved to the
"\Siemens\WINCC\options\pdl\FaceplateDesigner" folder and are there
available to all other projects
In OS Project Editor, you can select the default faceplates to copy from
"\Siemens\WINCC\options\pdl\FaceplateDesigner_V6", and the user-specific
faceplates to copy from "\Siemens\WINCC\options\pdl\FaceplateDesigner"
to the project when generating the basic data
• Also copy the data from "\Siemens\WINCC\options\pdl\FaceplateDesigner" to
the corresponding folder which contains the WinCC clients
Using the "Global Script" editor you can read/write protect functions configured for
user-specific faceplates.
For further information, refer to "Global Script" editor documentation.
• The dynamic functions of faceplates created in Faceplate Designer can be
controlled by means of configuration data In particular the performance of a
faceplate is determined by the selection of a suitable dynamics configuration
An important aspect is an optimized, lean interface between the AS and OS
function This especially applies to the block icons
Note
It is advisable in this context to implement the new status word "VSTATUS"
introduced in V6 for integration in the AS blocks in particular for block icons in
order to cut down on variable interconnections.
The new status word could not be used in this case, as the default symbols must
be compatible with V5 in order to be able to visualize AS blocks of this version.
Procedure
1. Select the object, for example @Level6, for the access rights level required,
and then select "Object properties".
2. On the "Event Æ Property topics Æ Colors Æ Background color", select a
direct connection as action
3. Select the new object from the "Target" field on the right pane and the "Object
in picture" field to select the background color as property
4. On the "Event Æ Property topics Æ Other Æ Operator control enable" tab,
select a direct connection as action
A script which is already available for this event simultaneously controls the
background color if the enable signal for user input is controlled by an AS
variable In this case, you must delete the script
5. Select the new object from the "Target" field on the right pane and the "Object
in picture" field to set the enable operator input property
When installing additional objects in a view, select the object most recently
interconnected by means of direct connection, and then repeat the operations
described earlier.
Important!
The configuration of the "Background color" and "Operator input enable" must
match the configuration at "@Level5" and "@Level6". Example: background color
= "gray", and operator input enable = "false". This ensures proper functioning of the
scripts.
Background information:
If the script is used to set a value at the property and this value already exists in
the configuration of this property, the value is not transferred to other properties by
means of the direct connection. You should therefore make sure that the
configured values of target properties which receive data at the direct connection
match the values of the source properties.
Multiple instance
The term “multiple instance” denotes the existence of several blocks which are
configured in a CFC chart and can be controlled and monitored at a faceplate on
the OS.
Configuration
The symbol is always interconnected in your configuration data with a complete
variable name.
The check of user rights always encompasses the variable name selected and the
entire faceplate.
Set the property MULTI_INSTANCE = 'true' at the "@Faceplate" object in the
"@PG_xxxxx.pdl" and "@PL_xxxxx.pdl" pictures so that the program is able to
detect the "Multiple instance" type and truncate the block name from the variable
name after user rights were confirmed.
Append the /blockname string to all variable interconnections in the faceplate.
Example: /Controller.PV_IN.
Important: This action also has to be executed in the scripts!
Add these supplements to all interconnections of the OVERVIEW picture.
Define the properties of the batch parameters for the operating log of a block at the
"@Faceplate" object in the "@PG_xxxxx.pdl" and "@PL_xxxxx.pdl" pictures.
Multiple instance technology is ignored in this case. Special use cases such as
different BatchIDs or StepNos. for different blocks are covered by script control
when you select pictures in the various views.
The multiple instance technology is ignored in the trend view when "Mode = 2" is
set.
Visualization of online trends is only available for the variable name stored at the
block icon. You can set other modes in order to view the trends of several blocks.
GetComputerNameA(szStation, &dwSize);
pszParentPicture = GetParentPicture(lpszPictureName);
strcpy(sztag1,pszTagname);
strcpy(sztag2,pszTagname);
strcat(sztag1,"/Instanz1");
strcat(sztag2,"/Instanz2");
Example:
DWORD dEventState1 = GetPropWord(lpszPictureName,"EventState","CollectValue");
pszParentPicture = GetParentPicture(lpszPictureName);
GetComputerNameA(szStation, &dwSize);
strcpy(sztag1,pszTagname);
strcpy(sztag2,pszTagname);
strcat(sztag1,"/R");
strcat(sztag2,"/M");
SetPictureUp(lpszPictureName,lpszObjectName,"@Lock.bmp");
else
SetPictureUp(lpszPictureName,lpszObjectName,"@Unlock.bmp");
SetPictureUp(lpszPictureName,lpszObjectName,"@Lock.bmp");
else
SetPictureUp(lpszPictureName,lpszObjectName,"@Unlock.bmp");
Note
The terms "Format_InputValue" and "Format_OutputValue" selected in this
context are process-oriented and are not directly relevant to the I/O of the AS
block parameters.
Example: The FMT_PID parameter "PV" represents an output parameter at the
AS block, however, in terms of the process it represents an input variable.
The block icons of the program provide new properties which can be used, for
example, to integrate controller or measurement functions when you implement
trend views:
• ReturnPath: Transfers trend data for the corresponding process tag
• StandardTrend: Used to define the trend functionality to be visualized in the
trend view
Default Mode
trend:
0 Trend functionality similar to V5, i.e. a separate trend picture must be configured for each
instance.
The trend view "@PCS7_TREND.pdl" is available for all PCS7 faceplates and contains the
"TrendPicture" window. To visualize the trend view of a process tag on this area:
1st Open WinCC Editor "Tag Logging".
2nd Create a variable archive for the trend view using the Archive Wizard.
3rd Create the variables for this archive.
For detailed information about the steps mentioned earlier, refer to the WinCC Online Help,
index "Tag Logging".
4th Open the "@CONL1_Standard.pdl" picture in Graphics Designer.
5th Configure the TlgOnlineTrend object "Control1" to suit requirements. Click "Help" for
further information.
6th Save the picture to a file named "@CONL1_<tagname>.pdl".
The variable name <tagname> must match the name of the process tag of the AS block.
Replace the "/" with the "_" character in the name, because Windows does not support the "/"
character in file names.
Example of the window name of a process tag with the variable name "Measurement/M“
@CONL1_Messung_M.pdl
2 A "@CONL1_Standard.pdl" picture is called where you enter one or several online variables.
An archive is not required.
x axis = 5 min
This is the default setting as you neither have to make provisions in configuration data nor
have to comply with naming conventions in terms of the visualization of trends.
The ReturnPath property in the block icon returns the number of trends, the name of the
structure element and the color.
>2 A "@CONL1_Standard.pdl” picture is called where you enter one or several online archive
variable names.
You must comply with conventions outlined below in order to ensure proper functioning of
this configuration without having to program further functions:
• The archive must be named "Prozesswertarchiv", regardless of the language setting.
• The archive and the variable must be available on the same server.
• The archive variable name must comply with the default name you assign when creating
the archive variable.
• If the server prefix is included in the variable name of the "tagname" property of the block
icon, the server prefix must be set without "::" in the archive variable name.
• If the variable name entered in the "tagname" property does not contain a server prefix,
the archive variable name must match the variable name.
Note:
The archive variable name is represented in previous versions by the "tagname" without "/"
separators.
In V6 or higher, the archive variable name corresponds with the "tagname". The archive
variable must be assigned this name in order to ensure proper functioning of the trend in the
faceplate.
The ReturnPath property in the block icon is used to return the number of trends, the
variable name and the color.
in this mode, the duration of the axis x cycle (in minute units) is read from parameter
"StandardTrend".
Default Mode
trend:
ReturnPath syntax:
.PV_IN Structure element name with dot for the initial trend
: Separator between the structure element name and the color
CO_GREEN Color of the first trend
, Comma for a further trend
Example:
.PV_IN:CO_DKGREEN,.SP:CO_BLUE,.LMNR_IN:CO_DKRED
(default setting for CTRL_PID)
The example shows three controller trends, that is, the actual value, setpoint and
manipulated value feedback.
If you cannot adhere to the four conventions mentioned earlier, you can expand the
"ReturnPath“ property by assigning additional parameters:
*tagname: individual archive variable name
*archivname: individual archive name (entered without „\")
*archivserver: The trend is available on an archive server. Enter the server prefix of the
archive server without "::" characters
Example:
.PV_IN:CO_DKGREEN,.SP:CO_BLUE,.LMNR_IN:CO_DKRED*tagname:
MySpecialTag*archivname:MySpecialArchivname*archivserver:
MySpecialArchivServer
Note: You can only define a "tagname", "archivname" or the "archivserver" at the end of the
strings.
Adapt the archive variable names accordingly when using multiple instances.
The archive variable may only differ in term of member variables.
Default Mode
trend:
Rename the archive tags to "MULTI.M1_U“ and "MULTI.M2_U“
The table below show additional parameters to be set depending on the certain
criteria:
• Structure of the archive tag name and tag names in the block icon
• Source from which the faceplate is called
• Archive tag on the separate archive server
Server Client with Client with client Client with Client with client
server picture picture server picture picture and
and archive tag archive tag on
on separate separate archive
archive server server
Tag name without *asia: *asia: not supported, *asia: not supported,
server prefix "tagname" *archivname: "tagname"
Archive tag name always contains MyArchivserver always contains
without server prefix the server prefix prefix the server prefix
Tag name with server *asia: *asia: *asia: *asia: *asia:
prefix *archivname: *archivname:
Archive tag name MyArchivserver MyArchivserver
without server prefix prefix prefix
Tag name without *asia: MyServer *asia: not supported, *archivname: not supported,
server prefix prefix MyServer "tagname" MyArchivserver "tagname"
Archive tag name with prefix always contains prefix always contains
server prefix the server prefix the server prefix
Tag name with server no settings no settings no settings *archivname: *archivname:
prefix required in required in required in MyArchivserver MyArchivserver
Archive tag name with recommended recommended recommended prefix prefix
server prefix tag tag tag
configuration configuration configuration
The block icon returns the values of the "StandardTrend“ and "ReturnPath“
properties to the faceplate when prototype picture "@PG_xxx“ is called.
The prototype picture contains a "Trend functions" object assigned the
"StandardTrend" and "ReturnPath" properties. These are used to store the data
which are evaluated using the "PCS7_Trend.fct" script when the user selects the
"@PCS7_Trend.pdl" picture.
The same functionality is transferred to the loop display.
Procedure
You only need to change the "type" property at the block icon to generate a symbol
variant for the AS block.
Any faceplate variant you may want to generate for an AS block must be assigned
a name other than that of the AS block type. Example: variation of "MEAS_MON" is
the faceplate name "MEAS_NEW".
Settings to make at the block icon:
1. Rename the "Servername" property to "PCS7 MEAS_NEU Control".
2. Create a new "StructureType" property at the block icon which contains the AS
block type ("MEAS_MON")
This is necessary to ensure that the "Link faceplate to process tag“ wizard is
still able to select the variable
Addressing
WinCC scripts deploy absolute or relative addressing of picture names.
Example:
• absolute
@screen.@win12:@1001.@top09:@pg_elap_cnt.OverviewWindow:@PG_
ELAP_CNT_OverView.pdl
• relative
@PG_ELAP_CNT_OverView.pdl
The WebClient only supports relative addressing within the script context.
Also, you should define the picture window name instead of the picture name as
address when using WebClient scripting.
Example:
SetPropChar(lpszPictureName,lpszObjectName,lpszPropertyName,szValue);
WinCC: the lpszPictureName is a pointer to the picture name
WebClient: lpszPictureName is a pointer to the picture window name
Exceptions are the picture to which the script belongs and the parent picture
(ParentPicture), i.e. the picture name can be used as pointer. It is advisable always
to use the picture window name as the pointer to this name is unambiguous. The
picture name may be ambiguous.
Example of relative picture addressing:
The @PG_xxx.pdl picture contains a "View" window which is used, for example, to
visualize the default view of a faceplate.
When addressing a different window of the @PG_xxx.pdl picture in the screen
which returns the default view in the "View" window, the relative window address is
determined as shown below:
sprintf(szPictureName,"../OperationWindow");
Note
Instead of checking the syntax of the Web code section when you compile the
WinCC script, the program checks it only when you publish the pictures.
2.1.10.10 Notes
By contrast to WinCC, scripts on the WebClient which are written in C do not
provide global tags which can be shared by all pictures.
It is advisable to discard cyclic synchronous functions, as these generate longer
runtimes on the WebClient compared to WinCC.
2.1.12 Texts for the input of analog and binary values from the ES
Multilingual texts
You can translate any texts for multilingual applications using the Text Library
Editor in WinCC. In SIMATIC Manager, set the default dialog language, i.e. usually
"English", for display devices which contain the control and display texts configured
in STEP 7 and in the ES. This prevents overwriting of translated texts when you
compile the OS.
Important information
As the default texts are already available in English language in the ES, you should
always create a project library for the AS blocks and translate their default English
texts into the required language when you configure a project in a language other
than English.
Make sure that the new texts do not exceed the length of the default texts. Verify
that the texts are properly output to the faceplate if you cannot avoid longer texts.
For further information on the creation of project libraries, refer to the ES
Configuration Manual.
You can ignore attribute "s7_unit" for translation, as space characters or
internationally used short names were used in the default settings.
OP_TRIG I0 0 Reset
STOP_VAL 0 Valve=Stop
TIME_OFF Mon. time off
TIME_ON Mon. time on
Procedure
1. Open WinCC Explorer to start Faceplate Designer.
2. Enter a name for the new faceplate in the "Type" combo box.
3. You can either select a name from the drop-down list of structure types of the
WinCC variable database or assign a new name.
4. In the “Selected views” pane on the right side, enter the various views of the
faceplate to be generated in Faceplate Designer Select these from the
"Available views" pane on the left side, or create new views by clicking
"Further". Configure additional view names for output to the list of views when
creating multilingual projects The program outputs a corresponding message
when you generate this new view
Procedure
1. Open WinCC Explorer to start Faceplate Designer.
2. Enter the value "REG_NEU" in the "Type" input box
3. Click "Further…" in "Available views" and then create two new views:
"NewView1" and "NewView2".
4. Select the new views and then click "->". This transfers the new views to
"Selected views"
5. You can move the "Messages" view to the end of the list using the "Cursor
down" button
6. Click "Generate"
The program generates the template pictures shown below
The files generated are listed in the output box at the bottom of the picture.
Graphics Designer outputs the picture shown below when you change to the
English language.
Next, adapt the "Text" properties of the static texts in the object names
"NeueSicht1" and "NeueSicht2" accordingly. Example: "NewView1" and
"NewView2".
Do the same for the French language.
Procedure
To edit the default faceplate of the controller:
1. Open "@PG_REG_NEU_STANDARD.pdl".
2. Delete the "@Level6" and "@Level5" objects (cf. "Configuring user rights")
3. Open the default controller faceplate "@PG_CTRL_PID" and copy all data to
the "@PG_REG_NEU_STANDARD.pdl" picture
The "@Level6" and "@Level5" objects for setting user rights and the
corresponding direct connections to the control elements are included in the
data copied.
Note
The program deletes the special characters from the object names of the copied
data. The "@Level6" and "@Level5" objects of the
"@PG_REG_NEU_STANDARD.pdl" pictures are therefore initially named
"Level6" and "Level5". You must restore the original names, because the scripts
can only provide values to these objects.
In the next step, you can edit, add or delete picture objects.
Note that the deleted objects may still receive or transfer data by means of direct
connection. Refer to "Documentation of the default faceplates". This section lists all
direct connection sequencers and objects which transfer data by means of direct
connection. Objects usually included:
• "@Level6" and "@Level5" for the transfer of user rights
• The "Format" object for the transfer of instance-specific number formats (cf. the
description of basic elements, chapter 2.3 et seq.)
Procedure
1. Open the "@PG_REG_NEU_NEUESICHT1.pdl" and "@PCS7Elements.pdl"
pictures in WinCC Graphics Designer.
2. Select Window > Align horizontally to align the pictures horizontally
3. Copy the required picture objects from the "@PCS7Elements.pdl" to the
"@PG_REG_NEU_NEUESICHT1.pdl" picture.
4. Assign meaningful, object-relevant object names.
5. Position the objects
6. Interconnect the dynamic attributes of the picture elements with the AS
parameters
7. Configure the "User rights sequencers" based on the "@Level5" and
"@Level6" objects
8. Save the picture
Procedure
The "Picture selection with process tag" function lets you change to the loop view.
It is advisable for this reason to generate a loop view, regardless of whether you
only require a single view for the faceplate.
1. Generate the pictures without loop view in Faceplate Designer.
The program generates the group picture view without loop view selection
button.
2. Repeat generation and include the loop display view Click "No" for all pictures,
except when prompted to "Overwrite loop display".
Procedure
Recommended procedure for generating an additional view after having edited the
existing views:
1. Enter the type name and the selected views in Faceplate Designer similar to
the initial generation
2. Add the new view to the entries and then start generation
During generation, the program outputs a message asking you to confirm
overwriting of any existing file.
3. Acknowledge this message with "No"
All basic elements are saved to the "@PCS7Elements.pdl" picture template. The
picture is saved to the ”\Wincc\options\pdl\FaceplateDesigner_V6" folder and
copied to the project by OS Project Editor.
You cannot edit the value shown in the operator control picture if operator input is
disabled when you select the picture.
Properties Function
ProcessValue/OutputValue Structure element of the controlled analog value
Properties
Properties
Static texts are used, for example, to label check boxes and I/O buttons.
Format: Arial character set, font size 12
Properties
Properties Function
Links/PV Structure element of the analog value output to a dynamic
bar graph
Links/Range_LL Structure element for "Bar graph low limit" (Measurement
start value)
Links/Range_UL Structure element for "Bar graph high limit" (measurement
end value)
Other/PVunderLimit Display of measuring range undershoot
The process value may not be edited by the user.
Other/PVoverLimit Display of measuring range overshoot
The process value may not be edited by the user.
Colors/Barcolor_PV Color of the bar graph
Properties
The double bar graph is used for simultaneous visualization of setpoints and actual
values.
Properties Function
Links/PV Structure element of the process value which is output to a
dynamic bar graph.
Links/SP Structure element of the setpoint which is output to a
dynamic bar graph
Links/Range_LL Structure element for "Bar graph low limit" (Measurement
start value)
Links/Range_UL Structure element for "Bar graph high limit" (measurement
end value)
Other/SPunderLimit Display of measuring range undershoot
The setpoint may not be edited by the user.
Other/PVunderLimit Display of measuring range undershoot
The process value may not be edited by the user.
Other/SpoverLimit Display of measuring range overshoot
The setpoint may not be edited by the user.
Other/PVoverLimit Display of measuring range overshoot
The process value may not be edited by the user.
Colors/ Barcolor_SP Bar graph color for the setpoint
Colors/Barcolor_PV Bar graph color for the process value
When operator input enable = TRUE at the bar graph and you click the graph, the
script briefly cycles the operator input enable status from "FALSE“ > "TRUE" >
"FALSE.
The "operator input enable" property can then be transferred to the corresponding
basic element "PCS7_AnalogValue" (property "Open_BedBox_from_Bar“) by
means of direct connection, were it initiates the call of the analog value input box
for setpoint input (see also the description of analog value input in chapter 2.3.1).
The bar graph display is supplemented by arrows which indicate values above and
below bar graph limits.
The scripts (call of the script "PCS7_UpdateBar.fct") stored in each one of the
interconnected properties PV, SP, RANGE_LL and RANGE_UL output arrows at
the bar graph limits to indicate any measuring range overshoot/undershoot when
values change.
Properties
The horizontal bar graph can be used, for example, to visualize manipulated
variables.
The "operator input enable" property can be transferred to the corresponding basic
element "PCS7_AnalogValue" (property "Open_InpBox_from_Bar“) by means of
direct connection, were it initiates the call of the analog value input box for setpoint
input (see also the description of analog value input in chapter 2.3.1).
The bar graph display is supplemented by arrows which indicate values above and
below bar graph limits.
Properties Function
Other/Barcolor Color of the bar graph
Other/PVunderLimit Display of measuring range undershoot
The process value may not be edited by the user.
Other/PVoverLimit Display of measuring range overshoot
The process value may not be edited by the user.
Other/Unit Unit of the manipulated variable
Links/RANGE_LL Start of the measuring range of the bar graph display
Links/50PVALUE 50%-display is calculated by a script when RANGE_LL or
RANGE_UL changes.
Links/RANGE_UL End of the measuring range of the bar graph display.
Links/PV Structure element of the manipulated variable which is output
to a dynamical bar graph
Properties
Properties
Properties Function
Userdefined2/ "Statusdisplay2" control
actual status Messages with a diagonal strike-out disable requests from
the AS (.MSG_LOCK)
Properties
Properties Function
Userdefined2/ Control of status display 1 / Indicates that a block is occupied
actual status by a batch.
Structure element (.OCCUPIED)
Properties
The button for group acknowledgment of messages corresponds with the button of
the standard button set "@Buttons11.pdl", however, with a different script for
instance-specific message acknowledgment. Group acknowledgment only
functions in combination with a group display.
Properties
Properties Function
Status/actual status Indicates whether a block is locked
Structure element (.LOCK)
Properties
Properties Function
Other/CollectValue Display of alarm and warning states
Structure element (.EventState)
Properties
@PCS7_BedCheck.pdl
Properties Function
Other/ DisplayActivWith DisplayActivWith = 1 Æ The value 'TRUE' is
written to the binary variable when the check box
is set.
DisplayActivWith = 0 Æ The value 'FALSE' is
written to the binary variable when the check box
is set.
Other/OP_enabled Enables operator input at the check box
Interconnection/Input Control picture title of the "@PCS7_BedCheck.pdl"
check box
Interconnection/Variable Interconnection with the binary structure element,
for example (.MSG_LOCK)
Interconnection/NegatedVariable Check box that is clicked; may not be modified by
the user
Interconnection/Read_Text_From_AS Text is read from "String_0" or "String_1" and
assigned to the "Input" property.
Interconnection/CaptionCheckBoxOn YES = The text of "Input" is displayed on the right
side of the check box
NO = The check box text is not displayed if
insufficient space is available
You select the internal option “Inverted Variable” clicking on the check box. The
status of the binary variable to be controlled is determined and written back to
"Inverted Variable" ("Interconnection/NegatedVariable" property). When the
"Interconnection/Variable” property changes and a picture is selected, a script is
executed to update the display of the "NegatedVariable" (see also the Check_Box
flow chart). The "Interconnection/Variable” property must be set by the
configuration to "unequal 1“ and "unequal 0“ (0x8) to ensure that the script is
always executed when a picture is selected.
The texts used to label the check boxes are read from parameter attributes
"String_0" and "String_1" of the block instance.
Properties
Properties
@PCS7_BedCombo.pdl
Properties Function
Colors/BackColor_Text1 Background color Text1
Colors/BackColor_Text2 Background color Text2
Font/Text1 Display Text1 (read from AS)
Font/Text2 Display Text2 (read from AS)
Displays/Display_Text1 Display Text1 (controls which value is selected in the
display)
Displays/Display_Text2 Display Text2 (controls which value is selected in the
display)
Other/ OP_enabled_Text1 Enables input of Text1
Other/ OP_enabled_Text2 Enables input of Text2
Other/OP_enabled Enables the entire combo box for control using
"@Level5/6"
Other/Password_Text1 User rights for Text1 (not used)
Other/Password_Text2 User rights for Text2 (not used)
Links/Write_Variable1 Structure element to which selection Text1 is written
Links/Write_Variable2 Structure element to which selection Text2 is written
Links/Display_Variable1 Structure element which returns the first binary state
(Text1)
Links/Display_Variable2 Structure element which returns the second binary state
(Text2)
Parameters/ Write_value_Text1 Specifies which value is written to structure element
"Write_Variable1“ with selection Text1 ('TRUE' or
'FALSE')
Properties Function
Parameters/Display_Text1_with Specifies which value ('TRUE' or 'FALSE) structure
element "Display_Variable1" uses to display Text1
Parameters/ Write_value_Text2 Specifies which value is written to structure element
"Write_Variable2" with selection Text2 ('TRUE' or
'FALSE')
Parameters/Display_Text2_with Specifies which value ('TRUE' or 'FALSE)
"Display_Variable2" uses to display Text2
The texts used to label the check boxes are read from parameter attributes
"String_0" and "String_1" of the block instance.
• If the text of the strings contains a "=“ character, the text appended to the "=“
forms the label of the check boxes, and the text on the left side of the "=“ forms
the control picture title.
• If the text of the strings does not contain a "=“ character the full text is used to
label the check boxes In this case, the title bar of the control picture is filled
with space characters
Properties
@PCS7_3BedCombo.pdl
Properties Function
Colors/BackColor_Text1 Background color Text1
Colors/BackColor_Text2 Background color Text2
Colors/BackColor_Text3 Background color Text3.
Font/Text1 Display Text1 (read from AS)
Font/Text2 Display Text2 (read from AS)
Font/Text3 Display text for Text3 (read from AS)
Displays/Display_Text1 Display text1 (controls which value is selected in the
display)
Displays/Display_Text2 Display Text2 (controls which value is selected in the
display)
Displays/Display_Text3 Display Text3 (controls which value is selected in the
display)
Other/ OP_enabled_Text1 Enables operator input of Text1
Other/ OP_enabled_Text2 Enables operator input of Text2
Other/OP_enabled_Text3 Enables operator input of Text3.
Other/OP_enabled Enables operator input at the entire combo box for
control using "@Level5/6"
Other/Password_Text1 User rights for Text1 (not used)
Other/Password_Text2 User rights for Text2 (not used)
Other/Password_Text3 User rights for Text3 (not used)
Links/Write_Variable1 Structure element to which selection Text1 is written
Properties Function
Links/Write_Variable2 Structure element to which selection Text2 is written
Links/Write_Variable3 Structure element to which selection Text3 is written
Links/Display_Variable1 Structure element which returns the first binary state
(Text1)
Links/Display_Variable2 Structure element which returns the second binary state
(Text2)
Links/Display_Variable3 Structure element which returns the second binary state
(Text3)
Parameters/ Write_value_Text1 Specifies which value is written to structure element
"Write_Variable1“ with selection Text1 ('TRUE' or
'FALSE')
Parameters/Display_Text1_with Specifies which value ('TRUE' or 'FALSE')
"Display_Variable" uses to display Text1
Parameters/ Write_value_Text2 Specifies which value is written to structure element
"Write_Variable2" with selection Text2 ('TRUE' or
'FALSE')
Parameters/Display_Text2_with Specifies which value ('TRUE' or 'FALSE)
"Display_Variable" uses to display Text2
Parameters/ Write_value_Text3 Specifies which value is written to structure element
"Write_Variable3“ with selection Text3 ('TRUE' or
'FALSE')
Parameters/Display_Text3_with Specifies which value ('TRUE' or 'FALSE')
"Display_Variable" uses to display Text3
The texts used to label the check boxes are read from parameter attributes
"String_0" and "String_1" of the block instance.
• If the text of the strings contains a "=” character, the text appended to the "=“
forms the label of the check boxes, and the text on the left side of the "=“ forms
the control picture title.
• If the text of the strings does not contain a "=“ character the full text is used to
label the check boxes In this case, the title bar of the control picture is filled
with space characters
Properties
@PCS7_BedBinaer.pdl
Properties Function
Colors/Button_Colour Background color for text if active and input is
disabled
Other/OP_enabled Input enable
Other/DisplayActive Displays "Button On" property
Do not change, as controlled by script
Links/Write_Variable Structured element to which the selection text is
written
Links/Display_Variable Structure element which indicates the first binary
state (Text)
Properties Function
Parameters/Write_value Defines which value is written to structure element
"Write_Variable“ with selection Text ('TRUE' or
'FALSE')
Parameters/ Display_is_active_with Defines which value ('TRUE' or 'FALSE')
"Display_Variable" uses to indicate the text in the
selected color (display active and input disabled)
Parameters/ButtonText The display text may not be modified, as controlled
by script
Parameters/CMD2Steps 1- or 2-button control
Properties
@PCS7_BedBinär.pdl
Properties
Properties Function
Links/Link Interconnection with the binary structure element, for
example (.MSG_LOCK)
Others/ Read_Text_From_AS Text fetched from the AS ("String_0" and "String_1") for
labeling the status display
Other/Display May not be changed by the user and must remain
'TRUE'.
Other/OP_enabled Input enable
Font/Text_On Description of the 'True' status
Font/Text_Off Description of the 'FALSE' status
Colors/BackColor_OFF Background color for the 'Off' status
Colors/BackColor_ON Background color for the 'On' status
Colors/TextColor_OFF Text color for the 'Off' status
Colors/TextColor_ON Text color for the 'On' status
Displays/Off Displays static text "T_off"
May not be edited by users, as controlled by script
Displays/On Displays static text "T_on"
May not be edited by users, as controlled by script
Properties
Properties Function
Links/Link Interconnection with the binary structure element
(.MSG_LOCK)
Others/ Read_Text_From_AS "Text_On" label for the status display, read from the AS
(String_1).
Other/Display May not be modified by the user, as controlled by script
Other/OP_enabled Input enable
Font/Text_On Description of the 'True' status
Colors/BackColor_ON Background color for the 'On' status
Colors/TextColor_ON Text color for the 'On' status
Masks/ Mask Value used to control visibility of the text box
For status displays with n options, the number of alternatives required determines
the number of objects of the type Status_1_v_n to be arranged in an overlay
stack.
The "PCS7_1vnStati_Variable_Changed_V6.fct" script is called when the variable
which is interconnected with the "Links/Link" property changes.
You can define the value to be used to display the relevant object using the
"Masks/Mask" property. This option is suitable for alternative control using
INTEGER or REAL values, for example.
Set the value in "Mask" to 1 for all objects of an alternative control of multiple
binary values. You can set the priority for all active binary values in the "Level“
property. WinCC supports levels 0 to 15, also in ascending order of priority.
Example
Of two objects, one is assigned to level 4 and the other to level 5. Both objects are
set visible and arranged in an overlay stack. The level 5 object is visible and the
level 4 object remains hidden.
The status text can be read from the AS (Read_Text_From_AS = TRUE) by setting
the link to an input parameter such as REV_ON. The output parameters usually do
not contain "String_1". In this case (Read_Text_From_AS = FALSE), save the text
directly to the object.
Properties
The valve status display shown below was derived from PCS 7 V5.
As of PCS 7 V6.x, it is advisable to use the “Extended Status Display” function to
implement the status displays. Refer to the WinCC process control options.
Properties Function
Other/OP_enabled Operator input enable
Other/Display Displays the user object
Link/VariableLink Interconnection to the structured element if the states are
controlled using REAL or INTEGER values
State/Index Manual setting of the status display for binary control using
"State/Display".
State/Display Control of states using binary variables
Properties
Standard status display; with two alternatives and control by means of the
"Status/ActualStatus" property.
Properties
Procedure
To configure permissions:
1. Create a direct connection of "@Level5" or "@Level6", "Enable input" property
to the "Permission" object, "Level_Source" property.
2. C script called when the "Level_Source" property changes:
SetPropWord(lpszPictureName,lpszObjectName,"Target_BackgroundColor",CO_WHITE);
}
else
{
SetPropBOOL(lpszPictureName,lpszObjectName,"Target_Permission",FALSE);
SetPropWord(lpszPictureName,lpszObjectName,"Target_BackgroundColor
",CO_LTGRAY);
}
SetPropBOOL(lpszPictureName,lpszObjectName,"Level_Target",value);
This script is called when a new user logs in or a picture has been selected.
The AS variables which are included in the verification of permissions must be
checked at the same time. In this case, check the "QPARF" and "Q_SP_OP"
variables.
The program sets the following values if all three criteria have been met:
- Property "TARGET_OP_ENABLE" = 'TRUE'
- The value at property "TARGET_BackgroundColor" is set to "white"
The value of property "Level_Source" is transferred to property "Level_Target".
"Level_Target“ is defined for the interconnection of the direct connections to
further objects.
SetPropWord(lpszPictureName,lpszObjectName,"Target_BackgroundColor",CO_WHITE);
}
else
{
SetPropBOOL(lpszPictureName,lpszObjectName,"Target_Permission",FALSE);
SetPropWord(lpszPictureName,lpszObjectName,"Target_BackgroundColor
",CO_LTGRAY);
}
return TRUE;
When one of these variables is changed, these will be read from the AS. The
status of "@Level5" and "@Level6" also has been verified.
The program sets the following values if all criteria have been met:
- Property "TARGET_OP_ENABLE" = 'TRUE'
- The value at property "TARGET_BackgroundColor" is set to "white"
Note: The script must also query the control "@Level" status of the direct
connection.
4. Create a direct connection from the "Target_OP_Enable" to the actual object
which is subject to the verification of permissions, for example,
"Setpoint_AnalogValue", "Enable input" property.
The input enable property may no longer be interconnected at this object and
must be set to the value 'FALSE'.
The BackgroundColor property must also be set to "gray" and is controlled
either by the input enable function in a script, or by direct connection using the
"TARGET_BackgroundColor" property of the "Permission" object.
The "Password" property is no longer used for the “Permission” object.
5. If necessary, create an additional direct connection form the "Level_Target"
property to a further "Permission" object.
Access control
The "OpenNextFaceplate" object is also assigned the "Processcontrolling_backup“
and "Higherprocesscontrolling_backup“ properties for setting permissions for the
faceplate to be called. The usual default settings are here the permission levels 5
and 6. You can transfer the permissions entered in the source symbol to the
"OpenNextFaceplate" object using the direct connections of "@Level5" and
"@Level6".
Direct connections
@Level5/Permission/Change Æ OpenNextFaceplate/Processcontrolling
@Level6/Permission/Change Æ OpenNextFaceplate/HigherProcesscontrolling
Overview objects
The "Disable/enable messages" function is implemented in the overview using this
button: .
The button is only visible to operators assigned the permission level defined at the
block icon property "Processcontrolling_backup".
Properties
The message disable/enable button corresponds with the button of the standard
button set "@Buttons11.pdl", however, with a different script for instance-specific
disabling/enabling of messages.
The plain text appears as short info when you position the mouse pointer onto the
Quality Code display.
The Quality Code display leads the display of analog values.
On the maintenance view, the Quality code display is appended to the displays of
binary values in the valve and motor faceplates.
Properties
2.4 Scripts
List of scripts
The scripts listed in this table are installed in the
"\Siemens\WinCC\aplib\FacePlateDesigner_V6" bzw.
"\Siemens\WinCC\aplib\FacePlateDesigner" folder and do not have to be copied to
the GraCS subfolder of the project folder. The scripts are computer-specific and
not project-specific.
2.5 Bitmaps
List of bitmaps
The bitmaps are installed in the
"...\Siemens\WinCC\options\pdl\FaceplateDesigner_V6" folder.
The bitmaps are copied to the "GraCS" subfolder of the project folder when you run
OS Project Editor.
The bitmaps are loaded dynamically to the selected pictures.
2.6 Pictures
Picture list
The pictures listed below are installed in the
"...\Siemens\WinCC\options\pdl\FaceplateDesigner_V6" folder.
They are copied to the "GraCS" subfolder of the project folder when you run OS
Project Editor.
Pictures
@PCS7Elements.Pdl Picture template for basic elements
@@PCS7Typicals.pdl Picture template for block icons from the TH
supplement block icons
@Template.pdl Picture template of block icons for Graphics Object Update
Only difference to "@@PCS7Typicals.pdl": the "type" property.
@PCS7_BedAnalog.pdl Analog value control picture
@PCS7_BedAnalog_NL.pdl Analog value control picture without limits, scroll bars or
incremental input.
@PCS7_BedBinaer.pdl Single-button binary control picture, only confirmation
(example: Open/Close/manual/Auto for valve / motor)
@PCS7_BedCheck.pdl Two-button control picture (example: activate alarm/warning)
@PCS7_BedKombo.pdl Two-button binary control picture (e.g. manual/auto mode for
controller)
@PCS7_3BedKombo.pdl Three-button binary control picture (e.g. manual/auto mode for
controller)
@PCS7_AnalogInputwithLimits.pdl Analog value control picture
(not used but still supplied for reasons of compatibility with V5.1)
@PCS7_BinaryInput1of2.pdl Binary value control picture
(not used but still supplied for reasons of compatibility with V5.1)
@PCS7_ALARM.pdl Display of the message view in faceplates with alarm
@PCS7_BATCH.pdl Display of the batch view in faceplates
@PCS7_TREND.pdl Display of the trend view in analog faceplates
2.7 Faceplates
General information
For information on which parameters of the AS block instance can be used to
visualize the various display objects in the faceplate, refer to the offline dialog of
Graphics Designer.
Block comment
The CFC block comment is visualized on the faceplate as short info (tooltip)
showing the variable name.
This method ensures that the description of the technological function is always
available in the faceplate.
2.7.1.1 @PG_%Type%.pdl
Overview
The "@PG_%Type%.pdl" template is available for configuring the views.
OverviewWindow (Bildfenster)
@Faceplate ViewList (Bildfenster)
ComboControl
BlockType ButtonOpenLoop
View (Bildfenster)
OverviewWindow
Window used to visualize alarm and batch states, and for instance-specific
message acknowledgment and enabling messages of the faceplate. A group
display is usually shown here. If the faceplate is used for a multiple instance block
it may also show several group displays. The display is defined in the configuration
of the "@PG_<Type>_Overview.pdl“ picture. The same picture is shown in the loop
view of the faceplate.
Used to visualize the block instance or variable of the calling object. It is also used
to store additional faceplate information such as FirstView, the name of the batch
variable or CurrentUser.
User object with I/O field, for storing data of the trend function "Trendpage". This
object is hidden in online mode.
Name of the faceplate type. This type name forms part of the name of all views
belonging to the faceplate. This object is hidden in online mode.
ViewList
Window used to visualize and select existing views.
ComboControl
Selection and display element for the various views. The element always shows
the name of the active view.
ButtonOpenLoop
Object for selecting the loop picture. Faceplate Designer automatically hides this
object if generation or update of the loop view is not selected.
View
Window used to display the various faceplate views.
OperationWindow
Window used to display analog value input.
ComboWindow
Window used to display binary value input.
2.7.1.2 @PG_%TYPE%
Geometry/Pos X=0, y = 0
Geometry/Dimensions Width = 320, Height = 260
"View" window
Geometry/Pos X=1, y = 47
Geometry/Dimensions Width = 320, Height = 214
2.7.1.3 @PG_%Type%_%View%.pdl
Geometry/Pos X=0, y = 0
Geometry/Dimensions Width = 320, Height = 214
Rectangle @Frame
Geometry/Pos X=1, y = 50
Geometry/Dimensions Width = 320, Height = 214
2.7.3 CTRL_PID
Access control
The view features two permission objects for the input of setpoints and
manipulated values, as permissions for these variables depend on different factors:
• "Permission_Setpoint"
• "Permission_Manual"
See also chapter 2.3.24, Basic elements, Permission Object.
In addition to the WinCC user rights, the permission objects evaluate the
parameters listed below:
Access control
The "Permission_SP_Bumpless“ object evaluates the WinCC permission levels
and the "OPTI_EN = FALSE“ parameter.
Access control
The "Permission_Gain“ object evaluates the WinCC permission levels and the
"OPTI_EN = FALSE“ parameter.
The setpoint bar graph in this view shows the setpoint input limits relative to bar
graph limits.
Adjust the setpoint input limits in the maintenance view.
Access control
The "Permission_AlarmHigh_AnalogValue“ permission object evaluates WinCC
permission levels and the "OPTI_EN = FALSE“ parameter.
Note
The block icons are not provided process control elements. All process control
actions are carried out at the faceplates.
@@PCS7Typicals.pdl
The @@PCS7Typicals.pdl picture is used for automatic creation of block icons
from the TH.
The symbols for all OS-relevant CFC blocks can be created in a picture for the
charts of the hierarchy folder and, depending on the configuration, for the
subfolders if this picture meets the following requirements:
• It is available in the Technological Hierarchy (TH)
• The "Derive block icons from TH" option is set
Options of creating the block icons:
• Select the "Create/Modify Block Icons" command in the TH
• Enable the corresponding check box in the wizard when executing the
"Compile OS" function
Rules:
A copy of a block icon with "type" property string "@CTRL_PID/1" from the
@@PCS7Typicals.pdl picture is created in this picture for a CFC block instance
assigned the symbolic type name CTRL_PID.
If you want to edit the "@@PCS7Typicals.pdl" picture, copy it to a file named
"@PCS7Typicals.pdl" and then edit this copy. The "@PCS7Typicals.pdl" picture is
automatically derived from the TH if it exists in the project.
Note
All block icons in the pictures which also exist in "@@PCS7Typicals.pdl" and have
not been derived form the TH will be deleted during automatic generation. When
manually configuring and touching up the pictures, you should for this reason use
picture template "@Template.pdl" for the block icons, as this template has a
different default setting of the "type" property.
@Template.pdl
The @Template.pdl picture is primarily used as template for manual configuration
of block icons in the WinCC pictures. The block icons in these two pictures only
differ in terms of their "type" property. The property may not be modified at the
"@@PCS7Typicals.pdl" picture (naming convention, for example,
@MEAS_MON/1), as it is used as cross-reference to objects which are generated
and deleted based on the TH.
This property may not be changed in @Template.pdl.
Always assign the property a name other than the name already defined at the
block icons in @@PCS7Typicals. The program may otherwise delete the block
icons copied from this template from the pictures which were generated based on
the TH.
You should first create a copy of the "@Template.pdl" picture and assign it a
different name, and then edit this copy in order to modify the existing symbols. The
OS Project Editor (previously Split Picture Wizard) will otherwise reset the picture.
Overview
Basic properties
Properties at the block icons of the "@@PCS7Typicals" picture which you should
never change:
• Geometry/Width
• Geometry/Height
• Other/OP_enabled
• Other/Password
• Other/Display
• General/Servername
• Styles/GroupRelevant (only for blocks with Alarm_8P messages)
2.8.4.2 CTRL_PID
Properties
See also chapter 2.8.4, "General properties"
2.8.4.3 CTRL_S
Properties
See also chapter 2.8.4, "General properties"
The visibility of these texts is also controlled by scripts. The scripts are called when
you change QLMNUP and QLMNDN.
Note
The "OutputValue_AdvancedAnalogDisplay“ and "Unit_MAN_OP“ objects must
always be brought to the foreground in the user object, in order to ensure proper
functioning of the visualization control.
2.8.4.4 DOSE
Properties
See also chapter 2.8.4, "General properties"
The DOSE block does not contain a parameter which represents the effective
setpoint. The program outputs the setpoint display for this reason, depending on
the QSPEXTON status.
QSPEXTON = 0 Æ "SetpointValue_AdvancedAnalogDisplay" is displayed
QSPEXTON = 1 Æ "SetpointExternValue_ AdvancedAnalogDisplay " is displayed
2.8.4.5 FMCS_PID/FMT_PID
Properties
See also chapter 2.8.4, "General properties"
2.8.4.6 ELAP_CNT
Properties
See also chapter 2.8.4, "General properties"
2.8.4.7 MEAS_MON
Properties
See also chapter 2.8.4, "General properties"
2.8.4.8 SWIT_CNT
Properties
See also chapter 2.8.4, "General properties"
2.8.4.9 RATIO_P
Properties
See also chapter 2.8.4, "General properties"
2.8.4.10 OP_A
Properties
See also chapter 2.8.4, "General properties"
2.8.4.11 OP_A_LIM
Properties
Properties and visualization as OP_A; see chapter 2.8.4.10, OP_A
2.8.4.12 OP__A_RJC
Properties
Properties and visualization as OP_A; see chapter 2.8.4.10, OP_A
2.8.4.13 VALVE
Properties
See also chapter 2.8.4, "General properties"
Left-click calls the VALVE faceplate. Right-click calls the corresponding INTERLOK
faceplate.
The name of the INTERLOK block is stored as script transfer parameter, see
chapter 2.4 "Scripts"
The default block name is "L“. The INTERLOK block and the VALVE block must be
placed in the same CFC chart.
2.8.4.14 VAL_MOT
Properties
Properties and visualization as at VALVE; see chapter 2.8.4.13, VALVE
2.8.4.15 MOTOR
Properties
See also chapter 2.8.4, "General properties"
2.8.4.16 MOT_SPED
Properties
See also chapter 2.8.4, "General properties"
2.8.4.17 MOT_REV
Properties
See also chapter 2.8.4, "General properties"
2.8.4.18 INTERLOK
Properties
Siehe auch Kapitel 2.8.4 "Allgemeine Eigenschaften"
2.8.4.19 OP_D3
Properties
2.8.4.20 OP_D
Properties
See also chapter 2.8.4, "General properties"
2.8.4.21 OP_TRIG
Properties
See also chapter 2.8.4, "General properties"
2.8.4.22 DIG_MON
Properties
See also chapter 2.8.4, "General properties"
3.1 Requirements
Software requirements:
• The "Notepad" ASCII editor integrated in WINDOWS or a similar editor for
creating a registry file
• A tool for creating the help topics (for example, "RoboHelp")
Help file
You create an online help system for your blocks by writing a help file using the
help authoring system. You can assign this file a user-specific name. For reasons
of clarity, you should use the name of your library or a name shared by your blocks.
Example: "MYLIB__a.HLP".
Help topic
Create a separate topic for each one of your blocks. Define the Online Help entry
address for each topic ("Topic-ID" + "Map #") and enter this address in the registry
(cf. chapter 3.3). You can select any addresses. However, these must be
unambiguous in the online help system.
If you library is relatively complex, you can also create an hm file which contains all
IDs used. You can assign the MAP IDs using the RoboHelp authoring tool of this
file.
Entries in the hm file:
In addition to the help text, each topic contains the following information:
a German
b English
c French
d Spanish Currently not supported in PCS 7
e Italian Currently not supported in PCS 7
y Not language-dependent For the registry file, for example
Use the Options > Customize > Language dialog box to set the regional
language. PCS 7 calls the help file which matches the set language using the
registry (cf. chapter 3.3).
Copy the help file and any corresponding CNT file to the subfolder of the STEP 7
folder in which you install your library or the project with the blocks.
Registry file
Open the ASCII editor to write a registry file which enters your block data in the
WINDOWS registry. You can assign the registry file a user-specific name. For
reasons of clarity, you should use the name of your library or a name shared by
your blocks. Example: "MYLIB__y.reg".
Example
Example of a registry file for three blocks and five language versions (Spanish and
Italian with English help text).
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7\2.0\Applications\s7libs\mylib\ABC]
"Version"="0.2"
"VersionDate"="23.11.2003"
"HelpFileGerman"="S7libs\\mylib\\MYLIB__a.hlp"
"HelpFileEnglish"="S7libs\\mylib\\MYLIB__b.hlp"
"HelpFileFrench"="S7libs\\mylib\\MYLIB__c.hlp"
"HelpFileSpanish"="S7libs\\mylib\\MYLIB__b.hlp"
"HelpFileItalian"="S7libs\\mylib\\MYLIB__b.hlp"
[HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7\2.0\Applications\s7libs\mylib\ABC\XYZ]
"CONTROL"=dword:00000010
"CONTROL2"=dword:00000011
"CONTROL3"=dword:00000012
Note
Faulty entries in the registry may lead to problems in program execution or
prevent proper execution of the required function.
You should therefore use the registry keys as shown in this example.
Note
Italian and Spanish are currently not supported in PCS 7, so the help system is
called in English language.
Storage location
Copy the help files for the SFC templates to your installation folder. It is advisable
to save these to the existing "S7Hlp" folder. This folder also contains the SFC
online help files. This setup ensures that you can also change to the SFC online
help from the help system you created. See below. The example registry entries
shown below relates to this storage location.
Key entries
Author The "Author" entry is assigned by the SFC because this program
compiles executable blocks from these SFC templates. Always: ES_SFC.
Family You can view the family name in the "Family" field (no empty string) in the
properties dialog box of the SFC template. In the example: SFC
Name You can view the name of the SFC template in the "Name" field (no
empty string) of the properties dialog box. In the example: "Dosi1" and
"Heat1"
Example of a registry file for two block types and two language versions
[HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7\2.0\Applications\s7libs\SFCTypes]
[HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7\2.0\Applications\s7libs\SFCTypes\ES_SFC]
"HelpFileGerman"="S7Hlp\\SFC_Typa.hlp"
"HelpFileENGLISH"="S7Hlp\\SFC_Typb.hlp"
"Version"="1.1"
"VersionDate"="14.11.2003"
[HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7\2.0\Applications\s7libs\SFCTypes\ES_SFC\SFC]
"Dosi1"=dword:00000888
"Heat1"=dword:00000889
Note
The jump address appended to the green text with double underscore Æ
!JumpID(`s7jsfcab.hlp',`IDH_CONTENTS') is formatted as hidden text.
4.1 Requirements
In order to create a complete library and the corresponding Setup functions for
distribution, you need a program for the creation of installation routines such as
"InstallShield".
Procedure
To group your blocks and/or SFC templates in a library:
1. Create a new S7 library and generate an S7 program therein
2. Enter the names and numbers of your blocks, including the corresponding
comments in the symbol table of the library (this does not apply to
SFC templates).
3. Sources:
If you decide to include the source files of the blocks in your delivery, copy
these from the source folder of your project to the source folder of the library
4. Blocks:
Copy your blocks from the block folder of your project to the block folder of the
library
Note:
- When using your multiple instance blocks to call blocks which are not
generally available (SFBs, SFCs), you should also copy these to the block
folder of the library.
- Exclude blocks the compiler has generated from the SFC templates when
you copy the blocks
5. SFC templates:
Create a chart folder if you have not yet done so
Copy the SFC templates from the chart folder of your project to the chart folder
of the library
Note:
The blocks belonging to the SFC templates are also copied and saved to the
block folder.
Procedure
1. In order to use a Setup routine to install your library on the target computer,
create an installation script using the Setup authoring tool to perform the
actions outlined below:
- Copy the block library to the S7LIBS subfolder of the STEP 7 folder
- Call the S7BIN\S7ALIBXX.EXE program in the STEP 7 folder in order to
publish the new library in SIMATIC Manager
- Copy the help file (HLP and CNT file) to the subfolder of the STEP 7 folder
to which the block library was copied (for example, subfolder
S7LIBS\MYLIB)
- Call the registry file belonging to the help file
- Copy the prototype pictures to the options\pdl \FaceplateDesigner_V6
subfolder of the WinCC folder
- Copying the scripts to any subfolder of the aplib subfolder in the WinCC
folder
This folder should preferably be assigned the same name as the folder to
which the block library was copied. Example: subfolder
options\pdl\mylib).
- Setup of an uninstall option
2. Note that the block library and the online help system can only be installed
when STEP 7 exists on the target computer The prototype pictures can only be
installed in a subfolder of WinCC You should for this reason implement
functions to query the existence of STEP 7 and WinCC in the installation dialog
3. You can also query the following items in the registry:
- Query the required value of the STEP7_VERSION name ("V5.2", for
example) in the key
HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\STEP7
- You can also query the version name (V6.0 SP!, for example) in
HKEY_LOCAL_MACHINE\SOFTWARE\Siemens\WinCC\Setup
A.1 MEAS_MON
// @(#) $Header:: L:/PCS7/PCS7LibV51.SW/TechBlocks/VCS/Algorithm/meas_mon.csv$
//Copyright (C) Siemens AG 1995. All Rights Reserved. Confidential
VAR_INPUT
OOS {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='In Service';
S7_string_1:='Out of Service'} : BOOL := 0; // 1= Out of Service
M_SUP_AH {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Suppress HH=No';
S7_string_1:='Suppress HH=Yes'} : BOOL := 0; // 1=Suppress HH Alarm
M_SUP_AL {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Suppress LL=No';
S7_string_1:='Suppress LL=Yes'} : BOOL := 0; // 1=Suppress LL Alarm
M_SUP_WH {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Suppress H=No';
S7_string_1:='Suppress H=Yes'} : BOOL := 0; // 1=Suppress H Alarm (Warning)
M_SUP_WL {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Suppress L=No';
S7_string_1:='Suppress L=Yes'} : BOOL := 0; // 1=Suppress L Alarm (Warning)
CSF {S7_dynamic:='true'} : BOOL := 0; // Control System Fault 1=External Error
MSG_LOCK {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Enable 1=Messages locked
MO_PVHR {S7_visible:='false';
S7_m_c:='true';
S7_shortcut:='Bar UL';
S7_unit:=''} : REAL := 110; // High Limit Bar Range
MO_PVLR {S7_visible:='false';
S7_m_c:='true';
S7_shortcut:='Bar LL';
S7_unit:=''} : REAL := -10; // Low Limit Bar Range
VAR_OUTPUT
QERR {S7_visible:='false';
S7_m_c:='true'} : BOOL := 1; // 1=Error
QH_ALM {S7_dynamic:='true'} : BOOL := 0; // 1=HH-Alarm active
QL_ALM {S7_dynamic:='true'} : BOOL := 0; // 1=LL Alarm active
QH_WRN {S7_dynamic:='true'} : BOOL := 0; // 1=H Alarm active (Warning)
QL_WRN {S7_dynamic:='true'} : BOOL := 0; // 1=L Alarm active (Warning)
QMSG_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Message ERROR
QMSG_SUP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Message Suppression Active
MSG_STAT {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: STATUS output
MSG_ACK {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: ACK_STATE output
VSTATUS {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Status word
END_VAR
CONST
C_OOS := 0; // 1= Out of Service
C_M_SUP_AH := 0; // 1=Suppress HH Alarm
C_M_SUP_AL := 0; // 1=Suppress LL Alarm
C_M_SUP_WH := 0; // 1=Suppress H Alarm (Warning)
C_M_SUP_WL := 0; // 1=Suppress L Alarm (Warning)
C_CSF := 0; // Control System Fault 1=External Error
C_MSG_LOCK := 0; // Enable 1=Messages locked
C_MO_PVHR := 110; // High Limit Bar Range
C_MO_PVLR := -10; // Low Limit Bar Range
C_USTATUS := 0; // User Status Bits
C_U := 0; // Analog Input (Measured Value)
C_QC_U := 16#80; // Quality Code for Input U
C_U_AH := 100; // HH Alarm Limit
C_U_WH := 95; // H Alarm Limit (Warning)
C_U_WL := -3; // L Alarm Limit (Warning)
C_U_AL := -5; // LL Alarm Limit
C_HYS := 5; // Hysteresis of Analog Input
C_AUX_PR05 := 0; // Auxiliary Value 5
C_AUX_PR06 := 0; // Auxiliary Value 6
C_AUX_PR07 := 0; // Auxiliary Value 7
C_AUX_PR08 := 0; // Auxiliary Value 8
C_AUX_PR09 := 0; // Auxiliary Value 9
C_AUX_PR10 := 0; // Auxiliary Value 10
C_MSG_EVID := 0; // Message ID
C_BA_EN := 0; // Batch Enable
C_OCCUPIED := 0; // Occupied by Batch
C_BA_ID := 0; // Batch ID
C_BA_NA := ''; // Batch Name
C_STEP_NO := 0; // Batch Step Number
C_RUNUPCYC := 3; // Lag: Number of Run Up Cycles
C_QERR := 1; // 1=Error
C_QH_ALM := 0; // 1=HH-alarm Active
C_QL_ALM := 0; // 1=LL Alarm Active
C_QH_WRN := 0; // 1=H Alarm active (Warning)
C_QL_WRN := 0; // 1=L Alarm Active (Warning)
C_QMSG_ERR := 0; // 1=Message ERROR
C_QMSG_SUP := 0; // 1=Message Suppression Active
C_MSG_STAT := 0; // Message: STATUS Output
C_MSG_ACK := 0; // Message: ACK_STATE output
C_VSTATUS := 0; // Status word
END_CONST
// Static Variables
VAR
siRUNUPCNT: int := 0; // Counter for RUNUPCYC editing
sb_SIG_1: bool := FALSE; //Merker ALARM_8P Signal 1
sb_SIG_2: bool := FALSE; //Merker ALARM_8P Signal 2
sb_SIG_3: bool := FALSE; //Merker ALARM_8P Signal 3
sb_SIG_4: bool := FALSE; //Merker ALARM_8P Signal 4
sb_SIG_5: bool := FALSE; //Merker ALARM_8P Signal 5
ALARM_8P_1: ALARM_8P; // Multiple instance ALARM_8P
siBA_ID: dword := 0; // Old value BA_ID
sbyBA_NA: array[1..32] of byte := 32(0);
VSTATUS_LOC : DWORD :=16#0;// Local static variable, in which the output VSTATUS
// is copied.
STEP_NO_LOC : DWORD; // Local variable, in which the input STEP_NO is
// saved.
PV_IN_LOC : REAL; // Local variable, in which the input PV_IN is saved.
dwDUMMY: DWORD := 0; // Stand-by
BA_ID_LOC : DWORD; // Local static variable, in which the input BA_ID
// is copied.
U_LOC : REAL; // Local static variable, in which the input U is copied, because of
// message in ALARM_8P
VSTATUS_LOW_BIT_6 : BOOL;
VSTATUS_LOW_BIT_7 : BOOL;
END_STRUCT;
END_VAR
// Temporary Variables
VAR_TEMP
pbALARM: BOOL; // Call up ALARM_8P
pbM_SUP: BOOL; // Message suppression
pb_SIG_1,pb_SIG_2,pb_SIG_3,pb_SIG_4:BOOL;
TOP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
START_UP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
ERR : INT; // Error at startup
END_VAR
BEGIN
// Write VSTATUS, STEP_NO resave as STEP_NO_LOC and
// BA_ID resave as BA_ID_LOC.
// Supply of VSTATUS output variables with the inputs.
VSTATUS_STR.VSTATUS_LOW_BIT_0 := OCCUPIED;
VSTATUS_STR.VSTATUS_LOW_BIT_1 := BA_EN;
VSTATUS_STR.VSTATUS_LOW_BIT_2 := MSG_LOCK;
// Supply of VSTATUS output variables (HIGH BYTE) with the values,
// which come from the user via the input variable USTATUS (from external).
VSTATUS_STR.USTATUS := USTATUS;
STEP_NO_LOC := STEP_NO; // Resave, due to output of STEP_NO_LOC in ALARM_8P
BA_ID_LOC := BA_ID; // Resave, due to output of BA_ID_LOC in ALARM_8P
U_LOC := U; // Resave, due to output of U_LOC in ALARM_8P
ERR := RD_SINFO (TOP_SI := TOP_SI, START_UP_SI := START_UP_SI);
// Read out start info
pbM_SUP := MSG_LOCK;
IF TOP_SI.NUM = 100 THEN // When startup
siRUNUPCNT := RUNUPCYC; // Saving the value of the RUNUPCYC input
// Initialization outputs
QMSG_ERR := C_QMSG_ERR;
QMSG_SUP := C_QMSG_SUP;
MSG_STAT := C_MSG_STAT;
MSG_ACK := C_MSG_ACK;
QH_WRN := C_QH_WRN;
QL_WRN := C_QL_WRN;
QH_ALM := C_QH_ALM;
QL_ALM := C_QL_ALM;
// pbALARM := NOT OOS; // Initialization first call ALARM_8P
pb_SIG_1:= QH_ALM; // Alarm high
pb_SIG_2:= QH_WRN; // Warning high
pb_SIG_3:= QL_WRN; // Warning low
pb_SIG_4:= QL_ALM; // Alarm low
pbALARM :=TRUE; // Initialization ALARM
ELSE;
// LIMITS_P.1 für Alarmprüfung (optimiert)
IF (U <= U_AL) THEN // Low limit responded
QL_ALM := TRUE;
ELSE;
IF (U >= (U_AL+HYS)) THEN // Reset low limit responded
QL_ALM := FALSE;
ELSE; // QL_ALM remains unchanged
END_IF;
END_IF;
IF (U >= U_AH) THEN // High limit responded
QH_ALM := TRUE;
ELSE;
IF (U <= (U_AH-HYS)) THEN // Reset high limit responded
QH_ALM := FALSE;
ELSE; // QH_ALM remains unchanged
END_IF;
END_IF;
// LIMITS_P.2 for Warning check (optimized)
IF (U <= U_WL) THEN // Low limit responded
QL_WRN := TRUE;
ELSE;
IF (U >= (U_WL+HYS)) THEN // Reset low limit responded
QL_WRN := FALSE;
ELSE; // QL_WRN remains unchanged
END_IF;
END_IF;
IF (U >= U_WH) THEN // High limit responded
QH_WRN := TRUE;
ELSE;
IF (U <= (U_WH-HYS)) THEN // Reset high limit responded
QH_WRN := FALSE;
ELSE; // QH_WRN remains unchanged
END_IF;
END_IF;
IF siRUNUPCNT = 0 THEN // Initialize alarms
IF M_SUP_AH OR MSG_LOCK THEN
pb_SIG_1:= 0; // Report possible outgoing
ELSE;
pb_SIG_1:= QH_ALM; // Alarm high
END_IF;
IF M_SUP_WH OR MSG_LOCK THEN
pb_SIG_2:= 0; // Report possible outgoing
ELSE;
pb_SIG_2:= QH_WRN; // Warning high
END_IF;
IF M_SUP_WL OR MSG_LOCK THEN
pb_SIG_3:= 0; // Report possible outgoing
ELSE;
pb_SIG_3:= QL_WRN; // Warning low
END_IF;
IF M_SUP_AL OR MSG_LOCK THEN
pb_SIG_4:= 0; // Report possible outgoing
ELSE;
pb_SIG_4:= QL_ALM; // Alarm low
END_IF;
// pbALARM := (sb_SIG_1 <> pb_SIG_1) OR (sb_SIG_2 <> pb_SIG_2)
// OR (sb_SIG_3 <> pb_SIG_3) OR (sb_SIG_4 <> pb_SIG_4)
// OR (sb_SIG_5 <> CSF);
pbALARM :=TRUE; // Initialization ALARM
ELSE;
pbALARM :=FALSE; // Initialization no ALARM
pbM_SUP := TRUE;
siRUNUPCNT := siRUNUPCNT - 1;
END_IF;
END_IF;
IF pbALARM THEN // Call up ALARM_8P
IF siBA_ID <> BA_ID_LOC THEN
// STRING variables may not be interconnected to ALARM8_P as auxiliary
//process values, therefore transferred in ARRAY OF BYTE.
FOR ERR := 1 TO 32
DO
sbyBA_NA[ERR] := 0; // Delete array as default
END_FOR;
ERR := BLKMOV (SRCBLK:= BA_NA,DSTBLK:=sbyBA_NA);
siBA_ID := BA_ID_LOC; // Save modified BA_ID
END_IF;
// Call ALARM_8P with lock logic (MSG_LOCK).
ALARM_8P_1( EN_R := TRUE, // Update the ACKL_STATE output
ID := 16#EEEE, // PMC communication channel
EV_ID:= MSG_EVID,
SIG_1:= pb_SIG_1,
SIG_2:= pb_SIG_2,
SIG_3:= pb_SIG_3,
SIG_4:= pb_SIG_4,
SIG_5:= CSF,
SIG_6:= 0,
SIG_7:= 0,
SIG_8:= 0,
SD_1 := sbyBA_NA,
SD_2 := STEP_NO_LOC,
SD_3 := BA_ID_LOC,
SD_4 := U_LOC,
SD_5 := AUX_PR05,
SD_6 := AUX_PR06,
SD_7 := AUX_PR07,
SD_8 := AUX_PR08,
SD_9 := AUX_PR09,
SD_10 := AUX_PR10);
QMSG_ERR := ALARM_8P_1.ERROR;
MSG_STAT := ALARM_8P_1.STATUS;
MSG_ACK := ALARM_8P_1.ACK_STATE;
IF (NOT QMSG_ERR) THEN // Note historical signals.
sb_SIG_1:= pb_SIG_1;
sb_SIG_2:= pb_SIG_2;
sb_SIG_3:= pb_SIG_3;
sb_SIG_4:= pb_SIG_4;
sb_SIG_5:= CSF;
END_IF;
END_IF;
IF (MSG_STAT = 21) THEN // Block locked
pbM_SUP := TRUE;
END_IF;
QMSG_SUP := pbM_SUP;
QERR := NOT OK; // Note negated OK-Flag result in the block.
// Power supply of the VSTATUS output variable with the outputs.
VSTATUS_STR.VSTATUS_LOW_BIT_14 := QMSG_SUP OR M_SUP_AH OR M_SUP_WH OR M_SUP_WL OR
M_SUP_AL ;
VSTATUS_STR.VSTATUS_LOW_BIT_15 := OOS;
VSTATUS := VSTATUS_LOC;
END_FUNCTION_BLOCK
A.2 MOTOR
// @(#) $Header:: L:/PCS7/PCS7LibV51.SW/TechBlocks/VCS/Algorithm/motor.csv $
//Copyright (C) Siemens AG 1995-1997. All Rights Reserved. Confidential
FUNCTION_BLOCK "MOTOR"
TITLE = 'motor '
//
{
S7_tasklist:= 'OB100';
S7_alarm_ui:= '1';
S7_m_c:= 'true'
}
AUTHOR: TECHN61
NAME: MOTOR
VERSION: '4.0'
FAMILY: CONTROL
KNOW_HOW_PROTECT
VAR_INPUT
OOS {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='In Service';
S7_string_1:='Out of Service'} : BOOL := 0; // 1= Out of Service
LOCK {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Lock to OFF
LOCK_ON {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Lock to ON
AUTO_ON {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // AUTO Mode:1=ON, 0=OFF
L_RESET {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // Linkable Input RESET
MSS {S7_dynamic:='true'} : BOOL := 1; // Motor Protecting Switch: 0=Active
CSF {S7_dynamic:='true'} : BOOL := 0; // Control System Fault 1=External Error
FB_ON {S7_qc:='true';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Feedback: 1=ON
QC_FB_ON : BYTE := 16#80; // Quality Code for FB_ON
QC_QSTART_I : BYTE := 16#80; // Quality Code for Input QSTART
ON_OP_EN {S7_visible:='false'} : BOOL := 1; // Enable 1=Operator may input "ON"
OFFOP_EN {S7_visible:='false'} : BOOL := 1; // Enable 1=Operator for "OFF"
MANOP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input "MANUAL"
AUTOP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input "AUTO"
LIOP_SEL {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // Select: 1=Linking, 0=Operator Active
AUT_L {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // Linkable Input for MANUAL/AUTO Mode
MONITOR {S7_link:='false';
S7_m_c:='true';
S7_string_0:='Monitoring=Off';
S7_string_1:='Monitoring=On'} : BOOL := 1; // Select: 1=Monitoring ON,
// 0=Monitoring OFF
TIME_MON {S7_link:='false';
S7_edit:='para';
S7_m_c:='true';
S7_shortcut:='Mon. Time';
S7_unit:='s'} : REAL := 3; // Monitoring Time for ON [s]
SAMPLE_T {S7_visible:='false';
S7_sampletime:='true'} : REAL := 1; // Sample Time [s]
MSG_EVID {S7_visible:='false';
S7_link:='false';
S7_param :='false';
S7_server:='alarm_archiv';S7_a_type:='alarm_8p'} : DWORD := 0; // Message ID
BA_EN {S7_visible:='false';
S7_m_c:='true'} : BOOL := 0; // Batch Enable
OCCUPIED {S7_visible:='false';
S7_m_c:='true'} : BOOL := 0; // Occupied by Batch
BA_ID {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Batch ID
BA_NA {S7_visible:='false';
S7_m_c:='true'} : STRING[32] := ''; // Batch Name
STEP_NO {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Batch Step Number
RUNUPCYC {S7_visible:='false';
S7_link:='false'} : INT := 3; // Lag: Number of Run Up Cycles
START_OFF {S7_visible:='false'} : BOOL := 1; // 1=Start up with Motor OFF
FAULT_OFF {S7_visible:='false'} : BOOL := 1; // 1=In case of Fault: Motor OFF
MSS_OFF {S7_visible:='false'} : BOOL := 1; // 1=In case of MSS-Fault: Motor OFF
USTATUS {S7_visible:='false'} : WORD := 0; // User STATUS Bits
END_VAR
VAR_IN_OUT
RESET {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='0';
S7_string_1:='Error=Reset'} : BOOL := 0; // Operator Input Error Reset
MAN_ON {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Motor=Stop';
S7_string_1:='Motor=Start'} : BOOL := 0; // Operator Input: 1=ON, 0=OFF
AUT_ON_OP {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Mode=Manual';
S7_string_1:='Mode=Auto'} : BOOL := 0; // Operator Input Mode 1=AUTO,
// 0= MANUAL
AUX_PR04 {S7_visible:='false'} : ANY; // Auxiliary Value 4
AUX_PR05 {S7_visible:='false'} : ANY; // Auxiliary Value 5
AUX_PR06 {S7_visible:='false'} : ANY; // Auxiliary Value 6
AUX_PR07 {S7_visible:='false'} : ANY; // Auxiliary Value 7
AUX_PR08 {S7_visible:='false'} : ANY; // Auxiliary Value 8
AUX_PR09 {S7_visible:='false'} : ANY; // Auxiliary Value 9
AUX_PR10 {S7_visible:='false'} : ANY; // Auxiliary Value 10
END_VAR
VAR_OUTPUT
QERR {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 1; // 1=Error
QMSS_ST {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Unacknowledged Motor Protective Switch
QMON_ERR {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Monitoring Error
QGR_ERR {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // 1=Group Error
QOP_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Operator Error
QRUN {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Motor running
QSTOP {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Motor STOP
QSTART {S7_qc:='true';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Control Output 1=START Active
QC_QSTART : BYTE := 16#80; // Quality Code for Output QSTART
QON_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "ON"
QOFF_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "OFF"
QMAN_AUT {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // 1=AUTO, 0=MANUAL Mode
QMANOP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Oper. ena. for "MANUAL" Mode
QAUTOP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "AUTO"
QMSG_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Message ERROR
QMSG_SUP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Message Suppression Active
MSG_STAT {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: STATUS Output
MSG_ACK {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: ACK_STATE output
VSTATUS {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Status word
END_VAR
CONST
C_OOS := 0; // 1= Out of Service
C_LOCK := 0; // 1=Lock to OFF
C_LOCK_ON := 0; // 1=Lock to ON
C_AUTO_ON := 0; // AUTO Mode:1=ON, 0=Off
C_RESET := 0; // Operator Input Error Reset
C_L_RESET := 0; // Linkable Input RESET
C_MSS := 1; // Motor Protecting Switch: 0=Active
C_CSF := 0; // Control System Fault 1=External Error
C_FB_ON := 0; // Feedback: 1=ON
C_QC_FB_ON := 16#80; // Quality Code for FB_ON
C_QC_QSTART_I := 16#80; // Quality Code for Input QSTART
C_MAN_ON := 0; // Operator Input: 1=ON, 0=OFF
C_ON_OP_EN := 1; // Enable 1=Operator may input ON
C_OFFOP_EN := 1; // Enable 1=Operator for "OFF"
C_AUT_ON_OP := 0; // Operator Input Mode 1=AUTO, 0= MANUAL
C_MANOP_EN := 1; // Enable: 1=Operator may input MANUAL
C_AUTOP_EN := 1; // Enable: 1=Operator may input AUTO
C_LIOP_SEL := 0; // Select: 1=Linking, 0=Operator Active
C_AUT_L := 0; // Linkable Input for MANUAL/AUTO Mode
C_MONITOR := 1; // Select: 1=Monitoring ON, 0=Monitoring OFF
C_TIME_MON := 3; // Monitoring Time for ON [s]
C_SAMPLE_T := 1; // Sample Time [s]
C_AUX_PR04 := 0; // Auxiliary Value 4
C_AUX_PR05 := 0; // Auxiliary Value 5
C_AUX_PR06 := 0; // Auxiliary Value 6
C_AUX_PR07 := 0; // Auxiliary Value 7
C_AUX_PR08 := 0; // Auxiliary Value 8
C_AUX_PR09 := 0; // Auxiliary Value 9
C_AUX_PR10 := 0; // Auxiliary Value 10
C_MSG_EVID := 0; // Message ID
C_BA_EN := 0; // Batch Enable
C_OCCUPIED := 0; // Occupied by Batch
C_BA_ID := 0; // Batch ID
C_BA_NA := ''; // Batch Name
C_STEP_NO := 0; // Batch Step Number
C_RUNUPCYC := 3; // Lag: Number of Run Up Cycles
C_START_OFF := 1; // 1=Start up with Motor OFF
C_FAULT_OFF := 1; // 1=In case of fault: Motor OFF
C_MSS_OFF := 1; // 1=In case of MSS fault: Motor OFF
C_USTATUS := 0; // User STATUS Bits
C_QERR := 1; // 1=Error
C_QMSS_ST := 0; // Unacknowledged Motor Protective Switch
C_QMON_ERR := 0; // 1=Monitoring Error
C_QGR_ERR := 0; // 1=Group Error
C_QOP_ERR := 0; // 1=Operator Error
C_QRUN := 0; // Status: 1=Motor running
C_QSTOP := 0; // Status: 1=Motor STOP
C_QSTART := 0; // Control Output 1=START Active
C_QC_QSTART := 16#80; // Quality Code for Output QSTART
C_QON_OP := 0; // Status: 1=Operator enabled for "ON"
C_QOFF_OP := 0; // Status: 1=Operator enabled for "OFF"
C_QMAN_AUT := 0; // 1=AUTO, 0=MANUAL Mode
C_QMANOP := 0; // Status: 1=Oper. enabled for "MANUAL" Mode
C_QAUTOP := 0; // Status: 1=Operator enabled for "AUTO" Mode
C_QMSG_ERR := 0; // 1=Message ERROR
C_QMSG_SUP := 0; // 1=Message Suppression Active
C_MSG_STAT := 0; // Message: STATUS Output
C_MSG_ACK := 0; // Message: ACK_STATE output
C_VSTATUS := 0; // Status word
END_CONST
// Static Variables
VAR
sbI_OD1: BOOL := 0; // Flag of old operating value for OP_D.1
sbI_OD2: BOOL := 0; // Flag of old operating value for OP_D.2
sbQ_OD1: BOOL := 0; // Binary output for OP_D.1
sbALT_LINK_I_OT1: BOOL := 0; // Old value of interconnectable input for OP_TRIG.1
sbALT_QSTART: BOOL := 0; // Historical process data for QSTART
sb_SIG_1: BOOL := FALSE; // ALARM_8P signal 1 flag
sb_SIG_2: BOOL := FALSE; // ALARM_8P signal 2 flag
sb_SIG_3: BOOL := FALSE; // ALARM_8P signal 3 flag
srAktZeit: REAL := 0; // Time passed
siRUNUPCNT: INT := 0; // Counter for RUNUPCYC editing
VSTATUS_LOC : DWORD :=16#0; // Local variable, into which the VSTATUS output is copied
STEP_NO_LOC : DWORD; // Local variable, into which the STEP_NO input is copied
BA_ID_LOC : DWORD; // Local variable, into which the BA_ID input is copied
// Temporary variables
VAR_TEMP
TOP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
START_UP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
ERR : INT; // Startup error
pbLINK_ON_OD1: BOOL; // Operating/Interconnection flag for OP_D.1.
pbLINK_I_OD1: BOOL; // Interconnectable input for OP_D.1.
pbQOP_ERR: BOOL; // Operating error pointer for OP_D.1.
pbLINK_I_OT1: BOOL; // Interconnectable input for OP_TRIG.1.
pbQ_OT1: BOOL; // Binary output for OP_TRIG.1.
pbALARM: BOOL; // Call up ALARM_8P
pbM_SUP: BOOL; // Message suppression
END_VAR
BEGIN
// Supply of the VSTATUS, resave STEP_NO as STEP_NO_LOC,
// Resave BA_ID as BA_ID_LOC
// Supply of the VSTATUS output variable with the inputs.
VSTATUS_STR.VSTATUS_LOW_BIT_0 := OCCUPIED;
VSTATUS_STR.VSTATUS_LOW_BIT_1 := BA_EN;
// Supply of the VSTATUS output variable (HIGH BYTE) with the values
// that come from the user via the input variable USTATUS (from external).
VSTATUS_STR.USTATUS := USTATUS;
// Resave STEP_NO as STEP_NO_LOC and resave BA_ID as BA_ID_LOC
STEP_NO_LOC := STEP_NO; // Resave, due to output of STEP_NO_LOC in ALARM_8P
BA_ID_LOC := BA_ID; // Resave, due to output of BA_ID_LOC in ALARM_8P
ERR := RD_SINFO (TOP_SI := TOP_SI, START_UP_SI := START_UP_SI); // Read out
// start info
// pbM_SUP := FALSE;
IF (TOP_SI.NUM = 100) AND START_OFF THEN
siRUNUPCNT := RUNUPCYC; // Save the value of the RUNUPCYC input
// Initial states
// Outputs to be set
RESET := C_RESET;
MAN_ON := C_MAN_ON;
AUT_ON_OP := C_AUT_ON_OP;
QERR := C_QERR;
QMSS_ST := C_QMSS_ST;
QMON_ERR := C_QMON_ERR;
QGR_ERR := C_QGR_ERR;
QOP_ERR := C_QOP_ERR;
QRUN := C_QRUN;
QSTOP := C_QSTOP;
QSTART := C_QSTART;
QC_QSTART := QC_QSTART_I; // Quality output described with value of input
QON_OP := C_QON_OP;
QOFF_OP := C_QOFF_OP;
QMAN_AUT := C_QMAN_AUT;
QMANOP := C_QMANOP;
QAUTOP := C_QAUTOP;
QMSG_ERR := C_QMSG_ERR;
// QMSG_SUP := C_QMSG_SUP;
MSG_STAT := C_MSG_STAT;
MSG_ACK := C_MSG_ACK;
// Static variables to be set
sbI_OD1 := C_MAN_ON; // Reset flag of old operating value for OP_D.1.
// to zero
sbI_OD2 := C_AUT_ON_OP; // Reset flag of old operating value for OP_D.2.
// to zero
sbQ_OD1 := 0; // Has to be set for incorrect operator
sbALT_LINK_I_OT1 := L_RESET; // Previous value set by LINK_I
sbALT_QSTART := C_QSTART; // Set previous STOP-Modi
srAktZeit := 0; // Set acttime to NULL (zero)
pbALARM :=TRUE; // Initialization ALARM_8P
ELSE;
// MOTOR Algorithm
// OP_D.2 Select manual or automatic mode
pbQOP_ERR := FALSE; // Is only set to 1 in fault scenarios
IF LIOP_SEL THEN
// Interconnection
IF AUT_ON_OP = sbI_OD2 THEN
;// No operation occurs
ELSE;
pbQOP_ERR := TRUE; // Prohibited operator
END_IF;
AUT_ON_OP := AUT_L;
// Write AUT_L back to operator input
QMAN_AUT := AUT_L; // Interconnection
QMANOP := FALSE; // No operator allowed
QAUTOP := FALSE;
ELSE;
// Operator
IF (sbI_OD2 <> AUT_ON_OP) AND
NOT ((AUT_ON_OP AND AUTOP_EN) OR (NOT(AUT_ON_OP) AND MANOP_EN)) THEN
// Prohibited operator
pbQOP_ERR := TRUE;
AUT_ON_OP := sbI_OD2;
ELSE; // No or allowed operator
QMAN_AUT := AUT_ON_OP;
END_IF;
QMANOP := MANOP_EN;
// Copy the inputs to the outputs
QAUTOP := AUTOP_EN;
END_IF;
IF MONITOR THEN
// If the monitor is active, the change from Q_START has to be written
// immediately to the output.
IF FB_ON = QSTART THEN // Before the monitor time expires,
// same Feedback and QSTART
srAktZeit := 0;
IF QSTART THEN // Report the corresponding feedback status
QRUN := 1;
ELSE;
QSTOP := 1;
END_IF;
END_IF;
END_IF;
IF srAktZeit < SAMPLE_T THEN // If the monitor time expires, does the <=
IF MONITOR THEN // watchdog then < instead function?
IF ( FB_ON <> QSTART ) AND ( NOT pbQ_OT1 ) THEN
// After the monitor time, feedback and QSTART are different
QMON_ERR := 1;
ELSE; END_IF;
ELSE;
IF QSTART THEN // Set QRUN and QSTOP
QRUN := 1;
QSTOP := 0;
ELSE;
QRUN := 0;
QSTOP := 1;
END_IF;
END_IF;
END_IF;
// Control signal
sbALT_QSTART := QSTART;
QGR_ERR := QMON_ERR OR QMSS_ST OR CSF;
QSTART := sbQ_OD1 AND ((NOT(QMON_ERR AND FAULT_OFF)) OR LOCK_ON);
QC_QSTART := QC_QSTART_I; // Describe quality output with value of input.
// Watchdog - 3 -
// Set QRUN and QSTOP
IF QSTART THEN // Adapt QRUN and QSTOP to the previous value of QSTART.
QSTOP := 0;
ELSE;
QRUN := 0;
END_IF;
IF siRUNUPCNT = 0 THEN
// Initialize alarm
// pbALARM := (sb_SIG_1 <> QMSS_ST)
// OR (sb_SIG_2 <> QMON_ERR) OR (sb_SIG_3 <> CSF);
pbALARM :=TRUE; // Initialization ALARM_8P
ELSE;
siRUNUPCNT := siRUNUPCNT - 1;
QMSG_SUP := TRUE;
pbALARM := FALSE; // Initialization no ALARM
END_IF;
END_IF;
IF pbALARM THEN // Call up ALARM_8P
IF siBA_ID <> BA_ID_LOC THEN
// STRING variables may not be interconnected to ALARM8_P as auxiliary
// process values, therefore transferred in ARRAY OF BYTE.
FOR ERR := 1 TO 32
DO
sbyBA_NA[ERR] := 0; // Delete array as default
END_FOR;
ERR := BLKMOV (SRCBLK:= BA_NA,DSTBLK:=sbyBA_NA);
siBA_ID := BA_ID_LOC; // Save modified BA_ID
END_IF;
A.3 Valve
// @(#) $Header:: L:/PCS7/PCS7LibV51.SW/TechBlocks/VCS/Algorithm/valv$
//Copyright (C) Siemens AG 1995. All Rights Reserved. Confidential
(*----------------------------------------------------------------------------
1. OP_D.2
2. OP_TRIG.1
3. Watchdog RESET Logic
4. SEL_BOOL.1
5. OP_D.1
6. Watchdog (remaining)
7. XOR
8. MESSAGE
----------------------------------------------------------------------------*)
//PCS 7 Library Vx.x
//Funktion: Single-Drive/Dual-Feedback Valve
//Etikett-Version 3.0
//Makro-Version :V0.92
FUNCTION_BLOCK "VALVE"
TITLE = 'Single-Drive/Dual-Feedback Valve'
//
{
S7_tasklist:= 'OB100';
S7_alarm_ui:= '1';
S7_m_c:= 'true'
}
AUTHOR: TECHN61
NAME: VALVE
VERSION: '3.0'
FAMILY: CONTROL
KNOW_HOW_PROTECT
VAR_INPUT
OOS {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='In Service';
S7_string_1:='Out of Service'} : BOOL := 0; // 1= Out of Service
V_LOCK {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Lock to SAVE position
VL_OPEN {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Lock to OPEN
VL_CLOSE {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Lock to CLOSE
AUTO_OC {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // AUTO Mode:1=Open, 0=Close
SS_POS {S7_dynamic:='true';
S7_edit:='para';
S7_m_c:='true'} : BOOL := 0; // Safe Position. 1=Open, 0=Close
START_SS {S7_visible:='false'} : BOOL := 1; // 1=Start with Safe State Position
// and Manual Mode.
FAULT_SS {S7_visible:='false'} : BOOL := 1; // 1=In Case of fault: Safe State
// Position.
L_RESET {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // Linkable Input RESET
CSF {S7_dynamic:='true'} : BOOL := 0; // Control System Fault 1=External Error
FB_OPEN {S7_qc:='true';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Feedback: 1=OPEN
QC_FB_OPEN : BYTE := 16#80; // Quality Code for FB_OPEN
FB_CLOSE {S7_qc:='true';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Feedback: 1=CLOSE
QC_FB_CLOSE : BYTE := 16#80; // Quality Code for FB_CLOSE
QC_QCONTROL_I : BYTE := 16#80; // Quality Code for Input QCONTROL
NO_FB_OP {S7_visible:='false'} : BOOL := 0; // 1=No Feedback OPEN present
NO_FB_CL {S7_visible:='false'} : BOOL := 0; // 1=No Feedback CLOSE present
MONITOR {S7_link:='false';
S7_m_c:='true';
S7_string_0:='Monitoring=Off';
S7_string_1:='Monitoring=On'} : BOOL := 1; // Select: 1=Monitoring ON,
// 0=Monitoring OFF
NOMON_OP {S7_visible:='false'} : BOOL := 0; // 1=No Monitoring OPEN
NOMON_CL {S7_visible:='false'} : BOOL := 0; // 1=No Monitoring CLOSE
OP_OP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input OPEN
CL_OP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input CLOSE
MANOP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input MANUAL
AUTOP_EN {S7_visible:='false'} : BOOL := 1; // Enable: 1=Operator may input AUTO
LIOP_SEL {S7_contact:='true'} : BOOL := 0; // Select: 1=Linking, 0=Operator Active
AUT_L {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // Linkable Input for MANUAL/AUTO Mode
TIME_MON {S7_link:='false';
S7_edit:='para';
S7_m_c:='true';
S7_shortcut:='Mon. Time';
S7_unit:='s'} : REAL := 3; // Monitoring Time [s]
SAMPLE_T {S7_visible:='false';
S7_sampletime:='true'} : REAL := 1; // Sample Time [s]
MSG_EVID {S7_visible:='false';
S7_link:='false';
S7_param :='false';
S7_server:='alarm_archiv';S7_a_type:='alarm_8p'} : DWORD := 0; // Message ID
BA_EN {S7_visible:='false';
S7_m_c:='true'} : BOOL := 0; // Batch Enable
OCCUPIED {S7_visible:='false';
S7_m_c:='true'} : BOOL := 0; // Occupied by Batch
BA_ID {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Batch ID
BA_NA {S7_visible:='false';
S7_m_c:='true'} : STRING[32] := ''; // Batch Name
STEP_NO {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Batch Step Number
RUNUPCYC {S7_visible:='false';
S7_link:='false'} : INT := 3; // Lag: Number of Run Up Cycles
USTATUS {S7_visible:='false'} : WORD := 0; // User STATUS Bits
END_VAR
VAR_IN_OUT
RESET {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='0';
S7_string_1:='Error=Reset'} : BOOL := 0; // Operator Input Error Reset
MAN_OC {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Valve=Close';
S7_string_1:='Valve=Open'} : BOOL := 0; // Operator Input: 1=OPEN, 0=CLOSE
AUT_ON_OP {S7_visible:='false';
S7_link:='false';
S7_m_c:='true';
S7_string_0:='Mode=Manual';
S7_string_1:='Mode=Auto'} : BOOL := 0; // Operator Input Mode 1=AUTO,
// 0= MANUAL
AUX_PR04 {S7_visible:='false'} : ANY; // Auxiliary Value 4
AUX_PR05 {S7_visible:='false'} : ANY; // Auxiliary Value 5
AUX_PR06 {S7_visible:='false'} : ANY; // Auxiliary Value 6
AUX_PR07 {S7_visible:='false'} : ANY; // Auxiliary Value 7
AUX_PR08 {S7_visible:='false'} : ANY; // Auxiliary Value 8
AUX_PR09 {S7_visible:='false'} : ANY; // Auxiliary Value 9
AUX_PR10 {S7_visible:='false'} : ANY; // Auxiliary Value 10
END_VAR
VAR_OUTPUT
QERR {S7_visible:='false';
S7_m_c:='true'} : BOOL := 1; // 1=Error
QCONTROL {S7_qc:='true';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Control Output: 0=Standstill
QC_QCONTROL : BYTE := 16#80; // Quality Code Output for QCONTROL
QMON_ERR {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Monitoring Error
QGR_ERR {S7_dynamic:='true';
S7_contact:='true'} : BOOL := 0; // 1=Group Error
QMAN_AUT {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // 1=AUTO, 0=MANUAL Mode
QOP_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Operator Error
QOP_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "OPEN"
QCL_OP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "CLOSE"
QAUTOP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Operator enabled for "AUTO"
QMANOP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // Status: 1=Oper. ena. for "MANUAL" Mode
QOPENING {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Valve is Opening
QOPENED {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Valve is OPEN
QCLOSING {S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Valve is Closing
QCLOSED {S7_dynamic:='true';
S7_contact:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Valve is CLOSED
QMSG_ERR {S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // 1=Message ERROR
QMSG_SUP {S7_visible:='false';
S7_dynamic:='true';
S7_m_c:='true'} : BOOL := 0; // 1=Message Suppression Active
MSG_STAT {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: STATUS Output
MSG_ACK {S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: ACK_STATE-output
VSTATUS {S7_visible:='false';
S7_m_c:='true'} : DWORD := 0; // Status-word
END_VAR
CONST
C_OOS := 0; // 1= Out of Service
C_V_LOCK := 0; // 1=Lock to SAVE position
C_VL_OPEN := 0; // 1=Lock to OPEN
C_VL_CLOSE := 0; // 1=Lock to CLOSE
C_AUTO_OC := 0; // AUTO Mode:1=Open, 0=Close
C_SS_POS := 0; // Safe Position. 1=Open, 0=Close
C_START_SS := 1; // 1=Start with Safe State Position and Manual Mode
C_FAULT_SS := 1; // 1=In Case of Fault: Safe State Position
C_RESET := 0; // Operator Input Error Reset
C_L_RESET := 0; // Linkable Input RESET
C_CSF := 0; // Control System Fault 1=External Error
C_FB_OPEN := 0; // Feedback: 1=OPEN
C_QC_FB_OPEN := 16#80; // Quality Code for FB_OPEN
C_FB_CLOSE := 0; // Feedback: 1=CLOSE
C_QC_FB_CLOSE := 16#80; // Quality Code for FB_CLOSE
C_QC_QCONTROL_I := 16#80; // Quality Code for Input QCONTROL
C_NO_FB_OP := 0; // 1=No Feedback OPEN present
C_NO_FB_CL := 0; // 1=No Feedback CLOSE present
C_MONITOR := 1; // Select: 1=Monitoring ON, 0=Monitoring OFF
C_NOMON_OP := 0; // 1=No Monitoring OPEN
C_NOMON_CL := 0; // 1=No Monitoring CLOSE
C_MAN_OC := 0; // Operator Input: 1=OPEN, 0=CLOSE
C_OP_OP_EN := 1; // Enable 1=Operator may input OPEN
C_CL_OP_EN := 1; // Enable: 1=Operator may input CLOSE
C_AUT_ON_OP := 0; // Operator Input Mode 1=AUTO, 0= MANUAL
C_MANOP_EN := 1; // Enable: 1=Operator may input MANUAL
C_AUTOP_EN := 1; // Enable: 1=Operator may input AUTO
C_LIOP_SEL := 0; // Select: 1=Linking, 0=Operator Active
C_AUT_L := 0; // Linkable Input for MANUAL/AUTO Mode
C_TIME_MON := 3; // Monitoring Time [s]
C_SAMPLE_T := 1; // Sample Time [s]
C_AUX_PR04 := 0; // Auxiliary Value 4
C_AUX_PR05 := 0; // Auxiliary Value 5
C_AUX_PR06 := 0; // Auxiliary Value 6
C_AUX_PR07 := 0; // Auxiliary Value 7
C_AUX_PR08 := 0; // Auxiliary Value 8
C_AUX_PR09 := 0; // Auxiliary Value 9
C_AUX_PR10 := 0; // Auxiliary Value 10
C_MSG_EVID := 0; // Message ID
C_BA_EN := 0; // Batch Enable
C_OCCUPIED := 0; // Occupied by Batch
C_BA_ID := 0; // Batch ID
C_BA_NA := ''; // Batch Name
C_STEP_NO := 0; // Batch Step Number
C_RUNUPCYC := 3; // Lag: Number of Run Up Cycles
C_USTATUS := 0; // User STATUS Bits
C_QERR := 1; // 1=Error
C_QCONTROL := 0; // Control Output: 0=Standstill
C_QC_QCONTROL := 16#80; // Quality Code Output for QCONTROL
C_QMON_ERR := 0; // 1=Monitoring Error
C_QGR_ERR := 0; // 1=Group Error
C_QMAN_AUT := 0; // 1=AUTO, 0=MANUAL Mode
C_QOP_ERR := 0; // 1=Operator Error
C_QOP_OP := 0; // Status: 1=Operator enabled for "OPEN"
C_QCL_OP := 0; // Status: 1=Operator enabled for "CLOSE"
C_QAUTOP := 0; // Status: 1=Operator enabled for "AUTO"
C_QMANOP := 0; // Status: 1=Oper. ena. for "MANUAL" Mode
C_QOPENING := 0; // 1=Valve is Opening
C_QOPENED := 0; // 1=Valve is OPEN
C_QCLOSING := 0; // 1=Valve is Closing
C_QCLOSED := 0; // 1=Valve is CLOSED
C_QMSG_ERR := 0; // 1=Message ERROR
C_QMSG_SUP := 0; // 1=Message Suppression Active
C_MSG_STAT := 0; // Message: STATUS Output
C_MSG_ACK := 0; // Message: ACK_STATE-output
C_VSTATUS := 0; // Status-word
END_CONST
// Static variables
VAR
sbRESTART: BOOL := 1; // First run(Default is1)
sb_SIG_1: BOOL := FALSE; // ALARM_8P signal 1 flag
sb_SIG_2: BOOL := FALSE; // ALARM_8P signal 2 flag
//------------------------ Watchdog----------------------------
sbOC: BOOL := FALSE; // Old values direction
srAKTZEIT: REAL := 0; // Current time of the on-delay
siRUNUPCNT: INT := 0; // Counter for RUNUPCYC editing
//------------------------ ALARM_8P.1 -----------------------------
ALARM_8P_1: ALARM_8P; // Multi-instanced ALARM_8P
dwDUMMY: DWORD := 0; // Stand-by
siBA_ID: DWORD := 0; // Old value BA_ID
sbyBA_NA: ARRAY[1..32] OF BYTE := 32(0);
VSTATUS_LOC : DWORD := 16#0; // Local variable, into which the VSTATUS output is copied.
STEP_NO_LOC : DWORD; // Local variable, into which the STEP_NO input is copied.
BA_ID_LOC : DWORD; // Local variable, into which the BA_ID input is copied.
// Temporary variables
VAR_TEMP
TOP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
START_UP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
ERR : INT; // Startup error
pbALARM: BOOL; // Call up ALARM_8P
pbM_SUP: BOOL; // Message suppression
//-------------------------- SEL_BOOL.1 -------------------------
pbSEL_BOOL_Q: BOOL; // SEL_BOOL 1 output
//-------------------------- OP_D.1 and 2 -------------------------
pbQOP_ERR: BOOL; // Temporary output value
//-------------------------- OP_TRIG.1 -------------------------
pbRESET: BOOL; // RESET (Ausgang Q)
//-------------------------- Watchdog -------------------------
pbQMON_ERR: BOOL; // Watchdog error
pbVerfahren: BOOL; // Valve travel
//-------------------------- Feedback -------------------------
pbFB_OPEN: BOOL;
pbFB_CLOSE: BOOL;
END_VAR
BEGIN
// Write VSTATUS, resave STEP_NO as STEP_NO_LOC, resave BA_ID as BA_ID_LOC.
// Supply of the VSTATUS output variable with the inputs.
VSTATUS_STR.VSTATUS_LOW_BIT_0 := OCCUPIED;
VSTATUS_STR.VSTATUS_LOW_BIT_1 := BA_EN;
// Supply of the VSTATUS output variable (HIGH BYTE) with the values
// that come from the user via the input variable USTATUS (from external).
VSTATUS_STR.USTATUS := USTATUS;
//Resave STEP_NO as STEP_NO_LOC und resave BA_ID as BA_ID_LOC
STEP_NO_LOC := STEP_NO; // Resave, due to output of STEP_NO_LOC in ALARM_8P
BA_ID_LOC := BA_ID; // Resave, due to output of BA_ID_LOC in ALARM_8P
ERR := RD_SINFO (TOP_SI := TOP_SI, START_UP_SI := START_UP_SI); // Read out
// start info.
pbM_SUP := FALSE;
IF TOP_SI.NUM = 100 OR sbRESTART THEN // Startup or first run
sbRESTART := FALSE; // No first run anymore
QMON_ERR := C_QMON_ERR; // No error
pbALARM :=TRUE; // Initialization ALARM_8P
IF START_SS THEN // At Start SafeStatePosition?
AUT_ON_OP := false; // Manual mode
sbAUT_ON_OP := false; // Manual mode
sbMAN_OC := SS_POS; // Idle position
MAN_OC := SS_POS; // Write back idle position
sbD1_Q_OC := SS_POS; // Idle position
srAKTZEIT := 0; // Initialize watchdogs time
QMAN_AUT := C_QMAN_AUT; // Manual
QOPENING := C_QOPENING; // No movement
QCLOSING := C_QCLOSING;
sbL_RESET := C_L_RESET; // No RESET
RESET := C_RESET; // No RESET
QCONTROL := C_QCONTROL; // Idle position
QC_QCONTROL := QC_QCONTROL_I; // Describe quality output with values of
// input.
QMSG_ERR := C_QMSG_ERR;
QMSG_SUP := C_QMSG_SUP;
MSG_STAT := C_MSG_STAT;
MSG_ACK := C_MSG_ACK;
QGR_ERR := C_QGR_ERR;
QCL_OP := C_QCL_OP;
QOP_OP := C_QOP_OP;
QOP_ERR := C_QOP_ERR;
QMANOP := C_QMANOP;
QAUTOP := C_QAUTOP;
ELSE;
IF (NOT AUT_ON_OP AND // Manual mode
MONITOR) THEN // Watchdog active
IF NOT NO_FB_OP AND // Feedback OPEN available
FB_OPEN THEN // Feedback available
MAN_OC := TRUE; // Track operator input
QCONTROL := (MAN_OC XOR SS_POS);
THEN
pbSEL_BOOL_Q := SS_POS; // Idle position
IF (NOT V_LOCK) THEN
IF VL_CLOSE THEN
pbSEL_BOOL_Q := 0; // Close valve
ELSE;
IF VL_OPEN THEN
pbSEL_BOOL_Q := 1; // Open valve
END_IF;
END_IF;
END_IF;
ELSE;
pbSEL_BOOL_Q := AUTO_OC; // Automatic value
END_IF;
// OP_D.1 (optimized and expanded with LINK_ON calculation) - 5 -
IF QMAN_AUT OR V_LOCK OR VL_OPEN OR VL_CLOSE OR (pbQMON_ERR AND FAULT_SS)
// LINK_ON
THEN // Interconnection
IF MAN_OC = sbMAN_OC THEN
; // Keine Bedienung erfolgt
ELSE;
pbQOP_ERR := TRUE; // Prohibited operator
END_IF;
IF sbD1_Q_OC <> pbSEL_BOOL_Q THEN // Valve travel?
pbVerfahren := TRUE;
sbD1_Q_OC := pbSEL_BOOL_Q; // LINK_I
END_IF;
MAN_OC := sbD1_Q_OC; // Write output back to operator input
// (BTRACK is always1).
ELSE; // Bedienung
IF (sbMAN_OC <> MAN_OC) AND
NOT ((MAN_OC AND OP_OP_EN) OR (NOT(MAN_OC) AND CL_OP_EN)) THEN
pbQOP_ERR := TRUE; // Prohibited operator
MAN_OC := sbMAN_OC;
// Write back old operating values
ELSE;
IF sbD1_Q_OC <> MAN_OC THEN // Valve travel?
// Allowed operator
pbVerfahren := TRUE;
sbD1_Q_OC := MAN_OC;
END_IF;
END_IF;
END_IF;
sbMAN_OC := MAN_OC; //Note old operating values
IF pbVerfahren // Valve is traveled -> Reposition watchdog time
THEN
IF TIME_MON < SAMPLE_T THEN
srAKTZEIT := SAMPLE_T;
ELSE;
srAKTZEIT := TIME_MON;
END_IF;
END_IF;
Asynchronous OBs
Asynchronous OBs (organization blocks) are called by the operating system of the
CPU when asynchronous events occur (for example errors).
AUTHOR
Block attribute:
When a block library is used, this contains the library name. It is also used to
identify the help file belonging to the library.
BATCH flexible
A program package for creating complex recipe controls for the entire range from
small to large-scale applications.
Block attribute
Using the block attributes ( FUNCTION_BLOCK, TITLE, List of system
attributes, AUTHOR, NAME, VERSION, FAMILY,
KNOW_HOW_PROTECT) of the block, you can influence the object properties of
your block.
Block header
1. Section of the PLC block with administrative information ( block
attributes).
2. The upper part of the block in the graphic representation in CFC containing the
name (block type, block name), comment and the task assignment (run-time
property).
Block icon
Symbolic display of the most important information of a PLC block. The
corresponding faceplate can be opened with the block icon.
CFC
Continuous Function Chart
1. This is a function chart on which blocks can be placed, interconnected, and
assigned parameters. A CFC chart consists of 1 to 26 chart partitions each
with 6 sheets.
2. Editor for plant-oriented graphic configuration of automation tasks. Using the
CFC editor, a complete software structure (CFC chart) can be created from
ready-made blocks.
CNT file
Optional part of an online help system. The CNT file contains the contents of the
online help system.
Code section
Part of a block containing the algorithm of the block.
Declaration section
Part of a block defining the interface of the block and the data it uses internally.
Faceplate
Graphic representation of all the elements of a PLC block intended for operator
control and monitoring on an OS.
FAMILY
Block attribute:
When a block library is used, this contains a common name for a subset of the
blocks. FAMILY and NAME form part of the key for locating the help text of a
block in the online help system.
Function (FC)
Specified in IEC 1131–3 as a software unit that provides a single result when it
executes (can also be a structured data type) and does not have memory for
storing data. The major difference between an FC and an FB is the absence of
data storage.
FUNCTION_BLOCK
Block attribute:
Contains the symbolic name of the block. This is used to display the name of the
block in the SIMATIC Manager and in the CFC chart.
Global script
Within WinCC, global script is the generic term for C functions created by the
user that can be used throughout a project and in multiple projects.
Graphics Designer
Graphic editor in WinCC for creating faceplates.
HID
Higher-level identifier: This is made up of the name of the plant hierarchy folders
that are selected to form part of the name and of the CFC chart and the block in the
CFC chart.
Initial start
The first time that a block is executed following its instantiation. Following this first
execution, the parameters and modes of the block are in a defined state.
KNOW_HOW_PROTECT
Block attribute:
When this attribute is set, it protects the algorithm of the block from being viewed or
modified unless the source file is in the same program.
Library
Software package with PLC blocks and/or faceplates grouped according to
common features.
Message list
From within the run-time system of WinCC, it is possible to display and edit lists
of messages. The messages displayed in the lists relate only the currently active
project.
Monitoring
Part of the functions of an OS allowing visualization of the process parameters and
statuses in various forms (numeric, graphic).
NAME
Block attribute:
Contains the symbolic name of the block; identical to FUNCTION_BLOCK.
NAME and FAMILY form part of the key for locating the help text of a block in
the online help system.
OK flag
The OK flag is a system-internal variable. If an error occurs during execution of an
option, for example overflow with arithmetic operations, the OK flag is changed by
the system and passed to the ENO block output.
Operator authorization
The right assigned to the operator to modify the PLC block parameter.
Operator control
Procedure in which the operator changes the value or status of a block. Generally,
such operations involve input at the operator station which is then checked and
passed to the block on the PLC. Here, the instruction is checked again before is
assigned to the block since it is possible that process conditions have changed
since the instruction was sent from the OS and received at the PLC.
PLC block
An object belonging to a library or a block structure that contains part of the S7
user program. The blocks that are executed in the CPU of a PLC are known as
PLC blocks.
Prototype picture
Prototype pictures are used by WinCC to reuse picture components that have
already been configured. The prototype picture technique makes use of template
pictures that can be included more than once in one or more parent pictures. A
prototype is simply a template that only "comes to life" in a real object. An object
based on a template is created by instantiation. Several instances (on other words
real objects) can be created from a template.
Registration file
And ASCII file (.reg) containing all the information such as path, MAP IDs for online
help systems, for example to enter a block in the WINDOWS NT registry. Using
this registration file, the online help for a selected block can be started in the
required language in CFC or in the SIMATIC Manager.
SCL
Higher-level programming language for formulating solutions to technological tasks
in SIMATIC S7 (similar to PASCAL) complying with the ST (structured text)
language specified in IEC 1131–3.
Standard view
View of a faceplate in which the most important values of the corresponding
PLC block are visualized.
Start info
The start information is part of an organization block (OB). It informs the S7 user in
detail of the event that triggered the OB call.
STL
Statement List: Statement List is a textual programming language complying with
IEC 1131-3 and resembling machine code.
TITLE
Block attribute:
This information is not evaluated in PCS 7, however, it is displayed in the
SIMATIC Manager in the object properties of the block in the comment field.
Trend view
View of a faceplate in which the most important values of the corresponding
PLC block are visualized over time.
UDT
User-defined data types
VERSION
Block attribute:
Contains the version number of the block
View
View of a block in which certain values of a PLC block are displayed (for example,
trend view, alarm view, standard view etc.).
WinCC
Windows Control Center: A software package for plant-oriented graphic
development of faceplates and for operator control and monitoring of the PLC.
E Messages.............................................. 1-31
MOT_REV
ELAP_CNT Block icon ........................................ 2-112
Block icon........................................ 2-106 MOT_SPED
Block icon ........................................ 2-111
F MOTOR ...............................................A-7
Block icon ........................................ 2-110
Faceplate
Multiple instance ..........................1-22, 2-11
Configuring.......................................... 2-3
Multiple instance block.......................... 1-22
Design................................................. 2-2
Test ..................................................... 2-4
Faceplate Designer ................................ 2-5 N
Faceplates ............................................ 2-83 Naming conventions ............................. 1-46
FMCS_PID
Block icon........................................ 2-105
FMT_PID
O
Block icon........................................ 2-105 Object properties of the block ........1-9, 1-10
Object toolkit ........................................... 2-6
G Online Help ............................................. 3-1
OP_A ....................................................1-30
Global scripts.......................................... 2-6 Block icon ........................................ 2-108
Global views ......................................... 2-87 OP_A_LIM ............................................ 1-30
Group display ....................................... 2-58 OP_A_RJC ........................................... 1-30
OP_D
H Block icon ........................................ 2-113
OP_D3
Help file................................................... 3-1
Block icon ........................................ 2-113
Help topic................................................ 3-1
OP_TRIG
HLP file ................................................... 3-2
Block icon ........................................ 2-113
Horizontal bar graph............................. 2-53
Operator control functions .................... 1-30
Output parameters ................................ 1-14
I Overview ............................................... 2-10
In/out parameters ................................. 1-14
INCLUDE statement............................... 3-2 P
Initialization........................................... 1-25
Parameter attributes ............................. 2-28
Input parameters .................................. 1-14
Parameter types.................................... 1-14
Installation script..................................... 4-2
Permission ............................................ 2-71
InstallShield ............................................ 4-1
Picture................................................... 2-82
INTERLOK
Picture templates .................................... 2-6
Block icon........................................ 2-112
L Q
Quality Code display ............................. 2-77
Labeling
check box.......................................... 2-60
Language ID ........................................... 3-2 R
Library..................................................... 4-1 Range of numbers ................................ 1-46
Local variables...................................... 1-22 RATIO_P
Locked .................................................. 2-58 Block icon ........................................ 2-107
Regional language .................................. 1-6
M Registry file ............................................. 3-3
MEAS_MON ........................................... A-1
Block icon........................................ 2-106
Message class...................................... 1-41
Message origin ..................................... 1-40
Message suppression .......................... 2-56
Message view....................................... 2-87