Method and device for maintaining power failure
By associating the target data items of variable points with the power-off retention attributes in industrial automation control systems and adopting a more fine-grained setting method, the operational complexity and storage resource waste problems of the power-off retention function are solved, and a simplified and flexible power-off retention function is achieved.
Patent Information
- Application Number
- CN202510879156.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-14
AI Technical Summary
In the prior art, the power-off retention function of industrial automation control systems is cumbersome to operate and lacks flexibility, resulting in complex user operations and waste of storage resources.
By associating the target data item in the variable point with the power-off retention attribute, a more fine-grained setting method is adopted, and the name is used as the setting object. This supports independent setting of data items, reduces the amount of stored data, and simplifies operations.
The invention realizes the simplification and flexibility of the power-off retention function of industrial automation control, reduces storage pressure, and improves programming efficiency and data processing flexibility.
Smart Images

Figure CN120780540A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of industrial automation control technology, and in particular to a method and device for power-off retention. Background Art
[0002] The power-off retention function is an important function in industrial automation control. It supports retaining key data after the system loses power, so that the system can continue to operate normally based on the key data after power is restored, thereby improving the stability and reliability of the system.
[0003] In the prior art, each variable point that needs to be retained after power failure is usually set one by one, so that all data items of the variable point are preserved when the system loses power. However, this method is not only cumbersome to operate, but also lacks flexibility. Summary of the Invention
[0004] In view of the above problems, the present application provides a method and device for power-off retention, which realizes the power-off retention function of industrial automation control in a simple and flexible way.
[0005] The present application discloses a method for power-off retention, the method comprising:
[0006] Obtaining a target data item in a variable point; the data in the target data item is data that needs to be retained after power failure;
[0007] Associating the name corresponding to the target data item with the power-off retention attribute;
[0008] In the event of a power failure, determining that the data item corresponding to the name associated with the power failure retention attribute is the data item to be stored;
[0009] The data in the data item to be stored is stored, and after the power failure disappears, the data in the data item to be stored is read.
[0010] Optionally, the variable point includes a first variable point of a structure type, and associating the name corresponding to the target data item with the power-off retention attribute includes:
[0011] Open the data item list of the first variable point in the definition interface; the data item list includes multiple data items;
[0012] Check the name of the first target data item in the data item list to associate the name of the first target data item with the power-off retention attribute.
[0013] Optionally, the variable point includes a second variable point of a basic type, and associating the name corresponding to the target data item with the power-off retention attribute includes:
[0014] setting a preset name corresponding to a second target data item; the second variable point comprises a data item, which is the second target data item;
[0015] checking the preset name in a definition interface of the variable point, and associating the name corresponding to the second target data item with the power-off retention attribute.
[0016] Optionally, the associating the name corresponding to the target data item with the power-off retention attribute comprises:
[0017] adding a retain command in front of the name of the first target data item through a definition statement of the variable point, and associating the name of the first target data item with the power-off retention attribute.
[0018] Optionally, the associating the name corresponding to the target data item with the power-off retention attribute comprises:
[0019] adding a retain command in front of the preset name through the definition statement of the variable point;
[0020] adding an alias command in front of the preset name after the retain command is added, and associating the name corresponding to the second target data item with the power-off retention attribute.
[0021] Optionally, the associating the name corresponding to the target data item with the power-off retention attribute comprises:
[0022] defining a retain flag of the name of the target data item as true through an explanation file.
[0023] Based on the above power-off retention method, the application further discloses a power-off retention device, which comprises an acquisition unit, an association unit, a determination unit and a storage unit.
[0024] The acquisition unit is used for acquiring a target data item in a variable point; data in the target data item is data that needs to be subjected to power-off retention.
[0025] The association unit is used for associating a name corresponding to the target data item with a power-off retention attribute.
[0026] The determination unit is used for determining, in a power-off condition, that a data item corresponding to the name associated with the power-off retention attribute is a to-be-stored data item.
[0027] The storage unit is used for storing data in the to-be-stored data item, and reading the data in the to-be-stored data item after the power-off condition disappears.
[0028] Optionally, the variable point comprises a first variable point of a structure type, and the association unit comprises:
[0029] a list subunit configured to open a data item list of the first variable point in a definition interface of the variable point; the data item list comprising a plurality of data items;
[0030] a check subunit configured to check a name of a first target data item in the data item list and associate the name of the first target data item with the power-off retention attribute.
[0031] Optionally, the variable point comprises a second variable point of a basic type, and the associating unit comprises:
[0032] a preset subunit configured to set a preset naming corresponding to a second target data item; the second variable point comprising one data item, which is the second target data item;
[0033] an associating subunit configured to check the preset naming in the definition interface of the variable point and associate the name corresponding to the second target data item with the power-off retention attribute.
[0034] Optionally, the associating unit comprises:
[0035] a definition subunit configured to add a retain command before the name of the first target data item through a definition statement of the variable point and associate the name of the first target data item with the power-off retention attribute.
[0036] Optionally, the associating unit comprises:
[0037] an adding subunit configured to add a retain command before the preset naming through a definition statement of the variable point;
[0038] a command subunit configured to add an alias command before the preset naming after the retain command is added and associate the name corresponding to the second target data item with the power-off retention attribute.
[0039] Optionally, the associating unit comprises:
[0040] an instruction subunit configured to define a retain flag of the name of the target data item as true through an instruction file.
[0041] This application discloses a method and apparatus for power-off retention. A target data item in a variable point is obtained, where the data is to be retained during power-off. The name of the target data item is associated with a power-off retention attribute. Based on setting the power-off retention attribute for each variable point, the data item is used as the smallest unit for power-off retention, allowing independent setting of data items. This provides a more granular setting method, improves data processing flexibility, and saves data storage space. For example, when power-off retention is required for a data item in a variable point, compared to the prior art method of storing the data for the entire variable point, the method of this application only needs to store the data for this data item, reducing the amount of data to be stored and alleviating storage pressure. Using the name as the setting object for power-off retention reduces the number and difficulty of setting operations. For example, when power-off retention is required for multiple data items, compared to the prior art method of setting each variable point individually, the method of this application only needs to define a single alias to indicate these multiple data items, allowing all data items of the alias to be set at once. In the event of a power failure, the data item corresponding to the name associated with the power-off retention attribute is determined to be the data item to be stored, the data stored therein, and the data read after the power failure disappears. In summary, the method of the present application realizes the power-off retention function of industrial automation control in a simpler and more flexible way by changing the minimum unit and setting object of power-off retention. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0043] Figure 1 A flowchart of a power-off retention method disclosed in an embodiment of the present application;
[0044] Figure 2a This is a schematic diagram of setting structure variable points in the definition interface disclosed in the embodiment of this application;
[0045] Figure 2b This is a schematic diagram of setting basic type variable points in the definition interface disclosed in the embodiment of this application;
[0046] Figure 3 This is a schematic structural diagram of a power-off retention device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In industrial automation control, the IEC61131-3 standard is a widely used programming language standard for programmable logic controllers. It specifies a series of programming languages, such as ladder diagram (LD), instruction list (IL), and structured text (ST), providing a unified standard for programming industrial control systems. Regarding power-loss retention, the IEC61131-3 standard uses the "retain" keyword to mark variable points, enabling power-loss retention. When a variable point is marked with the "retain" keyword, the corresponding variable's value is stored in the event of a power outage and restored to its pre-power-loss state upon system power-up.
[0048] Currently, most software uses definition statements or provides a definition interface to set each variable point. In practical applications, the number of variable points in a project is often enormous. The IEC61131-3 standard requires power-off retention for each variable point, which complicates user operations, creates a significant workload, and is prone to configuration errors. Furthermore, for structures, not all data items in a variable point may require power-off retention. The IEC61131-3 standard only supports power-off retention for the entire structure as a variable point, resulting in redundant data storage and increased hardware pressure.
[0049] Therefore, this application has made technical improvements to the power-off retention function of the programmable logic controller programming language in the IEC61131-3 standard, proposing a name-based batch power-off retention setting method and a power-off retention setting method for individual data items within a structure. This solves the problems of complex and inflexible power-off retention settings and waste of storage resources.
[0050] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0051] Embodiment 1: This application discloses a method for power-off retention.
[0052] For details, please refer to Figure 1 A power-off retention method disclosed in this embodiment includes the following steps:
[0053] Step 101: Get the target data item in the variable point.
[0054] In the method of this embodiment, the data in the target data item is data that needs to be retained after power failure. When the system loses power, these data need to be stored in time to avoid loss due to their importance and particularity.
[0055] Step 102: Associating the name corresponding to the target data item with a power-off retention attribute.
[0056] In the method of this embodiment, as an optional method, for the first variable point of the structure type, the data item list of the first variable point is opened in the definition interface. Due to the structural characteristics of the first variable point, it will contain multiple data items, some of which need to be maintained after power failure, while some data items do not need to be maintained after power failure. The name, element type, whether to maintain power failure, and other information of each data item will be displayed in the data item list of the first variable point. Therefore, the target data item that needs to be maintained after power failure can be selected in the data item list, and the target data item can be associated with the power failure maintenance attribute by checking or other selection methods. For example, the second data item and the fourth data item can be given the power failure maintenance attribute at one time under the data item list of the first variable point.
[0057] In the method of this embodiment, for the second variable point of the basic data type (such as INT), there is only one data item under it. A preset name (such as T_INT) can be set in the definition interface to correspond to the data item, specifically the data type of the data item. Then, by checking, the data type corresponding to the preset name is associated with the power-off retention attribute. Taking the variable point of INT type as an example, this step can use T_INT as an alias for INT to represent the INT type. After assigning the power-off retention attribute to T_INT, the variable points of INT type represented by it also have the power-off retention attribute.
[0058] As another optional method, determine the first variable point in the variable point definition statement. This first variable point is still a structure type. Determine the target data item in the first variable point and add a retain command to the target data item. Specifically, add the retain command before the name of the data item to associate the name of the data item with the power-off retention attribute. For example, if the first variable point is SType1, STRUCT represents a structure, and item1 and item2 are the two data items under the first variable point, this operation is as follows:
[0059] SType1:STRUCT
[0060] item1:BOOL
[0061] retainitem2:BOOL
[0062] END_STRUCT
[0063] It can be seen that item1 and item2 are both of BOOL type. After this operation, item2 in SType1 has the power-off retention attribute, while item1 does not have the power-off retention attribute.
[0064] In the method of this embodiment, the second variable point is determined in the definition statement, and the second variable point is still the basic type (such as INT). First, set the preset name (for example, T_INT) corresponding to the second target data item under the second variable point. Add a retain command before the preset name, and then add an alias command before the preset name after adding the retain command to indicate that the preset name is associated with the name of the second target data item, and the data item corresponding to the preset name has a power-off retention attribute. Taking the second target data item of INT type as an example, set the preset name to T_INT, and then specify T_INT as an alias of INT through the alias command, and give T_INT a power-off protection attribute through the retain command. The statement is ALIAS:retain T_INT:INT. After this operation, all data items with the alias T_INT have a power-off protection attribute.
[0065] As another optional method, you can also define the retain flag of the target data item name as true through a description file (configuration file). The description file for a data item item2 in the structure variable point is as follows:
[0066] <variable name="item2"retain="TRUE">
[0067] <type>
[0068] <bool / >
[0069] < / type>
[0070]
[0071] As you can see, the description file defines the retain flag of item2 as true, giving item2 the power-off retention property. After this operation, item2 has the power-off retention property.
[0072] In the method of this embodiment, correspondingly, a variable point of a basic data type can also be defined through a description file. The operation can be to first assign a preset name T_INT power-off retention attribute, and then, based on the alias command, make T_INT correspond to the INT type. The description file can be specifically as follows:
[0073] <dataType name="T_INT"retain="TRUE">
[0074] <basetype>
[0075] <alias>
[0076] <int>
[0077] <alias / >
[0078] <basetype / >
[0079]
[0080] Step 103: In the event of a power failure, determine that the data item corresponding to the name associated with the power failure retention attribute is the data item to be stored.
[0081] In the method of this embodiment, the data item to be stored is a data item corresponding to the name associated with the power-off retention attribute.
[0082] Step 104: Storing the data in the data item to be stored, and reading the data in the data item to be stored after the power failure disappears.
[0083] This embodiment discloses a method and device for power-off retention. On the basis of setting the power-off retention attribute for each variable point, the data item is used as the minimum unit of power-off retention, and independent setting of the data item is supported, which adds a more fine-grained setting method, improves data processing flexibility, reduces the amount of data to be stored, reduces storage pressure, and saves data storage space. In addition, the name is used as the setting object for power-off retention. It is only necessary to define the association between the name and the power-off retention attribute, and all variable points belonging to the name can be set at one time. The number and difficulty of setting operations are reduced, programming efficiency is improved, and the probability of error is reduced. The power-off retention function of industrial automation control is realized in a simpler and more flexible way.
[0084] Example 2: This application discloses another method for power-off retention, please refer to Figure 2a The method described in this embodiment introduces the setting of structure variable points in the definition interface of variable points.
[0085] like Figure 2a As shown in the figure, SType1 in the upper left corner represents the structure variable point. The labels 1, 2, 3, and 4 on the left are the four data items under SType1. You can see that their names are item1, item2, item3, and item4, respectively. As shown in the figure, the element type of these four data items is BOOL. The Initial Value and Comment columns are both empty. In the Power Loss Retention column on the far right, item2 and item4 have been checked to give them the Power Loss Retention attribute. With this setting, item2 and item4 have the Power Loss Retention attribute, while item1 and item3 do not.
[0086] Example 3: This application discloses another method for power-off retention, please refer to Figure 2b The method described in this embodiment introduces the setting of basic type variable points in the variable point definition interface.
[0087] like Figure 2b As shown in the figure, T_INT in the upper left corner represents the preset name, its data type is set to INT, the Initial Value and Comment columns are both empty, and in the Retention column on the far right, T_INT has been given the Retention attribute by checking the box. After this setting, all data items named T_INT will have the Retention attribute.
[0088] Based on the power-off retention method disclosed in the above embodiment, this embodiment correspondingly discloses a power-off retention device. Figure 3 The power-off retention device includes: an acquisition unit 301, an association unit 302, a determination unit 303 and a storage unit 304;
[0089] The acquisition unit 301 is used to acquire a target data item in a variable point; the data in the target data item is data that needs to be retained after power failure;
[0090] The associating unit 302 is configured to associate the name corresponding to the target data item with a power-off retention attribute;
[0091] The determining unit 303 is configured to determine, in the event of a power failure, that the data item corresponding to the name associated with the power failure retention attribute is the data item to be stored;
[0092] The storage unit 304 is configured to store the data in the data item to be stored, and read the data in the data item to be stored after the power failure disappears.
[0093] Optionally, the variable point includes a first variable point of a structure type, and the associating unit 302 includes:
[0094] A list subunit is used to open a data item list of the first variable point in the definition interface of the variable point; the data item list includes multiple data items;
[0095] The check subunit is used to check the name of the first target data item in the data item list and associate the name of the first target data item with the power-off retention attribute.
[0096] Optionally, the variable point includes a second variable point of a basic type, and the associating unit 302 includes:
[0097] A preset subunit is used to set a preset name corresponding to a second target data item; the second variable point includes a data item, which is the second target data item;
[0098] The associating subunit is used to check the preset name in the definition interface of the variable point and associate the name corresponding to the second target data item with the power-off retention attribute.
[0099] Optionally, the associating unit 302 includes:
[0100] The definition subunit is used to add a retain command before the name of the first target data item through the definition statement of the variable point, so as to associate the name of the first target data item with the power-off retention attribute.
[0101] Optionally, the associating unit 302 includes:
[0102] Add a subunit for adding a retain command before the preset name through the definition statement of the variable point;
[0103] The command subunit is used to add an alias command before the preset name after adding the retain command, so as to associate the name corresponding to the second target data item with the power-off retention attribute.
[0104] Optionally, the associating unit 302 includes:
[0105] The description subunit is used to define the retain flag of the name of the target data item as true through a description file.
[0106] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0107] It should also be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a set of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0108] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0109] The features described in the embodiments of this specification can be replaced with each other or combined to enable professional and technical personnel in this field to implement or use this application.
[0110] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.< / int> < / alias> < / basetype>
Claims
1. A method for power-off retention, characterized in that: include: Get the target data item in the variable point; The data in the target data item is data that needs to be retained after power failure; Associating the name corresponding to the target data item with the power-off retention attribute; In the event of a power failure, determining that the data item corresponding to the name associated with the power failure retention attribute is the data item to be stored; The data in the data item to be stored is stored, and after the power failure disappears, the data in the data item to be stored is read.
2. The method according to claim 1, characterized in that The variable point includes a first variable point of a structure type, and associating a name corresponding to the target data item with a power-off retention attribute includes: Open the data item list of the first variable point in the definition interface; the data item list includes multiple data items; Check the name of the first target data item in the data item list to associate the name of the first target data item with the power-off retention attribute.
3. The method according to claim 1, characterized in that The variable point includes a second variable point of a basic type, and associating the name corresponding to the target data item with the power-off retention attribute includes: Set a preset name corresponding to the second target data item; the second variable point includes a data item, which is the second target data item; In the definition interface of the variable point, the preset name is checked, and the name corresponding to the second target data item is associated with the power-off retention attribute.
4. The method according to claim 2, characterized in that The associating the name corresponding to the target data item with the power-off retention attribute includes: By using the definition statement of the variable point, a retain command is added before the name of the first target data item to associate the name of the first target data item with the power-off retention attribute.
5. The method according to claim 3, characterized in that The associating the name corresponding to the target data item with the power-off retention attribute includes: Through the definition statement of the variable point, add the retain command before the preset name; An alias command is added before the preset name after the retain command to associate the name corresponding to the second target data item with the power-off retention attribute.
6. The method according to claim 1, characterized in that The associating the name corresponding to the target data item with the power-off retention attribute includes: By defining the retain flag of the name of the target data item in the description file, it is set to true.
7. A power-off holding device, characterized in that: include: an acquisition unit, an association unit, a determination unit, and a storage unit; The acquisition unit is used to acquire the target data item in the variable point; The data in the target data item is data that needs to be retained after power failure; The associating unit is used to associate the name corresponding to the target data item with the power-off retention attribute; The determining unit is configured to determine, in the event of a power failure, that the data item corresponding to the name associated with the power failure retention attribute is the data item to be stored; The storage unit is used to store the data in the data item to be stored, and read the data in the data item to be stored after the power failure disappears.
8. The device according to claim 7, characterized in that The variable point includes a first variable point of a structure type, and the association unit includes: A list subunit is used to open a data item list of the first variable point in the definition interface of the variable point; the data item list includes multiple data items; The check subunit is used to check the name of the first target data item in the data item list and associate the name of the first target data item with the power-off retention attribute.
9. The device according to claim 7, characterized in that The variable point includes a second variable point of a basic type, and the association unit includes: A preset subunit is used to set a preset name corresponding to a second target data item; the second variable point includes a data item, which is the second target data item; The associating subunit is used to check the preset name in the definition interface of the variable point and associate the name corresponding to the second target data item with the power-off retention attribute.
10. The device according to claim 8, characterized in that The association unit includes: The definition subunit is used to add a retain command before the name of the first target data item through the definition statement of the variable point, so as to associate the name of the first target data item with the power-off retention attribute.
