PROGRAM DEVELOPMENT SUPPORT DEVICE, PROGRAM DEVELOPMENT SUPPORT METHOD, AND PROGRAM DEVELOPMENT SUPPORT PROGRAM

JP7638457B1Active Publication Date: 2025-03-03MITSUBISHI ELECTRIC CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2024559716
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2025-03-03
Estimated Expiration
2043-03-31

AI Technical Summary

Benefits of technology

【0010】 本開示では、類似検索部が既存の制御プログラムとプログラム断片との副作用を比較することにより、既存の制御プログラムからモデルの構成単位となるプログラム断片を検出することができる。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007638457000001
    Figure 0007638457000001
  • Figure 0007638457000002
    Figure 0007638457000002
  • Figure 0007638457000003
    Figure 0007638457000003
Patent Text Reader

Abstract

The program development support device (1) includes a program fragment database (1043) that registers multiple fragment side effect lists, in which multiple side effects included in a program fragment (F) corresponding to a mechanism element are described as multiple fragment side effects, in correspondence with multiple program fragments (F); a program analysis unit (1041) that analyzes a control program and creates a program side effect list in which multiple side effects included in the control program are described as multiple program side effects; and a similarity search unit (1042) that compares the multiple program side effects described in the program side effect list with the multiple fragment side effects described in the multiple fragment side effect lists, and searches for a program fragment (F) corresponding to the fragment side effect list in which the multiple fragment side effects are included in the multiple program side effects, as a similar program fragment.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to a program development support device, a program development support method, and a program development support program. The present disclosure relates to improving the efficiency of development of control programs in the fields of factory automation (FA) and process automation (PA). [Background technology]

[0002] Machine tools and production lines (hereinafter collectively referred to as production equipment) are often controlled using a PLC (Programmable Logic Controller). Since the content of the control varies depending on the production equipment, the machine tool manufacturer or system integrator (hereinafter collectively referred to as production equipment manufacturer) creates the control program according to the production equipment.

[0003] In order to make the development of control programs more efficient, the application of model-based development is becoming widespread in some areas. As of 2022, the scope of application of model-based development is limited, and it cannot be said that it is widely applied to the development of production equipment and control programs. For this reason, the proportion of development assets (hereinafter referred to as existing development assets) to which model-based development has not been applied is large for all production equipment on the market. Considering the need for business efficiency in recent years, it is preferable to convert existing development assets into development assets (hereinafter referred to as model-based development assets) to which model-based development has been applied, and to utilize them for future model modifications and model reuse development.

[0004] It would be useful if control programs, which are existing development assets, could be converted into model-based development assets. However, manual conversion requires a huge amount of man-hours, and no technology is known that can perform conversion without manual effort.

[0005] In order to recover a model from a control program, it is necessary to recover the intention of the developer who created the control program. However, information is often lost when engineers change, and supplementary information (labels, comments) or design documents in the control program that serve as clues for analysis are often insufficient.

[0006] As a result, it is often determined that the effect of manual work is not commensurate with the effort put in. In addition, since it is necessary to restore the developer's intent and deriving a model from a control program is not a problem that can be solved deterministically, there are no known techniques for performing conversion using software. [Prior art documents] [Patent documents]

[0007] [Patent Document 1] JP 2001-306108 A Summary of the Invention [Problem to be solved by the invention]

[0008] Patent Document 1 discloses a method for creating a control program, characterized in that a state transition diagram, which is a type of model, is associated with the control program and saved. The state transition diagram must be created and edited on a screen by the user in advance, and Patent Document 1 mentions generating a control program from the state transition diagram. On the other hand, there is no mention of models other than the state transition diagram. The technique disclosed in Patent Document 1 does not disclose or suggest deriving a state transition diagram from a control program. The problem that the present disclosure aims to solve is to detect program fragments that serve as building blocks of a model from an existing control program and generate a control program model, without assuming that design information for the production equipment is attached to the control program. [Means for solving the problem]

[0009] A program development support device according to the present disclosure includes: a program fragment database in which a plurality of fragment side effect lists, in which a plurality of side effects included in a program fragment corresponding to a mechanism element are described as a plurality of fragment side effects, are registered in correspondence with a plurality of program fragments; a program analysis unit that analyzes a control program and creates a program side-effect list in which a plurality of side effects included in the control program are described as a plurality of program side-effects; a similarity search unit that compares the plurality of program side effects described in the program side effect list with the plurality of fragment side effects described in the plurality of fragment side effect lists, and searches for a program fragment corresponding to the fragment side effect list in which the plurality of fragment side effects are included in the plurality of program side effects, as a similar program fragment; Equipped with: Effect of the Invention

[0010] In the present disclosure, the similarity search unit compares the side effects of an existing control program with those of a program fragment, thereby making it possible to detect a program fragment that serves as a building block of a model from the existing control program. [Brief description of the drawings]

[0011] [Figure 1] FIG. 4 is a diagram showing an example of a control program. [Diagram 2] FIG. 13 is a diagram showing an example of a block definition diagram. [Diagram 3] FIG. 2 is a diagram showing an example of an internal block diagram. [Figure 4] FIG. 13 is a diagram showing an example of a state transition diagram. [Diagram 5] FIG. 1 shows a system configuration. [Figure 6] FIG. 2 is a diagram showing the configuration of an engineering workstation 9. [Figure 7] FIG. 1 shows a configuration of a program development support device 1. [Figure 8] FIG. 2 is a diagram showing the configuration of a model extraction unit 104. [Figure 9] FIG. [Figure 10] FIG. 10 is a diagram showing the structure of a program fragment database 1043. [Figure 11] 10 is a flowchart showing the operation of a program analysis unit 1041. [Figure 12] 10 is a diagram showing an example of a program list converted into text by a program analysis unit 1041. FIG. [Figure 13] 10 is a diagram showing an example of a variable abstraction table created by the program analysis unit 1041. [Figure 14] 10 is a diagram showing an example of a program after normalization and abstraction by the program analysis unit 1041. [Figure 15] 13 is a diagram showing an example of a side effect target algebra calculated by the program analysis unit 1041. [Figure 16] 10 is a diagram showing an example of a program side effect list created by the program analysis unit 1041. [Figure 17] 10 is a diagram showing an example of program side effect dependency relationships of program side effects determined by the program analysis unit 1041. FIG. [Figure 18] 10 is a diagram showing a program dependency graph of program side effects generated by the program analysis unit 1041. FIG. [Figure 19] 10 is a diagram showing an example of a side effect list after program normalization by the program analysis unit 1041. [Figure 20] FIG. 10 is a diagram showing the relationship of information by a program analysis unit 1041. [Figure 21] 10 is a flowchart showing the operation of a similarity search unit 1042. [Figure 22] FIG. 13 is a diagram showing an example of a side effect search performed by the similarity search unit 1042. [Figure 23] 10 is a diagram showing a data structure of a search result from a similarity search unit 1042. FIG. [Figure 24] FIG. 13 is a diagram showing an example of a search result table by a similarity search unit 1042. [Diagram 25] 10 is a diagram showing an example of a search result correspondence table by a similarity search unit 1042. FIG. [Figure 26] FIG. 13 is a diagram showing an example of a side effect matching table created by the similarity search unit 1042. [Figure 27] FIG. 13 is a diagram showing another example of a side effect matching table created by the similarity search unit 1042. [Figure 28] FIG. 10 is a diagram showing a side effect combination list by the mechanism element estimation unit 1044. [Figure 29] A diagram showing the structure of a model database. [Diagram 30] FIG. 13 shows a model database management table. [Diagram 31] FIG. 13 shows a monitor screen displayed by a model configuration unit 1045. [Diagram 32] FIG. 13 shows a monitor screen displayed by a model configuration unit 1045. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0012] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings. In each drawing, the same or corresponding parts are denoted by the same reference numerals. In the description of the embodiments, the description of the same or corresponding parts will be omitted or simplified as appropriate.

[0013] Embodiment 1 In this embodiment, the control program is described on the assumption that it is a program developed using ladder diagrams, which are graphical programming languages ​​that mimic electric circuits. Four other languages ​​have been standardized in IEC (International Electrotechnical Commission) 61131-3, and the subject of this embodiment is not limited to ladder diagrams.

[0014] An example of a control program created using a ladder diagram is shown in Figure 1. The language specifications of ladder diagrams are referred to in IEC 61131-3 and other documents, but the outline is as follows. -The horizontal lines in the program are connecting lines. The left side of the connecting line is a conditional statement, and the right side is an imperative statement. When the conditional statement is true, the imperative statement on that connecting line is executed. · Condition statements written in parallel by integrating connecting lines become an OR condition. In other words, if any one or more of the condition statements is true, the command statement is executed. · Condition statements written in series on a connecting line are AND conditions. In other words, if all the condition statements are true, the command statement is executed. Statements written in parallel by branching connecting lines will all be executed when the condition statement is met.

