53
Applikationen & Tools Answers for industry. Deckblatt S7-300 / S7-400 Package Unit Integration in SIMATIC PCS 7 SIMATIC PCS 7 Application Example y October 2009

Wincc Flexible and Cfc

Embed Size (px)

Citation preview

  • Applikationen & Tools

    Answers for industry.

    Deckblatt

    S7-300 / S7-400 Package Unit Integration in SIMATIC PCS 7

    SIMATIC PCS 7

    Application Example y October 2009

  • 2 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Reference to Automation and Drives Service & Support This article is from the internet application portal of the Industry Automation and Drives Technologies Service & Support. Clicking the link below directly displays the download page of this document. http://support.automation.siemens.com/WW/view/en/39203658 In case of questions to this entry please contact us via the following e-mail adress: [email protected]

  • Integration of Package Units 1.0, Beitrags-ID: 39203658 3

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    s

    SIMATIC Integration of Package Units SIMATIC PCS 7

    Preface 1

    Software development SIMATIC S7 control

    2 Specifications when choosing the system

    3

    OS transfer 4

    Connecting WinCC flexible to CFC programs

    5 Compiling the TIA projects and PCS 7

    6

    Internet Links 7

    History 8

  • Warranty, liability and support

    4 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Warranty, liability and support Note The application examples are not binding and do not claim to be complete re-

    garding the circuits shown, equipping and any eventuality. The application ex-amples do not represent customer-specific solutions. They are only intended to pro-vide support for typical applications. You are responsible in ensuring that the de-scribed products are correctly used. These application examples do not relieve you of the responsibility in safely and professionally using, installing, operating and servicing equipment. When using these application examples, you recognize that Siemens cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these application examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications - e.g. Catalogs - then the contents of the other documents have priority.

    We do not accept any liability for the information contained in this document. Any claims against us - based on whatever legal reason - resulting from the use of the examples, information, programs, engineering and performance data etc., described in this application example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (wesentliche Vertragspflichten). However, claims arising from a breach of a condition which goes to the root of the contract shall be limited to the foreseeable damage which is intrinsic to the contract, unless caused by intent or gross negligence or based on mandatory liability for injury of life, body or health The above provisions does not imply a change in the burden of proof to your detriment. Copyright 2009 Siemens I IA AS. It is not permissible to transfer or copy these application examples or excerpts of them without first having prior authorization from Siemens I IA AS in writing.

  • Inhaltsverzeichnis

    Integration of Package Units 1.0, Beitrags-ID: 39203658 5

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Inhaltsverzeichnis Warranty, liability and support ................................................................................... 4 1 Preface................................................................................................................ 6

    1.1 The goal of this document.................................................................... 6 2 Software development SIMATIC S7 control.................................................... 7

    2.1 Applicable editors and versions ........................................................... 7 2.2 Creating the TIA project as a multiproject Activity ............................... 8 2.3 Network configuration for the OS transfer.......................................... 13 2.4 Message processing by means of ALARM (_S / _ 8P) functions ...... 16 2.4.1 Description of the function ALARM_S................................................ 16 2.4.2 Description of the function ALARM_8P.............................................. 17 2.5 Generation of function blocks............................................................. 18 2.5.1 Generating the function blocks as a SCL/AWL source with

    "ALARM_8P" ...................................................................................... 18 2.5.2 Generating the function blocks with AWL using "ALARM_S" ............ 20 2.5.3 Parameterizing message properties in the block ............................... 24 2.6 Generating the PLC program ............................................................. 25

    3 Specifications when choosing the system ................................................... 26 4 OS transfer ....................................................................................................... 28 5 Connecting WinCC flexible to CFC programs .............................................. 33

    5.1 Function block "GetIDB" (determining the current entity block) ......... 34 5.1.1 Code example "GetIDB" in SCL......................................................... 34 5.1.2 Generating the ListDB........................................................................ 35 5.1.3 Integrating the function block into CFC.............................................. 35 5.1.4 Generating the WinCC flexible project in the SIMATIC Manager ...... 36 5.1.5 Entering tags in WinCC flexible with reference to an entity DB ......... 40

    6 Compiling the TIA projects and PCS 7 .......................................................... 42 7 Internet Links ................................................................................................... 52 8 History............................................................................................................... 53

  • Preface 1.1 The goal of this document

    6 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Preface 11.1 The goal of this document

    The goal of the present application is to describe how a S7 program with WinCC (TIA application) must be created, so that a later integration in a PCS 7 system is possible. STEP 7 / WinCC applications, e.g. for package units of machine manufacturers, are often created as a TIA application. Some of these applications must be integrated later into a control system of a production plant. To guarantee this, certain configuration specifications must be considered already while the application is being created. Furthermore this document describes the requirements and the necessary configuration steps to create a S7-300/S7-400 project with WinCC flexible application, which corresponds to the requirements for the integration in a PCS 7 system. The necessary methods are illustrated in step by step instructions.

    Main contents Following main points are explained in this document: Applicable editors (AWL, SCL, CFC) Conditions when choosing the system Measures for the OS transfer Connection of WinCC flexible to CFC programs Consolidating TIA projects and PCS 7

    Validity valid for PCS 7 from V6.0 to V7.1

  • Software development SIMATIC S7 control2.1 Applicable editors and versions

    Integration of Package Units 1.0, Beitrags-ID: 39203658 7

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Software development SIMATIC S7 control 2

    2.1 Applicable editors and versions

    For the development of the software for the SIMATIC S7 control, the editors can be used for KOP/FUP/AWL and CFC. In doing so, the use of CFC is recommended, because this editor offers a much higher clarity and also makes understanding and operation easier for programmers and service employees without much experience. However, because of the much higher memory requirements, it does not make much sense to use CFC for use with the compact CPUs S7-3xxC and S7-312 (memory 32 KB). When choosing a version, make sure that the software corresponds to the requirements of the PCS 7-version of the target system.

    Table 2-1

    PCS 7 Version STEP 7 Version CFC Version SFC Version WinCC Version 6.0 5.2 + HF2 6.0 6.0 6.0 6.0 + SP1 5.2 + HF5 6.0 + HF2 6.0 + HF2 6.0 + HF3 6.0 + SP2 5.2 + SP1 + HF1 6.0 + HF4 6.0 + HF3 6.0 + SP1 + HF1 6.0 + SP3 5.3 + HF2 6.0 + SP2 6.0 + SP1 6.0 + SP2 6.0 + SP3+ postal-fixed

    5.3 + HF4 6.0 + SP2 6.0 + SP1 6.0 + SP2 + HF2

    6.1 5.3 + SP1 + HF1 6.1 6.1 6.0 + SP3 6.1 + SP1 5.3 + SP2 + HF2 6.1 + SP1 6.1 + SP1 6.0 + SP3a 6.1 + SP2 5.3 + SP2 + HF12 6.1 + SP1 + HF9 6.1 + SP1 + HF1 6.0 + SP3a + HF17 6.1 + SP3 6.1 + SP1 + HF9 6.1 + SP1 + HF11 6.1 + SP1 + HF1 6.0 + SP3a + HF24 7.0 5.4 + SP1 + HF2 7.0 7.0 6.2 7.0 + SP1 5.4 + SP3 7.0 + SP1 7.0 + SP1 6.2 + SP2 7.0 + SP2 5.4 + SP3 + HF5 7.0 + SP1 + HF4 7.0 + SP1 + HF4 6.2 + SP2 + HF7 7.1 5.4 + SP4 + HF6 7.1 7.1 7.0 + SP1

    Table 1 shows the versions of the individual editors of the various PCS 7 versions It is recommended to install the abovementioned software versions from the installation data carriers of PCS 7, because the HF can only be obtained from the hotline.

  • Software development SIMATIC S7 control 2.2 Creating the TIA project as a multiproject Activity

    8 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.2 Creating the TIA project as a multiproject Activity

    The TIA project that is to be created must be created as a multiproject so that it can later easily be integrated into a PCS 7-project. In the multiproject an individual project is generated respectively for the S7 control and for the WinCC station.

    Table 2-2

    Activity Screenshot 1. To generate the multiproject,

    select in the menu bar File> New

    2. In the following dialog select the tab "Multiproject", enter the name (in our example "MP_AppNote") and the storage path of the multiproject and end the action with "OK".

  • Software development SIMATIC S7 control2.2 Creating the TIA project as a multiproject Activity

    Integration of Package Units 1.0, Beitrags-ID: 39203658 9

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 3. Creating the project for the

    SIMATIC S7 control: Select the multiproject and open the corresponding context menu with the right mouse button. Select Multiproject> Create in Multiproject .

    4. In the following dialog, enter the name (in our example "AppNote_AS") and the storage path of the project and end the action with "OK".

    5. Creating the project for the

    WinCC station: Select the multiproject and open the corresponding context menu with the right mouse button. Select Multiproject> Create in Multiproject .

  • Software development SIMATIC S7 control 2.2 Creating the TIA project as a multiproject Activity

    10 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 6. In the following dialog enter the

    name (in our example "AppNote_OS") and the storage path of the project and end the action with "OK".

    7. Inserting the SIMATIC S7

    control in the project "AppNote_AS": Select the project "AppNote_AS" and call up the corresponding context menu with the right mouse button. Select Insert New Object> SIMATIC 300 Station or SIMATIC 400 Station. Continue configuring the control as usual.

  • Software development SIMATIC S7 control2.2 Creating the TIA project as a multiproject Activity

    Integration of Package Units 1.0, Beitrags-ID: 39203658 11

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 8. Inserting the WinCC-Sation in

    the project "AppNote_OS": Select the project "AppNote_OS" and open the corresponding context menu with the right mouse button. Select Insert New Object> PC SIMATIC station.

    9. To configure the PC SIMATIC

    station you select in the project "AppNote_OS" the PC station and open the corresponding context menu with the right mouse button in the right window under "Configuration". Select "Open Object"

  • Software development SIMATIC S7 control 2.2 Creating the TIA project as a multiproject Activity

    12 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 10. In this dialog, configure the

    SIMATIC station, save it and close the dialog.

    11. This is what the multiproject

    looks like after completion.

  • Software development SIMATIC S7 control2.3 Network configuration for the OS transfer

    Integration of Package Units 1.0, Beitrags-ID: 39203658 13

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.3 Network configuration for the OS transfer

    In order to use the automatic generation of tags, messages and archives like in PCS 7, a network configuration must be created with NetPro. The various subnetworks (Ethernet / Profibus) are merged to form one. This was, the system knows the way with which the SIMATIC control communicates with the WinCC system.

    Table 2-3

    Activity Screenshot 1. Open the tool "NetPro" by

    selecting one of both projects in the project tree. Afterwards click on Options> Configure Network.

  • Software development SIMATIC S7 control 2.3 Network configuration for the OS transfer

    14 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 2. After opening the editor, select

    the menu point Edit> Merge/Unmerge Subnets> Ethernet Subnets .

    3. Name the common network (in

    our example "ProcBus_AppNote" and assign both subnets to this common network by selecting the subnetworks on the left side and assign them with the button. Confirm the merge with "OK"

    Confirm the message "You have

    merged subnets" with "OK".

  • Software development SIMATIC S7 control2.3 Network configuration for the OS transfer

    Integration of Package Units 1.0, Beitrags-ID: 39203658 15

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 4. To test whether or not the

    configuration is consistent select Save and Compile.

    5. Confirm the following dialog with

    "OK"

    6. If the settings are correct, you

    wont receive any error messages. Close the report.

  • Software development SIMATIC S7 control 2.4 Message processing by means of ALARM (_S / _ 8P) functions

    16 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.4 Message processing by means of ALARM (_S / _ 8P) functions

    The use of the ALARM functions is essential for an integration of the application in PCS 7. With the help of the alarm functions, all alarms and messages are generated automatically in WinCC/PCS 7 OS during the OS transfer. Here one differentiates in the function between ALARM_S and ALARM_8P. The ALARM_8P is applicable only for use with S7-400. With this block, a many messages can be configured. The number of possible messages depends on the CPU type and is listed in the technical data of the CPU. The ALARM_S is executable in S7-300 and S7-400. The number of the possible messages is particularly with small S7-300 CPUs very limited. How many messages are possible is listed in the technical data of the CPU.

    2.4.1 Description of the function ALARM_S

    Each time the SFC "ALARM_S" is called, it generates a message to which you can attach an accompanying value. The message is transmitted to all stations that are connected. The SFC makes an easy registration mechanism available to you. Make sure that you only call the SFC if the value of the message-triggering signal SIG is inverted compared to that of when it was last called. If this is not the case, you are informed of this with "RET_VAL", and no message is transmitted. You must make sure that when the SFC is called for the first time, the value 1 is present at the input SIG. Otherwise, you receive information about an error via RET_VAL, and no message is transmitted. Note: Call the SFC from a FB to which you have already assigned the suitable system attributes! The operating system occupies a system resource for the duration of a signal cycle when generating a message with ALARM_S. At "ALARM_S" from the SFC call with SIG=1the signal cycle lasts until the renewed call with SIG=0. At the "ALARM_SQ" the time span is, when applicable, increased by the time up to the acknowledgement of the coming signal by one of the connected display devices. If within the signal cycle an overcharging or delete of the message-generating block occurs, the respective system resource remains occupied up to the next restart (soft boot).

    Message acknowledgement You can acknowledge the messages transmitted by "ALARM_SQ" with signal status 1 on a connected display device. The messages which you have transmitted with "ALARM_S" are always implicitly acknowledged.

    Temporary storage of signal statuses "ALARM_SQ" and "ALARM_S" occupy system resources. Therein, among other things, the last two signal statuses are temporarily saved incl. time stamp and accompanying value. If a call of the SFC occurs at a time at which the signal statuses of the last two "valid" SFC calls havent yet been transmitted (signal overflow), the current and the last signal status are rejected and an overflow ID is entered in the temporary storage. At the next possible time the next to last signal including overflow ID is transmitted.

  • Software development SIMATIC S7 control2.4 Message processing by means of ALARM (_S / _ 8P) functions

    Integration of Package Units 1.0, Beitrags-ID: 39203658 17

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Entity overflow If the number of Alarm_S/SQ calling is larger than the maximum number of system resources of your CPU, a resource bottleneck may occur (entity overflow). You are informed of this not only by an error information in RET_VAL but also on the connected display devices.

    2.4.2 Description of the function ALARM_8P

    The SFB "ALARM_8P" monitors up to eight signals. Standard operation (i.e. the acknowledgement-triggered messaging is switched

    off): the block generates a message to which you can attach up to ten accompanying values not only at rising edge (the coming event) but also with falling edge (going event).

    The acknowledgement-triggered messaging is switched: The block doesnt generate any other messages after the generated coming message for the signal until you have acknowledged this coming message on a display device (see also introduction to the generation of block-related messages with SFBs)

    The message is transmitted to all connected devices. At the first call, a message with the current signal status is transmitted. After the arrival of your acknowledgement on a connected display device, the acknowledgement information is forwarded to all connected devices. For all eight signals there is a common message number which is split on the display device into eight smaller messages. You can acknowledge each message individually or also several messages at once. You can process the acknowledgement status of the single messages in your program with the output parameter ACK_STATE. If you disable or enable a message of an ALARM_8P block, it always affects the whole ALARM_8P block. Disabling and enabling individual signals is not possible. A message storage with 2 storage spaces per entity of the SFB 35 "ALARM_8P" is available. Further details about the temporary storage of signal changing can be found in the paragraph "Signal change compilation" at the introduction to the generation of block-related messages with SFBs.

    Message acknowledgement You can acknowledge the messages transmitted by "ALARM_8P" with signal status 1 on a connected display device.

    Temporary storage of signal statuses "ALARM_8P" occupies system resources. Therein, among other things, the last two signal statuses are temporarily saved incl. time stamp and accompanying value. If a call of the SFC occurs at a time at which the signal statuses of the last two "valid" SFC calls havent yet been transmitted (signal overflow), the current and the last signal status are rejected and an overflow ID is entered in the temporary storage. At the next possible time the next to last signal including overflow ID is transmitted.

    Entity overflow If the number of Alarm_8P calling is larger than the maximum number of system resources of your CPU, a resource bottleneck may occur (entity overflow). You are informed of this not only by an error information in RET_VAL but also on the connected display devices.

  • Software development SIMATIC S7 control 2.5 Generation of function blocks

    18 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.5 Generation of function blocks

    When generating function blocks, the languages AWL and SCL can be used. For this, some attributes must be assigned for the block, so that the needed tags and messages for the WinCC system are generated automatically when the OS transfer occurs.

    2.5.1 Generating the function blocks as a SCL/AWL source with "ALARM_8P"

    Preparing block for OS transfer: To mark that a function block should be regarded with the OS transfer, it must be given the attribute S7_m_c = 'true'. Code example SCL:

    FUNCTION_BLOCK FB100//Function block generated by SCL //Date: 2009-06-10 {S7_m_c: = 'true'}//attribute for operating and monitoring the block

    The same attribute receives in the following block every block connection that should be operated and monitored on WinCC, i.e. a tag for this connection is automatically generated with the OS transfer in WinCC. (only possibly with VAR_INPUT, VAR_OUTPUT, VAR_INOUT).

    Generating messages in the block: In order to generate messages with the alarm functions of the SIMATIC control described above, the SFC/SFB must be instantiated in the block and called with the necessary parameters. Code example SCL:

    FUNCTION_BLOCK FB100//Function block generated by SCL //Date: 2009-06-10 {S7_m_c: = 'true'}//attribute for operating and monitoring the block . . . VAR_INPUT

    IN1 {S7_visible: = 'true'}: BOOL;//input 1 TEXT1: STRING;//text as an accompanying value ALARM_8P MSG_EVID {S7_a_type: = 'alarm_8p'; S7_server: = 'alarm_archiv'}: DWORD; //Message EventID (generated by system)

    END_VAR VAR

    alarm_8p: "ALARM_8P"; SD_1: ARRAY [1 32] OF BYTE ; ret: INT;

    END_VAR VAR_OUTPUT

    OUT1 {S7_visible: = 'true'; S7_m_c: = 'true'}: BOOL; //S7_m_c: = 'true' the attribute is for operating and monitoring the block connection

    END_VAR

    BEGIN OUT1: = IN1; ret: = BLKMOV (SRCBLK: = TEXT1, DSTBLK: = SD_1); //alerting

  • Software development SIMATIC S7 control2.5 Generation of function blocks

    Integration of Package Units 1.0, Beitrags-ID: 39203658 19

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    alarm_8p ( EN_R: = TRUE,//ACK_STATE actualize SIG_1: = IN1, SIG_2: = FALSE, SIG_3: = FALSE, SIG_4: = FALSE, SIG_5: = FALSE, SIG_6: = FALSE, SIG_7: = FALSE, SIG_8: = FALSE, ID: = 16#EEEE, EV_ID: = MSG_EVID, SEVERITY: = 1, SD_1: = SD_1//, //The unused accompanying values must be commented out or be deleted! //Accompanying values must become consistently parameterized. Not needed accompa

    //nying values are //to be occupied by dummies. //SD_2: = 0, //SD_3: = 0, //SD_4: = 0, //SD_5: = 0, //SD_6: = 0, //SD_7: = 0, //SD_8: = 0, //SD_9: = 0, //SD_10: = 0

    ); END_FUNCTION_BLOCK

  • Software development SIMATIC S7 control 2.5 Generation of function blocks

    20 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.5.2 Generating the function blocks with AWL using "ALARM_S"

    Preparing block for OS transfer: To mark that a function block should be regarded with the OS transfer, it must be given the at-tribute S7_m_c = 'true'.

    Table 2-4

    Activity Screenshot 1. Paste the function block in the

    project. Open the context menu of the block container with the right mouse button. Select "Insert New Object> Function Block".

    2. Set the required properties in

    the following dialog. (In our example name: "FB101"; symbolic name: "FB_STL"; symbol comment: "Function block created by stl") Then you confirm the dialog with "OK".

  • Software development SIMATIC S7 control2.5 Generation of function blocks

    Integration of Package Units 1.0, Beitrags-ID: 39203658 21

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 3. Open the block in the editor.

    Select in the menu "File" the entry Properties .

    4. Switch to the tab "Attributes".

    Enter the attribute "S7_m_C" and the accompanying value "true" in the attribute table and close the dialog with "OK".

    The same attribute receives in the following block every block connection that should be operated and monitored on WinCC, i.e. a tag for this connection is automatically generated with the OS transfer in WinCC. (only possibly with VAR_INPUT, VAR_OUTPUT, VAR_INOUT).

  • Software development SIMATIC S7 control 2.5 Generation of function blocks

    22 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Table 2-5

    Activity Screenshot 1. pen the context menu of the

    block connection with the right mouse button. Select Object Properties .

    2. Switch to the tab "Attributes".

    Enter the attribute "S7_m_C" and the accompanying value "true" in the attribute table and close the dialog with "OK".

    Generating messages in the block:

    Table 2-6

    Activity Screenshot 1. Paste an input parameter

    "MSG_EVID" with the type DWord in the block interface. Open the context menu of the block connection with the right mouse button. Select Object Properties .

  • Software development SIMATIC S7 control2.5 Generation of function blocks

    Integration of Package Units 1.0, Beitrags-ID: 39203658 23

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 2. Enter the attributes "S7_a_type"

    and "S7_server" with the accompanying values "true" in the attribute table and close the dialog with "OK". .

    3. Open the SFC "ALARM_S" in

    the function block and connect the interface as shown in the example.

  • Software development SIMATIC S7 control 2.5 Generation of function blocks

    24 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.5.3 Parameterizing message properties in the block

    The properties (e.g., message text) of the generated messages are parameterized in the message properties dialog.

    Table 2-7

    Activity Screenshot 1. Open the context menu of the

    block with the right mouse button. Select Special Object Properties> Message .

    2. In the following dialog the

    message properties (e.g. message texts) can be parameterized and possibly blocked for the entity being used. For more information please use the online help. Note: The entities built in the block of the message block are automatically recognized and displayed.

  • Software development SIMATIC S7 control2.6 Generating the PLC program

    Integration of Package Units 1.0, Beitrags-ID: 39203658 25

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    2.6 Generating the PLC program

    The PLC program is configured as usual within the project for the SIMATIC S7 control. We recommend the use of CFC for the generation of the program. Follow the notes for the generation of function blocks (chap. 2.4) in this document.

  • Specifications when choosing the system 2.6 Generating the PLC program

    26 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Specifications when choosing the system 3 In order to receive a messaging behavior with correct time order sequence and to allow automatic generation of messages with the OS transfer, the alarm functions (SFC/SFB) of the SIMATIC control must be used. Because with the SFB "ALARM_8P" more information can be transferred for every message, the use of this block is recommended. However, a S7-400 control is then necessary. When using the CFC editor somewhat more RAM is necessary and the number of the generated blocks is much larger than with AWL/SCL. When choosing the system components, one must make sure that sufficient resources are available for the use of these alarm functions.

    Table 3-8 Quantity list of message number process with S7-300 CPUs

    CPU Bestell-Nr. Max. number of stations that can be

    connected

    Simultaneously active ALARM_S blocks

    CPU 312C 6ES7312-5BD01-0AB0 6 20 CPU 312C 6ES7312-5BE03-0AB0 6 20 CPU 313C 6ES7313-5BE01-0AB0 8 20 CPU 313C 6ES7313-5BF03-0AB0 8 20 CPU 313C-2DP 6ES7313-6CE01-0AB0 8 20 CPU 313C-2DP 6ES7313-6CF03-0AB0 8 20 CPU 313C-2PtP 6ES7313-6BE01-0AB0 8 20 CPU 313C-2PtP 6ES7313-6BF03-0AB0 8 20 CPU 314C-2DP 6ES7314-6CF02-0AB0 12 40 CPU 314C-2DP 6ES7314-6CG03-0AB0 12 40 CPU 314C-2PtP 6ES7314-6BF02-0AB0 12 40 CPU 314C-2PtP 6ES7314-6BG03-0AB0 12 40 CPU 312 6ES7312-1AD10-0AB0 6 20 CPU 312 6ES7312-1AE13-0AB0 6 20 CPU 312 6ES7312-1AE14-0AB0 6 300 CPU 314 6ES7314-1AF11-0AB0 12 40 CPU 314 6ES7314-1AG13-0AB0 12 40 CPU 314 6ES7314-1AG14-0AB0 12 300 CPU315-2DP 6ES7315-2AG10-0AB0 16 40 CPU 315-2DP 6ES7315-2AH14-0AB0 16 300 CPU 315-2 PN/DP 6ES7315-2EG10-0AB0 16 40 CPU 315-2 PN/DP 6ES7315-2EH13-0AB0 16 40 CPU316-2DP 6ES7316-2AG00-0AB0 12 50 CPU317-2DP 6ES7317-2AJ10-0AB0 32 60 CPU 317-2 PN/DP 6ES7317-2EJ10-0AB0 32 60 CPU 317-2 PN/DP 6ES7317-2EK13-0AB0 32 60 CPU318-2DP 6ES7318-2AJ00-0AB0 16 100 CPU319-3 PN/DP 6ES7318-3EL00-0AB0 32 300 CPU315F-2 DP 6ES7315-6FF01-0AB0 16 40 CPU315F-2 DP 6ES7315-6FF04-0AB0 16 300 CPU315F-2 PN/DP 6ES7315-2FH10-0AB0 16 40 CPU315F-2 PN/DP 6ES7315-2FH13-0AB0 16 40 CPU317F-2 DP 6ES7317-2AJ10-0AB0 32 60 CPU 317F-2 PN/DP 6ES7317-2FK13-0AB0 32 60

  • Specifications when choosing the system2.6 Generating the PLC program

    Integration of Package Units 1.0, Beitrags-ID: 39203658 27

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    CPU Bestell-Nr. Max. number of stations that can be

    connected

    Simultaneously active ALARM_S blocks

    CPU 317F-2DP 6ES7317-6FF00-0AB0 32 60 CPU 317F-2DP 6ES7317-6FF03-0AB0 32 60 CPU 319F-3 PN/DP 6ES7318-3FL00-0AB0 32 300

    Table 3-9 Quantity list of message number process with S7-400 CPUs

    CPU Max. number of stations that can be

    connected

    Simultaneously ac-tive ALARM_S blocks

    ALARM_8 blocks

    CPU 412-1 8 70 300 CPU 412-2 8 70 300 CPU 414-2 8 100 600 CPU 414-3 8 100 600 CPU 416-2 12 200 IN 1800 CPU 416-3 12 200 IN 1800 CPU 417-4 16 200 10000

  • OS transfer 2.6 Generating the PLC program

    28 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    OS transfer 4 When translating the WinCC station (also called OS transfer) all interface parameters of the function blocks which are marked as operable and able to be monitored are transferred to the WinCCs tag management and are available after theyve been translated. In addition, the alarms and messages of the message entities "Alarm_8P", "Alarm_S" etc. are transferred.

    Table 4-10

    Activity Screenshot 1. Open the context menu of the

    WinCC application with the right mouse button. Select "Compile".

  • OS transfer2.6 Generating the PLC program

    Integration of Package Units 1.0, Beitrags-ID: 39203658 29

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 2. In the following select, if not

    already selected, the S7 program which is to be translated and assign this to the operator station with . Confirm with Next>.

    3. Select the connection with which

    the S7 control is connected to the OS. Confirm with Next>.

    4. Select the data to be translated

    (at least tags and messages). Pay attention to the lower settings! (Entire OS, "With memory reset", "Changes") Confirm with Next>.

    5. You confirm the following

    compilation with "Compile"

  • OS transfer 2.6 Generating the PLC program

    30 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 6. Now the compiler goes through

    the program of the control you generated and searches for all data that is OS-relevant.

    7. After successful translation, a

    dialog appears which you confirm with "OK".

  • OS transfer2.6 Generating the PLC program

    Integration of Package Units 1.0, Beitrags-ID: 39203658 31

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 8. Open the context menu of the

    WinCC application with the right mouse button. Select "Open Object".

    9. The block connections marked

    for the visualization are in the folder tag management> SIMATIC S7 Protocol Suite> TCP/IP> AppNote_AS_Prog

    10. The messages generated about

    the alarm functions (SFB/SFC) are found in the Alarm Logging.

  • OS transfer 2.6 Generating the PLC program

    32 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    The design of the visualization is not a component of this document. However, because the demand for operating concepts that stay the same is increasing (faceplate technology), concepts of the screen block technology WinCC/PCS 7 OS are pointed out. More information can be found in the documentation PCS 7 Configuration Manual Operator Station and the WinCC information system.

  • Connecting WinCC flexible to CFC programs2.6 Generating the PLC program

    Integration of Package Units 1.0, Beitrags-ID: 39203658 33

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Connecting WinCC flexible to CFC programs 5

    Tags With the classical TIA application the tags in WinCC flexible are often connected with global data blocks or directly in the entity data blocks. Because CFC assigns the entity data block number automatically--and maybe after program modifications newly assigns--this second variation does not function. This variation is however very interesting if one wants to create uniform operating interfaces for function blocks. To handle this problem, the tags must be entered in WinCC flexible as multiplex tags. In these tags the data block number is replaced with a tag which refers to a list data block (ListDB). In this ListDB the actual entity data block numbers are written by a special block.

    Messages If the messages are generated in the function blocks in the control by the SFB "Alarm_S", these are automatically available on the SIMATIC HMI station, i.e. the alarms are reported on the WinCC stations and the HMI stations without further configuration expenditure.

  • Connecting WinCC flexible to CFC programs 5.1 Function block "GetIDB" (determining the current entity block)

    34 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    5.1 Function block "GetIDB" (determining the current entity block)

    5.1.1 Code example "GetIDB" in SCL

    FUNCTION_BLOCK "GetIDB"//Function block GetIDB //Date: 2009-06-10 VAR_INPUT

    //-------------------------------------------------------------------- //Definition of input tags and an own //Data type view of the data type ANY //-------------------------------------------------------------------- X: INT;//connect to any AnyPointer AT ANY_IN: STRUCT BYTE0 :BYTE; //Byte 0 MODEL :BYTE; //Byte 1 data / parameter type ANZ :WORD; //Byte 2+3 lengths of the tags DBNR :WORD; //Byte 4+5 DB numbers BZ :DWORD; //Byte from 6 to 10 range indicators END_STRUCT;

    END_VAR VAR_OUTPUT

    DBNR: INT; END_VAR

    BEGIN

    DBNR: = WORD_TO_INT (AnyPointer. DBNR);//access to byte 4 and 5 END_FUNCTION

  • Connecting WinCC flexible to CFC programs5.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 35

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    5.1.2 Generating the ListDB

    To transfer the current entity data block number to WinCC flexible, a global DB must be generated (as seen in the illustration).

    Figure 5-1

    5.1.3 Integrating the function block into CFC

    The function block GetIDB must be connected to each function block that is to make data available for or receive data for WinCC flexible. (as seen in the illustration)

    Figure 5-2

  • Connecting WinCC flexible to CFC programs 5.1 Function block "GetIDB" (determining the current entity block)

    36 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    5.1.4 Generating the WinCC flexible project in the SIMATIC Manager

    The SIMATIC HMI station must be pasted into the same project in the multiproject in which the AG is, so that the connection with the AG is possible.

    Table 5-11

    Activity Screenshot 1. Open the context menu of the

    project with the right mouse button. Select "Insert New Object> SIMATIC HMI Station".

    2. In the following dialog select the

    device to be used and confirm the dialog with "OK".

  • Connecting WinCC flexible to CFC programs5.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 37

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 3. Mark the pasted station and

    select from the menu "Options" the point "Configure Network".

    4. Now in the NetPro Editor the

    interfaces of the HMI device are connected with the networks of the AG. Select an interface (in our example "HMI IE") with the right mouse button and select the point Object Properties .

  • Connecting WinCC flexible to CFC programs 5.1 Function block "GetIDB" (determining the current entity block)

    38 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 5. Select in the displayed dialog

    the point Properties .

    6. In the dialog Properties the

    addresses and available networks are indicated. Enter a free address, select the desired network (in our example "ProcBus_AppNote_AS" and confirm the choice with "OK"

  • Connecting WinCC flexible to CFC programs5.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 39

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 7. Open the context menu of the

    project WinCC flexible RT with the right mouse button. Select "Open Object".

    8. After the WinCC flexible interface has been opened, select in the project tree the point Communication> Connections and activate the connection.

  • Connecting WinCC flexible to CFC programs 5.1 Function block "GetIDB" (determining the current entity block)

    40 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    5.1.5 Entering tags in WinCC flexible with reference to an entity DB

    Because the implemented entity data blocks can change when using CFC, these may not be addressed "directly". In the tag the number of the data block is replaced with a tag which lies in the ListDB and contains the actual number of the DB.

    Figure 5-3

    In the example the actual number of the entity data block used by the function block is read out with the tag "ListDB.IDB_1". This tag replaces the number of the entity DB in the tag "Var@IDB1" (Address: DB [ListDB.IDB_1] DBX0.0) Construction of a multiplex tag:

    Table 5-12

    Activity Screenshot 1. Select in the property dialog of

    the tag Properties> Addressing and click on the button "123" behind "DB". Select in the list that appears the point "mutiplexed"

    2. In the tag choice dialog select

    the tag with which you want to replace the DB number (multiplexes).

  • Connecting WinCC flexible to CFC programs5.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 41

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Note To avoid a multiple engineering of WinCC and WinCC flexible, it may be advisable to use the WinCC flexible option Sm@rt service. With this, it is possible to remotely control the WinCC flexible Panel via the IE-Control in a WinCC/PCS 7 OS operator display.

    You can find further information at http://www.automation.siemens.com/hmi/html_00/products/software/wincc-flexible-optionen/wincc-flex-smartservice.htm.

  • Compiling the TIA projects and PCS 7 5.1 Function block "GetIDB" (determining the current entity block)

    42 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Compiling the TIA projects and PCS 7 6 After the configuration of the package unit has been completed, the partial project must be integrated into the PCS 7 multiproject. Only the projected operator displays and the project of the control (AS project) are required.

    Table 6-13

    Activity Screenshot 1. Start archiving the AS project

    from the SIMATIC Manager under File> Archives .

    2. Select the control project

    (User projects> AppNote_AS) and confirm the choice with "OK".

  • Compiling the TIA projects and PCS 75.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 43

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot 3. Determine the name and the

    storage place for the archive.

    4. Copy the configured pictures

    from the WinCC project in the path "GraCS" (in our example: "c:\Programme\SIEMENS \STEP7\S7Proj\MP_AppNo\AppNo_1\winccproj\AppNote_OS\GraCS\packUnit.pdl") in the directory "GraCS" of the PCS 7 OS of the complete project.

    On the target system you have to retrieve the project again in the path of the available multiproject, adapt the NetPro configuration and generate the technological hierarchy for the package unit.

  • Compiling the TIA projects and PCS 7 5.1 Function block "GetIDB" (determining the current entity block)

    44 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Table 6-14

    Activity Screenshot

    1. Start retrieving the AS project from the SIMATIC Manager.

    2. Select the archive of the control

    project and confirm the choice with "Open".

    3. Determine the control project,

    i.e. optimal manner of the path of the available multiproject.

  • Compiling the TIA projects and PCS 75.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 45

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    4. Acknowledge the dialog with "OK"

    5. In the following dialog you are

    made aware of the fact that your control project has references to the original multiproject and has asked whether these references should be deleted. Confirm the removal with "Yes".

    6. You exit the opening of the

    project with "No".

    7. Open (if not already opened) the

    target project and open the context menu of the multiproject with the right mouse button. Select Multiproject> Insert into Multiproject.

  • Compiling the TIA projects and PCS 7 5.1 Function block "GetIDB" (determining the current entity block)

    46 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    8. Select the already retrieved user project (in our example "AppNote_AS") and confirm the choice with "OK".

    9. Select from the Menu "Options"

    the point "Configure Network".

  • Compiling the TIA projects and PCS 75.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 47

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    10. Open with Edit> Merge / Unmerge Subnets> Ethernet Subnets the dialog for merging networks to connect the process bus of the package unit with that of the whole system.

    11. Add the Ethernet network of the

    package unit to the available complete network with the button .

    12. Confirm the following dialog with

    "OK".

  • Compiling the TIA projects and PCS 7 5.1 Function block "GetIDB" (determining the current entity block)

    48 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    13. Select from the menu "Network" the entry Save and Compile .

    14. Select in the Save and

    Compile dialog the point "Compile changes only" and confirm the choice with "OK".

    15. Close the protocol dialog with

    .

  • Compiling the TIA projects and PCS 75.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 49

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    16. To complete the technological hierarchy, a hierarchy folder must be pasted in the PCS 7 in the view technological view. The position of the hierarchy folder depends mostly on the construction of the project. In our example the technological hierarchy is defined in the OS project. Open the context menu of the project in the technological view with the right mouse button and select the entry "Insert New Object> Hierarchy Folder".

    17. Name the newly pasted

    hierarchy folder according to the package unit or default setting.

  • Compiling the TIA projects and PCS 7 5.1 Function block "GetIDB" (determining the current entity block)

    50 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    18. Next match this hierarchy folder in the AS project of the package unit. Open the context menu of the hierarchy folder in the technological view with the right mouse button and select the entry Plant Hierarchy> Update in the Mmultiproject.

    19. Confirm the following dialog with

    "OK".

  • Compiling the TIA projects and PCS 75.1 Function block "GetIDB" (determining the current entity block)

    Integration of Package Units 1.0, Beitrags-ID: 39203658 51

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Activity Screenshot

    20. In the following dialog mark only the project of the package unit (in our example "AppNote_AS") and confirm the choice with "OK".

    21. The integration of the package

    unit project in the whole PCS 7-project is then complete.

  • Internet Links

    52 Integration of Package Units

    1.0, Beitrags-ID: 39203658

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    Internet Links 7 Table 7-15 Internet Links

    Topic Link

    \1\ This entry http://support.automation.siemens.com/WW/view/de/BeitragsID

    \2\ Siemens I IA/DT Customer Support

    http://support.automation.siemens.com

  • History

    Integration of Package Units 1.0, Beitrags-ID: 39203658 53

    Cop

    yrig

    ht

    Sie

    men

    s A

    G 2

    009

    All

    right

    s re

    serv

    ed

    History 8 Table 8-16 History

    Version Date Modification

    V1.0 29.10.2009 First release

    1 Preface1.1 The goal of this document

    2 Software development SIMATIC S7 control2.1 Applicable editors and versions2.2 Creating the TIA project as a multiproject Activity2.3 Network configuration for the OS transfer2.4 Message processing by means of ALARM (_S / _ 8P) functions2.4.1 Description of the function ALARM_S2.4.2 Description of the function ALARM_8P

    2.5 Generation of function blocks2.5.1 Generating the function blocks as a SCL/AWL source with "ALARM_8P"2.5.2 Generating the function blocks with AWL using "ALARM_S"2.5.3 Parameterizing message properties in the block

    2.6 Generating the PLC program

    3 Specifications when choosing the system4 OS transfer5 Connecting WinCC flexible to CFC programs5.1 Function block "GetIDB" (determining the current entity block)5.1.1 Code example "GetIDB" in SCL5.1.2 Generating the ListDB5.1.3 Integrating the function block into CFC5.1.4 Generating the WinCC flexible project in the SIMATIC Manager5.1.5 Entering tags in WinCC flexible with reference to an entity DB

    6 Compiling the TIA projects and PCS 77 Internet Links8 History