Master-slave control method and control device of controller, and computer readable storage medium
By receiving the equipment working status and target controller attribute information, it automatically determines and adjusts the controller operating status, solving the problem of long master-slave switching time in the existing technology, and realizing the intelligence and reliability of the equipment.
Patent Information
- Application Number
- CN202310303886.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-20
- Publication Date
- 2024-09-20
AI Technical Summary
In the existing technology, the method for confirming the master-slave status of the controller cannot automatically determine the most suitable operating identity. As a result, the device needs to stop serving when the master-slave switch is performed, the switching time is long, and a smooth transition cannot be achieved.
By receiving the working status of the device and the attribute information of the target controller, the running status of the target controller is determined, and the working status of the controller and the device is adjusted according to the running status to achieve automatic judgment and smooth switching.
There is no need to pre-set the master-slave relationship of the controller, which improves the intelligence and operational reliability of the equipment and simplifies the master-slave switching process.
Smart Images

Figure CN118672164A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of controllers, and in particular to a master-slave control method of a controller, a master-slave control device of a controller, and a computer-readable storage medium. Background Art
[0002] Important power equipment in the power industry is often designed with redundancy to avoid single point failures that lead to equipment failure, thereby ensuring safe and reliable operation of the equipment. Power equipment is usually equipped with two controllers, one of which is the main controller (referred to as the host) and the other is the subordinate controller (referred to as the slave). When the equipment is working normally, the equipment is controlled and operated by the host. When the host fails, the equipment is controlled and operated by the slave, so that the equipment can continue to provide services.
[0003] The current confirmation of the master-slave status of the controller is set in the controller's pre-configuration file, that is, by reading the controller's identity information in the pre-configuration file to determine whether the controller is running as the device's master or slave. This method cannot automatically determine the most suitable operating identity when the controller is online. In addition, when the master is running normally, the slave is in standby mode. When a fault occurs and a master-slave switch is required, the switch time is long. The device must stop service first, and then start service after the slave status is activated. The master-slave switch of the controller cannot be smoothly transitioned. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems in the related art to a certain extent. To this end, the first purpose of the present invention is to propose a master-slave control method of a controller, which determines the operating state of a target controller according to the working state of the device and the attribute information of the target controller, thereby adjusting the working state of the target controller and the device according to the operating state of the target controller, so that the device does not need to pre-set the master-slave relationship of the controller, improves the intelligence of the device and the reliability of the device operation, and is simple to implement.
[0005] The second object of the present invention is to provide a master-slave control device of a controller.
[0006] A third object of the present invention is to provide a computer-readable storage medium.
[0007] To achieve the above-mentioned objectives, an embodiment of the first aspect of the present invention proposes a master-slave control method for a controller, comprising: when a target controller is online, receiving the working status of a device; determining the operating status of the target controller based on the working status of the device and the attribute information of the target controller; and adjusting the working status of the target controller and the device based on the operating status of the target controller.
[0008] According to the master-slave control method of the controller of the embodiment of the present invention, when the target controller is online, the working state of the device is first received, and then the operating state of the target controller is determined according to the working state of the device and the attribute information of the target controller, and finally the working state of the target controller and the device is adjusted according to the operating state of the target controller. Therefore, the method can make the device do not need to pre-set the master-slave relationship of the controller, improve the intelligence of the device and the reliability of the device operation, and is simple to implement.
[0009] In addition, the master-slave control method of the controller according to the above embodiment of the present invention may also have the following additional technical features:
[0010] According to one embodiment of the present invention, the attribute information of the target controller includes a priority, and the operating state of the target controller is determined according to the working state of the device and the attribute information of the target controller, including: when it is determined according to the working state of the device that there is a host controller, controlling the target controller as a slave controller; when it is determined according to the working state of the device that there is a slave controller, determining the host controller and the slave controller of the device according to the priority of the target controller; when it is determined according to the working state of the device that there is no running controller, controlling the target controller as a host controller.
[0011] According to one embodiment of the present invention, when it is determined that there is a slave controller according to the working state of the device, the host controller and the slave controller of the device are determined according to the priority of the target controller, including: determining the priority of the target controller according to the online time of the slave controller running in the device and the target controller; wherein, the longer the online time, the higher the priority; if the priority of the target controller is higher than the priority of the slave controller running in the device, the target controller is used as the host controller of the device, and the slave controller running in the device is used as the slave controller of the device; if the priority of the target controller is lower than the slave controller running in the device, the slave controller running in the device is used as the host controller of the device, and the target controller is used as the slave controller of the device.
[0012] According to an embodiment of the present invention, during the operation of the host controller and the slave controller of the device, the master-slave control method of the controller further includes: if it is detected that the host controller of the device is offline, using the slave controller of the device as the host controller.
[0013] According to an embodiment of the present invention, the method for controlling a master-slave controller further includes: if it is detected that the offline controller is back online, it acts as a slave controller of the device and backs up the host controller of the device.
[0014] According to one embodiment of the present invention, the attribute information of the target controller includes a version number, and the running state of the target controller is determined according to the working state of the device and the attribute information of the target controller, and further includes: if it is determined according to the working state of the device that there is a running controller, then the version number of the running controller is obtained; and the running state of the target controller is determined according to the version number of the target controller and the version number of the running controller.
[0015] According to one embodiment of the present invention, the running state of the target controller is determined according to the version number of the target controller and the version number of the running controller, including: if the version number of the target controller is the same as the version number of the running controller, the running state of the target controller is determined according to the working state of the device and the priority of the target controller; if the version number of the target controller is higher than the version number of the running controller, the target controller is used as the host controller and the running controller is offline; if the version number of the target controller is lower than the version number of the running controller, the running controller is used as the host controller and the target controller is offline.
[0016] According to one embodiment of the present invention, the attribute information of the target controller includes an ID number, and the operating status of the target controller is determined according to the working status of the device and the attribute information of the target controller, including: if there are two target controllers, and it is determined according to the working status of the device that there is no running controller, then the operating status of each target controller is determined according to the ID number of the target controller.
[0017] To achieve the above-mentioned purpose, the second aspect of the embodiment of the present invention proposes a master-slave control device of a controller, including: a receiving module, used to receive the working status of the device when the target controller is online; a determination module, used to determine the operating status of the target controller according to the working status of the device and the attribute information of the target controller; an adjustment module, used to adjust the working status of the target controller and the device according to the operating status of the target controller.
[0018] According to the master-slave control device of the controller of the embodiment of the present invention, the receiving module is used to receive the working state of the device when the target controller is online, the determining module is used to determine the operating state of the target controller according to the working state of the device and the attribute information of the target controller, and the adjusting module is used to adjust the working state of the target controller and the device according to the operating state of the target controller. Thus, the device can make the device not need to pre-set the master-slave relationship of the controller, improve the intelligence of the device and the reliability of the device operation, and is simple to implement.
[0019] To achieve the above objectives, a third aspect of the present invention provides a computer-readable storage medium on which a master-slave control program of a controller is stored. When the master-slave control program of the controller is executed by a processor, the master-slave control method of the controller is implemented.
[0020] According to the computer-readable storage medium of an embodiment of the present invention, by implementing the master-slave control method of the controller mentioned above during execution, the device does not need to pre-set the master-slave relationship of the controller, thereby improving the intelligence level of the device and the reliability of the device operation, and the implementation is simple.
[0021] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of a master-slave control method of a controller according to an embodiment of the present invention;
[0023] Figure 2 A partial flow chart of a master-slave control method of a controller according to a specific example of the present invention;
[0024] Figure 3 A schematic diagram of master-slave switching of a controller according to a specific example of the present invention;
[0025] Figure 4 Schematic diagram of a block diagram of a master-slave control device of a controller according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0027] The following describes a master-slave control method of a controller, a master-slave control device of a controller, and a computer-readable storage medium provided in an embodiment of the present invention with reference to the accompanying drawings.
[0028] Figure 1 4 is a flow chart of a master-slave control method of a controller according to an embodiment of the present invention.
[0029] like Figure 1 As shown, the master-slave control method of the controller according to the embodiment of the present invention may include the following steps:
[0030] S1, when the target controller comes online, receives the working status of the device.
[0031] S2, determining the operating state of the target controller according to the working state of the device and the attribute information of the target controller.
[0032] According to one embodiment of the present invention, the attribute information of the target controller includes a priority, and the operating state of the target controller is determined according to the working state of the device and the attribute information of the target controller, including: when it is determined according to the working state of the device that there is a host controller, controlling the target controller as a slave controller; when it is determined according to the working state of the device that there is a slave controller, determining the host controller and the slave controller of the device according to the priority of the target controller; when it is determined according to the working state of the device that there is no running controller, controlling the target controller as a host controller.
[0033] Specifically, when the device is started, the device controller automatically determines the most appropriate master-slave identity by reading the information of the current working state of the device. That is, when the target controller is online, the working state of the device is received, and after receiving the working state of the device, the operating state of the target controller can be determined according to the working state of the device and the attribute information of the target controller. The attribute information of the target controller may include priority, that is, there is a controller with a higher priority or a controller with a lower priority. If it is detected according to the working state of the device that a controller already exists as a host controller to control the device, the online controller (target controller) can be automatically used as a slave controller, that is, the operating state of the target controller is slave operation. If it is detected according to the working state of the device that a controller already exists as a slave controller to control the device, the host controller and slave controller of the device can be determined according to the priority of the target controller, for example, the controller with a higher priority can be used as the host controller, and the controller with a lower priority can be used as the slave controller. If it is detected according to the working state of the device that there is no running controller at present, the online controller (target controller) can be automatically used as the host controller, and the operating state of the target controller is determined to be the host operating state.
[0034] According to one embodiment of the present invention, when it is determined that there is a slave controller according to the working state of the device, the host controller and the slave controller of the device are determined according to the priority of the target controller, including: determining the priority of the target controller according to the online time of the slave controller running in the device and the target controller; wherein, the longer the online time, the higher the priority; if the priority of the target controller is higher than the priority of the slave controller running in the device, the target controller is used as the host controller of the device, and the slave controller running in the device is used as the slave controller of the device; if the priority of the target controller is lower than the slave controller running in the device, the slave controller running in the device is used as the host controller of the device, and the target controller is used as the slave controller of the device.
[0035] Specifically, when determining the existence of a slave controller according to the working state of the device and determining the host controller and slave controller of the device according to the priority of the target controller, the priority of the target controller can be determined according to the online time of the slave controller and the target controller running in the device. For example, the data type of the controller is uint32, and the high 31 bits are taken as the number of seconds from the start time of the scheduling component to 00:00:00 on January 1, 2020. The online time of the slave controller running in the device and the online time of the target controller are compared. The controller that starts first has a longer online time and a higher corresponding priority. The controller with a higher priority is used as the host controller, and the controller with a lower priority is used as the slave controller. For example, if the online time of the current slave controller is longer and greater than the online time of the target controller, the slave controller running in the device can be used as the host controller, and the target controller can be used as the slave controller. After determining the priority by the online time, the priority of the target controller is compared with the priority of the slave controller running in the device. If the priority of the target controller is higher than the priority of the slave controller running in the device, the target controller can be used as the host controller of the device, and the slave controller running in the device can be used as the slave controller of the device; if the priority of the target controller is lower than the priority of the slave controller running in the device, the slave controller running in the device can be used as the host controller of the device, and the target controller can be used as the slave controller of the device.
[0036] According to an embodiment of the present invention, during the operation of the host controller and the slave controller of the device, the master-slave control method of the controller further includes: if it is detected that the host controller of the device is offline, using the slave controller of the device as the host controller.
[0037] According to an embodiment of the present invention, the method for controlling a master-slave controller further includes: if it is detected that the offline controller is back online, it acts as a slave controller of the device and backs up the host controller of the device.
[0038] Specifically, during the operation of the host controller and the slave controller of the device, when the host controller is offline, the slave controller can detect the offline situation of the host controller in a short time, and can use the slave controller of the device as the host controller. When it is detected that the offline controller is back online, for example, when the offline host controller is back online, it can be used as the slave controller of the device, and obtain the host controller data in the current device operation state, so that the host controller of the device and the slave controller of the device can back up each other, so that when the host controller is offline, the slave controller can keep the data consistent when it is used as the host controller, so that the host controller and the slave controller can be intelligently and automatically switched without interrupting the service of the device.
[0039] According to one embodiment of the present invention, the attribute information of the target controller includes a version number, and the running state of the target controller is determined according to the working state of the device and the attribute information of the target controller, and further includes: if it is determined according to the working state of the device that there is a running controller, then the version number of the running controller is obtained; and the running state of the target controller is determined according to the version number of the target controller and the version number of the running controller.
[0040] According to one embodiment of the present invention, the running state of the target controller is determined according to the version number of the target controller and the version number of the running controller, including: if the version number of the target controller is the same as the version number of the running controller, the running state of the target controller is determined according to the working state of the device and the priority of the target controller; if the version number of the target controller is higher than the version number of the running controller, the target controller is used as the host controller and the running controller is offline; if the version number of the target controller is lower than the version number of the running controller, the running controller is used as the host controller and the target controller is offline.
[0041] Specifically, the attribute information of the target controller may also include a version number. The data type of the controller version number is uint16. The controller version number may be updated as the hardware of the device changes. The program may automatically update the version number, or the control program kernel may be updated. The program version number may be manually updated by the operator, and the initial value of the version number is read from the configuration file. That is, if the structure of the device changes or the control algorithm is optimized, the controller version number may be manually or automatically modified, and the updated version number value is larger than the original version number value, that is, the larger the value of the controller version number, the newer the version number. When it is determined that there is a running controller based on the working status of the device, the version number of the running controller is obtained. When the hardware of the electrical device changes, the controller should update the control program that matches it, and the program obtains a higher version number. When determining the running status of the target controller according to the version number of the target controller and the version number of the running controller, first compare the version number of the target controller with the version number of the running controller. When the version number of the target controller is the same as the version number of the running controller, the running status of the target controller can be determined according to the working status of the device and the priority of the target controller as mentioned above; when it is determined that the version number of the target controller is larger and the target controller is determined to be a higher version controller, the controller holding the lower version program (the running controller) is deemed to be mismatched with the hardware conditions and should be taken offline immediately, and the higher version controller (the target controller) should be run as a host control device; when it is determined that the version number of the target controller is smaller and the version number of the running controller is larger, continue to use the running controller as the host controller and control the target controller to go offline, so that when the hardware conditions of the device change, it can avoid low utilization or failure caused by the mismatch between the controller and the hardware structure, thereby improving the reliability of the device operation.
[0042] According to one embodiment of the present invention, the attribute information of the target controller includes an ID number, and the operating status of the target controller is determined according to the working status of the device and the attribute information of the target controller, including: if there are two target controllers, and it is determined according to the working status of the device that there is no running controller, then the operating status of each target controller is determined according to the ID number of the target controller.
[0043] Specifically, the attribute information of the target controller may also include an ID number. The data type of the controller is uint32. The upper 31 bits are the number of seconds from the start time of the scheduling component to 00:00:00 on January 1, 2020, and the lowest bit is the ID number of the controller. If two target controllers are started at the same time, and it is currently determined that there is no running controller based on the working status of the device, the operating status of each target controller can be determined based on the ID number of the target controller. For example, when two target controllers are started at the same time, the upper 31 bits are the same, and the judgment can be made based on the lowest bit ID number, that is, the smaller the ID number value, the higher the priority. The target controller with a smaller ID number value can be used as the host controller, and the target controller with a larger ID number value can be used as the slave controller, thereby avoiding the problem that two controllers are online at the same time and the controller cannot judge the priority.
[0044] S3, adjusting the working status of the target controller and the device according to the operating status of the target controller.
[0045] Specifically, after obtaining the operating status of the target controller, the working status of the target controller and the device can be adjusted according to the operating status of the target controller. For example, when the operating status of the target controller is host operation, not only the attribute information is sent to the controller in the device, but also the current device operation data needs to be sent to the controller in the device to achieve data synchronization. When the operating status of the target controller is slave operation, the device operation data received from the host is synchronized, and the local attribute information is sent to the running controller. When the target controller is in slave operation, the host detection clock is set to confirm whether the host is online. That is, the controller enters the initial state at startup and starts the initialization clock. The initialization clock can be set to 3 seconds. When the initialization clock times out and detects that the target controller has not entered the host operation or slave operation state, it is considered that the target controller has not received any signal from the running controller, and the target controller can enter the host operation state from the startup state.
[0046] As a specific example, the target controller has three states: startup state, master operation, and slave operation. When the target controller is started, it enters the startup state by default and sends the attribute information of the target controller to the running controller at a regular interval of 100ms. After receiving the attribute information of the running controller, the target controller can check and verify it according to the Figure 2 and Figure 3 The master-slave state diagnosis method shown in the figure determines whether the target controller switches the working state and the working state options to be switched. In addition, the host detection clock is set in the target controller program, and the clock is set to time out for 1s. The purpose of setting the host detection clock is to detect whether the host controller of the device is operating normally when the target controller is in slave operation. When the target controller enters the slave operation state, the host detection clock is turned on. When the slave controller receives the host controller signal, the host detection clock is reset; when the target controller switches out of the slave state, the host detection clock is turned off. Therefore, when the host detection clock times out, that is, the controller in the slave operation state has not received a signal from the host controller for 1ms, it can be considered that the original host controller has been offline, so the slave controller switches to the master operation state. The target controller diagnoses its current master-slave state by receiving the attribute information of the running controller. If the controller has not received the attribute information of the running controller, it will not start the diagnosis and switch the state. Therefore, the present invention sets a startup detection clock for the target controller. When the target controller is online, it enters the startup state and turns on the startup detection clock. The startup detection clock sets a single trigger timeout of 3 seconds. When the startup clock times out, the machine's working status is detected. If it is detected that the target controller has not switched to the host operation state or the slave operation state, it is considered that no other controller is currently running as a device, and the target controller switches to the host state to run.
[0047] Combination Figure 2 As shown, S101: the controller receives the attribute information of the running controller, including the priority, version number, and working status of the running controller. S102: Determine whether the version number of the running controller is consistent with that of the target controller. If not, proceed to step S103 to determine whether the version number of the target controller is newer. If so, proceed to step S105 to use the target controller as the host controller and take the running controller offline; if not, proceed to step S104 to use the running controller as the host controller and take the target controller offline. S102: Determine whether the version number of the running controller is consistent with that of the target controller. If consistent, proceed to step S106 to detect the working status information of the target controller and the running controller.
[0048] Combination Figure 3 As shown, after confirming that the target controller and the running controller have the same version, S106: detect the working state information of the target controller and the running controller. The following is a technical design of the target controller and the running controller's working state switching behavior in different working states when the two controllers have the same version.
[0049] In scenarios C01 and C05, the target controller and the running controller have the same working state and are not in the startup state. Theoretically, such scenarios will not occur in a good communication environment. If such scenarios occur, the priority of the controller is confirmed to diagnose whether the controller needs to switch states. That is, when the target controller and the running controller are both running as masters, if the priority of the target controller is lower than the priority of the running controller, the target controller switches to the slave running state and turns on the master clock detection. When the target controller and the running controller are both running as slaves, if the priority of the target controller is higher than the priority of the running controller, the target controller switches to the master running state.
[0050] In scenario C02, the target controller operates as a slave controller of the device. After receiving the signal from the host controller, the target controller reads the device operation data sent by the host controller and synchronizes the device operation data in the target controller, that is, the slave controller reads the device operation data of the host controller to achieve real-time data synchronization. This scenario is the only scenario in which the target controller reads the device data of the running controller. In addition, the controller in slave operation turns on the host detection clock. In this scenario, the slave receives the host signal and resets the host detection clock.
[0051] In scenario C03, the target controller in the startup state detects that the running controller is in the master state, the target controller switches to the slave state and starts the master detection clock.
[0052] In scenarios C04 and C08, when the target controller running in the master state detects that the running controller is in the slave running and startup state, the host controller does not need to adjust its own attribute parameters.
[0053] In scenarios C06, C07, C09, C10, and C11, the device does not have a controller in host operation at this time, and it is necessary to determine the target controller to switch to or the running controller to be the host controller through priority judgment. That is, when the running controller is in slave operation and the target controller is in the startup state, it is determined whether the priority of the target controller is higher than that of the running controller. If so, the target controller is switched to the host operation state; if not, the target controller is switched to the slave operation state. When the running controller is in the startup state and the target controller is in slave operation, when the priority of the target controller is higher than that of the running controller, the target controller is switched to the host operation state. When both the running controller and the target controller are in the startup state, if the priority of the target controller is higher than that of the running controller, the target controller is switched to the host operation state. In scenario C11, when the controller in the startup state detects that the running controller is a controller in the startup state with a higher priority than the target controller, the startup detection clock of the target controller is reset. This setting is because the two controllers exchange identity information with each other. In the next moment, the running controller switches to the master state. The target controller detects the controller in the master state (that is, scenario C03) and should switch to the slave state. Therefore, there is no risk of being in the startup state for a long time.
[0054] In summary, the master-slave control method of the controller according to the embodiment of the present invention first receives the working status of the device when the target controller is online, then determines the operating status of the target controller according to the working status of the device and the attribute information of the target controller, and finally adjusts the working status of the target controller and the device according to the operating status of the target controller. Therefore, the method enables the device to not need to pre-set the master-slave relationship of the controller, improves the intelligence of the device and the reliability of the device operation, and is simple to implement.
[0055] Corresponding to the above embodiment, the present invention further proposes a master-slave control device of a controller.
[0056] like Figure 4 As shown, the master-slave control device 100 of the controller of the embodiment of the present invention may include: a receiving module 110 , a determining module 120 and an adjusting module 130 .
[0057] The receiving module 110 is used to receive the working state of the device when the target controller is online. The determining module 120 is used to determine the operating state of the target controller according to the working state of the device and the attribute information of the target controller. The adjusting module 130 is used to adjust the working state of the target controller and the device according to the operating state of the target controller.
[0058] According to one embodiment of the present invention, the attribute information of the target controller includes a priority, and the determination module 120 determines the operating status of the target controller based on the working status of the device and the attribute information of the target controller, and is specifically used for: when it is determined according to the working status of the device that there is a host controller, controlling the target controller as a slave controller; when it is determined according to the working status of the device that there is a slave controller, determining the host controller and the slave controller of the device according to the priority of the target controller; when it is determined according to the working status of the device that there is no running controller, controlling the target controller as a host controller.
[0059] According to one embodiment of the present invention, when determining that there is a slave controller according to the working status of the device, the determination module 120 determines the host controller and the slave controller of the device according to the priority of the target controller, and is specifically used to: determine the priority of the target controller according to the online time of the slave controller running in the device and the target controller; wherein, the longer the online time, the higher the priority; if the priority of the target controller is higher than the priority of the slave controller running in the device, the target controller is used as the host controller of the device, and the slave controller running in the device is used as the slave controller of the device; if the priority of the target controller is lower than the slave controller running in the device, the slave controller running in the device is used as the host controller of the device, and the target controller is used as the slave controller of the device.
[0060] According to an embodiment of the present invention, the determination module 120 is further configured to: during the operation of the host controller and the slave controller of the device, if it is detected that the host controller of the device is offline, use the slave controller of the device as the host controller.
[0061] According to an embodiment of the present invention, the determination module 120 is further configured to: if it is detected that the offline controller is back online, the controller serves as a slave controller of the device and backs up the host controller of the device.
[0062] According to one embodiment of the present invention, the attribute information of the target controller includes a version number. The determination module 120 determines the running state of the target controller according to the working state of the device and the attribute information of the target controller, and is also used for: if it is determined according to the working state of the device that there is a running controller, then obtaining the version number of the running controller; determining the running state of the target controller according to the version number of the target controller and the version number of the running controller.
[0063] According to one embodiment of the present invention, the determination module 120 determines the running status of the target controller according to the version number of the target controller and the version number of the running controller, and is specifically used for: if the version number of the target controller is the same as the version number of the running controller, determining the running status of the target controller according to the working status of the device and the priority of the target controller; if the version number of the target controller is higher than the version number of the running controller, the target controller is used as the host controller and the running controller is offline; if the version number of the target controller is lower than the version number of the running controller, the running controller is used as the host controller and the target controller is offline.
[0064] According to one embodiment of the present invention, the attribute information of the target controller includes an ID number, and the determination module 120 determines the operating status of the target controller according to the working status of the device and the attribute information of the target controller, and is specifically used for: if there are two target controllers, and it is determined according to the working status of the device that there is no running controller, then the operating status of each target controller is determined according to the ID number of the target controller.
[0065] It should be noted that for details not disclosed in the master-slave control device of the controller in the embodiment of the present invention, please refer to the details disclosed in the master-slave control method of the controller in the embodiment of the present invention, and the details will not be repeated here.
[0066] According to the master-slave control device of the controller of the embodiment of the present invention, the receiving module is used to receive the working state of the device when the target controller is online, the determining module is used to determine the operating state of the target controller according to the working state of the device and the attribute information of the target controller, and the adjusting module is used to adjust the working state of the target controller and the device according to the operating state of the target controller. Thus, the device can make the device not need to pre-set the master-slave relationship of the controller, improve the intelligence of the device and the reliability of the device operation, and is simple to implement.
[0067] Corresponding to the above embodiment, the present invention also proposes a computer-readable storage medium.
[0068] The computer-readable storage medium of the embodiment of the present invention stores a master-slave control program of the controller, and the master-slave control program of the controller implements the master-slave control method of the controller when executed by the processor.
[0069] According to the computer-readable storage medium of an embodiment of the present invention, by executing the above-mentioned master-slave control method of the controller, the device does not need to pre-set the master-slave relationship of the controller, thereby improving the intelligence level of the device and the reliability of the device operation, and the implementation is simple.
[0070] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0071] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0072] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0073] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0074] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0075] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A master-slave control method of a controller, It is characterized in that include: When the target controller comes online, the working status of the receiving device; Determining the operating state of the target controller according to the working state of the device and the attribute information of the target controller; The working states of the target controller and the device are adjusted according to the running state of the target controller.
2. The master-slave control method of the controller according to claim 1, It is characterized in that The attribute information of the target controller includes a priority, and determining the operating state of the target controller according to the working state of the device and the attribute information of the target controller includes: When it is determined that there is a host controller according to the working state of the device, controlling the target controller to act as a slave controller; When it is determined that a slave controller exists according to the working state of the device, determining a host controller and a slave controller of the device according to the priority of the target controller; When it is determined according to the working state of the device that there is no running controller, the target controller is controlled to serve as a host controller.
3. The master-slave control method of the controller according to claim 2, It is characterized in that When it is determined that there is a slave controller according to the working state of the device, determining the host controller and the slave controller of the device according to the priority of the target controller includes: Determine the priority of the target controller according to the online time of the slave controller and the target controller running in the device; wherein the longer the online time, the higher the priority; If the priority of the target controller is higher than the priority of the slave controller running in the device, the target controller is used as the host controller of the device, and the slave controller running in the device is used as the slave controller of the device; If the priority of the target controller is lower than that of the slave controller running in the device, the slave controller running in the device is used as the host controller of the device, and the target controller is used as the slave controller of the device.
4. The master-slave control method of the controller according to claim 2, It is characterized in that During the operation of the host controller and the slave controller of the device, the method further includes: If it is detected that the host controller of the device is offline, the slave controller of the device is used as the host controller.
5. The master-slave control method of the controller according to claim 4, It is characterized in that Also includes: If it is detected that the offline controller is back online, it will serve as the slave controller of the device and back up the host controller of the device.
6. The master-slave control method of the controller according to claim 1, It is characterized in that The attribute information of the target controller includes a version number, and determining the operating state of the target controller according to the working state of the device and the attribute information of the target controller further includes: If it is determined according to the working state of the device that there is a running controller, obtaining a version number of the running controller; The running state of the target controller is determined according to the version number of the target controller and the version number of the running controller.
7. The master-slave control method of the controller according to claim 6, It is characterized in that Determining the running state of the target controller according to the version number of the target controller and the version number of the running controller includes: If the version number of the target controller is the same as the version number of the running controller, determining the running state of the target controller according to the working state of the device and the priority of the target controller; If the version number of the target controller is higher than the version number of the running controller, the target controller is used as the host controller and the running controller is offline; If the version number of the target controller is lower than the version number of the running controller, the running controller is used as the host controller and the target controller is offline.
8. The master-slave control method of the controller according to claim 1, It is characterized in that The attribute information of the target controller includes an ID number, and determining the operating state of the target controller according to the working state of the device and the attribute information of the target controller includes: If there are two target controllers, and it is determined according to the working state of the device that no running controller exists, the running state of each target controller is determined according to the ID number of the target controller.
9. A master-slave control device of a controller, It is characterized in that include: The receiving module is used to receive the working status of the device when the target controller comes online; A determination module, configured to determine the operating state of the target controller according to the working state of the device and the attribute information of the target controller; The adjustment module is used to adjust the working state of the target controller and the device according to the running state of the target controller.
10. A computer-readable storage medium, It is characterized in that A master-slave control program of the controller is stored thereon, and when the master-slave control program of the controller is executed by the processor, a master-slave control method of the controller according to any one of claims 1-8 is implemented.
Citation Information
Patent Citations
Control method and device of SVG parallel operation system and storage medium
CN111181169A
Method, system and related device for confirming master-slave relationship among multiple controllers
CN112486740A
Equipment switching method and device, electronic equipment and computer readable storage medium
CN113505028A
System for controlling master / Slave dynamic configuration
JP2002278787A
Master / slave system, control device, master / slave switching method and master / slave switching program
JP2013025765A