[0015] The created control program is executed by the controller. The control program is implemented to be executed within a predetermined time constraint, either periodically or event-driven. Typically, the control program is executed periodically, repeatedly at a set time called the basic processing cycle. According to the original concept of ladder diagrams, which are modeled after electric circuits, there is no order relationship between parallel connection lines, and the execution timing of the conditional statements and command statements of each connection line is parallel. However, in actual controllers, because a control program is executed using a finite number of processor cores, execution is often sequential, as if there was an order from the upper connection line to the lower connection line. The behavior of such sequential execution order may change the control results, and the behavior may differ depending on the manufacturer or model of the controller, but such differences in behavior are rarely taken into consideration in practice.

[0016] In model-based development, production equipment is described in SysML (Systems Modeling Language) or other abstract models at the design stage, and the model is used to automatically design mechanical or electrical equipment and automatically generate control programs, improving efficiency. Describing production equipment as a model also makes its modification and reuse development more efficient. SysML defines multiple types of models, but the following three types are effective for automatically generating control programs. These models are explained below with simple examples. Block Definition Diagram (BDD). Internal Block Diagram (IBD). State Machine Diagram (STM).

[0017] An example of a block definition diagram is shown in Figure 2. Figure 2 is a diagram showing the configuration relationship of the production equipment. Production Line A is shown to be composed of one transfer system 1 (Transfer 1), a press machine (Press), and a transfer system 2 (Transfer 2). Furthermore, the transfer system 1 is shown to be composed of three subsystems: a work detector (Work Detector), a conveyor 1 (Conveyor 1), and a turntable 1 (Turntable 1). The press machine and transfer system 2 are also composed of a hierarchical structure.

[0018] An example of an internal block diagram is shown in Figure 3. Figure 3 shows the internal configuration and connections of the transport system 1. The transport system 1 is composed mainly of a controller subsystem. Figure 3 shows that a detection sensor is connected, and the controller subsystem uses input information bDetect from the detection sensor for control.

[0019] An example of a state transition diagram is shown in Figure 4. Figure 4 is a diagram showing the state transitions of the operation of the conveyance system 1. The conveyance system 1 has three states: stopped state, conveyor transport in progress, and turntable rotating, and it is shown that when a workpiece is detected in the stopped state, the conveyor transits to the conveyor transport state.

[0020] ***Problem that the embodiment is trying to solve*** The problem that this embodiment aims to solve is to generate a control program model based on an existing control program, without assuming that design information of the production equipment is attached to the control program.

[0021] The problems that this embodiment is trying to solve can be broken down into the following two. (Sub-task 1) Detecting program fragments that are building blocks of a control program model from within a control program Large-scale control programs can range from thousands to tens of thousands of lines, and often contain a mixture of control processes for multiple subsystems. Control programs are implemented with a degree of freedom depending on the developer, so they are not necessarily organized into files or consecutive lines for each target subsystem. A model cannot be generated without organizing the control program into meaningful units. Therefore, the first challenge is to divide the control program into blocks, which are meaningful units corresponding to the subsystems.

[0022] (Subtask 2) Generating a control program model from program fragments A program fragment only represents the contents of the control process, and does not represent highly abstract block definitions or state transitions. For this reason, the second challenge is to generate a control program model from the program fragment. When generating a model, it is necessary to make it possible to derive a model based on the behavior of program fragments with different descriptions, taking into account that an infinite number of program fragments that behave the same can be described. Since there are an infinite number of possible descriptions of program fragments, differences are not limited to minor differences in the variable assignments and conditional statements used, but can also be at the syntax level, so the identity of behavior cannot be confirmed by simple matching comparison using wildcard searches and other searches.

[0023] ***Description of the configuration of the embodiment*** An embodiment of the present invention will be described. Note that the scope of the present disclosure is not limited by the contents described in the present embodiment. The production equipment controlled by the control program (hereinafter referred to as the controlled object) is a combination of mechanical mechanisms or electrical circuits (collectively referred to as mechanical elements). A portion (fragment) of a control program and the entire control program are collectively called a control program.

[0024] The program development support device 1 of this embodiment is used in a system configuration as shown in FIG. The program development support device 1 is connected to a controller 3 via a setting bus 2, and is a device for developing a program to be executed by the controller for controlling production equipment. The setting bus 2 is a serial bus, a wired network, or a wireless network. The setting bus 2 is used to write programs to the controller 3, and can be disconnected when not in use. The setting bus 2 may be replaced with a storage medium or other means that can be used to transfer programs. The controller 3 controls the production equipment. The nearby devices 4 and the remote devices 5 are various devices that input and output information to and from the controller 3, and perform operations based on commands from the controller 3. The nearby device 4 is installed near the controller 3 via the backplane bus. The remote device 5 is connected to the controller 3 via a control network 6 .

[0025] The program development support device 1 executes program development support software on an engineering workstation 9 having a configuration shown in Fig. 6. The engineering workstation 9 is a general-purpose computer. In the engineering workstation 9 , a CPU 91 , a memory 92 , a non-volatile memory 93 , and a setting port 94 are connected to a bus 95 . The engineering workstation 9 may be of any type, so long as it is provided with the resources necessary to execute the program development support software. The engineering workstation 9 may be a desktop computer, a notebook computer, a tablet computer, or a virtual computer running in the cloud. The engineering workstation 9 may be configured to increase the processing speed by using a multiprocessor, a multicore processor, or a parallel computing accelerator using a GPU (Graphics Processing Unit), or by using quantum or pseudo-quantum processing technology.

[0026] The configuration of the program development support device 1 realized by executing the above-mentioned program development support software is as shown in FIG.

[0027] The programming unit 101 provides a means for a developer to create or edit a control program, and is realized by a program editor or other editor. The programming unit 101 is based on the capability of programming in all or part of five languages ​​including the ladder diagram standardized by IEC61131-3. The programming unit 101 may be compatible with other languages ​​as long as the control program can be written in those languages. The program memory 103 is a storage area for temporarily storing the control program developed by the developer using the programming unit 101 during the creation and editing process, or for permanently storing the program after it has been created. The control program represents the entire series of programs that control the production equipment, and is generally stored, saved, and managed under the name of a project.

[0028] The program setting storage unit 105 permanently stores the program in the program memory 103. Alternatively, the program setting storage unit 105 provides the ability to write to the controller 3 via the setting port 94. The model extraction unit 104 is a means for analyzing the control program present in the program memory 103 and extracting a model. A model extraction unit 104 generates a block definition diagram, an internal block diagram, and a state transition diagram, which are models corresponding to the control program. The model extraction unit 104 is an element constituting the characteristic of this embodiment and is composed of a plurality of components, so details thereof will be described separately.

[0029] The display operation unit 102 is a means for providing the developer with the display and operation of the process and results relating to model extraction by means of a monitor, keyboard and mouse. The display operation unit 102 also serves as a registration unit for the program fragment database 1043 and the model database 1046 .

[0030] The internal configuration of the model extraction unit 104 is shown in FIG. The outline of the function of each part is as follows: The program analysis unit 1041 converts the control program P into a form in which side effects are extracted, in order to facilitate similarity search. The similarity search unit 1042 uses the output of the program analysis unit 1041 and the program fragment database 1043 to search the control program P for program fragments that have side effects equivalent to those of mechanism elements registered in the program fragment database 1043, and obtains a list of matching search results. Based on the list of search results, the mechanism element estimation unit 1044 estimates which combination of mechanism elements constitutes the control program P. Since the search results may include combinations of mechanism elements that cannot coexist in the control program, the mechanism element estimation unit 1044 eliminates combinations of mechanism elements that cannot coexist. The model configuration unit 1045 searches the model database 1046 for models corresponding to the mechanism elements estimated by the mechanism element estimation unit 1044, and estimates the connection relationships between them to estimate a model of the entire control program.

[0031] In the program analysis unit 1041, the similarity search unit 1042, the mechanism element estimation unit 1044, and the model configuration unit 1045, the "part" in each of them may be interpreted as a "process", a "procedure", or a "step". The program development support method is a method carried out by executing a program development support program. The program development support program causes a computer to execute each of the processes, procedures, or steps, where the "part" of each of the above parts is interpreted as a "process," "procedure," or "step." The program development support program may be provided as a program product or a computer-readable non-volatile recording medium having the program recorded thereon.

