Upload
doanthuy
View
245
Download
1
Embed Size (px)
Citation preview
http://support.automation.siemens.com/WW/view/en/88964239
Application Description 03/2014
Data Synchronization between
Head and Field PLCs with Storage
of the Process Values in CSV FilesSIMATIC STEP 7 (TIA Portal), WinAC RTX, WinAC ODK
Warranty and Liability
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 2
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
Warranty and Liability
Note The Application Examples are not binding and do not claim to be completeregarding the circuits shown, equipping and any eventuality. The ApplicationExamples do not represent customer-specific solutions. They are only intendedto provide support for typical applications. You are responsible for ensuring thatthe described products are used correctly. These application examples do notrelieve you of the responsibility to use safe practices in application, installation,operation and maintenance. When using these Application Examples, yourecognize that we cannot be made liable for any damage/claims beyond theliability clause described. We reserve the right to make changes to theseApplication Examples at any time without prior notice.If there are any deviations between the recommendations provided in theseapplication examples and other Siemens publications – e.g. Catalogs – thecontents 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 ofthe examples, information, programs, engineering and performance data etc.,described in this Application Example shall be excluded. Such an exclusion shallnot apply in the case of mandatory liability, e.g. under the German Product LiabilityAct (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,body or health, guarantee for the quality of a product, fraudulent concealment of adeficiency or breach of a condition which goes to the root of the contract(“wesentliche Vertragspflichten”). The damages for a breach of a substantialcontractual obligation are, however, limited to the foreseeable damage, typical forthe type of contract, except in the event of intent or gross negligence or injury tolife, body or health. The above provisions do not imply a change of the burden ofproof to your detriment.
Any form of duplication or distribution of these Application Examples or excerptshereof is prohibited without the expressed consent of Siemens Industry Sector.
Securityinforma-tion
Siemens provides products and solutions with industrial security functions thatsupport the secure operation of plants, solutions, machines, equipment and/ornetworks. They are important components in a holistic industrial securityconcept. With this in mind, Siemens’ products and solutions undergo continuousdevelopment. Siemens recommends strongly that you regularly check forproduct updates.
For the secure operation of Siemens products and solutions, it is necessary totake suitable preventive action (e.g. cell protection concept) and integrate eachcomponent into a holistic, state-of-the-art industrial security concept. Third-partyproducts that may be in use should also be considered. For more informationabout industrial security, visit http://www.siemens.com/industrialsecurity.
To stay informed about product updates as they occur, sign up for a product-specific newsletter. For more information, visithttp://support.automation.siemens.com.
Table of Contents
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 3
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
Table of ContentsWarranty and Liability ................................................................................................. 2
1 Task ..................................................................................................................... 4
2 Solution............................................................................................................... 5
2.1 Overview............................................................................................... 52.2 Hardware and software components ................................................... 72.2.1 Components used ................................................................................ 72.2.2 Sample files and projects ..................................................................... 7
3 Functionality of the Application ....................................................................... 8
3.1 General overview ................................................................................. 83.2 The blocks of the STEP 7 program .................................................... 103.2.1 "Archive_Data" function block ............................................................ 103.2.2 "SysDateTimeToInt" function block .................................................... 123.2.3 "Global_Data" data block ................................................................... 12
4 Installation ........................................................................................................ 13
4.1 Installation of the hardware ................................................................ 134.2 Installation of the software.................................................................. 14
5 Startup of the SIMATIC Components ............................................................ 15
5.1 IP addresses used .............................................................................. 155.2 Loading the PLCs ............................................................................... 16
6 Operation of the Application .......................................................................... 18
6.1 Creating an executable file from the C# program .............................. 196.2 Starting archiving ................................................................................ 206.2.1 Establishing a connection with the shared memory of the
WinAC ................................................................................................ 206.2.2 Defining the archive file name and starting ........................................ 216.3 Stopping archiving .............................................................................. 22
7 Adding More Field PLCs ................................................................................. 24
7.1 Changes in the new field PLC ............................................................ 247.2 Changes in the head PLC .................................................................. 267.3 Changing the shared memory access ................................................ 317.3.1 Addresses used .................................................................................. 317.3.2 Changes in the STEP 7 program ....................................................... 327.3.3 Changes in the C# program ............................................................... 337.3.4 Screenshot of STEP 7 program expansion ........................................ 357.3.5 Screenshot of C# program expansion ................................................ 36
8 References ....................................................................................................... 37
9 History............................................................................................................... 37
1 Task
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 4
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
1 TaskIntroduction
Process value exchange between a head PLC and several field PLCs requiresperformant cyclic communication. This communication is for the head PLC tocollect all process values of the field devices and archive them as CSV files.
Overview of the automation taskThe figure below provides an overview of the automation task.Figure 1-1
Field PLC 1 Field PLC 2 Field PLC n
Head PLC Archiving inCSV files
Description of the automation taskThe head PLC is supposed to process the process values from the field PLCs inthe following steps: Collect process values by means of cyclic communication between head and
field PLCs Bundle process values Archive process values in CSV files
Requirements for the automation taskThe following requirements are imposed on the automation solution: Optimal and performant utilization of the available connection resources of the
head or field PLC. Easy adaptation to variable quantity structures (process values and number of
field PLCs). Applicable to IPCs with WinAC as head PLC and S7-1200/1500 as field PLCs. Process data archiving in a cycle of 1 second minimum. Process value archiving in CSV files.
2 Solution2.1 Overview
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 5
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
2 Solution2.1 Overview
Schematic overviewThe figure below gives a schematic overview of the most important components ofthe solution:
Figure 2-1
Head PLC IPC427D + WinAC RTX
Field PLC S7-1200Field PLC S7-1500
Storage ofprocess values
in CSV files
WinAC ODKShared Memory
Extention(SMX)
SetupThis application example demonstrates the use of a communication block and dataarchiving using WinAC ODK. A SIMATIC IPC with WinAC RTX is used as head PLC. A CPU S7-1500 and two CPU S7-1200 are used as field PLCs. Data archiving is realized via the shared memory extension (SMX) interface of
WinAC ODK. A C# program reads the process values from the shared memory and archives
them in CSV files.
2 Solution2.1 Overview
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 6
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
DescriptionThe foundation stone of this application is a communication block for datasynchronization between several field PLCs and one head PLC. For the completedescription of the communication block, please refer to the following entry:http://support.automation.siemens.com/WW/view/en/39040038This application example only describes the archiving of the collected processvalues. For the complete description of the communication between head and fieldPLCs, please refer to the above-named entry.
The task of the "Archive_Data" function block in the head PLC is to automaticallybundle the process values of the field PLCs and provide them to the Windowsoperating system via the SMX interface. A C# program reads the process valuesfrom the shared memory and stores them in CSV files. The process values arewritten to the shared memory by the STEP 7 program once per second.The C# program autonomously recognizes when new process values are written tothe shared memory by the STEP 7 program. In this case, the process values arearchived line by line in CSV files. The C# program provides a graphical userinterface. Here, archiving can be started and monitored.Figure 2-2: C# program, graphical user interface
AdvantagesThe solution presented here offers you the following advantages: Quick and easy setup of a communication solution Flexible expandability of the field PLCs Consistent archiving of process data Easy archiving operability due to supplied wizard user interface
DelimitationThis application does not include information on basic STEP 7 programming basic information on Industrial Ethernet and CPU-CPU communication
Basic knowledge of these topics is therefore assumed.
2 Solution2.2 Hardware and software components
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 7
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
2.2 Hardware and software components
2.2.1 Components used
The application was set up with the following components:
Hardware components
Table 2-1
Component No. Article number Note
IPC 427D 1 6AG4140-xxxx-xxxx Head PLCCPU 1516-3PN/DP 1 6ES7 516-3AN00-0AB0 Field PLC 1CPU 1214C DC/DC/DC 1 6ES7 214-1AE30-0XB0 Field PLC 2CPU 1212C DC/DC/DC 1 6ES7 212-1AD31-0XB0 Field PLC 3SCALANCE X208 1 6GK5208-0BA10-2AA3 -SIMATIC FIELD PG 1 6ES7716-.....-0... For loading the head and field
PLCs
Software components
Table 2-2
Component No. Article number Note
STEP 7 Professional V12SP1 UP3
1 6ES7822-0A… -
WinAC ODK 4.2 1 6ES7806-1CC03-0BA0 -Microsoft Visual Studio2010
1 -
WinAC RTX 2010 SP1 1 6ES7671-0RC08-0YA0 -
2.2.2 Sample files and projects
The following list contains all files and projects used in this example.
Table 2-3
Component Note
88964239_CODE_TIA_v10.zip contains the STEP 7 project88964239_CODE_visual_studio_v10.zip contains the Visual Studio project
3 Functionality of the Application3.1 General overview
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 8
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
3 Functionality of the Application3.1 General overview
The figure below shows the functionality of the STEP 7 and C# program.Figure 3-1
STEP 7 program C# program
Start/Stop
Yes
No
Read new datafrom
shared memory
Write data toCSV file
Set“C_Prog_ready”
Start/Stop
„C_Prog_ready“
TRUE
FALSE
Set“Error_Bit”
Communicationwith
field PLCs
Write data toshared memory
Increment“New_Data”
counter
Increment“Error_Counter”
counter
100ms* cycle time
*Called every second (OB 35)
* Default setting in this application
Reset“C-Prog_ready”
“New Data”counter
incremented
Archive_Data
STEP 7 programThe "Archive_Data" block is called every second by means of a time interrupt. Withthe help of the "C_Prog_ready" tag, the status of the C# program is checked. Whenthe C# program is ready for new data, communication with the field PLCs isstarted. Then, the data are written to the shared memory and the counter"New_Data" is incremented. This is necessary in order that the C# programrecognizes whether new data are available. If the "C_Prog_ready" tag is set to"False" when the "Archive_Data" block is called, error handling is started (seechapter 3.2.1 "Archive_Data" function block).
3 Functionality of the Application3.1 General overview
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 9
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
C# programThe C# program checks whether the "New_Data" counter has been incremented. Ifthis is not the case, it awaits the next scanning cycle. If new data are available,these are processed. The "C_Prog_ready" tag is set to "False". This is necessaryto signal to the STEP 7 program that the C# program is just processing data.(Handshake) Afterwards, the data are read from the shared memory and written toCSV files. Then, the "C_Prog_ready" tag is set to "True". This indicates that the C#program is ready for new data.
Data exchange via shared memoryFigure 3-2
STEP 7 program WinAC ODKShared Memory Extention
C# program
Output Area (4kByte)
Input Area (4kByte)
write
write
read
read
• Counter_New_Data• Processdata
• C_Prog_ready
For data exchange between the STEP 7 program and the C# program, the sharedmemory interface of WinAC ODK is used. 4 kBytes of data are available each forinput and output.
Note For further information on WinAC ODK, please refer to:
http://support.automation.siemens.com/WW/view/en/12840073/133300
Archiving in CSV filesThe C# program reads the data from the shared memory and archives them inCSV files. These CSV files constitute a cyclic buffer. This buffer consists of severalCSV files which are changed as soon as a file contains 65,000 lines. When themaximum capacity of the last file has been reached, the first one is overwrittenagain. The names of the CSV files are expanded by the extension "_X", where Xstands for the number of the current file to be written.
3 Functionality of the Application3.2 The blocks of the STEP 7 program
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 10
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
3.2 The blocks of the STEP 7 program
The figure below shows the interaction of the existing application (see entry ID39040038) and the application described herein:
Figure 3-3
DATASYNC_HEAD
TCONiDB
TSEND
OB 35(1 sec.)
OB 1
IP_ADDRESS
DB_SND_DATADB_RCV_DATA
DB_STATEDB_MANAGE
TRCV
TSEND
TDISCON
DATASYNC_HEAD
iDB
DATASYNC_HEAD
iDB
Archive_Data SysDateTimeToInt
Data synchronization application (entry ID 39040038)
This application
Global_Data
Readprocess values
3.2.1 "Archive_Data" function block
Task
Query whether the C# program is ready for data archiving Start communication between head and field PLCs Read data from "DB_RCV_Data" data block Save data to shared memory
3 Functionality of the Application3.2 The blocks of the STEP 7 program
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 11
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
Reaction to errorIn the event of an error, the following operations are executed during operation: Set "Error_Bit" tag Increment "Error_Counter" counter
The following error might occur: C program has not finished data readout
Error acknowledgementIf a positive edge is pending at the "Reset_Error" input, "Error_Bit" is set to "False"and "Error_Counter" is reset to "0".
InterfacesThe formal parameters of the function block have the following meaning:
Figure 3-4 "Archive_Data" function block
Table 3-1
Formal parameter Type Data type Meaning
Reset_Error Input Bool Acknowledges the error "Error_Bit" is reset "Error_Counter" is set to 0
Error_BitOutput
Bool Is set in the event of an errorError_Counter INT Counts the number of errors during
operation
3 Functionality of the Application3.2 The blocks of the STEP 7 program
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 12
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
3.2.2 "SysDateTimeToInt" function block
In order that date and system time can be written to the shared memory, the datatype must first be converted from "Date_And_Time" into "INT". This is executed bythe "SysDateTimeToInt" function block.
Task
Query of date and system time Split-up of date and system time into "INT" values Return of the "INT" values
InterfacesTable 3-2
Formal parameter Type Data type Meaning
Year_YYYY
Output
INT Current year (four digits)Year_YY INT Current year (two digits)Month INT Current monthDay INT Current dayHour INT Current hourMinute INT Current minuteSecond INT Current second
3.2.3 "Global_Data" data block
TaskThe "Global_Data" data block serves for data management of the process valuesrequired for archiving.It contains the following tags:
Table 3-3
Tag Data type Meaning
Reset_Error BOOL Acknowledges the error "Error_Bit" is reset "Error_Counter" is set to 0
Error_Bit BOOL Is set in the event of an errorError_Counter INT Counts the number of errors during operationIncrement INT Counter that is incremented in the case of new
process valuesCur_Date_Time STRUCT Contains the date and time as INT values
4 Installation4.1 Installation of the hardware
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 13
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
4 Installation4.1 Installation of the hardware
The figure below shows the hardware configuration and the IP addresses used inthis application.
Figure 4-1
CPU 1214C CPU 1212C
CPU 1516C
SIMATIC Field PG
192.168.0.3
SCALANCE X208
192.168.0.1 192.168.0.2
192.168.0.200
IPC427D
192.168.0.10
Connect a head PLC (here: IPC427D), the field PLCs (here: S7-1200/1500), andthe SCALANCE X208 each to a 24 V power supply. Connect all devices with theSCALANCE X208 by means of a standard Ethernet cable.
Note The installation guidelines for these components must always be observed.
4 Installation4.2 Installation of the software
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 14
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
4.2 Installation of the software
Installation of the basic software:Install the following software on the programming device:
Table 4-1
No. Instruction Remarks
1. InstallSTEP 7 V12 ProfessionalSP1 Update 2
Manual:http://support.automation.siemens.com/WW/view/en/77991795
2. InstallWinAC ODK V4.2 SP1
Manual:http://support.automation.siemens.com/WW/view/en/12840073/133300
3. InstallMicrosoft Visual Studio 2010
-
Install the following software on the execution system (here: IPC427D).Table 4-2
No. Instruction Remarks
1. InstallWinAC RTX 2010 Update 3on a PC system
Manual:http://support.automation.siemens.com/WW/view/en/10805641/133300
Update:http://support.automation.siemens.com/WW/view/en/15227402
Application softwareUnzip the following files on your PG/PC.
Table 4-3
No. Instruction Remarks
1. Unzip the files "WinAC_Data_Concentrator.zip" and"Visual_Studio_WinAC_Data_Concentrator.zip".
-
5 Startup of the SIMATIC Components5.1 IP addresses used
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 15
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
5 Startup of the SIMATIC Components5.1 IP addresses used
The following IP addresses are used in this application:Table 5-1
IP address Component
192.168.0.1 Field PLC 1192.168.0.2 Field PLC 2192.168.0.3 Field PLC 3192.168.0.10 Head PLC IPC192.168.0.200 SIMATIC Field PG
The subnet mask is always 255.255.255.0.
Changing the IP addresses of the PLCsThe SIMATIC components are addressed in the TIA portal by means of the onlinefunction "Assign IP address".
Table 5-2
No. Instruction Remarks
1. Start the TIA portal and openthe project"WinAC_Data_Concentrator".
-
2. Open the project view of theTIA portal.
-
3. Double-click "Online &diagnostics" under "HEAD –WinAC RTX Software PLC".
4. Select "Assign IP address"under "Functions".Click the "Accessible devices"button.
5 Startup of the SIMATIC Components5.2 Loading the PLCs
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 16
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
5. Select the SIMATIC Field PGinterface. The search foraccessible devices is carriedout automatically.The result is shown in a list.Identify the PLC you use as"HEAD" PLC via the MACaddress and click "Apply".
6. Assign the IP address storedin the project to this devicewith "Assign IP address".The "HEAD" PLC now ownsthe IP address stored in theproject.
7. Change the IP addresses ofthe field PLCs in the sameway.
-
5.2 Loading the PLCs
In the following, the PLCs are loaded with the hardware configuration and userprogram.
Note For further information, please refer to the entry "How is a project downloaded inthe CPU in STEP 7 (TIA portal)?"
http://support.automation.siemens.com/WW/view/en/59728694
5 Startup of the SIMATIC Components5.2 Loading the PLCs
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 17
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
Table 5-3
No. Instruction Remarks
1. Select the first field PLC.
Then load the deviceconfiguration and program tothe field PLC with the respectivesymbol in the toolbar.
2. The project is compiled.Click the "Load" button.
3. Activate "Start all" to start themodule.
Exit the loading operation with"Finish".
4. Proceed in the same way forthe two other field PLCs and thehead PLC.
-
6 Operation of the Application5.2 Loading the PLCs
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 18
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
6 Operation of the ApplicationIn order to archive the data arising during communication between the head andfield PLCs, they must be read out of the shared memory of the WinAC with the C#program ("WinAC_Data_Concentrator.exe").
Description of the wizard pageFigure 6-1
1
2
3 4
5 6
7
8
Table 6-1
No. Remarks
1 Opens a dialog box for connection with the WinAC RTX2 Input field for defining the file names3 Shows the currently selected storage path4 Opens a dialog box for defining the storage path for the files5 Starts data archiving6 Stops data archiving7 Shows the name of the file that is currently written8 Shows the data records that are currently written
6 Operation of the Application6.1 Creating an executable file from the C# program
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 19
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
6.1 Creating an executable file from the C# programTable 6-2
No. Instruction Remarks
1. Open the supplied Visual Studio2010 project:"WinAC_Data_Concentrator.sln".
-
2. Select "Release" under "SolutionConfiguration".
3. Click "Build – Build Solution" inthe menu list.The executable file is created andsaved to the project folder.
4. Navigate to the project folder ofthe Visual Studio project.Open the "bin" folder with adouble-click and in there the"Release" folder.
-
5. Copy the file to the target systemusing WinAC RTX (here:IPC427D).
6. Start the"WinAC_Data_Concentrator.exe"on the target system (here:IPC427D).
-
6 Operation of the Application6.2 Starting archiving
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 20
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
6.2 Starting archiving
6.2.1 Establishing a connection with the shared memory of the WinAC
Table 6-3
No. Instruction Remarks
1. Click "SMX – Open" in themenu list.A dialog box opens.
2. Enter the name of the WinAC.In this application, the name is"WinAC RTX Software PLC".Confirm with "OK".
Note:You can find the name of thePLC in the project tree under"HEAD".
3. In the case of an invalid entry,an error message is output.
6 Operation of the Application6.2 Starting archiving
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 21
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
6.2.2 Defining the archive file name and starting
Table 6-4
No. Instruction Remarks
1. Enter the desired file name foryour archive in the "File Name"field on the user interface.The file extension ".csv" is thenattached automatically.
2. Select the storage path towhich the archive files are to besaved.Click the "..." button for that andselect the folder.Confirm with the "OK" button.
The default path is "C:\Temp".
3. Start archiving with the"Start Data logging" button.
6 Operation of the Application6.3 Stopping archiving
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 22
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
4. If the start was successful, thename of the currently written fileis displayed at "Cur. File" andthe current data at "Cur Data".
5. In the case of invalid entries, anerror message box opens.
6.3 Stopping archivingTable 6-5
No. Instruction Remarks
1. While data archiving is running,the "Stop Data logging" button isenabled.You can stop archiving byclicking this button.
2. Click "SMX – Close" in the menubar to cut the connection with theshared memory of the WinAC.
6 Operation of the Application6.3 Stopping archiving
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 23
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
3. Click "File – Exit" in the menu barto completely end the program.
7 Adding More Field PLCs7.1 Changes in the new field PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 24
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
7 Adding More Field PLCsTo expand the application, you can create up to 32 field PLCs in the project. Howto add a new PLC is described here by taking the example of a CPU 1215C.
7.1 Changes in the new field PLC
Perform the following steps to add a new SIMATIC S7 1200/1500 CPU:Table 7-1
No. Instruction Remarks
1. Click "Add new device".
2. Select the desired CPU andconfirm with "OK"The CPU is added.
3. Assign a unique IP address asdescribed in chapter 5.1 IPaddresses used.For example, 192.168.0.4
-
7 Adding More Field PLCs7.1 Changes in the new field PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 25
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
4. Change to a different field PLC.Copy the files in the "Programblocks" folder with a right-clickand "Copy".
5. Return to the new CPU.Select the "Program blocks"folder with a right-click and thenclick "Paste".
7 Adding More Field PLCs7.2 Changes in the head PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 26
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
6. If the "Program blocks" folderalready contains files, a promptappears, asking whether theseare to be overwritten.Confirm with "OK".
7. Execute steps 4 and 5 for the"PLC Data Types" folder.
-
Note When changing the receive and send structures, make sure that the sendstructure of the head PLC corresponds exactly to the receive structure of thefield PLC.
7.2 Changes in the head PLC
The following supplements are required in the head PLC (here: IPC 427D) toinclude the new CPU in the communication:
"DB_IPADDRESS" data blockTable 7-2
No. Instruction Remarks
1. Open the "DB_IPADDRESS"data block under "Programblocks".
-
2. Copy the structure"IP_Address_01".
7 Adding More Field PLCs7.2 Changes in the head PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 27
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
3. Paste the structure in thebottom list.
Assign the name"IP_Address_04".
4. Open the structure and enterthe IP address of the new CPU.
"DB_MANAGE" data blockTable 7-3
No. Instruction Remarks
1. Open the "DB_MANAGE" datablock under "Program blocks".
-
2. Enter the number of field PLCsat "Nr_of_Substations".
In this example, it is 4 fieldPLCs.
3. Select the "REQ_3" tag andright-click. Select "Add row".
7 Adding More Field PLCs7.2 Changes in the head PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 28
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
4. Create the new "REQ_4" tag.
Data blocks "DB_SEND_DATA" and "DB_RCV_DATA"Table 7-4
No. Instruction Remarks
1. Open the "DB_SEND_DATA"data block under "Programblocks".
-
2. Copy the structure"Receive_Structure_01".
3. Paste the structure at thebottom and assign the name"ReceiveStructure_04".
4. Open the "DB_RCV_DATA"data block and execute steps 1.– 3.
-
"DB_STATE" data blockTable 7-5
No. Instruction Remarks
1. Open the "DB_STATE" datablock under "Program blocks".
-
2. Copy the "Sub_01" tag.
7 Adding More Field PLCs7.2 Changes in the head PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 29
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
3. Paste the tag at the bottom ofthe table and assign the name"Sub_04".
"Do_Communication" function blockTable 7-6
No. Instruction Remarks
1. Open the "Do_Communication"function block with a double-click.
-
2. Select network 3 with a right-click. Select "Insert network".A new network is inserted.
3. Drag and drop the"DATASYNC_HEAD" functionblock to the new network.
The "Call options" windowopens in which you have a newdata block created. Assign thename "IDB_04_DATASYNC"and confirm with the "OK"button.
7 Adding More Field PLCs7.2 Changes in the head PLC
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 30
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
4. Interconnect the block as shownin the following figure.
For further information aboutblock interconnection, pleaserefer to the following applicationdocumentation:http://support.automation.siemens.com/WW/view/en/39040038
5. Copy the network "start impulsefor partner 3" and paste it at thebottom of the block.
-
6. Change parameter "IN1" to"IDB_04_DATASYNC.Step"and the output parameter to"DB_MANAGE.REQ_4".
"Archive_Data" function blockTable 7-7
No. Instruction Remarks
1. Open the "Archive_Data"function block under "Programblocks".
-
2. Place the cursor in the line withthe comment "Start impulse forCommunication".
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 31
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
3. Set the "REQ_4" tag in the"DB_MANAGE" data block to 1.
4. Load the project to the new fieldPLC and to the head PLC asdescribed in chapter 5.2Loading the PLCs.
-
After having executed this step, communication to the new CPU is established. Thecommunication data are stored cyclically every second in the "DB_RECV_DATA"data block.
7.3 Changing the shared memory access
In order to archive the process data of the newly added CPU, these data must alsobe written to the shared memory. The commands for that must be added in theSTEP 7 program in the head PLC and in the C# program.
7.3.1 Addresses used
In the shared memory, the following addresses have been assigned so far:Table 7-8
STEP 7 program C# program Usage
From 16348 From 0 Data exchange station 1From 17000 From 616 Data exchange station 2From 18000 From 1616 Data exchange station 3From 20000 From 3616 Data exchange date and time20477 4093 New_Data20478 4094 C_Prog_ready
Note The addresses for "New_Data" and "C_Prig_ready" are located at the end of theshared memory area. When adding new PLCs, make sure that these two bytesare not changed.
In this example, the shared memory addresses from 19000 (and 2626 respectively)are used for the new PLC.
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 32
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
7.3.2 Changes in the STEP 7 program
In order to archive the process data of the newly added PLC, you must expand thecode in the "Archive_Data" function block as follows:
Table 7-9
No. Instruction Remarks
1. Open the "Archive_Data"function block under "Programblocks".
-
2. Place the cursor in the line withthe comment "Write Info fromCommunicationpartner 2".
3. Copy the lines that execute theshared memory access ofstation 2 (comment: "EndCommunication Partner 2").
-
4. Place the cursor in the line withthe comment "EndCommunication Partner 3".
5. Paste the text. -6. Adjust the commands to the
new PLC.
Start address for station 4 =19000.
The process data source is"DB_RCV_DATA".ReceiveStructure04.
See screenshot in chapter 7.3.4 Screenshot of STEP 7program expansion
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 33
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
7.3.3 Changes in the C# program
In order to read and archive the process data of the newly added PLCs from theshared memory, you must make the following changes in the C# program:
Table 7-10
No. Instruction Remarks
1. Open the "MainWindow.cs" filein the Visual Studio project.
-
2. Go to the "#region VariableDefinition" area.
3. Add the following new tags.
4. Place the cursor in the "voidread_SMX(…)" function.
-
5. Copy the commands between"#region SMX READER Partner2" and "#endregion Partner 2".
6. Place the cursor below thecommand "#region SMXREADER Partner 3".
7. Paste the text. -8. Adjust the commands to the
address range of the new PLC(2616-2874).
Save the return values of theSMX functions to the tagscreated in step 3.
See screenshot in chapter 7.3.5 Screenshot of C# programexpansion
9. Place the cursor in the line withthe comment "Write Informationin CSV Output Stream".
10. Copy the"csv_writer_WriteLine(…)" lineof station 3.
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 34
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
No. Instruction Remarks
11. Paste the line directly belowand change the tag names tothe ones created in step 3.
12. Place the cursor in the line withthe comment "Information forWizard Page".Expand the output by the tagscreated in step 3.
-
13. Then create a new executablefile as described in 6.1 Creatingan executable file from the C#program.
-
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 35
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
7.3.4 Screenshot of STEP 7 program expansion
The following figure shows the complete code required for a newly added PLC inthe STEP 7 program:
Figure 7-1
7 Adding More Field PLCs7.3 Changing the shared memory access
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 36
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
7.3.5 Screenshot of C# program expansion
The following figure shows the complete code required for a newly added PLC inthe C# program:
Figure 7-2
8 References
WinAC Data ConcentratorEntry ID: 88964239, V1.0, 03/2014 37
Cop
yrig
htSi
emen
sAG
2014
Allr
ight
sre
serv
ed
8 ReferencesTable 8-1
Subject Title
\1\ Siemens IndustryOnline Support
http://support.automation.siemens.com
\2\ Download page of theentry
http://support.automation.siemens.com/WW/view/en/88964239
\3\ Application entry pageData synchronization
http://support.automation.siemens.com/WW/view/en/39040038
\4\ WinAC ODK manual http://support.automation.siemens.com/WW/view/en/12840073/133300
9 History
Table 9-1
Version Date Modifications
V1.0 03/2014 First version