CN103676763A - Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform - Google Patents

Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform Download PDF

Info

Publication number
CN103676763A
CN103676763A CN201310664058.1A CN201310664058A CN103676763A CN 103676763 A CN103676763 A CN 103676763A CN 201310664058 A CN201310664058 A CN 201310664058A CN 103676763 A CN103676763 A CN 103676763A
Authority
CN
China
Prior art keywords
frame
function code
plc
socket
unix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310664058.1A
Other languages
Chinese (zh)
Inventor
陈龙
戎刚
单鹏珠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Corp of China SGCC
Nanjing NARI Group Corp
State Grid Electric Power Research Institute
Original Assignee
State Grid Corp of China SGCC
Nanjing NARI Group Corp
State Grid Electric Power Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Corp of China SGCC, Nanjing NARI Group Corp, State Grid Electric Power Research Institute filed Critical State Grid Corp of China SGCC
Priority to CN201310664058.1A priority Critical patent/CN103676763A/en
Publication of CN103676763A publication Critical patent/CN103676763A/en
Pending legal-status Critical Current

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a method for achieving communication with a Siemens S5 PLC based on a UNIX platform and a LINUX platform. The method includes the steps of initialization, initialization on original sockets, generation on sockets, connection building, data requesting and disconnection of the connecting process. According to the method, original upper computer platform software can be replaced, no extra requirement for hardware systems is required, the UNIX/LINUX is an open source operation system, cost is low, the hardware and software cost is reduced, and meanwhile the safety and the reliability of systems are further improved.

Description