[0032] The functions of the program analysis unit 1041, the similarity search unit 1042, the mechanism element estimation unit 1044, and the model construction unit 1045 may be realized by one electronic circuit, or may be distributed and realized by multiple electronic circuits. Some of the functions of the program analysis unit 1041, the similarity search unit 1042, the mechanism element estimation unit 1044, and the model configuration unit 1045 may be realized by electronic circuits, and the remaining functions may be realized by software. Some or all of the functions of the program analysis unit 1041, the similarity search unit 1042, the mechanism element estimation unit 1044, and the model configuration unit 1045 may be realized by firmware. The processor 901 and each of the electronic circuits are also referred to as processing circuitry. The functions of the program analysis unit 1041, the similarity search unit 1042, the mechanism element estimation unit 1044, and the model configuration unit 1045 are realized by a processing circuitry.

[0033] The program fragment database 1043 and the model database 1046 are stored in the non-volatile memory 93 (or the memory 92). Moreover, the various lists, tables, and graphs described below are stored in the memory 92 (or the non-volatile memory 93) in list format, table format, or file format.

[0034] ● Similar search ● Although there may be minor differences depending on the object to be controlled, there are standards for mechanism elements, and mechanism elements can be categorized. For this reason, it is expected that control programs for controlling mechanism elements of the same type will have similar control content. For this reason, a program fragment database 1043 is provided that records fragments of control programs (program fragments F) that control standard mechanism elements. If the control program contains a fragment similar to a program fragment F registered in the program fragment database 1043, the program fragment F is searched for as a similar program fragment. When searching, in order to perform a similarity search that absorbs differences in the implementation of the control program due to developers or differences due to production equipment, a program analysis unit 1041 and a similarity search unit 1042 are provided and a similarity search is performed based on the "side effects" caused by the program fragment F.

[0035] ●Side effects and order constraints● A side effect is a term used in the field of programming, and refers to the effect of a program changing variables inside or outside the program. Specifically, a side effect refers to a change in the value of a variable or a change in the value of a port number. Here, even if the control programs are completely different at the syntax level, if the changes in variables as a result of execution are the same, the side effects are considered to match. Since different developers use different variable names and different port numbers, the side effects are considered to match if only the correspondence between variables and ports is the same.

[0036] The similarity search unit 1042 searches for a fragment similar to the search target program fragment F in the control program to be searched from the following viewpoints. (1) Identity of multiple side effects: whether the control program contains multiple side effects that are the same as those of the program fragment F. (2) Identity of order constraints of multiple side effects: Whether the control program contains multiple side effects with the same order constraints as multiple side effects of program fragment F.

[0037] The similarity search unit 1042 searches for program fragments by allowing the following differences in the control program as long as the order constraints are satisfied. -Changing the processing order of the control program. Substitution of instructions used by the control program, even if the same side effect occurs with a different instruction. - Processing unrelated to side effects may be inserted into the control program.

[0038] Side effects are structured and defined as data that represents the change in the value of a variable or output port before and after execution of the basic processing cycle of a control program. Side effects are not limited to those with definite results, such as changing data X from 0 to 1. For this reason, a data structure is adopted that can define side effects in which the way data changes depends on conditions, or side effects in which the change is expressed by an equation rather than a constant. The reason for extracting information on the order constraints of multiple side effects in addition to side effects is to distinguish whether the execution result in one basic processing cycle is completely preserved or different. Some control programs may achieve their side effects through multiple basic processing cycles.

[0039] Specifically, a control program may be programmed to manipulate only internal variables in the first basic processing cycle, and to output the result to an external variable in the second basic processing cycle when the condition for the internal variable is met, in a processing content that can be programmed to produce a side effect in only one basic processing cycle. More specifically, in the case of a control program in which a side effect on variable A occurs first, and then a side effect on variable B occurs in response to a change in the value of variable A, if the side effect on variable A occurs first, then as a result of one basic processing cycle, side effects on both variables A and B will occur.

[0040] On the other hand, in the case of a control program in which the order of side effects is reversed, so that a side effect on variable B occurs first in response to a change in the value of variable A, and then a side effect on variable A occurs, only the side effect on variable A occurs in the first basic processing cycle, and the side effect on variable B occurs in the second basic processing cycle. In the latter case, the same result as in the former case, achieved through one basic processing cycle, is achieved through two basic processing cycles. In such cases, the time required for processing differs between the former and latter cases. However, since the time of a basic processing cycle is generally small, measured in milliseconds, and data input and output for control programs may occur at periods longer than the basic processing cycle, the results are often equivalent in production equipment control even if the time required for processing differs. In this way, there is room to allow for differences even in program fragments that achieve the same side effects despite requiring different numbers of basic processing cycles.

[0041] ●Model configuration● A model database 1046 stores a plurality of models in association with a plurality of program fragments F, and a model construction unit 1045 extracts models from the model database 1046. Furthermore, the model construction unit 1045 analyzes the connection relationships between the plurality of models extracted from the control program, and constructs a model of the control program as a whole. The results obtained by the model configuration unit 1045 are displayed to the user by the display operation unit 102. In addition, by storing the model in the memory unit by the program setting storage unit 105, it is possible to reuse the model in the development of other control programs. Note that, if a model cannot be uniquely identified in the model extraction process, it may be possible to identify the model from multiple options via the display operation unit 102.

[0042] ***Explanation of the operation of the model extraction unit 104*** The following describes each part of the model extraction unit 104. In the following, the subject of the operation of each part is basically the subject of the explanation of each paragraph.

[0043] ●Program Fragment Database 1043● The program fragment database 1043 stores a plurality of program fragments F corresponding to a plurality of Joseki mechanism elements. The program fragment database 1043 stores a plurality of program fragments F in association with a plurality of mechanism element identifiers (mechanism element serial numbers) listed in the mechanism element side effect table. The program fragment database 1043 stores a side effect list for each mechanism element (hereinafter referred to as a fragment side effect list) and a side effect dependency graph for each mechanism element (hereinafter referred to as a fragment side effect dependency graph) in association with the mechanism element according to the mechanism element side effect table shown in FIG.

[0044] As shown in FIG. 10, the program fragment database 1043 stores a program fragment F, a fragment side-effect list, and a fragment side-effect dependency graph for each mechanism element. Many types of program fragments F for standard mechanical elements are widely published in reference books on control programs for developers, and a method of predefining the program fragment database 1043 based on these can be considered. In addition, when developing production equipment that handles uncommon mechanical elements, it is also possible for the developer to manually register the program fragment F in the program fragment database 1043. The fragment side-effect list and the fragment side-effect dependency graph can be created by inputting a program fragment F instead of the control program P to a program analysis unit 1041 described below.

[0045] ●Program Analysis Unit 1041● The program analysis unit 1041 receives the control program P as an input and generates side effect order constraint information of the control program P (a normalized fragmented side effect list of the control program P and a program side effect dependency graph of the control program P, which will be described later). An example will be described separately. The flow of operations of the program analysis unit 1041 is shown in FIG. It is assumed that the control program P to be analyzed by the program analysis unit 1041 has been previously loaded into the program memory 103. It is assumed that the program memory 103 stores a program list (the program list shown in FIG. 12) in which the control program P in FIG. 1 has been converted into text.

[0046] ● Step S1: Normalization and abstraction of the control program P As a preprocessing step, the program analysis unit 1041 normalizes the control program P into a program sequence that can be handled as a character string and whose description is restricted according to certain rules, and also performs abstraction by replacing the variables and port numbers in the control program with implementation-independent algebra. The algebra is a variable that replaces the variable implemented in the control program P. The result of these processes is called the program after normalization and abstraction.

[0047] The conversion rules for normalization may be freely set as long as they suppress fluctuations in program description. An example is as follows. - Organize conditions so that one condition statement does not contain multiple conditions. Specifically, organize multiple AND conditions into condition statements that are combined in multiple hierarchies. Also, divide multiple OR conditions into multiple parallel condition statements. If the same condition involves multiple side effects, separate it into one statement for each variable or output port. ·A variable or output port is replaced with a temporary variable that has the same type as the original type. Type is a general term in programming that describes the meaning of data. Specifically, there are types such as 1-bit data, 16-bit unsigned discrete value, or 32-bit signed floating point number. -Fixed values ​​(magic numbers) should be made into unique variables that represent fixed values.

[0048] An example of abstraction is as follows: Hereinafter, variables and port numbers will be collectively referred to as variables. The program analysis unit 1041 replaces each of a plurality of variables used in the control program P with a plurality of algebras, and creates a variable abstraction table indicating the correspondence of the replacements. An example of a variable abstraction table is shown in FIG. In the column "Variable name of control program P", multiple variables that appear in the control program are listed in the order of appearance without duplication. There is no particular restriction on the order in which they are listed in the variable abstraction table. The "Type" column lists the type of the listed variables. The type is determined for each variable at the programming stage. The types include the following, including those given in the examples. bit: 1 bit of data. intN: signed N-bit integer, where N is commonly 8, 16, 32, or 64. uintN: an unsigned N-bit integer, where N is commonly 8, 16, 32, or 64. · Timer: A 1-bit data that becomes 1 when the set time has elapsed and becomes 0 otherwise. The "variable name after abstraction" is the algebraic name for the variables that appear in the control program P, and it should be assigned without duplication. Here, an algebraic name is used that combines an alphabetic prefix determined by the type and a numeric suffix that indicates the order in which the variables of each type appear. Here, the prefix m is used for the bit type, t for the timer type, and sl for the signed 16-bit integer type.

