20171123221222QHKFNZXYQG - A002 - S7-1200 - Read Energy Data-Modbus TCP-IP Client

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Quick Guide

Quick Guide
Step 7 Basic & SIMATIC S7-1200
Modbus TCP/IP client

Unrestricted © Siemens AG 2017 www.siemens.com/s7-1200

• Procedure : Modbus TCP/IP client Concept 3


• Input Parameter and Output Parameter ของ MB_CLIENT 9
• Compile and Download Program 11
• Go online 12

Unrestricted © Siemens AG 2017


Page 2 SLT / DF FA

Handout 1
Quick Guide

Procedure : Modbus TCP/IP client Concept

1 สร้าง DB สาหรับอ่านข้อมูลที่ได้จาก Power meter : “Data_Read”


SIMATIC S7-1200
Modbus TCP/IP client

2 กาหนด tag name และ data type ให้กบั “Data_Read” S7-1200 อ่านค่าจาก Power meter
(SENTRON PAC4200)

3 สร้าง DB สาหรับการConnect ทีข่ า CONNECT ของ DB (MB_CLIENT) Ethernet /Modbus TCP/IP

4 กาหนด tag name และ data type ให้กบั DB ที่ใช้สาหรับการconnect

5 สร้าง Data block : MB_CLIENT


SENTRON PAC4200 SENTRON PAC4200 SENTRON PAC4200 SENTRON PAC4200

Modbus TCP/IP server Modbus TCP/IP server Modbus TCP/IP server Modbus TCP/IP server
1 2 3 8

6 กาหนด Parameter S7-1200 สามารถอ่านค่าจาก Power meter ซึ่งเป็ น Modbus TCP/IP ได้สูงสุ ด 8 station

Unrestricted © Siemens AG 2017


Page 3 SLT / DF FA

1. สร้ าง DB สาหรั บอ่ านข้ อมูลที่ได้ จาก Power meter

3 ตั้งชื่อให้กบั Data block

1 Double click to
Add new block

2 Click เลือก Data block 4 กด OK

Unrestricted © Siemens AG 2017


Page 4 SLT / DF FA

Handout 2
Quick Guide

2. กาหนด tag name และ data type สาหรั บ Data_Read

3 กด Compile
2 กาหนด Data type ให้ tag name

1 ตั้งชื่อ tag name ใน Data block

Unrestricted © Siemens AG 2017


Page 5 SLT / DF FA

3. สร้ าง DB สาหรั บการConnect ที่ขา CONNECT ของ FB (MB_CLIENT)

3 ตั้งชื่อให้กบั Data block

1 Double click to
Add new block

2 4
Click เลือก Data block กด OK

Unrestricted © Siemens AG 2017


Page 6 SLT / DF FA

Handout 3
Quick Guide

4. กาหนด tag name และ data type ให้ กับ DB ที่ใช้ สาหรั บการconnect

3 กด Compile
2 กาหนด Data type ให้ tag name
Data type : TCON_IP_v4
1 ตั้งชื่อ tag name ใน Data block

ใส่ IP Address ของ Power meter

Unrestricted © Siemens AG 2017


Page 7 SLT / DF FA

5.สร้ าง Data block : MB_CLIENT

3 ตั้งชื่อ data block

2 Double click หรื อ


Drag & Drop
1
Double click ที่ Main block

4 กด OK

Unrestricted © Siemens AG 2017


Page 8 SLT / DF FA

Handout 4
Quick Guide

Input Parameter and Output Parameter ของ MB_CLIENT

Input parameter

- REQ : เมื่อค่าเป็ น 1 คือ Block ถึงจะทางาน


