Master device and communication method

A master device according to this disclosure which communicates with a plurality of slave devices to share cyclic data includes: a configuration information acquiring unit to acquire a phase difference of each of the slave devices determined based on a number of other slave devices to be relayed when the each slave device communicates with the master device; and a transmission timing determining unit to calculate a hop count from a number of other slave devices to be relayed when the each slave device communicates with the master device or another slave device based on the phase difference acquired by the configuration information acquiring unit and to determine a transmission timing for each slave device to transmit the cyclic data in such a way that communications with a same hop count are performed at a same timing by the plurality of slave devices.

CROSS-REFERENCE TO RELATED APPLICATION

The present application is based on PCT filing PCT/JP2020/011199, filed Mar. 13, 2020, the entire contents of which are incorporated herein by reference.

TECHNICAL FIELD

This disclosure relates to a master device and a communication method of a network system including the master device and a plurality of slave devices.

BACKGROUND TECHNOLOGY

Conventionally, technologies have been proposed to improve the communication efficiency in a network system including a plurality of communication devices.

For example, Patent Document 1 describes a method to improve the communication efficiency during cyclic communication in a network system made up of a plurality of nodes including a root node. The cyclic communication means communication in which the devices in a network system repeatedly transmits and receives information during communication cycles with a predetermined time length. In Patent Document 1, the root node performs the cyclic communication with the plurality of nodes via a line for communicating with a node that is directly connected to the root node. The root node performs further communication by using this line when it is unused during the communication cycle. As a result, the line usage rate is improved, and the communication efficiency of the network system is improved.

PRIOR ART LITERATURE

Patent Document

SUMMARY OF THE INVENTION

Problems to be Solved by the Invention

Patent document 1 improves the line usage rate of the line, among the lines in the network system, used for communication with the node directly connected to the root node. However, the line usage rates of the lines used for communication between the other nodes are not considered. Therefore, when the root node communicates with one node, the lines connecting the other nodes may not be used for communication. This leads to a poor communication efficiency for the entire network system.

This disclosure is made to solve the above problem. The object is to obtain a master device and a communication method that can improve the communication efficiency of a network system as a whole which includes a master device and a plurality of slave devices.

Means to Solve the Problem

A master device according to this disclosure which is connected with a plurality of slave devices by communication cables and is included in a network system to communicate while sharing cyclic data includes: a configuration information acquiring unit to acquire a phase difference of each of the slave devices determined based on a number of other slave devices to be relayed when the each slave device communicates with the master device; and a transmission timing determining unit to calculate a hop count from a number of other slave devices to be relayed when the each slave device communicates with the master device or another slave device based on the phase difference acquired by the configuration information acquiring unit and to determine a transmission timing for each slave device to transmit the cyclic data in such a way that communications with a same hop count are performed at a same timing by the plurality of slave devices using the communication cables each connecting different pairs of the slave devices.

Effect of the Invention

With the master device and the communication method according to this disclosure, the communication efficiency of an entire network system can be improved.

MODE FOR CARRYING OUT THE INVENTION

Hereinafter, Embodiment 1 of this disclosure will be described.FIG.1is a diagram of a network system1according to Embodiment 1 of this disclosure.

The network system1includes a plurality of communication devices, namely, one master device100and five slave devices200ato200ein Embodiment 1. The five slave devices may be collectively referred to as slave devices200. In the network system1, the master device100and the slave devices200ato200ecommunicate with each other during cyclic communication to share cyclic data. The cyclic data is information that the master device100and the slave devices200ato200erepeatedly transmit in each communication cycle during the cyclic communication operation. For example, the cyclic data includes instruction information transmitted from the master device100to the slave devices200. The slave devices200control external devices based on this instruction information. The cyclic data also includes output values from sensors collected by the slave devices200. The output values are transmitted from the slave devices200to the master device100. In the network system1, all of its communication devices communicate with all other communication devices therein within one communication cycle to share the cyclic data.

The master device100and the slave devices200ato200eare wired in a line-shaped connection by communication cables3. The slave devices200are connected to the master device100in the line-shaped connection, namely in the order of their proximity to the master device100: a slave device200a, a slave device200b, a slave device200c, a slave device200d, and a slave device200e. In the network system1of line-shaped connection, the master device100located at one end is connected to the slave device200a; the slave device200elocated at the other end is connected to the slave device200d. InFIG.1, the symbols M, S1to S5attached to each device indicate identification information of each device. The identification information, which is uniquely set for all the devices constituting the network system1, is used for identifying the master device100and the slave devices200.