[0049] An example of a program after normalization and abstraction is shown in Figure 14. A variable abstraction table is used to convert variables into algebraic expressions in the program listing. Also, commands such as RESET and ADD are replaced with numerical assignment statements. As a result of the above, the normalized and abstracted program shown in Figure 14 is obtained.

[0050] ● Step S2: Extraction of side effect target algebra In order to organize the changes in the values ​​of variables that are side effects, the program analysis unit 1041 extracts a side effect target algebra that lists algebras that are subject to change from the normalized and abstracted program. In other words, the side effect target algebra is an algebra that corresponds to variables that are rewritten by the execution of the control program P, and does not include variables that are only referenced and not changed by the execution of the control program P. However, if a variable is subject to rewriting even under rare conditions, it is included in the side effect target algebra. An example of extracting a side effect target algebra is shown in Figure 15. The side effect target algebra table is an extract of all variables that are assigned values ​​in the statements of the program after normalization and abstraction. Variables that are only referenced are not included in the side effect target algebra table.

[0051] ● Step S3: Extraction of side effects The program analysis unit 1041 lists the side effects of one basic processing cycle, that is, the change results for each condition, for the side effect target algebra shown in FIG. The program analysis unit 1041 describes the side effects for each condition for each side effect target algebra so that they are complete. In other words, the program after normalization and abstraction describes the processing flow as the control program P, whereas in step 3, the change results organized for each side effect target algebra are described. Regarding side effects, the conditions for a side effect or the output value of a side effect may not be fixed in the control program, but may depend on the results of other side effects. In such cases, the side effects necessary to obtain the conditions or output values ​​are also extracted. On the other hand, side effects on variables that do not affect the side effect on the side effect target algebra do not need to be extracted as side effects.

[0052] An example of extracted side effects is shown in Figure 16. The program side effect list in Figure 16 is a compilation of value changes that occur in multiple side effect target algebras. For ease of understanding, the column "Corresponding line number of program after normalization and abstraction" lists the line number of control program P where the side effect is described (the line number in the program list). The program side effects list includes: Serial number: A serial number assigned to a program side effect. An identifier for the program side effect. Variable: A variable whose value changes due to program side effects. program side effects: program side effects of the control program P. Line number of the program after normalization and abstraction: The line number of the program listing where the side effects of the control program P are described.

[0053] ● Step S4: Extract side effect dependencies of side effects The program analysis unit 1041 organizes the multiple program side effects extracted from the program side effect list into serial order if the order dependency relationship must be maintained in order to obtain equivalent side effects, and into parallel order if it is not. The multiple program side effects with the order dependency relationships organized can be expressed, for example, in a directed graph structure.

[0054] Figure 17 shows a tabular representation of the ordering dependencies between multiple program side effects. The program side-effect dependency table shown in Figure 17 indicates which algebras are referenced by side effects for side-effect target algebras. Specifically, the side effect for t1 references m1 and sl1. The program side-effect dependency graph in Figure 18 shows these dependencies in a directed graph. The program side-effect dependency graph uses the side-effect target algebras shown in Figure 17 as nodes and indicates their dependencies with arrows, and algebras that are not side-effect targets (m4, m5, sl1, sl3, sl5) are excluded from the graph. The program side-effect dependency graph is order constraint information that represents order constraint relationships of side effects for ensuring equivalence of the side effects of a control program P (hereinafter, referred to as program order constraint information).

[0055] ● Step S5: Normalize side effects The program analysis unit 1041 normalizes the side effects after the dependency extraction in accordance with separately defined normalization rules so that synonymous conditions are expressed in a unified manner and so that synonymous side effects are expressed in a unified manner. An example of the normalization rules is shown below. Inequalities are expressed only with less than "<" or less than or equal to "≦", and inequalities involving only integers are expressed only with less than "<". For example, an inequality using only integers, 2≧X, is expressed as X<3. Furthermore, an inequality using floating-point numbers, 3.6≧X, is replaced with X≦3.6. Identities and precomputable expressions are replaced by the results of the expressions, and conditional statements are omitted. Specifically, replace the first expression below with the second expression. 1st formula: if(2>1)then(X=0)else(NOP) 2nd formula: X=0 · Replace commands that output values, such as OUT, RESET, and SET, with assignment statements. Specifically, RESET X is a command that sets X to 0, so replace it with X=0, which assigns 0 to X. -Replace conditional statements using the inequality sign "!=" with conditional statements using the equality sign. Specifically, replace the first formula below with the second formula. First formula: if(X!=1) then(Y=1) else(Z=1) Second formula: if(X==1) then(Z=1) else(Y=1)

[0056] The above normalization rules are merely examples, and other normalization rules may be used as long as synonymous conditions and synonymous side effects are expressed in a unified manner. An example of side effects after normalization is shown in Figure 19. In the normalized program side effect list shown in Figure 19, as a result of normalizing the program side effects in the program side effect list, the condition statement for t2 has been replaced without an inequality sign. Also, the direction of the inequality sign in the condition statement for sl4 has been swapped.

[0057] The information obtained by the program analysis unit 1041 as described above is summarized in FIG. The program analysis unit 1041 creates one normalized / abstracted program and one normalized program side effect table for one control program P. One normalized program side effect table refers to one normalized program side effect list and one program side effect dependency graph.

[0058] The normalized fragmented side-effect list of the control program P and the program side-effect dependency graph of the control program P are collectively referred to as program side-effect order constraint information.

[0059] ● List of fragment side effects and fragment side effect dependency graph for program fragment database 1043 The fragment side-effect list and the fragment side-effect dependency graph registered in the program fragment database 1043 can be created by the program analysis unit 1041 analyzing the program fragment F instead of the control program P. Specifically, the program analysis unit 1041 creates the following from the program fragment F: A program listing of program fragment F in text form. A variable abstraction table for program fragment F. The program fragment F after normalization and abstraction. An algebraic table of side-effect targets for program fragment F. A list of fragment side effects of program fragment F. A fragment side-effect dependency table for the fragment side-effects of program fragment F. A fragment side-effect dependency graph of a program fragment F. A list of normalized fragment side-effects for program fragment F.

[0060] The description formats of the tables, lists, and graphs of these program fragments F are the same as those of the tables, lists, and graphs of the control program P. Specifically, the description formats of the fragment side-effect lists and program side-effect lists are the same. Also, the description formats of the fragment side-effect dependency graphs and program side-effect dependency graphs are the same. The normalized fragment side-effect list of the program fragment F and the fragment side-effect dependency graph of the program fragment F are collectively referred to as fragment side-effect order constraint information. The program analysis unit 1041 creates a plurality of fragment side-effect order constraint information from a plurality of program fragments F.

[0061] ● Similarity search section 1042 ● The similarity search unit 1042 searches whether the control program P in the program memory 103 contains a similar program fragment having the same side effect as the program fragment F in the program fragment database 1043 .

[0062] The similarity search unit 1042 receives as input a control program P to be searched that has been created by a developer, and a program fragment F to be searched that is registered in a program fragment database 1043 . The similarity search unit 1042 performs a similarity search using the program side effect order constraint information (the normalized program side effect list and the program order constraint information) regarding side effects obtained by the program analysis unit 1041 and the fragment side effect order constraint information (the normalized fragment side effect list and the fragment side effect dependency graph of the program fragment F). The flow of operations of the similarity search unit 1042 is shown in FIG.

[0063] ● Step S11: Reading search options The similarity search unit 1042 reads from the memory 92 a search option that defines the looseness of the matching conditions in the search. The reason for using the search option is that when the control program P to be searched is created using complex control logic and a similarity search does not sufficiently determine a match, it is assumed that the range in which the similarity search unit 1042 will determine a match will be expanded. The search options may be set in the memory 92 by the developer using the display operation unit 102 of the program development support device, or the similarity search unit 1042 may change the option settings in the memory 92 depending on the search results. Specifically, if the number of matching search results is too high as a result of the search, the search options may be set to make the matching conditions stricter, and conversely, if the number of search results is too low, the opposite setting may be used.