- DISCONNECT : ตัดการทางานของ Block
- MB_MODE : เลือกโหมด โดยที่ 0 คือ อ่านข้อมูล ,1 คือ เขียนข้อมูล
- MB_DATA_ADDR : เริ่ มอ่านข้อมูล ที่ address …..
- MB_DATA_LEN : ขนาดของข้อมูล (Word)
- MB_DATA_PTR : Data Block สาหรับแสดงค่าข้อมูล
- CONNECT : Data Block สาหรับการเชื่อมต่อกับ Device
Output parameter (Monitor value)
- DONE : อยูใ่ นสถานะของ Block เมื่อทางานเสร็ จสิ้ น
- BUSY : อยูใ่ นสถานะกาลังส่งคาสัง่
- ERROR : อยูใ่ นสถานะ Error
- STATUS : แสดงสถานะการทางานของ Block
** ผู้ใช้ งานสามารถศึกษาเพิม่ เติม โดยคลิกที่ Block แล้ วกด F1 **
Unrestricted © Siemens AG 2017
Page 9 SLT / DF FA

Example of MODBUS Address from Energy meter

Offset is 1, then MODBUS address will be 40002

Unrestricted © Siemens AG 2017 Ref : Appendix A.3 MODBUS, SENTRON PAC4200, System Manual, 09/2010, A5E02316180B-03
Page 10 SLT / DF FA

Handout 5
Quick Guide

6. กาหนด Parameter

ใส่ ค่า Parameters ต่างๆ ดังนี้


Input parameter
- REQ : 1
- DISCONNECT :0
- MB_MODE :0
- MB_DATA_ADDR : 40002
- MB_DATA_LEN : 15
- MB_DATA_PTR : “Data_Read”.Read
- CONNECT : “Connect_ModbusTCP_IP”.Connect

Output parameter (Monitor value)


- DONE : “MB_Client_DB_1”.DONE
- BUSY : “MB_Client_DB_1”.BUSY
- ERROR : “MB_Client_DB_1”.ERROR
- STATUS : “MB_Client_DB_1”.STATUS

Unrestricted © Siemens AG 2017


Page 11 SLT / DF FA

Compile and Download Program

Compile Program Download Program

Unrestricted © Siemens AG 2017


Page 12 SLT / DF FA

Handout 6
Quick Guide

Go online

2 กด Monitor all 1 กด Go online

ตัวอย่ าง การอ่านค่ าจาก Power meter


ที่เป็ น Modbus TCP/IP

Unrestricted © Siemens AG 2017


Page 13 SLT / DF FA

Reference

Application example

Data Communication between S7-1200 and


SENTRON PAC3200 via MODBUS TCP (Set 22)
Entry ID: 40614428, Entry date: 07/04/2017
Download link

Switching Loads with S7-1200 and SENTRON


PAC3200 via MODBUS TCP (Set 24)
Entry ID: 58856464, Entry date: 07/24/2013
Download link

Energy Data Acquisition with the


Energy Meter of the S7-1200
Entry ID: 109739414, Entry date: 11/02/2016
Download link
A5E02316180B-03
Unrestricted © Siemens AG 2017
Page 14 SLT / DF FA

Handout 7
Quick Guide

Reference

SIMATIC S7-1200 : Manual


https://support.industry.siemens.com/cs/products?dtp=Manual&mfn=ps&pnid=13683&lc=en-US
SIMATIC S7-1200 : Application example
https://support.industry.siemens.com/cs/products?ps=100&dtp=ExampleOfUse&mfn=p
s&pnid=13683&lc=en-WW
The TIA Portal Tutorial Center (videos)
https://support.industry.siemens.com/cs/document/106656707/the-tia-portal-tutorial-center-
(videos)?dti=0&pnid=13683&lc=en-WW
Automation task in 10 minutes or less
https://www.youtube.com/watch?v=0MhJfAtkcJI&list=PLC76AD9A5EF6E8212
Industry Online Support
https://support.industry.siemens.com/cs
Unrestricted © Siemens AG 2017
Page 15 SLT / DF FA

Unrestricted © Siemens AG 2017


Page 16 SLT / DF FA

Handout 8

You might also like