FIG.2is a table showing the correspondence between device names and the identification information in Embodiment 1 of this disclosure. As shown inFIG.2, the identification information of the master device100is M; the identification information of the slave device200ais S1; the identification information of the slave device200bis S2; the identification information of the slave device200cis S3, the identification information of the slave device200dis S4; and the identification information of the slave device200eis S5. In the examples of this disclosure, the identification information is shown as M, S1to S5. However, the identification information can be other numbers or character strings, as long as each device can be identified thereby. For the identification information, the MAC address of each device or the names of the devices set by the user in advance may be used.

The master device100includes at least one communication port101, which is the interface to which a communication cable3is connected. A specific example of the communication port101is a LAN port, a USB port, or the like. The master device100communicates with the slave devices200ato200evia the communication cables3, to acquire the configuration information required to communicate with the slave devices200ato200e, to set transmission timings to perform the cyclic communication, and thus to share the cyclic data with the slave devices200during the cyclic communication.

Each of the slave devices200has two or more communication ports. In the Embodiment 1, the slave devices200ato200ehave two communication ports201and202, individually. In each of the slave devices200ato200e, the communication port connected to the device on the master side being closer to the master device100is shown as communication ports201ato201e, and the communication port connected to the device on the end side being closer to the slave device200eat the end of the line connection is shown as communication ports202ato202e.

The slave devices200ato200eare controlled by the master device100. After the master device100sets the transmission timings for the cyclic data, the master device100and the other slave devices200perform the cyclic communication to share the cyclic data.

Note thatFIG.1illustrates the network system1that includes five slave devices200. However, the communication method according to this disclosure is applicable to a network system that includes two or more slave devices200.

Next, the detailed configuration of the master device100will be described with reference toFIG.3.FIG.3shows a functional block diagram of the master device100according to Embodiment 1. The master device100includes a storing unit110, a processing unit120, and a control unit130in addition to the communication port101described above. The details of each unit will be described below.

First, the storing unit110will be described. The storing unit110is a device for storing information. The storing unit110includes a received information storing unit111, a setting storing unit112, and a transmission information storing unit113.

The received information storing unit111stores information acquired by the master device100from the slave devices200via the communication port101. This information includes, for example, information of configuration information response frames acquired by the master device100from the slave devices200during the configuration information acquisition and also information of the cyclic data acquired by the master device100from the slave devices200during the cyclic communication. The configuration information response frames include the information that the master device100acquires from the slave devices200included in the network system1in order to detect the configuration of the network system1. The configuration information response frames include information about the slave devices200.

The setting storing unit112stores, as the setting information, the configuration information of the network system1acquired by a configuration information acquiring unit121, to be described later, and the transmission timing of each of the slave devices200determined by a transmission timing determining unit122, to be described later. The setting storing unit112may store the user settings on the transmission timing of the cyclic data in the cyclic communication or information such as the communication time required for the transmission timing determining unit122to determine the transmission timing, in addition to the configuration information and the transmission timing, which are the setting information.

The transmission information storing unit113stores information generated by a transmission information generating unit123to be described later, to be transmitted from the master device100to the slave devices200until a transmission control unit131to be described later instructs to transmit the information. The information to be transmitted from the master device100to the slave devices200includes, for example, information of configuration information request frame to be transmitted during the configuration information acquisition, the setting information to be transmitted during communication setting, and the cyclic data acquired from the slave devices200during the cyclic communication. The configuration information request frames include the information that the master device100transmits to the slave devices200in the network system1in order to detect the configuration of the network system1. The configuration information request frames include the information to cause the slave devices200to transmit the information of the configuration information response frames.

Next, the processing unit120will be described. The processing unit120includes the configuration information acquiring unit121, the transmission timing determining unit122, and the transmission information generating unit123.

The configuration information acquiring unit121acquires the configuration information of the slave devices200from the information of the configuration information response frames stored in the received information storing unit111during the configuration information acquiring operation. The configuration information is the information for the master device100to set the transmission timing of the cyclic data to be transmitted during the cyclic communication and includes a phase difference, which is the hop count for each slave device200to communicate with the master device100.

The hop count is a number determined depending on the number of slave devices200to be relayed when communication is performed between the master device100and a slave device200or between the slave devices200. When the master device100or a slave device200communicates with its adjacent device, which may be the master device100or a slave device200, the hop count for this communication is one. For each increase in the number of master device100or the slave devices200that are relayed in the communication, the hop count for that communication also increases by one.

For example, when the master device100communicates with the slave device200a, which are adjacent to each other, the hop count for this communication is counted as one. When the master device100communicates with the slave device200b, the hop count for this communication is counted as two because the number of slave devices200to be relayed is increased by one from the communication between adjacent devices.

The phase difference is the hop count determined depending on the number of slave devices to be relayed when a device communicates with a reference device in the network system1. The phase difference of the reference device itself is set to zero. In the Embodiment 1, the reference device is the master device100, so that the phase difference of the master device100is zero. The phase difference of the slave device200ais one, because it is the hop count determined depending on the number of slave devices200to be relayed when the slave device200ais communicating with the master device100. Similarly, the phase difference of the slave device200bis two, the phase difference of the slave device200cis three, the phase difference of the slave device200dis four, and the phase difference of the slave device200eis five.

