Disclosure of Invention
In view of this, the present invention provides an industrial ethernet control system and a network-induced delay calculation method thereof, which can implement the calculation of network-induced delay without performing clock synchronization of the whole system, thereby reducing the complexity of industrial communication.
The invention provides a network-induced delay calculation method in an industrial Ethernet control system, which comprises the following steps:
in the kth polling period of a loop in the industrial Ethernet control system, k is greater than or equal to 2 and is a positive integer:
recording the time t when the network scheduling manager NSM in the loop sends a request message to the controller/actuator node C/AN in the loop5,j(k) And the moment t when the C/AN finishes receiving the request message sent by the NSM6,j(k);
Extracting the stored network-induced delay tau of the C/AN of the loop receiving the NSM forwarding data in the k-1 polling periodmc(k-1) and the time difference between said NSM and said C/AN △ τmc(k-1);
According to the formula: tau ismc(k)=τmc(k-1)+((t6,j(k)-t5,j(k))-△τmc(k-1)), calculating a network-induced delay τ for the C/AN to receive the NSM-forwarded datamc(k)。
Further, recording the t5,j(k) And t6,j(k) Thereafter, the method further includes △ τ according to equationmc(k)=t6,j(k)-t5,j(k) Calculating a time difference △ τ between the NSM and the C/AN in the kth polling periodmc(k);
In calculating the τmc(k) And △ τmc(k) Thereafter, the method further comprises: storing said τmc(k) And △ τmc(k)。
Further, the method further comprises:
during the k-th polling period of the loop:
recording the time t when the NSM sends a request message to the sensor node SN of the loop1,i(k);
Extracting the time t when the stored loop sends the request message to the SN by the NSM in the k-1 polling period1,i(k-1);
According to the formula: tau isbd(k)=t1,i(k)-t1,i(k-1) -T, calculating the influence delay tau of other loops on the loopbd(k) Wherein T is a polling period;
saving t1,i(k)。
Further, the method further comprises:
during the k-th polling period of the loop:
recording the time t when the SN receives the request message from the NSC2,i(k) The moment t when the SN makes a response message according to the request message sent by the NSC3,i(k) The NSM receives the moment t of the response message sent by the SN4,i(k);
According to the formula: tau issm(k)=[(t4,i(k)-t1,i(k))-(t3,i(k)-t2,i(k))]ξ, calculating the network-induced delay τ transmitted on the SN to the NSMsm(k) ξ is the ratio of the length of the response packet returned by the SN to the total packet length.
Further, the method further comprises:
during the kth polling cycle of the loop:
recording the time t when the NSM sends the request message to the C/AN5,j(k);
According to the formula: tau ismd(k)=t5,j(k)-t4,i(k) Calculating the processing time tau required by the NSM to prepare to forward the data to the C/ANmd(k)。
Further, the method further comprises:
during the k-th polling period of the loop:
calculating the time tau of the operation processing of the C/AN control algorithmcd(k) And self-delay tau of controlled objectp(k);
According to the formula: τ (k) = τsm(k)+τmd(k)+τmc(k)+τbd(k)+τcd(k)+τp(k) And calculating the total delay tau (k) of the polling period.
Further, the method further comprises:
during the 1 st polling period of the loop:
recording the time t when the NSM sends the request message to the SN1,i(1);
Recording the time t when the NSM sends the request message to the C/AN5,j(1) The C/AN finishes receiving the request from the NSMTime t of message calculation6,j(1) The moment t when the C/AN makes a response message to the NSM according to the request message from the NSM7,j(1) The time t when the NSM finishes receiving the response message sent by the C/AN8,j(1);
According to the formula: tau ismc(1)=[(t8,j(1)-t5,j(1))-(t7,j(1)-t6,j(1))]η or τmc(1) The communication rate of × communication packet size is calculated to obtain taumc(1) η, where the ratio of the request packet length to the total packet length is expressed;
according to the formula △ taumc(1)=t6,j(1)-t5,j(1) △ tau is obtained by calculationmc(1);
Saving t1,i(1)、τmc(1) And △ τmc(1)。
The invention also provides an industrial Ethernet control system, which comprises: in the k-th polling period of the circuit, k is more than or equal to 2 and is a positive integer:
the NSM is used for recording the time t when the NSM sends the request message to the C/AN5,j(k) And combining said t5,j(k) Sending the data to the C/AN;
the C/AN is used for receiving t sent by the NSM5,j(k) And request message, and recording the time t of finishing receiving the request message6,j(k);
The C/AN is further configured to: tau ismc(k)=τmc(k-1)+((t6,j(k)-t5,j(k))-△τmc(k-1)), calculating a network-induced delay τ for the C/AN to receive the NSM-forwarded data during the kth polling periodmc(k) In which τ ismc(k-1) and △ τmc(k-1) a network-induced delay for said C/AN to receive said NSM-forwarded data and a time difference between said NSM and said C/AN for a k-1 polling period.
Further, during the kth polling period of the loop:
the C/AN is also used according to the formula △ taumc(k)=t6,j(k)-t5,j(k) Calculating the time difference △ tau between the NSM and the C/AN in the kth polling periodmc(k);
And for storing said τmc(k) And △ τmc(k)。
Further, during the kth polling period of the loop:
the NSM is further configured to record a time t when the NSM sends a request message to the SN1,i(k);
For use according to the formula: tau isbd(k)=t1,i(k)-t1,i(k-1) -T, calculating the influence delay tau of other loops on the loopbd(k) Wherein t is1,i(k-1) is the time when the NSM sends a request message to the SN in the k-1 polling period;
for saving t1,i(k)。
The invention has the beneficial effects that:
aiming at the problems that the network induced delay needs to be synchronized by a whole system clock and has high requirement on the system performance in the prior art, the embodiment of the invention adopts AN asynchronous differential mode to realize the calculation of the network induced delay of the C/AN receiving NSM forwarding data, thereby realizing the calculation of the network induced delay without the clock synchronization of the whole system and effectively reducing the complexity of industrial communication.
Detailed Description
Fig. 1 is a schematic structural diagram of an industrial ethernet control system according to an embodiment of the present invention.
As shown in fig. 1, the industrial ethernet control system adopts a master-slave communication mode, which includes: a Network Scheduling Manager (NSM) 101, a plurality of Sensor Nodes (SN) 102, a plurality of Controller/Actuator nodes (C/AN) 103, a controlled object 104, and AN industrial ethernet-based Network 105 connecting the NSM101 and the SN102, C/AN103, wherein the Controller is distributed on each Actuator Node. In operation, the NSM101 is responsible for completing communication management and man-machine interaction, polling each SN102 in a time-triggered manner, forwarding data to the C/AN103 in AN event-triggered manner, completing real-time control operation at the C/AN103, and performing operation output on AN actual controlled object 104, thereby forming a fully-distributed network control system.
In fig. 1, the real-time delay of the industrial ethernet control system comprises six components, namely, the network-induced delay τ for transmitting data from SN102 to NSM101sm(k) The processing time τ required for the NSM101 to prepare the forwarding datamd(k) C/AN103 receives network-induced delay tau of NSM101 forwarding datamc(k) C/AN103 control time tau of arithmetic processingcd(k) Time delay tau of controlled object 104 itselfp(k) Influence delay tau on current loop by delay of other measurement and control loops of systembd(k) In that respect Wherein, taumd(k)、τcd(k) And τp(k) Can be directly calculated, while in the master-slave communication mode, NSM101 is the master, SN102 and C/AN103 are slaves, so τsm(k) Can be calculated at NSM101, but τmc(k) But is difficult to directly obtain at C/AN103, AN initial value can be determined in advance and then obtained by rolling calculation by adopting AN asynchronous difference method, and the influence tau of the delay of other measurement and control loops on the current loop isbd(k) Or calculated in an asynchronous difference method, and this process will be described in detail later, and will not be described herein.
Before introducing the calculation of the delay of the industrial ethernet control system, a communication process (including a time sequence) of the industrial ethernet control system is first described, specifically, as shown in fig. 2, it includes:
step S201, NSM according to time triggering mode, at t1And starting to send a request message to the SN at any moment.
Step S202, SN at t2And starting to receive the request message sent by the NSM.
Step S203, SN at t3The NSM101 starts to return a response message.
Step S204, the NSM receives the response message returned by the SN and sends the response message to the server at t4And the moment reception is finished.
Step S205, NSM according to the event triggering mode, at t5And sending a request message to the C/AN at any moment.
Step S206, the C/AN receives the request message sent by the NSM and at t6And the moment reception is finished.
Step S207, C/AN at t7And returning a response message to the NSM at the moment.
Step S208, NSM receives the response message returned from C/AN, and at t8Time of dayAnd finishing the receiving.
The following describes the network induced delay calculation method in the industrial ethernet control system according to the present invention in detail.
Specifically, in order to calculate the network-induced delay within a single period, the time when the NSM initiates communication to a certain fixed SN in a time-driven manner is regarded as a fixed and unchangeable periodic variation time. The delay in a single period of the system comprises six parts:
τ(k)=τsm(k)+τmd(k)+τmc(k)+τbd(k)+τcd(k)+τp(k) (1)
wherein in the formula, the network-induced delay is mainly represented by tausm(k) And τmc(k) In the above, other delay times can be directly calculated. Thus, to determine the network-induced delay τ for SN uploading data to NSMsm(k) The system adopts the time sequence as shown in fig. 2, firstly, the NSM sends a request message for uploading the collected data to the ith SN according to the time triggering mode, and records the time t at the moment1,i(k) (ii) a Secondly, the SN collects the sensing data and the time t when the SN receives the request message2,i(k) And the moment t of sending a response message3,i(k) Encapsulating the response message and returning the response message to the NSM; then, after receiving the SN response message, the NSM records the time t at the moment4,i(k) In that respect Then the network-induced delay τ between SN and NSMsm(k) Comprises the following steps:
τsm(k)=[(t4,i(k)-t1,i(k))-(t3,i(k)-t2,i(k))]·ξ (2)
the value ξ represents the ratio of the length of the response packet to the length of the total packet, and the periodic data in the industrial network communication usually shows the characteristics of short frames, small packets and frequent data transmission, so if the request packet and the response packet are regarded as the same minimum communication packet, the value ξ in the formula (2) can be set asIf the SN has a large amount of data to upload, which results in the length of the response packet being greater than that of the request packet issued by the NSM, the NSM can directly calculate ξ value according to the length of the response packet and the length of the request packet.
In the process of calculating the network-induced delay for forwarding data from the NSM to the C/AN, the NSM sends a data-sending request message to the jth C/AN according to the time sequence shown in fig. 2, and records the time t at the beginning of the data-sending request message5,i(k) And adds the time to the request message for transmission; after the C/AN receives the request message correctly, the C/AN finishes receiving the request message at the moment t6,i(k) And (7) recording. Since the C/AN has now received all the data, the control operation can begin. Then the network-induced delay τ between NSM and C/ANmc(k) Comprises the following steps:
wherein, taumc(k-1) network-induced delay between NSM and C/AN of last cycle, △ τmcRepresenting the incremental change between the network-induced delay of the present cycle and the network-induced delay of the previous cycle. The method embodies the characteristic of induced delay of a differential computing network in an asynchronous communication environment, the whole system does not carry out clock synchronization, and t on NSM5,j(k) And t on C/AN6,j(k) Instead of being based on the same reference clock, the difference between the two periods is calculated, and τ between the two periods can be directly describedmcThe variation of (2).
In the recursive calculation using equation (3), an initial value problem needs to be involved. The initial τ may be set when the system first polls for communications, i.e., when the value of k is 1mc(k-1)、t5,j(k-1)、t6,j(k-1) are all 0, but since the system uses asynchronous communication, t on NSM5,j(0) And t on C/AN6,j(1) Not based on the same reference clock, and therefore,tau cannot be directly calculated by adopting the formula (3)mc(1) Calculation of initial τ is only performed with reference to the method of equation (2)mc(1). According to the time sequence shown in fig. 2, the NSM sends a request message for data transmission to the jth C/AN according to AN event trigger mode, and records the time t at the beginning of the request message5,j(1) And adds the time to the request message for transmission; after the C/AN receives the request message correctly, the C/AN finishes receiving the request message at the moment t6,j(1) Recording; then, C/AN receives the request message at time t6,j(1) And the moment t of sending a response message7,j(1) Encapsulating the response message and returning the response message to the NSM; after receiving the C/AN response message, the NSM records the time t8,j(1). Then the network-induced delay τ between the C/AN and the NSM determined by the first communicationmc(1) Comprises the following steps:
τmc(1)=[(t8,j(1)-t5,j(1))-(t7,j(1)-t6,j(1))]·η (4)
wherein the value of η represents the ratio of the request packet length to the total packet length, and is taken as the value directly at the time of first communicationAfter the initial value is obtained by formula (4), NSM issues it to C/AN for storage in the current period, and in the subsequent communication process, tau obtained by current calculation is continuously sentmc(k) The value is updated to the value as τ at the time of the next cycle calculation using equation (3)mc(k-1)。
Upper pair of tausm(k) And τmc(k) The calculation method of (a) is explained, and it should be noted that: the tau is calculated by adopting an asynchronous difference modemc(k) On one hand, the calculation precision is high, on the other hand, the whole system clock synchronization is not needed, and the complexity of industrial communication can be effectively reduced, which is the key point of the embodiment of the invention. The following describes the method for calculating the network-induced delay in the industrial ethernet network control system according to the embodiment of the present invention in more detail.
Fig. 3 is a schematic flow chart illustrating a method for calculating network-induced delay in an industrial ethernet control system according to an embodiment of the present invention. It includes:
step S301, in the first polling period of the control loop, determining the initial value tau of the network induced delay between the NSM and the C/AN node in the loopmc(1) Initial value of time difference between NSM and C/AN △ taumc(1) And the initial value t of the initial time when the NSM initiates the request message to the SN1,i(1) And storing.
Step S302, in the second polling period of the control loop, the loop network induced delay tau in the current polling period is calculated by adopting a differential method, and the network induced delay tau between NSM and C/AN in the polling period is usedmc(2) Time difference △ tau between NSM and C/ANmc(2) And NSM initiates a request message t to SN1,i(2) The corresponding initial value is updated.
Step S303, in any follow-up polling period, utilizing the initial value tau of network induced delay between NSM and C/AN obtained in the previous polling periodmcInitial values of time differences between (k-1), NSM and C/AN △ taumc(k-1) and the starting time t when the NSM initiates the request message to the SN1,i(k-1), the network induced delay tau of the control loop in the polling period is calculated in a rolling mode and updated to be the initial value tau of the network induced delay between the NSM and the C/AN in the next polling periodmc(k) Initial time difference between NSM and C/AN at △ taumc(k) And initial value t of initial time when NSM initiates request message to SN1,i(k)。
These three steps will be described separately below.
As shown in fig. 4, is a schematic flowchart of an embodiment of step S301, which includes:
step S401, during the first polling cycle, the NSM issues a detection message to the ith SN according to a time triggering mode, and records the time t of the initial moment1,i(1)。
Step (ii) ofS402, NSM sends request message of data transmission to jth C/AN according to event trigger mode after receiving response message of ith SN, records time t of initial moment of sending request message5,j(1)。
Step S403, after the C/AN receives the request message correctly, the C/AN finishes receiving the time t of the request message6,j(1) And (7) recording.
Step S404, C/AN compares t6,j(1) And the moment t of sending a response message7,j(1) Encapsulated in a reply message and returned to the NSM.
Step S405, after the NSM receives the C/AN response message, recording the time t at the moment8,j(1) And using the formula: tau ismc(1)=[(t8,j(1)-t5,j(1))-(t7,j(1)-t6,j(1))]η or τmc(1) The communication rate of × communication packet size is calculated to obtain taumc(1) Using formula △ taumc(1)=t6,j(1)-t5,j(1) △ tau is obtained by calculationmc(1) And will t1,i(1)、τmc(1) And △ τmc(1) Saved for the next cycle of rolling calculations.
Here, if the network is not forwarding via a route, τ may be employedmc(1) = communication packet size × communication rate calculation τmc(1) Otherwise, adopt τmc(1)=[(t8,j(1)-t5,j(1))-(t7,j(1)-t6,j(1))]η calculation of τmc(1) And η is
It should be noted that the industrial ethernet network includes: the industrial Ethernet system comprises a bus type industrial Ethernet and a full-switching type industrial Ethernet, wherein the bus type industrial Ethernet has no route forwarding, and the full-switching type industrial Ethernet has route forwarding.
As shown in fig. 5, is a schematic flowchart of an embodiment of step S302, which includes:
step S501, in the 2 nd polling cycle, the NSM initiates communication to the ith SN according to a time triggering mode, sends a request of uploading collected data, and records the starting time t1,i(2)。
Step S502, SN collected sensing data, time t when receiving request message2,i(2) And the moment t of sending a response message3,i(2) Encapsulated in a reply message in a form of table one, and returned to the NSM.
Watch 1
Message header |
Sensing data |
|
|
Step S503, after receiving the SN response message, the NSM records the time t4,i(2)。
Step S504, NSM adopts the formula: tau issm(2)=[(t4,i(2)-t1,i(2))-(t3,i(2)-t2,i(2))]ξ, or τsm(2) The speed of the communication message packet is × according to the size of the communication message packet, and tau is obtained by calculationsm(2) The formula is adopted: tau isbd(2)=t1,i(2)-t1,i(1) T is calculated to obtain taubd(2) Where T is the polling period.
Here, if the network is not forwarding via a route, τ may be employedsm(2) = communication packet size × communication rate calculation τsm(2) Otherwise, onlyCan adopt tausm(2)=[(t4,i(2)-t1,i(2))-(t3,i(2)-t2,i(2))]ξ calculation of τsm(2) And ξ is
Step S505, NSM sends the request message of data transmission to jth C/AN according to the event triggering mode, records the time t at this moment5,j(2) And is represented by the formula: tau ismd(2)=t5,j(2)-t4,i(2) Calculating the processing time tau required by NSM to prepare forwarding datamd(2) Finally △ taumc(1)、τmc(1)、τsm(2)、τbd(2)、τmc(2) And t5,j(2) And issuing according to the table two format.
Watch two
Step S506, after the C/AN receives the request message correctly, the C/AN finishes receiving the time t of the request message6,j(2) Recorded, and expressed by the formula:is calculated to obtain taumc(2) Represented by the formula △ taumc(2)=t6,j(2)-t5,j(2) Calculated to obtain △ taumc(2) And will taumc(2) And △ τmc(2) Saved for the next cycle of rolling calculations.
Step S507, calculating a value of τ (2) = τsm(2)+τmd(2)+τmc(2)+τbd(2)+τcd(2)+τp(2) And calculating the total delay tau of the second polling period system.
As shown in fig. 6, it is a schematic flowchart of the embodiment of step S303, and it should be noted that, when the 2 nd polling cycle is ended, it may be determined whether the system continues to operate first, and if the system continues to operate, the following manner is referred to, and in practice, such determination should be made each time the polling cycle is ended. Specifically, step S303 includes:
step S601, when the kth polling cycle is carried out, the SM initiates communication to the ith SN according to a time triggering mode, sends a request of uploading collected data, and records the initial time t1,i(k)。
Step S602, SN collecting sensing data, time t when receiving request message2,i(k) And the moment t of sending a response message3,i(k) And encapsulating the response message according to the table three and returning the response message to the NSM.
Watch III
Message header |
Sensing data |
|
|
Step S603, after receiving the SN response message, the NSM records the time t at the moment4,i(k)。
Step S604, NSM adopts formula tausm(k)=[(t4,i(k)-t1,i(k))-(t3,i(k)-t2,i(k))]ξ or, of the formula τsm(k) Computing the rate of communication packet which is not less than × the size of communication packet to obtain tausm(k) The formula is adopted: tau isbd(k)=t1,i(k)-t1,i(k-1) -T, and calculating to obtain taubd(k)。
Here, if the network is not forwarding via a route, τ may be employedsm(k) = communication packet size × communication rate calculation τsm(k) Otherwise, only τ can be usedsm(k)=[(t4,i(k)-t1,i(k))-(t3,i(k)-t2,i(k))]ξ calculation of τsm(k) And ξ is
Step S605, NSM sends the request message of data transmission to jth C/AN according to the event triggering mode, records the time t at this moment5,j(k) The formula is as follows: tau ismd(k)=t5,j(k)-t4,i(k) Is calculated to obtain taumd(k) Finally, will tausm(k)、τbd(k)、t5,j(k)、τmd(k) And the message is added into the request message for transmission, as shown in the table four.
Watch four
Message header |
Sensing data |
|
|
|
|
This is different from the second polling cycle because△ tau calculated from the second polling periodmc(k) And τmc(k) Wherein k =2,3, 4.. is already stored in the jth C/AN, so there is no need to issue △ τ any moremc(k) And τmc(k) The value of (2) is given in C/AN.
Step S606, C/AN receives the request message correctly, then finishes the time t of the request message6,j(k) Record, then the formula:is calculated to obtain taumc(k) Represented by the formula △ taumc(k)=t6,j(k)-t5,j(k) △ tau is obtained by calculationmc(k) And will t1,i(k)、τmc(k) And △ τmc(k) Saved for the next cycle of rolling calculations.
Step S607, where τ (k) = τsm(k)+τmd(k)+τmc(k)+τbd(k)+τcd(k)+τp(k) And calculating to obtain the total system delay tau.
Here, on the basis of obtaining the system delay by adopting the asynchronous difference method, the parameters of the controller can be continuously and dynamically adjusted, and the system performance under the environment with the network-induced delay can be obviously improved.
Finally, the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all of them should be covered in the claims of the present invention.