[0064] The possible search options are: · Search option 1: Whether to require an exact match of side effect ordering constraints. If the control program P to be searched contains all the side effects of the program fragment F to be searched but does not satisfy the order constraints, the side effects may not be chained in one basic processing cycle, and the same side effects may be obtained after multiple basic processing cycles are executed. In other words, by searching for partial matches of the order constraints of the side effects, it may be possible to search for many similar program fragments that obtain the same side effects. Here, it is assumed that search option 1 is set to require a perfect match of the order constraints of the side effects. · Search option 2: Whether to allow differences in algebraic types. In control program P, the same operation can be performed using variables with a wider range of values. Specifically, an operation using a 16-bit integer type can also be performed using a 32-bit integer type. By allowing differences in types for variables with a wider range of values, it may be possible to search for many similar program fragments that achieve the same side effects. Here, it is assumed that search option 2 is set to not allow differences in algebraic types.

[0065] ● Step S12: Search for program side effects using fragment side effects The similarity search unit 1042 checks whether there is a match among all of the normalized fragment side effects for each of the program fragments F listed in the fragment side effect list of the program fragment database 1043. When all of the multiple normalized fragment side effects in the fragment side effect list are included in the program side effect list, the similarity search unit 1042 determines that the program fragment F corresponding to the fragment side effect list is a similar program fragment. In other words, the similarity search unit 1042 checks whether or not the control program P satisfies all of the side effects of each mechanism element registered in the program fragment database 1043. If all of the side effects are satisfied, it is determined that the mechanism element is included in the control program P. If any side effects are not satisfied, it is determined that the mechanism element is not included in the control program P.

[0066] In step S12, only the presence or absence of matching side effects is considered, and whether the multiple matching side effects are consistent with each other is not taken into consideration. Whether the multiple matching side effects are consistent with each other is determined by the mechanism element estimation unit 1044.

[0067] The criteria for determining whether a side effect is acceptable are as follows: (a) The structure and conditions of the side effects are the same, and (b) the side effects are the same; and (c) The algebra involved in side effects is consistent.

[0068] An example of a match determination is shown in FIG. Assume that the fragment side effects (search target side effects) after normalization for a program fragment F are (1) and the program side effects (search target side effects) are (2) to (5).

[0069] Although (2) has a different algebra from (1), swapping m1 and m4, and m3 and m5 in (2) results in the same conditional branch structure and condition as (1), so (a) above is satisfied. Swapping sl1 and sl2 produces the same side effect, sl2+=1, so the result of the side effect is the same, and (b) above is satisfied. sl1 in (1) and sl2 in (3) have the same type, there is no algebraic inconsistency, and so (c) above is satisfied. Based on these results, it is determined that (2) matches (1).

[0070] In (3), the order of the branch statements is different from that in (1), but if m1 and m5, and m3 and m4 are swapped, the conditional branch structure and conditions will be the same as those in (1), so (a) above is satisfied. The same side effect sl2+=1 occurs, so the result of the side effect is the same, and (b) above is satisfied. sl2 in (1) and sl2 in (3) have the same type, there is no algebraic inconsistency, and (c) above is satisfied. As a result of these findings, it is determined that (3) matches (1).

[0071] In (4), no matter how the variables are rearranged, the side-effect algebra sl2 has a different type from the algebra m4 in (1), resulting in a contradiction in algebras. This contradicts (c) above, and (4) is therefore judged to be inconsistent with (1).

[0072] In (5), the result of the side effect on sl1 (sl1=0) differs from the result of the side effect on sl2 in (1) (sl2+=1), so this contradicts (b) above and (5) is judged to be inconsistent with (1).

[0073] Next, the similarity search unit 1042 determines whether the order dependency of the fragment side effect satisfies the order dependency of the program side effect for a program fragment F whose fragment side effects all match the program side effect. Specifically, it compares the program order constraint information (program order dependency graph) with the fragment order constraint information (fragment order dependency graph) to check whether the dependency of the side effect target algebra matches. If the dependency of the side effect target algebra matches, the similarity search unit 1042 determines that there is equivalence between the program side effect and the fragment side effect.

[0074] ● Step S13: There is a fragment side effect that matches the program side effect. If the similarity search unit 1042 determines that all of the multiple normalized fragment side effects in the fragment side effect list are included in the program side effects in the program side effect list, and that there is at least one fragment side effect list with matching side effect dependencies, it transitions to step S14. Otherwise, it transitions to step S16. That is, if it determines that there is at least one similar program fragment, it transitions to step S14, and if not, it transitions to step S16.

[0075] ● Step S14: Record the results The similarity search unit 1042 records in the search result table whether or not there is a match for the program fragment F (mechanism element) corresponding to the fragment side-effect list. The similarity search unit 1042 estimates that a program fragment F (mechanism element) corresponding to a fragment side effect list in which all of the multiple normalized fragment side effects in the fragment side effect list are included in the program side effects and in which the side effect dependencies match is a similar program fragment included in the control program P. The similarity search unit 1042 records the correspondence between the similar program fragments F (mechanism elements) and lines of the normalized and abstracted programs in a search result correspondence table. The relationship between the search result table and the search result correspondence table is as shown in FIG. 23, and the search result table is referenced from the search result table.

[0076] An example of a search result table is shown in FIG. Each row in the search result table corresponds to a mechanism element described in the mechanism element side effect table registered in the program fragment database 1043. The result column indicates whether or not the program fragment F of the mechanism element is included in the control program P. If the result is "Yes," a search result correspondence table ID for identifying the corresponding search result correspondence table is recorded.

[0077] An example of the search result correspondence table is shown in FIG. Each row in the search result correspondence table corresponds to a side effect of the program fragment F of the mechanism element in the program fragment database 1043. The "serial number of the program after normalization and abstraction" field lists one or more line numbers that are determined to match the corresponding side effect in the control program P (the program after normalization and abstraction).

[0078] ● Step S15: Check the consistency of side effects for each mechanism element If there are multiple corresponding lines in the normalized and abstracted control program P for one side effect in the search result correspondence table, the similarity search unit 1042 creates a side effect consistency table to check which combination of lines can realize the mechanism element in question. An example of a side effect consistency table is shown in FIG. A side effect consistency table is created for each mechanism element that is determined to be included in the control program P. Each row of the side effect matching table corresponds to a side effect of the program fragment F of the mechanism element in question in the program fragment database 1043 . The similarity search unit 1042 creates one or more sets of line numbers (line number sets) in which a plurality of fragment side effects of the program fragment F correspond one-to-one to each of the one or more line numbers in the program list. As shown in the search result correspondence table, there are eight possible pairs of line numbers in the normalized and abstracted program that realize each side effect. Each column in the side effect consistency table lists all eight of these pairs.

[0079] Of the eight combinations, those that have overlapping line numbers in the normalized and abstracted programs indicate that the processing for realizing the corresponding side effect is not included in the control program, and are therefore marked as inconsistent with "NO." Furthermore, if the line numbers of the normalized and abstracted programs corresponding to the side effects of the program fragment F of the mechanism element are not in ascending order, the side effects of the control program P may not be realized in the order of the side effects of the program fragment F, so enter "?". Finally, if there are no duplicate line numbers in the normalized / abstracted program and the line numbers in the normalized / abstracted program are in ascending order, enter "OK." The similarity search unit 1042 determines that there is a consistent line number pair when all of the fragment side effects in the line number pair correspond to program side effects obtained from different lines in the program list of the control program. In other words, the similarity search unit 1042 determines that a line number pair is consistent if all of the line numbers in the line number pair are different. The similarity search unit 1042 determines that a program fragment F corresponding to a fragment side effect list having one or more consistent line number pairs is a similar program fragment.

[0080] In step S15, in accordance with the search option settings, "OK" is marked to pairs whose side effect order constraints match perfectly, and "?" is marked to pairs whose side effect order constraints do not match perfectly. The similarity search unit 1042 obtains the following table and ends the process. Search result table Search result correspondence table Side-effect consistency table by line number of the program after normalization and abstraction

[0081] ● Step S16: No match If it is determined that the search results are not a match, the process of the similarity search unit 1042 ends. If it is determined that there is not a match, the search options are changed to loosen the matching conditions, and then this procedure is carried out again. Alternatively, if there is no room for further relaxation of the search options, it is determined that there are no modelable fragments in the control program. Examples of changing search options are as follows: (1) Relaxation of search option 1 The similarity search unit 1042 searches assuming that a perfect match of the order constraint of the side effects is not required. That is, the similarity search unit 1042 searches for a partial match of the order constraint of the side effects. If it is determined that there is no match with the partial match, the similarity search unit 1042 further relaxes search option 1 and searches ignoring the order constraint of the side effects.