The transmission timing determining unit122determines the transmission timing of the cyclic data for the master device100and each of the slave devices200by using the identification information and the phase difference information for each of the slave devices200included in the configuration information acquired by the configuration information acquiring unit121. Here, the transmission timing refers to the timing for a transmission source device to transmit the cyclic data to a transmission destination device. The transmission timing determining unit122determines the transmission timing of the cyclic data for each of the slave devices200so that the communication of the same hop count will be performed at the same timing between a plurality of devices. The transmission timing may be determined as elapsed microseconds in each cyclic communication or as a specific clock time. The determination method of the transmission timing will be described later.

On the basis of the setting information stored in the setting storing unit112, the transmission information generating unit123generates the information of the configuration information request frame to be transmitted from the master device100to each of the slave devices200or the cyclic data to be transmitted from the master device100to the slave devices200during the cyclic communication and stores them in the transmission information storing unit113.

Next, the control unit130will be described. The control unit130includes a transmission control unit131and a time acquiring unit132. In addition to these, the control unit130may have a function for the master device100to perform necessary controls.

The transmission control unit131acquires the time information from the time acquiring unit132and controls the transmission information storing unit113so that the information to be transmitted by the master device100will be transmitted from the communication port101at the time when it should be transmitted.

The time acquiring unit132acquires the time information from a clock (not shown) of the master device100; the master device100and the slave devices200are synchronized with the clock in order to perform communication with the time-sharing method during the cyclic communication. In the communication of the network system1using the time-sharing method for cyclic communication, the transmission and reception of the cyclic data are performed by specifying in advance the time slots within one cycle and the communication that takes place in the respective slots.

Next, the detailed configuration of the slave devices200will be described with reference toFIG.4.FIG.4is a functional block diagram of a slave device200according to Embodiment 1 of this disclosure. Each slave device200includes a storing unit210, a processing unit220, and a control unit230in addition to the communication ports201and202described above.

First, the storing unit210will be described. The storing unit210stores the information to be transmitted and received, as well as the settings for communication. The storing unit210is a device that stores information, the device corresponding to working memory or the like. The storing unit210includes a received information storing unit211, a setting storing unit212, and a transmission information storing unit213.

The received information storing unit211stores the information that the slave device200acquires from the master device100and other slave devices200via the communication ports201or202. This information includes, for example, the information of the configuration information request frame acquired during the configuration information acquisition, the setting information acquired from the master device100during the communication setting, and the information of the cyclic data acquired from the master device100and other slave devices200during the cyclic communication.

The setting storing unit212stores the setting information acquired by a setting information acquiring unit221to be described later, the setting information including the transmission timings of the cyclic data for the cyclic communication and transmitted from the master device100.

The transmission information storing unit213stores the information to be transmitted from the slave device200. This information includes, for example, the information of the configuration information response frame to be transmitted to the master device100during the configuration information acquisition, and the information of the cyclic data to be transmitted during the cyclic communication.

Next, the processing unit220will be described. The processing unit220includes the setting information acquiring unit221and a transmission information generating unit222.

The setting information acquiring unit221acquires the setting information of the transmission timing of the cyclic data from the setting information received from the master device100during the communication setting operation out of the received information stored in the received information storing unit211.

The transmission information generating unit222generates the information of, but not limited to, the configuration information response frame to be transmitted from the slave device200to the master device100or other slave devices200and stores the information in the transmission information storing unit213.

Next, the control unit230will be described. The control unit230includes a transmission control unit231and a time acquiring unit232.

The transmission control unit231acquires the time information from the time acquiring unit232and controls the transmission information storing unit213in such a way that the information stored in the transmission information storing unit213to be transmitted to other devices is transmitted from the communication port201on the master side or the communication port202on the end side at the time when it should be transmitted. As for the communication port to be used for the transmission, the transmission control unit231controls the transmission information storing unit213in such a way that the information to be transmitted is transmitted to the device being the transmission destination of the information from the port that is linked to the destination out of the two ports: the communication port201on the master side and the communication port202on the end side.

The time acquiring unit232acquires the time information from the clock with which the master device100and the slave devices200are synchronized in order to perform communication with the time-sharing method during the cyclic communication.

Next, the operation of the network system1according to Embodiment 1 will be described with reference toFIG.5.FIG.5is a flowchart showing the outline of the operation of the network system1in Embodiment 1.

When the network system1starts its operation, the flow shown inFIG.5is started. First, the master device100determines whether an instruction to start communication is given in Step S1. The network system1repeats Step S1until the instruction to start communication is given. This instruction to start communication is given, for example, by the user to the master device100.

