Method and system for confirming configuration downloading result of automatic control system
By introducing a state machine and a dual-state identification mechanism into the automated control system, the problem of inconsistent states between the upper and lower computers caused by network anomalies was solved, ensuring the accuracy of configuration download results and improving the reliability and stability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, the confirmation of configuration download results depends on instantaneous network communication between the upper and lower computers. This can lead to inconsistencies in the states of the upper and lower computers when the network is abnormal, which may erroneously trigger a full offline download and affect the continuous and stable operation of the control system.
A state machine and a dual-configuration identifier mechanism are introduced. By creating a state machine in the host computer and recording the first configuration identifier of the last successful download and the second configuration identifier to be downloaded this time, the identifier update is precisely controlled by the communication feedback mechanism to ensure the accuracy of the download results.
This effectively avoids inconsistencies in the configuration status of upper and lower level machines due to network anomalies, prevents accidental triggering of offline downloads and system resets, and improves the reliability and stability of the system.
Smart Images

Figure CN121657643A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation control technology, and in particular to a method and system for confirming the configuration download results of an automated control system. Background Technology
[0002] In existing technologies, the confirmation of configuration download results relies on instantaneous network communication between the upper and lower level computers. If network packet loss, timeouts, or abnormal shutdowns of the upper level computer occur upon download completion, the upper level computer may fail to successfully record the unique configuration identifier, while the lower level computer has already updated and recorded the new identifier. This inconsistency between the upper and lower level computers can incorrectly trigger a full offline download on the next download, causing unnecessary system resets and severely impacting the continuous and stable operation of the control system.
[0003] Therefore, there is an urgent need to provide a technical solution to address the above problems. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a method and system for confirming the configuration download results of an automated control system.
[0005] In a first aspect, the present invention provides a method for confirming the configuration download results of an automated control system, the technical solution of which is as follows: In the host computer, each configuration is in the process of online download. Each configuration creates a state machine during a download process and records the first configuration identifier of the previous successful download and the second configuration identifier to be downloaded this time. The host computer communicates with each slave computer in the download configuration to download data. The host computer updates the state machine based on the download result signal fed back by the slave computer within a specified time period. Based on the state of the state machine, it determines whether to update the first configuration identifier to be consistent with the second configuration identifier. When the state machine is updated to the point where the download is complete, the state machine to which the download belongs is destroyed to confirm the download result of this configuration. The configuration is the configuration information implemented by the control system software in the host computer for the slave computer to update or run.
[0006] The beneficial effects of the method for confirming the configuration download results of an automated control system according to the present invention are as follows: The method of this invention creates a state machine and a double-reset state identifier, and combines a communication feedback mechanism to precisely control the identifier update, effectively avoiding inconsistencies in the configuration states of the upper and lower computers caused by network anomalies, preventing accidental triggering of offline downloads and system resets, and improving system reliability.
[0007] Based on the above scheme, the method for confirming the configuration download result of an automated control system according to the present invention can be further improved as follows.
[0008] In one optional approach, each configuration in the host computer is in the process of online download. Each configuration creates a state machine during a download process and records the identifier of the first configuration that was successfully downloaded previously and the identifier of the second configuration to be downloaded this time, including: If an online download instruction for a specified configuration corresponding to a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first configuration identifier and the second configuration identifier in the text file storing the specified configuration path are written into the created hash table.
[0009] Among the above optional methods, by creating a state machine and hash table and persistently storing configuration identifiers, systematic management and rapid matching of the download process state are achieved. At the same time, the file storage mechanism effectively addresses scenarios such as abnormal system shutdown, ensuring the recoverability of critical data and improving the overall stability and execution efficiency of the download process.
[0010] In an alternative approach, the method further includes: The host computer reads the first configuration identifier and the historical configuration identifier to be downloaded from persistent storage, and obtains the current running configuration identifier of the corresponding slave device; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave device in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded, determine whether to perform online download or offline download; If it is determined that an online download will be performed, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
[0011] Among the above optional methods, by introducing historical configuration identifiers to be downloaded into the download type decision, a multi-verification mechanism is established. This mechanism can accurately identify the temporary inconsistency caused by the abnormal confirmation of the previous download result when the identifiers of the upper and lower computers are inconsistent, thereby avoiding the situation of being misjudged as needing offline download and significantly reducing the risk of unnecessary system reset.
[0012] In one optional approach, determining whether to perform online or offline download based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded includes: The host computer compares the current running configuration identifier with the first configuration identifier; If they match, then perform an online download; if they do not match, then further compare the current running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.
[0013] Among the above optional methods, by setting a two-level judgment process that first compares the running flag with the success flag, and then compares the running flag with the historical pending download flag, the decision logic for download types is refined, ensuring that the system can accurately distinguish between the two scenarios of "truly needing a full download" and "only needing to repair the flag status", thus further optimizing the accuracy of the download strategy.
[0014] In one optional approach, the host computer communicates and downloads data to each slave device in the download configuration, updating the state machine based on the download result signals fed back by the slave devices within a specified time period, including: During the download result confirmation process, the host computer sends a configuration completion command to the slave computer and waits to receive the download result signal returned by the slave computer. If a download result signal is received within the specified time period, the state machine state is updated to download successful or download failed based on the signal. If no download result signal is received within the specified time period, the state machine's state will be updated to download timeout.
[0015] Among the above-mentioned optional methods, by clearly defining the communication timeout mechanism and corresponding state machine state transitions in the download result confirmation stage, unreliable network factors are incorporated into the standardized processing flow, enabling the system to clearly define various results such as download success, failure, and timeout, providing accurate and reliable state basis for subsequent identifier updates.
[0016] In one alternative approach, the state machine-based determination of whether to update the first configuration identifier to match the second configuration identifier includes: If the state machine's state is updated to download successful, then the first configuration identifier is updated to match the second configuration identifier; If the state machine's state is updated to download failure or download timeout, the first configuration identifier remains unchanged.
[0017] In the above-mentioned optional methods, by strictly limiting the update of the successful configuration flag to when the state machine confirms that the download is successful, the authority and accuracy of the host computer record are ensured, effectively eliminating the fundamental problem of inconsistency between the host and host computer state records due to network anomalies and other reasons, and ensuring the continuity of long-term system operation from the result level.
[0018] Secondly, the present invention provides a system for confirming the configuration download results of an automated control system. The technical solution of the system is as follows: The system for confirming the configuration download results of the automated control system includes: The identification and recording module is used to record the identifier of the first configuration that was successfully downloaded last time and the identifier of the second configuration to be downloaded this time in the host computer when each configuration is in the process of online download. The communication feedback module is used to communicate and download with each slave device in the download configuration through the host computer, update the state machine according to the download result signal fed back by the slave device within a specified time period, and determine whether to update the first configuration identifier to be consistent with the second configuration identifier based on the state of the state machine. The resource cleanup module is used to destroy the state machine to which the current download belongs when the state machine is updated to the end of the download, so as to complete the confirmation of the download result of this configuration. The configuration is the configuration information implemented by the control system software in the host computer for the slave computer to update or run.
[0019] The beneficial effects of the automatic control system configuration download result confirmation system of the present invention are as follows: The system of this invention creates a state machine and a dual-state identifier, and combines a communication feedback mechanism to precisely control the identifier update, effectively avoiding inconsistencies in the configuration states of the upper and lower computers caused by network anomalies, preventing accidental triggering of offline downloads and system resets, and improving system reliability.
[0020] Based on the above scheme, the system for confirming the configuration download results of an automated control system according to the present invention can be further improved as follows.
[0021] In one alternative approach, the identification recording module is specifically used for: If an online download instruction for a specified configuration corresponding to a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first configuration identifier and the second configuration identifier in the text file storing the specified configuration path are written into the created hash table.
[0022] Among the above optional methods, by creating a state machine and hash table and persistently storing configuration identifiers, systematic management and rapid matching of the download process state are achieved. At the same time, the file storage mechanism effectively addresses scenarios such as abnormal system shutdown, ensuring the recoverability of critical data and improving the overall stability and execution efficiency of the download process.
[0023] In an alternative embodiment, the system further includes: The download judgment module is used to read the first configuration identifier and the historical configuration identifier to be downloaded from the persistent storage through the host computer, and obtain the current running configuration identifier of the corresponding slave computer; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave computer in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded, determine whether to perform online download or offline download; If it is determined that an online download will be performed, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
[0024] Among the above optional methods, by introducing historical configuration identifiers to be downloaded into the download type decision, a multi-verification mechanism is established. This mechanism can accurately identify the temporary inconsistency caused by the abnormal confirmation of the previous download result when the identifiers of the upper and lower computers are inconsistent, thereby avoiding the situation of being misjudged as needing offline download and significantly reducing the risk of unnecessary system reset.
[0025] In one alternative approach, the download determination module is specifically used for: The host computer compares the current running configuration identifier with the first configuration identifier. If they match, then perform an online download; if they do not match, then further compare the current running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.
[0026] Among the above optional methods, by setting a two-level judgment process that first compares the running flag with the success flag, and then compares the running flag with the historical pending download flag, the decision logic for download types is refined, ensuring that the system can accurately distinguish between the two scenarios of "truly needing a full download" and "only needing to repair the flag status", thus further optimizing the accuracy of the download strategy.
[0027] In one alternative approach, the communication feedback module is specifically used for: During the download result confirmation process, the host computer sends a configuration completion command to the slave computer and waits to receive the download result signal returned by the slave computer. If a download result signal is received within the specified time period, the state machine state is updated to download successful or download failed based on the signal. If no download result signal is received within the specified time period, the state machine's state will be updated to download timeout.
[0028] Among the above-mentioned optional methods, by clearly defining the communication timeout mechanism and corresponding state machine state transitions in the download result confirmation stage, unreliable network factors are incorporated into the standardized processing flow, enabling the system to clearly define various results such as download success, failure, and timeout, providing accurate and reliable state basis for subsequent identifier updates.
[0029] In an alternative embodiment, the communication feedback module is further specifically used for: If the state machine's state is updated to download successful, then the first configuration identifier is updated to match the second configuration identifier; If the state machine's state is updated to download failure or download timeout, the first configuration identifier remains unchanged.
[0030] In the above-mentioned optional methods, by strictly limiting the update of the successful configuration flag to when the state machine confirms that the download is successful, the authority and accuracy of the host computer record are ensured, effectively eliminating the fundamental problem of inconsistency between the host and host computer state records due to network anomalies and other reasons, and ensuring the continuity of long-term system operation from the result level.
[0031] Thirdly, the technical solution of an electronic device according to the present invention is as follows: It includes a memory, a processor, and a program stored in the memory and running on the processor, wherein the processor executes the program to implement the steps of the method for confirming the configuration download results of the automated control system as described in this invention.
[0032] Fourthly, the technical solution of a computer-readable storage medium provided by the present invention is as follows: The computer-readable storage medium stores instructions that, when read, cause the computer-readable storage medium to perform the steps of the method for confirming the configuration download result of the automated control system according to the present invention.
[0033] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0034] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a flowchart illustrating a method for confirming the configuration download results of an automated control system according to the present invention. Figure 2 This is a flowchart illustrating the configuration download type determination process of the present invention; Figure 3 This is a flowchart illustrating the download result confirmation and configuration identifier update process of the present invention; Figure 4 This is a schematic diagram of the structure of a system for confirming the configuration download results of an automated control system according to the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device according to the present invention. Detailed Implementation
[0035] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0036] In the field of industrial automation control technology, automated control systems typically consist of a host computer and several slave computers. The host computer is responsible for the design and management of the system configuration. The configuration is a general term for all kinds of configuration information required for the operation of the control system, including control logic, communication parameters, hardware configuration, etc. The slave computers, as field execution units, must load and run the configuration issued by the host computer to realize their control functions. Therefore, accurately and reliably downloading the configuration to the slave computers is the foundation for ensuring the normal operation of the entire automation system.
[0037] In this process, confirming the configuration download results is particularly important. A correct confirmation mechanism ensures that the upper and lower level computers have a consistent understanding of the currently running configuration version. This is the key basis for deciding whether the next download should use an online method (incremental update, which does not affect continuous system operation) or an offline method (full update, which causes system reset). If the confirmation result is unreliable, it will directly lead to misjudgment, which may result in unplanned system shutdown and reset, posing a serious threat to the stability and security of continuous production.
[0038] Currently, common implementations rely on instantaneous confirmation between the lower and upper control systems via communication. Specifically, after the configuration content is transmitted, both parties exchange confirmation signals to determine whether the download was successful and record the unique identifier of the configuration accordingly. However, the unreliability of industrial field networks and potential anomalies in the upper control system inherently flaw this confirmation mechanism based on ideal communication. For example, at the moment the download is completed, the lower control system may have successfully received and applied the new configuration and immediately sent a confirmation signal; however, this signal may fail to reach the upper control system due to network latency or packet loss, or it may fail to save the success status due to a sudden power outage of the upper control system. This leads to a typical paradoxical situation: the lower control system believes it is running on the new version of the configuration, while the upper control system still records the success identifier of the old version. When the operator subsequently initiates another download, the system will detect the inconsistency between the upper and lower control system identifiers, thus erroneously triggering a full offline download, causing an unnecessary reset of the entire control system and interrupting the ongoing process flow.
[0039] To address the aforementioned drawbacks, the core idea of this invention is to introduce a state machine to manage the entire download process in a refined manner, and to adopt a dual recording and comparison mechanism of "previous successful download identifier" and "current download identifier" to transform the confirmation of download results from relying on a single instantaneous communication to a reliable decision based on process state and persistent storage.
[0040] Taking the aforementioned network anomaly scenario as an example, under the solution of this invention, even if the confirmation signal is lost upon completion of the download, the host computer will not immediately update the "success flag" because it has not received confirmation. However, before the next download, the system will read the current running flag of the slave computer and compare it with the locally recorded "download flag" (which has been pre-saved at the start of this download). When the two are found to match, it can be determined that the previous download was actually successful on the slave computer side, but an anomaly occurred in the confirmation process. The system will then automatically repair the local "success flag" and intelligently select the online download method, thereby successfully avoiding unnecessary system resets caused by misjudgment and fundamentally improving the robustness and continuous operation capability of the system.
[0041] Figure 1 This diagram illustrates a flowchart of an embodiment of a method for confirming the configuration download results of an automated control system provided by the present invention. This method is executed by a system for confirming the configuration download results of an automated control system. Figure 1 As shown, it includes the following steps: S1. Each configuration in the host computer is in the process of online download. Each configuration creates a state machine during a download process and records the identifier of the first configuration that was successfully downloaded last time and the identifier of the second configuration to be downloaded this time.
[0042] For example, a state machine can be a linked list of states or an enumerated variable, whose states include at least: ready to download, downloading, download result confirmed, download successful, download failed, download timed out, and download completed. The first and second configuration identifiers can be globally unique identifiers (UUIDs). For example, the first configuration identifier corresponds to DownloadOKUUID, used to represent the configuration version successfully applied to the lower-level device; the second configuration identifier corresponds to DownloadUUID, used to represent the configuration version currently being prepared for download. The core of this step is to establish an independent, traceable session context for each download task.
[0043] It is understood that the "record" in this invention refers not only to temporary storage in memory (such as a hash table), but more importantly, to persistently storing these two configuration identifiers in a non-volatile storage medium (such as a text file Config.ini) under the configuration path. This is intended to address scenarios such as abnormal system shutdown, ensuring that even if the host computer unexpectedly restarts, the critical version identifier information will not be lost, providing a data foundation for subsequent abnormal recovery.
[0044] S2. The host computer communicates with each slave computer in the download configuration to download data. The host computer updates the state machine based on the download result signal fed back by the slave computer within a specified time period, and determines whether to update the first configuration identifier to be consistent with the second configuration identifier based on the state of the state machine.
[0045] For example, this step covers the critical stage from sending configuration data to result confirmation. In the "Download Result Confirmation" state, the host computer sends a configuration configuration completion command to the slave computer and starts a timer to define a "specified time period". Within this time period, if the host computer receives a success signal from the slave computer, it updates the state machine to "Download Successful"; if it receives a failure signal, it updates to "Download Failed"; if no signal is received within the timeout period, the state machine updates to "Download Timeout". This mechanism incorporates the unreliability of network communication into a standardized processing flow.
[0046] Understandably, a key decision-making logic is "determining whether to update the first configuration identifier based on the state machine's state." The strategy is as follows: only when the state machine's state is explicitly updated to "download successful" is the value of the first configuration identifier (DownloadOKUUID) changed to the value of the second configuration identifier (DownloadUUID), thus formally confirming the download success. If the state is "download failed" or "download timed out," the first configuration identifier remains unchanged. This design ensures the authority of the host computer's records and prevents inconsistencies in the status records between the host and host computers due to communication anomalies.
[0047] S3. The host computer communicates with each slave computer in the download configuration to download data. The host computer updates the state machine based on the download result signal fed back by the slave computer within a specified time period, and determines whether to update the first configuration identifier to be consistent with the second configuration identifier based on the state of the state machine.
[0048] For example, when the state machine transitions to the "download complete" state, it signifies that all business logic (including success, failure, or timeout) for this download session has been processed. At this point, the system will release the state machine instance created for this download task and the memory resources it occupied. Simultaneously, the final configuration identifier result (regardless of whether the first configuration identifier was updated) will be written back to the persistent storage file to ensure that the final state of the file is strictly synchronized with the final result of this download.
[0049] Understandably, the "confirmation of the configuration download result" step in this section is a final, conclusive action. It signifies that the decisions based on the state machine state (such as whether to update the first configuration identifier in S2) have taken effect and been persisted, and the lifecycle of this download task has officially ended. Destroying the state machine is a necessary step in resource management; it ensures system cleanliness, avoids memory leaks, and prepares for processing the next download request.
[0050] The technical solution in this embodiment creates a state machine and a dual-state identifier, and combines a communication feedback mechanism to precisely control the identifier update, effectively avoiding inconsistencies in the configuration states of the upper and lower computers due to network anomalies, preventing accidental triggering of offline downloads and system resets, and improving system reliability.
[0051] In one optional approach, each configuration in the host computer is in the process of online download. Each configuration creates a state machine during a download cycle and records the identifier of the first configuration that was successfully downloaded previously and the identifier of the second configuration to be downloaded this time, including: If an online download instruction for a specified configuration of a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first and second configuration identifiers in the text file storing the specified configuration path are written into the created hash table.
[0052] In this embodiment, when an online download command for a specific configuration of a specific lower-level machine is received, the system immediately creates an independent state machine instance to manage the entire lifecycle of this download session. The state machine is used to accurately track and control the state of each stage in the download process, and its initial state is set to "ready to download," which marks the formal start of the download process.
[0053] Simultaneously, the system creates a dedicated hash table data structure for this configuration. The hash table stores key configuration identifier information in key-value pairs, its core function being to provide fast identifier lookup and matching capabilities. The system then reads the saved configuration identifiers from the persistent storage file under the specified configuration path and writes these identifier values into the newly created hash table. Specifically, the persistent storage file can be a text file, such as Config.ini, which records at least two key configuration identifiers: the first configuration identifier, corresponding to the DownloadOKUUID recorded in the file, representing the last successfully downloaded and run configuration version confirmed by the host computer; and the second configuration identifier, corresponding to the DownloadUUID recorded in the file, representing the current configuration version to be downloaded. In addition, this file can also save historical configuration identifiers to be downloaded, corresponding to the previous DownloadUUID, which can be called HistoryDownloadUUID, used to record configuration versions that were planned to be downloaded during the previous download process but may not have been ultimately confirmed due to anomalies. By loading these pre-stored identifiers from the file into a hash table in memory, the system prepares the data for subsequent identifier comparison and download decisions.
[0054] To facilitate understanding, let's illustrate with a specific scenario: Suppose a user clicks the online download button for a slave device named "PLC_01" via the host computer interface, triggering an online download command. The system then responds by creating a state machine object for this download task and setting its current state to "Ready to Download". Next, the system instantiates a hash table in memory, locates the project path where the "PLC_01" configuration is located, and reads the Config.ini file in that path. Suppose this file contains the following three lines of records: DownloadOKUUID=a1b2c3d4... (This is the first configuration identifier, i.e., the version that was successfully run last time); DownloadUUID=x9y8z7w6... (This is the second configuration identifier for this download, representing the new version that will be downloaded soon); HistoryDownloadUUID=e5f6g7h8... (This is the historical configuration identifier for downloads, representing the version that was last attempted to be downloaded).
[0055] The system loads all these key-value pairs into a hash table: associating "DownloadOKUUID" with the value "a1b2c3d4...", "DownloadUUID" with the value "x9y8z7w6...", and "HistoryDownloadUUID" with the value "e5f6g7h8...". In this way, the first configuration identifier, the second configuration identifier, and the historical downloadable configuration identifier complete their initialization records for this download session. These three identifiers together constitute a complete state context, enabling the system to not only determine regular version consistency in subsequent steps but also perform recoverable diagnostics using the historical downloadable configuration identifier when anomalies occur, thereby intelligently selecting the correct download method and avoiding unnecessary system resets. This series of operations ensures that each download session has an independent, complete, and accurate context environment.
[0056] In one alternative approach, the method further includes: The host computer reads the first configuration identifier and the historical configuration identifier to be downloaded from the persistent storage, and obtains the current running configuration identifier of the corresponding slave computer; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave computer in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configurations to be downloaded identifier, determine whether to perform online download or offline download; If online download is selected, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
[0057] In one optional approach, based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifiers to be downloaded, it is determined whether to perform an online download or an offline download, including: The host computer compares the current running configuration identifier with the first configuration identifier; If they match, then perform an online download; if they do not match, then further compare the currently running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.
[0058] It should be noted that, in the complete technical solution of this invention, the online download process should be broadly understood as the entire session cycle from the user issuing the online download command to the final confirmation of the download result, rather than just referring to the configuration data transmission stage. Therefore, the creation of the state machine and the starting point of its lifecycle begin precisely when the online download command is received. Furthermore, the download type determination step is embedded within the online download process in the implementation of the technical solution. Specifically, the online download process is a complete logical session that begins with the creation of the state machine and naturally incorporates download type determination as an indispensable initial decision-making stage in its flow. Therefore, the continued execution of the online download process involves the core steps of configuration data transmission and subsequent confirmation after successful determination.
[0059] In this embodiment, as Figure 2 As shown, when a user triggers an online download command for a specified configuration on a designated lower-level machine, the system immediately creates a state machine and sets its initial state to "Ready to Download". Subsequently, the state transitions to "Configuration Verification in Progress", marking the initiation of the download type judgment logic. In this state, the upper-level machine performs crucial data acquisition operations: reading the first configuration identifier and historical configuration identifiers to be downloaded from persistent storage. The historical configuration identifiers represent configuration versions that were attempted to be downloaded to the lower-level machine during the previous download process but may not have been ultimately confirmed due to anomalies. Simultaneously, the upper-level machine sends a query command to the lower-level machine to obtain the configuration version currently running on the corresponding lower-level machine, i.e., the currently running configuration identifier.
[0060] Subsequently, the state machine enters the "configuration verification complete" state. In this state, the system, based on the acquired current running configuration identifier, first configuration identifier, and historical configuration identifier to be downloaded, executes a two-stage judgment logic to determine whether to perform an online download or an offline download. This judgment forms the basis for subsequent process decisions. If it is ultimately determined to perform an online download, the system will perform a crucial preparatory action: replacing the historical configuration identifier to be downloaded with the current second configuration identifier. The significance of this operation is that it pre-records the "configuration version to be downloaded," laying the data groundwork for handling possible download result confirmation anomalies. After completing this operation, the state machine updates to the "start download" state, thus marking the imminent start of the core configuration data transmission phase. At this point, the online download process can continue. This design ensures the state machine's coherent management of the entire session cycle (from decision to execution), with download type judgment being a key link embedded in this coherent process, rather than an isolated pre-processing action.
[0061] Specifically, based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifiers to be downloaded, the system determines whether to perform an online or offline download, involving a fine-grained two-level comparison process. The host computer first compares the current running configuration identifier with the first configuration identifier. If they match, it indicates that the slave computer is running the last successful version recorded by the host computer, and the status is consistent, so online download is directly executed. If they do not match, a second-level judgment is triggered: the host computer further compares the current running configuration identifier with the historical configuration identifiers to be downloaded. If they match at this level, it reveals a specific abnormal scenario: the version actually running on the slave computer is the version that was attempted to be downloaded during the previous download process but was not successfully confirmed by the host computer due to communication abnormalities or other reasons. In this case, the system intelligently determines to still execute online download, because this is a situation where the status is inconsistent but can be repaired by the mechanism, rather than a version conflict requiring a full reset. If the second-level comparison also does not match, it indicates that there is a substantial difference between the configuration versions of the host and slave computers, and full synchronization must be performed through offline download.
[0062] To facilitate understanding, let's illustrate with a specific scenario: Suppose a user triggers an online download command on the lower-level machine "PLC_01". The state machine is created and enters "Preparing to Download", then immediately transitions to "Configuration Checking". In this state, the upper-level machine reads the first configuration identifier (DownloadOKUUID) as "A1B2" from the configuration file, the historical configuration identifier to be downloaded (HistoryDownloadUUID) as "C3D4", and queries the lower-level machine to find the currently running configuration identifier as "E5F6". The system performs a first-level comparison ("E5F6" vs "A1B2") which is inconsistent, and then performs a second-level comparison ("E5F6" vs "C3D4") which is also inconsistent. Therefore, it determines that offline download needs to be performed, and the state machine then transitions to the end process. In another scenario, if the currently running identifier of the lower-level machine is found to be "X9Y8", and the historical configuration identifier to be downloaded is also "X9Y8". After the first-level comparison is inconsistent, the second-level comparison result is consistent. At this point, the system, under the "configuration verification complete" state, determines to execute the online download and updates the historical configuration to be downloaded identifier to the new version (e.g., "Z7W6"). The state machine then transitions to "start download," formally entering the core stage of configuration data transmission and confirmation. This design, embedding the judgment logic into the state machine flow, ensures the rigor of the process and the ability to handle exceptions, effectively distinguishing between state inconsistencies caused by momentary communication anomalies and genuine version conflicts, greatly reducing unnecessary system resets.
[0063] In one optional approach, the host computer communicates and downloads data to each slave device in the download configuration, updating the state machine based on the download result signals fed back by the slave devices within a specified time period, including: During the download result confirmation process, the host computer sends a configuration completion command to the slave computer and waits to receive the download result signal returned by the slave computer. If a download result signal is received within a specified time period, the state machine state is updated to download successful or download failed based on the signal. If no download result signal is received within the specified time period, the state machine's state will be updated to download timeout.
[0064] In this embodiment, as Figure 3 As shown, after the configuration data is sent, the system enters the download result confirmation process. During this process, the host computer first sends a configuration data transmission completion command to the slave computer, indicating that the data transmission phase has ended.
[0065] Subsequently, the host computer starts a timer to wait for the download result signal returned by the slave computer. The duration of this wait is the specified time period. This time period can be preset according to the network environment and system requirements (e.g., set to 30 seconds).
[0066] If the host computer successfully receives a download result signal from the slave computer within the specified time period, it updates the state machine's state according to the signal's content: if the signal indicates successful download, the state machine's state is updated to "Download Successful"; if the signal indicates download failure, the state machine's state is updated to "Download Failed". If the host computer does not receive any download result signal within the specified time period, it is determined to have timed out, and the state machine's state is updated to "Download Timeout".
[0067] This mechanism ensures that even in the event of network anomalies, the system can accurately record the final state of the download process through the state machine, providing a clear basis for subsequent decision-making.
[0068] In one alternative approach, determining whether to update the first configuration identifier to match the second configuration identifier based on the state of the state machine includes: If the state machine's state is updated to download successful, then the first configuration identifier is updated to match the second configuration identifier; If the state machine's state is updated to download failure or download timeout, the first configuration flag remains unchanged.
[0069] In this embodiment, as Figure 3 As shown, the system detects the current state of the state machine. If the state is updated to "Download Successful," a critical operation is performed, updating the value of the first configuration identifier to match the value of the second configuration identifier. This means that the configuration version downloaded this time has been officially confirmed as a stable running version, and its identifier (i.e., the second configuration identifier) is promoted to the new success benchmark (i.e., the first configuration identifier). Conversely, if the state machine is updated to "Download Failed" or "Download Timed Out," the system keeps the first configuration identifier unchanged, that is, it continues to use the configuration identifier of the last successful download as the valid benchmark. This decision rule is crucial, as it ensures the authority and accuracy of the first configuration identifier (DownloadOKUUID). Only downloads that have been explicitly verified to be successful will update this identifier, thereby fundamentally avoiding the problem of inconsistent version records between the upper and lower level machines due to network interruptions, lower-level machine malfunctions, and other failures.
[0070] To facilitate understanding, let's illustrate with a specific scenario: Suppose a download process has progressed to the download result confirmation stage, and the state machine is in the "download result confirmation" state. After the host computer sends a completion command, it starts a 30-second timer.
[0071] Scenario 1: At 20 seconds, the host computer receives a "success" signal from the slave computer, and the state machine is then updated to "download successful". According to the decision logic, the system updates the first configuration identifier (assuming it was originally "Ver1.0") to the second configuration identifier (assuming it is "Ver2.0").
[0072] Scenario 2: At 20 seconds, the host computer receives a "failure" signal from the slave computer (if the slave computer verifies the configuration content incorrectly), the state machine updates to "download failed", and the first configuration identifier "Ver1.0" remains unchanged.
[0073] Scenario 3: The 30-second timer expires, the host computer does not receive any signal, the state machine updates to "download timeout", and the first configuration identifier "Ver1.0" remains unchanged.
[0074] In scenarios two and three, even if the download fails or times out, because the first configuration identifier is not updated incorrectly, when the configuration verification is performed during the next download start, the system will find that the current running identifier of the lower-level machine (which may still be "Ver1.0") is consistent with the success identifier ("Ver1.0") recorded by the upper-level machine. Thus, the online download can be executed correctly instead of triggering unnecessary offline downloads, effectively ensuring the continuity and stability of the system.
[0075] Figure 4 This diagram illustrates the structure of an embodiment of an automated control system configuration download result verification system 200 provided by the present invention. Figure 4 As shown, the system 200 includes: The identification and recording module 210 is used to record the identifier of the first configuration that was successfully downloaded last time and the identifier of the second configuration to be downloaded this time in the online download process of each configuration in the host computer. The communication feedback module 220 is used to communicate and download with each slave device in the download configuration through the host computer, update the state machine according to the download result signal fed back by the slave device within a specified time period, and determine whether to update the first configuration identifier to be consistent with the second configuration identifier based on the state of the state machine. The resource cleanup module 230 is used to destroy the state machine to which the current download belongs when the state machine is updated to the end of the download, so as to complete the confirmation of the download result of the current configuration; wherein, the configuration is the configuration information implemented by the control system software in the host computer for the slave computer to update or run.
[0076] The technical solution in this embodiment creates a state machine and a dual-state identifier, and combines a communication feedback mechanism to precisely control the identifier update, effectively avoiding inconsistencies in the configuration states of the upper and lower computers due to network anomalies, preventing accidental triggering of offline downloads and system resets, and improving system reliability.
[0077] In one alternative approach, the identification and recording module is specifically used for: If an online download instruction for a specified configuration of a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first and second configuration identifiers in the text file storing the specified configuration path are written into the created hash table.
[0078] In an alternative approach, the system also includes: The download judgment module is used to read the first configuration identifier and the historical configuration identifier to be downloaded from the persistent storage through the host computer, and obtain the current running configuration identifier of the corresponding slave computer; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave computer in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configurations to be downloaded identifier, determine whether to perform online download or offline download; If online download is selected, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
[0079] In one alternative approach, the download determination module is specifically used for: The host computer compares the current running configuration identifier with the first configuration identifier. If they match, then perform an online download; if they do not match, then further compare the currently running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.
[0080] In one alternative approach, the communication feedback module is specifically used for: During the download result confirmation process, the host computer sends a configuration completion command to the slave computer and waits to receive the download result signal returned by the slave computer. If a download result signal is received within a specified time period, the state machine state is updated to download successful or download failed based on the signal. If no download result signal is received within the specified time period, the state machine's state will be updated to download timeout.
[0081] In one alternative approach, the communication feedback module is also specifically used for: If the state machine's state is updated to download successful, then the first configuration identifier is updated to match the second configuration identifier; If the state machine's state is updated to download failure or download timeout, the first configuration flag remains unchanged.
[0082] The steps for each parameter and each module to perform the corresponding function in the above-described system 200 for confirming the configuration download result of the automated control system in this embodiment can be referred to the parameters and steps in the embodiment of the method for confirming the configuration download result of the automated control system described above, and will not be repeated here.
[0083] like Figure 5 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320 coupled to a memory 310. The memory 310 stores at least one computer program 330, which is loaded and executed by the processor 320 to enable the electronic device 300 to implement any of the above-mentioned methods for confirming the configuration download results of an automated control system. Specifically: The electronic device 300 can vary considerably due to differences in configuration or performance. It may include one or more processors 320 (Central Processing Units, CPUs) and one or more memories 310. The one or more memories 310 store at least one computer program 330, which is loaded and executed by the one or more processors 320 to enable the electronic device 300 to implement any of the automation control system configuration download result confirmation methods provided in the above embodiments. Of course, the electronic device 300 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The electronic device 300 may also include other components for implementing device functions, which will not be elaborated upon here.
[0084] An embodiment of the present invention provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to enable a computer to implement any of the above-described methods for confirming the configuration download results of an automated control system.
[0085] Alternatively, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device, etc.
[0086] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform any of the above-described methods for verifying the configuration download results of an automated control system.
[0087] It should be noted that the terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and represent a limitation on a specific order or sequence. Where appropriate, the order of use for similar objects can be interchanged so that the embodiments of this application described herein can be implemented in an order other than that shown or described.
[0088] Those skilled in the art will recognize that this invention can be implemented as a system, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: it can be entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the invention can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.
[0089] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0090] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for confirming the configuration download results of an automated control system, characterized in that, The confirmation method is used for the lower-level machine to download the configuration scheme that requires its own configuration from the upper-level machine. The confirmation method includes: In the host computer, each configuration is in the process of online download. Each configuration creates a state machine during a download process and records the first configuration identifier of the previous successful download and the second configuration identifier to be downloaded this time. The host computer communicates with each slave computer in the download configuration to download data. The host computer updates the state machine based on the download result signal fed back by the slave computer within a specified time period. Based on the state of the state machine, it determines whether to update the first configuration identifier to be consistent with the second configuration identifier. When the state machine is updated to the point where the download is complete, the state machine to which the download belongs is destroyed to confirm the download result of this configuration. The configuration is the configuration information implemented by the control system software in the host computer for the slave computer to update or run.
2. The method according to claim 1, characterized in that, Each configuration in the host computer is in the process of online download. During each download, each configuration creates a state machine and records the identifier of the first configuration that was successfully downloaded previously and the identifier of the second configuration to be downloaded this time, including: If an online download instruction for a specified configuration corresponding to a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first configuration identifier and the second configuration identifier in the text file storing the specified configuration path are written into the created hash table.
3. The method according to claim 1, characterized in that, The method further includes: The host computer reads the first configuration identifier and the historical configuration identifier to be downloaded from persistent storage, and obtains the current running configuration identifier of the corresponding slave device; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave device in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded, determine whether to perform online download or offline download; If it is determined that an online download will be performed, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
4. The method according to claim 3, characterized in that, The step of determining whether to perform online or offline download based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded includes: The host computer compares the current running configuration identifier with the first configuration identifier; If they match, then perform an online download; if they do not match, then further compare the current running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.
5. The method according to claim 1, characterized in that, The host computer communicates with each slave device in the download configuration to download data. Based on the download result signals fed back by the slave devices within a specified time period, the state machine is updated, including: During the download result confirmation process, the host computer sends a configuration completion command to the slave computer and waits to receive the download result signal returned by the slave computer. If a download result signal is received within the specified time period, the state machine state is updated to download successful or download failed based on the signal. If no download result signal is received within the specified time period, the state machine's state will be updated to download timeout.
6. The method according to claim 5, characterized in that, The state machine-based determination of whether to update the first configuration identifier to match the second configuration identifier includes: If the state machine's state is updated to download successful, then the first configuration identifier is updated to match the second configuration identifier; If the state machine's state is updated to download failure or download timeout, the first configuration identifier remains unchanged.
7. A system for confirming the configuration download results of an automated control system, characterized in that, The confirmation system is used for the lower-level machine to download the configuration scheme that requires its own configuration from the upper-level machine. The confirmation system includes: The identification and recording module is used to record the identifier of the first configuration that was successfully downloaded last time and the identifier of the second configuration to be downloaded this time in the host computer when each configuration is in the process of online download. The communication feedback module is used to communicate and download with each slave device in the download configuration through the host computer, update the state machine according to the download result signal fed back by the slave device within a specified time period, and determine whether to update the first configuration identifier to be consistent with the second configuration identifier based on the state of the state machine. The resource cleanup module is used to destroy the state machine to which the current download belongs when the state machine is updated to the end of the download, so as to complete the confirmation of the download result of this configuration. The configuration is the configuration information implemented by the control system software in the host computer for the slave computer to update or run.
8. The system according to claim 7, characterized in that, The identification recording module is specifically used for: If an online download instruction for a specified configuration corresponding to a specified lower-level machine is received, a state machine is created, and the state of the state machine is updated to ready to download. A hash table to which the configuration belongs is also created, and the values of the first configuration identifier and the second configuration identifier in the text file storing the specified configuration path are written into the created hash table.
9. The system according to claim 7, characterized in that, The system also includes: The download judgment module is used to read the first configuration identifier and the historical configuration identifier to be downloaded from the persistent storage through the host computer, and obtain the current running configuration identifier of the corresponding slave computer; wherein, the historical configuration identifier to be downloaded represents the configuration that was attempted to be downloaded to the slave computer in the previous download process; Based on the current running configuration identifier, the first configuration identifier, and the historical configuration identifier to be downloaded, determine whether to perform online download or offline download; If it is determined that an online download will be performed, the historical configuration identifier to be downloaded will be replaced with the second configuration identifier, and the online download process will continue.
10. The system according to claim 9, characterized in that, The download determination module is specifically used for: The host computer compares the current running configuration identifier with the first configuration identifier. If they match, then perform an online download; if they do not match, then further compare the current running configuration identifier with the historical configuration identifier to be downloaded. If they match, proceed with the online download; otherwise, proceed with the offline download.