[0082] (2) Relaxation of search option 2 The similarity search unit 1042 performs a search while allowing differences in algebraic types. When checking the side effect matching criteria (c), the similarity search unit 1042 determines that there is no contradiction in the algebra related to the side effect even if the types do not match and there is a difference in type that has upward compatibility. Specifically, it determines that the algebra of a 16-bit integer type can also be the algebra of a 32-bit integer type.

[0083] ●Mechanism element estimation section 1044● Based on the side effect consistency table obtained by searching for one control program P (search target), the mechanism element estimation unit 1044 estimates which combination of mechanism elements the control program P controls from among multiple possible combinations of mechanism elements.

[0084] Here is an example. (1) When two mechanism elements are included Assume that a search result table containing two mechanism elements is obtained as a result of a search for one control program P (search target) by the similarity search unit 1042. The side effect consistency table obtained for the first mechanism element is shown in Fig. 26, and the side effect consistency table obtained for the second mechanism element is shown in Fig. 27. In this case, if both of the two mechanism elements correspond to rows of the control program P after normalization and abstraction that do not have overlaps, the two mechanism elements are compatible.

[0085] If the search options are set to require an exact match of the order constraints of the side effects, pairs whose side effect consistency table judgements are "NO" and "?" are excluded, and using pairs whose side effect consistency table judgements are "OK", all combinations are generated by extracting one column from each of the two side effect consistency tables, and all combinations with no duplicate row numbers are extracted. A combination is expressed as {first column of the side effect consistency table, second column of the side effect consistency table}. A list of these combinations is called a side effect combination list. If we only look at combinations that are judged to be "OK", and extract all combinations with no duplicates, we get the following list of side effect combinations. {tuple 1, tuple 1}, {tuple 1, tuple 2}, {tuple 1, tuple 3}, {tuple 1, tuple 4}, {tuple 2, tuple 2}, {tuple 2, tuple 4}. {tuple 2, tuple 1} and {tuple 2, tuple 3} are incompatible because both mechanism elements require line 42 of the program after normalization and abstraction.

[0086] If the search options are set to not require an exact match of the order constraints of the side effects, then columns for which the result of the side effect consistency table is "NO" are excluded, all combinations are generated by taking one column from each of the two side effect consistency tables, and all combinations with no duplicate row numbers are extracted. When excluding combinations for which the answer is "NO," if all combinations with no overlaps are extracted, the side effect combination list shown in FIG. 28 is obtained. {tuple 1, tuple 1}, {tuple 1, tuple 2}, {tuple 1, tuple 3}, {tuple 1, tuple 4}, {tuple 2, tuple 2}, {tuple 2, tuple 4}, {tuple 3, tuple 1}, {tuple 3, tuple 2}, {tuple 3, tuple 3}, {tuple 3, tuple 4}, {tuple 4, tuple 2}, {tuple 4, tuple 4}, {tuple 7, tuple 1}, {tuple 7, tuple 2}, {tuple 7, tuple 3}, {tuple 7, tuple 4}, {tuple 8, pair 2}, {tuple 8, pair 4}. The following combination is incompatible because both mechanism elements require line 42 of the program after normalization and abstraction. {tuple 2, tuple 1}, {tuple 2, tuple 3}, {tuple 4, tuple 1}, {tuple 4, tuple 3}, {tuple 8, tuple 1}, {tuple 8, tuple 3}.

[0087] (2) When one mechanical element is included Assume that only one mechanism element is included as a result of a search for one control program P (search target) by the similarity search unit 1042. The side effect consistency table obtained for the first mechanism element is as shown in Fig. 26. A combination is represented by the notation {column of the first side effect consistency table}.

[0088] If the search options are set to require exact match of side effect ordering constraints, the side effect combination list is: {Group 1}, {Group 2}. If the search options are set to not require exact match of side effect ordering constraints, the side effect combination list is: {Group 1}, {Group 2}, {Group 3}, {Group 4}, {Group 7}, {Group 8}. In addition, even if the two mechanism elements (1) above are included, if all pairs in the side effect consistency table obtained for one of the mechanism elements are “NO”, it will be treated the same as the case where one mechanism element (2) is included, and a side effect combination list will be created using only the side effect consistency table obtained for the other mechanism element.

[0089] (3) When three or more mechanical elements are included Three or more mechanism elements may be included as a result of a search for one control program P (search target) by the similarity search unit 1042. As long as the three or more mechanism elements correspond to lines of the control program P after normalization and abstraction that do not have overlaps, the three or more mechanism elements are compatible. If the mechanism element 3 is found, the side effect combination list will be written as {first column of the side effect consistency table, second column of the side effect consistency table, third column of the side effect consistency table}.

[0090] Thus, the side effect combination list is a list in which one or more pairs of line numbers are described in each line. The mechanism elements corresponding to the combinations described in the side effect combination list are mechanism elements that can be realized simultaneously. The mechanism element estimation unit 1044 outputs a side effect combination list. By combining the search result table, the side effect combination list, and the program list of the normalized / abstracted program, all combinations of which mechanism elements may be realized by which lines in the program list of the normalized / abstracted program can be determined.

[0091] Note that it is not necessarily determined that all lines of a program after normalization and abstraction correspond comprehensively to mechanism elements, and there is a possibility that lines for controlling mechanism elements that are not registered in the program fragment database 1043, lines of peripheral processing for controlling mechanism elements, or lines of other processing will remain without being associated.

[0092] ●Model Database 1046● The model database 1046 registers models corresponding to the program fragment F registered in the program fragment database 1043 as mechanism element models. The model database 1046 has a structure shown in FIG. A model corresponding to a mechanism element identifier (mechanism element serial number) can be referenced from the model database management table in Fig. 30. In this embodiment, the model is assumed to be a block definition diagram, an internal block diagram, and a state transition diagram, but is not limited to these. The model database 1046 may be predefined like the program fragment database 1043, or may have a means for the developer to register, edit, and delete. In either case, the models to be registered must be generated manually by a person (the developer of the program development support device). However, since it is only necessary to consider models for multiple program fragments F in advance, the complexity of model generation is lower than generating a model from the entire large-scale control program. Also, since the contents of the model can be defined based on the behavior of the mechanism elements described in the aforementioned books, etc., model generation is possible.

[0093] ●Model configuration section 1045● The model configuration unit 1045 extracts a corresponding mechanism element model from the model database 1046 for each of the multiple combinations in the side effect combination list. The model configuration unit 1045 indicates the connection relationships between the interfaces of the mechanism element models, and then displays the information below on the monitor via the display operation unit 102. · Variables of the control program P corresponding to the interfaces of the mechanism element model · Output port names. Line number of the control program P corresponding to the mechanism element model.

[0094] Basically, the model configuration unit 1045 is expected to extract all mechanism elements that have results in the search result table, but it may happen that not all mechanism elements can be realized simultaneously due to the side effect combination list. In that case, the model configuration unit 1045 extracts mechanism element models by narrowing down only to mechanism elements that can be realized simultaneously and are listed in the combinations in the side effect combination list.

[0095] To extract a mechanism element model, the model configuration unit 1045 refers to the side effect matching table, the search result correspondence table, and the search result table from the side effect combination list, and identifies the mechanism element serial number. The model configuration unit 1045 uses the model database management table to extract various models corresponding to the mechanism element serial numbers. FIG. 31 shows an example of a monitor display in the case of {pair 1, pair 1}. The monitor displays a control program model of the state transition diagram, block definition diagram, and internal block diagram for the pusher mechanism type 2, combined with the state transition diagram, block definition diagram, and internal block diagram for the turntable mechanism type 2.

[0096] The connection relationships between multiple mechanism elements are specified using a block definition diagram and an internal block diagram. The mechanism element models in the model database 1046 are recorded in such a way that the algebra appearing in the side effects is associated with the input / output interfaces of the models. As a result, if the interfaces of the mechanism element models are connected, the mechanism element models are connected with wires to combine the connection relationships and displayed as a control program model. Depending on which combination in the side effect combination list is used for display, the connections of the mechanism elements or the model may change. The side effect combination list may include combinations that correctly represent the model of the actual production equipment, and combinations that do not. In order to select a model that is correctly represented, the display operation unit 102 provides a function for the developer to select a combination in the side effect combination list, and the model configuration unit 1045 configures the model according to the selection.

[0097] As shown in Figure 32, the model construction unit 1045 displays on the monitor at the display operation unit 102 fragments of the control program P that were not used in constructing the control program model as fragments not reflected in the control program model, in order to leave room for the developer to interpret them separately. The model configuration unit 1045 also displays on the monitor of the display operation unit 102 a message indicating that a portion that could not be identified due to a lack of information or inconsistency in the connection relationships between mechanism element models is an unknown fragment. The model configuration unit 1045 displays information that cannot be determined as blank in the control program model, and enables the user to input the information later on the display operation unit 102 .