When it is determined in Step S1that the instruction to start communication is given, the flow proceeds to Step S2, where the master device100starts a configuration information acquiring operation.

Here, the configuration information acquiring operation of the network system1will be described.FIG.6is a sequence diagram showing the communications for acquiring configuration information according to Embodiment 1. InFIG.6, the communications performed during the configuration information acquiring operation are shown by arrows in chronological order from top to bottom. The tail of an arrow shows the device that transmits information during the communication, and the head of an arrow shows the device that receives information during the communication. The same is true for the arrows in the sequence diagrams shown below.

InFIG.6, the solid arrows show the communications for the configuration information request frames, and the dotted arrows show the communications for the configuration information response frames.

In the configuration information acquiring operation, the master device100first transmits to the slave device200athe configuration information request frame to request the configuration information necessary for the communication with the slave devices200from the communication port101.

Upon receiving the configuration information request frame, the slave device200aupdates the information of the configuration information request frame and transmits the updated configuration information request frame to the slave device200b. Then, the slave device200atransmits the configuration information response frame to the master device100.

Thereafter, the slave devices200bthrough200dperform the same operation upon receiving the configuration information request frame. Upon receiving the configuration information request frame, the slave device200etransmits the configuration information response frame to the master device100without transmitting the configuration information request frame because the slave device200eis the device located at the end of the network system1.

Through the above operation, all the slave devices200athrough200econstituting the network system1transmit the configuration information response frames to the master device100, where the configuration information acquiring operation of the network system1is completed.

When the configuration information acquisition is completed in Step S2, the flow proceeds to Step S3, and the network system1performs the communication setting operation.

Here, the communication setting operation of the network system1will be described.FIG.7is a sequence diagram showing the communication for communication setting according to Embodiment 1 in the network system1with the same configuration as inFIG.1. InFIG.7, the communications between the devices are shown by arrows in chronological order from top to bottom. InFIG.7, the solid arrows show the communications for the setting information. In the communication setting operation, the master device100first determines the transmission timing of the cyclic data of each of the slave devices200based on the phase difference and the hop count. The determination method of the transmission timing will be described later. Then, the master device100transmits the setting information including the transmission timings of the cyclic data to the slave device200a. Upon receiving the setting information, the slave device200aperforms the communication setting to itself. The communication setting performed by each slave device200is an operation in which each slave device200stores, in its setting storing unit212, information indicating to which device the slave device200transmits the cyclic data in which time slot within one cycle. Then, the master device100transmits the setting information to the slave devices200bto200ein the same way. The slave devices200bthrough200ealso each perform the communication setting to itself in the same way as the slave device200adoes.

After Step S3ofFIG.5, the flow proceeds to Step S4, where the cyclic communication operation of the master device100and the slave devices200is started.

The cyclic communication operation refers to a repetitive communication operation performed in the network system1repeating the cyclic communication, and it is a communication operation that the network system1mainly performs. For example, the master device100transmits instruction information to the slave devices200as cyclic data, and the slave devices200control the sensors and other devices to be monitored based on this instruction information. Also, each of the slave devices200transmits to the master device100and the other slave devices200the values obtained from the monitored devices such as sensors connected to the slave device200as cyclic data.

After the cyclic communication is completed in Step S4, the flow proceeds to Step S5, where the master device100determines whether to end the communication. When the communication is to be ended, the flow inFIG.5is completed, otherwise the flow proceeds to Step S6.

In Step S6, the master device100determines whether the configuration information acquiring operation is needed. If the configuration information acquiring operation is needed, the flow returns to Step S2to repeat the steps up to Step S6until it is determined to end the communication in Step S5. If the configuration information acquiring operation is not needed, the flow returns to Step S4to repeat the steps up to Step S6until it is determined to end the communication in Step S5.

The case where the configuration information acquiring operation is needed is, for example, a case where the master device100is set to check at predetermined intervals whether a new slave device200is added to or an existing slave device200is removed from the network system1and each predetermined interval has elapsed.

The case where the configuration information acquiring operation is not needed is, for example, a case where the master device100is set to check at predetermined intervals whether a new slave device200is added to or an existing slave device200is removed from the network system1and each predetermined interval has not elapsed yet.

The network system1operates as described above.

Next, the details of each operation will be described. First, the operation of the master device100during the configuration acquisition performed in Step S2ofFIG.5will be described.FIG.8is a flowchart showing the operation of the master device100during the configuration information acquisition performed in Step S2ofFIG.5.

InFIG.5, when the instruction for starting the communication is given to the network system1in Step S1, the configuration information acquiring operation is started in Step S2, and the master device100starts the operation of the configuration information acquisition shown inFIG.8.

