Search device
The search device addresses memory address extraction challenges in PLC programs by converting text programs, using a database to detect index registers and calculate modifier data, enhancing memory tracking and reducing designer burden.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- TOSHIBA UNIFIED TECHNOLOGIES CO LTD
- Filing Date
- 2022-05-13
- Publication Date
- 2026-07-24
Smart Images

Figure 0007894737000001 
Figure 0007894737000002 
Figure 0007894737000003
Abstract
Description
Technical Field
[0001] The present invention relates to a memory search device used in a program of a PLC (Programmable Logic Controller).
Background Art
[0002] In a PLC program, it is widely practiced to search the usage status of a memory and output it as a reference result for use as reference data during program creation (see, for example, Patent Document 1).
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] In a PLC program, when handling a large amount of data, a technique called index modification is used to suppress the program capacity. Index modification is a program technique that uses an indirect designation using an index register that specifies the actual address of a memory by a specific command word or the like.
[0005] However, since the target address of the index register is modified and specified by a complex element such as the calculation result of a program, there is a problem that it is difficult to search the actual address of the memory actually used. The program editor (engineering tool) used to create a PLC program has a reference search function for searching the actual address of the memory used in the program, but the index register is excluded from the search target, and it is a burden for the program designer to grasp the usage status of the memory used when creating and updating the program.
[0006] This embodiment was proposed to solve the problems of the prior art described above. The objective of this embodiment is to provide a search device that can extract the actual address and usage location of a memory address even when the memory address is specified by calculation processing in a PLC program. [Means for solving the problem]
[0007] To achieve the above objective, the search device according to claim 1 comprises: a source program in text format converted by a program editor (engineering tool) for a PLC (programmable logic controller); a database storing information on instruction words and operands used in the source program and information on registers; an index search means that refers to the database and detects an index register used in the source program as first index register information; a calculation means that calculates index modifier data for the first index register information detected by the index search means; a reference search function that stores the combination of the first index register and the index modifier data in the database as second index register information, refers to the database and extracts memory used in the program from the operands corresponding to the instruction words used in the source program and the second index register information; and an output means that outputs the extraction results obtained by the reference search function as a reference search result for the program. Furthermore, the reference search function extracts memory whose source cannot be identified and outputs it as the reference search result from the output means. It is characterized by the following.
[0008] To achieve the above objective, the search device according to claim 2 is the search device according to claim 1, wherein the database further includes transmission table information which is information of communication paths connecting a plurality of PLCs, and the reference search results are cross-referenced in the programs of the plurality of PLCs and output as the reference search results from the output means. [Brief explanation of the drawing]
[0010] [Figure 1] A functional block diagram showing a search device according to the first embodiment. [Figure 2] A flowchart illustrating the search function of the first embodiment. [Figure 3] A flowchart illustrating the function for calculating index-modified data in the first embodiment. [Figure 4] A functional block diagram showing a search device according to the second embodiment. [Figure 5] A flowchart illustrating the search function of the second embodiment. [Figure 6] A functional block diagram showing a search device according to the third embodiment. [Figure 7] A flowchart illustrating the search function of the third embodiment. [Modes for carrying out the invention]
[0011] (First embodiment) PLC1 is a programmable logic controller, a general-purpose controller that can issue on / off commands to controlled objects such as pumps and valves in a factory, and detect their respective states. PLC1 operates using its internal program 2, which can be constructed using PLC1's dedicated program editor 3. Program editor 3 has various functions, one of which is the ability to output program 2 in text format as source program 4.
[0012] The program editor 3 can run on a normal computer. Here, a normal computer consists of a CPU, storage device, interface, etc., and is equipped with input means such as a keyboard and mouse, and output means such as a CRT device, liquid crystal monitor, printer, and file (memory). In this embodiment, as well as the search device of the present invention, the search device also runs on this normal computer, and the aforementioned output means corresponds to output means 11 in Figure 1.
[0013] The search device of this embodiment has a reference search function 6 that detects the memory used by a source program 4 in text format. The target program 2 can be of any type, such as ladder language or ST (structured text) language, as long as it is in text format. Furthermore, since the search device of this embodiment operates on a normal computer and uses text characters as the determination element, it is an application program that can be built in various development environments using spreadsheet software or general-purpose languages such as C language.
[0014] The search device of this embodiment has a database 5. The database 5 stores instruction word information 5a, operand information 5b, and register information 5c used in program 2. Furthermore, the memory reference search function 6 is extended by registering index register information 5d (second index register information). The search function flow is shown in Figure 2. The index register information 5d is search information obtained by the index search function 7 by searching the source program 4 line by line, extracting an index register 10 (first index register information) that matches the register information 5c, and then calculating and linking the index modified data 9 used in that index register 10 using the calculation means 8.
[0015] PLC1 can flexibly change the address specified in the index register 10 by combining the index register 10 and the index-modified data 9, thereby enabling memory allocation that can handle large amounts of data. To elaborate on the function of calculating the index-modified data 9 using Figure 3, the method for generating the index-modified data 9 is implemented by a program that includes calculations and repetitive operations using various combinations of instruction words. Therefore, the instruction word information 5a and operand information 5b of the database 5 are effective in calculating the index-modified data 9 by the calculation means 8. The index-modified data 9 is obtained by tracing back the program that calculates the modified data to extract the starting point, and then executing the process of identifying the calculation means and obtaining the modified data from there.
[0016] The reference search function 6 detects the memory used in the program 2 by referring to the database 5. For the source program 4, starting from the first line, the instruction words used in order are used as search keywords, and the target memory is extracted by adding the operand information 5b and the index register information 5d to the content that matches the instruction word information 5a and analyzing it. An operand is a specified condition of an instruction word, and among the components of an instruction word, it indicates a constant, a variable, further data that is the target of individual instructions / processes in the program, and the location information of the data, so it is a main element for specifying the memory size.
[0017] The search results regarding the memory usage in the program 2 by the reference search function 6 are sorted by the output means 11 and output in a list format as the reference result 12.
[0018] In the search device of this embodiment, for the texturized source program 4, the memory used can be specified and extracted by referring to the database 5. Also, since the instruction word information 5a and the operand information 5b depend on the model of the PLC 1, it is possible to easily cope with environmental changes including version upgrades of the same model by changing the registration content in the database 5.
[0019] Furthermore, by adding the (second) index register information 5d linked with the index modification data 9 obtained by the index register 10 and the calculation means 8 as search data, the search range (target) is expanded. Due to index modification, the memory used in the program 2 was such that the program designer implemented prevention of memory reuse and selection of allocation targets based on the results of investigating the memory usage list (drawing) and the program 2. Therefore, outputting it as the reference result 12 reduces the burden on the program designer.
[0020] (Second Embodiment) The search device of the second embodiment will be described with reference to FIG. 4 for its configuration and FIG. 5 for its search function. Here, the description of the parts overlapping with the first embodiment will be omitted. When the absolute amount of the control target increases in PLC1, there are cases where a plurality of PLCs including another PLC13 are used to handle the control target, and each PLC may be connected by a transmission cable to exchange necessary data with each other. In that case, the aforementioned database 5 also serves as transmission table information 5e, which is setting information that summarizes other PLC13 and addresses to be transmitted as information regarding PLC-to-PLC transmission (communication). The reference search function 6 is extended in combination with the reference result 12 of other PLC13 to be transmitted as shown in FIG. 4.
[0021] Although it is not easy to confirm the reference regarding the transmission among multiple PLCs, by sharing and using the reference result 12 of other PLC13, it is possible to search for the use of memory including index registers. It is possible to avoid the risk of duplicate use of memory and change of transmission signals in Program 2, reducing the burden on the program designer.
[0022] (Third Embodiment) The search device of the third embodiment will be described with reference to FIG. 6 for its configuration and FIG. 7 for its search function. Here, the description of the parts overlapping with the first and second embodiments will be omitted. The search device of the present invention outputs the reference result 12 of the memory used in the program including the index register information 5c, but it also has a function of outputting an out-of-scope report 14 for memories whose writing source cannot be specified at each search execution.
[0023] There are various forms such as direct address specification (absolute address specification), indirect address specification, index address specification (pointer address specification), and relative address specification for the command words (operands), index registers, and addresses specified for the modification data. However, when the address specification is generated from the data in the memory, it may not be possible to identify it just by analyzing the program.
[0024] General reference functions typically exclude memory locations that cannot be identified. When these locations are not included in the reference results, program designers remain unaware of them, leaving them with concerns. Therefore, reporting these unidentified locations allows designers to investigate and detect them if the target program is identified, which is beneficial. Furthermore, it helps avoid program risks related to memory usage due to insufficient references. [Explanation of symbols]
[0025] 1. PLC (Programmable Logic Controller) 2. Program 3. Program Editor 4. Source program (text format) 5. Database 5a... Imperative information 5b...Operand information 5c...Register information 5d...Index register information 5e...Transmission Table Information 6. Reference Search Function 7. Index search function 8. Calculation method for modified data 9. Index-Modified Data 10...Index Register 11. Output means 12. Reference results 13...Other PLCs 14. Reports not applicable
Claims
1. The source program for the PLC is converted into a text format by a program editor, A database storing information about the instruction words and operands used in the source program, and information about registers, An index search means that refers to the aforementioned database and detects the index register used in the aforementioned source program as first index register information, A calculation means for calculating index-modified data for the first index register information detected by the index search means, The combination of the first index register and the index-modified data is stored in the database as second index register information. A reference search function that refers to the database and extracts the memory used in the program from the operands corresponding to the instruction words used in the source program and the second index register information, Output means for outputting the extraction results obtained by the reference search function as reference search results for the program, Equipped with, The aforementioned reference search function is a search device that further extracts memory whose source cannot be identified and outputs it as the reference search result from the output means.
2. In the search device described in claim 1, The database further contains transmission table information, which is information about communication paths connecting multiple PLCs, and the search device cross-references the reference search results in the programs of the multiple PLCs and outputs them as the reference search results from the output means.