[0098] As described above, in the first embodiment, standard control programs for each mechanism element are stored in a database as program fragments F, and program fragments similar to program fragments F are searched for in the control program P to detect program fragments F from the database. Similarity search is achieved by extracting the changes that control program P makes to external variables as a result of its execution as "side effects" and comparing their equivalence. The program fragment F and its mechanism element model are associated with each other and stored in a database. Based on the results of a similarity search, the corresponding mechanism element model is extracted and combined, thereby converting the control program P into a control program model. In this way, a control program model can be generated from the control program P.

[0099] *** Summary of the first embodiment *** The program development support device 1 includes a program analysis unit 1041 and a similarity search unit 1042 . The program fragment database 1043 registers, in association with the program fragments F, a plurality of fragment side-effect lists in which a plurality of side effects included in the program fragment F corresponding to the mechanism element are described as a plurality of fragment side-effects. The program fragment database 1043 registers order constraints of a plurality of fragment side effects included in a program fragment F corresponding to a mechanism element as a plurality of pieces of fragment order constraint information in association with the plurality of program fragments F.

[0100] The program analysis unit 1041 analyzes the control program and creates a program side-effect list in which a plurality of side effects included in the control program are described as a plurality of program side-effects. The program analysis unit 1041 creates order constraints for a plurality of program side effects as program order constraint information.

[0101] The similar search unit 1042 compares multiple program side effects listed in the program side effect list with multiple fragment side effects listed in multiple fragment side effect lists, and searches for a program fragment F corresponding to the fragment side effect list in which the multiple fragment side effects are included in the multiple program side effects, as a similar program fragment.

[0102] The similarity search unit 1042 compares the order constraints of the program order constraint information with the order constraints of multiple fragment order constraint information, and determines, as a similar program fragment, a program fragment F whose order constraints of the fragment order constraint information correspond to the fragment order constraint information included in the order constraints of the program order constraint information.

[0103] Based on the search option settings, the similarity search unit 1042 determines, among the searched program fragments F, those program fragments F whose order constraints in the fragment order constraint information do not completely match the order constraints in the program order constraint information as similar program fragments that obtain the same side effects after passing through multiple basic processing cycles.

[0104] The program analysis unit 1041 performs normalization to constrain the description of the program list of the control program and abstraction to replace variables in the program list of the control program with algebraic expressions. The program analysis unit 1041 normalizes the descriptions of multiple program side effects written in the program side effect list by expressing synonymous conditions in a unified description and expressing synonymous side effects in a unified description.

[0105] The similarity search section uses the following criteria for judgment: (a) The structure and conditions of the side effects are the same, and (b) the side effects are the same; and (c) The algebra related to side effects is consistent is used to determine whether a fragment side effect matches a program side effect.

[0106] The program fragment database 1043 registers variables used by each of the multiple program fragments F and variables referenced by the variables as multiple pieces of fragment order constraint information. The program analysis unit 1041 creates variables used by the control program and variables referenced by the variables as program order constraint information.

[0107] If the order constraints described in each of the multiple fragment order constraint information match the order constraints described in the program order constraint information, the similarity search unit 1042 determines that the program fragment F corresponding to the fragment order constraint information is a similar program fragment.

[0108] The program analysis unit 1041 detects, for each line in the program list of the control program, a variable whose value is changed by a side effect and one or more line numbers that change the value of the variable. The program analysis unit 1041 creates a list of variables, side effects, and one or more line numbers in correspondence with each other as a program side effect list. The similarity search unit 1042 creates one or more line number pairs in which a plurality of fragment side effects of the program fragment F correspond one-to-one to each of the one or more line numbers in the program list. If there is a line number pair among one or more line number pairs in which all of the fragment side effects correspond to program side effects obtained from different lines in the program list of the control program, the similarity search unit 1042 determines that there is one or more consistent line number pairs, and treats the program fragment F corresponding to the fragment side effect list as a similar program fragment.

[0109] The program development support device 1 includes a mechanism element estimation unit 1044 , a model database 1046 , and a model configuration unit 1045 .

[0110] When the similarity search unit 1042 searches for a plurality of similar program fragments, the mechanism element estimation unit 1044 determines whether different lines of the control program correspond to all of a plurality of fragment side effects contained in the plurality of similar program fragments. When different lines of the control program correspond to all of the fragment side effects, the mechanism element inference unit 1044 infers a combination of mechanism elements corresponding to the multiple similar program fragments as a consistent combination of mechanism elements.

[0111] The mechanism element estimation unit 1044 creates a side effect combination list by combining each of one or more consistent line number pairs of the multiple similar program fragments found by the similarity search unit 1042. When the lines listed in multiple line number pairs for each combination in the side effect combination list correspond to different lines in the control program, the mechanism element estimation unit 1044 estimates the combination of mechanism elements corresponding to multiple similar program fragments as a consistent combination of mechanism elements.

[0112] The model database 1046 stores a plurality of mechanism element models corresponding to the plurality of program fragments F, respectively. The model database 1046 includes, as mechanism element models, at least one of a block configuration diagram, an internal block diagram, and a state transition diagram.

[0113] The model configuration unit 1045 extracts from the model database 1046 a plurality of models corresponding to a plurality of program fragments F described in combinations of consistent mechanism elements, and configures a control program model of the control program by combining the plurality of models.

[0114] The program analysis unit 1041 creates a program side-effect list from the control program using the same process as that used to create a plurality of fragment side-effect lists from each of a plurality of program fragments.

[0115] The program analysis unit 1041 creates program order constraint information from the control program using the same process as that used to create a plurality of pieces of fragment order constraint information from each of a plurality of program fragments.

[0116] The program development support device is characterized by retrieving and displaying a program fragment F from a control program that will result in equivalent results for variables or ports after execution. The program development support device is characterized in that, using a control program as an input, it generates a control program model that abstractly represents an object to be controlled by the control program. The program development support device is characterized in that, in a similarity search, by setting an option, it is possible to search for fragments that have the same side effects as program fragment F but whose order constraints do not completely match, thereby searching for fragments that can obtain the same side effects from the control program through multiple basic processing cycles.

[0117] The program development support device includes the following: A program memory 103 for storing the control program. A program analysis unit 1041 that extracts side effects, which are changes in the values ​​of variables or ports after the control program is executed, from the control program, and extracts a list of program side effects after normalization and abstraction and program order constraint information that represents the order relationship of side effects to guarantee equivalence of side effects. A program fragment database 1043 in which a plurality of program fragments F, a plurality of side effect lists after normalization and abstraction, and a plurality of pieces of order constraint information are registered. A similarity search unit 1042 that compares the side effect list and order constraint information after normalization and abstraction of the control program with the side effect list and order constraint information after normalization and abstraction of the program fragment F. A mechanism element estimation unit 1044 that estimates elements of a mechanical mechanism or an electric circuit that is to be controlled by the control program. A model database 1046 that stores models corresponding to the program fragments stored in the program fragment database 1043. A model configuration unit 1045 that configures a control program model by acquiring, from a model database, a mechanism element model corresponding to a mechanical mechanism or an electric circuit controlled by the control program, and identifying the connection relationship between interfaces between the mechanism element models.

[0118] ***Explanation of the Effects of the First Embodiment*** According to this embodiment, a program fragment database 1043 storing standard program fragments F and a program analysis unit 1041 extracting side effects and their order constraints that represent the behavior of a control program P are used to perform a similarity search for the behavior of the program fragment F from the control program P. This makes it possible to identify the mechanism elements controlled by the control program P. In addition, by making it possible to select the degree of matching of the order constraints, it becomes possible to perform a similar search for control program fragments that require multiple basic processing cycles but have the same behavior, thereby enabling modeling of the control program.

[0119] According to this embodiment, a control program model used in model-based development can be derived based on a production equipment control program P. In this case, even if the control program P is not implemented based on common rules and has inconsistent syntax, etc., a control program model can be derived based on the behavior.

[0120] This embodiment makes it easy to implement model-based development that utilizes development assets of existing control programs P. If model-based development can be implemented, existing assets can be re-examined at a high level of abstraction, making it possible to reuse them in similar developments, reducing development man-hours and preventing the introduction of defects, thereby making control program development more efficient.

[0121] In addition, as a secondary effect of this embodiment, even when model-based development is not applied, the reuse development of the control program P can be made more efficient. As described above, when a third party other than the developer performs reuse development of the control program P, the third party does not fully understand the structure or design concept of the target control program P compared to the developer, so it is difficult to determine the parts that need to be changed and the impact of the changes. In contrast, if the control program P can be converted into a control program model, a top-down understanding of the structure and design concept is promoted, and reuse development can be made more efficient.

