PLC device
The PLC device simplifies POU call route specification and reduces user burden by using hash values to automatically determine matching call paths, enhancing execution efficiency by automating the monitoring of variable values within the PLC system.
Patent Information
- Application Number
- PCT/JP2023/026090
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-07-14
- Publication Date
- 2025-01-23
AI Technical Summary
Specifying a Program Organization Unit (POU) call route in a Programmable Logic Controller (PLC) device is complex and time-consuming, affecting program execution, as users need to manually input call paths, which increases user burden and execution time.
The PLC device includes an acquisition unit for acquiring call path information, a hash value generation unit that generates and updates hash values for POU call instructions, and a verification unit that compares these hash values to simplify the specification of POU call routes and reduce user burden by automatically determining matching call paths, thereby speeding up the process.
This solution simplifies the method of specifying POU call routes, reduces user burden, and speeds up the determination of specified call paths by using hash values to monitor variable values of POUs, allowing for efficient execution of sequence programs without manual intervention.
Smart Images

Figure JP2023026090_23012025_PF_FP_ABST
Abstract
Description
PLC device
[0001] The present disclosure relates to a PLC device that monitors variable values of POUs in a sequence program.
[0002] In a PLC (Programmable Logic Controller) device, a sequence program is constructed by combining functional unit programs called POUs (Program Organization Units). PLC devices use a variable monitoring function to check the operation of a sequence program without stopping it. Because sequence programs are executed periodically, there is a demand for monitoring variables for a specified POU call route. A technique for monitoring variable values during execution of a POU for a specified call route is known. For example, see Patent Document 1.
[0003] Japanese Patent Application Laid-Open No. 2003-228417
[0004] However, specifying a POU call route requires the user to input a call path, which is cumbersome. In addition, if it takes time to determine whether the POU call route matches the specified call path, this can affect program execution.
[0005] Therefore, it is desired to simplify the method of specifying the POU call route and reduce the burden on the user.
[0006] One aspect of the PLC device disclosed herein includes an acquisition unit that acquires and notifies call path information from a sequence program, the call path information including at least information on the location of a POU call instruction for the call path of a POU to be monitored, the jump address of the called POU, and the return address of the caller POU; a hash value generation unit that generates a hash value using the call path information as input; an execution unit that executes the sequence program, notifies the hash value generation unit of the call path information of the POU call instruction to be executed, and updates the call path hash value at the time of execution of the POU call instruction; a verification unit that compares the call path hash value at the time of execution of the POU call instruction updated by the execution unit to determine whether it matches the hash value generated from the call path information notified by the acquisition unit; and an output unit that, if there is call path information whose hash values match in the comparison by the verification unit, outputs the value of the variable of the POU to be monitored in the call path information.
[0007] FIG. 1 is a diagram showing an example of a functional block configuration of a PLC system according to a first embodiment; FIG. 2 is a diagram showing an example of a relationship between a sequence program and a POU; FIG. 3 is a diagram showing an example of a list of hash values of notified call path information; FIG. 4 is a flowchart illustrating a monitor process of a PLC device; FIG. 5 is a functional block diagram showing an example of a functional configuration of a PLC system according to a second embodiment; FIG. 6 is a diagram showing an example of a display screen of a sequence program; and FIG. 7 is a flowchart illustrating a monitor process of a PLC device.
[0008] First Embodiment A PLC system according to a first embodiment will be described in detail below with reference to the drawings. FIG. 1 is a diagram illustrating an example of a functional block configuration of the PLC system according to the first embodiment. As illustrated in FIG. 1, the PLC system 1 includes a PLC device 10 and a display device 20. The PLC device 10 and the display device 20 are directly connected to each other via a connection interface (not shown). The PLC device 10 and the display device 20 may be connected to each other and communicate via a network (not shown), such as a local area network (LAN) or the Internet. In this case, the PLC device 10 and the display device 20 include a communication unit (not shown) for communicating with each other via such a connection. Although the PLC device 10 and the display device 20 are described as separate devices, the display device 20 may be included in the PLC device 10, as described below.
[0009] <Display Device 20> The display device 20 is, for example, a computer or tablet terminal known to those skilled in the art, and has an input unit 21 and a display unit 22. The input unit 21 is, for example, a keyboard or a touch panel arranged on the display unit 22 (described later), and receives input of the call path of the POU to be monitored from the user. The display unit 22 is, for example, a liquid crystal display. The display unit 22 displays variable values of the POU to be monitored, etc., received from the PLC device 10.
[0010] 1 , the PLC device 10 according to this embodiment includes an acquisition unit 110, an execution unit 111, a hash value generation unit 112, a verification unit 113, a variable monitor execution unit 114, a monitor memory unit 115, and an output unit 116. The PLC device 10 includes a central processing unit (CPU) (not shown) or other processing device for implementing the operations of the functional blocks in FIG. 1 . The PLC device 10 also includes a main storage device (not shown) such as a read-only memory (ROM) or hard disk drive (HDD) (not shown) that stores various control programs, and a random access memory (RAM) for storing data temporarily required for the processing device to execute the programs.
[0011] In the PLC device 10, the arithmetic processing unit loads application software such as an OS and a debug program from the auxiliary storage device, and executes arithmetic processing based on the OS and application software while loading the loaded OS and application software into the main storage device. Based on the results of this calculation, the PLC device 10 controls each piece of hardware. This allows the processing by the functional blocks in Figure 1 to be realized. In other words, the PLC device 10 can be realized by the cooperation of hardware and software.
[0012] The acquisition unit 110 acquires and notifies call path information from the sequence program SP, including at least information on the location of the POU call instruction for the call path of the POU to be monitored, the jump address of the called POU, and the return address of the caller POU. FIG. 2 is a diagram showing an example of the relationship between the sequence program SP and the POUs. In FIG. 2, the main sequence program SP is shown on the left side, and functions FC_SUB1 and FC_SUB2, which are POUs, are shown in the center and right side. Specifically, for example, when function FC_SUB1 called from the sequence program SP is the POU to be monitored, the acquisition unit 110 acquires, as call path information, a call path (e.g., "MAIN1->FC_SUB1") including information on the location of the POU call instruction for function FC_SUB1, the jump address of the called POU, and the return address of the caller POU, based on a user's input operation via the input unit 21. Furthermore, when function FC_SUB2, which is called from function FC_SUB1, is set as the POU to be monitored, the acquisition unit 110 acquires, as call path information, the call path of the call from function FC_SUB1 to function FC_SUB2 (e.g., "FC_SUB1->FC_SUB2") based on the user's input operation via the input unit 21. Furthermore, when function FC_SUB2, which is called from the sequence program SP, is set as the POU to be monitored, the acquisition unit 110 acquires, as call path information, the call path of the call from function FC_SUB2 (e.g., "MAIN1->FC_SUB2") based on the user's input operation via the input unit 21. The acquisition unit 110 outputs the acquired call path information to the hash value generation unit 112, which will be described later. In addition, the acquisition unit 110 may acquire call path information of the POU to be monitored by, based on the user's input operation, aligning the cursor or mouse pointer of the input unit 21 with the position of functions FC_SUB1 or FC_SUB2 on the display screen of the sequence program SP displayed on the display unit 22 and clicking, etc.
[0013] The execution unit 111 periodically executes the sequence program SP, and when executing a POU call instruction of the sequence program SP, notifies the hash value generation unit 112 (described later) of the call path information of the POU call instruction. The execution unit 111 updates the call path hash value at the time of execution of the POU call instruction.
[0014] The hash value generation unit 112 generates a hash value using, for example, call path information notified by the acquisition unit 110 as input. Specifically, the hash value generation unit 112 receives, for example, the memory address of the POU call instruction, which is the location of the POU call instruction included in the call path information; the memory address of the callee code, which is specified as an operand of the POU call instruction and is the jump address of the callee POU; and the memory address of the return destination code, which is stored in a register or call stack and is the return address of the caller POU, and generates a hash value using an algorithm such as CRC (Cyclic Redundancy Check) or checksum. As shown in FIG. 3 , the hash value generation unit 112 generates a list of hash values for each piece of call path information notified by the acquisition unit 110. The hash value generation unit 112 also generates a call path hash value using, as input, the call path information of the POU call instruction notified by the execution unit 111.
[0015] The verification unit 113 compares, for example, whether the call path hash value at the time of execution of the POU call instruction updated by the execution unit 111 matches a hash value generated from the call path information notified by the acquisition unit 110. Specifically, the verification unit 113 compares, for example, whether the call path hash value at the time of execution of the POU call instruction updated by the execution unit 111 matches any of the hash values in the list of hash values in FIG.
[0016] If the verification unit 113 finds call path information whose hash values match, the variable monitor execution unit 114 writes the variable values of the POUs to be monitored for that call path information into the monitor memory unit 115, which will be described later.
[0017] The monitor memory unit 115 is, for example, a memory such as RAM, and stores the variable values of the POUs to be monitored by the variable monitor execution unit 114. The variable values of the POUs to be monitored are numeric values or character strings according to the data type of the variable (for example, integer type, floating-point number type, character string type, etc.).
[0018] The output unit 116 outputs the variable values of the POU to be monitored that are recorded in the monitor memory unit 115 to the display unit 22 of the display device 20. The display unit 22 of the display device 20 displays the variable values of the POU to be monitored that are stored in the monitor memory unit 115.
[0019] <Monitoring Process of PLC Device 10> Next, the flow of the monitoring process of the PLC device 10 will be described with reference to Fig. 4. Fig. 4 is a flowchart illustrating the monitoring process of the PLC device 10. The flow shown here is executed every time the sequence program SP is executed.
[0020] In step S11, the acquisition unit 110 acquires call path information from the sequence program SP, including at least information on the position of a POU call instruction for the call path of the POU to be monitored, the jump address of the called POU, and the return address of the caller POU. The acquisition unit 110 notifies the acquired call path information to the hash value generation unit 112.
[0021] In step S12, the hash value generating unit 112 generates a hash value using the call path information notified in step S11 as an input.
[0022] In step S13, the execution unit 111 executes the sequence program SP, and when executing the POU call instruction, notifies the hash value generation unit 112 of the call path information of the POU call instruction.
[0023] In step S14, the hash value generation unit 112 generates a call path hash value using the call path information notified in step S13 as an input. The execution unit 111 updates the call path hash value when the POU call instruction is executed.
[0024] In step S15, the verification unit 113 compares the call path hash value updated in step S14 when the POU call instruction is executed with any of the hash values in the list of hash values in FIG. 3 to determine whether they match.
[0025] In step S16, if there is call path information whose hash values match in the comparison in step S15, the variable monitor execution unit 114 records the variable values of the POUs to be monitored for that call path information in the monitor memory unit 115.
[0026] In step S17, the output unit 116 outputs the variable values of the POU to be monitored, which were recorded in the monitor memory unit 115 in step S16, to the display unit 22 of the display device 20. The display unit 22 of the display device 20 displays the variable values of the POU to be monitored, which were recorded in the monitor memory unit 115.
[0027] As described above, the PLC device 10 according to the first embodiment acquires call path information for the call path of the POU to be monitored from the sequence program SP and generates a hash value using each acquired call path information as input. The PLC device 10 executes the sequence program SP. When executing a POU call instruction, the PLC device 10 generates and updates a hash value from the call path information of the POU call instruction. The PLC device 10 compares the updated call path hash value at the time of execution of the POU call instruction to determine whether it matches the hash value of the call path information of the POU to be monitored. The PLC device 10 outputs the variable values of the POU to be monitored for the call path information whose hash values match to the display device 20. This simplifies the method for specifying the POU call route and reduces the burden on the user. Furthermore, the PLC device 10 can speed up the process of determining whether the specified call path is matched by comparing hash values. The first embodiment has been described above.
[0028] Second Embodiment Next, a second embodiment will be described. In the first embodiment, the PLC device 10 obtained call path information for the call path of the POU to be monitored from the sequence program SP. In contrast, in the second embodiment, the PLC device 10A displays the sequence program SP on the display device 20, and obtains call path information for a POU selected by the user from the displayed sequence program SP as the POU to be monitored, which is different from the first embodiment. As a result, the PLC device 10A according to the second embodiment can simplify the method of specifying the call route of the POU and reduce the burden on the user. The second embodiment will be described below.
[0029] Fig. 5 is a functional block diagram showing an example of the functional configuration of a PLC system according to the second embodiment. Elements having the same functions as those of the PLC system 1 in Fig. 1 are denoted by the same reference numerals, and detailed description thereof will be omitted. As shown in Fig. 5, the PLC system 1 according to the second embodiment includes a PLC device 10A and a display device 20. The display device 20 has the same functions as the display device 20 in the first embodiment. The input unit 21 and the display unit 22 have the same functions as the input unit 21 and the display unit 22 in the first embodiment.
[0030] The PLC device 10A includes a call command selection unit 117, an acquisition unit 110a, an execution unit 111, a hash value generation unit 112, a verification unit 113, a variable monitor execution unit 114, a monitor memory unit 115, and an output unit 116. The execution unit 111, the hash value generation unit 112, the verification unit 113, the variable monitor execution unit 114, the monitor memory unit 115, and the output unit 116 have the same functions as the execution unit 111, the hash value generation unit 112, the verification unit 113, the variable monitor execution unit 114, the monitor memory unit 115, and the output unit 116 in the first embodiment.
[0031] The call instruction selection unit 117 displays, for example, a POU call instruction of the sequence program SP on the display unit 22 of the display device 20, and accepts designation of call path information of the POU to be monitored by selecting a POU call instruction from the input unit 21 of the display device 20. FIG. 6 is a diagram showing an example of a display screen 200 of the sequence program SP. In FIG. 6, the display screen 200 has a display area 210 that displays a menu of items to be displayed on the display screen 200, a display area 220 that displays content corresponding to the item selected in the menu, and a display area 230 that displays operation buttons corresponding to the item selected in the menu. Note that FIG. 6 illustrates an example in which the user selects "MAIN2" as the sequence program SP, and the display area 220 displays the ladder program of "MAIN2" and the ladder program of "MYFUNC," which is a POU called from "MAIN2." 6, the display screen 200 displays the net numbers of the ladder programs "MAIN2" and "MYFUNC" vertically and the column numbers horizontally in the display area 220. Furthermore, "AAA" in "MYFUNC" indicates the command to be executed within "MYFUNC," and "in1" and "out1" indicate variables referenced within "MYFUNC." Furthermore, "TRUE" in column "1" indicates a literal (constant).
[0032] For example, as shown in FIG. 6 , when a user selects "MYFUNC" in "MAIN2" as a POU call instruction in the sequence program SP via the input unit 21, the display device 20 may highlight the selected "MYFUNC" on the display screen 200 with shading (e.g., red or yellow). When a user presses the "Call Path Selection" button via the input unit 21, the call instruction selection unit 117 accepts the specification of call path information for the monitored "MYFUNC," including the net number and column number (2, 2) as the location of the POU call instruction, the call destination net number "9" as the jump address of the called POU, and the call source net number "1" as the return address of the call source POU. The monitored variables in this case are "in1" and "out1."
[0033] The acquisition unit 110 a acquires the call path information of the monitoring target “MYFUNC” accepted by the call instruction selection unit 117 , and notifies the hash value generation unit 112 of the information.
[0034] <Monitoring Process of PLC Device 10> Next, the flow of the monitoring process of PLC device 10A will be described with reference to Figure 7. Figure 7 is a flowchart illustrating the monitoring process of PLC device 10A. The flow shown here is executed each time the sequence program SP is executed. Note that the processing of steps S23 to S28 is the same as the processing of steps S12 to S17 in Figure 4, and detailed description thereof will be omitted.
[0035] In step S21, the call instruction selection unit 117 displays the POU call instruction of the sequence program SP on the display unit 22 of the display device 20, and accepts the specification of the call path information of the POU to be monitored by selecting the POU call instruction from the input unit 21 of the display device 20.
[0036] In step S22, the acquisition unit 110a acquires the call path information of the POU to be monitored that was accepted in step S21, and notifies the hash value generation unit 112 of the information.
[0037] As described above, the PLC device 10A according to the second embodiment receives and acquires call path information for a POU to be monitored, selected by a user, from the display screen 200 of the sequence program SP displayed on the display device 20. The acquired call path information is used as input to generate a hash value. The PLC device 10A executes the sequence program SP. When executing a POU call instruction, the PLC device 10A generates and updates a call path hash value from the call path information of the POU call instruction. The updated call path hash value at the time of execution of the POU call instruction is compared to the hash value of the call path information for the POU to be monitored, to determine whether it matches. The PLC device 10A outputs the variable values of the POU to be monitored, whose call path information hash values match, to the display device 20. This simplifies the method for specifying a POU call route and reduces the burden on the user. Furthermore, the PLC device 10A can speed up the process of determining whether the specified call path is matched by comparing hash values. The second embodiment has been described above.
[0038] As described above, the PLC devices 10 and 10A according to the first and second embodiments can simplify the method of specifying the POU call route, thereby reducing the burden on the user.
[0039] <Modifications> In the first and second embodiments, the PLC device 10, 10A and the display device 20 are different devices, but this is not limiting. For example, the PLC device 10, 10A may include the display device 20.
[0040] The functions of the PLC devices 10 and 10A in the first and second embodiments can be realized by hardware, software, or a combination of these. Here, "realized by software" means that the functions are realized by a computer reading and executing a program.
[0041] The program can be stored and supplied to a computer using various types of non-transitory computer-readable media. Non-transitory computer-readable media include various types of tangible storage media. Examples of non-transitory computer-readable media include magnetic recording media (e.g., flexible disks, magnetic tapes, hard disk drives), magneto-optical recording media (e.g., magneto-optical disks), CD-ROMs (Read Only Memory), CD-Rs, CD-R / Ws, and semiconductor memories (e.g., mask ROMs, PROMs (Programmable ROMs), EPROMs (Erasable PROMs), flash ROMs, and RAMs). The program may be provided to the computer by various types of transient computer-readable media. Examples of transient computer-readable media include electrical signals, optical signals, and electromagnetic waves. The transient computer-readable media can provide the program to the computer via a wired communication path such as an electrical wire or optical fiber, or via a wireless communication path.
[0042] The step of writing a program to be recorded on a recording medium includes not only processes that are performed in chronological order, but also processes that are not necessarily performed in chronological order but are executed in parallel or individually. The step of writing the program may also be performed by cloud computing.
[0043] Although the present disclosure has been described in detail, the present disclosure is not limited to the individual embodiments described above. Various additions, substitutions, modifications, partial deletions, etc. are possible in these embodiments without departing from the gist of the present disclosure or the spirit of the present disclosure derived from the content of the claims and their equivalents. These embodiments can also be implemented in combination. For example, in the above-described embodiments, the order of each operation and the order of each process are shown as examples and are not limited to these. The same applies when numerical values or mathematical expressions are used to describe the above-described embodiments.
[0044] The following supplementary notes are further disclosed regarding the above-described embodiment and modifications. (Supplementary Note 1) The PLC device (10) includes an acquisition unit (110) that acquires and notifies call path information including at least information on the position of a POU call instruction for a call path of a POU to be monitored from a sequence program (SP), the jump address of the called POU, and the return address of the caller POU; a hash value generation unit (112) that generates a hash value using the call path information as an input; an execution unit (111) that executes the sequence program (SP), notifies the hash value generation unit (112) of the call path information of the POU call instruction to be executed, and updates the call path hash value at the time of execution of the POU call instruction; a verification unit (113) that compares whether the call path hash value at the time of execution of the POU call instruction updated by the execution unit (111) matches a hash value generated from the call path information notified from the acquisition unit (110); and an output unit (116) that outputs the value of a variable of the POU to be monitored for the call path information when the comparison by the verification unit (113) finds call path information whose hash values match. (Supplementary Note 2) The PLC device (10) of Supplementary Note 1 includes a monitor memory unit (115) that stores the values of variables of a POU to be monitored, and a variable monitor execution unit (114) that, when call path information whose hash values match in a comparison by a verification unit (113) is found, writes the values of variables of the POU to be monitored of the call path information to the monitor memory unit (115). (Supplementary Note 3) The PLC device (10A) of Supplementary Note 1 or Supplementary Note 2 includes a call instruction selection unit (117) that displays a POU call instruction of a sequence program (SP) and accepts designation of call path information of a POU to be monitored by selecting the POU call instruction from the outside (20).
[0045] REFERENCE SIGNS LIST 1 PLC system 10, 10A PLC device 110, 110a Acquisition unit 111 Execution unit 112 Hash value generation unit 113 Verification unit 114 Variable monitor execution unit 115 Monitor memory unit 116 Output unit 117 Call command selection unit 20 Display device 21 Input unit 22 Display unit
Claims
1. A PLC device comprising: an acquisition unit that acquires and notifies call path information from a sequence program, the call path information including at least information on the position of a POU call instruction for a call path of a POU to be monitored, the jump address of the called POU, and the return address of the called POU; a hash value generation unit that generates a hash value using the call path information as input; an execution unit that executes the sequence program, notifies the hash value generation unit of the call path information of the POU call instruction to be executed, and updates the call path hash value at the time of execution of the POU call instruction; a verification unit that compares whether the call path hash value at the time of execution of the POU call instruction updated by the execution unit matches the hash value generated from the call path information notified by the acquisition unit; and an output unit that outputs the value of the variable of the POU to be monitored of the call path information when the comparison by the verification unit finds call path information whose hash values match.
2. A PLC device as described in claim 1, comprising: a monitor memory unit that stores the values of variables of the POU to be monitored; and a variable monitor execution unit that, when there is call path information whose hash values match in the comparison by the verification unit, writes the values of variables of the POU to be monitored of the call path information into the monitor memory unit.
3. A PLC device according to claim 1 or 2, further comprising a call command selection unit which displays a POU call command of the sequence program and accepts designation of call path information of the POU to be monitored by selecting a POU call command from outside.
Citation Information
Patent Citations
Programmable logic controller and program formation assistance device
JP2020013527A
Tracking a programs calling context using a hybrid code signature
US20130054942A1