Ladder program analyzer
The ladder program analysis device automatically analyzes and outputs execution paths, addressing the challenge of manual intervention and separate file management in ladder language, enhancing coverage recording and verification.
Patent Information
- Application Number
- JP2022571374
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-12-21
- Filing Date
- 2021-12-16
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-12-16
AI Technical Summary
In ladder language used in PLCs, it is difficult to record coverage of execution paths due to the need for manual intervention and separate file management, and the inability to visually confirm coil conditions that turn on only for one scan.
A ladder program analysis device with a path analysis unit, contact combination acquisition unit, and path output unit that automatically analyzes and outputs execution paths without manual intervention, allowing for the measurement of execution paths and execution history.
Enables the automatic measurement of ladder program execution paths and execution history without manual intervention, facilitating improved coverage recording and verification.
Smart Images

Figure 0007601906000001 
Figure 0007601906000002 
Figure 0007601906000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a ladder program analysis device. [Background technology]
[0002] In software development, it is required to record coverage in order to prove test implementation for improving reliability and certification of functional safety, etc. "Coverage" is one of the measures used in software testing, also known as code coverage rate, and refers to the percentage of a program's source code that has been tested.
[0003] To improve coverage, a conversion unit that converts a PLC program that operates a programmable logic controller (PLC) into a general-purpose language program written in a general-purpose programming language and a technology that performs testing on the general-purpose language program are known (for example, Patent Document 1). [Prior art documents] [Patent documents]
[0004] [Patent Document 1] JP 2018-133034 A Summary of the Invention [Problem to be solved by the invention]
[0005] In the ladder language used in PLCs, the input circuits for one coil output branch or merge, and in order to record which of the multiple routes had been verified, it was necessary to manage them in a separate file, making recording coverage difficult.
[0006] Also, in cases where the condition for the coil to turn ON is only met for one scan, it was not possible to check this visually, and it was necessary to record the coverage while taking logs using a separate function such as tracing.
[0007] There is a demand for a technology that can measure the execution path of a ladder program without manual operation by an operator for easy coverage recording. [Means for solving the problem]
[0008] One aspect of the present disclosure is an analysis device comprising a path analysis unit that analyzes each path of a ladder program circuit, a contact combination acquisition unit that acquires a combination of contacts of each analyzed path, and a path output unit that outputs a path based on the calculation result of a condition value for each combination. Effect of the Invention
[0009] According to one embodiment, the execution path of a ladder program can be measured without manual intervention by an operator. [Brief description of the drawings]
[0010] [Figure 1] FIG. 2 is a functional block diagram illustrating functions of an analysis device according to an embodiment. [Diagram 2] 1 is a flowchart illustrating an operation of an analysis device according to an embodiment. [Diagram 3] 1 is a diagram showing an example of a range of logical operations in a ladder program to be analyzed by an analysis device according to one embodiment. FIG. [Figure 4] 4 is a table showing examples of combinations of nodes in each path included in the range shown in FIG. 3. [Diagram 5] 5 is a table showing an example of the results of logical operations for each path shown in FIG. 4. [Figure 6] 6 is an example of a diagram showing the result of the logical operation shown in FIG. 5 in a ladder program. [Figure 7] 4 is a table showing an example of a result of a first logical operation for each path shown in FIG. 3. [Figure 8] 4 is a table showing an example of a result of a second logical operation for each path shown in FIG. 3. [Figure 9]9 is a table showing the difference between the result of the first logical operation shown in FIG. 7 and the result of the second logical operation shown in FIG. 8. [Figure 10] 10 is an example diagram showing the difference shown in FIG. 9 in a ladder program. [Figure 11] FIG. 2 is a functional block diagram illustrating functions of an analysis device according to an embodiment. [Figure 12] 1 is a flowchart illustrating an operation of an analysis device according to an embodiment. [Figure 13] 1 is a table illustrating an execution history of operations according to one embodiment. [Figure 14] FIG. 2 is a functional block diagram illustrating functions of an analysis device according to an embodiment. [Figure 15] 1 is a flowchart illustrating an operation of an analysis device according to an embodiment. [Figure 16] This is an example in which a dummy output coil is installed on each path that makes up a ladder program. [Figure 17] 17 is a table showing an example of an output result for each pass shown in FIG. 16. [Figure 18] 18 is an example of a diagram showing the output result shown in FIG. 17 in a ladder program. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0011] 1. First embodiment Hereinafter, a first embodiment of the present invention will be described with reference to FIGS. 1 to 10. FIG. 1 is a functional block diagram for explaining the function of the analysis device 1 according to this embodiment. FIG. 2 is a flowchart showing the operation of the analysis device 1. FIG. 3 is a diagram showing an example of a range of logical operations in a ladder program to be analyzed by the analysis device 1. FIG. 4 is a table showing an example of a combination of nodes in each path included in the range of logical operations shown in FIG. 3. FIG. 5 is a table showing an example of a result of logical operations for each path shown in FIG. 4. FIG. 6 is an example of a diagram showing the result of logical operations shown in FIG. 5 in a ladder program. FIG. 7 is a table showing an example of a result of a first logical operation for each path shown in FIG. 3. FIG. 8 is a table showing an example of a result of a second logical operation for each path shown in FIG. 3. FIG. 9 is a table showing the difference between the result of the first logical operation shown in FIG. 7 and the result of the second logical operation shown in FIG. 8. FIG. 10 is an example of a diagram showing the difference shown in FIG. 9 in a ladder program.
[0012] 1.1 Configuration of the first embodiment As shown in FIG. 1, the analysis device 1 according to this embodiment includes a control unit 11, a storage unit 12, and a display device 13.
[0013] The control unit 11 is a part that controls the entire analysis device 1, and realizes various functions in this embodiment by appropriately reading and executing various programs from a storage area such as a ROM, RAM, flash memory, or hard disk (HDD). The control unit 11 may be a CPU. The control unit 11 includes a program acquisition unit 111, a range setting unit 112, a start / end condition setting unit 113, a path analysis unit 114, a list generation unit 115, a logical operation unit 116, and a path output unit 117. The control unit 11 executes and analyzes the ladder program.
[0014] The program acquisition unit 111 acquires a ladder program to be analyzed by the analysis device 1 from the storage unit 12 described below.
[0015] The range setting unit 112 sets the range of paths that are the subject of logical operations by the later-described logical operation unit 116. The range setting unit 112 makes it possible to perform logical operations on only some of the circuits, rather than on all of the circuits that make up the ladder program.
[0016] The start / end condition setting unit 113 sets the start condition and end condition of the logical operation. For example, the start condition may be that "X0.0" in the ladder program is turned ON, or that a start button for instructing the start of analysis of the ladder program is pressed in the analysis device 1. The start / end condition setting unit 113 may also set the end condition as that "X0.0" in the ladder program is turned OFF, or that an end button for instructing the end of analysis of the ladder program is pressed in the analysis device 1.
[0017] The path analysis unit 114 analyzes each path in the ladder program circuit. More specifically, the path analysis unit 114 identifies (makes apparent) all paths included in the ladder program circuit.
[0018] The list generating unit 115 creates a list of the paths analyzed by the path analyzing unit 114 .
[0019] The logical operation unit 116 performs logical operation using the condition values of each combination of nodes included in each item of the list generated by the list generation unit 115. In the following, the list generation unit 115 and the logical operation unit 116 may be collectively referred to as a "node combination acquisition unit."
[0020] The path output unit 117 outputs a path based on the result of the calculation by the logical operation unit 116. For example, the path output unit 117 may output only the path for which the result of the calculation by the logical operation unit 116 is true. Alternatively, the path output unit 117 may output only the path for which the result of the calculation by the logical operation unit 116 is false. In addition, the destination of these outputs may be the storage unit 12 described below or the display device 13.
[0021] The path output unit 117 includes a difference comparison unit 118 and a comparison result output unit 119 . When the logic operation unit 116 performs logic operations on a given path multiple times, the difference comparison unit 118 compares the results of these operations. The comparison result output section 119 outputs the comparison results from the difference comparison section 118 together with the paths to which each of the calculation results included in the comparison results corresponds.
[0022] The memory unit 12 is a storage device that stores the ladder program acquired by the program acquisition unit 111, the path output by the path output unit 117, the comparison result output by the comparison result output unit 119 included in the path output unit 117, etc.
[0023] The display device 13 is a display device that displays the ladder program acquired by the program acquisition unit 111, the path output by the path output unit 117, the comparison result output by the comparison result output unit 119 included in the path output unit 117, etc., and is realized, for example, by an LCD monitor.
[0024] 1.2 Operation of the First Embodiment Hereinafter, the operation of the analysis device 1 according to this embodiment will be described with reference to the flowchart in FIG. 2 and the diagrams illustrated in FIGS.
[0025] In step S11 , the program acquisition unit 111 acquires the ladder program from the storage unit 12 .
[0026] In step S12, the range setting unit 112 sets a range for logical operation. Fig. 3 shows an example of setting a range for logical operation. In the example of Fig. 3, a range is set that includes a path including "R1111.0" and "F0089.5", a path including "DDDD", and a path including "X0010.6" and "EEEE".
[0027] In step S13, the start / end condition setting unit 113 sets the start condition and end condition of the logical operation.
[0028] In step S14, the path analysis unit 114 analyzes the paths of the ladder program included in the range of the logical operation.
[0029] In step S15, the list generating unit 115 creates a list of each analyzed path.
[0030] If the start condition is met in step S16 (S16: YES), the process proceeds to step S17. If the start condition is not met (S16: NO), the process returns to step S16.
[0031] In step S17, the logical operation unit 116 performs logical operations on the condition values corresponding to the combinations of nodes included in each item of the list. Fig. 5 shows an example of the results of the logical operation.
[0032] In step S18, the path output unit 117 outputs the path for which the calculation result is true. Here, as an example, the path output unit 117 outputs the path for which the calculation result is true to the display device 13, but is not limited to this. The path output unit 117 may output the path for which the calculation result is false instead of the path for which the calculation result is true. Note that the output destination may be the storage unit 12 instead of the display device 13.
[0033] In step S19, if the end condition is met (S19: YES), the process proceeds to step S20. If the end condition is not met (S19: NO), the process returns to step S17.
[0034] In step S20, the display device 13 displays the output contents by the path output unit 117. Fig. 6 is an example of such a display, in which the path No. 2 for which the calculation result in Fig. 5 is true is highlighted (in Fig. 6, the path is shown by a thick line).
[0035] Note that the analysis device 1 may not only simply output paths for which the calculation results are true, but also output the comparison results by the difference comparison unit 118 together with paths to which each calculation result included in the comparison results corresponds. Below, with reference to Figs. 7 to 9, examples of outputting the calculation results included in the comparison results together with paths to which the comparison results correspond will be described.
[0036] Fig. 7 is a table showing an example of the first calculation result. In the table of Fig. 7, the calculation result of path No. 1 is "FALSE", the calculation result of path No. 2 is "TRUE", and the calculation result of path No. 3 is "FALSE".
[0037] Fig. 8 is a table showing an example of the second calculation result. In the table of Fig. 8, the calculation result of path No. 1 is "FALSE", the calculation result of path No. 2 is "FALSE", and the calculation result of path No. 3 is "FALSE". Compared with the table of Fig. 7, the calculation result of path No. 2 has changed from "TRUE" to "FALSE".
[0038] Fig. 9 is a table showing the comparison result between the first calculation result and the second calculation result. As described above, the calculation result of path No. 2 is "TRUE" in the first calculation result and "FALSE" in the second calculation result. In Fig. 9, the column of path No. 2 where the calculation result is different is surrounded by a thick line.
[0039] Fig. 10 shows an example of a ladder program displayed on display device 13 as a result of comparison results being output to display device 13 by comparison result output unit 119. In the example shown in Fig. 10, the path No. 2 is highlighted (in Fig. 10, this path is shown by a thick line). Note that display device 13 may display the table of Fig. 9 instead of the ladder program shown in Fig. 10.
[0040] 2. Second embodiment The second embodiment of the present invention will be described below with reference to Figs. 11 to 13. Fig. 11 is a functional block diagram for explaining the functions of an analysis device 1A according to this embodiment. Fig. 12 is a flowchart showing the operation of the analysis device 1A. Fig. 13 is a table showing the execution history of calculations. Note that, for the sake of simplicity of explanation, the following mainly describes components and operations of the analysis device 1A according to the second embodiment that are different from the analysis device 1 according to the first embodiment, and may omit the same components and operations.
[0041] 2.1 Configuration of the second embodiment 11, control unit 11A included in analysis device 1A differs from control unit 11 included in analysis device 1 in that control unit 11A further includes execution history output unit 120. For the sake of simplicity of explanation, range setting unit 112, start / end condition setting unit 113, difference comparison unit 118, and comparison result output unit 119 included in control unit 11 of analysis device 1 are not shown in FIG. 11, but the configuration may include one or more of these.
[0042] When a logical operation is executed multiple times, the execution history output unit 120 outputs paths in which the result of the logical operation has changed, together with the execution history for each path. The output destination may be the storage unit 12 or the display device 13.
[0043] 2.2 Operation of the Second Embodiment Hereinafter, the operation of the analysis device 1A according to this embodiment will be described with reference to the flowchart in FIG. 12 and the table illustrated in FIG.
[0044] In step S31, the program acquisition unit 111 acquires the ladder program from the storage unit 12.
[0045] In step S32, the path analysis unit 114 analyzes the path of the ladder program.
[0046] In step S33, the list generating unit 115 creates a list of each analyzed path.
[0047] If the logical operation is to be started in step S34 (S34: YES), the process proceeds to step S35. If the logical operation is not to be started yet (S34: NO), the process returns to step S34.
[0048] In step S35, the logical operation unit 116 performs a logical operation on the condition values corresponding to the combinations of nodes included in each item of the list.
[0049] In step S36, the path output unit 117 outputs the path together with the calculation result. Here, it is assumed that the path output unit 117 outputs the path to the execution history output unit 120 together with the calculation result.
[0050] In step S37, if the logical operation is to be ended (S37: YES), the process proceeds to step S38. If the logical operation is not to be ended yet (S37: NO), the process returns to step S35.
[0051] In step S38, the execution history output unit 120 outputs the paths in which the results of the logical operations have changed, together with the execution history for each path. Here, the execution history output unit 120 outputs to the display device 13, but is not limited to this and may output to the storage unit 12.
[0052] In step S39, the display device 13 displays the contents output from the execution history output unit 120. Fig. 13 is an example of such a display. For the path No. 1, the calculation result at the first logical operation is "TRUE", the calculation result at the second logical operation is "FALSE", and the calculation result at the third logical operation is "FALSE". In other words, the calculation result of the path No. 1 has changed, so it is highlighted (in Fig. 13, the column is surrounded by a thick line).
[0053] 3. Third embodiment Hereinafter, the third embodiment of the present invention will be described with reference to Figs. 14 to 18. Fig. 14 is a functional block diagram for explaining the function of an analysis device 1B according to this embodiment. Fig. 15 is a flowchart showing the operation of the analysis device 1B. Fig. 16 is an example in which a dummy output coil is installed in each path constituting a ladder program. Fig. 17 is a table showing an example of an output result for each path shown in Fig. 3. Fig. 18 is an example of a diagram showing the output result shown in Fig. 17 in a ladder program. Note that, in the following, for the sake of simplicity of explanation, mainly components and operations of the analysis device 1B according to the third embodiment that are different from the analysis device 1 according to the first embodiment will be described, and the same components and operations may be omitted.
[0054] 3.1 Configuration of the third embodiment 14, a control unit 11B included in an analysis device 1B does not include a logic operation unit 116 compared to the control unit 11 included in the analysis device 1, and instead includes a coil / command setting unit 121.
[0055] The coil and command setting unit 121 sets a dummy output coil or command for each path analyzed by the path analysis unit 114. Note that the coil and command setting unit 121 in this embodiment constitutes a part or the whole of a "contact combination acquisition unit."
[0056] The path output unit 117A outputs a path based on the output result from a dummy output coil or command set by the coil / command setting unit 121.
[0057] The start / end condition setting unit 113 sets start and end conditions for the output of an output coil or an instruction.
[0058] The ladder program execution unit 122, which executes the ladder program, executes the output coil or command set by the coil / command setting unit 121. In detail, the ladder program execution unit 122 starts outputting the output coil or command when a start condition is satisfied, and ends outputting the output coil or command when a termination condition is satisfied. The ladder program execution unit is also provided as a functional configuration in the control unit 11 of the first embodiment and the control unit 11A of the second embodiment.
[0059] A range setting unit 112 sets a range of paths to be targeted for output of an output coil or an instruction. A path analysis unit 114 analyzes each path within the set range.
[0060] The third embodiment may further include an execution history output unit (not shown) that, similar to the execution history output unit 120 in the second embodiment, outputs paths in which the results of the output coil or the output of an instruction have changed when the output of the output coil or the output of an instruction is executed multiple times, together with the execution history for each path.
[0061] 3.2 Operation of the third embodiment Hereinafter, the operation of the analysis device 1B according to this embodiment will be described with reference to the flowchart in FIG. 15 and the diagrams in FIGS.
[0062] In step S51, the program acquisition unit 111 acquires the ladder program from the storage unit 12.
[0063] In step S52, the path analysis unit 114 analyzes the path of the ladder program.
[0064] In step S53, the coil / command setting unit 121 sets a dummy output coil or command to each analyzed path. Fig. 16 shows an example of setting the output coils D1 to D3.
[0065] In step S54, if the ladder program executing unit 122 starts executing the ladder program (S54: YES), the process proceeds to step S55. If the ladder program executing unit 122 has not yet started executing the ladder program (S54: NO), the process returns to step S54.
[0066] In step S55, the path output unit 117A acquires the output result from the output coil or the command. Fig. 17 is a table showing an example of the output result.
[0067] In step S56, the path output unit 117A outputs a path whose output result from the output coil or command is true. In this step S56, the path output unit 117A may output a path whose output result is false instead of the path whose output result is true. Note that the path output unit 117A outputs to the display device 13, but is not limited to this, and the output destination may be the storage unit 12.
[0068] In step S57, if the ladder program executing unit 122 ends the execution of the ladder program (S57: YES), the process proceeds to step S58. If the ladder program executing unit 122 has not yet ended the execution of the ladder program (S57: NO), the process returns to step S55.
[0069] In step S58, the display device 13 displays the contents output from the path output unit 117A. Fig. 18 is an example of such a display, in which the path No. 2 whose output result has become ON in Fig. 17 is highlighted (in Fig. 18, the path is shown by a thick line).
[0070] [4. Effects] The analysis device of the present invention comprises a path analysis unit 114 that analyzes each path of a ladder program circuit, a contact combination acquisition unit that acquires a combination of contacts of each analyzed path, and a path output unit 117 that outputs a path based on the calculation result of the condition value for each combination.
[0071] This allows an operator to measure the execution path of a ladder program without manual work.
[0072] In addition, the analysis device of the present invention is equipped with an execution history output unit 120 that outputs paths where the results of a logical operation have changed when the logical operation is executed multiple times, along with the execution history of each path, making it possible to check the execution history of a ladder program without using functions such as tracing. [Explanation of symbols]
[0073] 1 Analysis device 11 Control section 12 Storage section 13 Display device 111 Program Acquisition Department 112 Range setting section 113 Start / End Condition Setting Section 114 Path Analysis Unit 115 List Generation Unit 116 Logic Operation Unit 117,117A Path output section 118 Difference Comparison Section 119 Comparison result output section 120 Execution history output section 121 Coil and command installation section 122 Ladder program execution section
Claims
1. a path analysis unit that analyzes each path of a ladder program circuit; a node combination acquisition unit for acquiring a combination of nodes of each analyzed path; a path output unit that outputs a predetermined path based on a result of one or more calculations of the condition values for each combination.
2. The analysis device according to claim 1 , wherein the contact combination acquisition unit includes a logical operation unit that performs a logical operation on a condition value for each acquired combination of contacts.
3. The contact combination acquisition unit includes a coil / command setting unit that sets an output coil or command to each path for each acquired contact combination, The analysis device according to claim 1 , wherein the path output unit outputs a path based on an output of an installed output coil or an instruction.
4. A start / end condition setting unit that sets a start condition and an end condition of the logical operation, The analysis device according to claim 2 , wherein the logical operation unit starts the logical operation when the start condition is satisfied, and ends the logical operation when the end condition is satisfied.
5. a range setting unit that sets a range of paths to be subjected to the logical operation, 5. The analysis device according to claim 2, wherein the path analysis unit analyzes each path within a set range.
6. The path output unit includes: a difference comparison unit that compares a plurality of operation results by the logic operation unit when the logic operation is executed a plurality of times; The analysis device according to claim 2 , further comprising a comparison result output section that outputs a comparison result obtained by the difference comparison section.
7. 7. The analysis device according to claim 2, further comprising an execution history output unit that outputs, when the logical operation is executed a plurality of times, paths in which a result of the logical operation has changed, together with an execution history for each path.
8. a start / end condition setting unit that sets a start condition and an end condition for outputting the output coil or the command; A ladder program execution unit that executes a ladder program, The analysis device according to claim 3 , wherein the ladder program execution unit starts outputting the output coil or command when the start condition is satisfied, and ends outputting the output coil or command when the end condition is satisfied.
9. A range setting unit that sets a range of paths to be the output coil or the output of the command, 9. The analysis device according to claim 3, wherein the path analysis unit analyzes each path within a set range.
10. The path output unit includes: a difference comparison unit that compares the output results of the output coil or the command when the output of the output coil or the command is executed a plurality of times; The analysis device according to claim 3 , further comprising a comparison result output section that outputs a comparison result obtained by the difference comparison section.
11. The analysis device according to claim 3, further comprising an execution history output unit that outputs, when the output of the output coil or the output of the instruction is executed multiple times, a path in which a result of the output of the output coil or the output of the instruction has changed, together with an execution history for each path.
12. The analysis device according to claim 1 , further comprising a display device that displays an output result from the path output unit.
Citation Information
Patent Citations
Static tracing device for plural processors
JP1985005347A
Display method and execution method for sequence program
JP1998283005A
Display information generation device, program execution situation display system, method and program
JP2015170009A
Software testing device, software testing system, software testing method, and program
JP2018133034A
