This application is a National Stage of International Application No. PCT/JP2010/065986 filed Sep. 15, 2010, the contents of which are incorporated herein by reference in their entirety.
The present invention relates to a communication apparatus and a delay detecting method.
When communication is performed on a network, in particular, a network used in an FA (Factory Automation) system and required to have real-time properties, it is desired that a communication delay is within a predetermined time and, at the same time, there is no loss of information.
In general, for measurement of a delay, there are a method of measuring a delay time in a round trip between two nodes to be measured and a method of measuring a delay time in one way between the nodes. In the measurement of a delay time in one way, a delay can be determined at a point when a reception side receives a communication frame. Therefore, compared with the method of measuring the round-trip delay time, there is an advantage that a time required for the measurement of a delay can be reduced. On the other hand, to perform the measurement of a delay time in one way, clocks need to be synchronized between the nodes or an offset time of clocks needs to be calculated between the nodes.
The measurement of a delay time in one way is performed in Patent Literature 1 as explained below. First, an offset time of clocks is calculated. Subsequently, a node on a transmission side gives a time stamp of a transmission time to a packet to be transmitted and transmits the packet. Thereafter, a node on a reception side records a time stamp of a reception time of the packet. The node on the reception side calculates a delay using the offset time of the clocks between the nodes, the time stamp of the transmission time, and the time stamp of the reception time.
The calculation of an offset time of clocks is performed as explained below. It is assumed that the nodes have a time calculating function. First, a first node transmits, to a second node, a packet for shift time calculation to which a time stamp of a transmission time acquired from a clock of the first node is given. Subsequently, the second node adds, to the received packet, a packet reception time from the first node and a transmission time in returning a packet to the first node and returns the packet to the first node. The first node records a reception time of the returned packet and calculates a shift time based on these four times.
On the other hand, the clock synchronization between the two nodes is performed in Patent Literature 2 as explained below. First, a first node creates a measurement packet in which a transmission time is put in a first payload and transmits the measurement packet to a second node. Subsequently, when the second node receives the measurement packet from the first node, the second node creates a return packet in which a transmission time of the measurement packet is put in a first payload, a reception time of the measurement packet is put in a second payload, and a transmission time of the return packet is put in a third payload and transmits the return packet to the first node. The first node that receives the return packet records a reception time of the return packet and performs correction of a clock based on these four times.
Concerning a loss of information (a packet), for example, in Patent Literature 1, a packet loss ratio calculating function is provided in a node, a sequence number is given to a transmission packet, and the number of losses of packets is counted according to missing of the sequence number.
However, in the method of calculating an offset time described in Patent Literature 1, the packet for offset time calculation is transmitted and received in parallel to a packet used for normal communication. When such a method is applied to a node that performs a periodical operation such as an incorporated system, it is necessary to irregularly (at different periods) perform transmission and reception processing of the packet for offset time calculation. Therefore, there is a problem in that it is difficult to maintain the periodical operation.
In the clock synchronization method described in Patent Literature 2, because it is necessary to put three kinds of time information in the payload of the return packet, a data size of the time information is made large. Therefore, in a situation in which a payload size is limited, there is a problem in that a region for carrying normal data is spoiled.
Further, in the detection of a delay, all times used for the delay detection are stored in a packet. Therefore, there is also a problem in that time information stored in the packet is made large. A loss of packets is detected according to missing of the sequence number. However, for example, when one packet is transmitted, there is also a problem in that it is difficult to detect a loss.
The present invention has been devised in view of the above and it is an object of the present invention to obtain, in a communication system in which nodes that perform a periodical operation are connected by a network, a communication apparatus and a delay detecting method that can maintain the periodical operation and transmit information for calculating a shift of clocks between the nodes without putting pressure on a region for storing normal data.
In order to solve the aforementioned problems, a communication apparatus that performs periodical communication with another communication apparatus connected via a transmission line according to one aspect of the present invention is constructed in such a manner as to include: a clock configured to measure time; a communicating unit configured to transmit and receive a communication frame; a time-stamp generating unit configured to generate a time stamp using the clock during transmission or during reception of the communication frame transmitted and received by the own communication apparatus; a transmission-data storing unit configured to store periodical transmission data stored in the periodically-transmitted communication frame; a reception-data storing unit configured to store the periodical transmission data in the periodically-received communication frame; a frame processing unit configured to generate a refresh instruction frame including a data refresh instruction to the other communication apparatus, the periodical transmission data in the transmission-data storing unit, and a frame transmission time, which is a time stamp of transmission timing, acquired from the time-stamp generating unit and store, upon receiving a refresh instruction frame from the other communication apparatus, periodical transmission data included in the refresh instruction frame in the reception-data storing unit; and a one-way-delay detecting unit configured to determine, upon receiving the refresh instruction frame, whether a next refresh instruction frame is received within a first delay allowable time after the refresh instruction frame is received last time and determine, when the next refresh instruction frame is received within the first delay allowable time, according to whether a transmission time of the refresh instruction frame from the other communication apparatus to the own apparatus is within a second delay allowable time, whether a delay has occurred in a communication frame transmitted from the other communication apparatus.
According to the present invention, a time stamp used for detection of a delay is stored in a communication frame exchanged between two nodes during periodical communication in addition to data to be transmitted. A delay of the communication frame in a network is detected from the time stamp stored in the communication frame to be periodically communicated and a reception time of the communication frame. Consequently, it is unnecessary to transmit a new communication frame to detect a delay besides the communication frame exchanged during the periodical communication. Time information included in the communication frame has to be only a transmission time of the communication frame. The size of the communication frame does not change. Therefore, when the present invention is applied to an apparatus that operates at a predetermined processing period such as a programmable controller that performs sequence control, there is an effect that it is possible to perform delay detection for a communication frame without affecting regular data processing.
Preferred embodiments of a communication apparatus and a delay detecting method according to the present invention are explained in detail below with reference to the accompanying drawings. The present invention is not limited by the embodiments.
In the first embodiment, communication is performed between a pair of the nodes 1 and 2 including the master-delay/loss detecting unit 14 and the slave-delay/loss detecting unit determined in advance. Specifically, the node 1 has a function of instructing, when periodical communication is performed, the node 2 to be paired with the node 1 to measure and calculate a clock offset at a predetermined period. The node 2 has a function of performing measurement for calculating a clock offset and calculation of the clock offset according to the instruction from the node 1 to be paired with the node 2. The master-delay/loss detecting unit 14 of the node 1 and the slave-delay/loss detecting unit 24 of the node 2 also have a function of detecting a delay and a loss of a communication frame during periodical communication using a communication frame used in the periodical communication.
In the following explanation, the node 1 that instructs calculation of a clock offset is referred to as master station and the node 2 that performs calculation processing for a clock offset based on an instruction from the master station 1 is referred to as slave station.
In the example shown in
The configuration of a protocol data unit (hereinafter referred to as PDU) stored in a data section of a communication frame exchanged in the communication system is explained.
The header section 31 has header information of the PDU 30 and includes CTRL 311, CID 312, TS 313, and OBL 314. The CTRL 311 includes type information representing a type of the PDU 30, request/response information including a bit representing request/response, and PDU association information including a bit representing association of the PDU used for offset calculation.
As types of the PDU 30, in the first embodiment, four types are used, i.e., RefreshReady for performing notification of preparation completion of refresh processing and offset measurement, RefreshMO for performing notification of the refresh processing and the offset measurement, RefreshGO for performing notification of the refresh processing and offset generation, and Refresh for performing notification of the refresh processing.
The request/response information is a bit for representing whether the PDU 30 represented by the type information is a request or a response to the request. The request and the response are determined to be in a bit-inverted relation.
The PDU association information is inverted from an initial state every time offset calculation is performed. The PDU association information is used for specifying a set of PDUs 30 used for offset calculation. Specifically, concerning the PDUs 30 of RefreshMO or RefreshReady (measurement instruction) and RefreshGO (calculation instruction) exchanged during one offset calculation processing, the PDU association information has the same bit (value). The PDUs 30 of RefreshMO and RefreshGO exchanged during next offset calculation processing are the PDUs 30 in which the previous PDU association information is inverted. For example, concerning a series of processing of a RefreshReady request issued from the master station 1, a RefreshReady response issued from the slave station 2, a RefreshGO request issued from the master station 1, and a RefreshGO response issued from the slave station 2, the PDU association information is the same bit (value), for example “0”. Concerning a series of processing of a RefreshMO request issued from the master station 1 next, a RefreshMO response issued from the slave station 2, a RefreshGO request issued from the master station 1, and a RefreshGO response issued from the salve station 2, the PDU association information is the same bit, i.e., “1”, different from the PDU association information of the last time. Further, concerning a series of processing of a RefreshMO request issued from the master station 1 next, a RefreshMO response issued from the slave station 2, a RefreshGO request issued from the master station 1, and a RefreshGO response issued from the slave station 2, the PDU association information is the same bit, i.e., “0”, different from the PDU association information of the last time. The PDU association information is set in this way.
The CID 312 is identification information for linking the master-delay/loss detecting unit 14 of the master station 1 and the slave-delay/loss detecting unit 24 of the slave stations 2, which are the pair that performs communication. The identification information stored in the CID 312 is different for each pair of the master-delay/loss detecting unit 14 and the slave-delay/loss detecting unit 24, which perform communication, and is generated to be unique in the network. As an example of a generation rule for the identification information stored in the CID 312, a method of connecting an address of the master station 1 and an address of the slave station 2 can be illustrated. However, when a second master-delay/loss detecting unit is provided in the master station 1, a second slave-delay/loss detecting unit is provided in the slave station 2, and second communication is performed between the master station 1 and the slave station 2 using the second master-delay/loss detecting unit and the second slave-delay/loss detecting unit as a second pair, redundancy occurs under the generation rule for the identification information. Therefore, as a generation rule for identification information used when the second pair performs communication, a method of inverting connection order in the identification information generation rule and connecting the address of the slave station 2 and the address of the master station 1 can be illustrated.
The TS 313 is a region in which a time stamp concerning transmission timing of the PDU 30 is stored. Specifically, during periodical communication, the master-delay/loss detecting unit 14 or the slave-delay/loss detecting unit 24 stores a time stamp of timing for transmitting the PDU 30 in the TS 313. In communication other than the periodical communication, a time stamp of timing when the PDU 30 representing a request is transmitted by the master-delay/loss detecting unit 14 is stored in the TS 313. When the PDU 30 representing a response to the request from the master-delay/loss detecting unit 14 is transmitted by the slave-delay/loss detecting unit 24, a value stored in the TS 313 of the PDU 30 representing a request corresponding to the response (i.e., a time stamp indicating transmission timing for the request corresponding to the response) is stored in the TS 313. Main types of the PDU 30 transmitted in the periodical communication are RefreshMO, RefreshGO, and Refresh.
The OBL 314 is a region in which information used in calculating an offset of a clock is stored. Specifically, when the type information of the CTRL 311 is RefreshGO and the request/response information is a request, i.e., when the PDU 30 is a RefreshGO request, a value of a time stamp indicating reception timing for a RefreshReady response or a RefreshMO response, which is a base for generating the RefreshGO request, is stored in the OBL 314.
The data section 32 is a data storage region for data and the like to be periodically communicated. The trailer section 33 is a storage region for a check code used in detecting breakage of the PDU 30. As the check code, a CRC (Cyclic Redundancy Check) cyclic redundancy code and the like can be used.
As explained above, the TS 313 stores a transmission time of the PDU 30 used for detection of a delay and a loss of the PDU 30 transmitted from the master station 1 to the slave station 2 or from the slave station 2 to the master station 1. However, in the first embodiment, in addition to the TS 313, the OBL 314 that stores a reception time of the PDU 30 in the master station 1 necessary for calculation of a clock offset is provided, whereby a configuration in which a clock offset based on the maser station 1 can be calculated on the slave station 2 side is obtained. Processing for detecting a delay and a loss and processing for calculating a clock offset using these kinds of information are explained below.
As shown in
The clock 11 generates time information used by the master station 1. The transmission-data storing unit 12 stores, for example, periodical transmission data to be transmitted to another node in, the periodical communication. The reception-data storing unit 13 stores, for example, data stored in a data section of a PDU received in the periodical communication (periodical reception data). The periodical transmission data stored in the transmission-data storing unit 12 is used for calculation of a value set in a not-shown input and output apparatus or the like connected to another node (the slave station 2) performed by a not-shown processing apparatus connected to the own apparatus. The periodical reception data stored in the reception-data storing unit 13 is an output value or the like from the input and output apparatus connected to the other node and is used for calculation in the processing apparatus.
The master-delay/loss detecting unit 14 has a function of generating a PDU exchanged with a partner node (the slave station 2) and detecting a delay and a loss of the PDU using the PDU periodically communicated with the partner node. The master-delay/loss detecting unit 14 has a function of storing information necessary for calculation of a clock offset of the slave station 2 in the PDU and transmitting the PDU and instructing the slave station 2 to measure and calculate the clock offset.
The frame transmitting unit 15 stores the PDU generated by the master-delay/loss detecting unit 14 in a data section of a communication frame such as an Ethernet (registered trademark) frame and transmits the PDU to the network. The frame receiving unit 16 receives the communication frame addressed to the own node referring to a header of the communication frame such as an Ethernet (registered trademark) frame flowing on the network and extracts the PDU stored in the data section.
A more detailed configuration of the master-delay/loss detecting unit 14 is explained. The master-delay/loss detecting unit 14 includes a connection-establishment requesting unit 141, a time-stamp generating unit 142, a frame processing unit 143, a time-stamp storing unit 144, a one-way-delay detecting unit 145, a round-trip-delay detecting unit 146, and a loss detecting unit 147.
The connection-establishment requesting unit 141 performs connection establishment processing between the connection-establishment requesting unit 141 and the node to be paired (the slave station 2).
The time-stamp generating unit 142 generates a time stamp, which is a time of transmission, based on the clock 11 of a PDU transmitted (generated) by the frame processing unit 143 and passes the time stamp to the frame processing unit 143. The time-stamp generating unit 142 also generates a time stamp at a point when a PDU is received from another node.
The frame processing unit 143 has a function of generating a PDU to be transmitted to the slave station 2 according to a processing situation. For example, when the connection establishment processing is completed, the frame, processing unit 143 generates a RefreshReady request. When a RefreshReady response or a RefreshMO response is received and periodical transmission data is present in the transmission-data storing unit 12, the frame processing unit 143 generates a RefreshGO request. Further, when a RefreshGO response is received and periodical transmission data is present in the transmission-data storing unit 12, the frame processing unit 143 generates a RefreshMO request. In other cases during the periodical communication, the frame processing unit 143 generates a Refresh request.
In these cases, the frame processing unit 143 stores predetermined information in the storage regions, for example, stores, in the data section 32, periodical transmission data stored in the transmission-data storing unit 12 and stores, in TSs of PDUs, a time stamp passed from the time-stamp generating unit 142. When generating a RefreshGO request, the frame processing unit 143 stores, in the OBL, a time stamp at the reception time of a RefreshReady response or a RefreshMO response based on which the RefreshGO request is generated.
Further, the frame processing unit 143 also has a function of acquiring data stored in a data section of a received PDU and stores the data in the reception-data storing unit 13 or reads out a time stamp from a TS and stores the time stamp in the time-stamp storing unit 144 as a PDU transmission time to extract information necessary for the processing units.
The time-stamp storing unit 144 stores a value stored in a TS of a received PDU and a time stamp generated by the time-stamp generating unit when a predetermined PDU is received. For delay detection and clock offset calculation, the time-stamp storing unit 144 stores, as a PDU transmission time T_snd, a value stored in a TS of a received Refresh request, RefreshMO response, or RefreshGO response and stores, as a PDU reception time T_rcv, a time stamp generated by the time-stamp generating unit 142 at the reception time of the Refresh request, the RefreshMO response, or the RefreshGO response. For loss detection, the time-stamp storing unit 144 stores, as a last PDU transmission time T_psnd, a value stored in a TS of a RefreshReady response, a Refresh request, a RefreshMO response, or a RefreshGO response and stores, as a present PDU transmission time T_nsnd, a value stored in a TS of a Refresh request, a RefreshMO response, or a RefreshGO response received immediately after the PDU.
The one-way-delay detecting unit 145 detects occurrence of a delay of a PDU using the PDU received from the slave station 2. The one-way-delay detecting unit 145 performs delay determination according to whether the PDU is periodically received and time required for the PDU to reach the own node from the partner node. Specifically, the one-way-delay detecting unit 145 starts a timer simultaneously with the start of the periodical communication or at the reception time of the last PDU and determines that a delay exceeds an allowable delay when a Refresh request, a RefreshMO response, or a RefreshGO response is not received within a predetermined time (a first delay allowable time r_interval). Even when a Refresh request, a RefreshMO response, or a RefreshGO response is received within the predetermined time, the one-way-delay detecting unit 145 determines the exceeding of the allowable delay according to Formula (1) below using the PDU transmission time T_snd and the PDU reception time T_rcv in the time-stamp storing unit 144. A second delay allowable time is represented as d_allowed. When Formula (1) is satisfied, the one-way-delay detecting unit 145 determines that a delay has not occurred. When Formula (1) is not satisfied, the one-way-delay detecting unit 145 determines that a delay has occurred. The first delay allowable time r_interval and the second delay allowable time d_allowed can be set to the same value or can be set to different values.
T—rcv−T—snd<d_allowed (1)
The round-trip-delay detecting unit 146 detects whether a round-trip delay is within an allowable delay in a request response sequence between the master station 1 and the slave station 2. Specifically, the round-trip-delay detecting unit 146 starts a timer upon transmitting a request PDU in the request response sequence. The round-trip-delay detecting unit 146 determines that a delay exceeds an allowable delay when a response PDU to the request is not received within a predetermined time (a round-trip delay allowable time rtt_allowed). The request response sequence refers to processing in which, when a PDU indicating a request is transmitted to the slave station 2, a PDU indicating a response to the request is returned from the slave station 2. For example, a request response sequence before offset calculation, RefreshReady request and response, RefreshMO request and response, and RefreshGO request and response used in the offset calculation, and a request response sequence in communication other than the periodical communication can be illustrated. It is assumed that the round-trip delay detection processing by the round-trip-delay detecting unit 146 is performed when the periodical communication is not performed.
The round-trip-delay detecting unit 146 confirms that the received response PDU is a response PDU corresponding to the transmitted request PDU. Specifically, when the request PDU transmitted by the own node is a request PDU transmitted before offset calculation, a RefreshReady request, and a request PDU in communication other than the periodical communication, the round-trip-delay detecting unit 146 checks whether a TS of the transmitted request PDU and a TS of the received response PDU coincide with each other. When the request PDU transmitted by the own node is a RefreshMO request and the RefreshGO request, the round-trip-delay detecting unit 146 compares PDU association information in a CTRL of the transmitted request PDU and PDU association information in a CTRL of the response PDU received from the partner node and determines whether the pieces of the PDU association information coincide with each other. When the pieces of the PDU association information coincide with each other, the round-trip-delay detecting unit 146 confirms that the received request PDU is a response PDU corresponding to the transmitted request PDU.
The loss detecting unit 147 detects a loss of a PDU on the network. Specifically, the loss detecting unit 147 determines a loss of a PDU according to Formula (2) below using the last PDU transmission time T_psnd and the present PDU transmission time T_nsnd in the time-stamp storing unit. A loss evaluation time meaning an allowable reception interval is represented as trns_interval. When Formula (2) is satisfied, the loss detecting unit 147 determines that a loss has not occurred. When Formula (2) is not satisfied, the loss detecting unit 147 determines that a loss has occurred.
T—psnd−T—nsnd<trns_interval (2)
Upon determining that a loss has not occurred in the determination by Formula (2), the loss detecting unit 147 sets the value T_nsnd of the present PDU transmission time in the time-stamp storing unit 144 as a new last PDU transmission time T_psnd and performs processing for deleting the value of the present PDU transmission time. Consequently, it is possible to apply loss detection processing to a periodically-received Refresh request, RefreshMO response, or RefreshGO response.
As shown in
The slave-delay/loss detecting unit 24 has a function of generating a PDU to be exchanged between the slave station 2 and the master station 1 and detecting a delay and a loss of the PDU using the PDU to be periodically communicated. The slave-delay/loss detecting unit 24 also has a function of acquiring, from the PDU, information necessary for calculation of a clock offset from the partner node and calculating the clock offset. The slave-delay/loss detecting unit 24 having such functions includes a connection-establishment responding unit 241, a clock-offset storing unit 242, a time-stamp generating unit 243, a frame processing unit 244, a time-stamp storing unit 245, a clock-offset calculating unit 246, a one-way-delay detecting unit 247, and a loss detecting unit 248.
The connection-establishment responding unit 241 performs connection establishment processing between the slave station 2 and the master station 1 to be paired. The clock-offset storing unit 242 stores a clock offset, which is a value of a shift of the clock 21 of the slave station 2 based on the clock 11 of the master station 1.
The time-stamp generating unit 243 generates, concerning a PDU transmitted (generated) by the frame processing unit 244, a time stamp, which is a transmission time, based on the clock 11 of the master station 1 and passes the time stamp to the frame processing unit 244. The time-stamp generating unit 243 also generates a time stamp at a point when a PDU is received from another node. The time-stamp generating unit 243 generates a time stamp based on a sum of a time (a value) obtained from the clock 21 and the clock offset in the clock-offset storing unit 242.
The frame processing unit 244 has a function of generating, according to a processing situation, a PDU to be transmitted to the master station 1 to be paired. For example, when a RefreshReady request, a RefreshMO request, and a RefreshGO request are received and periodical transmission data is stored in the transmission-data storing unit 22, the frame processing unit 244 generates a RefreshReady response, a RefreshMO response, and a RefreshGO response. When the PDU is not received in the periodical communication and a predetermined time elapses from the last reception of the PDU, the frame processing unit 244 generates a Refresh request.
In these cases, the frame processing unit 244 stores predetermined information in the storage regions, for example, stores, in a data section of the PDU, the periodical transmission data stored in the transmission-data storing unit 22, stores, in a TS, the time stamp passed from the time-stamp generating unit 243 during the periodical communication, and stores, in a TS of a response PDU to the received PDU, a value stored in the TS of the received PDU in communication other than the periodical communication.
The frame processing unit 244 also has a function of acquiring data stored in a data section of the received PDU and storing the data in the reception-data storing unit 23 and reading out the time stamp from the TS and storing the time stamp in the time-stamp storing unit 245 as a PDU transmission time to extract information necessary for the processing units from the received PDU.
The time-stamp storing unit 245 stores a value stored in the TS of the received PDU and a time stamp generated by the time-stamp generating unit 243 when a PDU of a predetermined type is received. For delay detection, the time-stamp storing unit 245 stores, as the PDU transmission time T_snd, a value stored in a TS of a received Refresh request, RefreshMO request, or RefreshGO request and stores, as the PDU reception time T_rcv, a time stamp at the reception time of the Refresh request, the RefreshMO request, or the RefreshGO request. For loss detection, the time-stamp storing unit 245 stores, as the last PDU transmission time T_psnd, a value stored in a TS of a RefreshReady request, a Refresh request, a RefreshMO request, or a RefreshGO request and stores, as the present PDU transmission time T_nsnd, a value stored in a TS of a Refresh request, a RefreshMO request, or a RefreshGO request received immediately after the PDU.
Further, for clock offset calculation, the time-stamp storing unit 245 stores, as a PDU master transmission time for measurement Tm_snd, a value stored in a TS in a PDU including an offset measurement instruction received from the master station 1 and stores, as a PDU slave reception time for measurement Ts_rcv, a time stamp acquired from the time-stamp generating unit 243 when the PDU including the offset measurement instruction is received. The time-stamp storing unit 245 stores, as a PDU slave transmission time for measurement Ts_snd, a time stamp acquired from the time-stamp generating unit 243 when a response PDU corresponding to the PDU including the offset measurement instruction is transmitted. Further, the time-stamp storing unit 245 stores, as a PDU master reception time for measurement Tm_rcv, a value in an OBL of a PDU including an offset calculation instruction received from the master station 1. As the PDU including the offset measurement instruction, a RefreshReady request or a RefreshMO request can be illustrated. As the response PDU corresponding to the PDU including the offset measurement instruction, a RefreshReady response or a RefreshMO response can be illustrated. As the PDU including the offset calculation instruction, a RefreshGO request can be illustrated.
The clock-offset calculating unit 246 calculates an offset (a clock offset) between the clock 11 of the master station 1 and the clock 21 of the own node necessary in performing one-way delay measurement by a time stamp. Specifically, upon receiving the PDU including the offset calculation instruction, the clock-offset calculating unit 246 calculates a clock offset ts_offset using Formula (3) below from the PDU master transmission time for measurement Tm_snd, the PDU slave reception time for measurement Ts_rcv, the PDU slave transmission time for measurement Ts_snd, and the PDU master reception time for measurement Tm_rcv from the time-stamp storing unit 245.
ts_offset=[Tm—rcv+Tm—snd−(Ts—rcv+Ts—snd)]/2 (3)
The one-way-delay detecting unit 247 detects occurrence of a delay of a PDU using the PDU received from the master station 1. Specifically, the one-way-delay detecting unit 247 starts a timer simultaneously with the start of the periodical communication or at the last PDU reception time and determines that a delay exceeds an allowable delay when a Refresh request, a RefreshMO request, or a RefreshGO request is not received within the predetermined time (the first one-way delay allowable value r_interval). Even when a Refresh request, a RefreshMO request, or a RefreshGO request is received within the predetermined time, the one-way-delay detecting unit 247 determines the exceeding of the allowably delay using Formula (1) from the PDU transmission time T_snd and the PDU reception time T_rcv in the time-stamp storing unit 245.
The loss detecting unit 248 detects a loss of a PDU on the network. Specifically, the loss detecting unit 248 determines a loss of a PDU using Formula (2) from the last PDU transmission time T_psnd and the present PDU transmission time T_nsnd in the time-stamp storing unit 245.
A clock offset calculating method, a one-way delay detecting method, a round-trip delay detecting method, and a loss detecting method in the communication system having such a configuration are explained below. First, the clock offset calculating method is explained.
As shown in
Subsequently, a RefreshGO request for instructing calculation of a clock offset is transmitted from the master station 1 (SQ13). Upon receiving the RefreshGO request, the slave station 2 starts calculation processing for a clock offset using the acquired time stamps Tm_snd, Ts_rcv, Ts_snd, and Tm_rcv. The reception of the RefreshGO request gives an opportunity for the periodical communication to be started in the slave station 2. The slave station 2 transmits a RefreshGO response, which is a response to the RefreshGO request (SQ14). The reception of the RefreshGO response gives an opportunity for the periodical communication to be started in the master station 1.
Thereafter, the master station 1 transmits a Refresh request after a predetermined time has elapsed (SQ15). The slave station 2 also transmits the Refresh request after the predetermined time has elapsed (SQ16). In the master station 1, time from the transmission of the RefreshGO request until the transmission of the next Refresh request is a period T1. In the slave station 2, time from the transmission of the RefreshGO response until the transmission of the next Refresh request is a period T2.
On the other hand, as shown in
Subsequently, a RefreshGO request for instructing calculation of a clock offset and the refresh processing is transmitted from the master station 1 (SQ34). Upon receiving the RefreshGO request, the slave station 2 performs calculation processing for a clock offset using the acquired time stamps Tm_snd, Ts_rcv, Ts_snd, and Tm_rcv and sets the calculated clock offset as a new clock offset. The salve station 2 transmits a RefreshGO response, which is a response to the RefreshGO request (SQ39).
As explained above, during the periodical communication, the Refresh requests are periodically transmitted by both of the master station 1 and the slave station 2. However, a measurement instruction and a calculation instruction for a clock offset and responses to the instructions are transmitted while being included in the Refresh requests rather than being transmitted at timing different from timing for the Refresh request.
In the master station 1, time from the transmission of the refresh instruction PDU including an instruction for the refresh processing such as a Refresh request, a RefreshGO request, or a RefreshMO request until the transmission of the next refresh instruction PDU is a period T1. Similarly, in the slave station 2, time from the transmission of the refresh instruction PDU (a Refresh request, a RefreshGO response, or a RefreshMO response) until the transmission of the next refresh instruction PDU is a period T2.
First, the connection-establishment requesting unit 141 of the master station 1 and the connection-establishment responding unit 241 of the slave station 2 perform connection establishment processing between the master station 1 and the slave station 2 (step S11 in
When the connection establishment processing is completed, as shown in
Subsequently, as shown in
Thereafter, the frame processing unit 244 of the slave station 2 generates, as a response to the received RefreshReady request, a RefreshReady response in which a value stored in the TS of the RefreshReady request is stored in a TS. The frame processing unit 244 transmits the RefreshReady response from the frame transmitting unit 25. At this point, the frame processing unit 244 stores the time stamp received from the time-stamp generating unit 243 at the RefreshReady response transmission time in the time-stamp storing unit 245 as the EDU slave transmission time for measurement Ts_snd (step S53). This is equivalent to SQ12 in the sequence shown in
Subsequently, as shown in
Thereafter, as shown in
Thereafter, the frame processing unit 244 of the slave station 2 determines whether periodical transmission data is stored anew in the transmission-data storing unit 22 (step S55). When periodical transmission data is not stored (No at step S55), the frame processing unit 244 stays in a waiting state until periodical transmission data is stored in the transmission-data storing unit 22. When periodical transmission data is stored (Yes at step S55), the frame processing unit 244 receives a time stamp of transmission timing from the time-stamp generating unit 243, and creates a RefreshGO response in which the received time stamp is stored in a TS and the periodical transmission data is stored in a data section. The RefreshGO response is transmitted from the frame transmitting unit 25 to the master station 1 (step S56). This is equivalent to SQ14 in the sequence shown in
Subsequently, as shown in
When the timing for clock offset calculation has not come (No at step S18), the frame processing unit 143 receives a time stamp of transmission timing from the time-stamp generating unit 142, creates a Refresh request in which the received time stamp is stored in a TS and the periodical transmission data is stored in a data section, and transmits the Refresh request from the frame transmitting unit 15 to the slave station 2 (step S19). This is equivalent to SQ15 in the sequence shown in
On the other hand, when it is determined at step S18 that the timing for clock offset calculation has come (Yes at step S18), the frame processing unit 143 receives a time stamp of transmission timing from the time-stamp generating unit 142, creates a RefreshMO request in which the received time stamp is stored in a TS and the periodical transmission data stored in the transmission-data storing unit 12 is stored in a data section, and transmits the RefreshMO request from the frame transmitting unit 15 to the slave station 2 (step S20). This is equivalent to SQ32 in the sequence shown in
Subsequently, as shown in
On the other hand, when the RefreshMO request is received at step S57 (Yes at step S57), the frame processing unit 244 receives a time stamp of reception timing for the RefreshMO request from the time-stamp generating unit 243 and stores the received time stamp in the time-stamp storing unit 245 as the P00 slave reception time for measurement Ts_rcv. The frame processing unit 244 stores a value in the TS of the RefreshMO request in the time-stamp storing unit 245 as the PDU master transmission time for measurement Tm_snd (step S60). Thereafter, the frame processing unit 244 determines whether new periodical transmission data is present in the transmission-data storing unit 22 (step S61). When periodical transmission data is not stored (No at step S61), the frame processing unit 244 stays in a waiting state until periodical transmission data is stored in the transmission-data storing unit 22. When periodical transmission data is stored (Yes at step S61), the frame processing unit 244 receives a time stamp of transmission timing from the time-stamp generating unit 243, creates a RefreshMO response in which the received time stamp is stored in a TS and the periodical transmission data in the transmission-data storing unit 22 is stored in a data section, and transmits the RefreshMO response from the frame transmitting unit 25 to the master station 1. At this point, the frame processing unit 244 stores the time stamp stored in the TS of the RefreshMO response in the time-stamp storing unit 245 as the PDU slave transmission time for measurement Ts_snd (step S62). This is equivalent to SQ37 in the sequence shown in
Subsequently, as shown in
On the other hand, when the RefreshMO response is received at step S21 (Yes at step S21), the frame processing unit 143 receives the time stamp Tm_rcv of the reception timing for the RefreshMO response from the time-stamp generating unit 142, temporarily stores the time stamp Tm_rcv, and then further determines whether new periodical transmission data is stored in the transmission-data storing unit 22 (step S24). When periodical transmission data is not stored anew (No at step S24), the frame processing unit 143 stays in a waiting state until transmission data is stored in the transmission-data storing unit 12. When periodical transmission data is stored anew (Yes at step S24), the frame processing unit 143 receives a time stamp of transmission timing from the time-stamp generating unit 142, creates a RefreshGO request in which the received time stamp is stored in a TS, the periodical transmission data in the transmission-data storing unit 22 is stored in a data section, and the time stamp Tm_rcv of the reception timing for the RefreshMO response temporarily stored at step S24 is stored in an OBL, and transmits the RefreshGO request from the frame transmitting unit 15 to the slave station 2 (step S25). This is equivalent to SQ34 in the sequence shown in
Subsequently, as shown in
On the other hand, when the RefreshGO request is received at step S63 (Yes at step S63), the frame processing unit 244 stores a value stored in the OBL of the received RefreshGO request in the time-stamp storing unit 245 as the PDU master reception time for measurement Tm_rcv. Thereafter, because the RefreshGO request is received, the clock-offset calculating unit 246 calculates a clock offset of the clock 21 of the slave station 2 with respect to the clock 11 of the master station 1 using Formula (3) from Tm_snd, Ts_rcv, Ts_snd, and Tm_rcv stored in the time-stamp storing unit 245. The clock-offset calculating unit 246 adds the calculated clock offset to a value of the clock offset stored in the clock-offset storing unit 242 so far and stores the added-up clock offset in the clock-offset storing unit 242 as a new clock offset (step S66).
Thereafter, the frame processing unit 244 of the slave station 2 determines whether periodical transmission data is stored anew in the transmission-data storing unit 22 (step S67). When periodical transmission data is not stored (No at step S67), the frame processing unit 244 stays in a waiting state until periodical transmission data is stored in the transmission-data storing unit 22. When periodical transmission data is stored (Yes at step S67), the frame processing unit 244 receives a time stamp of transmission timing from the time-stamp generating unit 243, creates a RefreshGO response in which the received time stamp is stored in a TS and the periodical transmission data in the transmission-data storing unit 22 is stored in a data section, and transmits the RefreshGO response from the frame transmitting unit 25 (step S68). Thereafter, the processing returns to step S57. This is equivalent to SQ39 in the sequence shown in
Subsequently, as shown in
As explained above, a measurement instruction and a calculation instruction for a clock offset and offset generation information are included in a periodical communication frame including an instruction for refresh processing exchanged during the periodical communication between the master station 1 and the slave station 2. Therefore, it is possible to perform calculation of a clock offset during the periodical communication.
Delay detection processing is explained next. In the first embodiment, as the delay detection processing, the master station 1 performs one-way delay detection processing using a PDU transmitted from the slave station 2 and performs round-trip delay detection processing using a PDU exchange in a request response sequence. The slave station 2 performs one-way delay detection processing.
Subsequently, the one-way-delay detecting unit 145 determines whether a Refresh request, a RefreshMO response, or a RefreshGO response is received in the frame receiving unit 16 (step S72). If none of a Refresh request, a RefreshMO response, and a RefreshGO response is received (No at step S72), the one-way-delay detecting unit 145 determines whether the predetermined period (the first delay allowable time) r_interval has elapsed from the timer start (step S73). When the predetermined period has not elapsed (No at step S73), the processing returns to step S72. When the predetermined period has elapsed (Yes at step S73), the one-way-delay detecting unit 145 determines that a delay has exceeded an allowable delay (step S77). When it is determined that a delay has exceeded the allowable delay, the master station 1 is disconnected and communication is stopped. The processing ends.
On the other hand, when any one of a Refresh request, a RefreshMO response, and a RefreshGO response is received at step S72 (Yes at step S72), the one-way-delay detecting unit 145 receives a time stamp of reception timing for the Refresh request, the RefreshMO response, or the RefreshGO response from the time-stamp generating unit 142 and stores the time stamp in the time-stamp storing unit 144 as the PDU reception time T_rcv (step S74). The one-way-delay detecting unit 145 stores a value stored in a TS of the received Refresh request, RefreshMO response, or RefreshGO response in the time-stamp storing unit 144 as the PDU transmission time T_snd (step S75).
Subsequently, the one-way-delay detecting unit 145 determines whether a difference between the PDU reception time T_rcv and the PDU transmission time T_snd stored in the time-stamp storing unit 144 at steps S74 and S75, i.e., time in which the refresh instruction PDU is transmitted from the slave station 2 and reaches the master station 1 is smaller than the second delay allowable time d_allowed set in advance (step S76).
As a result of the determination, when the difference between the PDU reception time T_rcv and the PDU transmission time T_snd is equal to or larger than the second delay allowable time d_allowed (No at step S76), the one-way-delay detecting unit 145 determines that a delay has exceeded the allowable delay (step S77). The processing ends. When the difference between the PDU reception time T_rcv and the PDU transmission time T_snd is smaller than the second delay allowable time d_allowed (Yes at step S76), the one-way-delay detecting unit 145 determines that a delay is within the allowable delay (step S78) and restarts the timer (step S79). The processing returns to step S72. The one-way delay detection processing in the master station 1 is performed as explained above.
The one-way delay detection processing in the slave station 2 is explained. The one-way delay detection processing in the slave station 2 is basically the same as the one-way delay detection processing in the master station 1. However, the one-way delay detection processing in the station 2 is different from the one-way delay processing in the master station 1 in points explained below. The start of the periodical communication at the timing for starting the timer at step S71 is at a timing when the RefreshGO request in SQ13 shown in
As explained above, in the one-way delay detection processing, the one-way delay detection processing can be performed using a periodical communication frame including an instruction for refresh processing in which a time stamp of time transmitted by a partner node is stored. Delay detection is performed every time the periodical communication frame including the instruction for the refresh processing is received. Therefore, it is possible to quickly detect a delay.
When the response PDU has not been received at step S93 (No at step S93), the round-trip-delay detecting unit 146 determines whether the predetermined time (the round-trip delay allowable time) rtt_allowed has elapsed from the start of the timer (step S96). When the predetermined time has not elapsed (No at step S96), the processing returns to step S93. On the other hand, when the predetermined time has elapsed from the start of the timer (Yes at step S96), the round-trip-delay detecting unit 146 stops the timer (step S97) and determines that a delay has exceeded the allowable delay (step S98). When it is determined that a delay has exceeded the allowable delay, the master station 1 is disconnected and communication is stopped. Consequently, the processing ends.
At step S93, the round-trip-delay detecting unit 146 checks whether the received response PDU is a response PDU corresponding to the request PDU transmitted at step S91. Specifically, when the request PDU transmitted at step S91 is a request PDU transmitted before offset calculation, a RefreshReady request, and a request PDU in communication other than the periodical communication, the round-trip-delay detecting unit 146 checks whether a TS of the request PDU transmitted at step S91 and a TS of the response PDU received at step S93 coincide with each other. When the TSs coincide with each other, the round-trip-delay detecting unit 146 determines that the response PDU is a response corresponding to the request PDU. When the request PDU transmitted at step S91 is a RefreshMO request and a RefreshGO request, the round-trip-delay detecting unit 146 confirms whether PDU association information included in a CTRL of the request PDU transmitted at step S91 coincides with PDU association information included in a CTLR of the response PDU received at step S93. When the pieces of PDU association information coincide with each other, the round-trip-delay detecting unit 146 determines that the response PDU is a response corresponding to the request PDU.
As explained above, in the case of a sequence in which the master station 1 transmits a request PDU to the slave station 2 and the slave station 2 transmits a response PDU corresponding to the request PDU to the master station 1, it is possible to detect whether a round-trip delay is within the allowable delay. The delay detection processing is switched according to a type of communication such that the round-trip delay detection processing by the round-trip-delay detecting unit 146 is performed in time other than the periodical communication time and the one-way delay detection processing by the one-way-delay detecting unit 145 is performed in the periodical communication time. Consequently, it is possible to perform the delay detection in every scene of communication on the network.
PDU loss detection processing is explained.
When Refresh request, RefreshMO response, or a RefreshGO response has been received (Yes at step S113), the loss detecting unit 147 stores a value stored in a TS of the received Refresh request, RefreshMO response, or RefreshGO response in the time-stamp storing unit 144 as the present PDU transmission time T_nsnd (step S114). Thereafter, the loss detecting unit 147 determines whether a difference between the present PDU transmission time T_nsnd and the last PDU transmission time T_psnd stored in the time-stamp storing unit 144 is smaller than a loss evaluation time trns_interval that means an allowable reception interval (step S115).
As a result of the determination, when the difference between the present PDU transmission time T_nsnd and the last PDU transmission time T_psnd is equal to or larger than the loss evaluation time trns_interval (No at step S115), the loss detecting unit 147 determines that there is a loss of a PDU (step S116). Processing for, for example, disconnecting the master station 1 to stop communication is performed. The PDU loss detection processing ends. When the difference between the present PDU transmission time T_nsnd and the last PDU transmission time T_psnd is smaller than the loss evaluation time trns_interval (Yes at step S115), the loss detecting unit 147 determines that there is no loss of a PDU (step S117). The loss detecting unit 147 stores, as a new last PDU transmission time T_psnd, the present PDU transmission time T_nsnd stored in the time-stamp storing unit 144 at step S114 (step S118). Thereafter, the processing returns to step S113. the loss detecting unit 147 repeatedly executes the processing explained above.
Loss detection processing in the slave station 2 is explained. The loss detection processing in the slave station 2 is basically the same as the loss detection processing in the master station 1. However, the loss detection processing in the slave station 2 is different from the loss detection processing in the master station 1 in that a RefreshReady request is received at step S111 and that it is determined at step S113 whether a Refresh request, a RefreshMO request, or a RefreshGO request is received.
As explained above, in the PDU loss detection processing, it is possible to perform the PDU loss detection processing using a periodical communication frame including an instruction for refresh processing in which a time stamp of time transmitted by a partner node is stored. The PDU loss detection processing is performed every time the periodical communication frame including the instruction for the refresh processing is received. Therefore, it is possible to quickly detect a PDU loss.
In the delay detection processing and the PDU loss detection processing explained above, when the one-way delay detecting unit 145 and the round-trip delay detecting unit 146 of the master station 1 determine that a delay is within the allowable delay and the loss detecting unit 147 determines that there is no loss of a PDU, data stored in a data section of the Refresh request, the RefreshMO response, and the RefreshGO response received from the slave station 2 is stored in the reception-data storing unit 13.
When the one-way-delay detecting unit 247 of the slave station 2 determines that a delay is within the allowable delay and the loss detecting unit 248 determines that there is no loss of a PDU, data stored in a data section of the Refresh request, the RefreshMO request, and the RefreshGO request received from the master station 1 is stored in the reception-data storing unit 23.
The operations of the one-way-delay detecting units 145 and 247 performed when there is fluctuation in transmission intervals of the frame transmitting units 15 and 25 of the master station 1 and the slave station 2 are explained. It is assumed that there is fluctuation in transmission intervals and a second PDU among three PDUs (first to third PDUs, e.g., PDUs transmitted in SQ31 to SQ33 shown in
At steps (S15, S19, S20, S23, S25, and S28) for transmitting a Refresh request, a RefreshMO request, and a RefreshGO request (a refresh instruction frame including an instruction for the refresh processing), after transmitting the refresh instruction frame, the one-way-delay detecting unit 145 of the master station 1 stores, as final transmission timing, a time stamp stored in a TS of the transmitted refresh instruction frame. When the refresh instruction frame is transmitted next, the one-way-delay detecting unit 145 waits until a difference between the final transmission timing and the present transmission timing exceeds a half of the loss evaluation time trns_interval. When the difference exceeds a half of the loss evaluation time, the one-way-delay detecting unit 145 transmits the refresh instruction frame from the frame transmitting unit 15.
At steps (S56, S59, S62, S65, and S68) for transmitting a Refresh request, a RefreshMO response, and a RefreshGO response (a refresh instruction frame) in
According to the first embodiment, a region in which information for calculating a clock offset is stored is provided in a PDU exchanged between two nodes during the periodical communication in addition to a region in which data to be transmitted is stored and a region in which a time stamp used for detection of a delay and a loss is stored. A clock offset between the two nodes is calculated based on the time stamp used for detection of a delay and a loss and information for calculating an offset. Consequently, it is unnecessary to transmit a new PDU for clock offset calculation besides the PDU exchanged during the periodical communication. The size of the PDU does not change. Therefore, when the embodiment is applied to an apparatus that operates at a predetermined processing period such as a programmable controller that performs sequence control, there is an effect that it is possible to prevent influence on periodical data processing.
A delay measuring method is switched to perform round-trip delay measurement at the time other than the periodical communication time and perform one-way delay measurement at the periodical communication time. Consequently, when the delay measuring method is applied to a system that transmits and receives input and output information from an input and output apparatus such as a sensor or an actuator at a predetermined processing period such as a programmable controller system that performs sequence control, it is possible to reduce time until a delay and a loss of the input and output information are detected.
Further, even when there is fluctuation in a generation period of periodical communication data, a transmission side transmits the periodical communication data after a half of a loss evaluation time used for loss determination on a reception side elapses from the last transmission timing. Therefore, it is possible to prevent determination that a loss has not occurred although a loss has occurred on the transmission side and surely detect a loss.
In the first embodiment, the size of time information stored in a TS of a PDU is not explained. In the second embodiment, the size of time information set to an arbitrary size is explained.
In an example explained in the second embodiment, both the clocks 11 and 21 of the master station 1 and the slave station 2 are clocks having 48-bit width and the size of a TS of a PDU is limited to 16 bits.
The time-stamp generating unit 142 of the master station 1 according to the second embodiment generates low-order 16 bits of time information generated by the clock 11 as a time stamp. The time-stamp generating unit 243 of the slave station 2 calculates a sum of the clock 21 and a time offset stored in the clock-offset storing unit 242 and generates low-order 16 bits of a calculated value as a time stamp.
Differences from the first embodiment in clock offset calculation processing, one-way delay detection processing, and PDU loss detection processing in the second embodiment are explained below.
Connection Establishment Processing by the Master Station 1
During the connection establishment request processing at step S11 in
Connection Establishment Processing by the Slave Station 2
During the connection establishment request processing at step S51 in
Check Code Generation Processing by the Master Station 1
In the steps of transmitting a Refresh request, a RefreshMO request, and a RefreshGO request at steps S15, S19, S20, S23, S25, and S28 in
Check Code Setting Processing During PDU Transmission by the Slave Station 2
In the steps of transmitting a Refresh request, a RefreshMO response, and a RefreshGO response at steps S55, S59, S62, S65, and S68 in
Subsequently, the frame processing unit 244 generates a check code from the set high-order bit for response transmission and a header section and a data section of a PDU to be transmitted and stores the generated check code in a trailer section of the PDU to be transmitted (step S134). After transmitting the PDU (step S135), the frame processing unit 244 stores the PDU transmission time T_snd of the PDU to be transmitted this time in the time-stamp storing unit 245 as T_psnd (step S135). The processing ends.
On-Way Delay Detection Processing
One-Way Delay Detection Processing by the Master Station 1
First, the one-way-delay detecting unit 145 of the master station 1 receives a time stamp currently generated by the time-stamp generating unit 142 and stores the received time stamp in the time-stamp storing unit 144 as the last PDU reception time T_prcv (step S151). Subsequently, the start of the periodical communication in the master station 1 gives the opportunity to the one-way-delay detecting unit 145 to start the timer using the clock 11 (step S152). The start of the periodical communication in the master station 1 is at timing when the RefreshGO response in SQ14 shown in
Subsequently, the one-way-delay detecting unit 145 determines whether a Refresh request, a RefreshMO response, or a RefreshGO response has been received in the frame receiving unit 16 (step S153). When none of a Refresh request, a RefreshMO response, and a RefreshGO response has been received (NO at step S153), the one-way-delay detecting unit 145 determines whether the predetermined time (the first delay allowable time) r_interval has elapsed from the timer start (step S154). When the predetermined time has not elapsed (No at step S154), the processing returns to step S153. When the predetermined time has elapsed at step S154 (Yes at step S154), the one-way-delay detecting unit 145 determines that a delay has exceeded an allowable delay (step S159) and performs processing for, for example, disconnecting the master station 1. The processing ends.
On the other hand, when any one of a Refresh request, a RefreshMO response, or a RefreshGO response is received at step S153 (Yes at step S153), the one-way-delay detecting unit 145 receives a time stamp of reception timing for the Refresh request, the RefreshMO response, or the RefreshGO response from the time-stamp generating unit 142 and stores the time stamp in the time-stamp storing unit 144 as the PDU reception time T_rcv (step S155). The one-way-delay detecting unit 145 stores a value stored in a TS of the received Refresh request, RefreshMO response, or RefreshGO response in the time-stamp storing unit 144 as the PDU transmission time T_snd (step S156).
Subsequently, the one-way-delay detecting unit 145 generates a 48-bit PDU transmission time T_snd_48 and a 48-bit PDU reception time T_rcv_48 (step S157).
First, the one-way-delay detecting unit 145 of the master station 1 sets high-order 32 bits of the clock 11 as clock high-order bit information up_clk_s_d (step S171). Subsequently, the one-way-delay detecting unit 145 generates the 48-bit PDU reception time T_rcv_48 in which the high-order 32 bits are set as clock high-order bit information up_clk_s_d and low-order 16 bits are set as the PDU reception time T_rcv (step S172).
Thereafter, the one-way-delay detecting unit 145 determines whether the PDU transmission time T_snd is larger than the PDU reception time T_rcv (step S173). When the PDU transmission time T_snd is equal to or smaller than the PDU reception time T_rcv (No at step S173), the one-way-delay detecting unit 145 sets the clock high-order bit information up_clk_s_d as high-order bits for time calculation (step S174). On the other hand, when the PDU transmission time T_snd is larger than the PDU reception time T_rcv (Yes at step S173), the one-way-delay detecting unit 145 sets, as the high-order bits for time calculation, high-order bit information obtained by decrementing the clock high-order bit information up_clk_s by one (step S175).
Subsequently, the one-way-delay detecting unit 145 generates the 48-bit PDU transmission time T_snd_48 in which high-order 32 bits are set as the high-order bits for time calculation set at step S174 or S175 and low-order 16 bits are set as the PDU transmission time T_snd (step S176). Thereafter, the one-way-delay detecting unit 145 calculates a check code from the set high-order bits for time calculation and a header section and a data section of a received PDU (step S177). The one-way-delay detecting unit 145 determines whether the calculated check code is equal to a value stored in a trailer section of the received PDU (step S178). When the check code and the value do not coincide with each other (No at step S178), the one-way-delay detecting unit 145 determines that abnormality has occurred. The processing ends. When the check code and the value are equal (Yes at step S178), the processing returns to the processing shown in
Referring back to
One-Way Delay Detection Processing by the Slave Station 2
The one-way delay detection processing in the slave station 2 is basically the same as the one-way delay detection processing in the master station 1. However, differences from the one-way delay detection processing in the master station 1 are explained below. The start of the periodical communication at the timing for starting the timer at step S152 is at timing when the RefreshGO request in SQ43 shown in
The generation processing for the 48-bit PDU transmission time T_snd_48 and the 48-bit PDU reception time T_rcv_48 at step S158 is different from the generation processing performed in the master station 1.
First, the one-way-delay detecting unit 247 of the slave station 2 acquires the last PDU transmission time T_psnd used in the loss detecting unit 248 from the time-stamp storing unit 245 (step S191). Subsequently, the one-way-delay detecting unit 247 determines whether the PDU transmission time T_snd stored in a TS of the received Refresh request, RefreshMO request, or RefreshGO request acquired at step S156 is smaller than the last PDU transmission time T_psnd acquired at step S191 (step S192). When the PDU transmission time T_snd is equal to or larger than the last PDU transmission time T_psnd (No at step S192), the one-way-delay detecting unit 247 sets, as high-order bits for transmission time, the high-order bit information for request PDU transmission time generation up_clk_d_s acquired from the time-stamp storing unit 245 (step S193). On the other hand, when the PDU transmission time T_snd is smaller than the last PDU transmission time T_psnd (Yes at step S192), the one-way-delay detecting unit 247 sets, as high-order bits for transmission time, high-order bit information obtained by incrementing, by one, the high-order bit information for request PDU transmission time generation up_clk_d_s acquired from the time-stamp storing unit 245 (step S194). The one-way-delay detecting unit 247 sets up_clk_d_s+1 obtained at step S194 in the time-stamp storing unit 245 as new high-order bit information for request PDU transmission time generation up_clk_d_s.
Therefore, the one-way-delay detecting unit 247 generates the 48-bit PDU transmission time T_snd_48 in which high-order 32 bits are set as the high-order bits for transmission time set at step S193 or S194 and low-order 16 bits are set as the PDU transmission time T_snd (step S195).
Subsequently, the one-way-delay detecting unit 247 determines whether the PDU reception time T_rcv acquired at step S155 in
Thereafter, the one-way-delay detecting unit 247 generates the 48-bit PDU reception time T_rcv_48 in which high-order 32 bits are set as the high-order bits for reception time set at step S197 or S198 and low-order 16 bits are set as the PDU reception time T_rcv (step S199).
Subsequently, the one-way-delay detecting unit 247 calculates a check code from the high-order bits for transmission time set at step S193 or S194 and a header section and a data section of a received PDU (step S200). The one-way-delay detecting unit 247 determines whether the calculated check code is equal to a value stored in a trailer section of the received PDU (step S201). When the check code and the value do not coincide with each other (No at step S201), the one-way-delay detecting unit 247 determines that abnormality has occurred. The processing ends. When the check code and the value are equal (Yes at step S201), the processing returns to the processing shown in
Loss Detection Processing
Loss Detection Processing by the Master Station 1
Upon receiving a RefreshReady response (step S221), the loss detecting unit 147 of the master station 1 stores a value stored in a TS of the received RefreshReady response in the time-stamp storing unit 144 as the last PDU reception time T_psnd (step S222). Thereafter, the loss detecting unit 147 determines whether any one of a Refresh request, a RefreshMO response, and a RefreshGO response has been received (step S223). If none of a Refresh request, a RefreshMO response, and a RefreshGO response has been received (No at step S223), the loss detecting unit 147 stays in a waiting state until a Refresh request, a RefreshMO response, or a RefreshGO response is received.
If a Refresh request, a RefreshMO response, or a RefreshGO response has been received (Yes at step S223), the loss detecting unit 147 stores a value stored in a TS of the received Refresh request, RefreshMO response, or RefreshGO response in the time-stamp storing unit 144 as the present PDU transmission time T_snd, and stores a reception time of the Refresh request, the RefreshMO response, or the RefreshGO response as the frame reception time T_rcv (step S224).
Subsequently, the loss detecting unit 147 generates the 48-bit last PDU transmission time T_psnd_48 and the 48-bit present PDU transmission time T_nsnd_48 (step S225).
First, the loss detecting unit 147 of the master station 1 sets high-order 32 bits of the clock 11 as the clock high-order bit information up_clk_s_l (step S241). Subsequently, the loss detecting unit 147 determines whether the present PDU transmission time T_nsnd acquired at step S224 is larger than the frame reception time T_rcv of the Refresh request, the RefreshMO response, or the RefreshGO response received at step S223 (step S242). When the present PDU transmission time T_nsnd is equal to or smaller than the frame reception time T_rcv (No at step S242), the loss detecting unit 147 sets the clock high-order bit information up_clk_s_l as first high-order bits for loss detection (step S243). On the other hand, when the present PDU transmission time T_nsnd is larger than the frame reception time T_rcv (Yes at step S242), the loss detecting unit 147 sets, as first high-order bits for loss detection, high-order bit information obtained by decrementing the clock high-order bit information up_clk_s_l by one (step S244).
Subsequently, the loss detecting unit 147 generates the 48-bit present PDU transmission time T_nsnd_48 in which high-order 32 bits are set as the first high-order bits for loss detection and low-order 16 bits are set as the present PDU transmission time T_nsnd (step S245).
Subsequently, the loss detecting unit 147 determines whether the last PDU transmission time T_psnd is larger than the present PDU transmission time T_nsnd (step S246). When the last PDU transmission time T_psnd is equal to or smaller than the present PDU transmission time T_nsnd (No at step S246), the loss detecting unit 147 sets the clock high-order bit information up_clk_s_l acquired at step S241 as second high-order bits for loss detection (step S247). On the other hand, when the last PDU transmission time T_psnd is larger than the present PDU transmission time T_nsnd (Yes at step S246), the loss detecting unit 147 sets, as second high-order bits for loss detection, high-order bit information obtained by decrementing the clock high-order bit information up_clk_s_l acquired at step S241 (step S248) by one.
Thereafter, the loss detecting unit 147 generates the 48-bit last PDU transmission time T_psnd_48 in which high-order 32 bits are set as the second high-order bits for loss detection set at step S247 or S248 and low-order 16 bits are set as the last PDU transmission time T_psnd (step S249).
Subsequently, the loss detecting unit 147 generates a check code from the first high-order bits for loss detection set at step S243 or S244 and a header section and a data section of a received PDU (step S250). The loss detecting unit 147 determines whether the calculated check code is equal to a value stored in a trailer section of the received PDU (step S251). When the check code and the value do not coincide with each other (No at step S251), the loss detecting unit 147 determines that abnormality has occurred. The processing ends. When the check code and the value are equal (Yes at step S251), the processing returns to the processing shown in
Referring back to
Loss Detection Processing by the Slave Station 2
The loss detection processing in the slave station 2 is basically the same as the loss detection processing in the master station 1. However, differences from the loss detection processing in the master station 1 are explained below. At step S221, a RefreshReady request has been received. At step S223, it is determined whether a Refresh request, a RefreshMO request, or a RefreshGO request has been received.
The generation processing for the 48-bit present PDU transmission time T_nsnd_48 and the 48-bit last PDU transmission time T_psnd_48 at step S225 is different from the generation processing performed in the master station 1.
First, the loss detecting unit 248 of the slave station 2 acquires the high-order bit information for loss detection PDU time generation up_clk_l from the time-stamp storing unit 245 (step S261). Subsequently, the loss detecting unit 248 generates the 48-bit last PDU transmission time T_psnd_48 in which high-order 32 bits are set as high-order bit information for loss detection PDU time generation and low-order 16 bits are set as the last PDU transmission time T_psnd (step S262).
Thereafter, the loss detecting unit 248 determines whether the last PDU transmission time T_psnd is larger than the present PDU transmission time T_nsnd (step S263). When the last PDU transmission time T_psnd is equal to or smaller than the present PDU transmission time T_nsnd (No at step S263), the loss detecting unit 248 sets the high-order bit information for loss detection PDU time generation up_clk_l as high-order bits for loss detection (step S264). On the other hand, when the last PDU transmission time T_psnd is larger than the present PDU transmission time T_nsnd (Yes at step S263), the loss detecting unit 248 sets, as high-order bit for loss detection, high-order bit information obtained by incrementing the high-order bit information for loss detection PDU time generation up_clk_l by one (step S265). The loss detecting unit 248 stores up_clk_l+1 obtained at step S265 in the time-stamp storing unit 245 as new high-order bit information for loss detection PDU time generation up_clk_l.
Subsequently, the loss detecting unit 248 generates the 48-bit present PDU transmission time T_nsnd_48 in which high-order 32 bits are set as the high-order bits for loss detection set at step S264 or S265 and low-order 16 bits are set as the present PDU transmission time T_nsnd (step S266). Thereafter, the loss detecting unit 248 calculates a check code from the set high-order bit for loss detection and a header section and a data section of a received PDU (step S267). The loss detecting unit 248 determines whether the calculated check code is equal to a value stored in a trailer section of the received PDU (step S268). When the check code and the value do not coincide with each other (No at step S268), the loss detecting unit 248 determines that abnormality has occurred. The processing ends. When the check code and the value are equal (Yes at step S277), the processing returns to the processing shown in
In the example explained above, the clock has the 48-bit width and only 16 bits can be stored in the TS of the PDU. However, the bit width of the clock can be other values and the number of bits stored in the TS of the PDU can be other values.
According to the second embodiment, in the TS and the OBL in which the time stamp of the PDU is stored, the low-order bits of a size fit in the regions of the TS and the OBL are stored. The master station 1 including the clock 11 set as a reference notifies the slave station 2 of the high-order bits of the clock when connection is established. Consequently, there is an effect that, even when the size of the TS of the PDU is limited to be smaller than the clock width, it is possible to perform the delay and loss detection and the calculation processing for a clock offset between the master station 1 and the slave station 2. A part of the clock included in the node only has to be included in the PDU. Therefore, there is also an effect that it is possible to reduce the size of the PDU.
As explained above, the communication apparatus according to the present invention is useful as a communication device used in a system that periodically transmits and receives data.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP2010/065986 | 9/15/2010 | WO | 00 | 3/8/2013 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2012/035629 | 3/22/2012 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
20030115321 | Edmison et al. | Jun 2003 | A1 |
20040052259 | Garcia et al. | Mar 2004 | A1 |
20060041673 | Sturrock et al. | Feb 2006 | A1 |
20060109868 | Schopp | May 2006 | A1 |
Number | Date | Country |
---|---|---|
2004-289748 | Oct 2004 | JP |
2007-27985 | Feb 2007 | JP |
Entry |
---|
International Search Report for PCT/JP2010/065986 dated Dec. 14, 2010. |
Communication dated Aug. 20, 2014 from the German Patent and Trademark Office in counterpart application No. 112010005881.4. |
Number | Date | Country | |
---|---|---|---|
20130170388 A1 | Jul 2013 | US |