Real-time ethernet system and its implementation
Technical field
The present invention relates to Ethernet communication technology field, particularly a kind of real-time ethernet system and its implementation.
Background technology
Ethernet is as one of present most widely used computer communication network, adopt csma/cd (CSMA/CD) agreement, transmission rate can reach more than gigabit and even 10,000,000,000, but the CSMA/CD agreement that it adopts, brought the uncertainty in transmission time, make it can not be applicable to real-time network, therefore research be applicable to control system real-time ethernet highly significant.
Based on ICP/IP protocol, the hierarchy of ethernet communication is: application layer, transport layer, network layer, data link layer and physical layer, wherein transport layer protocol mainly contains TCP, UDP, network layer protocol mainly contains IP, and the data link layer of Ethernet is divided into logic link control (LLC) sublayer and media interviews control (MAC) sublayer again.
The realization of real-time ethernet is mainly by revising ethernet mac sublayer agreement, increase intermediate software layer many modes such as (can add, also can add) between LLC sublayer and media access control sublayer between IP layer and LLC sublayer.
The realization of real-time ethernet that at present many documents arranged, real-time ethernet standard and product that many maturations are arranged simultaneously, for example existing at present 11 kinds of real-time ethernet standards are included into IEC61158 standard for Fieldbus (the 4th edition), comprise Ethemet/IP, PROFINET, P-NET/IP, INTERBUS TCP/IP, VNET/IP, TCnet, EtherCAT, Ethernet Powerlink, EPA, MODBUS-RTPS, SERCOS III.
Mainly there are following two problems in method for present existing various realization real-time ethernets:
1, realizes real-time ethernet, at first to solve the time synchronized between each node, present relevant paper and standard are all disperseed synchronized algorithm based on each node operation, no matter be based on the algorithm of software, as NTP, SNTP etc., also be based on the algorithm of software, combination of hardware, as IEEE1588 etc., certain or some nodes break down, and then can influence the normal operation and the synchronization accuracy of synchronized algorithm.
2, realize real-time ethernet, its core is the CSMA/CD agreement that changes based on competition mechanism, thereby realizes time deterministic communication mode, but the essence of real-time ethernet is still multi-host communication.If real-time ethernet certain or some node breaks down, the then very likely realization of influence time deterministic communication mechanism, no matter and at present be relevant paper, or how relevant criterion is all not mentioned excises malfunctioning node.
Summary of the invention
(1) technical problem that will solve
The technical problem to be solved in the present invention is: how realize real-time ethernet communication under the situation of the hardware of avoiding changing significantly Ethernet, software and protocol stack, and can avoid malfunctioning node oneself to close oneself problem, the problem includes: the logic flaw problem.
(2) technical scheme
A kind of real-time ethernet system, comprise: some communication nodes, ethernet communication network and time synchronized subsystem, each communication node is connected with the time synchronized subsystem with ethernet communication network respectively, and described time synchronized subsystem is used to control each communication node and carries out real-time ethernet communication.
Wherein, described time synchronized subsystem comprises: real-time processing controller and real-time processing communication bus, described real-time processing controller links to each other with the real-time processing communication bus, and described real-time processing controller comprises: main real-time processing and control element (PCE) and some from real-time processing and control element (PCE)
The real-time processing and control element (PCE) of described master is connected from real-time processing and control element (PCE) with some by described real-time processing communication bus, be used to produce the time assignment information that each communication node carries out ethernet communication, and judge the whether overtime communication resource that takies of communication node according to the communications status of each communication node, if overtime, to send the order that overtime communication node enforcement is resetted or excises from real-time processing and control element (PCE); Described time assignment information is meant to allow and allows certain node to begin to carry out control informations such as ethernet communication and call duration time length.Described overtime certain communication node that is meant is not finished the state information of communication in official hour length.
Each is described from communication node of real-time processing and control element (PCE) connection, be used for transmitting described time assignment information and overtime communication node being implemented the order that resets or excise to described communication node, and to leading the communications status that real-time processing and control element (PCE) feeds back described communication node.The communications status of described communication node is meant that this communication node finishes communication whether information and other information relevant with this node ethernet communication in official hour length.
Wherein, the real-time processing and control element (PCE) of described master comprises: the timing controlled subelement, and the overtime judgment sub-unit and the first Control on Communication subelement,
Described timing controlled subelement connects the first Control on Communication subelement, is used to produce the time assignment information of each communication node, and sets the timing controlled scheme that difference is used in real time;
Described overtime judgment sub-unit connects the described timing controlled subelement and the first Control on Communication subelement respectively, be used to judge whether communication node is overtime, if overtime, then produce the order that overtime communication node enforcement is resetted or excises, send by the first Control on Communication subelement;
The first Control on Communication subelement connects described timing controlled subelement and overtime judgment sub-unit, and connection real-time processing communication bus, be used for sending described time assignment information and overtime communication node being implemented the order that resets or excise from real-time processing and control element (PCE), and receive the communications status of the described communication node of sending from real-time processing and control element (PCE) to described.
Wherein, describedly comprise from real-time processing and control element (PCE): communication node control sub unit and connected second communication control sub unit,
The second communication control sub unit connects described real-time processing communication bus, be used to receive time assignment information that main real-time processing and control element (PCE) sends and overtime communication node is implemented the order that resets or excise, and to the communications status of leading real-time processing and control element (PCE) feedback communication node;
Described communication node control sub unit is used to receive time assignment information that the second communication control sub unit transmits and overtime communication node is implemented the order that resets or excise, and the communications status of the communication node that obtains is sent to described second communication control sub unit.
Wherein, the real-time processing and control element (PCE) of described master and all adopt 3 to get 2 or 2 and get 2 and take advantage of 2 redundancy structure from real-time processing and control element (PCE).
Wherein, described real-time processing communication bus is two redundant mode buses.
A kind of implementation method of utilizing above-mentioned real-time ethernet system may further comprise the steps:
S1: the real-time processing and control element (PCE) of described master produces the time assignment information that each communication node carries out ethernet communication successively, and with described time distribute send to corresponding to real-time processing and control element (PCE);
S2: describedly described time assignment information is sent to described communication node from real-time processing and control element (PCE);
S3: described communication node receives described time assignment information, the beginning ethernet communication;
S4: after communication is finished, corresponding the finishing of described communication node notice from real-time processing and control element (PCE) communication.
Wherein, also comprise the step that overtime node enforcement is resetted and excises between described step S3 and the S4:
In communication process, described ethernet communication state from real-time processing and control element (PCE) to the real-time processing and control element (PCE) of described master that transmit described communication node from;
The real-time processing and control element (PCE) of described master judges according to described communications status whether described communication node is overtime, if, then send the order that this communication node enforcement is resetted or excises, otherwise, execution in step S1;
Described from real-time processing and control element (PCE) receive described to this communication node implement to reset or the order of excising after, the corresponding communication node is resetted or excises operation, and finish the communication of this communication node.
Wherein, the real-time processing and control element (PCE) of described master be communication node to distribute the mode of lock in time be the period allocated mode, described each cycle is divided into two periods of real-time control communication and non real-time ethernet communication or is divided into real-time control communicates by letter the period.
Wherein, the described real-time control communication period comprises the experimental process period.
(3) beneficial effect
The present invention realizes the time synchronized of each node by real-time ethernet time synchronized subsystem is set, thereby between the application layer of communication node software and transport layer, add real-time processing layer and realize real-time ethernet, avoided hardware, software and protocol stack to make amendment to Ethernet, reduced Ethernet synchronous data communication expense simultaneously, and can implement to reset or excise processing to malfunctioning node, close the logic flaw problem that oneself exists thereby solved malfunctioning node oneself.
Description of drawings
Fig. 1 is the real-time ethernet system configuration schematic diagram of the embodiment of the invention;
Fig. 2 is a time synchronized subsystem structure schematic diagram among Fig. 1;
Fig. 3 is the structural representation of main real-time processing and control element (PCE) among Fig. 2;
Fig. 4 is from the structural representation of real-time processing and control element (PCE) among Fig. 2;
Fig. 5 is the real-time ethernet hierarchy block diagram of the embodiment of the invention;
Fig. 6 is the real-time ethernet communication means flow chart of the embodiment of the invention;
Fig. 7 is the flow chart that enforcement resets or excises to malfunctioning node in the real-time ethernet communication means of the embodiment of the invention;
Fig. 8 is to be that communication node distributes schematic diagram lock in time in the real-time ethernet communication means of the embodiment of the invention.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples are used to illustrate the present invention, but are not used for limiting the scope of the invention.
The real-time ethernet that the present invention realizes comprises: some communication nodes, ethernet communication network and time synchronized subsystem, as shown in Figure 1, each communication node is connected with the time synchronized subsystem with ethernet communication network respectively, realizes the real-time ethernet function jointly.
Described communication node, its communication hardware uses general Ethernet card, its communication software is based on general TCP or UDP/IP protocol stack, adds real-time processing layer between its application layer and transport layer, in real time processing layer carry out real-time data communication should be based on udp protocol.Described ethernet communication network uses general ethernet device (switch, router and netting twine etc.), finishes the Ethernet data transfer function, and network should possess redundancy feature.
The of paramount importance basis of real-time ethernet that the present invention realizes is exactly each node dispersion synchronized algorithm that do not rerun, but real-time ethernet time synchronized subsystem is set, and each communication node is controlled, thereby reached the time synchronized of each communication node.
Wherein, this real-time ethernet time synchronized subsystem comprises: real-time processing controller and coupled real-time processing communication bus.As shown in Figure 2, described real-time processing controller comprises: main real-time processing and control element (PCE) and some from real-time processing and control element (PCE), main real-time processing and control element (PCE) is connected from real-time processing and control element (PCE) with some by the real-time processing communication bus, main real-time processing and control element (PCE) does not connect any communication node, and each connects a communication node from real-time processing and control element (PCE).
Main real-time processing and control element (PCE) is used for producing successively the time assignment information that each communication node carries out ethernet communication, and judge the whether overtime communication resource that takies of communication node, if overtime, to send the order that overtime communication node enforcement is resetted or excises from real-time processing and control element (PCE).The time assignment information is meant to allow and allows certain node to begin to carry out control informations such as ethernet communication and call duration time length.Overtime certain communication node that is meant is not finished the state information of communication in official hour length.As described in Figure 3, leading real-time processing and control element (PCE) comprises: timing controlled subelement, overtime judgment sub-unit and the first Control on Communication subelement.Wherein the timing controlled subelement connects the first Control on Communication subelement and overtime judgment sub-unit, is used to produce the time assignment information of each communication node, and sets the timing controlled scheme that difference is used in real time by configuration interface.Overtime judgment sub-unit connects the described timing controlled subelement and the first Control on Communication subelement respectively, be used to judge whether communication node is overtime, if overtime, then produce the order that overtime communication node enforcement is resetted or excises, send by the first Control on Communication subelement.The first Control on Communication subelement connects timing controlled subelement, overtime judgment sub-unit, also connect described real-time processing communication bus, be used for sending described time assignment information and overtime communication node being implemented the order that resets or excise from real-time processing and control element (PCE), and receive the communications status of the described communication node of sending from real-time processing and control element (PCE) to described.
Be used for implementing the order that resets or excise from real-time processing and control element (PCE) to described communication node forwarding time assignment information with to overtime communication node, and to leading the communications status that real-time processing and control element (PCE) feeds back described communication node.The communications status of communication node is meant that this communication node finishes communication whether information and other information relevant with this node ethernet communication in official hour length.As shown in Figure 4, comprise from real-time processing and control element (PCE): communication node control sub unit and connected second communication control sub unit.Wherein the second communication control sub unit connects described real-time processing communication bus, be used to receive time assignment information that main real-time processing and control element (PCE) sends and overtime communication node is implemented the order that resets or excise, and to the communications status of leading real-time processing and control element (PCE) feedback communication node.The communication node control sub unit is used to receive lock in time that the second communication control sub unit transmits and overtime communication node is implemented the order that resets or excise, and the communications status of the communication node that obtains is sent to described second communication control sub unit.
In the present embodiment, highly reliable in order to satisfy, high available requirement, main real-time processing and control element (PCE) and all adopt redundancy structure from real-time processing and control element (PCE) preferably adopts 3 to get 2 or 2 and get 2 and take advantage of structures such as 2.The real-time processing communication bus can be used the STD bus of various maturations, also can use independently developed dedicated bus.Because it is principal and subordinate's working method, its amount of communication data is also little, therefore can use the low-speed communication bus, preferred high-speed communication bus.In order to satisfy its highly reliable, high available requirement, the real-time processing communication bus should adopt redundant configuration, the preferred pair redundant configuration modes that adopt.In addition, the real-time ethernet of present embodiment structure requires employed general ethernet device (network interface card, switch and router etc.) and network all should possess redundancy feature.
The invention allows for a kind of real-time ethernet implementation method, between the application layer of ICP/IP protocol hierarchy and transport layer, add real-time processing layer, as shown in Figure 5, this real-time processing layer is communicated by letter in conjunction with finishing real-time ethernet with above-mentioned real-time ethernet time synchronized subsystem, as shown in Figure 6, may further comprise the steps:
Step S601, main real-time processing and control element (PCE) are that communication node distributes the time assignment information of carrying out ethernet communication, and described time assignment information are sent to corresponding to real-time processing and control element (PCE).Be that communication node distributes the time assignment information of carrying out ethernet communication specifically, and through the real-time processing communication bus described time assignment information sent to from real-time processing and control element (PCE) by the first Control on Communication subelement by the timing controlled subelement.
Step S602, the described communication node that described time assignment information is sent to correspondence from real-time processing and control element (PCE).Particularly, from the second communication control sub unit of real-time processing and control element (PCE) the time assignment information that receives is sent to the communication node control sub unit, the communication node control sub unit is transmitted to connected communication node with described time assignment information.
Step S603, described communication node receive described time assignment information, the beginning ethernet communication.In the TCP and two kinds of agreements of UDP of transport layer, Transmission Control Protocol is connection-oriented, and real-time communication can not get guaranteeing, and udp protocol is towards connectionless, therefore in real time processing layer carry out real-time data communication should be based on udp protocol.
Step S604, after communication is finished, corresponding the finishing of described communication node notice from real-time processing and control element (PCE) communication.
Wherein, step S603 and S604 mainly finish at real-time processing layer, communication node receives the order of correspondence from the beginning ethernet communication of real-time processing and control element (PCE) transmission by real-time processing layer, the beginning ethernet communication, and ethernet communication is finished the state information of having communicated by letter and having finished from real-time processing and control element (PCE) of back notice correspondence.Owing in the ICP/IP protocol hierarchy, add real-time processing layer, hardware, drive software and protocol stack and common Ethernet that original transport layer, network layer and ethernet layer adopt are in full accord, and assurance can make full use of the technical resource and the technical advantage of Ethernet.
In the process of real time communication, some node may break down and cause overtimely, then can influence the synchronous communication of node, therefore, also can reset or excise overtime node in communication process, detailed process be crossed as shown in Figure 7, and step S701~S703 is consistent with above-mentioned steps S601~S603.
Step S704 in communication process, transmits the ethernet communication state of described communication node to the real-time processing and control element (PCE) of described master from real-time processing and control element (PCE).Obtain the communications status of the communication node of its connection from the communication node control sub unit of real-time processing and control element (PCE), and send to main real-time processing and control element (PCE) by the second communication control sub unit.
Step S705, the real-time processing and control element (PCE) of described master judge whether described communication node is overtime, if, execution in step S706 then, otherwise, execution in step S701.The overtime judgment sub-unit of main real-time processing and control element (PCE) judges according to the ethernet communication time of timing controlled subelement distribution with by the communications status of the communication node that feeds back from real-time processing and control element (PCE) whether this communication node is overtime.
Step S706, overtime judgment sub-unit is sent the order that this communication node enforcement is resetted or excises, and this order sends to from real-time processing and control element (PCE) by the first Control on Communication subelement.
Step S707, described from the described order that this communication node enforcement is resetted or excises of real-time processing and control element (PCE) reception, overtime communication node is resetted or excise operation by the communication node control sub unit, and finish to communicate by letter, after resetting or excising, at next communication cycle, no longer for this overtime node distributes the ethernet communication time, other communication node can not be affected.
Wherein, the real-time processing and control element (PCE) of described master is that the mode of communication node distribution ethernet communication time is the period allocated mode, difference according to application, can be divided into real-time control communication and two periods of non real-time common ethernet communication each cycle, also all can be divided into the real-time control communication period each cycle, each communication period of control in real time is divided into the sub-period that equates or do not wait according to the actual conditions of communication node again and distributes to different communication nodes.The distribution of cycle and sub-period can be decided according to system requirements, and the distribution of cycle and sub-period can change.Wherein, each sub-period is a small time period, as shown in Figure 8.
Fig. 8 has further described the flow process of this real-time ethernet system communication, comprises proper communication and the process that overtime communication node is resetted or excises.Also provided simultaneously the example that communication cycle, period, sub-period distribute.Distribution can realize real-time ethernet communication like this, also can take into account common ethernet communication, and the distribution of communication cycle, period, sub-period simultaneously also can adjust according to the actual requirements.The assignment information of communication cycle, period, sub-period is set by the configuration interface of main real-time processing and control element (PCE).
Above execution mode only is used to illustrate the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make various variations and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.