First, in Step S211, the master device100transmits the configuration information request frame to the slave device200afrom the communication port101via the communication cable3. At this time, the processing unit120of the master device100starts a reception monitoring timer (not shown). The reception monitoring timer, which is a function of the processing unit120, measures the time that has elapsed since the configuration information request frame is transmitted in order to determine the completion of the reception of the configuration information response frame. In Step S211, the processing unit120acquires current time information from the time acquiring unit132and sets this time information as the time when the acquisition of the configuration information response frame is started to activate the reception monitoring timer.

After Step S211, in Step S212, the processing unit120determines whether a configuration information response frame is received. If it is received, in Step S213, the received information storing unit111stores the information of the acquired configuration information response frame.

After Step S213, in Step S214, the configuration information acquiring unit121checks whether the configuration information response frames, which are the responses to the configuration information request frame, have been received from all the slave devices200connected to the network system1, or whether a predetermined time has passed since the reception monitoring timer was started.

The time elapsed since the reception monitoring timer was started is calculated as the difference between current time acquired by the processing unit120from the time acquiring unit132and the time when the acquisition of the configuration information response frames was started in Step S211. The predetermined time should be long enough to receive the configuration information response frames from all the slave devices200and is either pre-specified by the user or pre-stored to the master device100. When the master device100has not yet received from all the slave devices200the configuration information response frames even after this predetermined time, the master device100determines that a time out has occurred.

When the master device100confirms that the reception of the configuration information response frames from all the slave devices200has not been completed and also that the measurement time of the reception monitoring timer has not passed the predetermined time, the flow returns to Step S212to repeat the reception of the configuration information response frames. When the master device100confirms, in Step S214, that the reception of the configuration information response frames from all the slave devices200has been completed or that a time out has occurred since the measurement time of the reception monitoring timer has passed the predetermined time, the flow proceeds Step S215.

In Step S215, the configuration information acquiring unit121acquires the configuration information of the network system1based on the information of the configuration information response frames received up to Step S214and stores it in the setting storing unit112.

Through the operation of Step S211to Step S215described above, the master device100acquires the configuration information of the network system1.

Next, the operation of the slave devices200during the configuration information acquisition will be described.FIG.9is a flowchart showing the operation of each slave device200during the configuration information acquisition performed in Step S2ofFIG.5.

In Step S221, the communication port201on the master side acquires the configuration information request frame transmitted from the master device100, and stores it in the received information storing unit211. When the slave device200has received the configuration information request frame, the operation flow proceeds to Step S222.

In Step S222, the processing unit220of the slave device200determines whether the slave device200itself is the slave device200elocated at the end of the line connection in the network system1. Whether it is the slave device200elocated at the end of the line connection can be determined, for example, by checking whether the communication cable3is connected to the communication port202on the end side or by referring to the configuration information and so on previously notified by the master device100. When the slave device200determines that the slave device200itself is not the slave device200elocated at the end of the line connection, the flow proceeds to Step S223. When the slave device200determines that the slave device200itself is the slave device200elocated at the end of the line connection, the flow proceeds to Step S225.

In Step S223, the transmission information generating unit222of the slave devices200acquires and updates the configuration information request frame stored in the received information storing unit211. The transmission information generating unit222stores the updated configuration information request frame in the transmission information storing unit213.

Here, the configuration information request frame will be described with reference toFIG.10.FIG.10is an explanatory drawing showing the information contained in the configuration information request frame.FIG.10shows, in chronological order from top to bottom, the information contained in the configuration information request frames that are initiated by the master device100and relayed down to the slave device200elocated at the end of the line connection. As shown inFIG.10, the configuration information request frame contains the identification information of the transmission source device, the identification information of the transmission destination device, and the hop count when the master device100and the transmission source device communicate with each other. Specifically, the first row shows the configuration information request frame transmitted from the master device100to the slave device200a. In this transmission, the hop count included in the configuration information request frame to be transmitted is zero. The second row shows the configuration information request frame to be transmitted from the slave device200ato the slave device200b. In this transmission, the hop count included in the configuration information request frame to be transmitted is one. Similarly, the third row shows the configuration information request frame to be transmitted from the slave device200bto the slave device200c; the fourth row shows the configuration information request frame to be transmitted from the slave device200cto the slave device200d; and the fifth row shows the configuration information request frame to be transmitted from the slave device200dto the slave device200e. As shown inFIG.10, each slave device200adds one to the hop count of the received configuration information request frame when updating it in Step S223. For example, when the configuration information request frame with the information of the hop count zero is received from the master device100, the slave device200aupdates the configuration information request frame by rewriting the identification information of the transmission source device to S1, which is the identification information of the slave device200aitself, the identification information of the transmission destination device to S2, which is the identification information of the slave device200bbeing the next destination of the transmission, and the hop count to one by adding one.

