Soft-plc-based control method and device, terminal and storage medium

By acquiring the PLC logic diagram and selecting logic components from the soft PLC component library, the problem of low development efficiency of soft PLCs is solved, enabling rapid customization of control logic and reuse of logic components, thus improving development efficiency.

CN115933514BActive Publication Date: 2025-11-11SHENZHEN KANGBIDA CONTROL TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211632948.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-19
Publication Date
2025-11-11
Estimated Expiration
2042-12-19

AI Technical Summary

Technical Problem

Soft PLCs have low development efficiency, are inconvenient to debug, and are difficult to reuse logic programs.

Method used

By acquiring the PLC logic diagram, selecting logic components from the soft PLC component library, and calling these components based on logical relationships, soft PLC control quantities are generated, supporting the generation and storage of custom logic components.

Benefits of technology

It improves the efficiency of soft PLC development, enables rapid customization of control logic and reuse of logic elements, and reduces the difficulty of debugging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115933514B_ABST
    Figure CN115933514B_ABST
Patent Text Reader

Abstract

This invention provides a control method, device, terminal, and storage medium based on a soft PLC. The method includes: acquiring a PLC logic diagram corresponding to the control logic; wherein the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module; selecting logic elements corresponding to each logic module from a preset soft PLC component library; wherein the soft PLC component library contains multiple logic elements, each logic element implementing logical operations in the form of a soft PLC; and calling each logic element based on the logical relationships to obtain the soft PLC control quantity corresponding to the PLC logic diagram. This invention enables rapid soft PLC control without requiring customized code for the control logic, thus improving the efficiency of soft PLC development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control technology, and in particular to a control method, device, terminal and storage medium based on a soft PLC. Background Technology

[0002] A Programmable Logic Controller (PLC) is a digital electronic device with a microprocessor. When real-time requirements are not stringent, and to reduce costs, a software PLC can be used instead of a physical PLC to achieve the desired PLC functionality.

[0003] Currently, with increasing business demands, it is often necessary to frequently modify the logic program. Debugging software PLCs is extremely inconvenient and inefficient. Furthermore, almost every project requires customized control logic, making reuse difficult. In other words, the current development efficiency of software PLCs is low. Summary of the Invention

[0004] This invention provides a control method, device, terminal, and storage medium based on a soft PLC to solve the problem of low development efficiency of soft PLCs.

[0005] In a first aspect, embodiments of the present invention provide a control method based on a soft PLC, comprising:

[0006] Obtain the PLC logic diagram corresponding to the control logic; the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module;

[0007] Select the logic element corresponding to each logic module from the preset soft PLC component library; the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC.

[0008] By calling each logic element based on logical relationships, the soft PLC control quantity corresponding to the PLC logic diagram is obtained.

[0009] In one possible implementation, the PLC logic diagram also includes the input parameter types, output parameter types, and operation functions of each logic module;

[0010] Select the logic elements corresponding to each logic module from the preset soft PLC component library, including:

[0011] For each logic module, search the preset soft PLC component library for a logic component that matches the input parameter type, output parameter type, and operation function of that logic module, and use that logic component as the corresponding logic component for that logic module.

[0012] In one possible implementation, the method further includes:

[0013] When a new instruction for a logic element is obtained, the input parameter type, output parameter type, and operation function in the new instruction for the logic element are parsed.

[0014] New logic elements are generated based on input parameter types, output parameter types, and operation functions, and then stored in the soft PLC component library.

[0015] In one possible implementation, invoking each logical element based on logical relationships includes:

[0016] For any given logic element, obtain the value of its input parameter.

[0017] The output parameter value of the logic element is calculated based on the input parameter value and the operation function of the logic element;

[0018] Write the output parameter value of the logic element into the corresponding field of the logic element in the memory library.

[0019] In one possible implementation, before calculating the output parameter value of the logic element based on the input parameter value and the operation function of the logic element, the method further includes:

[0020] Obtain the input parameter status of the logic element;

[0021] If the input parameter status is abnormal, the output parameter value of the logic element will not be calculated.

[0022] In one possible implementation, the logical relationship includes the module_level field of each logical module, where the module_level field represents the operation sequence number of the logical module;

