show the entry list

WinCC -- Configuring and programming communication -- Communication to S7, use of fast AR_SEND 
How can you use process-driven archiving in WinCC for a process tag with SFB37 (AR_SEND)? 
How do you use SFB37 (AR_SEND) for process-driven archiving of process values in WinCC Tag Logging archives? 
How can you achieve archiving cycles of less than 500ms in WinCC Tag Logging? 
How can you tell that WinCC has received data from AR_SEND (SFB37)? 
Where is the data archived that is transferred by AR_SEND (SFB37) to WinCC? 
How can you ensure that the variables in AR_SEND (SFB37) have the same time stamp? 

How can you use process-driven archiving in WinCC for a process tag with SFB37 (AR_SEND)?Go to beginning
Part number:

Instructions:
This entry shows how you can use SFB37 (AR_SEND) to transfer one process value into a WinCC process value archive. This entry follows the procedure described in Entry ID 23629327.
 
No. Procedure
1 Defining the data format of the data to be archived
Archiving using the AR_SEND block supports different versions regarding the structure of the data to be transferred. Choose one of the possible data formats.
A detailed description of the structure of the data block to be transferred is available in the WinCC Online Help under "WinCC Information System > Communication > SIMATIC S7 Protocol Suite > Special functions > Data exchange with the S7 function block AR_SEND".