In Step S224, the updated configuration information request frame stored in the transmission information storing unit213is transmitted from the communication port202on the end side to another slave device200. For example, the slave device200atransmits, to the slave device200b, the configuration information request frame with the identification information of the transmission source device, or S1, the identification information of the transmission destination device, or S2, and the updated hop count, or one.

In Step S225, the updated configuration information response frame stored in the transmission information storing unit213is transmitted from the communication port201on the master side.

Here, the configuration information response frame will be described with reference toFIG.11.FIG.11is an explanatory drawing showing the information contained in the configuration information response frames.FIG.11shows, in chronological order from top to bottom, the information contained in the configuration information response frames that are transmitted from each of the slave devices200to the master device100. As shown inFIG.11, each configuration information response frame contains the identification information of the transmission source device, the identification information of the transmission destination device, and the hop count when the master device100and the transmission source device communicate with each other.

The master device100can acquire the configuration information of the network system1by performing the operation from Step S221to Step S225described above with all the slave devices. When all the slave devices200ato200ethat constitute the network system1have transmitted its configuration information response frame to the master device100, the configuration information acquiring operation of the network system1is completed.

When the configuration information acquiring operation of the network system1is completed, the configuration information for the communication setting operation is stored in the master device100. Here, the configuration information acquired by the master device100is shown inFIG.12.FIG.12is an explanatory drawing showing the configuration information acquired by the master device100according to Embodiment 1. The configuration information acquiring unit121of the master device100can acquire, from the information of the configuration information response frames shown inFIG.11, the identification information of each of the slave devices200, and the hop count of each of the slave devices200when it communicates with the master device100. The hop count when each of the slave devices200communicates with the master device100is the phase difference of each of the slave devices200. Thus, the master device100can acquire the identification information of each of the slave devices200and the phase difference corresponding to the identification information of each of the slave devices200, as shown inFIG.12.

Next, the operation of the master device100during the communication setting in Step S3will be described.FIG.13is a flowchart showing the operation of the master device100during the communication setting.

First, in Step S301, the transmission timing determining unit122of the master device100determines, based on the configuration information stored in the setting storing unit112, the transmission timing for each device to transmit the cyclic data during the cyclic communication.

Here, the determination method for the transmission timing determining unit122to determine the transmission timing will be described in detail with reference toFIG.14.FIG.14is a diagram illustrating the determination method of the transmission timing. InFIG.14, the hop count of the communication and the phase difference of the transmission source device are acquired from the information included in the configuration information.

For each communication from a transmission source device to a transmission destination device, the transmission timing determining unit122calculates the remainder of the phase difference of the transmission source device divided by the hop count of the communication that can be performed by the transmission source device. The transmission timing determining unit122determines the transmission timing of the cyclic data of each of the slave devices200after calculating the remainder of the phase difference of each of the slave devices200divided by the hop count of the communication that can be performed by the slave device200.

In a case where the transmission timing determining unit122is determining the transmission timings of a first slave device200and a second slave device200that each are about to perform separate communication of the same hop count, and then if the remainder of the phase difference of the first slave device200divided by the hop count and the remainder of the phase difference of the second slave device200divided by the hop count are the same, the transmission timing determining unit122determines the transmission timings of the first slave device and the second slave device so that their transmission timings will be the same. For example, in a case where the transmission timing determining unit122is determining the transmission timings of the slave device200aand the slave device200bthat each are about to separately perform one-hop communication with another device, the remainder of the phase difference of the slave device200adivided by the hop count is zero because the phase difference is one and the hop count is one and the remainder of the phase difference of the slave device200bdivided by the hop count is zero because the phase difference is two and the hop count is one. That is, the remainders with respect to the communication that these two devices are to perform are the same. Therefore, as shown inFIG.14, the transmission timing determining unit122determines the transmission timings of the slave device200aand the slave device200bto be the same timing, which is T1.

In a case where the transmission timing determining unit122is determining the transmission timings of the first slave device200and the second slave device200that each are about to separately perform communication of the same hop count, and then if the remainder of the phase difference of the first slave device200divided by the hop count and the remainder of the phase difference of the second slave device200divided by the hop count are not the same, the transmission timing determining unit122determines the transmission timings of the first slave device and the second slave device so that their transmission tasks will be performed at the different timings. For example, as shown inFIG.14, the remainder of the phase difference divided by the hop count is zero when the slave device200bwith its phase difference two is about to perform communication of the hop count two, and then the transmission timing T2is allotted this communication. When the slave device200awith its phase difference one is about to perform communication of the hop count two, the remainder of the phase difference divided by the hop count is one, and then the transmission timing T3is allotted this communication.