Based on UNIX and LINUX platform, complete the implementation method with Siemens S5 PLC communication
Technical field
The present invention relates to a kind of and implementation method Siemens S5PLC communication, belong to communication technical field.
Background technology
Siemens's SIMATIC S5 series of PLC is the Programmable Logic Controller that Siemens the eighties is released, and adopts the modular design of compact conformation, dependable performance.The S5PLC of take is control system that core forms extensive application in the industrial circle such as power plant, iron and steel, chemical industry at home.
SIMATIC S5PLC generally forms distributed automatic system by SINEC H1 net, and SINEC H1 net is comprised of equipment such as CP1430 communication module, CP1413 network interface card, transceiver (Transceiver), coaxial bus cable, terminal organ and PLC and workstations.CP1430 communication module is the interface module that S5PLC and miscellaneous equipment carry out communication.SINEC H1 net adopts ISO/OSI reference model, meets IEEE802.3 standard, adopts 7 layers of structure: Physical layer, link layer, network layer, transport layer, session layer, presentation layer, application layer.1-4 layer carries out configuration by physical connection with in CP1430 to be realized, and 5-7 layer is realized by relevant application software.
In the computer supervisory control system of domestic use S5PLC, the overwhelming majority has adopted the PROKON-LSX of Siemens Company or FactoryLink master system software to complete the communication function with S5PLC.And PROKON-LSX and FactoryLink software have all stopped production, and no longer provide corresponding support, and S5PLC is due to its stability as industrial control product and continuity, still in a large amount of uses.Therefore, need to provide reliable, stable host computer monitoring software to complete the functions such as exchanges data, monitoring of tools, senior application.
The deficiency of the computer supervisory control system of current use S5PLC has: (1), PROKON-LSX and FactoryLink software all stop production, and corresponding support is no longer provided.Former host computer computer hardware problem of aging is serious, cannot replace, and has had a strong impact on the safe operation of supervisory system; (2), do not have before this upper computer software based on UNIX/LINUX platform of mature and reliable can complete communication function.
Adopted after the new upper machine communication software based on UNIX/LINUX platform, master system can have been updated comprehensively, removed a hidden danger, can realize many Premium Features such as equipment dynamic monitoring, control authority locking, data statistic analysis simultaneously.
UNIX operating system, is a powerful multi-user, multiple task operating system, supports various processor framework, belongs to time sharing operating system, early than the exploitation of the Bell Laboratory at AT & T in 1969.(SuSE) Linux OS is a kind of cloning system of UNIX operating system, is the class Unix operating system of a set of free use and Free propagation, is the operating system of multi-user, multitask, support multithreading and the many CPU based on POSIX and UNIX.It can move main unix tool software, application program and procotol.It supports 32 and 64 hardware.Linux has inherited Unix take the design philosophy that network is core, is the multiple-user network operating system of a stable performance.The present invention is based on Redhat linux system and carry out program development, and be transplanted in other UNIX/LINUX operating system.
Summary of the invention
Technical matters to be solved by this invention is: utilize host computer on UNIX/LINUX platform to realize the communication with S5PLC, possess 802.3 agreement communication functions.
For solving the problems of the technologies described above, the invention provides and a kind ofly based on UNIX and LINUX platform, complete the implementation method with Siemens S5PLC communication, it is characterized in that, comprise the following steps:
1) in UNIX/LINUX system, by address family, be that AF_INET, type are that SOCK_STREAM creates socket socket;
2) with UNIX/LINUX devices in system, drive I/O channel management function ioctl to obtain the corresponding MAC Address of upper machine communication network interface card, account for altogether 6 bytes, described MAC Address is as source address (Source MAC Address), and MAC Address corresponding to the CP1430 communication module of S5PLC is as destination address (Destination MAC Address).
3) again by parameter initializations such as the sll_family in socket, sll_protocol, sll_ifindex, sll_hatype, sll_pkttype, sll_halen, source address, destination addresses, and operation parameter is carried out SOCKET connection, connection procedure is used SOCK_RAW parameter to complete, to receive all bottom-up informations that comprise IEEE802.3 agreement, after SOCKET is successfully established, will return to the SOCKET descriptor of generation, subsequent step completes on described SOCKET descriptor basis;
4) connect: send request frame (Connect Request, function code 0xe1), PLC replys and confirms claim frame (Connect Confirm, then send acknowledgement frame (Acknowledge, function code 0x60) function code 0xd1),, after this three process, communication is set up and is activated;
5) request msg: read plc data, send out Frame (Data, function code 0xf0), PLC first replys acknowledgement frame (Acknowledge, function code 0x60) to Frame and represents that it has received Frame, send out again an envelope Frame (Data, function code 0xf0) reply the data in PLC, receive after the Frame of PLC reply, send out again an envelope acknowledgement frame (Acknowledge, function code 0x60) replied confirmation, now the request process of a secondary data completes;
6) disconnect: send out claim frame (Disconnect Request, function code 0x80), PLC replys and confirms claim frame (Disconnect Confirm, function code 0xc0), send out acknowledgement frame (Acknowledge, function code 0x60), communication connects i.e. disconnection again.
The beneficial effect that the present invention reaches: the invention solves Siemens SIMATIC S5PLC and UNIX/LINUX master system and complete the problem of communication by IEEE802.3 agreement, eliminated S5PLC former can only with the defect of windows platform master system communication, reduce hardware and software investment, improved the safety and reliability of PLC and master system communication.
Embodiment
Due to the non-Transmission Control Protocol of IEEE802.3 agreement, and early stage a kind of underlying protocol based on MAC Address, use MAC Address to replace IP address.Therefore the present invention completes connection by RAW Ethernet communication modes.
First by address family, be that AF_INET, type are that SOCK_STREAM creates socket socket.
The IO channel management function that re-uses ioctl obtains the corresponding MAC Address of upper machine communication network interface card, account for altogether 6 bytes, this MAC Address is as source address (Source MAC Address), and MAC Address corresponding to the CP1430 communication module of S5PLC is as destination address (Destination MAC Address).The Ethernet data frame format of IEEE802.3 is generally as shown in table 1:
Table 1:
Figure BDA0000432803090000041
Thereafter, again by parameter initializations such as the sll_family in socket, sll_protocol, sll_ifindex, sll_hatype, sll_pkttype, sll_halen, source address, destination addresses, and use these parameters to carry out SOCKET connection, this connection must be used SOCK_RAW parameter to complete, to can receive all bottom-up informations that comprise 802.3 agreements.After SOCKET is successfully established, will return to the SOCKET of generation, follow-up all operations just completes on this SOCKET basis.
Connect: software first of the present invention is sent out claim frame (Connect Request, function code 0xe1), PLC can reply and confirm claim frame (Connect Confirm, function code 0xd1), thereafter software is sent out acknowledgement frame (Acknowledge again, function code 0x60), after this three process, communication is set up and is activated.
Request msg: after this, software reads plc data, will send out Frame (Data, function code 0xf0), PLC first can reply acknowledgement frame (Acknowledge to this Frame, function code 0x60) represent that it has received Frame, and then send out again an envelope Frame (Data, function code 0xf0) and reply the data in PLC.Software is received after the Frame of PLC reply, be sent out an envelope acknowledgement frame (Acknowledge, function code 0x60) again and be replied confirmation.Now, the request process of a secondary data completes.
Disconnect: software first of the present invention is sent out claim frame (Disconnect Request, function code 0x80), PLC can reply and confirm claim frame (Disconnect Confirm, function code 0xc0), thereafter software is sent out acknowledgement frame (Acknowledge again, function code 0x60), communication connects i.e. disconnection.
Above the process of the present invention and PLC communication is set forth, the SINEC H1 stipulations that wherein Frame (Data) has comprised S5PLC communication, its form that reads plc data frame is as shown in table 2:
Table 2:
Can correctly intactly receive all valid data like this.Data writing format similarly.
The present invention be based under UNIX/LINUX platform, develop with Siemens S5PLC bitcom; Meanwhile, software of the present invention by initialization, initialization raw socket, generate socket, connect, request msg, a series of complete process implementations such as disconnect, please all processes all have autonomous program source code support.The present invention can substitute original host computer platform software completely, and to hardware system without extra demand, and UNIX/LINUX is open source operating system, with low cost, reduced hardware and software cost, further improved the safety and reliability of system simultaneously.By arriving UNIX/LINUX platform based on existing can completing with the software transplanting of Siemens S5PLC communication in Windows system, can complete the object of the invention equally.
IEEE: IEEE's (English: Institute of Electrical and Electronics Engineers, referred to as IEEE) be international electronic technology and an Electronic Engineering Association that builds on January 1st, 1963, also be one of maximum in the world professional technique tissue, have from 175 360,000 national members.Except being built in the general headquarters of New York city,U.S, also in more than 150 country in the whole world, having branch, and also have 35Ge professional society and 2 federations.It often can deliver multiple magazine, journal, books every year, also holds the specialized conference of at least 300 times.IEEE has great impact in the defined standard of industry member at present.
PLC: programmable logic controller (PLC) (Programmable Logic Controller, be called for short PLC), a digital electronic device with microprocessor, the digital logic controller of controlling for robotization, can load steering order at any time in internal memory and store and carry out.Programmable Logic Controller is by innernal CPU, and the unit institute modularities such as instruction and data internal memory, input-output unit, power supply module, digital simulation are combined into.PLC is widely used in current industrial control field.Before programmable logic controller (PLC) occurs, generally to use hundreds of relay and counter could form the automated system with identical function, and now, through the simple programmable logic controller module of programming, substantially replaced these large-scale plants.The system program of programmable logic controller (PLC) generally before dispatching from the factory initialization complete, what user can be according to oneself need to meet different automated production requirements from the corresponding user program of edlin.PLC can receive (input) and send the electric or electronic signal of (output) multiple kenel, and with them, controls or supervise machinery and the electrical system of almost all kinds.
Below with preferred embodiment, disclose the present invention, so it is not intended to limiting the invention, and all employings are equal to replaces or technical scheme that equivalent transformation mode obtains, within all dropping on protection scope of the present invention.

