Configuration of Integration Between S7-1200 and Simuli
Short Description
s7-100...
Description
1. Configuration of S7-1200 1.1. Configuration of TCP/IP protocol 1.1.1. TRCV_C function block 1. Open TIA Portal and choose Portal choose Portal view. view. Choose tab Create new project . Write the name of the project and choose the place to save it. 2. In the new window choose option Configure a device, device, and then Add then Add new device. Choose device. Choose available PC controller and clic! Add clic! Add . ". On the left side in the Project the Project view, view , choose Device choose Device configuration, configuration, and then Configuration view. view. Place the mo#se pointer on the pict#re of PC and clic! mo#se ri$ht b#tton. %rom the men# choose option Properties option Properties.. Choose option PROFINET option PROFINET interface in eneral tab, tab, and then Et!ernet addresses. addresses. In part of IP of IP protocol in field IP field IP address write PC&s IP and in the field "u#net $as% ri$ht s#bnet mas!. '. In the ne(t step, choose from the tab P&C'() at first Progra$ first Progra$ #loc%s, #loc%s, and then *ain then *ain.. We are in the main pro$ram. ). %rom the librar* Co$$unication choose TRC+'C bloc! TRC+'C bloc! and dra$ to the main window of pro$ram. Clic! mo#se ri$ht b#tton on the TRC+'C , choose Properties choose Properties,, and then Connection para$eter . As a Partner a Partner choose choose ,nspecified , and then write in the field Address field Address the the IP of the comp#ter with *o# want to connect. %inall*, chec! Esta#lis! active connection on connection on the side of Partner and and write the n#mber of port on which the PC will wor! +Pict#re 1.
Picture 1. Configuration of TRCV_C block
1
-. To #se TRC+'C f#nction bloc! it is necessar* to define three data bloc!s TRC+'C'Data, RECEI+ED'Data and P&C'('Receive'D-. In the first case of TRC+'C'Data bloc!, from the tab Progra$ #loc%s *o# have to choose Add new #loc% , then Data #loc% . In the name of the bloc! write TRC+'C'Data +the names of all bloc!s are optional, depend onl* on #ser, b#t it is recommended to #se s#$$ested names, choose as a t*pe lo#al data. The ne(t step is to write the names of fields of str#ct#re, accordin$ to dia$ram from pict#re 2.
Picture 2. TRCV_C_Data data block
The last element is to match ri$ht fields from TRC+'C'Data with fields in TRC+'C f#nction bloc! accordin$ to their names +e.$. in field DONE *o# sho#ld choose TRC+'C'Data.Done. /. The ne(t step is to define data t*pe Received'Data'Tpe which will be t*pe of received data. In tab P&C data tpes choose Add new data tpe. Then chan$e the name of this t*pe and write ri$ht names and t*pes of fields, accordin$ to the pict#re ".
Picture 3. Received_Data_Type data type
0. The ne(t step is a definition of RECEI+ED'Data bloc! that will be #sed to save the received data. %rom the tab Progra$ #loc%s choose Add new #loc% , choose Data #loc% , write its name and choose as a t*pe Received'Data'-loc% , as in the pict#re '.
2
Picture . !efinition of data block t"at i# a type of Received_Data_Type
After the definition of RECEI+ED'Data, write its name in TRC+'C f#nction bloc! in a field DATA. . In a field CON *o# sho#ld choose str#ct#re called P&C'('Receive'D-, as in the pict#re ).
Picture $. C"oo#e PLC_1_Receive_DB in field CON of TRCV_C
3
1. The final effect of the confi$#ration of TRC+'C f#nction bloc! sho#ld loo! li!e this from the pict#re -.
Picture %. Configured TRCV_C block
1.1.2. TSEND_C function block 1. 3imilarl* as in the case of TRC+'C f#nction bloc!, we start a confi$#ration of T"END'C f#nction bloc! from dra$ this bloc! from librar* Co$$unication to the main window of the pro$ram. Clic! mo#se ri$ht b#tton on the T"END'C , choose Properties, and then Connection para$eter . As a Partner choose ,nspecified , and then write in the field Address the IP of the comp#ter with *o# want to connect. %inall*, chec! Esta#lis! active connection on the side of Partner and write the n#mber of port on which the PC will wor!. The f#nction bloc! T"END'C sho#ld loo! li!e in the pict#re /.
4
Picture 7. Confguration of TSEND_C
2. The ne(t step is to define a T"END'C'Data data bloc!, li!e in the case of str#ct#re TRC+'C'Data. The names of fields of this str#ct#re sho#ld be declared as in the dia$ram from pict#re 0.
Picture &. TSEND_C_Data data block
After the definition of T"END'C'Data data bloc!, *o# have to match ri$ht fields from T"END'C'Data with fields in T"END'C f#nction bloc! accordin$ to their names +e.$. in a field DONE *o# sho#ld choose T"END'C'Data.Done. ". The ne(t step is to declare data t*pe "end 'Data'Tpe which will be t*pe of sent data. In tab P&C data tpes choose Add new data tpe/ write the name of a t*pe, the field names and t*pes of fields, accordin$ to the pict#re .
Picture '. Send_Data_Type data type
5
'. 4e(t, create "END'Data bloc! that will be #sed to send pro$ram data. %rom the tab Progra$ #loc%s choose Add new #loc% , choose Data #loc% , write its name and choose as a t*pe "end 'Data'-loc% , as in the pict#re 1.
Picture 10. !efinition of data block t"at i# a type of Send_Data_Type
After the definition of "END 'Data, write its name in T"END 'C f#nction bloc! in the field DATA. ). In a field CON *o# sho#ld choose str#ct#re called P&C'('Receive'D-, as in the pict#re 11.
Picture 11. C"oo#e PLC_1_Receive_DB in field CON of TSEND_C 6
-. The last sta$e is a definition of a si$nal whose positive ed$e will $ive a si$nal to send data from T"END'C bloc! . There are a lot of wa*s to do it and it onl* depends on the pro$rammer, b#t probabl* one of the best wa* is to #se timer, li!e in the pict#re 12. The name of the variable that activates sendin$ of data sho#ld be written in field RE0 in T"END'C bloc! +in this e(ample this variable is called ti$er(.
Picture 12. Ti(er t"at acti)ate# #ending data
/. The final effect of the confi$#ration of T"END'C f#nction bloc! sho#ld loo! li!e this from the pict#re 1".
Picture 13. Configured TSEND_C block
7
1.2. Configuration of *!P protocol 1.2.1. TC+, function block 1. Open TIA Portal and choose Portal view. Choose tab Create new project . Write the name of the project and choose the place to save it. 2. In the new window choose option Configure a device, and then Add new device. Choose available PC controller and clic! Add . ". On the left side in the Project view, choose Device configuration, and then Configuration view. Place the mo#se pointer on the pict#re of PC and clic! mo#se ri$ht b#tton. %rom the men# choose option Properties. Choose option PROFINET interface in eneral tab, and then Et!ernet addresses. In the part of IP protocol in field IP address write PC&s IP and in field "u#net $as% ri$ht s#bnet mas!. '. In the ne(t step, choose from the tab P&C'( 5 at first Progra$ #loc%s, and then *ain. We are in the main pro$ram. ). %rom the librar* Co$$unication choose bloc! TCON and dra$ to the main window of pro$ram. Clic! mo#se ri$ht b#tton on the TCON , choose Properties, and then Connection para$eter . As a Partner choose ,nspecified , and then write in the field Address the IP of the comp#ter with *o# want to connect. %inall*, chec! Esta#lis! active connection on the side of Partner and write the n#mber of port on which the PC will wor! +Pict#re 1'.
Picture 1. Configuration of TCON block 8
9
-. In a field CONNECT *o# sho#ld choose str#ct#re called P&C'(' Connection'D-, as in the pict#re 1).
Picture 1$. C"oo#e PLC_1_ Connection _DB in field CONNECT of TCON
/. 4e(t, write the ID of the connection, e.$. 1 +the val#e sho#ld be from 1 to '). In field RE0 *o# sho#ld write TR,E . 0. The ne(t step is a definition of CON'Data bloc!, as in the pict#re 1-.
Picture 1%. CON_Data data block
. The last element is to match ri$ht fields from CON'Data with fields in TCON f#nction bloc! accordin$ to their names, as in the pict#re 1/.
Picture 17. Configured TCON function block
10
1.2.2. TURCV function block 1. %rom the librar* Co$$unication choose T,RC+ bloc! and dra$ to the main window of pro$ram. 4e(t, in the fields EN and EN'R write names of variables that sho#ld activate this bloc!. In the field ID write P&C'('Connection'D-.ID +this str#ct#re was #sed d#rin$ the confi$#ration of TCON bloc! and the n#mber ID was defined b* the #ser. 2. The ne(t step is to define a T,RC+'Data data bloc!, li!e in the case of str#ct#re TCON'Data. The names of fields of this str#ct#re sho#ld be declared as in the dia$ram from pict#re 10.
Picture 1&. TURCV_Data data block
6o# have to match ri$ht fields from T,RC+'Data with fields in T,RC+ f#nction bloc! accordin$ to their names. ". 4e(t, *o# have to create a bloc! that will be #sed to save IP address and port n#mber of the comp#ter which comm#nicates with the PC. In Progra$ #loc%s choose Add new #loc% , then Data #loc% and its t*pe TADDR'Para$. The name of this 7loc! is ADDRE""'Data, accordin$ to the pict#re 1.
11
Picture 1'. !eclaration of ADDRES_Data data block
12
'. The last step is to define data t*pe Received'Data'Tpe which will be t*pe of received data. In tab P&C data tpes choose Add new data tpe. Then chan$e the name of this t*pe and write ri$ht names and t*pes of fields, accordin$ to the pict#re 2.
Picture 20. Received_Data_Type data type
). 4e(t, create RECEI+ED'Data bloc! that will be #sed to save the received data. %rom the tab Progra$ #loc%s choose Add new #loc% , choose Data #loc% , write its name and choose as a t*pe Received'Data'-loc% . RECEI+ED'Data data bloc! sho#ld be assi$ned to the field DATA in T,RC+ f#nction bloc!. -. The final effect of the confi$#ration of T,RC+ f#nction bloc! sho#ld loo! li!e this from the pict#re 21.
Picture 21. Configured TURCV function block
13
1.2.3. TUSEND function block 1. 8ra$ T,"END bloc! from librar* Co$$unication to the main window of the pro$ram. 2. We start the confi$#ration of T,"END bloc! in the same wa* as in the case of T,RC+ bloc!. In the field ID write P&C'('Connection'D-.ID +this str#ct#re was #sed d#rin$ the confi$#ration of TCON bloc! and the n#mber ID was defined b* the #ser. 4e(t, in the field ADDRE"" write ADDRE""'Data +this variable was created in the para$raph 1.2.2 in point ". 4ow, *o# have to create T,"END'Data, data bloc! accordin$ to pict#re 22.
Picture 22. TUSEND_Data data block
9atch fields of T,"END f#nction bloc! with fields from T,"END'Data data bloc! accordin$ to the names. ". 4e(t step consists of definition of "end'Data'Tpe data t*pe. To do this, in tab P&C data tpes choose Add new data tpe , write the ri$ht name and create a str#ct#re li!e this from the pict#re 2".
Picture 23. Send_Data_Type data type
'. Create "END'Data data bloc! : it means that *o# have to choose Progra$ #loc%s tab, then Add new #loc% tab, then Data #loc% and choose "end'Data'Tpe as a datat*pe. "END'Data data bloc! sho#ld be assi$ned to the field DATA in T,"END f#nction bloc!.
14
). In the T,"END f#nction bloc! in field RE0 it is necessar* to write the name of the variable that is responsible for c*clic activation of this f#nction bloc!. It seems that the best wa* is to #se a timer : li!e in the pict#re 2'. In this case, the data will be sent c*clicall* with the positive ed$e of variable ti$er(.
Picture 2. Ti(er t"at acti)ate# #ending data
-. The final effect of the confi$#ration of T,RC+ f#nction bloc! sho#ld loo! li!e this from the pict#re 2).
Picture 2$. Configured TUSEND function block
15
1.3. Progra( on t"e #ide of PC 1. When *o# have confi$#red the f#nction and data bloc!s accordin$ to the instr#ctions from para$raph 1.1 or 1.2, the pro$rammer m#st decide which variables will be sent and received. The pro$rammer can send and receive boolean +7*te and float +;eal variables. 2. In the case of receivin$ data b* PC, the pro$rammer copies variables from RECEI+ED'Data bloc! +this bloc! was defined in par. 1.1.1 point & for TCP protocol and in par. 1.2.2 point $ for
View more...
Comments