Method, system and device for generating PLC ladder diagram and medium
By using the layout of horizontal stacked containers and vertical stacked containers, the automatic filling and flexible expansion of element positions are solved, and the problem of heavy workload of modification when there are too many elements in PLC ladder diagram generation is improved, improving efficiency and flexibility.
Patent Information
- Application Number
- CN202411636347.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-18
AI Technical Summary
When the number of elements is large, the workload of modifying and adjusting element positions is heavy, resulting in reduced efficiency and increased risk of errors.
The layout of horizontal stacked containers and vertical stacked containers is adopted, and the automatic filling and flexible expansion mechanisms are used to realize the series and parallel connection of elements, reducing the need for artificial adjustment of coordinate values.
It effectively reduces the modification workload when the number of elements is large, improves the efficiency of PLC ladder diagram generation, reduces the risk of errors, and improves the scalability and flexibility of the system.
Smart Images

Figure CN119472490A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of PLC ladder diagram generation, and in particular relates to a method, system, device and medium for generating a PLC ladder diagram. Background Art
[0002] PLC Ladder Diagram (LD) is a graphical programming language widely used in PLC (Programmable Logic Controller) programming. In PLC (Programmable Logic Controller) programming, the generation of ladder diagram is a very important link.
[0003] When generating existing PLC ladder diagrams, coordinate values are used to place graphics elements (such as contacts, coils, and function blocks, etc.). When it is necessary to add or delete graphics elements in the PLC ladder diagram, since the relative position relationship between the graphics elements is determined by the coordinate values, the coordinate values of all subsequent graphics elements need to be adjusted accordingly to ensure the accuracy of the PLC ladder diagram logic. When the number of graphics elements is small, the workload of modification is still within an acceptable range. However, once the number of graphics elements is large, the workload of modification becomes extremely heavy, which not only reduces the efficiency of PLC ladder diagram generation, but also increases the risk of errors. Summary of the invention
[0004] The purpose of the present invention is to provide a method, system, device and medium for generating a PLC ladder diagram, which is used to solve the problem in the prior art that once the number of graphic elements is large, the workload of modification becomes extremely heavy, resulting in reduced efficiency of PLC ladder diagram generation and increased risk of errors.
[0005] In order to achieve the above object, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for generating a PLC ladder diagram, comprising the following steps: Construct at least one horizontal stacking container and at least one vertical stacking container, use the vertical stacking container to store each network, use the horizontal stacking container to store the graphics elements in a single network, when it is necessary to connect the graphics elements in series, determine the position of the graphics elements to be connected in series in the horizontal stacking container, and connect the graphics elements in series at the determined positions of the graphics elements to be connected in series; The first graphic element is stored in a first horizontal stacking container, and other graphic elements are connected in series with the first graphic element. When the first graphic element needs to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container.
[0006] A further improvement of the present invention is that the graphic elements include contacts, coils, function blocks, jumps, returns, left busbars and right busbars.
[0007] A further improvement of the present invention is that, within a single network, when a graphic element needs to be deleted, the position of the graphic element to be deleted in the horizontal stack container is determined, and the graphic element is deleted at the position determined to be deleted.
[0008] A further improvement of the present invention is that after completing the parallel connection of the first graphic element, if it is necessary to continue to connect the graphic elements in parallel, if the graphic elements that need to be connected in parallel are not connected in series with other graphic elements, and the parent container of the horizontal stacking container where the graphic elements that need to be connected in parallel are located is a vertical stacking container, then a fourth horizontal stacking container is added, the graphic elements that need to be connected in parallel are stored in the newly added fourth horizontal stacking container, and the newly added fourth horizontal stacking container is placed below the horizontal stacking container where the graphic elements that need to be connected in parallel are located, the below refers to the next position of the horizontal stacking container where the graphic elements that need to be connected in parallel are located in the vertical stacking container, and the parent container refers to the container where the horizontal stacking container is placed.
[0009] A further improvement of the present invention is that after completing the parallel connection of the first graphic element, if it is necessary to continue to connect the graphic elements in series, the position of the graphic elements to be connected in series in the horizontal stacking container is determined, and the graphic elements are continued to be connected in series at the determined position of the graphic elements. A further improvement of the present invention is that after completing the parallel and series connection of the first graphic element, if it is necessary to continue connecting the graphic elements in parallel, and if there are other graphic elements connected in series with the graphic elements that need to be connected in parallel, then a fifth horizontal stacking container, a sixth horizontal stacking container and a second vertical stacking container are added, the graphic elements that need to be connected in parallel are moved from the horizontal stacker where they are located to the newly added fifth horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added sixth horizontal stacking container, the fifth horizontal stacking container and the sixth horizontal stacking container are stored together in the newly added second vertical stacking container, and the newly added second vertical stacking container is placed in the position where the horizontal stacking container where the graphic elements that need to be connected in parallel are located originally stored the graphic elements that need to be connected in parallel. A further improvement of the present invention is that, if it is necessary to continue to add networks, the position of the networks to be added is determined in the vertical stacking container, and the networks are continued to be added at the positions determined for adding the networks; if it is necessary to delete a network, the position of the networks to be deleted is determined in the vertical stacking container, and the networks are deleted at the positions determined for deleting the networks.
[0010] In a second aspect, the present invention provides a PLC ladder diagram generation system, comprising a layout container construction module, a network storage module, a single network element storage module, a series element generation module, and a parallel element generation module; The layout container construction module is used to construct at least one horizontal stacking container and at least one vertical stacking container; The network storage module is used to store each network using vertically stacked containers; The single network graphic element storage module is used to store graphic elements in a single network using horizontally stacked containers; The serial graphic element generation module is used to determine the position of the graphic element that needs to be serially connected in the horizontal stack container when the graphic element needs to be serially connected, and serially connect the graphic element at the determined position of the serially connected graphic element; The parallel graphic element generation module is used to store the first graphic element in the first horizontal stacking container, and there are other graphic elements connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container.
[0011] In a third aspect, the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method for generating a PLC ladder diagram introduced above when executing the computer program.
[0012] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method for generating a PLC ladder diagram introduced above.
[0013] Compared with the prior art, the present invention has the following beneficial effects: The present invention belongs to an improved invention. Compared with the existing method for generating a PLC ladder diagram, the horizontal stack container and the vertical stack container used in the method for generating a PLC ladder diagram proposed by the present invention are both layout containers. If a graphic element is deleted from a certain position in the horizontal stack container and the vertical stack container, the subsequent graphic elements will automatically fill in the position without manual adjustment. For example, when people are queuing, if someone in the queue leaves first, the people behind the person who left will automatically fill in the position in turn. Moreover, the horizontal stack container and the vertical stack container have strong expansion capabilities and flexibility. When it is necessary to connect graphic elements in series or delete graphic elements, it is only necessary to connect graphic elements in series or delete graphic elements at the corresponding positions of the horizontal stack container and the vertical stack container without manual modification of coordinate values. Compared with the prior art, the present invention effectively solves the problem that once the number of graphic elements is large, the workload of modification becomes extremely heavy in the prior art, resulting in reduced efficiency of generating a PLC ladder diagram and increased risk of errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a flow chart of the method for generating a PLC ladder diagram of the present invention; Figure 2 It is a schematic diagram of a system for generating a PLC ladder diagram of the present invention; Figure 3 A schematic diagram for generating serial graph elements within a single network of the present invention; Figure 4 A schematic diagram for generating parallel graphic elements within a single network of the present invention; Figure 5 It is a schematic diagram of connecting the graphics elements in parallel in a single network of the present invention and then continuing to connect the graphics elements in parallel; Figure 6 A schematic diagram of connecting graphic elements in parallel and then connecting graphic elements in series in a single network of the present invention; Figure 7 It is a schematic diagram of connecting the graphics elements in parallel and then connecting the graphics elements in series and then connecting the graphics elements in parallel in a single network of the present invention; Figure 8 generating a plurality of network schematic diagrams for the present invention; Fig. 9 It is a schematic diagram of the structure of the electronic device of the present invention. DETAILED DESCRIPTION
[0015] In order to further understand the content of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the embodiments are only for explaining the present invention and are not intended to limit it.
[0016] The method for generating a PLC ladder diagram proposed by the present invention uses horizontal stacking containers and vertical stacking containers to realize the generation of serial graphics elements and parallel graphics elements in a single network. Compared with the prior art, the present invention effectively solves the problem in the prior art that once the number of graphics elements is large, the workload of modification becomes extremely heavy, resulting in reduced efficiency of PLC ladder diagram generation and increased risk of errors.
[0017] Embodiment 1: The flow chart of the method for generating a PLC ladder diagram of the present invention is as follows Figure 1 As shown, the method for generating a PLC ladder diagram of the present invention comprises the following steps: S1. Construct at least one horizontal stacking container and at least one vertical stacking container, use the vertical stacking container to store each network, and use the horizontal stacking container to store graphics elements in a single network. When it is necessary to connect graphics elements in series, determine the position of the graphics elements to be connected in series in the horizontal stacking container, and connect the graphics elements in series at the determined positions of the graphics elements.
[0018] S2. The first graphic element is stored in a first horizontal stacking container, and there are other graphic elements connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed in the position where the first graphic element was originally stored in the first horizontal stacking container.
[0019] Embodiment 2: The schematic diagram of the generation system of the PLC ladder diagram of the present invention is as follows Figure 2 As shown, the PLC ladder diagram generation system of the present invention includes a layout container construction module, a network storage module, a single network element storage module, a series element generation module and a parallel element generation module.
[0020] The layout container building module is used to build at least one horizontal stacking container and at least one vertical stacking container.
[0021] The network storage module is used to store each network using vertically stacked containers.
[0022] The single network graphic element storage module is used to store graphic elements in a single network using horizontally stacked containers.
[0023] The serial graphic element generation module is used to determine the position of the graphic elements to be serially connected in the horizontal stack container when serial graphic elements are needed, and serially connect the graphic elements at the determined positions of the serial graphic elements.
[0024] The parallel graphic element generation module is used to store the first graphic element in the first horizontal stacking container, and there are other graphic elements connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed in the position where the first graphic element was originally stored in the first horizontal stacking container.
[0025] Embodiment 3: S1. Construct at least one horizontal stacking container and at least one vertical stacking container, use the vertical stacking container to store each network, and use the horizontal stacking container to store graphics elements in a single network. When it is necessary to connect graphics elements in series, determine the position of the graphics elements to be connected in series in the horizontal stacking container, and connect the graphics elements in series at the determined positions of the graphics elements.
[0026] Construct at least one horizontal stack container and at least one vertical stack container. Use the vertical stack container to store each network, and use the horizontal stack container to store primitives in a single network. The primitives include contacts, coils, function blocks, jumps (the primitives that can represent jumps), returns (the primitives that can represent returns), left busbars (leftPowerRail) and right busbars (rightPowerRail). The left busbars and right busbars are automatically added to the network when adding a network, and cannot be deleted separately. They can only be deleted together with the network when deleting the network.
[0027] When it is necessary to connect graphics elements in series, the positions of the graphics elements to be connected in series in the horizontal stack container are determined, and the graphics elements are connected in series at the positions determined.
[0028] When an element needs to be deleted, determine the position of the element to be deleted in the horizontal stack container, and delete the element at the position determined to be deleted. If all elements in the horizontal stack container where the element is located are deleted, the horizontal stack container also needs to be deleted. After the horizontal stack container is deleted, if the vertical stack container where the horizontal stack container is located is empty (that is, it does not contain any horizontal stack containers), the vertical stack container also needs to be deleted. Loop through the parent containers of the horizontal stack container and the vertical stack container, and delete all empty vertical stack containers and horizontal stack containers that do not store elements at the same time.
[0029] This embodiment takes one horizontal stack container and one vertical stack container as an example, and both the horizontal stack container and the vertical stack container are a type of layout container. This embodiment takes a single network that only includes a left bus and a right bus as an example, and as other implementation methods, other graphics elements may also exist in a single network.
[0030] The schematic diagram of this embodiment after adding one element (also called connecting one element in series), adding two elements (also called connecting two elements in series), and deleting one element in an empty network (including only the left bus and the right bus) is as follows: Figure 3 shown.
[0031] S2. The first graphic element is stored in a first horizontal stacking container, and there are other graphic elements connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed in the position where the first graphic element was originally stored in the first horizontal stacking container.
[0032] The first graphic element (the first graphic element in this embodiment is graphic element A) is stored in the first horizontal stacking container (the first horizontal stacking container in this embodiment is SH0), and other graphic elements (for example, touch_26) are connected in series with the first graphic element. When the first graphic element needs to be connected in parallel, a second horizontal stacking container (the second horizontal stacking container in this embodiment is SH1), a third horizontal stacking container (the third horizontal stacking container in this embodiment is SH2) and a first vertical stacking container (the first vertical stacking container in this embodiment is SV3) are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic element that needs to be connected in parallel (the graphic element that needs to be connected in parallel in this embodiment is graphic element B) is stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container. The specific structural changes are as follows: Figure 4 shown.
[0033] After completing the parallel connection of the first graphic element, if it is necessary to continue to connect graphic elements in parallel (the graphic element that needs to be connected in parallel in this embodiment is graphic element P), if the graphic element that needs to be connected in parallel is not connected in series with other graphic elements, and the parent container of the horizontal stacking container SH2 where the graphic element that needs to be connected in parallel (the graphic element that needs to be connected in parallel in this embodiment is graphic element B) is located is the vertical stacking container SV3, then a fourth horizontal stacking container is added (the fourth horizontal stacking container in this embodiment is SH3), and the graphic elements that need to be connected in parallel are stored in the newly added fourth horizontal stacking container, and the newly added fourth horizontal stacking container is placed below the horizontal stacking container where the graphic element that needs to be connected in parallel is located. The below refers to the next position of the horizontal stacking container where the graphic element that needs to be connected in parallel is located in the vertical stacking container. The parent container refers to the container where the horizontal stacking container is placed, and the specific structural changes are as follows: Figure 5 shown.
[0034] After the first graphic element is connected in parallel (for example, graphic element A and graphic element B are connected in parallel), if it is necessary to continue to connect graphic elements in series (the graphic element that needs to be connected in series in this embodiment is graphic element C), the position of the graphic element that needs to be connected in series in the horizontal stacking container is determined, and the graphic elements are continued to be connected in series at the determined position of the graphic element. The specific structural changes are as follows: Figure 6 shown.
[0035] After completing the parallel and series connection of the first graphic element (such as after graphic element A and graphic element B are connected in parallel, and after graphic element C is connected in series), if it is necessary to continue to connect graphic elements in parallel (the graphic element that needs to be connected in parallel in this embodiment is graphic element D), and if there are other graphic elements (the other graphic elements in this embodiment are graphic elements B) and graphic elements that need to be connected in parallel (the graphic element that needs to be connected in parallel in this embodiment is graphic element C) in series, then continue to add a fifth horizontal stacking container (the fifth horizontal stacking container in this embodiment is SH4), a sixth horizontal stacking container (the sixth horizontal stacking container in this embodiment is SH5) and a second vertical stacking container (the second vertical stacking container in this embodiment is SV6), move the graphic elements that need to be connected in parallel from the horizontal stacker where they are located to the newly added fifth horizontal stacking container, store the graphic elements that need to be connected in parallel in the newly added sixth horizontal stacking container, store the fifth horizontal stacking container and the sixth horizontal stacking container together in the newly added second vertical stacking container, and place the newly added second vertical stacking container at the position where the horizontal stacking container where the graphic elements that need to be connected in parallel are located originally stored the graphic elements that need to be connected in parallel. The specific structural changes are as follows: Figure 7 shown.
[0036] If you need to continue adding networks, determine the position of the networks you need to continue adding in the vertical stack container, and continue adding networks at the position where you want to add networks; if you need to delete a network, determine the position of the networks you need to delete in the vertical stack container, and delete the networks at the position where you want to delete networks.
[0037] The schematic diagram of this embodiment after adding two networks and deleting one network below the initial GVar_0002 network is as follows Figure 8 shown.
[0038] Embodiment 4: See also Fig. 9 As shown, the present invention also provides an electronic device 100 for a method for generating a PLC ladder diagram; the electronic device 100 includes a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104.
[0039] The memory 101 can be used to store the computer program 103, and the processor 102 implements the steps of the method for generating the PLC ladder diagram described in Example 1 by running or executing the computer program stored in the memory 101 and calling the data stored in the memory 101. The memory 101 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 101 can include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0040] The at least one processor 102 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 102 may be a microprocessor or any conventional processor, etc. The processor 102 is the control center of the electronic device 100, and uses various interfaces and lines to connect various parts of the entire electronic device 100.
[0041] The memory 101 in the electronic device 100 stores a plurality of instructions to implement a method for generating a PLC ladder diagram, and the processor 102 can execute the plurality of instructions to implement: Construct at least one horizontal stack container and at least one vertical stack container, use the vertical stack container to store each network, use the horizontal stack container to store graphics elements in a single network, when it is necessary to connect graphics elements in series, determine the position of the graphics elements to be connected in series in the horizontal stack container, and connect the graphics elements in the determined position of the graphics elements to be connected in series; when it is necessary to delete graphics elements, determine the position of the graphics elements to be deleted in the horizontal stack container, and delete the graphics elements in the determined position of the graphics elements to be deleted; The first graphic element is stored in a first horizontal stacking container, and other graphic elements are connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container.
[0042] Embodiment 5: If the module / unit integrated in the electronic device 100 is implemented in the form of 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, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory and read-only memory (ROM, Read-Only Memory).
[0043] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may 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.
[0044] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0045] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0046] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for generating a PLC ladder diagram, characterized in that: The following steps are involved: Construct at least one horizontal stacking container and at least one vertical stacking container, use the vertical stacking container to store each network, use the horizontal stacking container to store the graphics elements in a single network, when it is necessary to connect the graphics elements in series, determine the position of the graphics elements to be connected in series in the horizontal stacking container, and connect the graphics elements in series at the determined positions of the graphics elements to be connected in series; The first graphic element is stored in a first horizontal stacking container, and other graphic elements are connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container.
2. The method for generating a PLC ladder diagram according to claim 1, characterized in that: The graphic elements include contacts, coils, function blocks, jumps, returns, left bus bars and right bus bars.
3. The method for generating a PLC ladder diagram according to claim 1, characterized in that: In a single network, when an element needs to be deleted, the position of the element to be deleted in the horizontal stack container is determined, and the element is deleted at the position determined to be deleted.
4. The method for generating a PLC ladder diagram according to claim 1, characterized in that: After completing the parallel connection of the first graphic element, if it is necessary to continue to connect graphic elements in parallel, if the graphic elements to be connected in parallel are not connected in series with other graphic elements, and the parent container of the horizontal stacking container where the graphic elements to be connected in parallel are located is a vertical stacking container, then a fourth horizontal stacking container is added, and the graphic elements to be connected in parallel are stored in the newly added fourth horizontal stacking container, and the newly added fourth horizontal stacking container is placed below the horizontal stacking container where the graphic elements to be connected in parallel are located, the below refers to the next position of the horizontal stacking container where the graphic elements to be connected in parallel are located in the vertical stacking container, and the parent container refers to the container where the horizontal stacking container is placed.
5. The method for generating a PLC ladder diagram according to claim 1, characterized in that: After the first graphic element is connected in parallel, if it is necessary to continue to connect the graphic elements in series, the position of the graphic element to be connected in series in the horizontal stack container is determined, and the graphic elements are continued to be connected in series at the determined position of the graphic element to be connected in series.
6. The method for generating a PLC ladder diagram according to claim 5, characterized in that: After completing the parallel and series connection of the first graphic element, if it is necessary to continue connecting graphic elements in parallel, and if there are other graphic elements connected in series with the graphic elements that need to be connected in parallel, then continue to add a fifth horizontal stacking container, a sixth horizontal stacking container, and a second vertical stacking container, move the graphic elements that need to be connected in parallel from the horizontal stacker where they are located to the newly added fifth horizontal stacking container, store the graphic elements that need to be connected in parallel in the newly added sixth horizontal stacking container, store the fifth horizontal stacking container and the sixth horizontal stacking container together in the newly added second vertical stacking container, and place the newly added second vertical stacking container at the position where the horizontal stacking container where the graphic elements that need to be connected in parallel were originally stored.
7. The method for generating a PLC ladder diagram according to claim 1, characterized in that: If you need to continue adding networks, determine the position of the networks you need to continue adding in the vertical stack container, and continue adding networks at the position where you want to add networks; if you need to delete a network, determine the position of the networks you need to delete in the vertical stack container, and delete the networks at the position where you want to delete networks.
8. A PLC ladder diagram generation system, characterized in that: It includes a layout container building module, a network storage module, a single network graphic element storage module, a serial graphic element generation module and a parallel graphic element generation module; The layout container construction module is used to construct at least one horizontal stacking container and at least one vertical stacking container; The network storage module is used to store each network using vertically stacked containers; The single network graphic element storage module is used to store graphic elements in a single network using horizontally stacked containers; The serial graphic element generation module is used to determine the position of the graphic element that needs to be serially connected in the horizontal stack container when the graphic element needs to be serially connected, and serially connect the graphic element at the determined position of the serially connected graphic element; The parallel graphic element generation module is used to store the first graphic element in the first horizontal stacking container, and there are other graphic elements connected in series with the first graphic element. When the first graphic element needs to continue to be connected in parallel, a second horizontal stacking container, a third horizontal stacking container and a first vertical stacking container are added, the first graphic element is moved from the first horizontal stacker to the newly added second horizontal stacking container, the graphic elements that need to be connected in parallel are stored in the newly added third horizontal stacking container, the second horizontal stacking container and the third horizontal stacking container are stored together in the newly added first vertical stacking container, and the newly added first vertical stacking container is placed at the position where the first graphic element was originally stored in the first horizontal stacking container.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for generating a PLC ladder diagram according to any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for generating a PLC ladder diagram according to any one of claims 1 to 7 are implemented.