[0023] Calling various logical elements based on logical relationships includes:

[0024] Call each logical element in ascending order of the module_level field.

[0025] Secondly, embodiments of the present invention provide a control device based on a soft PLC, comprising:

[0026] The acquisition module is used to acquire the PLC logic diagram corresponding to the control logic; the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module.

[0027] The selection module is used to select the logic element corresponding to each logic module from the preset soft PLC component library; wherein, the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC.

[0028] The control module is used to call various logic elements based on logical relationships to obtain the soft PLC control quantities corresponding to the PLC logic diagram.

[0029] Thirdly, embodiments of the present invention provide a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method as described in the first aspect or any possible implementation thereof.

[0030] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect or any possible implementation thereof.

[0031] The beneficial effects of the control method, device, terminal, and storage medium based on soft PLC provided in this invention are as follows:

[0032] This invention allows for the direct selection of existing soft PLC logic elements based on the PLC logic diagram, and the invocation of each logic element according to the logical relationship. After the control logic is determined, soft PLC control can be performed quickly without the need for custom code for the control logic, thus improving the development efficiency of soft PLC. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 This is an application scenario diagram of a control method based on a soft PLC provided in an embodiment of the present invention;

[0035] Figure 2 This is a flowchart illustrating the implementation of soft PLC control based on FBD according to an embodiment of the present invention;

[0036] Figure 3 This is a flowchart illustrating the implementation of soft PLC control based on FBD according to an embodiment of the present invention;

[0037] Figure 4 This is a schematic diagram of the interface between a soft PLC and a SCADA system provided in an embodiment of the present invention;

[0038] Figure 5 This is an operation interface diagram of a custom logic element provided in an embodiment of the present invention;

[0039] Figure 6 This is a schematic diagram of the structure of a control device based on a soft PLC provided in an embodiment of the present invention;

[0040] Figure 7 This is a schematic diagram of a terminal provided in an embodiment of the present invention. Detailed Implementation

[0041] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0042] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.

[0043] In SCADA monitoring systems such as power monitoring systems, EMS energy management systems, microgrid energy storage systems, and photovoltaic monitoring systems, there are frequent requirements for logic control / timing control / logic operations. While purchasing PLC equipment can achieve this when real-time requirements are not stringent, it is costly. The common practice is to implement control logic using fixed code. However, with increasing business demands, this often requires frequent modifications to the logic program, making debugging inconvenient and inefficient. Furthermore, almost every project requires customized control logic, making code (control logic) reuse difficult. To address these issues, this invention proposes a method for implementing control based on software PLC in SCADA systems.

[0044] See Figure 1 The document illustrates a flowchart of the implementation of the control method based on a soft PLC provided in an embodiment of the present invention, which is described in detail below:

[0045] Step 101: Obtain the PLC logic diagram corresponding to the control logic; wherein, the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module.

[0046] In this embodiment, the PLC logic diagram can be generated based on the FBD language, and each PLC logic diagram corresponds to a specific FBD group. For example... Figure 2As shown, the FBD editing and debugging tool can save the PLC logic diagram as a local file in 1.1, store the PLC logic diagram in the relational database in 1.2, and debug the PLC logic diagram based on the input and output values ​​in the memory database in 2. The FBD background service loads the PLC logic diagram in the relational database, creates a separate thread for each FBD group, traverses the PLC logic diagram, calculates the logic function of each element, and writes the calculation results into the memory database.

[0047] like Figure 3 As shown, the specific process of loading the PLC logic diagram based on FBD and implementing soft PLC control is as follows:

[0048] The relational database is periodically scanned. Upon receiving a message or reaching the scan cycle, it is determined whether the configuration content of the FBD group has changed. If it has changed, the PLC logic diagram is reread from the relational database. If it has not changed, the read PLC logic diagram is scanned at predetermined time intervals to achieve soft PLC control.

[0049] Step 102: Select the logic element corresponding to each logic module from the preset soft PLC component library; wherein, the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC.

[0050] In this embodiment, each logic element corresponds to a separate dynamic library. The FBD service determines the logic elements corresponding to each logic module based on the PLC logic diagram in order to dynamically load these dynamic libraries.