The following format has been chosen for this example in which one value of a process tag is transferred:
Header Type (INT := 9)
Year Month
Day Hours
Minutes Seconds
1/10s 1/100s 1/1000s Weekday
Cycle (DINT := 1)
Unit (Type) (BYTE := B#16#1) Unit (Range) (BYTE := B#16#1)
AR_ID Subnumber (INT := 1)
Process data - data type (INT := 5)
Number of process values (INT := 1)
Process value (REAL)

Description of the data structure elements:

  • Header Type = 9
    Header with time stamp and AR_ID subnummer.
  • Date and Time (Year, Month, Day, Hours, Minutes, Seconds, ...)
    The time stamp is filled with current system time during runtime.
  • Cycle= 1
    The process values are read out equidistantly. The starting time point is specified in the header's time stamp and is absolutely necessary. The time units of Unit (Range) and "Cycle" factor are valid for the time intervals between process values.
  • Unit (Type)= 1
    The time stamp entered in the header is valid for the process value.
  • Unit (Range)= 1
    Reserved.
  • AR_ID subnumber= 1
    Defines the assignment between the PLC process value and the WinCC archive tag.
  • Process data - data type= 5
    S7 data type = REAL.
    WinCC data type = float.
  • Number of process values = 1
    Only one process value is transferred.
  • Process value
    The process value is filled with the current value during runtime.
2 Configuring the AR_SEND send block in the STEP 7 project
For this example a function block (FB) has been created, which only realizes the core functionality of data exchange using the AR_SEND block. The data structure defined in Step 1 is filled with values and the AR_SEND block transferred for "Sending". The SFB37 (AR_SEND) is called as a multi-instance. The relevant inputs and outputs of the AR_SEND block are run on the interface of the newly created FB. In practice, depending on the case in question, you might have to program more functionalities, for example:
  • To ensure data consistency when transferring, you should not change the data during the transfer procedure. For example, you may only write to the Send area again for this purpose when the "DONE" output of the AR_SEND block has the value "1".
  • In order to reduce the communication load it is also possible to transfer data to WinCC only when there is a change in the process value. It is also possible to collect the process data upon change of value in the data structure to be transferred and then send it upon the occurrence of an event that you define. For example, the data could be sent only after expiry of a maximum time or upon exceeding a defined value change (hysteresis).
  • Since you can only call the AR_SEND block a limited number of times in the S7 program, you should select a different version of data transfer using the AR_SEND block if there is a large number of measuring points to be archived. You can also transfer multiple values of different measuring points within one data block.

More information:

  1. The block has been created in the SCL language. The procedure is identical if you use a different language (STL).
  2. The data structure for the data to be transferred has been defined as UDT and is used in the FB's interface.


    Fig. 01 

    You parameterize the length of the data block to be transferred with the LEN parameter of the AR_SEND block. You can determine the length of the data area to be transferred by opening the UDT directly from the STEP 7 program's block container. In the STL editor, the length of the structure (UDT) is then shown in bytes in the last line.


    Fig. 02
  3. You run the input AR_ID AR_SEND block externally and assign the system attributes S7_server:='alarm_archiv' and S7_a_type:='ar_send'. In this way STEP 7 assigns a unique, continuous AR_ID when incorporating the FB in the program. The following two figures show the block for the languages SCL and STL.
     
    SCL STL

    Fig. 03

    Fig. 04
  4. The following two figures show the block call in the CFC chart and in STL.
     
    CFC STL

    Fig. 05

    Fig. 06

    If you use the block in the STEP 7 program, you can determine the current system time via SFC1 (READCLK  Read System Clock) and store it in a global data block. You can interconnect this data with the block's "Time Stamp" input.

You can download the block as SCL and STL source.

WinCC_ArSendOnePV.zip ( 3 KB )

You can use Copy/Paste to insert the relevant source in the SCL or STL editor. In order to compile this source successfully, you should define the the numbers for the UDT and the FB beforehand in the symbol table.


Fig. 07

3 Configuring process-driven archiving in WinCC
Configuration of this step is described in detail in the Entry ID 23629327 mentioned above and in the WinCC Online Help. For the sake of completeness we will list the major steps again:
  • WinCC Tag Manager: set up connection in the SIMATIC S7 Protocol Suite
  • WinCC Tag Manager: create the raw data tag of the raw data type "Archive Data Link"
  • WinCC Tag Logging: create process-controlled archive tag

How do you use SFB37 (AR_SEND) for process-driven archiving of process values in WinCC Tag Logging archives?Go to beginning
Part number:

Instructions
With SFB37 (AR_SEND) you can transfer one or more process values on a process-driven basis to WinCC Tag Logging archives. For this the process values are collected together with the associated time stamps in a relevant data area and transferred to the AR_SEND block. When an event defined by the user occurs, the AR_SEND block sends the archive data to WinCC in one or more data blocks. WinCC enters the raw data received into the corresponding archives. WinCC uses the normalization DLL "nrms7pmc.nll" to interpret the raw data. In order for the archive data to be interpreted correctly by the functions of the normalization DLL, the data must be put into the data format required by the normalization DLL before being sent. The following figure gives an overview of process-driven archiving.


Fig. 01

Notes

  • The conversion DLL does not check the data for correct chronological order. This means that also "old" process values can be archived with the AR_SEND block, even if data with more recent time stamps is already in the archive.
  • Process-driven archive tags are stored by default in the "TagLoggingFast" archive (see also Entry ID 21738144). Pay attention to the settings for maximum size and time period of the archive segments and of the complete archive. You make these settings in the Tag Logging editor under "Archive Configuration".

Proceed as follows to configure process-driven archiving via AR_SEND.
 
No. Procedure
1 Defining the data format of the data to be archived
The normalization DLL for WinCC Tag Logging, "nrms7pmc.nll", defines different data formats for different cases of application. Thus in one AR_SEND send procedure data can be sent by one or more process tags. Here one or more values can be transferred with different time stamps to one process tag. The WinCC normalization DLL differentiates between various methods of date/time stamping:
  • Process values with equidistant time intervals with predefined start time value
  • Process values with own time stamp for each value
  • Process values with time differences relative to the start time value

A detailed description of the structure of the data block to be transferred is available in the WinCC Online Help under "WinCC Information System > Communication > SIMATIC S7 Protocol Suite > Special functions > Data exchange with the S7 function block AR_SEND".
Fig. 02 shows the principle structure of the data block when several time-dependent process values with associated time stamps are transferred to a process tag (archive variable).


Fig. 02

2 Configuring the AR_SEND send block in the STEP 7 project
Fig. 03 shows the AR_SEND block when it is inserted in a CFC plan from the block library. In this case it is not interconnected, because this figure simply shows the inputs and outputs available on the block. Fig. 04 shows the corresponding STL code.


Fig. 03


Fig 04

The AR_SEND is configured as follows in STEP 7.

  • Create a data area to accept the data to be transferred. The structure of this data area must correspond to a format supported by the WinCC normalization DLL. This data area is transferred to the AR_SEND block as an ANY pointer at the input "SD_1" (ANY). At the "LEN"(WORD) input the length of the data area to be transferred must be specified hexadecimally in bytes.

    Note
    The length specification in the ANY pointer is not used by the AR_SEND block.

    The system automatically assigns the "AR_ID"(DWORD) uniquely when the AR_SEND block is incorporated and it cannot be changed. The value "W#16#EEEE" is assigned by default for the "ID"(WORD) input when incorporated in the CFC. You must not change this value. When you incorporate the AR_SEND block in an STL or SCL source, you must assign this value manually.
     
  • Program a program section to fill the data area to be transferred with the process values during runtime. Once the data area has been completely filled with valid values, the send procedure can be triggered by a positive edge at the controller input "REQ"(BOOL). The controller input "R"(BOOL) is for interrupting a send job in progress. The output "DONE"(BOOL) shows that the send procedure is completed. If an error occurs during processing, this is shown at the output "ERROR"(BOOL). Detailed error information is given at the output "STATUS"(WORD).

Information on the S7 function block SFB37 (AR_SEND) is available in the reference manual "System Software for S7-300/400 System and Standard Functions" - Entry ID 1214574.

Note
In this entry we have purposely left out a description of the direct interconnection of the SFB37 (AR_SEND) block. You should create your own, application-specific function block (FB) that fulfills your specific requirements for the transfer you want.

The advantages of using an application-specific function block for archiving with AR_SEND are as follows:

  • You only have to set and test the block once. Then you can use it multiple times which saves an enormous amount of time, because the actual interconnection of the AR_SEND is done only once. The time taken for interconnecting the AR_SEND block can under circumstances be quite significant. For example, it might be necessary to collect data of multiple process values over a certain period of time and then send it altogether in one AR_SEND message. If processing of the message is not yet completed, it might be necessary to continue collecting the process data. Evaluation of error information when processing blocks is always useful.
  • You can avoid configuration errors (e.g. double assignment of storage cells) by using the FB's instance data.
  • You can interconnect the data to be archived appropriately in the STL source.

The data area to be transferred can be created within the instance DB. You can call the SFB37 (AR_SEND) as a multi-instance. The relevant inputs and outputs of the AR_SEND block should be run on the interface of the newly created FB. Make sure that you run the input AR_ID AR_SEND block externally and assign the system attributes S7_server:='alarm_archiv' and S7_a_type:='ar_send'. In this way STEP 7 assigns a unique AR_ID when incorporating the FB in the program. Entry ID 23629424 includes a practical example in STL and SCL of how to use SFB37 (AR_SEND).

3 Configuring process-driven archiving in WinCC
Proceed as follows to configure in WinCC.
  • WinCC Tag Manager: Create connection in SIMATIC S7 Protocol Suite
    In the WinCC Tag Management, in a channel unit (e.g. MPI or Industrial Ethernet) of the SIMATIC S7 Protocol Suite you configure a connection that is to be used for communication with the S7 controller.

    Note

    Make sure that you assign the right parameters, specially the correct "Slot Number" in the "Connection properties" dialog.
     
  • WinCC Tag Management: Create the raw data tag of the raw data type "Archive Data Link"
    In the S7 connection used for data transfer you create a tag of the "Raw Data Type". The name length must not exceed 24 characters, because under circumstances this name might be a constituent part of the archive tag name.


    Fig. 05

    Via the "Select" button you open the "Address properties" dialog. In the "Address properties" dialog of the raw data tags, in the "Raw Data Type" area, you select "Archive Data Link".


    Fig. 06
     
  • WinCC Tag Logging: Creating a process-controlled archive tag
    Open the Tag Logging. Create a process-controlled archive tag in a process value archive. For this you use the pop-up menu "New Process Controlled Tag..." With the "Select" button you open a selection dialog to choose the Raw Data Tag that is to provide the archive tags. In the "Archive tag name" field you can assign a name that is different from the internal archive tag name. In the "Normalization DLL" area you must select "nrms7pmc.nll". This is the default value.


    Fig. 07

    With the "Options..." button in the "Normalization DLL" area you open the dialog to assign the relevant AR_ID and if necessary the AR_ID-Subnumber.


    Fig. 08

    Note
    In the "AR_ID" input field you must enter the number assigned for the parameter "AR_ID" on the associated AR_SEND block in the STEP 7 program.
    If process data for multiple archive tags is sent with the AR_SEND block, the AR_ID subnumber is used to assign the process data for multiple process tags in one message to the different archive tags. The AR_ID subnumbers are assigned by the programmer of the AR_SEND block call. If multiple process tags are transferred in one AR_SEND block call, the actual process values together with the associated AR_ID subnumbers are entered in the data area to be transferred. At this point, it is assumed that you know how to assign the AR_ID subnumbers to the process and archive tags of an AR_SEND call.

Additional Keywords
GMP, Pharma, Life Science, Validation, FDA 21 CFR Part 11

How can you achieve archiving cycles of less than 500ms in WinCC Tag Logging?Go to beginning
Part number:

Instructions:
The smallest archiving cycle in WinCC Tag Logging is 500ms. There is no way of reducing this archiving cycle time through settings in WinCC Tag Logging. Shorter archiving cycles can be achieved through process-controlled archiving.

There are the following options for this:

  • "AR_SEND" (SFB37)
    In an S7-400 CPU you can implement the "AR_SEND" (SFB37) block for process-controlled archiving in WinCC. With this method the archive data is collected in the controller and then transferred to WinCC as raw data. A conversion DLL on the WinCC side interprets the data sent and enters it in the WinCC archives. You must also interconnect AR_SEND block appropriately in the controller. In WinCC you only have to assign parameters, no programming is required. Information on how to use "AR_SEND" is also available in Entry ID 23629327 and Entry ID 23629424.
  • ODK for user-specific processing of raw data
    Also with this method the data is collected in the controller and transferred to WinCC as raw data. The data is processed and archived using a conversion DLL. The "AR_SEND" (SFB37) block is not available for smaller controllers (S7-300). You have to program this function yourself. The WinCC option "WinCC Open Development Kit" (ODK) provides information on how you can process the raw data received in WinCC using your own conversion DLL.

Keywords
21738145

How can you tell that WinCC has received data from AR_SEND (SFB37)?Go to beginning
Part number:

Instructions:
If the data has been sent successfully to WinCC, the parameter "DONE" of the AR_SEND block is set to "1". In WinCC there is no way of checking whether the data has been stored successfully in the archive.

Note:
If the data has its own time stamp in AR_SEND, it is also stored chronologically in WinCC.  Detailed information on parameterizing the AR_SEND block is available in the WinCC Information System (WinCC Online Help) under the keyword "AR_SEND: Data Block Structures - Structures and Parameters". Note the examples given there.


Where is the data archived that is transferred by AR_SEND (SFB37) to WinCC?Go to beginning
Part number:

Instructions
Process values transferred via the AR_SEND are stored by default in the WinCC archive "TagLogging Fast".

For WinCC V6.0
In WinCC V6.0 it is not possible to parameterize the storage location for this data.

For WinCC V6.2 onwards
In WinCC V6.2 you can choose whether the process values are to be stored in the "TagLogging Fast" or "TagLogging Slow" archive.

For this you open the "Tag Logging" editor and then the properties of the "TagLogging Fast" archive. Select the "Archive contents" tab.


Fig. 01

To archive process values in the "TagLogging Fast" archive, you now select the "Process-controlled measured values" check box. If the check box is not selected, the process values are archived in the "TagLogging Slow" archive.

More information is available in the WinCC Information System (WinCC Online Help) under the keyword "Storing Process Values".

How can you ensure that the variables in AR_SEND (SFB37) have the same time stamp?Go to beginning
Part number:

Instructions:
In order to give the same time stamp to the data in function block AR_SEND you must parameterize the AR_SEND block accordingly (parameter unit (type)). Detailed information on parameterizing the AR_SEND block is available in the WinCC Information System (WinCC Online Help) under the keyword "AR_SEND: Data Block Structures - Structures and Parameters". Note the examples given there.


 Entry ID:31526191   Date:2012-04-20 
I regard this article....as helpfulas not helpful                                 






























mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Help
Online Help
Guided Tour