Claims (1)

1. based on UNIX and LINUX platform, complete the implementation method with Siemens S5PLC communication, it is characterized in that, comprise the following steps:
1), in UNIX/LINUX system, by address family, be that AF_INET, type are that SOCK_STREAM creates socket socket;
2) with UNIX/LINUX devices in system, drive I/O channel management function ioctl to obtain the corresponding MAC Address of upper machine communication network interface card, account for altogether 6 bytes, described MAC Address is as source address (Source MAC Address), and MAC Address corresponding to the CP1430 communication module of S5PLC is as destination address (Destination MAC Address).
3) again by parameter initializations such as the sll_family in socket, sll_protocol, sll_ifindex, sll_hatype, sll_pkttype, sll_halen, source address, destination addresses, and operation parameter is carried out SOCKET connection, connection procedure is used SOCK_RAW parameter to complete, to receive all bottom-up informations that comprise IEEE802.3 agreement, after SOCKET is successfully established, will return to the SOCKET descriptor of generation, subsequent step completes on described SOCKET descriptor basis;
4) connect: send request frame Connect Request, function code 0xe1, PLC replys and confirms claim frame Connect Confirm, function code 0xd1, then send acknowledgement frame Acknowledge, and function code 0x60, after this three process, communication is set up and is activated;
5) request msg: read plc data, send out Frame Data, function code 0xf0, PLC first replys acknowledgement frame Acknowledge to Frame, and function code 0x60, represents that PLC has received Frame, send out again an envelope Frame Data, function code 0xf0, replys the data in PLC, receives after the Frame of PLC reply, to send out again an envelope acknowledgement frame Acknowledge, function code 0x60, is replied confirmation, and now the request process of a secondary data completes;
6) disconnect: send out claim frame Disconnect Request, function code 0x80, PLC replys and confirms claim frame Disconnect Confirm, function code 0xc0, then send out acknowledgement frame Acknowledge, and function code 0x60, communication connects i.e. disconnection.
CN201310664058.1A 2013-12-09 2013-12-09 Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform Pending CN103676763A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310664058.1A CN103676763A (en) 2013-12-09 2013-12-09 Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310664058.1A CN103676763A (en) 2013-12-09 2013-12-09 Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform

Publications (1)

Publication Number Publication Date
CN103676763A true CN103676763A (en) 2014-03-26

Family

ID=50314668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310664058.1A Pending CN103676763A (en) 2013-12-09 2013-12-09 Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform

Country Status (1)

Country Link
CN (1) CN103676763A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010043217A1 (en) * 1998-07-21 2001-11-22 Raytheon Company, A Delaware Corporation Information security analysis system
CN1845084A (en) * 2006-05-12 2006-10-11 罗军 Embedded remote monitoring system based on Ethernet and PSTN communication mode
CN101895729A (en) * 2010-07-06 2010-11-24 南京南自信息技术有限公司 Streaming media server of embedded Linux shearing system
CN102111382A (en) * 2009-12-28 2011-06-29 北京安码科技有限公司 Method for distributed service to confronting attach of distributed denial of service (DDOS)
US8280955B1 (en) * 2010-07-15 2012-10-02 Symantec Corporation Systems and methods for handling client-server communications

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010043217A1 (en) * 1998-07-21 2001-11-22 Raytheon Company, A Delaware Corporation Information security analysis system
CN1845084A (en) * 2006-05-12 2006-10-11 罗军 Embedded remote monitoring system based on Ethernet and PSTN communication mode
CN102111382A (en) * 2009-12-28 2011-06-29 北京安码科技有限公司 Method for distributed service to confronting attach of distributed denial of service (DDOS)
CN101895729A (en) * 2010-07-06 2010-11-24 南京南自信息技术有限公司 Streaming media server of embedded Linux shearing system
US8280955B1 (en) * 2010-07-15 2012-10-02 Symantec Corporation Systems and methods for handling client-server communications

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
徐世许等: "《机器自动化控制器原理与应用》", 31 October 2013, 机械工业出版社 *
蔡尧: "Linux环境下的嵌入式系统开发及其网络编程应用", 《中国优秀硕士论文全文数据库信息科技辑》 *

Similar Documents

Publication Publication Date Title
CN104620184B (en) Main intelligent electronic device for high-level application
EP2283403A2 (en) System and method for implementing a power control application in a distributed control system using iec61850
CN105305418A (en) Power distribution terminal self-description method based on IEC61850 standard
CN106016587B (en) Multi-variable air conditioning unit and its means of communication and device
CN102833112A (en) Communication management machine having looped network function
CN104253767A (en) Virtual shard network implementing method and switch
CN102053935A (en) MODBUS serial communication protocol-based communication method
CN103827759A (en) Method for configuring a communication interface module in a control or automation system
CN108449250A (en) A kind of IO-LINK master station devices and method for supporting multibus
CN105389278A (en) CAN bus based serial communication method for master and slave machines
CN105471098A (en) Intelligent distributed feeder automation system
CN105420443B (en) Converter inclining control system
CN107807604B (en) On-site bus control system based on Siemens controller and ohm dragon controller
CN102916489A (en) Virtual terminal automatic wiring method based on primary system structure of regional power grid
CN109284121A (en) The method and system of accumulation power supply multistage network multi-control apparatus synchronized update program
CN107992019B (en) Main station and sub station integrated error-prevention system closed loop test method and system
CN114285695A (en) Communication method, device, equipment, system and storage medium
CN204129519U (en) A kind of intelligent home control system with bus apparatus
CN103795773A (en) Remote networking monitoring method and system of high-voltage direct-current power supply devices
CN101105747A (en) Power station communication system and its reduction procedure implement method
CN104516850A (en) Connecting method for modularized products, modularized products using method and family service bus for method
CN103676763A (en) Method for achieving communication with Siemens S5 PLC based on UNIX platform and LINUX platform
CN116709069A (en) Message forwarding method, device, equipment and storage medium
CN104848472A (en) Air conditioner monitoring system, OPC server for air conditioner and OPC connecting method
CN105444333A (en) Central air conditioner control system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140326

RJ01 Rejection of invention patent application after publication