[0051] Step 103: Based on the logical relationships, call each logic element to obtain the soft PLC control quantity corresponding to the PLC logic diagram.

[0052] In this embodiment, each PLC logic diagram belongs to an FBD group. After the FBD service is started, the logical relationship of the PLC logic diagram is loaded, a thread is created for each FBD group, and each logic element is periodically called according to the logical relationship to obtain the final output control quantity, thereby realizing control based on soft PLC.

[0053] like Figure 4As shown, the interface between the soft PLC and the SCADA system includes a scan thread management class, a scan thread class, and an operation module. The scan thread management class corresponds one-to-one with the FBD group and is used for online configuration detection of the threads in the FBD group, rereading the PLC logic diagram when the configuration content of the FBD group changes. The scan thread class is used for reloading, executing, initializing, and creating the operation module, which is the logic element in step 102. Specifically, the scan thread class can call the creation interface when starting control to create new logic elements, call the initialization interface after creation to set the initial input parameters of the logic element, and complete the initialization. When running the control logic corresponding to the PLC logic diagram, it calls the execution interface to realize the calling of each logic element based on logical relationships. During online configuration, it calls the reload interface to reread the changed FBD group, PLC logic diagram, and logic elements.

[0054] In one possible implementation, the PLC logic diagram also includes the input parameter types, output parameter types, and operation functions of each logic module;

[0055] Select the logic elements corresponding to each logic module from the preset soft PLC component library, including:

[0056] For each logic module, search the preset soft PLC component library for a logic component that matches the input parameter type, output parameter type, and operation function of that logic module, and use that logic component as the corresponding logic component for that logic module.

[0057] In this embodiment, each logic element corresponds to a separate dynamic library. The corresponding logic element can be determined based on the input parameter type, output parameter type, and operation function of each logic module, and these dynamic libraries can be dynamically loaded. This allows these logic elements to run in the manner of a soft PLC, complete the required calculation process, and obtain the final control quantity.

[0058] In one possible implementation, the method further includes:

[0059] When a new instruction for a logic element is obtained, the input parameter type, output parameter type, and operation function in the new instruction for the logic element are parsed.

[0060] New logic elements are generated based on input parameter types, output parameter types, and operation functions, and then stored in the soft PLC component library.

[0061] In this embodiment, custom logic elements can be defined as needed. The input and output parameter types of a logic element can be defined, and its internal control logic or operational functions can be defined using Lua scripts to form a new logic element, similar to an IC. This logic element can then be used in later projects. For example... Figure 5As shown, logic elements can be arithmetic modules, comparison modules, data type conversion modules, Boolean operations, logic modules, action alarms, power control, etc., and can be directly integrated into... Figure 5 Select the logic element type from the list on the left and define the input / output parameter types. If you select the script module, you can define the control logic or operation functions of the logic element based on the Lua script, generating a custom logic element.

[0062] In one possible implementation, invoking each logical element based on logical relationships includes:

[0063] For any given logic element, obtain the value of its input parameter.

[0064] The output parameter value of the logic element is calculated based on the input parameter value and the operation function of the logic element;

[0065] Write the output parameter value of the logic element into the corresponding field of the logic element in the memory library.

[0066] In this embodiment, each FBD thread periodically traverses the PLC logic diagram, calls each logic element, each logic element obtains the corresponding input parameter value, performs logical operations according to its own operation function to obtain the output parameter value, and finally writes the output parameter value into the corresponding field in the memory library, so that subsequent logic elements can continue to perform logical operations based on the output parameter value.

[0067] In one possible implementation, before calculating the output parameter value of the logic element based on the input parameter value and the operation function of the logic element, the method further includes:

[0068] Obtain the input parameter status of the logic element;

[0069] If the input parameter status is abnormal, the output parameter value of the logic element will not be calculated.

[0070] In this embodiment, each logic element's input parameter value or output parameter value needs to be paired with a status field to indicate whether the value is valid. Each logic element determines whether to perform a calculation based on its input parameter value or output parameter value and the status field. For example, if the control module finds that the status of its input parameter value is abnormal, it will not perform control.