When the first slave device200and the second slave device200are about to perform separate communication each with a different hop count from the other, the transmission timing determining unit122allots different transmission timings for their communication tasks. As shown in the rows ofFIG.14, for example, the communication with the hop count one is assigned the transmission timing T1, and the communication with the hop count two to five is assigned the transmission timings other than the transmission timing T1. Options of the transmission timings such as T1through T9to be assigned may be stored in the master device100in advance.

In Embodiment 1, as illustrated inFIG.14, it is shown that the transmission timings are determined so that, in the communication with the same hop counts, all the devices with the same remainders of the phase differences divided by the respective hop counts will be assigned the same transmission timings. However, even if the transmission timings are determined so that a plurality of the devices will be assigned the same transmission timings by selecting at least one of the hop counts possible in the communication, the communication efficiency can be improved.

Also note that the transmission timing determining unit122only needs to determine the transmission timing of the cyclic data for each device so that the communication of the same hop counts will be performed at the same timings. In doing so, however, the transmission timing determining unit122does not necessarily need to use the remainders. For example, when determining the transmission timings of the first slave device and the second slave device to perform separate communication of the same hop count, the transmission timings of the first slave device and the second slave device may be set to the same timing when the phase difference subtracted by the hop count of the first slave device and the phase difference of the second slave device are the same. In this method as well, the result is that the communication of the same hop count is performed at the same time. This also can improve the communication efficiency. In this configuration, however, when the remainder of the phase difference of the first slave device divided by the hop count and the remainder of the phase difference of the second slave device divided by the hop count are different, if, of the first slave device and the second slave device, the transmission timing of the slave device whose remainder of the phase difference divided by the hop count is smaller than the other is set to be earlier than the transmission timing of the slave device whose remainder of the phase difference divided by the hop count is larger than the other, it is possible to further reduce the unused lines to improve the communication efficiency.

After Step S301, in Step S302, the setting information for each of the slave devices200is generated by using the determined transmission timing information. Specifically, the transmission information generating unit123generates the data in which the identification information and the setting information for each of the slave devices200are associated with each other and stores the generated data in the transmission information storing unit113. Here, the contents of the setting information will be described based onFIG.15.FIG.15is a diagram showing the contents of the setting information according to Embodiment 1. The information for the transmission of the cyclic data, that is, the identification information of the transmission source device, the transmission timing information, and the identification information of the transmission destination device are associated with each other and stored in the transmission information storing unit113as the setting information.

After Step S302, in Step S303, the master device100transmits the setting information stored in the transmission information storing unit113to the slave devices200via the communication port101. As described above, the master device100determines the transmission timing for all the communication to be performed by all of the transmission source devices.

Next, the operation of the master device100and the slave devices200during the cyclic communication in Step S4will be described with reference toFIG.16.FIG.16is a flowchart showing the operation of the master device100and each of the slave devices200during the cyclic communication.

When the communication setting operation of Step S3inFIG.5is completed, each device starts the operation of the cyclic communication. In Step S401, the processing unit120of the master device100acquires the time information from the time acquiring unit132and determines whether it is time to transmit the cyclic data based on the setting information stored in the setting storing unit112. Similarly, the processing unit220of each of the slave devices200acquires the time information from the time acquiring unit232and determines whether it is time to transmit the cyclic data based on the setting information stored in the setting storing unit212. The master device100and the slave devices200repeat the determination in Step S401until the transmission timing is reached. When the master device100and the slave devices200determine that it is the transmission timing, the flow proceeds to Step S402.

In Step S402, the processing unit120of the master device100and the processing unit220of each of the slave devices200transmit the cyclic data to the transmission destination device corresponding to the transmission timing based on the setting information. This cyclic data may be a numerical value or a character string.

In Step S403, the processing unit120of the master device100and the processing unit220of each of the slave devices200determine whether it is time to end the cyclic communication. Until the end time of the cyclic communication, the master device100and the slave devices200repeat the operations of Step S401and Step S402.

In Step S403, the processing unit120of the master device100acquires the time information from the time acquiring unit132and determines whether it is time to end the cyclic communication operation based on the setting information stored in the setting storing unit112. If it is the time, the master device100ends the cyclic communication operation. The processing unit220of each of the slave devices200acquires the time information from the time acquiring unit232and determines whether it is time to end the cyclic communication operation based on the setting information stored in the setting storing unit212. If it is the time, the slave device200ends the cyclic communication operation.

Here, when all the devices are to share the cyclic data during the cyclic communication in the network system1that includes the master device100and the plurality of slave devices200, the effects of the master device100and the communication method according to Embodiment 1 for the improvement of the line usage rate will be described.

FIG.17is a sequence diagram showing an example of the cyclic communication when the communication method according to Embodiment 1 is not applied. InFIG.17, the arrows show the communication between the devices. The communication slots assigned to the respective combinations of devices are shown in chronological order from top bottom. In each cycle in which the communication shown by the arrow is performed, the shaded areas show the lines that are not in use for the communication. As shown inFIG.17, the system without the communication devices according to Embodiment 1 has lots of unused lines. For example, during the cycle when the master device100and the slave device S1are in communication, the lines from the slave device S1to the slave device S5are not in use.

