24
Application Example AC500 Scalable PLC for Individual Automation Modbus RTU Communication AC500 CPU - UMC

Modbus_AC500_UMC

Embed Size (px)

Citation preview

Page 1: Modbus_AC500_UMC

Application Example AC500 Scalable PLC

for Individual Automation

Modbus RTU Communication AC500 CPU - UMC

Page 2: Modbus_AC500_UMC

Application Example - 1 - AC500/Issue: 09.2011

Content

1 Disclaimer ..................................................................................................................3

1.1 For customers domiciled outside Germany/ Für Kunden mit Sitz außerhalb Deutschlands........................................................................ 3

1.2 Nur für Kunden mit Sitz in Deutschland ........................................................................ 3

2 AC500 PM554 eCo CPU communication over Modbus RTU with UMC ................4

2.1 AC500 CPUs ....................................................................................................................4

2.2 AC500 Modbus RTU line ................................................................................................. 4

2.3 Hardware configuration .................................................................................................. 5

3 PLC program..............................................................................................................6

3.1 PS502 Configurator......................................................................................................... 6

3.2 eCo CPU........................................................................................................................... 6

3.3 rtsinfo............................................................................................................................... 7

3.4 Configuration of the serial port ...................................................................................... 7

3.5 IP settings ........................................................................................................................ 8

4 PLC_PRG ...................................................................................................................9

4.1 Modbus RTU library and program.................................................................................. 9

4.2 POUs ................................................................................................................................ 9

4.3 COM_MOD_MAST instance .......................................................................................... 10

4.4 POUs .............................................................................................................................. 10

4.4.1 Read binary inputs................................................................................................. 11 4.4.2 Read analog inputs................................................................................................ 13 4.4.3 Read diagnosis ......................................................................................................14 4.4.4 Start/stop UMC ......................................................................................................15

5 Using a serial analyser............................................................................................18

5.1 Modbus data exchange.................................................................................................19

Page 3: Modbus_AC500_UMC

Application Example - 2 - AC500/Issue: 09.2011

6 Related documents .................................................................................................20

6.1 UMC100-FBP technical description ............................................................................. 20

6.2 Modbus RTU FieldbusPlug MRP21-FBP technical description.................................. 20

6.3 AC500 Control Builder .................................................................................................. 21

6.4 AC500 CPU .................................................................................................................... 21

6.5 Modbus protocol description ....................................................................................... 21

Page 4: Modbus_AC500_UMC

Application Example - 3 - AC500/Issue: 09.2011

1 Disclaimer

1.1 For customers domiciled outside Germany/ Für Kunden mit Sitz außerhalb Deutschlands

"Warranty, Liability: The user shall be solely responsible for the use of this application example described within this file. ABB shall be under no warranty whatsoever. ABB's liability in connection with this application example or the files included within this file, irrespective of the legal ground, shall be excluded. The exclusion of liability shall not apply in the case of intention or gross negligence. The present declaration shall be governed by and construed in accordance with the laws of Switzerland under exclusion of its conflict of laws rules and of the Vienna Convention on the International Sale of Goods (CISG)." "Gewährleistung und Haftung: Der Nutzer ist allein für die Verwendung des in dieser Datei beschriebenen Anwendungsbeispiels verantwortlich. ABB unterliegt keiner Gewährleistung. Die Haftung von ABB im Zusammenhang mit diesem Anwendungsbeispiel oder den in dieser Datei enthaltenen Dateien - gleich aus welchem Rechtsgrund - ist ausgeschlossen. Dieser Ausschluß gilt nicht im Falle von Vorsatz oder grober Fahrlässigkeit. Diese Erklärung unterliegt Schweizer Recht unter Ausschluß der Verweisungsnormen und des UN-Kaufrechts (CISG)."

1.2 Nur für Kunden mit Sitz in Deutschland "Gewährleistung und Haftung: Die in diesem Anwendungsbeispiel enthaltenen Dateien beschreiben eine mögliche Anwendung der Steuerung AC500 bzw. zeigen eine mögliche Einsatzart der Steuerung. Sie stellen nur Beispiele für Programmierungen dar, sind aber keine fertigen Lösungen. Eine Gewähr kann nicht übernommen werden. Der Nutzer ist für die ordnungsgemäße, insbesondere vollständige und fehlerfreie Programmierung der Steuerungen selbst verantwortlich. Im Falle der teilweisen oder ganzen Übernahme der Programmierbeispiele können gegen ABB keine Ansprüche geltend gemacht werden. Die Haftung von ABB, gleich aus welchem Rechtsgrund, im Zusammenhang mit den Anwendungsbeispielen oder den in dieser Datei enthaltenen Dateien wird ausgeschlossen. Der Haftungsausschluß gilt jedoch nicht in Fällen des Vorsatzes, der groben Fahrlässigkeit, bei Ansprüchen nach dem Produkthaftungsgesetz, im Falle der Verletzung des Lebens, des Körpers oder der Gesundheit oder bei schuldhafter Verletzung einer wesentlichen Vertragspflicht. Im Falle der Verletzung einer wesentlichen Vertragspflicht ist die Haftung jedoch auf den vertragstypischen, vorhersehbaren Schaden begrenzt, soweit nicht zugleich ein anderer der in Satz 2 dieses Unterabsatzes erwähnten Fälle gegeben ist. Eine Änderung der Beweislast zum Nachteil des Nutzers ist hiermit nicht verbunden. Es gilt materielles deutsches Recht unter Ausschluß des UN-Kaufrechts."