[0071] In one possible implementation, the logical relationship includes the module_level field of each logical module, where the module_level field represents the operation sequence number of the logical module;

[0072] Calling various logical elements based on logical relationships includes:

[0073] Call each logical element in ascending order of the module_level field.

[0074] In this embodiment, each logic module corresponds to a `module_level` field, and the value of the `module_level` field is determined according to the calculation order of the parameters. For example, in a certain PLC logic diagram, the logical relationship between the logic modules is as follows: inputting the value 'a' into logic module A yields the value 'b', then inputting the value 'b' into logic module B yields the value 'c'. In this case, the `module_level` field of logic module A is 1, and the `module_level` field of logic module B is 2. During periodic traversal, the logic modules are called in the order of A and B.

[0075] In this embodiment of the invention, the existing soft PLC logic elements are selected directly from the PLC logic diagram, and each logic element is called according to the logical relationship. After the control logic is determined, soft PLC control can be performed quickly without the need to customize code for the control logic, which can improve the development efficiency of soft PLC.

[0076] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0077] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0078] Figure 6 A schematic diagram of the control device based on a soft PLC provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below:

[0079] like Figure 6 As shown, the control device 6 based on a soft PLC includes:

[0080] The acquisition module 61 is used to acquire the PLC logic diagram corresponding to the control logic; wherein, the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module;

[0081] Module 62 is selected to select logic elements corresponding to each logic module from a preset soft PLC component library; wherein, the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC.

[0082] The control module 63 is used to call each logic element based on logical relationships to obtain the soft PLC control quantity corresponding to the PLC logic diagram.

[0083] In one possible implementation, the PLC logic diagram also includes the input parameter types, output parameter types, and operation functions of each logic module;

[0084] Module 62 is specifically used for:

[0085] For each logic module, search the preset soft PLC component library for a logic component that matches the input parameter type, output parameter type, and operation function of that logic module, and use that logic component as the corresponding logic component for that logic module.

[0086] In one possible implementation, the soft PLC-based control device 6 further includes:

[0087] A new module is added to parse the input parameter type, output parameter type, and operation function in the new logic element instruction when a new logic element instruction is obtained.

[0088] New logic elements are generated based on input parameter types, output parameter types, and operation functions, and then stored in the soft PLC component library.

[0089] In one possible implementation, the control module 63 is specifically used for:

[0090] For any given logic element, obtain the value of its input parameter.

[0091] The output parameter value of the logic element is calculated based on the input parameter value and the operation function of the logic element;

[0092] Write the output parameter value of the logic element into the corresponding field of the logic element in the memory library.

[0093] In one possible implementation, the soft PLC-based control device 6 further includes:

[0094] The verification module is used to obtain the input parameter status of the logic element before calculating the output parameter value of the logic element based on the input parameter value and the operation function of the logic element;

[0095] If the input parameter status is abnormal, the output parameter value of the logic element will not be calculated.

[0096] In one possible implementation, the logical relationship includes the module_level field of each logical module, where the module_level field represents the operation sequence number of the logical module;

[0097] Control module 63 is specifically used for:

[0098] Call each logical element in ascending order of the module_level field.

[0099] In this embodiment of the invention, the existing soft PLC logic elements are selected directly from the PLC logic diagram, and each logic element is called according to the logical relationship. After the control logic is determined, soft PLC control can be performed quickly without the need to customize code for the control logic, which can improve the development efficiency of soft PLC.

[0100] Figure 7 This is a schematic diagram of a terminal provided in an embodiment of the present invention. Figure 7 As shown, the terminal 7 in this embodiment includes: a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70. When the processor 70 executes the computer program 72, it implements the steps described in the various soft PLC-based control method embodiments above, for example... Figure 1 Steps 101 to 103 are shown. Alternatively, when the processor 70 executes the computer program 72, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 6 The functions of modules / units 61 to 63 shown.

[0101] For example, the computer program 72 can be divided into one or more modules / units, which are stored in the memory 71 and executed by the processor 70 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 72 in the terminal 7. For example, the computer program 72 can be divided into... Figure 6 Modules / units 61 to 63 are shown.