[0122] In addition, by using part of the functions of this embodiment, it is possible to find similar program fragments F (so-called code clones) in a control program. This makes it possible to create a library of processes that frequently appear in control programs, and also realizes a refactoring function.

[0123] ***Description of Other Configurations of the First Embodiment*** Variation 1: Program Order Constraint Information and Fragment Order Constraint Information As the program order constraint information, a program side effect dependency table may be used instead of the program side effect dependency graph. The program order constraint information may be expressed in any manner as long as the order constraint of the program side effects is known. As the fragment order constraint information, a fragment side-effect dependency table may be used instead of the fragment side-effect dependency graph. The fragment order constraint information may be expressed in any manner as long as the order constraints of the fragment side effects are known.

[0124] ●Variation 2: Program Fragment F As the program fragment F, a part of the control program P may be registered in the program fragment database 1043 . As the program fragment F, a fragment similar to the program fragment F of the control program P may be registered in the program fragment database 1043 . As the program fragment F, fragment side effect order constraint information obtained by analyzing the program fragment F by the program analysis unit 1041 may be saved.

[0125] Variation 3: Creating a fragment side-effect list and a fragment side-effect dependency graph The fragment side-effect list and the fragment side-effect dependency graph of the program fragment database 1043 do not have to be created by the program analysis unit 1041, but may be created by other means or manually. stomach. The fragment side-effect list and the fragment side-effect dependency graph may be a mixture of those created by the program analysis unit 1041, those created by other means, and those created manually.

[0126] Variation 4: Description format of fragment side-effect list and fragment side-effect dependency graph The description format of the tables, lists, and graphs of the program fragment F does not have to be the same as the description format of the tables, lists, and graphs of the control program P, as long as the two are in a description format that allows them to be compared by the similarity search unit 1042. Specifically, the fragment side-effect dependency table of the program fragment F may be compared with the program side-effect dependency graph of the control program.

[0127] Variation 5: The similarity search unit 1042 may search for a plurality of fragment side effects that do not all match the program side effect but mostly match the program side effect for the program fragment F. Since there may be cases where not all of the fragment side effects are essential side effects for the program fragment F, a search may be performed for a plurality of fragment side effects that match the program side effect. Specifically, the percentage of matches between multiple fragment side effects and program side effects can be set by option settings, such as 100% match, 90% match, or 80% match. [Explanation of symbols]

[0128] 1 program development support device, 2 setting bus, 3 controller, 4 adjacent device, 5 remote device, 6 control network, 9 engineering workstation, 91 CPU, 92 memory, 93 non-volatile memory, 94 setting port, 95 bus, 101 programming section, 102 display and operation section, 103 program memory, 104 model extraction section, 105 program setting storage section, 1041 program analysis section, 1042 similarity search section, 1043 program fragment database, 1044 mechanism element estimation section, 1045 model construction section, 1046 model database, F program fragment, P control program.

Claims

1. a program fragment database in which a plurality of fragment side effect lists, in which a plurality of side effects included in a program fragment corresponding to a mechanism element are described as a plurality of fragment side effects, are registered in correspondence with a plurality of program fragments; a program analysis unit that analyzes a control program and creates a program side-effect list in which a plurality of side effects included in the control program are described as a plurality of program side-effects; a similarity search unit that compares the plurality of program side effects described in the program side effect list with the plurality of fragment side effects described in the plurality of fragment side effect lists, and searches for a program fragment corresponding to the fragment side effect list in which the plurality of fragment side effects are included in the plurality of program side effects, as a similar program fragment; A program development support device comprising:

2. the program fragment database registers order constraints of the plurality of fragment side effects as a plurality of fragment order constraint information in association with the plurality of program fragments; the program analysis unit creates order constraints of the plurality of program side effects as program order constraint information; 2. The program development support device of claim 1, wherein the similarity search unit compares the order constraints of the program order constraint information with the order constraints of the multiple fragment order constraint information, and classifies program fragments whose order constraints of the fragment order constraint information correspond to the fragment order constraint information included in the order constraints of the program order constraint information as similar program fragments.

3. 3. The program development support device according to claim 2, wherein the similarity search unit, based on a search option setting, classifies program fragments whose order constraints of the fragment order constraint information do not completely match the order constraints of the program order constraint information as similar program fragments that produce the same side effects after passing through multiple basic processing cycles.

4. 2. The program development support device according to claim 1, further comprising a mechanism element estimation unit that, when the similarity search unit searches for a plurality of similar program fragments, estimates, as a consistent mechanism element combination, a combination of mechanism elements corresponding to a plurality of similar program fragments in which different lines of the control program correspond to all of the fragment side effects contained in the plurality of similar program fragments.

5. a model database storing a plurality of mechanism element models corresponding to the plurality of program fragments, a model construction unit that extracts from the model database a plurality of models corresponding to the plurality of program fragments described in the combination of the consistent mechanism elements, and combines the plurality of models to construct a control program model of the control program; 5. The program development support device according to claim 4, further comprising:

6. The program analysis unit performing normalization for constraining the description of a program list of the control program and abstraction for replacing variables of the program list of the control program with algebra; The program analysis unit A program development support device as described in any one of claims 1 to 5, which normalizes program side effects by expressing synonymous conditions in a unified description and expressing synonymous side effects in a unified description for descriptions of multiple program side effects listed in the program side effect list.

7. The similarity search unit uses the following as a judgment criterion: (a) The structure and conditions of the side effects are the same, and (b) the side effects are the same; and (c) The algebra related to side effects is consistent.

6. The program development support device according to claim 1, wherein the fragment side effect is determined to match the program side effect by using a function.

8. the program fragment database registers variables used by each of the plurality of program fragments and variables referenced by the variables as the plurality of fragment order constraint information; the program analysis unit creates variables used by the control program and variables referenced by the variables as the program order constraint information; 3. The program development support device of claim 2, wherein the similarity search unit determines that a program fragment corresponding to the fragment order constraint information is a similar program fragment when the order constraint described in each of the plurality of fragment order constraint information matches the order constraint described in the program order constraint information.

9. the program analysis unit detects, for each line of a program list of the control program, a variable whose value is changed by a side effect and one or more line numbers that change the value of the variable, and creates a list in which the variables, the side effects, and the one or more line numbers correspond to each other as the program side effect list; The program development support device of claim 4, wherein the similarity search unit creates one or more line number pairs in which the multiple fragment side effects of the program fragment correspond one-to-one to each of the line numbers of the one or more line numbers of the program list, and when there is a line number pair among the one or more line number pairs in which all of the multiple fragment side effects correspond to program side effects obtained from different lines in the program list of the control program, it determines that there are one or more consistent line number pairs, and sets the program fragment corresponding to the fragment side effect list as the similar program fragment.

10. 10. The program development support device according to claim 9, wherein the mechanism element estimation unit creates a side effect combination list by combining each of the one or more consistent line number pairs of a plurality of similar program fragments, and when lines described in the multiple line number pairs of each combination in the side effect combination list correspond to different lines of the control program, estimates a combination of mechanism elements corresponding to a plurality of similar program fragments as a combination of consistent mechanism elements.

11. 6. The program development support device according to claim 5, wherein the model database includes, as the mechanism element models, at least one of a block configuration diagram, an internal block diagram, and a state transition diagram.

12. registering a plurality of fragment side effect lists, each of which describes a plurality of side effects included in a program fragment corresponding to a mechanism element as a plurality of fragment side effects, in correspondence with the plurality of program fragments in a program fragment database; a program analysis unit that analyzes a control program and creates a program side-effect list in which a plurality of side effects included in the control program are described as a plurality of program side-effects; A program development support method in which a similarity search unit compares the multiple program side effects listed in the program side effect list with the multiple fragment side effects listed in the multiple fragment side effect lists, and searches for program fragments corresponding to the fragment side effect list in which the multiple fragment side effects are included in the multiple program side effects as similar program fragments.

13. a computer having a program fragment database for registering a plurality of fragment side effect lists, each of which describes a plurality of side effects included in a program fragment corresponding to a mechanism element as a plurality of fragment side effects, in correspondence with a plurality of program fragments; a program analysis process for analyzing a control program and creating a program side-effect list in which a plurality of side effects included in the control program are described as a plurality of program side-effects; a similarity search process for comparing the plurality of program side effects described in the program side effect list with the plurality of fragment side effects described in the plurality of fragment side effect lists, and searching for a program fragment corresponding to the fragment side effect list in which the plurality of fragment side effects are included in the plurality of program side effects as a similar program fragment; A program development support program to implement the above.

Citation Information

Patent Citations

  • Reverse engineering support device, reverse engineering support method and program thereof

    JP2012164148A

  • Information processor, information processing method and program

    JP2012256178A

  • Program creation method and device for control equipment

    JP2001306108A