Page 5: Modbus_AC500_UMC

Application Example - 4 - AC500/Issue: 09.2011

2 AC500 PM554 eCo CPU communication over Modbus RTU with UMC

2.1 AC500 CPUs The CPUs from the AC500 PLC family are equipped with one or two serial interfaces. The Modus RTU protocol is always implemented in the firmware of the CPU, the corresponding Modbus RTU libraries are free. Therefore is possible to build two RS 485 lines, in order to communicate over Modbus RTU with max. 31 UMCs on each line. In real configurations the total scan time for a line will limit this number to 8-16 UMCs. The AC500 CPU is Modbus RTU master and will exchange data with the UMCs, acting as modbus slaves. The Modbus RTU communication is based on the master – slave princip: the ,master is generating standard modbus request telegram, the corresponding slave unit will answer with a standard reply telegram.

2.2 AC500 Modbus RTU line

The data exchange with an external supervisor system can be done using different communication protocols( Modbus TCP/IP, Profibus, etc.).

Page 6: Modbus_AC500_UMC

Application Example - 5 - AC500/Issue: 09.2011

2.3 Hardware configuration In the following example we will take an AC500 eCo CPU/PM554 and one UMC100 with Modbus RTU FBP. The communication will be done over an RS 485 line with the parameters 19200,8,1,even.

3

AC500 eCo CPUPM554 CPU

6

8

5

COM 1

Modbus RTU master

Modbus RTU slave

UMC 100

request

reply

UMC.project

RS 485, 19200, 8,1, E

120

Ohm

SUB-D, 9 pin, male

AC500 PM 582 CPU modbus RTU master – UMC 100 with MRP21 FBP

MRP21

blue

white

Page 7: Modbus_AC500_UMC

Application Example - 6 - AC500/Issue: 09.2011

3 PLC program

3.1 PS502 Configurator The PLC program was written with the ABB Configurator PS502 V2.0.0

3.2 eCo CPU using the eCo CPU PM554-ETH V2.0

Page 8: Modbus_AC500_UMC

Application Example - 7 - AC500/Issue: 09.2011

3.3 rtsinfo

3.4 Configuration of the serial port The CPU use for the modbus RTU communication the serial port COM1, with the parameters 19200 baud, RS485 (RTS control = Telegram ), 8 data bits, 1 stop bit, even parity ( default values for the SACE CBs ), as modbus RTU master.

Page 9: Modbus_AC500_UMC

Application Example - 8 - AC500/Issue: 09.2011

3.5 IP settings The programing and online acces to the CPU will be done over the ethernet port, in this case the CPU is already configured, with the IP address 192.168.5.47, subnet mask 255.255.248.0.

PC IP Settings The PC has to be in the same network as the CPU.

Page 10: Modbus_AC500_UMC

Application Example - 9 - AC500/Issue: 09.2011

4 PLC_PRG

The PLC program is given in this example as text and could be written with the actual version of the AC500 configurator.

4.1 Modbus RTU library and program

The program will be written with the AC500 Control Builder ( start )

4.2 POUs Two POUs are created: PLC_PRG(PRG) and RUN(PRG). In the PLC_PRG POU the instance of the COM_MOD_MAST Modbus RTU function block is called. The parameter for the different Modbus data communication ( read/write registers in slave ) and the data handling are handled in the POU named RUN, written in structure text.

Page 11: Modbus_AC500_UMC

Application Example - 10 - AC500/Issue: 09.2011

4.3 COM_MOD_MAST instance

4.4 Step chain The instance of the modbus function block will be parametrized from the RUN(PRG) program written in ST. POU for the step chain ( RUN )

Page 12: Modbus_AC500_UMC

Application Example - 11 - AC500/Issue: 09.2011

4.4.1 Read binary inputs CASE CHAIN OF (*read binary inputs*) 0: (*send request read binary inputs*) IF NOT UMC.DONE THEN IF NOT (start_UMC OR stop_UMC) THEN UMC.EN:=TRUE; UMC.COM:=1; UMC.SLAVE:=47; UMC.FCT:=1; UMC.TIMEOUT:=1000; UMC.ADDR:=16#0; UMC.NB:=16; CHAIN:=100; ELSE CHAIN:=1000; END_IF END_IF 100: (*reply read binary inputs arrived*) IF UMC.DONE THEN UMC.EN:=FALSE; binary_in_value:=binary_inputs; CHAIN:=200; END_IF