[0102] The terminal 7 can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The terminal 7 may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will understand that... Figure 7 This is merely an example of terminal 7 and does not constitute a limitation on terminal 7. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal may also include input / output devices, network access devices, buses, etc.

[0103] The processor 70 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0104] The memory 71 can be an internal storage unit of the terminal 7, such as a hard disk or memory of the terminal 7. The memory 71 can also be an external storage device of the terminal 7, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal 7. Furthermore, the memory 71 can include both internal storage units and external storage devices of the terminal 7. The memory 71 is used to store the computer program and other programs and data required by the terminal. The memory 71 can also be used to temporarily store data that has been output or will be output.

[0105] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0106] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0107] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0108] In the embodiments provided by this invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0109] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0110] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0111] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various control method embodiments based on the soft PLC described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately added to or subtracted from the content as required by the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium may not include electrical carrier signals and telecommunication signals.

[0112] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A control method based on a soft PLC, characterized in that, include: Obtain the PLC logic diagram corresponding to the control logic; wherein, the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module; Select logic elements corresponding to each logic module from the preset soft PLC component library; wherein, the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC; Based on the logical relationship, each logical element is invoked to obtain the soft PLC control quantity corresponding to the PLC logic diagram; The invocation of each logical element based on the aforementioned logical relationship includes: The PLC logic diagram is scanned at predetermined time intervals, and each logic element is invoked based on the logical relationships. The PLC logic diagram also includes the input parameter types, output parameter types, and operation functions of each logic module; The step of selecting logic elements corresponding to each logic module from a preset soft PLC component library includes: For each logic module, search the preset soft PLC component library for a logic component that matches the input parameter type, output parameter type, and operation function of that logic module, and use that logic component as the corresponding logic component for that logic module.

2. The control method based on soft PLC according to claim 1, characterized in that, The method further includes: When a new logic element instruction is obtained, the input parameter type, output parameter type, and operation function in the new logic element instruction are parsed. New logic elements are generated based on the input parameter type, the output parameter type, and the operation function, and stored in the soft PLC component library.

3. The control method based on soft PLC according to claim 1, characterized in that, The invocation of each logical element based on the logical relationship includes: For any given logic element, obtain the value of its input parameter. The output parameter value of the logic element is calculated based on the input parameter value and the operation function of the logic element; Write the output parameter value of the logic element into the corresponding field of the logic element in the memory library.

4. The control method based on soft PLC according to claim 3, characterized in that, Before calculating the output parameter value of the logic element based on the input parameter value and the operation function of the logic element, the method further includes: Obtain the input parameter status of the logic element; If the input parameter status is abnormal, the output parameter value of the logic element will not be calculated.

5. The control method based on soft PLC according to claim 1, characterized in that, The logical relationship includes the module_level field of each logical module, where the module_level field represents the operation sequence number of the logical module; The invocation of each logical element based on the logical relationship includes: Call each logical element in ascending order of the module_level field.

6. A control device based on a soft PLC, characterized in that, include: The acquisition module is used to acquire the PLC logic diagram corresponding to the control logic; wherein, the PLC logic diagram includes multiple logic modules and the logical relationships between each logic module; The selection module is used to select logic elements corresponding to each logic module from a preset soft PLC component library; wherein, the soft PLC component library contains multiple logic elements, and each logic element implements logic operations in the form of a soft PLC. The control module is used to call each logic element based on the logical relationship to obtain the soft PLC control quantity corresponding to the PLC logic diagram; The control module is specifically used for: The PLC logic diagram is scanned at predetermined time intervals, and each logic element is invoked based on the logical relationships. The PLC logic diagram also includes the input parameter types, output parameter types, and operation functions of each logic module; The selection module is specifically used for: For each logic module, search the preset soft PLC component library for a logic component that matches the input parameter type, output parameter type, and operation function of that logic module, and use that logic component as the corresponding logic component for that logic module.

7. A terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 5 above.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5 above.

Citation Information

Patent Citations

  • Automatic logic test case generation method and device based on control logic diagram

    CN114185781A

  • Soft PLC control function implementation method, apparatus and device, and storage medium

    CN114237146A