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.
- 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.
||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).
||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.
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.
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 System Software for S7-300/400 System and Standard Functions .
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 How can you use process-driven archiving in WinCC for a process tag with SFB37 (AR_SEND)? includes a practical example in STL and SCL of how to use SFB37 (AR_SEND).
||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.
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.
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".
- 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.
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.
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.
GMP, Pharma, Life Science, Validation, FDA 21 CFR Part 11