Control method and automatic control system
By introducing the communication connection between the host device and the slave device cluster in the industrial automation control system, the existing system solves the problems of increased cost and poor synchronization when expanding slave devices, achieves higher synchronization and scalability, and reduces cost.
Patent Information
- Application Number
- CN202111332045.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2041-11-11
AI Technical Summary
When expanding slave equipment, existing industrial automation control systems need to be equipped with dedicated drive equipment, resulting in increased costs and poor synchronization.
By introducing the communication connection between the host device, the slave device cluster and the bus in the automatic control system, the host device obtains the device identification in the slave device cluster, performs delay compensation, sends the initial data frame to obtain the target data, and realizes the control of the slave device. Control of equipment.
When a new slave device is added, the device identification can be assigned, and the synchronization of the system can be improved through delay compensation, avoiding the configuration of dedicated drive devices, reducing costs, and improving the scalability of the system.
Smart Images

Figure CN114035524B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial automation, and in particular to a control method and an automatic control system. Background Art
[0002] With the continuous promotion of industrial robots, their application occasions are also increasing. For example, welding operations are completed by the cooperation of a system consisting of industrial robots and external devices. Industrial robots need to expand external devices during operation. In related technologies, the expansion of external devices often requires the configuration of drive devices, which increases the cost of the system and leads to poor synchronization. Summary of the invention
[0003] In view of this, the object of the present invention is to provide a control method and an automatic control system. In order to achieve the above object, the technical solution adopted in the embodiment of the present invention is as follows:
[0004] In a first aspect, the present invention provides a control method, which is applied to an automatic control system, wherein the automatic control system includes a host device, a slave device cluster and a bus, wherein the host device is communicatively connected with the slave device cluster via the bus, and the slave device cluster includes a plurality of slave devices; the method includes:
[0005] When a new slave device joins the slave device cluster, the host device obtains a device identification of each slave device in the slave device cluster;
[0006] The host device performs delay compensation on the slave device cluster;
[0007] The host device sends an initial data frame, wherein the initial data frame includes a device identification and initial data of each of the slave devices;
[0008] The slave device cluster receives the initial data frame, and each of the slave devices obtains target data according to its own device identification and initial data, to obtain a target data frame of the slave device cluster, wherein the target data frame includes all target data;
[0009] The slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame.
[0010] In an optional implementation, each of the slave devices in the slave device cluster is communicatively connected in sequence, and the host device is communicatively connected to the first slave device in the slave device cluster via the bus;
[0011] The step of the host device obtaining the device identification of each slave device in the slave device cluster includes:
[0012] The host device sends an address data frame;
[0013] The current slave device receives the address data frame, obtains the corresponding device identification according to the address data frame, updates the address data frame according to the device identification, and then transmits it to the next slave device;
[0014] Wherein, the address data frame received by the first slave device is sent by the host, and the address data frames received by other slave devices are sent by the previous slave device;
[0015] The current slave device sends the corresponding device identification to the host device.
[0016] In an optional implementation manner, the address data frame received by the first slave device includes an address block and an initial value corresponding to the address block, and the address data frames received by the other slave devices include the address block and an updated value corresponding to the address block;
[0017] The step of the current slave device receiving an address data frame, obtaining a corresponding device identifier according to the address data frame, updating the address data frame according to the device identifier, and then transmitting the address data frame to the next slave device includes:
[0018] In the case where the current slave device is the first slave device, the current slave device receives an address data frame, uses an initial value in the address data frame as a corresponding device identifier, updates the address block according to the initial value, and then transmits the address block to the next slave device;
[0019] In the case that the current slave device is the other slave device, the current slave device receives the address data frame, uses the updated value in the address data frame as the corresponding device identifier, updates the address block according to the updated value, and then transmits it to the next slave device.
[0020] In an optional implementation manner, before the step of the host device performing delay compensation on the slave device cluster, the method further includes:
[0021] The first slave device sends the final update value in the address data frame received by the last slave device to the host device, where the final update value represents the total number of all slave devices.
[0022] In an optional implementation manner, the step of the host device performing delay compensation on the slave device cluster includes:
[0023] The host device sends N test data frames; N is a natural number greater than 2;
[0024] Any target slave device in the slave device cluster receives N test data frames in sequence;
[0025] When the target slave device receives the first test data frame, the starting time is recorded;
[0026] The target slave device receives the nth test data frame, obtains the delay time of the nth test data frame according to the starting time, and obtains N-1 delay time lengths; n is a natural number greater than or equal to 2 and less than or equal to N;
[0027] The target slave device performs delay compensation according to N-1 delay durations.
[0028] In an optional implementation manner, the slave device cluster receives the initial data frame, and the step of each of the slave devices obtaining target data according to its own device identification and initial data includes:
[0029] The current slave device receives an initial data frame, obtains initial data according to a device identifier corresponding to the initial data frame, obtains target data from the current slave device according to the initial data, and sends the initial data frame to a next slave device;
[0030] The initial data frame received by the first slave device is sent by the host, and the initial data frames received by other slave devices are sent by the previous slave device.
[0031] In an optional implementation manner, the target data frame further includes a check block, and after the slave device cluster sends the target data frame to the host device, the method further includes:
[0032] The host device determines an abnormal slave device according to the check block in the target data frame.
[0033] In an optional implementation, the address data frame further includes a data length block, and the initial data frame further includes a valid data block corresponding to each of the slave devices; the data length block is used to indicate a length range of the valid data block.
[0034] In an optional implementation, the initial data frame further includes a data type block, and the data type block is used to characterize the type of the valid data block.
[0035] In a second aspect, the present invention provides an automatic control system, the automatic control system comprising a host device, a slave device cluster and a bus, the host device and the slave device cluster are communicatively connected via the bus, and the slave device cluster comprises a plurality of slave devices;
[0036] The host device is used for obtaining the device identification of each slave device in the slave device cluster when a new slave device joins the slave device cluster;
[0037] The host device is used to perform delay compensation on the slave device cluster;
[0038] The host device is used to send an initial data frame, wherein the initial data frame includes a device identification and initial data of each slave device;
[0039] The slave device cluster is used to receive the initial data frame and obtain a target data frame of the slave device cluster, wherein the target data frame includes all target data;
[0040] The slave devices are used to obtain target data according to their respective device identifications and initial data;
[0041] The slave device cluster is used to send the target data frame to the host device, so that the host device controls the slave device according to the target data frame.
[0042] A control method and automatic control system provided by an embodiment of the present invention. The automatic control system includes a host device, a slave device cluster and a bus, wherein the host device is connected to the slave device cluster through bus communication, and the slave device cluster includes multiple slave devices. When a new slave device joins the slave device cluster, the host device obtains the device identification of each slave device in the slave device cluster; the host device performs delay compensation on the slave device cluster; the host device sends an initial data frame, which includes the device identification and initial data of each slave device; the slave device cluster receives the initial data frame, and each slave device obtains the target data according to its own device identification and initial data, and obtains the target data frame of the slave device cluster, which includes all target data; the slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame. Therefore, in the case of adding a new slave device, the device identification can be assigned to the slave device, and the synchronization of the system is improved through delay compensation, and no dedicated drive device is required, which improves the scalability of the system, saves costs, and can meet various operation requirements.
[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 A block diagram of an existing control system is shown;
[0046] Figure 2 A block diagram of an automatic control system provided by an embodiment of the present invention is shown;
[0047] Figure 3 A schematic flow chart of a control method provided by an embodiment of the present invention is shown;
[0048] Figure 4 A block diagram of another automatic control system provided by an embodiment of the present invention is shown;
[0049] Figure 5 An example diagram of a control method provided by an embodiment of the present invention is shown;
[0050] Figure 6 Another schematic flow chart of a control method provided by an embodiment of the present invention is shown;
[0051] Figure 7 Another exemplary diagram of a control method provided by an embodiment of the present invention is shown;
[0052] Figure 8 Another schematic flow chart of a control method provided by an embodiment of the present invention is shown;
[0053] Fig. 9 Another exemplary diagram of a control method provided by an embodiment of the present invention is shown;
[0054] Fig.10 Another schematic flow chart of a control method provided by an embodiment of the present invention is shown;
[0055] Fig.11 Another example diagram of the control method provided by an embodiment of the present invention is shown.
[0056] Icons: 110 - bus; 120 - master device; 130 - slave device cluster; 131 - slave device. DETAILED DESCRIPTION
[0057] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0058] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0059] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0060] In industrial automation, industrial robots and external devices are often combined into control systems for various operating scenarios, such as refining, welding, etc. Figure 1 , is a schematic diagram of an existing control system. The control system includes a host device, i.e., a robot, a plurality of slave devices, i.e., external devices, and a bus, through which the host device is connected to each slave device.
[0061] For this control system, since the host device and each slave device are connected through bus communication, the effectiveness of the bus is required to be high. In addition, when the slave device needs to be expanded, the drive device must be configured for the added slave device, which increases the cost of the system. Although EtherCAT, an Ethernet-based field bus, is currently used to alleviate system delays. However, the use of EtherCAT requires the configuration of a dedicated chip, which makes the system have great limitations and also involves the development of the application layer protocol, which is difficult to develop and requires a lot of cost.
[0062] Furthermore, the embodiments of the present invention provide a control method and an automatic control system to solve the problems in the above-mentioned related technologies.
[0063] See also Figure 2 , is a schematic diagram of an automatic control system provided by an embodiment of the present invention. The automatic control system includes a host device 120, a slave device cluster 130 and a bus 110. The host device 120 is connected to the slave device cluster 130 through the bus 110, and the slave device cluster 130 includes a plurality of slave devices 131.
[0064] The bus 110 may be a circuit that connects the above devices to each other and transmits communications (eg, control messages) between the above devices.
[0065] The host device 120 may receive commands from the slave device cluster 130 through the bus 110 , may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.
[0066] The host device 120 may include an integrated circuit chip with signal processing capabilities. It may be a general-purpose processor, such as a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0067] Optionally, the host device 120 may be an industrial robot, which may include an operation control module, a drive module, a communication module, a vision module, and a process package module.
[0068] The motion control module is used to execute motion trajectory planning and kinematics algorithms, and generate instructions to send to the drive module. The drive module is used to control each slave device 131 according to the received instructions. The communication module is used to communicate and interact with the slave device cluster 130. The visual module performs image recognition processing. The process package module is used to store the application programs required to perform various operations.
[0069] The slave device 131 may store a command or data received from the host device 120 or a command or data generated by the host device 120 .
[0070] The slave device 131 may include a memory, which may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0071] The slave device 131 may be an external device or an IO device.
[0072] If the slave device 131 is an external device and its operation requires the help of a motor device. The external device may include a current loop control module, an encoder acquisition module, and a current sampling module. The external device may calculate the duty cycle through these functional modules. The duty cycle refers to the time ratio of a high level in a cycle. The external device transmits the duty cycle to the motor device so that the power switch module of the motor device controls the motor device to rotate, which is used to provide operating energy to the external device.
[0073] The following will combine the above Figure 2 The automated control system shown in the figure introduces each step in each method provided by the embodiment of the present invention and the technical effects achieved.
[0074] In an automatic control system, due to new operation requirements, it is necessary to expand new slave devices in the slave device cluster to implement corresponding operations. If a new slave device is added to the slave device cluster, in order to realize the control of the slave device by the host device, the control method provided by the embodiment of the present invention can be executed.
[0075] See also Figure 3 , Figure 3 It is a flow chart of a control method provided by an embodiment of the present invention.
[0076] Step S202, when a new slave device joins the slave device cluster, the host device obtains the device identification of each slave device in the slave device cluster;
[0077] The slave device cluster includes multiple slave devices, and the device identifier is a unique identifier of the slave device, which may be an ID number, and is used to distinguish different slave devices.
[0078] Optionally, if a new slave device is added to the slave device cluster, the host device may assign an ID number, ie, a device identification, to each slave device, so that the host device obtains the device identification of each slave device, and each slave device obtains its corresponding device identification.
[0079] Step S204, the host device performs delay compensation on the slave device cluster;
[0080] It is understandable that there is a delay in the communication and interaction between the host device and the slave device in the automatic control system. In the case of a large delay, the efficiency of the host device in controlling the slave device will be affected, resulting in low operation efficiency.
[0081] Optionally, in an embodiment of the present invention, after determining the device identification of each slave device, the host device and the slave device cluster may perform a delay test. Based on the delay test, the host device may perform delay compensation on the slave device cluster to reduce the delay of the automatic control system.
[0082] Step S206, the host device sends an initial data frame;
[0083] Wherein, the initial data frame includes a device identification and initial data of each slave device;
[0084] Optionally, after performing delay compensation, the host device may send an initial data frame to the slave device cluster, the initial data frame including the device representation and initial data of each slave device. It can be understood that the host device performs an initialization operation on the slave device through the initial data frame.
[0085] Step S208, the slave device cluster receives the initial data frame, and each slave device obtains the target data according to its own device identification and initial data, thereby obtaining the target data frame of the slave device cluster;
[0086] Wherein, the target data frame includes all target data;
[0087] Optionally, the slave device cluster receives an initial data frame sent by the host device, the initial data frame is transmitted to each slave device, each slave device obtains target data according to the corresponding device identifier and initial data in the initial data frame, and a target data frame including all target data can be obtained.
[0088] Step S210, the slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame;
[0089] Optionally, after obtaining the target data frame, the slave device cluster sends the target data frame to the host device. The host device can control the slave device according to the target data frame and can control the working state of the slave device, such as adjusting the current, voltage, power parameters, etc. of the slave device.
[0090] It is understandable that each time the host device sends an initial data frame, the communication interaction process between the host device and the slave device cluster is the same. The embodiment of the present invention is introduced with one initial data frame. The initial data frame may be multiple, and the embodiment of the present invention does not limit it.
[0091] It can be seen that based on the above design, the control method provided by the embodiment of the present invention is applied to an automatic control system, which includes a host device, a slave device cluster and a bus, and the host device is connected to the slave device cluster through bus communication, and the slave device cluster includes multiple slave devices. When a new slave device joins the slave device cluster, the host device obtains the device identification of each slave device in the slave device cluster; the host device performs delay compensation on the slave device cluster; the host device sends an initial data frame, which includes the device identification and initial data of each slave device; the slave device cluster receives the initial data frame, and each slave device obtains the target data according to its own device identification and initial data, and obtains the target data frame of the slave device cluster, which includes all target data; the slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame. Therefore, in the case of adding a new slave device, the device identification can be assigned to the slave device, and the synchronization of the system is improved through delay compensation, and no dedicated drive device is required, which improves the scalability of the system, saves costs, and can meet various operation requirements.
[0092] Based on the above Figure 2 The automatic control system shown is a schematic diagram of another automatic control system provided by an embodiment of the present invention. Figure 4 , wherein each slave device 131 in the slave device cluster 130 is communicatively connected in sequence, and the host device 120 is communicatively connected to the first slave device 131A in the slave device cluster via the bus 110 .
[0093] Understandably, Figure 4 In the automatic control system shown, except for the first slave device 131A, other slave devices 131 are not directly connected to the host device 120 through the bus 110, which can reduce the transmission pressure of the bus and reduce the delay, thereby improving the synchronization of the system.
[0094] It is understandable that the host device 120 and the slave device 131 can achieve communication interaction by transmitting data frames during communication interaction via the bus 110. In the embodiment of the present invention, three types of data frames are involved. The following will briefly introduce these three types of data frames.
[0095] The first is an address data frame, which is used to determine the device identification of each slave device.
[0096] The second type is a test data frame, which is used to perform delay compensation on an automatic control system.
[0097] The third type is an initial data frame, which is used to detect data transmission between a host device and a slave device.
[0098] It can be understood that if a new slave device is added to the slave device cluster, the communication interaction between the host device and the slave device can be divided into three stages. These three stages correspond to the communication process based on the above three types of data frames, and these three stages have a time sequence, that is, the first stage is based on the address data frame for communication, then the second stage is based on the test data frame for communication, and finally the third stage is based on the initial data frame for communication.
[0099] Based on the above Figure 4 The automatic control system shown in the figure and the three types of data frames mentioned above, the embodiment of the present invention provides a data frame structure. In order to facilitate understanding of each step in the embodiment of the present invention, the structure of the data frame will be introduced below.
[0100] See also Figure 5 , is a schematic diagram of the structure of a data frame provided by an embodiment of the present invention.
[0101] (1) Preamble and Sfd represent the start block, which is used to mark the beginning of a data frame. The data in the start block can be different depending on the type of data frame.
[0102] Optionally, for an address data frame, the data in the start block may be AA_AA_AA_EA; for a test data frame and an initial data frame, the data in the start block may be 55_55_55_D5.
[0103] (2) Frame type represents the frame type block, which is used to indicate the type of data frame.
[0104] Optionally, if the data in the frame type block is 00, it indicates an initial data frame; if the data in the frame type block is 01, it indicates a test data frame; if the data in the frame type block is 11, it indicates an address data frame; if the data in the frame data block is 10, it indicates other data frames, that is, 10 is reserved and can be used to define other types of data frames.
[0105] (3) Slave num represents the device number block, which is used to define the total number of slave devices in the automatic control system. The device data block is only valid in the address data frame, that is, when the data in the frame type block is 11.
[0106] It is understandable that if the total number of slave devices in the automatic control system changes, the data in the device number block needs to be reset. Optionally, the data in the device number block can be a maximum of 64, which means that the automatic control system can support a maximum of 64 slave devices.
[0107] (4) Slave ID represents an address block, which is used to define the device identification of each slave device.
[0108] (5) Slave data refers to a valid data block, which is used to implement data exchange between the host device and the slave device. Each slave device has a corresponding valid data block.
[0109] (6) Frame num indicates a data type block, which is used to indicate the type of a valid data block. It can be understood that the data type block can be used to distinguish different data in a valid data block.
[0110] Optionally, if the data in the data type block is 1, it means that the type of the valid data block is current, that is, the data in the valid data block is the current value;
[0111] (7) Slave byte represents a data length block, which is used to indicate the length range of the valid data block. It can be understood that the data length block is used to define the length range of the data in the valid data block. Optionally, the data value in the data length block can be set to 0-255, which indicates that the length range of the data in the valid data block is 1 to 256 bytes.
[0112] The data length block is valid only in the address data frame, that is, when the data in the frame type block is 11.
[0113] (8) FCS and ERR represent check blocks, which are used to record the total number of abnormalities that occur during the communication between the host device and the slave device and the slave device in which the abnormality occurs.
[0114] Based on the above Figure 5 The data frame structure shown introduces the three stages of the communication process between the host device and the slave device.
[0115] For the above step S202, the device identification of each slave device can be determined through the address data frame, that is, the first stage. The embodiment of the present invention provides a possible implementation method, please refer to Figure 6, wherein step S202 may include the following steps:
[0116] Step 202-1, the host device sends an address data frame;
[0117] For example, the host device sends Figure 7 The address data frame shown in the figure has a start block, namely, Preamble and Sfd, of AA_AA_AA_EA; and a frame type block, namely, Frame type, of 11.
[0118] The device number block, i.e., Slave num, is 16, indicating that there are 16 slave devices in the automatic control system.
[0119] The data length block, namely the slave byte, is 0-255, indicating that the length of the valid data block corresponding to each defined slave device ranges from 1 to 256 bytes.
[0120] The address block, namely the Slave ID, is 1, indicating that the initial value of the address block of the address data frame is 1.
[0121] Step 202-3, the current slave device receives the address data frame, obtains the corresponding device identification according to the address data frame, updates the address data frame according to the device identification, and transmits it to the next slave device;
[0122] The address data frame received by the first slave device is sent by the host, and the address data frames received by other slave devices are sent by the previous slave device.
[0123] For example, the current slave device is the first slave device, that is, Figure 4 The slave device 131A in .
[0124] The slave device 131A receives the address data frame sent by the host device 120, and uses the initial value 1 corresponding to the address block in the address data frame as its corresponding device identification. Moreover, after adding 1 to the initial value, that is, updating the address block, the address data frame is transmitted to the next slave device, that is, the slave device 131B.
[0125] When the slave device is another slave device, such as the slave device 131B in FIG. 4 .
[0126] The slave device 131B receives the address data frame sent by the previous slave device, namely the slave device 131A, and uses the update value corresponding to the address block in the address data frame, namely 2, as its corresponding device identifier. Moreover, after adding 1 to the update value, namely updating the address, the address data frame is transmitted to the next slave device.
[0127] Step S202-5, the current slave device sends the corresponding device identification to the host device;
[0128] Optionally, after all slave devices obtain corresponding device identifications, the slave device cluster may send an address feedback frame to the host device, wherein the address feedback frame includes the device identification of each slave device, and the host device may obtain the device identification of each slave device based on the address feedback frame.
[0129] Optionally, in step S202-2, the address data frame is transmitted to the last slave device, such as Figure 4 The slave device 131X in the address data frame uses the final updated value corresponding to the address block in the address data frame as its corresponding device identification and does not need to update the address block.
[0130] The slave device 131X sends the address data frame to the first slave device, namely the slave device 131A, and then the slave device 131A sends the final update value corresponding to the address block in the address data frame to the host device. The host device can determine the total number of slave devices in the automatic control system based on the final update value.
[0131] After determining the device identification of each slave device, the above step S204 is executed, and the host device performs delay compensation on the slave device cluster, that is, the second stage. Figure 8 , step S204 may include the following steps:
[0132] Step S204-1, the host device sends N test data frames;
[0133] Wherein, N is a natural number greater than 2;
[0134] For example, the host device sends three Fig. 9 The test data frame shown in FIG. The start block in the test data frame, namely, the Preamble and the Sfd, are 55_55_55_D5; and the frame type block, namely, the Frame type, is 01.
[0135] The data type block, namely, Frame num, is 1, indicating that the data in the valid data block is the current value.
[0136] There are 16 slave devices in the automatic control system, and there are 16 valid data blocks, namely Slave-1data to Slave-16data.
[0137] Step S204-3, any target slave device in the slave device cluster receives N test data frames in sequence;
[0138] For example, any target slave device in the slave device cluster, that is, each slave device, will receive three test data frames in sequence.
[0139] Step S204-5, when the target slave device receives the first test data frame, the starting time is recorded;
[0140] For example, when each slave device receives the first test data frame, the time when the first test data frame is received is recorded as the start time.
[0141] Step S204-7, the target slave device receives the nth test data frame, obtains the delay time of the nth test data frame according to the starting time, and obtains N-1 delay time;
[0142] Wherein, n is a natural number greater than or equal to 2 and less than or equal to N;
[0143] For example, when each slave device receives the second test data frame, it records the receiving time corresponding to the second test data frame, and calculates the delay time of the second test data frame according to the starting time.
[0144] When receiving the third test data frame, each slave device records the receiving time corresponding to the third test data frame. According to the receiving time corresponding to the second test data frame, the delay time of the third test data frame is calculated. Each slave device obtains two delay time lengths.
[0145] Step S204-9: The target slave device performs delay compensation according to N-1 delay durations.
[0146] Optionally, each slave device performs delay compensation according to the maximum delay duration among the N-1 delay durations to ensure synchronization of the automatic control system. For example, delay compensation may be performed according to the maximum delay duration among the two delay durations.
[0147] Optionally, the delay duration of the automatic control system may also be obtained according to the maximum delay duration of each slave device.
[0148] After delay compensation is performed, the host device and the slave device communicate based on the initial data frame, that is, in the third stage, with respect to the above step S208, an embodiment of the present invention provides a possible implementation method.
[0149] See also Fig.10 , step S208 may include the following steps:
[0150] Step S208A, the current slave device receives the initial data frame, obtains initial data according to the device identifier corresponding to the initial data frame, obtains target data from the current slave device according to the initial data, and sends the initial data frame to the next slave device;
[0151] The initial data frame received by the first slave device is sent by the host, and the initial data frames received by other slave devices are sent by the previous slave device.
[0152] For example, the host device sends Fig.11 The initial data frame shown in FIG. The starting block in the initial data frame, namely Preamble and Sfd, is 55_55_55_D5; the frame type block, namely Frame type, is 00. The data type block, namely Frame num, is 1, indicating that the data in the valid data block is the current value. There are 16 slave devices in the automatic control system, and there are 16 valid data blocks, namely Slave-1data to Slave-16data.
[0153] The current slave device is the first slave device, that is, Figure 4 The slave device 131A in .
[0154] The slave device 131A receives the initial data frame sent by the host device 120, obtains the initial data from the valid data block Slave-1data according to its corresponding device identifier in the initial data frame, and obtains the target data from the local storage space of its slave device 131A according to the initial data, and then transmits the initial data frame to the next slave device, namely, slave device 131B.
[0155] The current slave device is another slave device, that is, Figure 4 The slave device 131B in .
[0156] The slave device 131B receives the initial data frame sent by the previous slave device, namely the slave device 131A, obtains the initial data from the valid data block Slave-2data according to its corresponding device identifier in the initial data frame, and obtains the target data from the local storage space of its slave device 131A according to the initial data, and then transmits the initial data frame to the next slave device.
[0157] The initial data frame is transmitted between each slave device in turn, so that each slave device obtains the initial data according to its corresponding device identification, and obtains the target data from its own local storage space according to the initial data until it is transmitted to the last slave device, that is, Figure 4 The slave device 131X in.
[0158] After the slave device 131X obtains the target data, it replaces the initial data in the Slave-16data in the initial data frame with the target data, and transmits the replaced initial data frame to its previous slave device.
[0159] Each slave device receives the replaced initial data frame transmitted by the next slave device, replaces the initial data in its corresponding valid data block with the target data of the slave device, and then transmits it to the previous slave device until it is transmitted to the first slave device, such as slave device 131A. The slave device 131A sends the target data frame containing all the target data to the host device 120, so that the host device 120 controls the slave device 131 according to the target data frame.
[0160] Optionally, during the communication between the host device and the slave device based on the initial data frame, an abnormality may occur in the slave device. After the slave device cluster obtains the target data frame based on the initial data frame, the target data frame can be sent to the host device.
[0161] The first slave device sends a target data frame to the host device, and the check block in the target data frame, namely FCS and ERR, records the total number of abnormalities and the slave device with the abnormality. The host device can determine the slave device with the abnormality based on the check block in the target data to control the abnormal slave device.
[0162] Based on the automatic control system provided in the above embodiment, if the total number of slave devices in the automatic control system is 16, the transmission rate of the data frame is 100Mbps, and the data length in the valid data block is 29 bytes, the delay of the automatic control system can be maintained within 500ns. That is, the control method and automatic control system improved based on the embodiment of the present invention can improve the synchronization and scalability of the system.
[0163] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing an automatic control system is provided below. It should be noted that the basic principle and technical effects of the automatic control system provided in this embodiment are the same as those in the above embodiments. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments.
[0164] The automatic control system includes: a host device, a slave device cluster and a bus, the host device and the slave device cluster are connected through bus communication, and the slave device cluster includes multiple slave devices;
[0165] The master device is used to obtain the device identification of each slave device in the slave device cluster when a new slave device joins the slave device cluster;
[0166] The master device is used to perform delay compensation on the slave device cluster;
[0167] The host device is used to send an initial data frame, which includes a device identification and initial data of each slave device;
[0168] The slave device cluster is used to receive the initial data frame and obtain the target data frame of the slave device cluster, where the target data frame includes all target data;
[0169] The slave devices are used to obtain target data according to their respective device identifications and initial data.
[0170] The slave device cluster is used to send the target data frame to the host device, so that the host device controls the slave device according to the target data frame.
[0171] Optionally, the host device is further used to send an address data frame;
[0172] The slave device is also used to receive the address data frame, obtain the corresponding device identification according to the address data frame, and transmit it to the next slave device after updating the address data frame according to the device identification; and the slave device sends the corresponding device identification to the host device. Among them, the address data frame received by the first slave device in the slave device cluster is sent by the host, and the address data frames received by other slave devices are sent by the previous slave device.
[0173] Optionally, the first slave device in the slave device cluster is used to receive the address data frame, use the initial value in the address data frame as the corresponding device identifier, and update the address block according to the initial value before transmitting it to the next slave device;
[0174] The other slave devices in the slave device cluster are used to receive the address data frame, use the updated value in the address data frame as the corresponding device identification, and update the address block according to the updated value before transmitting it to the next slave device.
[0175] Optionally, the first slave device in the slave device cluster is further used to send a final update value in the address data frame received by the last slave device to the host device, and the final update value represents the total number of all slave devices.
[0176] Optionally, the host device is further used to send N test data frames; N is a natural number greater than 2;
[0177] The slave device is also used to receive N test data frames in sequence; when the first test data frame is received, the starting time is recorded; when the nth test data frame is received, the delay duration of the nth test data frame is obtained according to the starting time, and N-1 delay durations are obtained; according to the N-1 delay durations, delay compensation is performed; n is a natural number greater than or equal to 2 and less than or equal to N.
[0178] Optionally, the slave device is also used to receive an initial data frame, obtain initial data according to a corresponding device identifier in the initial data frame, obtain target data from the current slave device according to the initial data, and send the initial data frame to the next slave device; wherein, the initial data frame received by the first slave device is sent by the host, and the initial data frames received by other slave devices are sent by the previous slave device.
[0179] Optionally, the host device is further configured to determine an abnormal slave device according to a check block in the target data frame.
[0180] In summary, an embodiment of the present invention provides a control method and an automatic control system. The automatic control system includes a host device, a slave device cluster and a bus, wherein the host device is connected to the slave device cluster through bus communication, and the slave device cluster includes multiple slave devices. When a new slave device joins the slave device cluster, the host device obtains the device identification of each slave device in the slave device cluster; the host device performs delay compensation on the slave device cluster; the host device sends an initial data frame, which includes the device identification and initial data of each slave device; the slave device cluster receives the initial data frame, and each slave device obtains the target data according to its own device identification and initial data, and obtains the target data frame of the slave device cluster, which includes all target data; the slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame. Therefore, in the case of adding a new slave device, the device identification can be assigned to the slave device, and the synchronization of the system is improved through delay compensation, and no dedicated drive device is required, which improves the scalability of the system, saves costs, and can meet various operation requirements.
[0181] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0182] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0183] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0184] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A control method, characterized in that: Applied to an automatic control system, the automatic control system comprises a host device, a slave device cluster and a bus, the host device is communicatively connected with the slave device cluster via the bus, the slave device cluster comprises a plurality of slave devices, each of the slave devices in the slave device cluster is communicatively connected in sequence, and the host device is communicatively connected with the first slave device in the slave device cluster via the bus; the method comprises: When a new slave device joins the slave device cluster, the host device obtains a device identification of each slave device in the slave device cluster; The host device sends N test data frames; N is a natural number greater than 2; For each slave device in the slave device cluster, the slave device receives N test data frames in sequence, and records the starting time when receiving the first test data frame, and calculates the delay duration of the nth test data according to the starting time and the receiving time corresponding to the nth test data frame, obtains N-1 delay durations, and performs delay compensation according to the maximum delay duration among the N-1 delay durations; n is a natural number greater than or equal to 2 and less than or equal to N; The host device sends an initial data frame, wherein the initial data frame includes a device identification and initial data of each slave device; The slave device cluster receives the initial data frame, and each of the slave devices obtains target data according to its own device identification and initial data, to obtain a target data frame of the slave device cluster, wherein the target data frame includes all target data; The slave device cluster sends the target data frame to the host device, so that the host device controls the slave device according to the target data frame; The slave device cluster receives the initial data frame, and each of the slave devices obtains target data according to its own device identification and initial data, including: For each slave device in the slave device cluster, the slave device obtains initial data according to the corresponding device identifier in the initial data frame, obtains target data from the local storage space according to the initial data, and sends the initial data frame to the next slave device; The initial data frame received by the first slave device is sent by the host device, and the initial data frames received by other slave devices are sent by the previous slave device.
2. The method according to claim 1, characterized in that The step of obtaining, by the host device, a device identification of each of the slave devices in the slave device cluster comprises: The host device sends an address data frame; The current slave device receives the address data frame, obtains the corresponding device identification according to the address data frame, updates the address data frame according to the device identification, and then transmits it to the next slave device; Wherein, the address data frame received by the first slave device is sent by the host device, and the address data frames received by other slave devices are sent by the previous slave device; The current slave device sends the corresponding device identification to the host device.
3. The method according to claim 2, characterized in that The address data frame received by the first slave device includes an address block and an initial value corresponding to the address block, and the address data frames received by the other slave devices include the address block and an updated value corresponding to the address block; The step of the current slave device receiving an address data frame, obtaining a corresponding device identifier according to the address data frame, updating the address data frame according to the device identifier, and then transmitting the address data frame to the next slave device includes: In the case where the current slave device is the first slave device, the current slave device receives an address data frame, uses an initial value in the address data frame as a corresponding device identifier, updates the address block according to the initial value, and then transmits the address block to the next slave device; In the case that the current slave device is the other slave device, the current slave device receives the address data frame, uses the updated value in the address data frame as the corresponding device identifier, updates the address block according to the updated value, and then transmits it to the next slave device.
4. The method according to claim 3, characterized in that Before the step of the host device performing delay compensation on the slave device cluster, the method further includes: The first slave device sends the final update value in the address data frame received by the last slave device to the host device, where the final update value represents the total number of all slave devices.
5. The method according to claim 1, characterized in that The target data frame further includes a check block. After the slave device cluster sends the target data frame to the host device, the method further includes: The host device determines an abnormal slave device according to the check block in the target data frame.
6. The method according to claim 2, characterized in that The address data frame further includes a data length block, and the initial data frame further includes a valid data block corresponding to each of the slave devices; the data length block is used to indicate the length range of the valid data block.
7. The method according to claim 6, characterized in that The initial data frame further includes a data type block, and the data type block is used to characterize the type of the valid data block.
8. An automatic control system, characterized in that: The automatic control system comprises a host device, a slave device cluster and a bus, the host device is communicatively connected with the slave device cluster via the bus, the slave device cluster comprises a plurality of slave devices, each of the slave devices in the slave device cluster is communicatively connected in sequence, and the host device is communicatively connected with the first slave device in the slave device cluster via the bus; The host device is used for obtaining the device identification of each slave device in the slave device cluster when a new slave device joins the slave device cluster; The host device is used to send N test data frames; N is a natural number greater than 2; For each slave device in the slave device cluster, the slave device is used to receive N test data frames in sequence, and record the starting time when the first test data frame is received, and calculate the delay duration of the nth test data according to the starting time and the receiving time corresponding to the nth test data frame, to obtain N-1 delay durations, and perform delay compensation according to the maximum delay duration among the N-1 delay durations; n is a natural number greater than or equal to 2 and less than or equal to N; The host device is used to send an initial data frame, wherein the initial data frame includes a device identification and initial data of each slave device; The slave device cluster is used to receive the initial data frame and obtain a target data frame of the slave device cluster, wherein the target data frame includes all target data; For each slave device in the slave device cluster, the slave device is used to obtain initial data according to the corresponding device identifier in the initial data frame, obtain target data from the local storage space according to the initial data, and send the initial data frame to the next slave device; Wherein, the initial data frame received by the first slave device is sent by the host device, and the initial data frames received by other slave devices are sent by the previous slave device; The slave devices are used to obtain target data according to their respective device identifications and initial data; The slave device cluster is used to send the target data frame to the host device, so that the host device controls the slave device according to the target data frame.
Citation Information
Patent Citations
Embedded device deployment method and system
CN114168210A
Unique device address assignment technique for bidirectional daisy chain system
US20160205066A1
Network for an aircraft or spacecraft, an aircraft or spacecraft, and a method for configuring a network
US20170134184A1