Page 13: Modbus_AC500_UMC

Application Example - 12 - AC500/Issue: 09.2011

Page 14: Modbus_AC500_UMC

Application Example - 13 - AC500/Issue: 09.2011

4.4.2 Read analog inputs This is an example for reading 7 words.

Example to read one analog input. (*read analog inputs*) 200: (*send request read analog inputs*) IF NOT UMC.DONE THEN UMC.EN:=TRUE; UMC.COM:=1; UMC.SLAVE:=47; UMC.FCT:=3; UMC.TIMEOUT:=1000; UMC.ADDR:=16#0200; UMC.NB:=1; CHAIN:=300; END_IF 300: (*reply read analog inputs arrived*) IF UMC.DONE THEN UMC.EN:=FALSE; analog_in_value:=analog_inputs; CHAIN:=400; END_IF

Page 15: Modbus_AC500_UMC

Application Example - 14 - AC500/Issue: 09.2011

4.4.3 Read diagnosis

400: (*send request read diagnosis *) IF NOT UMC.DONE THEN UMC.EN:=TRUE; UMC.COM:=1; UMC.SLAVE:=47; UMC.FCT:=3; UMC.TIMEOUT:=1000; UMC.ADDR:=16#2000; UMC.NB:=2; CHAIN:=500; END_IF 500: (*reply read diagnosis arrived*) IF UMC.DONE THEN UMC.EN:=FALSE; diagnosis_value:=diagnosis; CHAIN:=0; END_IF

Page 16: Modbus_AC500_UMC

Application Example - 15 - AC500/Issue: 09.2011

4.4.4 Start/stop UMC

(*start_UMC OR stop_UMC*) 1000: (*send request for start or stop UMC*) IF NOT UMC.DONE THEN UMC.EN:=TRUE; UMC.COM:=1; UMC.SLAVE:=47; UMC.FCT:=15; UMC.TIMEOUT:=1000; UMC.ADDR:=16#0100; UMC.NB:=16; CHAIN:=1100; IF start_UMC THEN start:=16#2400; (*value for start* UMC) END_IF

Page 17: Modbus_AC500_UMC

Application Example - 16 - AC500/Issue: 09.2011

IF stop_UMC THEN start:=16#2200; (*value for stop UMC*) END_IF END_IF 1100: (*reply for start or stop UMC has arrived*) IF UMC.DONE THEN UMC.EN:=FALSE; CHAIN:=1200; END_IF Continue with read (*(wait until start_UMC OR stop_UMC=FALSE*) 1200: IF NOT (start_UMC OR stop_UMC) THEN CHAIN:=0; END_IF END_CASE Start/Stop UMC inputs

Page 18: Modbus_AC500_UMC

Application Example - 17 - AC500/Issue: 09.2011

Global variables

Page 19: Modbus_AC500_UMC

Application Example - 18 - AC500/Issue: 09.2011

5 Using a serial analyser

In some cases the exact structure of the request/reply telegrams could help in order to analyse the data exchange between the modbus master ( AC500 CPU ) and the modbus slaves ( SACE CBs, UMC, operator panels ). The software Docklight can be installed on a Window PC. We have obtained good results with the USB to RS485 converter USB Nano 485.

3

AC500 eCo CPUPM554 CPU

6

8

5

COM 1

Modbus RTU master

Modbus RTU slave

UMC 100

request

reply

UMC.project

RS 485, 19200, 8,1, E

120

Ohm

A B

PC with W in XP Pro

Docklight Software

USB Nano 485www.cti-lean.com

RS 485

USB

SUB-D, 9 pin, male

AC500 PM 582 CPU modbus RTU master – UMC 100 with MRP21 FBP – with PC telegram analyser Docklight

MRP21

blue

white

Page 20: Modbus_AC500_UMC

Application Example - 19 - AC500/Issue: 09.2011

5.1 Modbus data exchange

Page 21: Modbus_AC500_UMC

Application Example - 20 - AC500/Issue: 09.2011

6 Related Documents

6.1 UMC100-FBP technical description

6.2 Modbus RTU FieldbusPlug MRP21-FBP technical description

Page 22: Modbus_AC500_UMC

Application Example - 21 - AC500/Issue: 09.2011

6.3 AC500 Control Builder

6.4 AC500 CPU

6.5 Modbus protocol description

Page 23: Modbus_AC500_UMC

Application Example - 22 - AC500/Issue: 09.2011

Page 24: Modbus_AC500_UMC

ABB Automation Products GmbH Wallstadter Str. 59 D-68526 Ladenburg Tel. : +49 62 21 / 701-1444 Fax : +49 62 21 / 701-1382 E-Mail : [email protected] www.abb.com/plc

Doc. kind: No. o. p.:

Helpline document 23 Title: Lang.:

Modbus RTU Communication AC500 CPU - UMC EN

Man

ual N

o. 2

CD

C 1

25 1

61 M

0201