Communication system and communication method
The communication system automates the setting of slave device addresses using random numbers and identification information, enhancing efficiency and reducing manual work in serial communication systems.
Patent Information
- Application Number
- JP2024097555
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2026-01-05
AI Technical Summary
Setting communication addresses for multiple slave devices in serial communication systems requires manual work, which is cumbersome and inefficient.
A communication system and method that automates the setting of communication addresses by using a master device to generate random numbers based on unique identification information, determine communication conditions, and control the slave devices to transmit responses, allowing the master device to set unique addresses automatically.
Automates the setting of communication addresses, reducing manual labor and eliminating the need for cumbersome manual adjustments, thereby improving efficiency and accuracy.
Smart Images

Figure 2026000292000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a communication system and a communication method, and more particularly to a communication system and a communication method capable of automatically setting the communication addresses of a plurality of slave devices that perform serial communication with a master device. [Background technology]
[0002] 2. Description of the Related Art In recent years, serial communication systems that use Modbus (registered trademark) communication, which is a general-purpose communication protocol, have become known.
[0003] In this serial communication system, multiple slave devices can be connected to one master device, but the master device can only communicate with one slave device at a time. Therefore, each of the multiple connected slave devices must be assigned a unique communication address that is unique within the system. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] Japanese Patent Publication No. 2023-18732 [Patent Document 2] Patent Publication No. 2021-158412 [Patent Document 3] JP 2019-4400 A [Patent Document 4] Japanese Patent Application Publication No. 2019-118012 [Patent Document 5] Japanese Patent Application Laid-Open No. 2012-169800 Summary of the Invention [Problem to be solved by the invention]
[0005] However, conventionally, it has been necessary to set the communication address for each slave device in advance (such as during installation work or on-site adjustment work for the slave device) by operating a setting switch.
[0006] As described above, setting communication addresses requires manual work, and setting communication addresses for multiple slave devices is extremely cumbersome.
[0007] An object of the present invention is to provide a communication system and a communication method that can automate the setting of a communication address for each slave device and improve the efficiency of the work involved in setting the communication address. [Means for solving the problem]
[0008] In order to solve the above problem, claim 1 of the present invention provides a communication system for transmitting and receiving communication data between a master device and a plurality of slave devices, wherein the plurality of slave devices include a transmitting circuit for transmitting communication data to the master device, a receiving circuit for receiving communication data from the master device, a random number generator for generating random numbers according to specific information associated with identification information unique to each device, a communication condition determination unit for determining predetermined communication conditions based on the random numbers generated by the random number generator, and a control unit for controlling the transmitting circuit to transmit a response to the communication data received by the receiving circuit to the master device in accordance with the predetermined communication conditions determined by the communication condition determination unit. and a control circuit for controlling the master device to request the slave devices, which have the same communication address pre-assigned as an initial value, to transmit the identification information, and to receive an initial response to the request via the receiving circuit; and the master device is characterized in that the control circuit in the master device changes the initial value of the corresponding slave device to a unique setting value in accordance with the identification information included in the response received by the receiving circuit, thereby enabling automatic setting of the communication address.
[0009] Claim 2 is characterized in that the identification information is a serial number unique to each device, and the specific information is determined based on the serial number and the current time.
[0010] A third aspect of the present invention is characterized in that the predetermined communication condition is a communication response delay time until a response is returned.
[0011] Claim 4 is characterized in that, in the master device, the control circuit creates a registration list in which the initial values and the setting values are registered in advance when automatically setting the communication addresses of the multiple slave devices.
[0012] Claim 5 is a communication method for a communication system that transmits and receives communication data between a master device and a plurality of slave devices, comprising: first, a step in which the master device requests the plurality of slave devices, each of which has been assigned the same communication address as an initial value in advance, to transmit identification information unique to each device; and, in response to this request, the plurality of slave devices transmit a response to the request from the master device in accordance with predetermined communication conditions that are determined based on a random number corresponding to specific information associated with the identification information unique to each device. In response to this response, the master device changes the initial value of the corresponding slave device to a unique setting value in accordance with the identification information included in the response, thereby enabling automatic setting of the communication address. [Effects of the Invention]
[0013] According to the present invention, it is possible to provide a communication system and a communication method that can automate the setting of a communication address for each slave device and improve the efficiency of the work related to setting the communication address. [Brief explanation of the drawings]
[0014] [Figure 1] 1 is a schematic diagram illustrating an example of the configuration of a serial communication system according to an embodiment of the present invention. [Figure 2] 1 is a block diagram illustrating an example of the configuration of a serial communication system according to an embodiment of the present invention. [Figure 3] 10 is a flowchart shown for explaining the operation of a master device when setting a slave address in the serial communication system according to the present embodiment. [Figure 4] 10 is a flowchart shown for explaining the operation of a slave device when a slave address is set in the serial communication system according to the present embodiment. [Figure 5] FIG. 2 is a diagram showing an example (at the time of creation) of a registration list of slave addresses in the serial communication system according to the present embodiment. [Figure 6]1 shows an example of a registration list in the serial communication system of this embodiment, where FIG. 1(a) shows the state when the serial number information of the first slave device is added, and FIG. 1(b) shows the state when the slave address setting information of the first slave device is added. [Figure 7] 1 shows an example of a registration list in the serial communication system of this embodiment, where FIG. 1(a) shows the state when serial number information of a second slave device is added, and FIG. 1(b) shows the state when slave address setting information of a second slave device is added. [Figure 8] 1 shows an example of a registration list in the serial communication system of this embodiment, where FIG. 1(a) shows the state when serial number information of the 31st slave device is added, and FIG. 1(b) shows the state when slave address setting information of the 31st slave device is added. DETAILED DESCRIPTION OF THE INVENTION
[0015] A communication system and a communication method according to an embodiment of the present invention will be described in detail below with reference to the drawings. Note that the description will be given taking as an example a case in which a master device automatically sets the slave address (communication address) of a slave device in a serial communication system that uses the Modbus (registered trademark) method as the communication protocol.
[0016] Embodiment 1 shows a schematic configuration of a serial communication system 1 according to this embodiment. This serial communication system 1 includes, for example, one master device 10 and multiple slave devices 20, each of which is made up of a watt-hour meter compatible with the Modbus communication protocol, for measuring the amount of electricity used by each load 30.
[0017] As an example, 31 slave devices 20(001), 20(002), 20(003), . . . , 20(031) are connected to one master device 10 via, for example, a network-connected serial line 34.
[0018] Therefore, in the case of the serial communication system 1 according to this embodiment, electricity is supplied from the electric wire 32 to a maximum of 31 loads 30 via the slave devices 20(001), 20(002), 20(003), ..., 20(031) individually.
[0019] FIG. 2 illustrates a block configuration of a serial communication system 1 according to this embodiment.
[0020] On the other hand, the master device 10 sequentially transmits and receives signals (communication data) to and from 31 slave devices 20(001), 20(002), 20(003), ..., 20(031), and includes, for example, a control circuit 11, a transmission circuit 12, a reception circuit 13, and a memory unit 14, as shown in FIG. 2.
[0021] The control circuit 11 controls each part in the master device 10, for example, to automatically set communication addresses for 31 slave devices 20(001), 20(002), 20(003), ..., 20(031), and to create a registration list (described later).
[0022] The transmission circuit 12 is controlled by the control circuit 11, and transmits signals (transmission data) by unicast to, for example, 31 slave devices 20(001), 20(002), 20(003), ..., 20(031) via the serial line 34. For example, signals transmitted by unicast as transmission data include a request for a serial number unique to a slave device (serial number read message) and a slave address setting message accompanying the creation of a registration list (details will be described later).
[0023] The receiving circuit 13 is controlled by the control circuit 11 and receives signals (responses) from, for example, 31 slave devices 20(001), 20(002), 20(003), . . . , 20(031) via the serial line 34.
[0024] The storage unit 14 is controlled by the control circuit 11 and has an address setting table storage unit 14a that stores an address setting table (not shown) and an address setting information storage unit 14b that stores a registration list, etc. In the address setting table, for example, data on the number of registered slave devices 20(001), 20(002), 20(003), ..., 20(031) (information on the number of devices), various telegrams, etc. are registered in advance for automatically setting communication addresses.
[0025] On the other hand, the 31 slave devices 20(001), 20(002), 20(003), ..., 20(031) each have the same configuration. That is, like the illustrated slave device 20(001), each includes a control circuit 21 that also functions as a watt-hour meter, a transmission circuit 22, a reception circuit 23, a storage unit 24, a random number generator 25, a communication condition determination unit 26, and a time information management unit 27.
[0026] The control circuit 21 controls each part of the corresponding slave device 20(001), 20(002), 20(003), ..., 20(031), and, for example, sets its own communication address in response to a signal from the master device 10.
[0027] The transmission circuit 22 is controlled by the control circuit 21, and transmits a signal (response data) to, for example, the master device 10 via the serial line 34. For example, the response data transmitted to the master device 10 may include a serial number (identification information) specific to the slave device corresponding to the serial number readout message, a communication address (slave address setting value) corresponding to the slave address setting message, etc. (details will be described later).
[0028] The receiving circuit 23 is controlled by the control circuit 21 and receives a signal from, for example, the master device 10 via a serial line 34 .
[0029] The storage unit 24 is controlled by the control circuit 21 and includes a manufacturing information storage unit 24a and an address storage unit 24b. The manufacturing information storage unit 24a stores, for example, a manufacturing number unique to each slave device. The address storage unit 24b stores a unique communication address that is unique within the serial communication system 1.
[0030] In this embodiment, the same slave address (for example, 001) is assigned as a temporary address (initial value) to each of the 31 slave devices 20(001), 20(002), 20(003), ..., 20(031) at the time of shipment. This same slave address is temporarily stored in, for example, the address storage unit 24b.
[0031] The random number generator 25 is controlled by the control circuit 21, and when a communication address is set, generates a random number according to unique specific information (e.g., serial number + current time) associated with the serial number specific to the slave device, with a seed value of "n".
[0032] The communication condition determination unit 26 is controlled by the control circuit 21, and sets, for example, a communication response delay time (predetermined communication condition) based on the random number generated by the random number generator 25.
[0033] The time information management unit 27 is controlled by the control circuit 21 and manages, for example, the current time in order to calculate unique specific information used in generating random numbers in the random number generator 25 .
[0034] Fig. 3 is a flowchart showing the operation of the master device 10 when automatically setting communication addresses unique to the slave devices in the serial communication system 1 according to this embodiment. Fig. 4 is a flowchart showing the operation of the slave devices 20(001), 20(002), 20(003), ..., 20(031).
[0035] In this embodiment, when the master device 10 automatically sets the communication addresses of the slave devices 20(001), 20(002), 20(003), ..., 20(031), first, as shown in FIG. 3, the master device 10 creates a registration list (step S01).
[0036] Here, the registration list is used to manage the communication addresses of all slave devices 20(001), 20(002), 20(003), ..., 20(031) in the serial communication system 1, and is created based on information about the number of devices registered in advance. This registration list is also used when automatically setting the communication addresses of all slave devices 20(001), 20(002), 20(003), ..., 20(031).
[0037] As shown in FIG. 5, the registration list includes the following items for each slave device 20(001), 20(002), 20(003), ..., 20(031): registration number, setting status, serial number, slave address (setting value), slave address (initial value), transmission data, response data, and remarks.
[0038] In this registration list, the registration numbers are serial numbers assigned to the slave devices 20(001), 20(002), 20(003), . . . , 20(031) in the serial communication system 1, respectively.
[0039] The setting status indicates whether the communication addresses of the slave devices 20(001), 20(002), 20(003), . . . , 20(031) have been set (setting completed) or not (not set).
[0040] The serial number is identification information unique to each slave device 20(001), 20(002), 20(003), . . . , 20(031).
[0041] The slave address (setting value) is the communication address of each slave device 20(001), 20(002), 20(003), ..., 20(031) that is automatically set, and in the present embodiment, a unique communication address that does not overlap within the serial communication system 1 is assigned in advance.
[0042] The slave address (initial value) is the same communication address (temporary address) assigned to the slave devices 20(001), 20(002), 20(003), . . . , 20(031) at the time of shipment, for example.
[0043] The transmission data is communication data transmitted from the master device 10 to each of the slave devices 20(001), 20(002), 20(003), . . . , 20(031).
[0044] The response data is communication data transmitted from each of the slave devices 20(001), 20(002), 20(003), . . . , 20(031) to the master device 10, and is mainly a response to the data transmitted from the master device 10.
[0045] As described above, once the registration list is created in the master device 10, the master device 10 then transmits a serial number readout message (for example, transmission data "01******") to all slave devices 20(001), 20(002), 20(003), ..., 20(031) that have the same slave address (001) set as the initial value, as shown in step S02 of Fig. 3. After transmitting the serial number readout message, the master device 10 then enters a standby state until it receives a response from the slave devices 20(001), 20(002), 20(003), ..., 20(031).
[0046] In response to this, as shown in FIG. 4, for example, in the slave devices 20(001), 20(002), 20(003), ..., 20(031) that have received the serial number readout message from the master device 10 (YES in step S11), first, the serial number unique to each device is read out from the serial number storage unit 24a. The current time is also read out from the time information management unit 27. Then, based on unique identification information (seed value) corresponding to the serial number and the current time, a random number is generated in the random number generator 25 (step S12).
[0047] Next, the communication condition determining unit 26 sets a communication response delay time (predetermined communication condition) in accordance with the random number generated by the random number generator 25 (step S13).
[0048] Next, after waiting for the communication response delay time set by communication condition determination unit 26 to elapse (YES in step S14), response data including the serial number stored in manufacturing information storage unit 24a is transmitted to master device 10 (step S15). As a result, slave devices 20(001), 20(002), 20(003), ..., 20(031), which have finished transmitting the response data, enter a standby state until a slave address setting message is transmitted from master device 10.
[0049] That is, in the case of the slave device 20(001) corresponding to the registration number "001", for example, as shown in FIG. 6, it will enter a standby state after transmitting response data "01****0000003**" including the serial number "0000003" to the master device 10.
[0050] Similarly, in the case of the slave device 20(002) corresponding to the registration number "002," for example, as shown in FIG. 7, it transmits response data "01****0000015**" including the serial number "0000015" to the master device 10 and then goes into standby mode.
[0051] Similarly, in the case of the slave device 20(031) corresponding to the registration number "031," for example, as shown in FIG. 8, it transmits response data "01****0000027**" including the serial number "0000027" to the master device 10 and then goes into standby mode.
[0052] In response to this, for example, as shown in FIG. 3, in the master device 10 that has received response data from the slave devices 20(001), 20(002), 20(003), ..., 20(031) (YES in step S03), for example, as shown in FIG. 6(a), the serial number "0000003" is added to the item of the slave device 20(001) corresponding to the registration No. "001" whose setting status in the registration list is "not set" and which was first received as a response to the transmission of the serial number readout message, and the setting status is changed from "not set" to "not set (serial number acquired)" (step S04).
[0053] 3, for example, the master device 10 transmits a slave address setting message (for example, transmission data "01**0000003002**") based on the serial number "0000003" and slave address (setting value) "002" to all slave devices 20(001), 20(002), 20(003), ..., 20(031) that have the same slave address (001) set as the initial value. As a result, the master device 10, which has finished transmitting the slave address setting message, enters a standby state until it receives a response from the slave devices 20(001), 20(002), 20(003), ..., 20(031).
[0054] In response to this, for example, as shown in FIG. 4, the slave devices 20(001), 20(002), 20(003), ..., 20(031) that have received the slave address setting message from the master device 10 (YES in step S16) each check whether the serial number "0000003" in the message matches the serial number "0000003" stored in the manufacturing information storage unit 24a.
[0055] If the serial numbers of the slave devices 20(002), 20(003), . . . , 20(031) do not match (NO in step S17), the received message is discarded (step S18).
[0056] Furthermore, if a match is confirmed (YES in step S17), the slave address (set value) "002" in the message is set in the address storage unit 24b, and then response data "01****0000003002YYYYMMHHSS**" including the slave address (set value) "002" is transmitted to the master device 10 (step S19).
[0057] In response to this, for example, as shown in FIG. 3, upon receiving the response data "01****0000003002YYYYMMHHSS**" from the slave device 20 (001), the master device 10 changes the setting status of the corresponding item in the registration list to "Setting Complete" (step S06), for example, as shown in FIG. 6(b).
[0058] In this way, the setting status in the registration list corresponding to the slave device 20(001) is changed to "setting complete", thereby completing the automatic setting of the communication address of the slave device 20(001) (setting and registration of the first device).
[0059] When the setting and registration of the first device is completed (YES in step S07), steps S01 to S06 in FIG. 3 and steps S11 to S19 in FIG. 4 are repeated in the same manner, and this time, automatic setting of the communication address of the slave device 20(002) (setting and registration of the second device) is performed, as shown in FIGS. 7(a) and (b).
[0060] After this, the automatic setting of communication addresses is repeated for the third to thirtieth devices in the same manner, and finally, as shown in Figures 8(a) and (b), the automatic setting of the communication address of the slave device 20 (031) (setting and registration of the 31st device) is performed (NO in step S07).
[0061] As described above, according to this embodiment, the setting of the communication addresses for each of the slave devices 20(002), 20(003), ..., 20(031) can be automated, and the work involved in setting the communication addresses can be made more efficient.
[0062] That is, the slave devices 20(001), 20(002), 20(003), ..., 20(031) serially connected to the master device 10 are requested to transmit their respective unique serial numbers, and in the slave devices 20(001), 20(002), 20(003), ..., 20(031) that respond, the slave addresses (setting values) corresponding to the serial numbers are registered as communication addresses.
[0063] This eliminates the need for the cumbersome manual work required up until now of setting a communication address for each of the slave devices 20(001), 20(002), 20(003), ..., 20(031) by operating a setting switch in advance, such as during installation work or on-site adjustment work of the slave devices 20(001), 20(002), 20(003), ..., 20(031).
[0064] Therefore, the work involved in setting the communication addresses of the slave devices 20(001), 20(002), 20(003), ..., 20(031) can be greatly simplified, and the manual setting of duplicate or incorrect communication addresses within the system can be eliminated, thereby improving the efficiency of the work.
[0065] In particular, the communication response delay time until the serial number is transmitted is changed in slave devices 20(001), 20(002), 20(003), ..., 20(031) according to a random number based on the serial number and the current time. This makes it easy to reset the time until the serial number is transmitted so that it is different from one device to the next.
[0066] In the case of the serial communication system 1 according to this embodiment, the slave addresses are automatically set in descending order for the slave devices 20(001), 20(002), 20(003), ..., 20(031), but it goes without saying that the present invention is not limited to this.
[0067] Furthermore, the slave devices 20(001), 20(002), 20(003), ..., 20(031) are not limited to watt-hour meters, and may be various measuring instruments compatible with the Modbus communication protocol, for example. [Explanation of symbols]
[0068] 1 Serial Communication System 10 Master Device 11 Control circuit 12 Transmitting circuit 13 Receiving circuit 14 Storage section 14a Address setting table storage section 14b Address setting information storage section 20 Slave device (power meter) 21 Control circuit 22 Transmitting circuit 23 Receiving circuit 24 Memory section 24a Manufacturing information storage section 24b Address storage section 25 Random Number Generator 26 Communication condition determination unit 27 Time information management department
Claims
1. A communication system for transmitting and receiving communication data between a master device and a plurality of slave devices, The plurality of slave devices include: a transmission circuit for transmitting communication data to the master device; a receiving circuit for receiving communication data from the master device; a random number generator that generates random numbers according to specific information associated with identification information unique to each device; a communication condition determination unit that determines predetermined communication conditions based on the random number generated by the random number generator; a control circuit that controls the transmission circuit to transmit a response to the communication data received by the reception circuit to the master device in accordance with the predetermined communication conditions determined by the communication condition determination unit; Each of them has The master device a transmission circuit for transmitting communication data to the plurality of slave devices; a receiving circuit for receiving communication data from the plurality of slave devices; a control circuit that controls the transmission circuit to request the plurality of slave devices to which the same communication address is assigned in advance as an initial value to transmit the identification information, and to receive an initial response to this request via the reception circuit; Equipped with In the master device, the control circuit changes the initial value of the corresponding slave device to a unique setting value in accordance with the identification information contained in the response received by the receiving circuit, thereby enabling automatic setting of the communication address.
2. 2. The communication system according to claim 1, wherein the identification information is a serial number unique to each device, and the specific information is determined based on the serial number and the current time.
3. 2. The communication system according to claim 1, wherein the predetermined communication condition is a communication response delay time until a response is returned.
4. 2. The communication system according to claim 1, wherein in the master device, the control circuit creates a registration list in which the initial values and the setting values are pre-registered when automatically setting the communication addresses of the plurality of slave devices.
5. A communication method for a communication system that transmits and receives communication data between a master device and a plurality of slave devices, comprising: First, the master device requests the plurality of slave devices, to which the same communication address has been assigned as an initial value in advance, to transmit identification information unique to each device; In response to the request, the plurality of slave devices transmit a response to the request to the master device in accordance with predetermined communication conditions determined based on random numbers corresponding to specific information associated with identification information unique to each device; and In response to this response, the master device changes the initial value of the corresponding slave device to a unique setting value according to the identification information contained in the response, thereby enabling automatic setting of the communication address.
Citation Information
Patent Citations
Communication system
JP2012169800A
Address setting device and system
JP2019004400A
Serial communication system and communication apparatus
JP2019118012A
Address setting device and system
JP2021158412A
Communication system and communication device
JP2023018732A