In contrast,FIG.18is a sequence diagram showing the cyclic communication when the communication method according to Embodiment 1 is applied to the network system1with the same configuration as inFIG.17. As inFIG.17, the arrows show the communications between the devices and the shaded areas show the lines that are not in use during the communications shown by the arrows. The master device100according to Embodiment 1 determines the transmission timings of the cyclic data to be set to the slave devices200so that the plurality of slave devices200will perform the communication of the same hop count at the same timing. Therefore, in the cycle during which the master device100and a certain slave device200is in one-to-one communication, communications are allotted to unused lines between other devices. Therefore, from the comparison of the numbers of the unused lines betweenFIG.17andFIG.18in the time period from the start of communication to the completion of all communication, it is understood that the number of unused lines is lower when the communication method according to Embodiment 1, shown inFIG.18, is applied. Thus, the application of the communication method according to Embodiment 1 reduces the number of unused lines when the distances between the devices communicating to share the cyclic data are short.

In addition, in the communication of the same hop count, if the communication takes the same unit of time, the time required to complete the cyclic communication is shorter by six time units in the cyclic communication shown inFIG.18, to which the communication method according to Embodiment 1 is applied, than in the cyclic communication shown inFIG.17, to which the communication method according to Embodiment 1 is not applied. This is achieved by the improvement of utilization of the lines. That is, the application of the communication method according to Embodiment 1 will shorten also the time to complete the communication cycles. The shorter time to complete the communication cycles contributes to suppress the increase in the communication cycles even when the number of devices in the network system1increases. This leads to high-speed communication in a large-scale network system1with a large number of devices.

As described so far, when performing the communication to share the cyclic data, the master device100determines the transmission timing of the cyclic data to be set to each of the slave devices200based on the phase difference of each of the slave devices200and the hop count determined depending on the number of slave devices200to be relayed so that the plurality of slave devices200will perform the communication of the same hop count at the same timings. As a result, the usage rate of the lines is improved, and the communication efficiency of the network system1is improved.

Next, the hardware configuration of the master device100and the slave devices200according to Embodiment 1 will be described with reference toFIG.19.FIG.19is a hardware configuration diagram of the master device100and the slave devices200according to Embodiment 1. The master device100and the slave devices200each include an input device901, an output device902, a storage device903, and a processing device904.

The input device901is an interface included in each of the communication port101of the master device100and the communication ports201and202of the slave devices200, to receive the information inputted. This interface works with both wired communication networks using LAN cables or coaxial cables, and wireless communication networks using wireless communication technologies.

The output device902is an interface included in the communication port101of the master device100and the communication ports201and202of each of the slave devices200, to output the information therefrom. This network may be a wired communication network using LAN cables or coaxial cables or a wireless communication network using wireless communication technologies.

The storage device903is an information storing device included in the storing unit110of the master device100and the storing unit210of each of the slave devices200. Examples of the storage device903include a non-volatile or volatile semiconductor memory such as RAM, ROM, and a flash memory, as well as a magnetic disk, a flexible disk, an optical disk, and a compact disk.

The processing device904is included in the processing unit120and the control unit130of the master device100, and the processing unit220and the control unit230of each of the slave devices200. The processing device904may be dedicated hardware or a Central Processing Unit (CPU) to execute a program stored in the storage device903.

The processing device904as dedicated hardware is, for example, a single circuit, a composite circuit, a programed processor, a parallel programed processor, an ASIC, an FPGA, or a combination thereof.

The functions of the processing device904as a CPU are realized by software, firmware, or the combination thereof. The software and the firmware are written as a program and stored in the storage device903. The processing device904realizes the functions of each unit by reading and executing the program stored in the storage device903.

The functions of the processing device904may be realized partly by the hardware and partly by the software or the firmware.

For example, the control unit130of the master device100may be configured as dedicated hardware and the processing unit120thereof may be configured as a CPU executing the program stored in the storage device903to realize the functions of the master device100.

Thus, the functions of the processing device904, described above, can be realized by hardware, software, firmware, or the combination thereof.

As described so far, according to the master device100and the communication method of this disclosure, when performing the communication to share the cyclic data, the master device100determines the transmission timing of the cyclic data to be set to each of the slave devices200based on the phase difference of each of the slave devices200and the hop count determined depending on the number of slave devices200to be relayed so that the plurality of slave devices200will perform the communication of the same hop count at the same timings. As a result, the usage rate of the lines is improved, and the communication efficiency of the entire network system1is improved.

DESCRIPTION OF SYMBOLS