Real time synchronization network and method of work thereof based on standard ethernet
Technical field:
The present invention relates to a kind of real-time synchronous communication network that is used for the communication of industry spot level, relate in particular to a kind of real time synchronization network based on standard ethernet, be used for solving field level communication system communication issue, when promptly how to solve Ethernet and being used for the field level communication system, realize the real-time and and the precise synchronization of system of communication.
Background technology
In factory automation and process automation field, fieldbus is the mainstream solution in the field level communication system at present.But, along with continuous advancement in technology and development, the conventional on-site bus has shown the limitation of itself more and more.On the one hand, along with improving constantly of field apparatus degree of intelligence, control becomes and more and more disperses, and being distributed between factory's smart machine everywhere and between smart machine and the factory's key-course needs exchanging control data continuously, and this makes that the exchange capacity of data rapidly increases between the field apparatus; On the other hand, along with development of computer, enterprise wishes the production information of bottom to be incorporated in the unified full factory information management system, so the information management system of enterprise need read on-the-spot creation data, and by industrial communication network realization remote service and maintenance, therefore, vertical consistency also becomes popular topic, the user wish management level and field level can use unified, with the communication plan of Automated Technology in Office compatibility, can simplify the structure of plant control system so greatly, save the cost of system implementation and maintenance.
Based on such demand, ethernet technology begins gradually the information management course bottom infiltration from factory and enterprise, and ethernet technology begins to be widely used in the controlled stage communication of factory.In the automation world, use the Ethernet solution that the significant advantage of several respects is arranged: unified framework, integrated communication and powerful service and diagnostic function.From the situation in present industrial automation control field, ethernet technology replaces the inexorable trend that fieldbus is the industrial control network development.
But, ethernet technology being applied in the production control process of factory is not a simple migration process.In the process that ethernet technology is incorporated into controlled stage communication, in order to satisfy the specific demand of industrial control system, as site environment, topological structure, reliability requirements, must common office's Ethernet be adjusted and replenish, to guarantee ethernet technology in the industry spot reliability of applying, i.e. our Industrial Ethernet of often saying.At present, in the controlled stage communication network field, the Industrial Ethernet solution has obtained recognition and acceptance widely, and enterprise and factory have also enjoyed facility and the income that the high performance communication network brings to the full.However, the Industrial Ethernet technology is running into the obstacle that is difficult to overcome---the real-time and the certainty of communication when the field level control system of the bottom is permeated.Because Ethernet adopts CSMA/CD collision detection mode, that is: when the some nodes on the network need send data, it is monitor channel at first, waited for if channel busy is just lasting, when in a single day it listen to channel idle, just data was sent.If two or more nodes all monitor and etc. data to be sent, when listening to channel idle, each node (almost simultaneously) just immediately begins to send data, this is just to clash.If a node detects conflict during the transmission, just stop transmission immediately, and send " a crowding " signal to channel, also find conflict to guarantee the every other node on the network.In the communication based on Ethernet, for avoiding conflict, each node adopts binary exponential backoff (BEB, Binary Exponential Back-Off) algorithm process conflict, but this method has the probabilistic defective of conflict time delay.When network load was big, the uncertainty of Network Transmission can not satisfy the real-time requirement of Industry Control, so the traditional ethernet technology is difficult to satisfy the real-time requirement that control system requires accurate timing communication, was regarded as the uncertainty network always.
Industrial control network is a kind of typical application system in real time, and task wherein (as the execution of functional block) is set out according to certain time interval usually, and the task executions time is had by the property requirement, and this task is called periodic task.Also has a kind of task in the application system in real time, this task only just occurs under specific Event triggered, the for example upload/download of equipment disposition, failure diagnosis, program, log, warning processing etc., this task is called the aperiodicity task, and the aperiodicity task triggers at random.These two kinds of tasks are reflected in the communication of industrial control network, are exactly the two class communication informations: the periodical communication information and the aperiodicity communication information.Periodical communication information is real time information, and aperiodic, information was non-real time information, and periodical communication information has different time responses with the aperiodicity communication information.In case system configuration is finished, the transmission of periodical communication information just has the time certainty.But not periodical communication information burst information often is uncertain in time.
For real-time and the certainty that improves Ethernet, people have done many researchs, propose the whole bag of tricks and improve CSMA/CD, the division of improving one's methods according to CSMA/CD mainly contains: improve the ethernet mac agreement, increase transmission controlling mechanism etc. on the Ethernet upper strata.CSMA/DCR (Deterministic Collision Resolution) is that the most representative a kind of MAC agreement is improved one's methods.When conflict takes place, adopt deterministic binary tree addressing method, CSMA/DCR takes the mode of preorder traversal to manage conflict according to node address.When conflict took place, the node stop of low priority was to the competition of channel, and the node of high priority continues competitive channel, up to successfully transmission.Though the mode of this modification ethernet mac agreement can be improved the deterministic problem of ethernet communication greatly, be cost but with change Ethernet firmware (ethernet controller hardware and software), be difficult to the commercial Ethernet compatibility with standard, and increased development cost.
Most typical a kind of method is that time-division multiplex obtains (TDMA) strategy in Ethernet upper strata increase transmission controlling mechanism, TDMA distributes certain bandwidth for each node, each node is the interior transmission information of sheet at a fixed time, has definite transmitting time with the information that guarantees each node.Because TDMA does not need to transmit extra control information, makes the network bandwidth get utilization rate than higher.But TDMA is based on the method for node, can not reflect the actual bandwidth requirement of each node, can't guarantee that aperiodic, information in time sent.Another method that increases transmission control on the Ethernet upper strata is a master-slave mode transmission control mode, this is a kind of centralized transmission control mode, have a main equipment and a plurality of slave unit in the network at least, slave unit only after receiving the control message of autonomous device, just can send data.The advantage of this master-slave mode transmission control mode is to guarantee that each slave unit all has the chance that sends data, but shortcoming is the bursty communication that can't handle in the industrial control network, for example the warning message in the industrial control network.
Therefore, although said method has all improved the real-time and the certainty of Ethernet transmission to a certain extent, but be to be cost (as CSMA/DCR) to change the Ethernet structure, perhaps realize at lower network layer (as the upper strata of MAC layer), the maximum deficiency of these methods is to realize that difficulty is big, often relate to hardware, can't be compatible with the Ethernet of traditional standard, and can't satisfy in the industrial control network two category informations-cycle information (being real time information) and information aperiodic (being generally non real-time information) are carried out simultaneously treated specific (special) requirements.
The development of Fast Ethernet and switching Ethernet technology has brought a solution for the uncertain problems that solves Ethernet, makes this application become possibility.At first, the traffic rate of Ethernet increases to 1000M of today, 10G from 10M, 100M, and under the identical situation of data throughout, the raising of traffic rate means alleviating and reducing that Network Transmission postpones of network load, and promptly collision probability descends greatly.Next adopts starshaped net topology, and switch is divided into several network segments with network.The Ethernet switch is owing to have storage, forwarding capability, make the Frame of input and output between each port can access buffering, no longer bumping simultaneously, switch also can filter the data of transmission over networks, the transmission of data is only limit in local network segment to be carried out, and no longer need through backbone network, also no longer take the bandwidth in other network segments, thereby reduced the network load of all network segments and backbone network.Once more, full-duplex communication makes again and receives and send message frame respectively simultaneously on two pairs of twisted-pair feeders (or two pairs of optical fiber) between port, also can not clash.Therefore, adopt switch hub and full-duplex communication, the collision domain on the network has not been existed (full-duplex communication), or collision probability reduces (half-duplex) greatly, thereby Ethernet communication certainty and real-time are improved greatly.But adopt the full-duplex switched-type Ethernet, changed CSMA/CD mechanism, the communication speed of network and efficient will depend on switch.In order to reduce the influence of switch to whole network speed and efficient, to avoid striding a plurality of switch communication during networking as far as possible, the equipment of frequent swap data is placed in the network segment, this will increase difficulty to networking, the expansion of system after also being unfavorable for.
Also there is strict requirement in the system that has to the synchronism of communication node, and such as in motion control, the synchronism of each also is an important factors.Existing solution is that all websites on the network must be by accurate clock synchronization to realize synchronous real-time ethernet.For example: Internet NTP (Network Time Protocol) NTP (Network Time Protocal), simple time network agreement SNTP (Simple Network Time Protocal), IEEE1588 standard Precision Time Protocol agreement PTP (Precision Time Protocal), periodically the synchronization packets that has a timestamp agreement by transmission realize communication cycles synchronously.Requiring synchronization accuracy is the occasion of microsecond level, goes for so high synchronization timing, can't realize by software merely, must rely on the support of hardware in the network second layer (data link layer), real-time asic chip when promptly waiting.
A lot of now manufacturers that use Ethernet to do field level communication, host computer all is the special use control network interface card of oneself developing, to realize the real time communication of Ethernet.Be difficult to and the standard ethernet compatibility, the also very difficult equipment interchange of developing with other manufacturer forms separately an independently cover communication system.
Now mainly containing several popular Industrial Ethernet networks in the world, is respectively PROFINET, Ethernet/IP, PowerLink, SYNQNET, SERCOS III etc.
PROFINET: be a kind of typical switching Ethernet network, what switch adopted is a kind of information forwarding mechanism based on the address, and the communication speed of network and efficient will depend on switch.In order to reduce the influence of switch to whole network speed and efficient, to avoid striding a plurality of switch communication during networking as far as possible, the equipment of frequent swap data is placed in the network segment, this will increase difficulty to networking, the expansion of system after also being unfavorable for.Each equipment can't be enumerated and dispose to simultaneity factor also.PROFINET by accurate clock synchronization to realize synchronous real-time ethernet, synchrodata by rule realizes the synchronous of communication cycles, its precision can reach the microsecond level, so high level of synchronization can't realize by software merely, go for that so high precision synchronous is real-time, must rely on the support of hardware in the network second layer, promptly real-time asic chip during Siemens IRT etc. has increased system cost.
The agreement of Ethernet/IP:Ethernet/IP is made up of IEEE 802.3 physical layers and 3 parts such as data link layer standard, ICP/IP protocol group and control and information protocol CIP (Control Information Protocol), front two parts are the ethernet technology of standard, and its characteristic is exactly the CIP part that is known as control and information protocol.The commercial ethernet communication chip of Ethernet/IP network using, physical medium and star topology also are to adopt Ethernet switch to realize the point-to-point connection of each equipment room, and each equipment can't be enumerated and dispose in system also.Comprised CIPSync in the Ethernet/IP technical specification of latest edition, CIP Sync time synchronized scheme is based on the IEEE1588 standard, periodically send a real-time clock synchronization message signals by primary processor (or slave station), so as other can be synchronous exactly from processor (or slave station).This mode will increase the burden of network, need the support of hardware equally, real-time asic chip when promptly waiting.The all necessary clock of this mode, all websites, cost is higher, with such communication mechanism the programming of system is brought very big influence, because control task must start by the mode of Time Triggered, this has improved the difficulty of programming, and does not meet industry control engineering staff's programming custom.
PowerLink: realize network topology structure arbitrarily by using Hub, come networking by Hub, the system that makes is difficult to enumerate and disposes each equipment.For fear of conflict, PowerLink utilizes bandwidth as far as possible, reorganized site information interaction mechanism in the network in time, on the CSMA/CD basis, introduce the time slot administrative mechanism, a website serves as management station's managing network communication on the network, to the given synchronous beat of other websites, distribute to each station issue authority, each station can only just can release news after obtaining issuing authority.This time slot administrative mechanism though avoided the network communication conflict, also makes each equipment get real time data aperiodic (as reporting to the police etc.) and can't in time notify system.
SYNQNET: be a kind of loop network structure, has fault tolerance, main equipment is realized real time synchronization network by a kind of special-purpose control network interface card of oneself exploitation, and revised data link layer MAC agreement, realized a kind of high performance network that is synchronized with the movement, owing to being own special-purpose control network interface card and having revised data link layer MAC agreement, make its Ethernet compatibility very difficult and other manufacturer and standard.
SERCOS III: be a kind of annular or linear topology structure, main equipment is realized real time synchronization network by the special use control network interface card of oneself exploitation, and communication protocol is divided into real time communication passage and non-realtime traffic passage.The real time communication channel transfer is used to show and import all real time datas such as control inner parameter, data and diagnostic message.The non real-time passage uses the ethernet frame of standard to transmit non-real-time data.But enumerate and dispose the method for each equipment in the not proposition system.
Summary of the invention
Purpose of the present invention is exactly in order to solve when at present Ethernet being used for the field level communication system, the real-time of conventional network equipment communication and the precise synchronization of system are difficult to ensure, and the interpolation special equipment, problem such as cause that use cost increases again, provide a kind of have simple in structure, cost is lower, adopts existing common general network interface card can realize synchronous real time synchronization network and method of work thereof based on standard ethernet in real time.
For achieving the above object, the present invention has adopted following technical scheme:
A kind of real time synchronization network based on standard ethernet, in dcs, comprise at least one main equipment and at least one slave unit, optional one is source of synchronising signal in slave unit, each equipment transmits data by host-host protocol, at least one data line interface is arranged on the main equipment, each slave unit has at least two data line interfaces, connected in series each other during connection, the data line interface that is main equipment is connected on the data line interface of slave unit by data wire, another data-interface of slave unit is connected on the data interface of next slave unit by data wire, connects and composes serial network successively, carries out synchronous full-duplex communication in real time.
Described each main equipment has two data line interfaces, each slave unit has two data line interfaces, optional one is source of synchronising signal in slave unit, each equipment transmits data by host-host protocol, a data line interface of main equipment is connected on the data line interface of slave unit by data wire, another data line interface of slave unit is connected on the data interface of next slave unit by data wire, cascade is gone down like this, link on the data line interface of last slave unit always, another data line interface of last slave unit is connected on another data line interface of main equipment by data wire, the looping network carries out synchronous full-duplex communication in real time.
Described source of synchronising signal is to choose one wantonly in slave unit, and synchronous signal line is installed thereon is connected with remaining slave unit, source of synchronising signal is responsible for the strict timing and the transmission of synchronizing signal, the periodic synchronizing signal that sends, other slave units are responsible for receiving synchronizing signal, be provided with a signal delay parameter register in each slave unit, be used to set the time delay of synchronizing signal on transmission line, this signal delay parameter can be set by the form that main equipment sends configuration message.
When described source of synchronising signal is set, also can utilize software to specify a slave unit to be source of synchronising signal arbitrarily according to the form that main equipment sends command message, perhaps determine that by the mode of on any one slave unit, setting the toggle switch device slave unit is a source of synchronising signal, is connected source of synchronising signal with synchronous signal line then with all the other slave units.
Described data wire had both comprised data transmission line, also comprised the Data Receiving line, and not conflict realizes full-duplex communication during adjacent two communication between devices, and the transmission medium of data wire both can be twisted-pair feeder, also can be optical fiber.
Described full-duplex communication is, each slave unit has storage to transmit data and the direct function of transmitting data, when main equipment communicates with slave unit, each slave unit is transmitted the information of main equipment, whole system communication is conflict not, when each slave unit communicates with main equipment, if slave unit has the data that send to main equipment, with the data that send earlier oneself to main equipment, receive and store a next slave unit simultaneously and send to the data of main equipment, after waiting for that the data of oneself giving main equipment are sent completely, transmit the data that a back slave unit of having stored sends to main equipment again,, will directly transmit the data that a next slave unit sends to main equipment if slave unit does not send to the data of main equipment, avoid communication contention aware, realized the full-duplex communication of whole system.
The host-host protocol form of described serial or loop network structure can be the standard ethernet host-host protocol, as IEEE802.3 Frame Protocol form, comprise compositions such as leading character, decollator, destination address, source address, length/type field, data segment, Frame Check Sequence territory; Wherein comprise data and cycle data aperiodic in the data segment, cycle data is in the Industry Control, task is sent according to certain time interval usually, and the task executions time had data by the property requirement, aperiodic, data were only just to occur under specific Event triggered, as the upload/download of equipment disposition, failure diagnosis, program, log, warning processing etc.; Also applicable to user-defined or other known host-host protocol forms.
A kind of method of work of the real time synchronization network based on standard ethernet,
(1) at first, main equipment carries out self check to slave unit, main equipment sends a query message, first slave unit at first receives this query message, first slave unit will be transmitted this query message, and send the response message of oneself and oneself device number is initialized as 0, each slave unit is transmitted this query message successively after receiving query message, and send the response message of oneself and oneself device number is initialized as 0, slave unit to the last, last slave unit can be determined by toggle switch, after this last slave unit is received this query message, sends the response message of oneself, be included as the information of last slave unit, and oneself device number is initialized as 0, after main equipment was received the response message of last slave unit, illustrative system connected reliable and each equipment operate as normal; If main equipment is after sending query message, to wait for a period of time, this time is 2 times of maximum duration of enumerating maximum slave unit under the normal condition, still can not receive the response message of last slave unit, with reporting errors, fault has been described;
(2) after self check is passed through, main equipment is enumerated and is disposed slave unit, after promptly receiving the response message of last slave unit from main equipment, begin to send configuration message, with first continuous slave unit of main equipment, this moment, device number was 0, configuration message will be received earlier, after receiving this configuration message, to not transmit this configuration message to next slave unit, the device number of first slave unit oneself is set to 1, sends a response message simultaneously, comprises the device number of oneself, the function of this slave unit, effect etc., main equipment is after having disposed first slave unit, to send out a next configuration message again, first slave unit will be transmitted this configuration message to the second slave unit, and this moment, device number was 0, second slave unit will do not transmitted this configuration message to next slave unit after receiving this configuration message, the device number of second slave unit oneself is set to 2, sends a response message simultaneously, comprises the device number of oneself, the function of this slave unit, effect etc.; Like this and the like, up to being configured to last slave unit; Each slave unit all has own unique equipment identity like this, and main equipment is also set up an equipment list, comprises the function of device number, each slave unit of each slave unit and effect etc.;
(3) finish after the enumerating and dispose of each slave unit at main equipment, send the parameter setting message successively for each slave unit, comprise sync signal delay parameter etc., system enters synchronous normal operating condition in real time then.
Described step (1) is in loop network during self check, main equipment sends a query message, after receiving, first slave unit is forwarded to next slave unit, device number with oneself is initialized as 0 simultaneously, each slave unit is transmitted successively and own device number is initialized as 0, slave unit to the last, last slave unit are transmitted this query message again to main equipment, and the own device number of initialization is 0; Main equipment is after receiving this query message, and the illustrative system connection is reliable and each equipment work is normal; After if main equipment waits for a period of time, this time is 2 times of maximum duration that detect maximum slave unit number under the normal condition, does not still receive this query message, and illustrative system connects unreliable or certain equipment irregular working.
Described step (2) is in loop network, main equipment begins to send configuration message by a data interface, with first continuous slave unit of main equipment, this moment, device number was 0, configuration message will be received earlier, after receiving this configuration message, to not transmit this configuration message to next slave unit, the device number of first slave unit oneself is set to 1, send a response message simultaneously, the device number that comprises oneself, the function of this slave unit, effects etc., main equipment will be sent out a next configuration message again after having disposed first slave unit, first slave unit will be transmitted this configuration message to the second slave unit, this moment, device number was that 0, the second slave unit will not transmitted this configuration message to next slave unit after receiving this configuration message, and the device number of second slave unit oneself is set to 2, send a response message simultaneously, the device number that comprises oneself, the function of this slave unit, effect etc., such and the like, up to having disposed last slave unit; Main equipment was transported to and was put message this moment, and each slave unit all has the device number of oneself, and each slave unit all will be transmitted this configuration message, and last slave unit will be transmitted this configuration message to another data line interface of main equipment; Main equipment illustrates that whole system finishes configuration after receiving this configuration message, each slave unit all has own unique equipment identity like this, and main equipment is also set up an equipment list, comprises the function of device number, each slave unit of each slave unit and effect etc.
Wherein, main equipment is the management of responsible whole system, and controls the equipment of each slave unit, and described slave unit is for being responsible for the actuating equipment of system, and the order that receives main equipment is also pressed command job.
The present invention has realized a kind of new real-time synchronous ethernet network that is used for field level communication in conjunction with FPGA (field programmable gate array) technology, and the equipment in the Ethernet is divided into main equipment and slave unit, is suitable for dcs.Provided the network topology structure that realizes full-duplex communication in the Ethernet, and provided main equipment and enumerate method with HRP-configured slave device and the method that realizes each slave unit real time communication and synchronization action automatically.
Beneficial effect of the present invention:
(1) this system master adopts the common standard network interface card, and is compatible fully with Ethernet, realized the consistency of factory's Control Network, realized a net on earth, avoided limitation incompatible between special-purpose network interface card.
(2) this system adopts serial structure (no fault tolerance) or loop configuration (fault tolerance is arranged), is easy to system constructing, expansion and maintenance.Do not use hub and switch, the challenge when having avoided system constructing and improved the speed and the efficient of system communication.
(3) main equipment of this system's proposition detects, enumerates and dispose the method for each slave unit automatically, and it is intelligent that system is had, and has reduced the loaded down with trivial details work with toggle switch manual configuration slave unit, has improved automatization level.
(4) the real-time synchronous method of the realization of this system's proposition, compare Internet NTP (Network Time Protocol) NTP (NetworkTime Protocal), simple time network agreement SNTP (Simple Network Time Protocal), IEEE1588 standard Precision Time Protocol agreement PTP methods such as (Precision Time Protocal), alleviated network burden.When realizing high-precise synchronization, avoid each slave unit website must carry precision clock chip (real-time ASIC when promptly waiting), saved cost.
Description of drawings
Fig. 1 is system's serial topology diagram of embodiment 1;
Fig. 2 is that the Ethernet of Fig. 1 connects example block diagram;
Fig. 3 is the ring topology figure of system;
Fig. 4 is that the Ethernet of Fig. 3 connects example block diagram;
Fig. 5 is for realizing the method figure of slave unit precise synchronization
Fig. 6 is the transmission format protocol figure of data,
Wherein, 1. main equipment, 2. slave unit, 3. data transmission line, 4. Data Receiving line, 5. common standard network interface card, 6. network transformer, 7.PHY chip, the 8. FPGA of band MAC IP kernel, 9. signal Synchronization line.
Embodiment
The invention will be further described below in conjunction with accompanying drawing and embodiment.
Embodiment 1:
With a main equipment and two slave units is example, and the serial topological structure of this system as shown in Figure 1.
Communication between main equipment 1 and the slave unit 2 is finished by data transmission line 3 and Data Receiving line 4 respectively, and the communication between the slave unit 2 is also finished by data transmission line 3 and Data Receiving line 4, has so just realized the full-duplex communication of each equipment room data.The function that slave unit has storage to transmit and directly transmit, when the data that main equipment 1 sends are passed through slave unit 2, slave unit 2 receives and directly is transmitted to next slave unit 2, when the data of slave unit 2 send to main equipment 1, if slave unit 2 has the data that will send to main equipment 1, then slave unit 2 is stored the data of next slave unit 2 earlier, after the data that send to main equipment 1 Deng slave unit 2 send, transmit the data of next slave unit 2 again, if slave unit 2 does not have to send to the data of main equipment 1, then slave unit 2 is directly transmitted the data of next slave unit 2.So just realized the full-duplex communication of system.This topological structure is not only applicable to Ethernet, also applicable to user-defined or other known host-host protocol forms, is the agreement difference of IP kernel among the FPGA.
The act Ethernet is an example, and detailed structure as shown in Figure 2.1 is main equipment, and 2 is slave unit, and 5 is the data-interface of main equipment, is the common standard network interface card, and 6 is network transformer, and 7 is the PHY chip, and 8 are the FPGA for band MAC IP kernel.
In the serial structure of this system, whether main equipment 1 can automatic checkout system reliably connect and operate as normal.In the end pass through a dial-up deploy switch in a slave unit 2, be indicated as last slave unit.When main equipment 1 detects slave unit automatically, main equipment 1 sends a query message, first slave unit 2 at first receives this query message, first slave unit 2 will be transmitted this query message, and to send the response message of oneself and oneself device number is initialized as 0 next slave unit 2 also be after last slave unit is received this query message, send the response message (being included as the information of last node) of oneself, and oneself device number is initialized as 0.After main equipment 1 was received the response message of last slave unit 2, illustrative system connected reliable and each equipment operate as normal.If main equipment 1 is after sending query message, wait for a period of time (this time is 2 times of maximum duration that detect maximum slave unit number under the normal condition) still can not receive the response message of last equipment 2, with reporting errors, fault has been described.
In the serial structure of this system, each slave unit 2 can be enumerated and dispose to main equipment 1 automatically.After main equipment 1 detects reliable connection of system and operate as normal, receive the response message of last slave unit 2 at main equipment 1 after, begin to send configuration message, configuration message will be received with first slave unit 2 (this moment, device number was 0) that main equipment 1 links to each other earlier, after receiving this configuration message, to not transmit this configuration message to next slave unit 2, the device number of first slave unit 2 oneself is set to 1, send a response message simultaneously, the device number that comprises oneself, the function of this slave unit, effect etc., main equipment 1 is after having disposed first slave unit 2, to send out configuration message more next, first slave unit 2 (this moment, device number was not 0) will be transmitted this configuration message to the second slave unit 2 (this moment, device number was 0), second slave unit also is that last slave unit 2 device number of oneself after receiving this configuration message is set to 2, send a response message simultaneously, comprise the device number of oneself, the function of this slave unit, effect etc.Each slave unit 2 all has own unique equipment identity like this, and main equipment 1 is also set up an equipment list, comprises the device number of each equipment, comprises the function of each equipment and effect etc.
With a main equipment and two slave units is example, and the ring topology of this system as shown in Figure 3.1 is main equipment, and 2 is slave unit.Order wire between main equipment 1 and the slave unit 2 has two single data to send line 3 and two single data receive line 4, communication between two slave units 2 is also finished by data transmission line 3 and Data Receiving line 4, and adjacent like this equipment room has just been realized the full-duplex communication of data.The function that slave unit has storage to transmit and directly transmit, when the data that main equipment sends are passed through first slave unit 2, slave unit 2 receives and directly is transmitted to next slave unit 2, when the data of slave unit 2 send to main equipment 31, if slave unit 2 has the data that will send to main equipment 1, then slave unit 2 is stored the data of next slave unit 2 earlier, after the data that send to main equipment 1 Deng slave unit 2 send, transmit the data of next slave unit 2 again, if slave unit 2 does not have to send to the data of main equipment 1, then slave unit 2 is directly transmitted the data of next slave unit 2.Main equipment 1 also can communicate by another data lines 3,4 and slave unit 2, and method is consistent by data wire 3,4 and slave unit 2 communication meanss with main equipment 1 above-mentioned.Be under the normal condition, one data lines is redundant, but this topological structure has fault tolerance, when even the data wire between two slave units 2 is connected with disconnection, slave unit 2 can communicate by data wire 3,4 and main equipment 1, and next slave unit 2 can carry out data communication by another data lines 3,4 and main equipment 1.This topological structure is not only applicable to Ethernet, also applicable to user-defined or other known host-host protocol forms, is the agreement difference of IP kernel among the FPGA.
The act Ethernet is an example, and inner detailed structure as shown in Figure 4.1 is main equipment, and 2 is slave unit, and 5 is the communication data interface of main equipment, i.e. common standard network interface card, and 6 is network transformer, and 7 is the PHY chip, and 8 are the FPGA for band MAC IP kernel.
In the loop configuration of this system, whether main equipment 1 can automatic checkout system reliably connect and operate as normal.Main equipment 1 sends a query message by data wire 3,4, after receiving, first slave unit 2 is forwarded to next slave unit 2, device number with oneself is initialized as 0 simultaneously, next slave unit also is that last slave unit 2 is transmitted this query message to main equipment 1 by data wire 3,4 again, and the own device number of initialization is 0.Main equipment 1 is after receiving this query message, and the illustrative system connection is reliable and each equipment work is normal.After (this time is 2 times of maximum duration that detect maximum slave unit number under the normal condition), still do not receive this query message if main equipment 1 waits for a period of time, illustrative system connects unreliable or certain equipment irregular working.
In the loop configuration of this system, each slave unit 2 can be enumerated and dispose to main equipment 1 automatically.After reliable connection of main equipment 1 detection system and the operate as normal, main equipment 1 is by data wire 3,4 begin to send configuration message, configuration message will be received with first slave unit 2 (this moment, device number was 0) that main equipment 1 links to each other earlier, after receiving this configuration message, to not transmit this configuration message to next slave unit 2, the device number of first slave unit 2 oneself is set to 1, send a response message simultaneously, the device number that comprises oneself, the function of this slave unit, effect etc., main equipment 1 is after having disposed first slave unit 2, to send out a next configuration message again, first slave unit 2 will be transmitted this configuration message to the second slave unit 2 (this moment, device number was 0), second slave unit 2 will do not transmitted this configuration message to next slave unit 2 after receiving this configuration message, the device number of second slave unit 2 oneself is set to 2, send a response message simultaneously, comprise the device number of oneself, the function of this slave unit, effect etc.Main equipment was transported to and was put message this moment, and each slave unit 2 all has the device number (this moment, device number was not 0) of oneself, and each slave unit 2 all will be transmitted this configuration message, and last slave unit 2 will be transmitted this configuration message to another data line interface of main equipment 1.Main equipment 1 illustrates that whole system finishes configuration after receiving this configuration message.Each slave unit 2 all has own unique equipment identity like this, and main equipment 1 is also set up an equipment list, comprises the device number of each slave unit 2, comprises the function of each equipment and effect etc.
In said in the above serial and the loop network structure, except that available Internet NTP (Network Time Protocol) NTP (Network TimeProtocal), simple time network agreement SNTP (Simple Network Time Protocal), IEEE1588 standard Precision Time Protocol agreement PTP (Precision Time Protocal) agreement come also to have proposed a kind of method that is used for each slave unit precise synchronization synchronous each slave unit.Be exactly between the slave unit except data wire, add a synchronous signal line again.With the serial topological structure is example, and as shown in Figure 5,1 is main equipment, and 2 is slave unit, and 3 is that data transmission line, 4 is the Data Receiving line, and 9 is synchronous signal line.Can choose a slave unit in slave unit 2 wantonly is source of synchronising signal, and lifting with last slave unit 2 is that source of synchronising signal is an example, and last slave unit 2 is responsible for the strict timing and the transmission of synchronizing signal, periodically sends synchronizing signal by synchronous signal line 9.Other slave unit 2 receives synchronizing signal.If do not consider to postpone on the line of transmission line, each slave unit 2 will be received synchronizing signal simultaneously, and action simultaneously realizes the synchronism of each slave unit 2 action.If postpone on the line of consideration transmission line, each slave unit 2 is received on the line of synchronizing signal and to be fixed time of delay, give in each slave unit 2 according to the transmission line length of each equipment at configuration phase a time delay parameter register is set, after receiving synchronizing signal, each one definite period of delay moves again, has so just realized the precise synchronization action of each slave unit 2.
In said serial and the loop network structure,, also can carry out data communication between each slave unit in the above except main equipment can carry out the data communication with each slave unit.Main equipment and each slave unit carry out the host-host protocol and the message format of data communication, mainly comprise main equipment configuration message, main equipment data message, slave unit data message three classes.Data communication protocol meets the ethernet frame protocol specification between main equipment and slave unit and between each slave unit, lifting ethernet ieee 802.3 Frame Protocol forms is example, as shown in Figure 6, comprise compositions such as leading character, decollator, destination address, source address, length/type field, data segment, Frame Check Sequence territory.Wherein comprise data and cycle data aperiodic in the data segment, cycle data is in the Industry Control, and task (as the execution of functional block) is sent according to certain time interval usually, and the task executions time is had data by the property requirement.Aperiodic, data were only just to occur for example upload/download of equipment disposition, failure diagnosis, program, log, warning processing etc. under specific Event triggered.
Main equipment configuration (inquiry) message: after system powers on or after the system reconfiguration, main equipment sends this message, finishes the detection of system and enumerating automatically and disposing each slave unit.
The main equipment data message is used for sending director data to slave unit, and in communication cycle, main equipment sends a main equipment cycle data message, therefrom extracts the data of oneself after slave unit receives.
The slave unit data message is used for reflecting this equipment running status to main equipment, and in communication cycle, slave unit all can send the slave unit data message No. one time to main equipment.
System finish slave unit enumerate automatically with layoutprocedure after, with the serial structure is example, as shown in Figure 5, main equipment 1 sends the cycle data message, all receive under the prerequisite of cycle data message of main equipment 1 guaranteeing each slave unit 2, source of synchronising signal is that last slave unit 2 is periodic by synchronizing signal of signal Synchronization line 9 transmissions, each slave unit 2 is after receiving this signal, after being worth the time of delay of setting, latch current working state, move simultaneously according to main equipment 1 cycle data of receiving, and be that slave unit cycle data message sends to main equipment 1 simultaneously with current working state.