Variable forcing method and system of controller, storage medium, electronic equipment and computer program product
By constructing a forced variable table and judging variable state in a programmable controller, the problem of forced variable changes during code operation is solved, and the efficiency and accuracy of variable coercion is improved.
Patent Information
- Application Number
- CN202510206722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-27
AI Technical Summary
During the periodic code operation of a programmable controller, forced variables may be changed by the code performing assignment operations, resulting in the forced failure of the variables and affecting the debugging of the program logic.
By building a forced variable table in the controller, updating the variable and identifying it as a forced state, calling the interface function to judge the variable state, ensuring that the variable value remains unchanged under the forced state.
It effectively avoids the problem of forced variables being assigned and changed during the variable coercion process, and improves the efficiency and accuracy of variable coercion.
Smart Images

Figure CN120215331A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of programmable controllers. Specifically, it relates to a method and system for variable forcing of a controller, a storage medium, an electronic device, and a computer program product. Background Art
[0002] A programmable logic controller (PLC) is a digital computing operation electronic system designed for industrial environments. In PLC programming, variable forcing is widely used in the fields of discrete and process control. In cases where devices such as sensors and instruments are not installed or have failed, the programmable controller can force some variables to simulate actual on-site signal values to complete the debugging of the program and the verification of functions.
[0003] The inventors of the present application found that during the periodic code operation of the programmable controller, forced variables may be assigned values by code execution and temporarily obtain different values. Taking the variable of the motor speed as an example. The forced variable assigns the motor speed to 1000 RPM (revolutions per minute). During the periodic code operation of the programmable controller, the code may assign the motor speed to 1500 RMP. The above situation will cause the failure of variable forcing, thereby affecting the debugging of the program logic.
[0004] The content in the background art section is only the technology known to the applicant and does not necessarily represent the prior art in this field. Summary of the Invention
[0005] According to one aspect of the present application, the present application provides a method for variable forcing of a controller. The variable forcing method includes: the host computer sends the received forced variable information to the controller, so that the controller constructs a forced variable table according to the forced variable information, updates the variable according to the forced variable data included in the forced variable table, and marks the updated variable as a forced state; calls the interface function of the controller; determines that the state of the variable is a forced state, and then maintains the variable value of the variable.
[0006] According to another aspect of the present application, the present application further provides a method for variable forcing of a controller. The variable forcing method includes: the controller receives the forced variable information; constructs a forced variable table according to the forced variable information; updates the variable according to the forced variable data included in the forced variable table, and marks the updated variable as a forced state; in response to the received instruction to call the interface function, provides the state of the variable, so that when the host computer determines that the state of the variable is a forced state, it maintains the variable value of the variable.
[0007] According to another aspect of the present application, the present application further provides a variable forcing system for a controller. The variable forcing system includes a host computer and a slave computer. The host computer receives the forced variable information and sends the received forced variable information. The controller receives the forced variable information, constructs a forced variable table according to the forced variable information, updates the variable according to the forced variable data included in the forced variable table, and marks the updated variable as a forced state. The host computer also calls the interface function of the controller. The controller provides the status of the variable in response to the received instruction to call the interface function. The host computer also determines the status of the variable, and maintains the variable value of the variable when it is determined that the status of the variable is a forced state.
[0008] According to another aspect of the present application, the present application provides a non-volatile computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the variable forcing method of the present application is implemented.
[0009] According to another aspect of the present application, the present application provides an electronic device. The electronic device includes one or more processors and a storage device. The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the variable forcing method of the present application.
[0010] According to another aspect of the present application, the present application provides a computer program product, including a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the variable forcing method of the present application.
[0011] Beneficial effects
[0012] The technical solution of the present application keeps the variable value of the variable unchanged when it is determined that the variable is in a forced state, avoiding the change of the forced variable due to being assigned a value during the variable forcing process, thereby improving the efficiency and accuracy of variable forcing. Description of the drawings
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0014] Figure 1 It shows a schematic flowchart of the variable forcing method 1000 of the controller in the embodiment of the present application;
[0015] Figure 2 It shows a schematic flowchart of the variable forcing method 2000 of the controller in the embodiment of the present application;
[0016] Figure 3 It shows a schematic flowchart of step S230 of the variable forcing method of the controller according to an embodiment of the present application;
[0017] Figure 4 It shows a schematic flowchart of step S130 of the variable forcing method of the controller according to an embodiment of the present application;
[0018] Figure 5 It shows a schematic flowchart of the variable forcing method 3000 of the controller according to an embodiment of the present application;
[0019] Figure 6 It shows a schematic structural diagram of the variable forcing system 4000 according to an embodiment of the present application;
[0020] Figure 7 It shows a schematic diagram of the variable forcing table according to an embodiment of the present application;
[0021] Figure 8 It shows a schematic diagram of the variable data area and the variable forcing flag area according to an embodiment of the present application.
[0022] Description of reference numerals:
[0023] Host computer 1; Controller 2; Variable data area 21; Variable forcing flag area 22. Detailed implementation manners
[0024] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. Identical reference numerals in the figures denote identical or similar parts, and thus their repeated description will be omitted.
[0025] The described features, structures or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of these specific details, or can be implemented in other ways, components, materials, devices, etc. In these cases, well-known structures, methods, devices, implementations, materials or operations will not be shown or described in detail.
[0026] In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or devices.
[0027] The terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order.
[0028] The technical solutions of this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, rather than all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments in this application without creative efforts belong to the scope of protection of this application.
[0029] The following will describe this application in detail in conjunction with the drawings of the specification.
[0030] Figure 1 The flowchart of the variable forcing method 1000 of the controller in the embodiment of this application is shown. As Figure 1 shown, the variable forcing method 1000 includes steps S110 - S130. Exemplarily, the variable forcing method 1000 can be executed by a host computer.
[0031] In step S110, the host computer sends the received forced variable information to the controller, so that the controller constructs a forced variable table according to the forced variable information, updates the variable according to the forced variable data included in the forced variable table, and marks the updated variable as the forced state.
[0032] For example, Figure 7 The schematic diagram of the variable forcing table in the embodiment of this application is shown. The variable forcing table can store variables of different types. For example, the variable type of the variable can be a single-bit variable type or a variable type defined based on the IEC61131 standard. For example, the variables defined based on the IEC61131 standard can be variables such as integer, floating point, time, date, and string.
[0033] The forced variable information can be the forced variable parameters input by the user in the human-machine operation interface of the host computer. The forced variable table can be a continuous memory structure with a configurable total memory occupancy length. The controller can store the forced variable information in the forced variable table according to the variable type of the variable. For example, the controller can update the variable by storing the forced variable data included in the forced variable table in the running area of the variable in the controller and replacing the original data of the variable.
[0034] In step S120, an interface function of the controller is called.
[0035] For example, the interface function can be an API (Application Programming Interface) function.
[0036] In step S130, if it is determined that the state of the variable is the forced state, the variable value of the variable is maintained.
[0037] For example, the interface function can be isForceVarCheckG(unsigned int offset, unsigned char bit_offset). The relative offset address and bit offset address corresponding to the variable are queried. offset is the relative offset address of the variable. bit_offset is the bit offset address of the variable.
[0038] For example, during the process of the host computer periodically running the code, the host computer can assign a value to the variable. The host computer can achieve maintaining the variable value of the variable by embedding stubs in the assignment statement of the code. For example, variable var1 is a forced variable, the state of variable var1 is the forced state, the relative offset address is 100, and the forced variable value is var1 = 20. When the host computer runs the code, it assigns a value of 10 to variable var1. The stub can be specifically if(!isForceVarCheckG(100, 0)) var1 = 10. After determining that the relative offset address of variable var1 is 100, it is determined that the state of variable var1 is the forced state, and the assignment action for var1 is cancelled, thereby maintaining var1 = 20. var is used to declare a variable. The state of the variable can be represented in binary form, 0 represents that the variable is in the non-forced state, and 1 represents that the variable is in the forced state. var1 = 10 means assigning a value of 10 to variable var1.
[0039] In the above embodiments of the present application, by determining that the variable is in the forced state, the variable value of the variable is kept unchanged, avoiding the change of the forced variable due to being assigned a value during the variable forcing process, thereby improving the efficiency and accuracy of variable forcing.
[0040] Figure 2 The flowchart of the variable forcing method 2000 of the controller according to the embodiment of the present application is shown. As Figure 2 shown, the variable forcing method 2000 includes steps S210 - S240. Exemplarily, the variable forcing method 2000 can be executed by the controller.
[0041] In step S210, the controller receives forced variable information. For example, the forced variable information can be the forced variable parameters input by the user in the human-machine operation interface of the host computer. The controller receives the forced variable information sent by the host computer.
[0042] In step S220, a forced variable table is constructed according to the forced variable information. For example, the forced variable table can be a continuous memory structure with a configurable total memory length occupied in the controller.
[0043] In step S230, the variables are updated according to the forced variable data included in the forced variable table, and the updated variables are marked as forced states.
[0044] For example, the controller can store the forced variable information in the forced variable table according to the variable types of the variables. The variable types of the variables can be single-bit variable types and variable types defined based on the IEC61131 standard. For example, the variables defined based on the IEC61131 standard can be variables such as integer, floating point, time, date, and string.
[0045] For example, the controller can update the variables by storing the forced variable data included in the forced variable table in the running area of the variables and replacing the original data of the variables.
[0046] In step S240, in response to the received instruction to call the interface function, the status of the variable is provided so that the host computer can determine that the status of the variable is a forced state and then keep the variable value of the variable.
[0047] For example, the controller can send the status of the variable to the host computer in response to the instruction of the host computer to call the interface function. The interface function can be isForceVarCheckG(unsigned int offset, unsigned char bit_offset). The relative offset address and bit offset address corresponding to the variable are queried. offset is the relative offset address of the variable. bit_offset is the bit offset address of the variable.
[0048] The process of the host computer keeping the variable value of the variable is as described in step S130 and will not be elaborated here.
[0049] In the above embodiments of the present application, by determining that the variable is in a forced state, the variable value of the variable is kept unchanged, avoiding the change of the forced variable due to being assigned a value during the variable forcing process, thereby improving the efficiency and accuracy of variable forcing.
[0050] Figure 8 A schematic diagram of the variable data area and the variable forcing flag area of the embodiments of the present application is shown.
[0051] For example, the controller is provided with a variable data area and a variable forced flag area. The variable data area is used to store variables. The variable forced flag area is used to identify the status of variables.
[0052] For example, the variable data area and the variable forced flag area are allocated with the same length. The host computer can read the status of the variable in the forced flag area according to the relative offset address and bit offset address of the variable in the variable data area and through the address access operation. The status of the forced flag area corresponding to the variable is divided into a forced status and a non-forced status.
[0053] Figure 3 The flowchart of step S230 of the variable forcing method of the controller according to the embodiment of the present application is shown. As Figure 3 shown, step S230 includes step S231 and step S232.
[0054] In step S231, the forced variable data is written into the variable data area to update the variable.
[0055] In step S232, the updated variable is identified as the forced status by using the variable forced flag area.
[0056] The process of the host computer maintaining the variable value of the variable is as described in step S130, which will not be elaborated here.
[0057] In the above embodiment of the present application, the update of the variable is realized by forcing the variable data to be written into the variable data area, and the identification of the forced status of the variable is realized by the forced flag area.
[0058] Figure 4 The flowchart of step S130 of the variable forcing method of the controller according to the embodiment of the present application is shown. As Figure 4 shown, step S130 includes step S131 and step S132.
[0059] In step S131, determine the type of the variable data area, the relative offset address and the bit offset address of the variable.
[0060] For example, the type of the variable data area of the variable can be a global variable data area, a program organization unit variable data area, an input area or an output area.
[0061] In step S132, if it is determined that the status of the variable is the forced status according to the type of the variable data area, the relative offset address and the bit offset address, the variable value of the variable is maintained.
[0062] For example, the variable can be of 4-byte integer type. The relative offset address of the variable in the variable data area is 0, and the data length is 4 bytes. Then, for the variable corresponding variable forced flag area, the relative offset address of the variable is 0, and the occupied length is 4 bytes. The forced flag bit occupies 1 byte. According to the variable data area type and relative offset address of the variable, the host computer can read whether the variable is in the forced state through the code *(char*)(data_area+offset). If the variable is a bit variable, the host computer can read whether the variable is in the forced state through the code (*(char*)(data_area+offset))>>bit_offset. data_area is the starting address of the variable data area, offset is the relative offset address of the variable, and bit_offset is the bit offset address of the variable.
[0063] The process of the host computer maintaining the variable value of the variable is as described in step S130 and will not be elaborated here.
[0064] In the above embodiments of the present application, by confirming the forced state of the variable through the variable data area type, relative offset address, and bit offset address of the variable, the variable value of the variable is maintained.
[0065] Figure 5 The flowchart of the variable forcing method 3000 of the controller according to the embodiments of the present application is shown. As Figure 5 shown, the variable forcing method 3000 includes steps S310 - S350. Exemplarily, the variable forcing method 3000 can be executed by the host computer. Steps S310 - S330 are the same as steps S110 - S130 mentioned above and will not be elaborated here.
[0066] In step S340, a cancellation instruction is sent to the controller to cause the controller to delete the forced variable information from the forced variable table.
[0067] For example, the cancellation instruction can be an instruction to cancel the forced variable information.
[0068] In step S350, the forced flag area is used to identify that the variable corresponding to the forced variable information is in the non-forced state.
[0069] In the above embodiments of the present application, by sending a cancellation instruction, the controller deletes the forced variable information, and the forced flag area corresponding to the forced variable information is identified as the non-forced state, thereby completing the debugging of the controller program.
[0070] Figure 6 The structural diagram of the variable forcing system 4000 according to the embodiments of the present application is shown. The variable forcing system is used to execute the above variable forcing method. As Figure 6As shown in the figure, the variable forcing system includes a host computer 1 and a controller 2. The control area 2 includes a variable data area 21 and a variable forcing flag area 22. The variable data area 21 is used to store variables. The variable forcing flag area 22 is used to identify the status of variables.
[0071] The host computer 1 sends the received forced variable information to the controller 2 so that the controller 2 constructs a forced variable table according to the forced variable information. The host computer 1 enables the controller 2 to update the variable according to the forced variable data included in the forced variable table and identifies the updated variable as the forced state.
[0072] For example, the forced variable information can be the forced variable parameters input by the user in the human-machine operation interface of the host computer 1. The forced variable table can be a continuous memory structure with a configurable total memory length in the controller 2.
[0073] The host computer 1 calls the interface function of the controller 2. If it is determined that the status of the variable is the forced state, the variable value of the variable is maintained.
[0074] The controller 2 receives the forced variable information sent by the host computer 1 and constructs a forced variable table according to the forced variable information. The controller 2 updates the variable according to the forced variable data included in the forced variable table and identifies the updated variable as the forced state. In response to the instruction of the host computer 1 to call the interface function received, the controller 2 provides the status of the variable to the host computer 1 so that the host computer 1 determines that the status of the variable is the forced state, and then maintains the variable value of the variable.
[0075] For example, the host computer 1 can centrally display and view the forced variables, can cancel the variable forcing in batches, and can modify the forced value multiple times.
[0076] For example, when the user downloads the program in the online incremental update mode and the relative offset address of the variable changes, the host computer 1 can record and send the relative offset address before the change and the relative offset address after the change of the variable to the controller 2. The controller 2 can traverse the variable forcing table. If the variable belongs to the situation where the relative offset address changes, the corresponding relative offset address of the variable and the variable forcing flag area 22 are updated.
[0077] In the above embodiments of the present application, by determining that the variable is in the forced state, the variable value of the variable is kept unchanged, which avoids the change of the forced variable due to being assigned a value during the variable forcing process, thereby improving the efficiency and accuracy of variable forcing, and at the same time improving the system stability and reliability of the variable forcing system.
[0078] According to another aspect of the present application, the present application provides a non-volatile computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the variable forcing method described above is implemented.
[0079] According to another aspect of the present application, the present application provides an electronic device. The electronic device includes one or more processors and a storage device. The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the variable coercion method described above.
[0080] According to another aspect of the present application, the present application provides a computer program product, including a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the variable coercion method described above.
[0081] In the 1990s, it was obvious to distinguish whether an improvement in a technology was an improvement in hardware (e.g., an improvement in circuit structures such as diodes, transistors, switches, etc.) or an improvement in software (an improvement in a method flow). However, with the development of technology, many improvements in method flows today can be regarded as direct improvements in hardware circuit structures. Almost all designers obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented by a hardware entity module.
[0082] For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is an integrated circuit whose logical function is determined by a user programming the device. A designer can program it by themselves to "integrate" a digital system onto a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compilers used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a hardware description language (HDL). There is not just one type of HDL, but many types, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be clear that by simply performing some logical programming on the method flow using the above-mentioned several hardware description languages and programming it into an integrated circuit, it is easy to obtain a hardware circuit that implements the logical method flow.
[0083] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory.
[0084] Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. to achieve the same functions. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or structures within the hardware component.
[0085] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0086] For the convenience of description, when describing the above system, each unit is described separately according to its function. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0087] Those skilled in the art should understand that the embodiments of the present application can provide a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] This application is described with reference to the flow diagrams and / or block diagrams of methods, systems (apparatus) and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flow diagrams and / or block diagrams can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flow diagrams and / or block diagrams. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors or other programmable data processing devices to generate a machine, so that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in one or more of the flows and / or blocks in the flow diagram Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0089] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implement the functions specified in one or more of the flows and / or blocks in the flow diagram Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows and / or blocks in the flow diagram Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0091] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0092] The memory can be non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
[0093] A computer-readable medium includes permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information accessible by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0094] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising the element.
[0095] This specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0096] Finally, it should be noted that the above are only the preferred embodiments of the present application and are not used to limit the present application. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions of the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.
Claims
1. A controller variable forcing method, characterized in that: The variable forcing method includes: The host computer sends the received mandatory variable information to the controller, so that the controller constructs a mandatory variable table according to the mandatory variable information, updates variables according to mandatory variable data included in the mandatory variable table, and marks the updated variables as mandatory states; Calling the interface function of the controller; If it is determined that the state of the variable is a forced state, the variable value of the variable is maintained.
2. The variable forcing method according to claim 1, characterized in that: The determining that the state of the variable is a forced state and maintaining the variable value of the variable comprises: Determine the variable data area type, relative offset address and bit offset address of the variable; If it is determined that the state of the variable is a forced state according to the variable data area type, the relative offset address and the bit offset address, the variable value of the variable is maintained.
3. The variable forcing method according to claim 1, characterized in that: The controller is provided with a variable data area and a variable forced flag area, wherein the variable data area is used to store the variable, and the variable forced flag area is used to identify the state of the variable. After determining that the state of the variable is a forced state, maintaining the variable value of the variable further includes: sending a cancel instruction to the controller so that the controller deletes the forced variable information from the forced variable table; The mandatory flag area is used to mark the variable corresponding to the mandatory variable information as being in a non-mandatory state.
4. A controller variable forcing method, characterized in that: The variable forcing method includes: The controller receives the mandatory variable information; Constructing a mandatory variable table according to the mandatory variable information; updating variables according to the mandatory variable data contained in the mandatory variable table, and marking the updated variables as mandatory states; In response to a received instruction to call an interface function, the state of the variable is provided so that the host computer determines that the state of the variable is a forced state, and then maintains the variable value of the variable.
5. The variable forcing method according to claim 4, characterized in that: The controller is provided with a variable data area and a variable forced flag area, wherein the variable data area is used to store the variable, and the variable forced flag area is used to identify the state of the variable. The updating of variables according to the mandatory variable data included in the mandatory variable table and marking the updated variables as mandatory states comprises: Writing the mandatory variable data into the variable data area to update the variable; The variable force flag area is used to mark the updated variable as being in a forced state.
6. A variable forcing system for a controller, characterized in that: The variable forcing system includes: The upper computer receives the mandatory variable information and sends the received mandatory variable information; A controller receives mandatory variable information, constructs a mandatory variable table according to the mandatory variable information, updates variables according to mandatory variable data included in the mandatory variable table, and identifies the updated variables as mandatory states; The host computer also calls the interface function of the controller; The controller provides the state of the variable in response to the received instruction to call the interface function; The host computer further determines the state of the variable, and when it is determined that the state of the variable is a forced state, maintains the variable value of the variable.
7. The variable forcing system according to claim 6, characterized in that: The variable data area includes a global variable data area, a program organization unit variable data area, an input area and an output area.
8. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the variable forcing method according to any one of claims 1 to 3 is implemented.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the variable forcing method as described in any one of claims 1 to 3.
10. A computer program product, characterized in that The invention comprises a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer is caused to execute the variable forcing method as claimed in any one of claims 1 to 3.
11. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the variable forcing method according to any one of claims 1 to 3 is implemented.
12. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the variable forcing method as claimed in claim 4 or 5.
13. A computer program product, characterized in that The invention comprises a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer is caused to perform the variable forcing method as claimed in claim 4 or 5.