WO2020178983A1 - プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム - Google Patents

プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム Download PDF

Info

Publication number
WO2020178983A1
WO2020178983A1 PCT/JP2019/008657 JP2019008657W WO2020178983A1 WO 2020178983 A1 WO2020178983 A1 WO 2020178983A1 JP 2019008657 W JP2019008657 W JP 2019008657W WO 2020178983 A1 WO2020178983 A1 WO 2020178983A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
component
circuit
common logic
common
Prior art date
Application number
PCT/JP2019/008657
Other languages
English (en)
French (fr)
Inventor
啓文 甲斐
浩平 藤田
瞬也 長谷川
Original Assignee
三菱電機株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 三菱電機株式会社 filed Critical 三菱電機株式会社
Priority to CN201980093411.0A priority Critical patent/CN113518947B/zh
Priority to JP2019552927A priority patent/JP6664563B1/ja
Priority to PCT/JP2019/008657 priority patent/WO2020178983A1/ja
Publication of WO2020178983A1 publication Critical patent/WO2020178983A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering

Definitions

  • the present invention relates to a program creation support device, a program creation support method, and a program creation support program that support the creation of a sequence program.
  • a programmable logic controller is a control device that operates according to a sequence program and controls controlled devices installed in factories and the like.
  • Ladder language is a major description language for sequence programs.
  • Ladder language is a programming language that is a graphical representation that imitates a relay circuit, and a program can be created by arranging circuit components that propagate control signals, such as contacts and coils, and specifying their connection relationship.
  • the control signal is assigned to the internal memory of the PLC, and this internal memory is called "device”.
  • a sequence program written in the ladder language is called a ladder program.
  • a device is expressed by combining symbols such as X and Y and numerical values, and signal propagation is expressed by allocating a device to each of a contact and a coil.
  • the definition of the program part that is, the definition of the input/output argument is automatically determined.
  • the present invention has been made in view of the above, and an object thereof is to obtain a program creation support device capable of improving the readability and maintainability of a sequence program.
  • the program creation support device extracts a common logic part from the entire circuit in the sequence program, and a circuit component included in the extracted common logic part.
  • a common determination unit that generates ancillary information indicating whether or not the device allocation for the circuit component at the same position matches in all the common logic portions is provided.
  • the program creation support device includes a program component generation unit that generates a program component based on the common logic part extracted by the common judgment unit and attached information, and a program component for each of the common logic parts in the sequence program. And a replacement part that replaces the circuit components connected to the input / output arguments of the program component.
  • the program component generation unit selects whether or not the user generates the input/output argument for the circuit component in which the device allocation to the circuit component at the same position in all the common logic parts in the attached information is the same. be able to.
  • the program creation support device has the effect of improving the readability and maintainability of the sequence program.
  • Diagram showing an example of the input / output argument generation specification screen for program components The figure which shows an example of the confirmation screen of the sequence program after the replacement process is executed.
  • a program creation support device, a program creation support method, and a program creation support program according to an embodiment of the present invention will be described below in detail with reference to the drawings.
  • the present invention is not limited to this embodiment.
  • -Common circuit pattern G A pattern of logic that commonly appears in the sequence programs.
  • Common logic portion H A portion (area) of the sequence program where the common circuit pattern G appears.
  • the program creation support device has at least the following two functions, and uses these functions to support the creation of a sequence program by the user.
  • the first function is to search for and display a common logic part H that can be made into a component from the entire circuit of the sequence program.
  • a ladder program which is a sequence program, is composed of instructions that correspond to contacts or coils and application instructions that correspond to numerical operations and the like. Therefore, the program creation support device has a common circuit pattern that is common only in the logic of a contact equivalent instruction that is an instruction equivalent to a contact, a coil equivalent instruction that is an instruction equivalent to a coil, and an application instruction equivalent to a numerical operation.
  • G and the program part are searched and displayed.
  • the retrieved common circuit pattern G is a candidate for a program component (macro, subroutine, etc.) that is a program component.
  • the second function when any of the common circuit patterns G retrieved by the first function is selected by the user, converts the selected common circuit pattern G into a program component (executes componentization) and registers it. It is a function. Further, the second function automatically replaces the sequence program into a component by replacing the common logic part H searched by the first function with an instance of the registered program component.
  • the program creation support device holds information as to whether or not the device allocations for each circuit component such as contacts and coils in the circuit match. deep. That is, in the extracted common circuit pattern G, whether or not the device allocations for the circuit components arranged at the same coordinates in all of the common logic portions H that are the origins of the common circuit patterns G are held as attached information.
  • the coordinates here indicate the positions in the circuit pattern of the circuit component. Therefore, the circuit components arranged at the same coordinates are the circuit components arranged at the same place in the common circuit pattern G.
  • the program creation support apparatus when the program component is generated by the above-mentioned second function, the program creation support apparatus, based on the attached information held when searching the common logic part H by the first function, Determine the argument of. Specifically, the program creation support apparatus allocates a device to this circuit part when there is a circuit part that is arranged at the same coordinate but does not have the same device allocation among the common logic parts H. Generate a program component with arguments.
  • FIG. 1 is a diagram showing an outline of a program part generation operation by the program creation support apparatus according to the embodiment.
  • the program creation support device extracts a common logic portion H from the sequence program.
  • the program creation support apparatus extracts the block in which the circuit blocks 2a to 4a are arranged as the common logic portion H.
  • the program creation support device sets a common circuit pattern G that can be made into a component, based on the logic of the circuit blocks 2a to 4a.
  • the program creation support device sets the logic common to the circuit blocks 2a to 4a in the common circuit pattern G.
  • the program creation support apparatus handles the circuit blocks 2a to 4a as the common circuit pattern G.
  • the program creation support apparatus confirms whether or not the device allocations for the circuit components of the same coordinates in the extracted circuit blocks 2a to 4a match, and indicates the information indicating the confirmation result (whether the device allocations match or not). Information to be shown) is retained.
  • the coordinates of the circuit component located at the upper left of the circuit blocks 2a to 4a are (0, 0)
  • the coordinates of the circuit component located to the right of this component are (1, 0)
  • the coordinates of the circuit component located on the right side are (2, 0).
  • the coordinates of the circuit component located directly below the circuit component located at the upper left are (0, 1)
  • the coordinates of the circuit component located to the right of this component are (1, 1)
  • the coordinates of the circuit components located to the right of The coordinates of the circuit component to be operated are (2, 1).
  • the method of determining the coordinates indicating the position of each circuit component is not limited to this. Further, it is not essential to indicate the arrangement of each circuit component by coordinates. If the arrangement of each circuit component in the circuit block is known, the arrangement of each circuit component may be indicated using information other than the coordinates.
  • the device allocations for the circuit components having the coordinates (0,0) and (1,1) do not match between the circuit blocks 2a to 4a, and the device allocations for the circuit components having other coordinates are performed.
  • the allocation is the same among the circuit blocks 2a to 4a. Therefore, in the program creation support apparatus, in phase (B), the device allocations for the circuit components with coordinates (0,0) and (1,1) do not match between the circuit blocks 2a to 4a, and the coordinates are By generating information indicating that the device allocations for the circuit components (1,0), (2,0), (0,1) and (2,1) are the same among the circuit blocks 2a to 4a. Hold.
  • circuit component whose device allocation is the same among all common logic portions H (circuit blocks 2a to 4a in FIG. 1) is referred to as a first circuit component, if necessary.
  • a circuit component that does not correspond to the first circuit component is referred to as a second circuit component.
  • the program creation support apparatus is a generation designation screen for input/output arguments of program parts based on the information generated and held in phase (B).
  • the screen 101 is displayed on the display device.
  • the program creation support device accepts the selection of the circuit component that generates the input / output argument from the user.
  • input / output arguments are always generated for circuit components whose device allocations do not match, that is, for second circuit components whose device allocations do not completely match between circuit blocks 2a to 4a. Therefore, on the screen 101 shown in FIG. 1, a display that allows the user to know that the input/output argument is always generated for the circuit component having the coordinates (0,0) and the circuit component having the coordinates (1,1) is displayed. The configuration is performed and the selection operation by the user is not accepted.
  • the program creation support device shifts to the phase (D) when the user's selection of the first circuit component that generates the input / output arguments is completed. That is, when the program creation support device receives an operation of ending the selection of the first circuit component that generates the input/output argument from the user, the program creation support device displays the screen 102, which is the image confirmation screen after the replacement with the program component, on the display device. Let me. In the screen 102 illustrated in FIG. 1, the sequence program before the replacement with the program component is displayed on the left side, and the sequence program after the replacement with the program component is displayed on the right side. Further, on the screen 102, the display contents are associated with the program parts and the circuit blocks so that it can be seen which circuit block has been replaced by the program part.
  • the display content on the right side of the screen 102 follows the operation content received from the user in phase (C).
  • a program component is displayed when the user selects the generation of an argument for the coil, which is a circuit component having coordinates (2,0).
  • the user After confirming the screen 102, the user presses the “OK (execute)” button at the lower right of the screen 102 when generating a program part and replacing a circuit block with a program part. Further, when the user reselects the circuit component for which the input / output argument is generated after confirming the screen 102, the user presses the "Cancel” button at the lower right of the screen 102. When the "Cancel” button is pressed, the program creation support device returns to the phase (C).
  • the program creation support apparatus moves to the phase (E) in FIG. 1 and generates a program component FB (Function Block). At this time, the program creation support apparatus creates a program component having the configuration shown on the right side of the screen 102 displayed on the display device in phase (D).
  • the program creation support apparatus shifts to the phase (F) of FIG. 1, and the circuit blocks 2a to 4a extracted in the phase (A) are changed to the program parts generated in the phase (E). To be circuit blocks 2b to 4b.
  • the program creation support device With such a procedure, the program creation support device generates a program component from the sequence program, and further replaces the circuit block of the sequence program that can be replaced with the generated program component with the program component. In addition, the program creation support device holds the generated program components so that they can be used when editing another sequence program, developing another sequence program, or the like.
  • FIG. 2 is a diagram showing a configuration of a program creation system including the program creation support apparatus according to the embodiment.
  • the program creation system 100 includes a program creation support device 1, a sequence program creation device 2, a sequence program editing device 3, and a display device 5.
  • the program creation support device 1, the sequence program creation device 2, the sequence program editing device 3, and the display device 5 will be described as individual devices, but each function of each of these devices will be described. May be realized by one device, for example, a computer system such as a personal computer.
  • the program creation support apparatus 1 extracts the common logic part H from the sequence program and creates the program parts according to the instruction from the user.
  • the sequence program creation device 2 is a device that creates a sequence program that operates in a PLC (Programmable Logic Controller) system, which is also called a sequencer.
  • the sequence program creation device 2 inputs the created sequence program to the program creation support device 1.
  • the sequence program editing device 3 is a device that edits the sequence program using the sequence program replaced by the program component in the program creation support device 1.
  • the display device 5 is a liquid crystal monitor or the like, and displays a sequence program, a common circuit pattern G, program parts, and the like according to an instruction from the program creation support device 1.
  • the program creation support apparatus 1 includes a program input unit 11, a program storage unit 12, a common determination unit 13, a search result storage unit 14, a search result display processing unit 15, an instruction input unit 16, and a program component registration unit. 17, a program component storage unit 18, a componentization processing unit 19, an output unit 20, a component definition display processing unit 21, and a componentization image display processing unit 22.
  • the program input unit 11 receives the sequence program input from the sequence program creating device 2, and sends the received sequence program to the program storage unit 12.
  • the program storage unit 12 is a memory or the like that stores a sequence program (program to be componentized) in which a common logic portion H is searched. Upon receiving the sequence program from the program input unit 11, the program storage unit 12 holds the received sequence program. When receiving a request from the sequence program editing device 3, the program storage unit 12 outputs the requested sequence program to the output unit 20. The sequence program output to the output unit 20 is transferred from the output unit 20 to the sequence program editing device 3. Further, the program storage unit 12 performs a process in which a circuit block used for generating a program component, out of the circuit blocks forming the held sequence program, is replaced with a program component by a componentization processing unit 19 described later. When a certain replacement process is performed, the sequence program after the replacement process is retained.
  • the common determination unit 13 reads the sequence program stored in the program storage unit 12 and determines whether or not there is a common logic part H in it. When there is a common logic portion H, the common determination unit 13 extracts the common logic in the common logic portion H as the common circuit pattern G. In other words, the common determination unit 13 extracts, as the common circuit pattern G, a logic pattern that commonly appears in the circuit patterns arranged in the common logic portion H.
  • the program creation support device 1 uses a known code clone detection method or the like when determining whether or not the logic portion H common to the sequence programs exists.
  • the code clone detection method is a method for finding similar code fragments from source code representing a program. Similar pieces of code that make up the source code are called code clones.
  • the common determination unit 13 confirms whether or not the device allocations for the circuit components arranged at the same coordinates in all the common logic portions H match, and as the information indicating the confirmation result, the auxiliary information of the common circuit pattern G. To generate.
  • the common determination unit 13 confirms whether or not the device allocations of all the circuit components included in the plurality of common logic portions H are the same in all the common logic portions H, and shows the confirmation result.
  • the attached information indicates a confirmation result for each of the plurality of circuit components included in the common logic portion H. For example, when the common logic portion H includes four circuit components #1 to #4, the attached information indicates whether or not the device allocation for the circuit component #1 is the same in all the common logic portions H.
  • the search result storage unit 14 is a memory or the like that stores the information of the common circuit pattern G extracted by the common determination unit 13 and the attached information as the search result. That is, when the common determination unit 13 extracts the common circuit pattern G, the search result storage unit 14 receives the information indicating the configuration of the extracted common circuit pattern G and the attached information, and retrieves each received information as a search result. Hold as.
  • information indicating the configuration of the common circuit pattern G will be referred to as configuration information.
  • the search result display processing unit 15 causes the display device 5 to display the search results stored in the search result storage unit 14 in a list format.
  • the search result display processing unit 15 outputs the configuration information and the auxiliary information of the selected common circuit pattern G to the common circuit pattern G. It is sent to the component definition display processing unit 21 as information.
  • the instruction input unit 16 receives an instruction input by the user, and outputs information indicating the content of the instruction to a part or all of the search result display processing unit 15, the component definition display processing unit 21, and the componentized image display processing unit 22. ..
  • the user's instruction is a search instruction that is a search instruction, a component specification instruction that is a componentization instruction, an argument generation necessity instruction and a componentization confirmation instruction, or an output instruction that is an output instruction.
  • the search instruction is an instruction for searching the common circuit pattern G from within the sequence program, and is sent from the instruction input unit 16 to the common determination unit 13.
  • the component designation instruction is an instruction to specify a common circuit pattern G to be made into a component from the search results, and is sent from the instruction input unit 16 to the search result display processing unit 15.
  • the argument generation necessity instruction is an instruction to specify the generation necessity of the input/output argument of the program component for the common circuit pattern G, and is transmitted from the instruction input unit 16 to the component definition display processing unit 21.
  • the componentization confirmation instruction is an instruction that specifies whether componentization is confirmed or canceled based on the confirmation result of the image after replacing some circuit blocks in the sequence program with program components.
  • the componentization confirmation instruction is sent from the instruction input unit 16 to the componentization image display processing unit 22.
  • the output instruction is an instruction to output the sequence program to the sequence program editing device 3, which is an external device, and is sent from the instruction input unit 16 to the output unit 20.
  • the program component registration unit 17 converts the common circuit pattern G into the program component based on the transmitted definition information. Make parts. That is, the program component registration unit 17 is a program component generation unit that generates program components that are program components based on the common circuit pattern G and definition information. The program component registration unit 17 also registers the generated program component in the program component storage unit 18.
  • the program component storage unit 18 is a memory or the like that stores program components according to instructions from the program component registration unit 17.
  • the program component storage unit 18 holds the program component received from the program component registration unit 17.
  • the program component storage unit 18 outputs the held program component to the component processing unit 19 when the component processing unit 19 performs the process of replacing the circuit block of the sequence program with the program component.
  • the component processing unit 19 replaces the common logic part H in the sequence program stored in the program storage unit 12 with the program component held in the program component storage unit 18.
  • the component processing unit 19 stores the replaced sequence program in the program storage unit 12.
  • the output unit 20 reads the sequence program specified by the output instruction from the program storage unit 12 and outputs it to the sequence program editing device 3, which is an external device.
  • the output unit 20 outputs the sequence program specified by the output instruction to the external device specified by the output instruction.
  • the component definition display processing unit 21 displays a generation designation screen (corresponding to the screen 101 shown in FIG. 1) of the input/output argument of the program component based on the information about the common circuit pattern G sent from the search result display processing unit 15. Display on the display device 5.
  • the component definition display processing unit 21 receives the designation of the input/output argument to be generated from the user in a state where the input/output argument generation designation screen of the program component is displayed.
  • the component definition display processing unit 21 When the user specifies the input / output arguments to be generated, the component definition display processing unit 21 generates the definition information of the program component based on the specification result by the user, and sends the generated definition information to the component image display processing unit 22. send.
  • the componentized image display processing unit 22 displays the image (confirmation screen) of the sequence program after replacing the common logic part H with the program component based on the definition information of the program component sent from the component definition display processing unit 21. It is created and displayed on the display device 5. Specifically, the componentized image display processing unit 22 causes the display device 5 to display a screen corresponding to the screen 102 shown in FIG. Further, the componentized image display processing unit 22 accepts the input of the determination result of whether or not the replacement is actually performed from the user in a state where the confirmation screen of the replaced sequence program is displayed on the display device 5.
  • the componentized image display processing unit 22 When the componentized image display processing unit 22 receives the input of the determination result indicating that the replacement is performed, it sends the definition information of the program component received from the component definition display processing unit 21 to the program component registration unit 17. On the other hand, when the componentized image display processing unit 22 receives the input of the determination result indicating that the replacement is not performed, the component definition display processing unit 22 is notified of the determination result.
  • the component definition display processing unit 21 that has received the notification causes the display device 5 to display the input/output argument generation designation screen of the program component again, and receives the designation of the input/output argument to be generated from the user.
  • FIG. 3 is a flowchart showing an example of the operation of the program creation support device 1 according to the embodiment.
  • the flowchart of FIG. 3 shows a processing procedure when the program creation support apparatus 1 creates a program part from a sequence program and creates a sequence program in which the common logic part H is replaced with a program part.
  • the program creation support device 1 holds the sequence program in the program storage unit 12. That is, it is assumed that the program input unit 11 of the program creation support apparatus 1 has received the sequence program from the sequence program creation apparatus 2 and stored the received sequence program in the program storage unit 12.
  • the program creation support device 1 receives the search instruction of the common logic part H and starts the program componentization process (step S1). That is, when the user inputs a search instruction for the common circuit pattern G (common logic portion H) from the instruction input unit 16, the search instruction is sent from the instruction input unit 16 to the common determination unit 13. As a result, the program creation support apparatus 1 starts the program componentization process.
  • the common determination unit 13 Upon receiving the search instruction from the instruction input unit 16, the common determination unit 13 extracts the common circuit pattern G from the sequence program stored in the program storage unit 12. The common determination unit 13 extracts, for example, a common logic portion H from the sequence program, and extracts a common circuit pattern from the circuit blocks (the circuit blocks 2a to 4a shown in FIG. 1) arranged in the common logic portion H. G is extracted (step S2). Further, the common determination unit 13 confirms whether or not the device allocation to the circuit components matches in all the common logic portions H for each circuit component constituting the extracted common logic portion H, and confirms the confirmation result. Generate attached information to show. The attached information is information indicating which of the first circuit component and the second circuit component each of the circuit components configuring the common logic portion H corresponds to.
  • the common determination unit 13 associates the extracted configuration information and the accessory information of the common circuit pattern G with the number of the common circuit pattern G and the search result.
  • the data is stored in the storage unit 14 (step S3).
  • the common determination unit 13 sends the location of the common logic portion H and the program identification information, which is information for identifying the sequence program from which the common logic portion H is extracted, to the componentization processing unit 19 in association with each other. ..
  • the location of the common logic part H is, for example, the line number of the ladder program.
  • the search result storage unit 14 Upon receiving the information from the common determination unit 13, the search result storage unit 14 stores the received information.
  • the search result display processing unit 15 extracts the information by the common determination unit 13 based on the information held in the search result storage unit 14.
  • the display device 5 displays a list of the configurations and the number of common circuit patterns G.
  • the display device 5 displays, for example, the common circuit pattern G shown in FIG. 1 and the number of cases (3 cases in FIG. 1) (step S4).
  • the common determination unit 13 may notify the search result display processing unit 15 that the information is stored in the search result storage unit 14.
  • the program creation support device 1 waits for the user to select the common circuit pattern G to be componentized.
  • the instruction input unit 16 receives the selection of the common circuit pattern G to be made into a component from the user (step S5), the instruction input unit 16 generates a component designation instruction indicating the selected common circuit pattern G and sends it to the search result display processing unit 15.
  • the search result display processing unit 15 reads the configuration information and the attached information of the common circuit pattern G indicated by the component designation instruction from the search result storage unit 14 and sends it to the component definition display processing unit 21.
  • the component definition display processing unit 21 When the component definition display processing unit 21 receives the configuration information and the attached information of the common circuit pattern G from the search result display processing unit 15, it responds to the common circuit pattern G selected by the user in step S5 based on the received information.
  • the display device 5 is caused to display the input/output argument generation designation screen for the program component to be executed (step S6).
  • the component definition display processing unit 21 causes the display device 5 to display, for example, the screen having the content illustrated in FIG. 4 as the screen for specifying the input/output argument of the program component.
  • FIG. 4 is a diagram showing an example of the input/output argument generation designation screen of the program component.
  • the input/output argument generation designation screen of the program component is displayed when the user specifies the argument to be generated as the input/output argument of the program component. That is, the program creation support apparatus 1 causes the display device 5 to display the input/output argument generation designation screen of the program component when the user specifies the argument to be generated as the input/output argument of the program component.
  • the input / output argument generation specification screen (hereinafter referred to as screen 101) of the program component illustrated in FIG. 4 has “coordinates”, “circuit symbols”, “match / mismatch of device allocation”, and “generation of input / output arguments”. Includes “necessity". The “coordinate” indicates the position in the common circuit pattern G of each circuit component included in the common circuit pattern G.
  • Circuit symbol indicates the type of circuit component existing at the position indicated by the “coordinate” in the same row.
  • “Match/mismatch of device allocation” indicates whether or not the device allocation for the circuit component existing at the position indicated by the “coordinate” in the same row is the same in all the common logic parts H. That is, “match / mismatch of device allocation” indicates whether the circuit component existing at the position indicated by the "coordinates” in the same line corresponds to the first circuit component or the second circuit component.
  • the circuit component (first circuit component) whose “device assignment match/mismatch” is “match” the devices assigned to the circuit component are also displayed. For example, the device assigned to the circuit component whose coordinates are (1, 0) is “M2”.
  • I/O argument generation necessity indicates whether or not an I/O argument for allocating a device to a circuit component existing at the position indicated by “coordinates" on the same line is generated.
  • the user can operate the input device such as a mouse to check or uncheck the item “I/O argument generation necessity” when the screen 101 is displayed on the display device 5. , Change the specification of input/output argument to be generated. However, it is essential to generate input / output arguments for the circuit component (second circuit component) in which "match / mismatch of device allocation" is "mismatch".
  • the program creation support device 1 fixes the "necessity of input/output argument generation" of the circuit component for which "match/mismatch of device allocation” is “mismatch” with a check mark, and checks by the user. The operation to remove is not accepted.
  • the program creation support apparatus 1 selects the input/output argument generated by the program component by the user with the screen 101 shown in FIG. Wait to do.
  • the instruction input unit 16 When the selection operation by the user is completed, that is, when the selection of the input/output argument to be generated is received from the user (step S7), the instruction input unit 16 generates an argument generation necessity instruction indicating the selected input/output argument. It is sent to the component definition display processing unit 21.
  • the instruction input unit 16 generates, for example, an argument generation necessity instruction when the selection operation end button, which is omitted in FIG. 4, is pressed by the user.
  • the argument generation necessity instruction is generated according to the contents of the screen 101 shown in FIG.
  • the description will be continued assuming that the user has designated generation of an input/output argument for allocating the device to the coil having the coordinates (2, 0).
  • the argument generation necessity instruction is an input for allocating the device to the a contact at the coordinate (0,0), the coil at the coordinate (2,0), and the b contact at the coordinate (1,1).
  • the component definition display processing unit 21 and the instruction input unit 16 that execute the above steps S6 and S7 take input / output arguments from the first circuit component after the common logic portion H is replaced with the program component.
  • a selection acceptance unit is configured to allow the user to select the first circuit component that requires the device allocation used.
  • the component definition display processing unit 21 When the component definition display processing unit 21 receives the argument generation necessity instruction, the component definition display processing unit 21 receives the received argument generation necessity instruction and the configuration information of the common circuit pattern G received from the search result display processing unit 15 and holds the component. It is sent to the image display processing unit 22.
  • the componentized image display processing unit 22 When the componentized image display processing unit 22 receives the argument generation necessity instruction and the configuration information of the common circuit pattern G from the component definition display processing unit 21, it holds the received information.
  • the componentized image display processing unit 22 replaces the common logic portion H with a program component based on the information received from the component definition display processing unit 21 and the sequence program stored in the program storage unit 12.
  • the confirmation screen of the subsequent sequence program is displayed on the display device 5 (step S8).
  • the componentized image display processing unit 22 causes the display device 5 to display, for example, the screen having the content illustrated in FIG. 5 as the confirmation screen of the sequence program after the replacement process is executed.
  • FIG. 5 is a diagram showing an example of a screen for confirming the sequence program after executing the replacement process.
  • the screen for confirming the sequence program after executing the replacement process is a screen for confirming the configuration of the sequence program after the common logic portion H is replaced with the program component. That is, the componentized image display processing unit 22 is a confirmation display processing unit that causes the display device 5 to display a screen for confirming the configuration of the sequence program after being replaced by the program component.
  • the confirmation screen (hereinafter, referred to as screen 102) of the sequence program after the replacement process shown in FIG. 5 has a configuration in which the sequence program before replacement and the sequence program after replacement are arranged side by side.
  • the left side of the screen 102 is a sequence program before replacing the common logic part H with a program part (a program before replacement), and the right side of the screen 102 is a sequence program after replacing the common logic part H with a program part (replacement). Later program).
  • the componentized image display processing unit 22 may calculate the size of the sequence program before the replacement and the size of the sequence program after the replacement and display them on the screen 102. In this case, it becomes possible for the user to know in advance the effect of reducing the program size by replacing the common logic part H with the program parts, and this can be used as a basis for determining whether or not to execute the replacement.
  • FIG. 5 shows an example of a screen that displays the configuration of the sequence program after replacing one common logic part H with the program parts, after replacing the plurality of common logic parts H with the program parts.
  • the configuration of the sequence program may be displayed.
  • the componentized image display processing unit 22 scrolls the display of the screen 102 up and down according to the operation from the user, and the user confirms the configuration of the sequence program after replacing all the common logic parts H with program components. You may be able to do it.
  • step S8 the program creation support apparatus 1 displays whether the screen 102 shown in FIG. 5 is displayed on the display device 5 or not, and whether the user replaces the common logic part H with the program parts. Wait until is selected (step S9).
  • step S9: execute When the “OK (execute)” button at the lower right of the screen 102 is pressed, that is, when execution of replacement of the common logic part H by program components is selected, the instruction input unit 16 selects (step S9: execute). A componentization confirmation instruction is generated and sent to the componentization image display processing unit 22.
  • step S9: cancel when the "cancel" button at the lower right of the screen 102 is pressed, that is, when it is selected not to replace the common logic part H by the program component, the instruction input unit 16 selects (step S9: cancel). ), a cancel instruction is generated and sent to the componentized image display processing unit 22.
  • the componentized image display processing unit 22 Upon receiving the cancel instruction, the componentized image display processing unit 22 sends the received cancel instruction to the component definition display processing unit 21, and finishes displaying the screen 102 on the display device 5.
  • the component definition display processing unit 21 displays the screen 101 on the display device 5. Then, the component definition display processing unit 21 waits again for the input / output arguments generated by the program component to be selected by the user and the selection operation to be completed.
  • the program creation support device 1 returns to step S7.
  • the componentization image display processing unit 22 receives the componentization confirmation instruction, the information received and held from the component definition display processing unit 21, specifically, the argument generation necessity instruction and the common circuit pattern.
  • the G configuration information is sent to the program component registration unit 17.
  • the program component registration unit 17 Upon receiving the argument generation necessity instruction and the configuration information of the common circuit pattern G from the componentized image display processing unit 22, the program component registration unit 17 converts the common circuit pattern G selected in step S5 into a program component. (Step S10). Specifically, the program component registration unit 17 has an input/output argument indicated by the argument generation necessity instruction for the common circuit pattern G represented by the configuration information of the common circuit pattern G received from the componentized image display processing unit 22. Create a program part by converting it to a program part. The program component registration unit 17 stores the converted program component in the program component storage unit 18 (step S11). In this way, the common circuit pattern G selected by the user is stored in the program component storage unit 18 as a program component.
  • the program component storage unit 18 Upon receiving the program component from the program component registration unit 17, the program component storage unit 18 stores the received program component.
  • the componentization processing unit 19 stores a common logic portion H in the sequence program held in the program storage unit 12. Is replaced with a program component stored in the program component storage unit 18 (step S12).
  • the component processing unit 19 allocates the input / output arguments of the replaced program component.
  • the componentization processing unit 19 receives the information received from the common determination unit 13 and held, specifically, the location of the common logic portion H and the sequence program of the sequence program from which the common logic portion H is extracted.
  • the common logic part H of the sequence program indicated by the program identification information is replaced with a program component.
  • the component processing unit 19 extracts the sequence program to be componentized from the program storage unit 12 based on the program identification information. Then, the component processing unit 19 replaces the circuit pattern in the common logic portion H of the extracted sequence program with the program component held by the program component storage unit 18. Whether or not the program component is stored in the program component storage unit 18 is grasped, for example, by the component processing unit 19 periodically checking the state of the program component storage unit 18.
  • the program component registration unit 17 may notify the component processing unit 19 that the program component has been stored in the program component storage unit 18.
  • the replaced sequence program is stored in the program storage unit 12.
  • this output instruction is sent from the instruction input unit 16 to the output unit 20.
  • the output unit 20 extracts the sequence program specified by the output instruction from the program storage unit 12 and sends it to the sequence program editing device 3.
  • the sequence program editing device 3 edits the sequence program according to the user's instruction.
  • the program creation support device 1 may return to step S4 and continue the operation after executing step S12 in FIG.
  • the search result display processing unit 15 causes the display device 5 to list the configuration and the number of common circuit patterns G in step S4
  • the common circuit pattern G selected in step S5 executed in the past, that is, the program The common circuit pattern G, which has already been made into a component, is not included in the list display.
  • the program component registration unit 17 may make all the common circuit patterns G extracted by the common determination unit 13 into a component. ..
  • the program creation support apparatus 1 for example, repeatedly executes the processes of steps S6 to S9 shown in FIG. 3, and when the processes of steps S6 to S9 are completed for all common circuit patterns G, steps S10 to S12 are executed. Execute.
  • the program creation support apparatus 1 is configured to allow the user to select the input/output argument of the program component in the above steps S6 and S7, but it may be configured not to accept the selection by the user. That is, among the circuit components included in the common circuit pattern G, the input/output argument is not generated for the circuit component (first circuit component) whose device allocation is the same in all the common logic parts H The number of input/output arguments of the component may be minimized.
  • the program creation support device 1 executes step S10 following step S5.
  • the search result display processing unit 15 reads the configuration information and the attached information of the common circuit pattern G selected by the user in step S5 from the search result storage unit 14 and sends them to the program component registration unit 17.
  • sequence program handled by the program creation support device 1 is a ladder program
  • sequence program is not limited to the ladder program.
  • program creation support apparatus 1 may allow the user to specify the size of the block to be extracted as the common circuit pattern G, similarly to the invention described in Patent Document 1.
  • the program creation support apparatus 1 analyzes a sequence program to confirm whether or not there are a plurality of circuit patterns having the same configuration, and a common circuit pattern having the same circuit pattern as the configuration. G is extracted, and a program component representing the extracted common circuit pattern G is generated. Then, the program creation support apparatus 1 replaces the common circuit pattern G included in the sequence program with the generated program component. Further, the program creation support apparatus 1 extracts the common circuit pattern G, and then, for each of the circuit components included in the common circuit pattern G, whether or not the device allocations match among all the extracted common circuit patterns G. Is generated and additional information indicating the confirmation result is generated.
  • the program creation support apparatus 1 excludes the case where the user instructs the first circuit component in which the device allocations match among all the common circuit patterns G, It was decided not to generate input/output arguments for device allocation. As a result, the number of input/output arguments of program parts can be reduced. As a result, the readability and maintainability of the sequence program can be improved.
  • FIG. 6 is a diagram showing a hardware configuration of the program creation support device 1 according to the embodiment.
  • the program creation support device 1 has a CPU (Central Processing Unit) 91, a ROM (Read Only Memory) 92, a RAM (Random Access Memory) 93, a communication interface 94, and an input unit 95.
  • these CPU 91, ROM 92, RAM 93, communication interface 94 and input unit 95 are connected via a bus line B.
  • the input unit 95 includes a mouse and a keyboard.
  • the program 90 is stored in the ROM 92.
  • the program 90 is a program for the CPU 91 to operate as the common determination unit 13, the search result display processing unit 15, the program component registration unit 17, the componentization processing unit 19, the component definition display processing unit 21, and the componentization image display processing unit 22.
  • the communication interface 94 is a processing circuit for the program creation support apparatus 1 to send and receive a signal for communication with other devices such as the sequence program creation apparatus 2 and the sequence program editing apparatus 3, and is, for example, a network interface card. is there.
  • a display device 5 is also connected to the bus line B.
  • the image display processing unit 22 is realized by the CPU 91 and the ROM 92. That is, each of the above components is realized by the CPU 91 reading the program 90 stored in the ROM 92 from the ROM 92 and executing the program 90.
  • program storage unit 12, the search result storage unit 14, and the program component storage unit 18 of the program creation support device 1 shown in FIG. 2 are realized by the RAM 93.
  • the program input unit 11 and the output unit 20 of the program creation support device 1 shown in FIG. 2 are realized by the communication interface 94.
  • the instruction input unit 16 of the program creation support device 1 shown in FIG. 2 is realized by the input unit 95.
  • the search result display processing unit 15 As the common determination unit 13 of the program creation support device 1, the search result display processing unit 15, the program component registration unit 17, the component processing unit 19, the component definition display processing unit 21, and the component image display processing unit 22.
  • the program (program 90) for operating is stored in the ROM 92 in advance, the present invention is not limited to this.
  • the above program 90 is supplied to the user in a state in which it is written in a recording medium such as a CD (Compact Disc)-ROM and a DVD (Digital Versatile Disc)-ROM, and the user implements the hardware for realizing the program creation support apparatus 1 by the user. It may be in the form of installation.
  • the hardware that realizes the program creation support apparatus 1 has a configuration including a reading device for reading the program from the recording medium, or an interface circuit for connecting the reading device.
  • the program 90 may be provided via a communication line such as the Internet.
  • 1 program creation support device 2 sequence program creation device, 3 sequence program editing device, 5 display device, 2a-4a, 2b-4b circuit block, 11 program input part, 12 program storage part, 13 common judgment part, 14 search results Storage unit, 15 search result display processing unit, 16 instruction input unit, 17 program component registration unit, 18 program component storage unit, 19 component processing unit, 20 output unit, 21 component definition display processing unit, 22 component image display processing Department, 100 program creation system.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Automation & Control Theory (AREA)
  • Programmable Controllers (AREA)
  • Stored Programmes (AREA)

Abstract

プログラム作成支援装置(1)は、シーケンスプログラム内の回路全体から共通のロジック部分を抽出し、抽出した共通のロジック部分に含まれる回路部品について、同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致しているか否かを示す付属情報を生成する共通判定部(13)と、共通のロジック部分と付属情報とに基づいてプログラムコンポーネントを生成するプログラムコンポーネント生成部(プログラム部品登録部(17))と、シーケンスプログラム内の共通のロジック部分の各々を、プログラムコンポーネントとプログラムコンポーネントの入出力引数に接続する回路部品とで置き換える置換部(部品化処理部(19))と、を備え、プログラムコンポーネント生成部は、同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致している回路部品については、ユーザが入出力引数を生成するか否かを選択することができる。

Description

プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム
 本発明は、シーケンスプログラムの作成を支援するプログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラムに関する。
 プログラマブルロジックコントローラ(PLC:Programmable Logic Controller)は、シーケンスプログラムに従って動作を行い、工場などに設置されている被制御機器を制御する制御装置である。
 シーケンスプログラムの主要な記述言語としてラダー言語がある。ラダー言語は、リレー回路を模したグラフィカルな表現によるプログラミング言語であり、接点およびコイルといった制御信号を伝搬する回路部品を配置し、それらの接続関係を指定することによって、プログラムを作成できる。なお、制御信号はPLCの内部メモリに割り付けられるが、この内部メモリは「デバイス」と呼ばれる。また、ラダー言語で記述されたシーケンスプログラムはラダープログラムと呼ばれる。ラダープログラムにおいては、XおよびYといった記号と数値とを組み合わせてデバイスを表現し、接点およびコイルのそれぞれにデバイスを割り付けることで信号伝搬を表現している。
 ここで、近年、生産設備の大規模化が進んでおり、これに伴いPLCが制御する被制御機器の数が増加し、シーケンスプログラムも大規模化している。そのため、シーケンスプログラムを効率良く作成できるようにするための技術が提案されている。
 例えば、特許文献1に記載の発明では、1つのシーケンスプログラムにおいて同じ回路パターンが複数回使用されることに着目し、シーケンスプログラムを効率良く作成できるようにしている。具体的には、特許文献1に記載の発明では、作成済みのシーケンスプログラムから共通の回路パターンを抽出して部品化を行い、部品化された回路パターンであるプログラム部品をその後のシーケンスプログラムの作成などで再利用できるようにしている。
特許第5769900号公報
 特許文献1に記載の発明では、プログラム部品の定義、すなわち入出力引数の定義を、自動的に決定する。具体的には、共通の回路パターン内の回路部品(接点、コイル等)に対する全てのデバイス割付が、入出力引数から渡されるものとして、プログラム部品の入出力引数が定義される。よって、例えば、共通回路パターン内に接点が5個、コイルが3個存在する場合、当該共通回路パターンから生成したプログラム部品は、入力引数が5個(=接点数)、出力引数が3個(=コイル数)となる。
 ところで、共通回路パターンの抽出元となる複数の回路において、デバイス割付が同じ回路部品については、引数として外部からデバイス割付を渡す必要が無く、プログラム部品の引数を省略することが可能である。また、シーケンスプログラムにおいては、使用するプログラム部品の入出力引数の数が少ないほど、可読性および保守性が高くなり、また、プログラム容量を削減することが可能である。しかしながら、特許文献1に記載の発明では、プログラム部品の入出力引数の数を削減すること、すなわち、シーケンスプログラムの可読性および保守性の改善について考慮されていないという問題があった。
 本発明は、上記に鑑みてなされたものであって、シーケンスプログラムの可読性および保守性を高めることが可能なプログラム作成支援装置を得ることを目的とする。
 上述した課題を解決し、目的を達成するために、本発明にかかるプログラム作成支援装置は、シーケンスプログラム内の回路全体から共通のロジック部分を抽出し、抽出した共通のロジック部分に含まれる回路部品について、同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致しているか否かを示す付属情報を生成する共通判定部、を備える。また、プログラム作成支援装置は、共通判定部が抽出した共通のロジック部分と付属情報とに基づいてプログラムコンポーネントを生成するプログラムコンポーネント生成部と、シーケンスプログラム内の共通のロジック部分の各々を、プログラムコンポーネントとプログラムコンポーネントの入出力引数に接続する回路部品とで置き換える置換部と、を備える。プログラムコンポーネント生成部は、付属情報のうち、同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致している回路部品については、ユーザが入出力引数を生成するか否かを選択することができる。
 本発明にかかるプログラム作成支援装置は、シーケンスプログラムの可読性および保守性を高めることができるという効果を奏する。
実施の形態にかかるプログラム作成支援装置によるプログラム部品の生成動作の概要を示す図 実施の形態にかかるプログラム作成支援装置を含んで構成されるプログラム作成システムの構成を示す図 実施の形態にかかるプログラム作成支援装置の動作の一例を示すフローチャート プログラム部品の入出力引数の生成指定画面の一例を示す図 置換処理実行後のシーケンスプログラムの確認用画面の一例を示す図 実施の形態にかかるプログラム作成支援装置のハードウェア構成を示す図
 以下に、本発明の実施の形態にかかるプログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラムを図面に基づいて詳細に説明する。なお、この実施の形態によりこの発明が限定されるものではない。
 以下の実施の形態において、「共通回路パターンG」と「共通のロジック部分H」とを以下のように区別して説明を行う。
・共通回路パターンG:シーケンスプログラムに共通して現れるロジックのパターン。
・共通のロジック部分H:共通回路パターンGが現れるシーケンスプログラムの箇所(領域)。
 以下の説明では、プログラム作成支援装置が取り扱うシーケンスプログラムがラダープログラムであるものとする。
実施の形態.
 まず、本実施の形態にかかるプログラム作成支援装置の動作の概要について説明する。本実施の形態にかかるプログラム作成支援装置は、少なくとも以下に示す2つの機能を有し、これらの機能を用いて、ユーザによるシーケンスプログラムの作成を支援する。
 第1の機能は、シーケンスプログラムの回路全体から部品化可能な共通のロジック部分Hを検索して表示する機能である。シーケンスプログラムであるラダープログラムは、接点またはコイルに相当する命令と、数値演算などに相当する応用命令とで構成されている。したがって、プログラム作成支援装置は、接点に相当する命令である接点相当命令、コイルに相当する命令であるコイル相当命令、および数値演算などに相当する応用命令のロジックのみで共通している共通回路パターンGと、プログラム箇所(共通のロジック部分H)とを検索し表示する。検索された共通回路パターンGが、プログラムコンポーネントであるプログラム部品(マクロ、サブルーチンなど)の候補である。
 第2の機能は、第1の機能で検索した共通回路パターンGの何れかがユーザによって選択されると、選択された共通回路パターンGをプログラム部品に変換(部品化を実行)して登録する機能である。また、第2の機能は、第1の機能で検索した共通のロジック部分Hを、登録したプログラム部品のインスタンスで置き換えることで、シーケンスプログラムを自動的に部品化する。
 ここで、上記の第1の機能において共通のロジック部分Hを検索する際、プログラム作成支援装置は、回路中の接点およびコイルといった各回路部品に対するデバイス割付が一致するかどうかという情報を保持しておく。つまり、抽出した共通回路パターンGにおいて、その元となる共通のロジック部分Hの全てで、同じ座標に配置された回路部品に対するデバイス割付が一致するかどうかを付属情報として保持しておく。ここでの座標は、回路部品の回路パターン内の位置を示す。よって、同じ座標に配置された回路部品とは、共通回路パターンG内の同じ場所に配置された回路部品である。
 また、上記の第2の機能においてプログラム部品を生成する際、プログラム作成支援装置は、第1の機能で共通のロジック部分Hを検索する際に保持しておいた付属情報に基づいて、プログラム部品の引数を決定する。具体的には、プログラム作成支援装置は、共通のロジック部分Hの間で、同じ座標に配置されているがデバイス割付が一致しない回路部品が存在する場合、この回路部品にデバイスを割付けるための引数を有するプログラム部品を生成する。
 これにより、プログラム作成支援装置が生成するプログラム部品の入出力引数が必要以上に多くなるのを防止することができ、シーケンスプログラムの可読性および保守性を高めることができる。また、シーケンスプログラムの容量を削減することができる。
 図1は、実施の形態にかかるプログラム作成支援装置によるプログラム部品の生成動作の概要を示す図である。
 図1のフェーズ(A)に示すように、プログラム作成支援装置は、シーケンスプログラム内から共通のロジック部分Hを抽出する。ここでは、プログラム作成支援装置は、回路ブロック2a~4aの配置されているブロックを共通のロジック部分Hとして抽出する。
 さらに、図1のフェーズ(B)に示すように、プログラム作成支援装置は、回路ブロック2a~4aのロジックに基づいて、部品化可能な共通回路パターンGを設定する。換言すると、プログラム作成支援装置は、回路ブロック2a~4aに共通なロジックを共通回路パターンGに設定する。これにより、プログラム作成支援装置は、回路ブロック2a~4aを共通回路パターンGとして扱う。
 このとき、プログラム作成支援装置は、抽出した回路ブロック2a~4aにおいて、同じ座標の回路部品に対するデバイス割付が一致するかどうかを確認し、確認結果を示す情報(デバイス割付が一致するか否かを示す情報)を保持する。図1に示した例では、回路ブロック2a~4aの左上に位置する回路部品の座標を(0,0)とし、この部品の右隣に位置する回路部品の座標を(1,0)、さらに右隣に位置する回路部品の座標を(2,0)としている。また、左上に位置する回路部品の一つ下に位置する回路部品の座標を(0,1)、この部品の右隣に位置する回路部品の座標を(1,1)、さらに右隣に位置する回路部品の座標を(2,1)としている。なお、各回路部品の位置を示す座標の決め方はこれに限定されない。また、各回路部品の配置を座標で示すことは必須ではない。回路ブロック内の各回路部品の配置が分かるのであれば座標以外の情報を用いて各回路部品の配置を示してもよい。
 図1に示した例では、座標が(0,0)および(1,1)の回路部品に対するデバイス割付が回路ブロック2a~4aの間で一致しておらず、その他の座標の回路部品に対するデバイス割付は回路ブロック2a~4aの間で一致している。そのため、プログラム作成支援装置は、フェーズ(B)において、座標が(0,0)および(1,1)の回路部品に対するデバイス割付が回路ブロック2a~4aの間で一致しておらず、座標が(1,0)、(2,0)、(0,1)および(2,1)の回路部品に対するデバイス割付が回路ブロック2a~4aの間で一致していることを示す情報を生成して保持する。なお、これ以降の説明では、必要に応じて、デバイス割付が全ての共通のロジック部分H(図1では回路ブロック2a~4a)の間で一致している回路部品を第1の回路部品と称し、第1の回路部品に該当しない回路部品を第2の回路部品と称する。
 次に、図1のフェーズ(C)に示すように、プログラム作成支援装置は、フェーズ(B)で生成して保持している情報に基づいて、プログラム部品の入出力引数の生成指定画面である画面101を表示装置に表示させる。そして、プログラム作成支援装置は、入出力引数を生成する回路部品の選択をユーザから受け付ける。ここで、デバイス割付が不一致の回路部品、すなわち、デバイス割付が回路ブロック2a~4aの間で完全には一致していない第2の回路部品については、必ず入出力引数を生成することとする。そのため、図1に示した画面101では、座標が(0,0)の回路部品および座標が(1,1)の回路部品については入出力引数を必ず生成することがユーザに分かるような表示を行い、ユーザによる選択操作を受け付けない構成としている。
 プログラム作成支援装置は、入出力引数を生成する第1の回路部品のユーザによる選択が終了すると、フェーズ(D)に移行する。すなわち、プログラム作成支援装置は、入出力引数を生成する第1の回路部品の選択を終了する操作をユーザから受け付けると、プログラム部品への置き換え後のイメージ確認画面である画面102を表示装置に表示させる。図1に例示した画面102では、プログラム部品への置き換えを行う前のシーケンスプログラムを左側に表示し、プログラム部品への置き換えを行った後のシーケンスプログラムを右側に表示する構成としている。また、画面102では、どの回路ブロックがプログラム部品に置き換えられたのかが分かるように、プログラム部品と回路ブロックとを対応付けた表示内容としている。画面102の右側の表示内容は、フェーズ(C)においてユーザから受け付けた操作内容に従う。図1に例示した画面102では、座標が(2,0)の回路部品であるコイルに対する引数の生成がユーザにより選択された場合のプログラム部品が表示されている。
 ユーザは、画面102を確認後、プログラム部品の生成および回路ブロックのプログラム部品への置き換えを行う場合、画面102の右下の「OK(実行)」ボタンを押下する。また、ユーザは、画面102を確認後、入出力引数を生成する回路部品の選択を再度行う場合、画面102の右下の「キャンセル」ボタンを押下する。「キャンセル」ボタンが押下されると、プログラム作成支援装置は、フェーズ(C)に戻る。
 プログラム作成支援装置は、画面102の「OK(実行)」ボタンが押下されると、図1のフェーズ(E)に移行してプログラム部品であるFB(Function Block)を生成する。このとき、プログラム作成支援装置は、フェーズ(D)で表示装置に表示させた画面102の右側に示された構成のプログラム部品を生成する。
 そして、プログラム部品の生成が終了すると、プログラム作成支援装置は、図1のフェーズ(F)に移行し、フェーズ(A)で抽出した回路ブロック2a~4aを、フェーズ(E)で生成したプログラム部品に置き換えて回路ブロック2b~4bとする。
 このような手順により、プログラム作成支援装置は、シーケンスプログラムからプログラム部品を生成し、さらに、シーケンスプログラムの回路ブロックのうち、生成したプログラム部品に置き換えが可能な回路ブロックをプログラム部品に置き換える。また、プログラム作成支援装置は、生成したプログラム部品を保持しておき、他のシーケンスプログラムの編集、他のシーケンスプログラムの開発などを行う際に使用できるようにする。
 図2は、実施の形態にかかるプログラム作成支援装置を含んで構成されるプログラム作成システムの構成を示す図である。プログラム作成システム100は、プログラム作成支援装置1、シーケンスプログラム作成装置2、シーケンスプログラム編集装置3および表示装置5を備える。なお、本実施の形態では、プログラム作成支援装置1、シーケンスプログラム作成装置2、シーケンスプログラム編集装置3および表示装置5が個別の装置であるものとして説明を行うが、これらの各装置が有する各機能を1つの装置、例えばパーソナルコンピュータなどの計算機システムで実現するようにしてもよい。
 プログラム作成支援装置1は、上述したように、シーケンスプログラムから共通のロジック部分Hを抽出し、ユーザからの指示に従いプログラム部品を生成する。
 シーケンスプログラム作成装置2は、シーケンサとも呼ばれるPLC(Programmable Logic Controller)システムなどで動作させるシーケンスプログラムを作成する装置である。シーケンスプログラム作成装置2は、作成したシーケンスプログラムをプログラム作成支援装置1に入力する。
 シーケンスプログラム編集装置3は、プログラム作成支援装置1でプログラム部品に置き換えられたシーケンスプログラムを用いてシーケンスプログラムの編集を行う装置である。表示装置5は、液晶モニタなどであり、プログラム作成支援装置1からの指示に従って、シーケンスプログラム、共通回路パターンG、プログラム部品などを表示する。
 プログラム作成支援装置1は、プログラム入力部11と、プログラム格納部12と、共通判定部13と、検索結果記憶部14と、検索結果表示処理部15と、指示入力部16と、プログラム部品登録部17と、プログラム部品格納部18と、部品化処理部19と、出力部20と、部品定義表示処理部21と、部品化イメージ表示処理部22とを備えている。
 プログラム入力部11は、シーケンスプログラム作成装置2から入力されるシーケンスプログラムを受け取り、受け取ったシーケンスプログラムをプログラム格納部12に送る。
 プログラム格納部12は、共通のロジック部分Hが検索されるシーケンスプログラム(部品化対象のプログラム)を記憶しておくメモリなどである。プログラム格納部12は、プログラム入力部11からシーケンスプログラムを受け取ると、受け取ったシーケンスプログラムを保持する。また、プログラム格納部12は、シーケンスプログラム編集装置3から要求を受けるなどした場合、要求されたシーケンスプログラムを出力部20へ出力する。出力部20へ出力されたシーケンスプログラムは、出力部20からシーケンスプログラム編集装置3に受け渡される。また、プログラム格納部12は、保持しているシーケンスプログラムを構成している回路ブロックのうち、プログラム部品の生成に用いられた回路ブロックが後述する部品化処理部19によってプログラム部品に置き換えられる処理である置換処理が行われた場合、置換処理後のシーケンスプログラムを保持する。
 共通判定部13は、プログラム格納部12に格納されているシーケンスプログラムを読み込んで、その中に共通のロジック部分Hがあるか否かを判定する。共通判定部13は、共通のロジック部分Hがある場合、共通のロジック部分Hにおける共通のロジックを共通回路パターンGとして抽出する。換言すると、共通判定部13は、共通のロジック部分Hに配置されている回路パターンに共通して現れるロジックのパターンを共通回路パターンGとして抽出する。なお、プログラム作成支援装置1は、シーケンスプログラムに共通のロジック部分Hが存在しているかを判定する際、公知のコードクローン検出手法などを利用する。コードクローン検出手法とは、プログラムを表すソースコードの中から、類似しているコード片を探し出す方法である。ソースコードを構成している、類似しているコード片がコードクローンと呼ばれる。
 また、共通判定部13は、共通のロジック部分H全てで、同じ座標に配置された回路部品に対するデバイス割付が一致するかどうかを確認し、確認結果を示す情報として、共通回路パターンGの付属情報を生成する。共通判定部13は、複数の共通のロジック部分Hに含まれる複数の回路部品のそれぞれについて、デバイス割付が全ての共通のロジック部分Hで一致しているか否かを確認し、確認結果を示す付属情報を生成する。付属情報は、共通のロジック部分Hに含まれる複数の回路部品のそれぞれについての確認結果を示す。例えば、共通のロジック部分Hが4つの回路部品#1~回路部品#4を含む場合、付属情報は、回路部品#1に対するデバイス割付が全ての共通のロジック部分Hで一致しているか否かの情報と、回路部品#2に対するデバイス割付が全ての共通のロジック部分Hで一致しているか否かの情報と、回路部品#3に対するデバイス割付が全ての共通のロジック部分Hで一致しているか否かの情報と、回路部品#4に対するデバイス割付が全ての共通のロジック部分Hで一致しているか否かの情報と、を含んで構成される。
 検索結果記憶部14は、共通判定部13が抽出した共通回路パターンGの情報および付属情報を、検索結果として記憶しておくメモリなどである。すなわち、検索結果記憶部14は、共通判定部13で共通回路パターンGが抽出されると、抽出された共通回路パターンGの構成を示す情報と付属情報とを受け取り、受け取った各情報を検索結果として保持する。以下、共通回路パターンGの構成を示す情報を構成情報と称する。
 検索結果表示処理部15は、検索結果記憶部14が保持している検索結果を、一覧形式で表示装置5に表示させる。検索結果表示処理部15は、表示中の検索結果内からユーザによって部品化する共通回路パターンGが選択されると、選択された共通回路パターンGの構成情報および付属情報を、共通回路パターンGに関する情報として部品定義表示処理部21に送る。
 指示入力部16は、ユーザによって入力される指示を受け取り、指示内容を示す情報を検索結果表示処理部15、部品定義表示処理部21および部品化イメージ表示処理部22の一部または全てに出力する。ユーザによる指示は、検索に関する指示である検索指示、部品化に関する指示である部品指定指示、引数生成要否指示および部品化確定指示、または出力に関する指示である出力指示、などである。
 検索指示は、シーケンスプログラム内から共通回路パターンGを検索させる指示であり、指示入力部16から共通判定部13に送られる。部品指定指示は、検索結果の中から部品化する共通回路パターンGを指定する指示であり、指示入力部16から検索結果表示処理部15に送られる。引数生成要否指示は、共通回路パターンGに対するプログラム部品の入出力引数の生成要否を指定する指示であり、指示入力部16から部品定義表示処理部21に送られる。部品化確定指示は、シーケンスプログラム内の一部の回路ブロックをプログラム部品に置き換えた後のイメージの確認結果を基に、部品化を確定するかキャンセルするかを指定する指示である。部品化確定指示は、指示入力部16から部品化イメージ表示処理部22に送られる。出力指示は、シーケンスプログラムを外部装置であるシーケンスプログラム編集装置3などに出力させる指示であり、指示入力部16から出力部20に送られる。
 プログラム部品登録部17は、後述する部品化イメージ表示処理部22からプログラム部品の定義情報が送られてくると、送られてきた定義情報に基づいて、共通回路パターンGをプログラム部品に変換して部品化を行う。すなわち、プログラム部品登録部17は、共通回路パターンGおよび定義情報に基づいてプログラムコンポーネントであるプログラム部品を生成するプログラムコンポーネント生成部である。また、プログラム部品登録部17は、生成したプログラム部品をプログラム部品格納部18に登録する。
 プログラム部品格納部18は、プログラム部品登録部17からの指示に従ってプログラム部品を格納するメモリなどである。プログラム部品格納部18は、プログラム部品登録部17から受け取ったプログラム部品を保持する。プログラム部品格納部18は、部品化処理部19がシーケンスプログラムの回路ブロックをプログラム部品に置換する処理を行う際、保持しているプログラム部品を部品化処理部19に出力する。
 部品化処理部19は、プログラム格納部12に格納されているシーケンスプログラムの中の共通のロジック部分Hを、プログラム部品格納部18が保持しているプログラム部品に置き換える。部品化処理部19は、置換後のシーケンスプログラムをプログラム格納部12に記憶させる。
 出力部20は、指示入力部16から出力指示が送られてきた場合、出力指示で指定されたシーケンスプログラムをプログラム格納部12から読み出して外部装置であるシーケンスプログラム編集装置3に出力する。シーケンスプログラム編集装置3に加えて他の外部装置が出力部20に接続されている場合、出力部20は、出力指示で指定されたシーケンスプログラムを、出力指示で指定された外部装置に出力する。
 部品定義表示処理部21は、検索結果表示処理部15から送られてきた共通回路パターンGに関する情報に基づき、プログラム部品の入出力引数の生成指定画面(図1に示した画面101に相当)を表示装置5に表示させる。部品定義表示処理部21は、プログラム部品の入出力引数の生成指定画面を表示させた状態で、生成する入出力引数の指定をユーザより受け付ける。部品定義表示処理部21は、生成する入出力引数のユーザによる指定が終了すると、ユーザによる指定結果に基づいてプログラム部品の定義情報を生成し、生成した定義情報を部品化イメージ表示処理部22に送る。
 部品化イメージ表示処理部22は、部品定義表示処理部21から送られてきたプログラム部品の定義情報に基づき、共通のロジック部分Hをプログラム部品に置換後のシーケンスプログラムのイメージ(確認用画面)を作成し、表示装置5に表示させる。具体的には、部品化イメージ表示処理部22は、図1に示した画面102に相当する画面を表示装置5に表示させる。また、部品化イメージ表示処理部22は、置換後のシーケンスプログラムの確認用画面を表示装置5に表示させた状態で、実際に置換を行うか否かの判断結果の入力をユーザより受け付ける。部品化イメージ表示処理部22は、置換を行うことを示す判断結果の入力を受け付けると、部品定義表示処理部21から受け取ったプログラム部品の定義情報をプログラム部品登録部17に送る。一方、部品化イメージ表示処理部22は、置換を行わないことを示す判断結果の入力を受け付けると、判断結果を部品定義表示処理部21に通知する。通知を受けた部品定義表示処理部21は、プログラム部品の入出力引数の生成指定画面を表示装置5に再度表示させて、生成する入出力引数の指定をユーザより受け付ける。
 図3は、実施の形態にかかるプログラム作成支援装置1の動作の一例を示すフローチャートである。図3のフローチャートは、プログラム作成支援装置1が、シーケンスプログラムからプログラム部品を作成し、共通のロジック部分Hをプログラム部品に置き換えたシーケンスプログラムを生成する場合の処理手順を示す。
 プログラム作成支援装置1は、シーケンスプログラムをプログラム格納部12で保持しているものとする。すなわち、プログラム作成支援装置1のプログラム入力部11が、シーケンスプログラム作成装置2からシーケンスプログラムを受け取り、受け取ったシーケンスプログラムをプログラム格納部12に格納する処理が完了しているものとする。
 プログラム作成支援装置1は、共通のロジック部分Hの検索指示を受け付けて、プログラム部品化処理を開始する(ステップS1)。すなわち、ユーザによって、指示入力部16から共通回路パターンG(共通のロジック部分H)の検索指示が入力されると、検索指示は、指示入力部16から共通判定部13に送られる。これにより、プログラム作成支援装置1はプログラム部品化処理を開始する。
 共通判定部13は、指示入力部16から検索指示を受け取ると、プログラム格納部12が保持しているシーケンスプログラムから共通回路パターンGを抽出する。共通判定部13は、例えば、シーケンスプログラムから共通のロジック部分Hを抽出し、この共通のロジック部分Hに配置されている回路ブロック(図1に示した回路ブロック2a~4aなど)から共通回路パターンGを抽出する(ステップS2)。また、共通判定部13は、抽出した共通のロジック部分Hを構成する各回路部品について、回路部品に対するデバイス割付が全ての共通のロジック部分Hで一致しているか否かを確認し、確認結果を示す付属情報を生成する。付属情報は、共通のロジック部分Hを構成する回路部品のそれぞれが、第1の回路部品および第2の回路部品のどちらに該当するかを示す情報である。
 共通判定部13は、共通回路パターンGの抽出および付属情報の生成が終了すると、抽出した共通回路パターンGの構成情報および付属情報と、この共通回路パターンGの件数とを対応付けして検索結果記憶部14に格納する(ステップS3)。
 また、共通判定部13は、共通のロジック部分Hの場所と、共通のロジック部分Hが抽出されたシーケンスプログラムを識別する情報であるプログラム識別情報とを対応付けして部品化処理部19に送る。共通のロジック部分Hの場所は、たとえば、ラダープログラムの行番号である。
 検索結果記憶部14は共通判定部13から情報を受け取ると、受け取った情報を記憶する。検索結果表示処理部15は、共通判定部13から出力された情報が検索結果記憶部14に格納されると、検索結果記憶部14が保持している情報に基づいて、共通判定部13により抽出された共通回路パターンGの構成および件数を表示装置5に一覧表示させる。表示装置5は、例えば、図1に示した共通回路パターンGと、その件数(図1では3件)を表示する(ステップS4)。共通判定部13から出力された情報が検索結果記憶部14に格納されたか否かは、例えば、検索結果表示処理部15が検索結果記憶部14の状態を定期的に確認することにより把握する。なお、共通判定部13が、情報を検索結果記憶部14に格納したことを検索結果表示処理部15に通知してもよい。
 ステップS4を実行後、プログラム作成支援装置1は、ユーザによって、部品化する共通回路パターンGが選択されるのを待つ。指示入力部16は、部品化する共通回路パターンGの選択をユーザより受け付けると(ステップS5)、選択された共通回路パターンGを示す部品指定指示を生成して検索結果表示処理部15に送る。検索結果表示処理部15は、部品指定指示が示す共通回路パターンGの構成情報および付属情報を検索結果記憶部14から読み出して、部品定義表示処理部21に送る。
 部品定義表示処理部21は、共通回路パターンGの構成情報および付属情報を検索結果表示処理部15から受け取ると、受け取った情報に基づいて、ステップS5でユーザに選択された共通回路パターンGに対応するプログラム部品の入出力引数の生成指定画面を表示装置5に表示させる(ステップS6)。部品定義表示処理部21は、ステップS6において、例えば、図4に示した内容の画面をプログラム部品の入出力引数の生成指定画面として表示装置5に表示させる。図4は、プログラム部品の入出力引数の生成指定画面の一例を示す図である。プログラム部品の入出力引数の生成指定画面は、プログラム部品の入出力引数として生成する引数をユーザに指定させる場合に表示される。すなわち、プログラム作成支援装置1は、プログラム部品の入出力引数として生成する引数の指定をユーザから受け付ける場合にプログラム部品の入出力引数の生成指定画面を表示装置5に表示させる。図4に例示したプログラム部品の入出力引数の生成指定画面(以下、画面101と記載する)は、「座標」、「回路記号」、「デバイス割付の一致・不一致」および「入出力引数の生成要否」を含む。「座標」は、共通回路パターンGに含まれる各回路部品の共通回路パターンGにおける位置を示す。「回路記号」は、同じ行の「座標」が示す位置に存在する回路部品の種類を示す。「デバイス割付の一致・不一致」は、同じ行の「座標」が示す位置に存在する回路部品に対するデバイス割付が、共通のロジック部分Hの全てにおいて一致しているか否かを示す。すなわち、「デバイス割付の一致・不一致」は、同じ行の「座標」が示す位置に存在する回路部品が第1の回路部品および第2の回路部品のどちらに該当するのかを示す。「デバイス割付の一致・不一致」が「一致」となっている回路部品(第1の回路部品)については、回路部品に割付けられているデバイスを合わせて表示するようにしている。例えば、座標が(1,0)の回路部品に割付けられているデバイスは「M2」である。「入出力引数の生成要否」は、同じ行の「座標」が示す位置に存在する回路部品にデバイスを割付けるための入出力引数を生成するか否かを示す。ユーザは、表示装置5に画面101が表示されている状態のときに、マウスなどの入力装置を操作して「入出力引数の生成要否」の項目にチェックを入れる、またはチェックを外すことで、生成する入出力引数の指定を変更する。ただし、「デバイス割付の一致・不一致」が「不一致」となっている回路部品(第2の回路部品)については入出力引数の生成が必須である。そのため、プログラム作成支援装置1は、「デバイス割付の一致・不一致」が「不一致」となっている回路部品の「入出力引数の生成要否」はチェックが入った状態で固定とし、ユーザによるチェックを外す操作を受け付けることはしない。
 ステップS6を実行後、プログラム作成支援装置1は、図4に示した画面101を表示装置5に表示させた状態で、ユーザによって、プログラム部品の生成する入出力引数が選択され、選択操作が終了するのを待つ。指示入力部16は、ユーザによる選択操作が終了すると、すなわち、生成する入出力引数の選択をユーザより受け付けると(ステップS7)、選択された入出力引数を示す引数生成要否指示を生成して部品定義表示処理部21に送る。指示入力部16は、例えば、図4では記載を省略している選択操作終了ボタンがユーザにより押下された場合、引数生成要否指示を生成する。ここでは、図4に示した画面101の内容に従って引数生成要否指示を生成するものとして説明を続ける。すなわち、ユーザが、座標(2,0)のコイルに対してデバイスを割付けるための入出力引数の生成を指定したものとして説明を続ける。この場合、引数生成要否指示は、座標(0,0)のa接点、座標(2,0)のコイルおよび座標(1,1)のb接点にそれぞれに対してデバイスを割付けるための入出力引数の生成を指定する情報を含む。なお、上記のステップS6およびS7を実行する部品定義表示処理部21および指示入力部16は、第1の回路部品の中から、共通のロジック部分Hがプログラム部品に置き換えられた後に入出力引数を用いたデバイス割付が必要な第1の回路部品をユーザに選択させる選択受付部を構成する。
 部品定義表示処理部21は、引数生成要否指示を受け取ると、受け取った引数生成要否指示と、検索結果表示処理部15から受け取って保持している共通回路パターンGの構成情報とを、部品化イメージ表示処理部22に送る。
 部品化イメージ表示処理部22は、部品定義表示処理部21から引数生成要否指示と、共通回路パターンGの構成情報とを受け取ると、受け取った情報を保持する。また、部品化イメージ表示処理部22は、部品定義表示処理部21から受け取った情報と、プログラム格納部12で保持されているシーケンスプログラムとに基づいて、共通のロジック部分Hをプログラム部品に置き換えた後のシーケンスプログラムの確認用画面を表示装置5に表示させる(ステップS8)。部品化イメージ表示処理部22は、ステップS8において、例えば、図5に示した内容の画面を置換処理実行後のシーケンスプログラムの確認用画面として表示装置5に表示させる。図5は、置換処理実行後のシーケンスプログラムの確認用画面の一例を示す図である。置換処理実行後のシーケンスプログラムの確認用画面は、共通のロジック部分Hがプログラム部品で置き換えられた後のシーケンスプログラムの構成を確認するための画面である。すなわち、部品化イメージ表示処理部22は、プログラム部品で置き換えられた後のシーケンスプログラムの構成を確認するための画面を表示装置5に表示させる確認表示処理部である。図5に示した置換処理実行後のシーケンスプログラムの確認用画面(以下、画面102と記載する)は、置換前のシーケンスプログラムと、置換後のシーケンスプログラムとを横に並べた構成である。画面102の左側が、共通のロジック部分Hをプログラム部品に置き換える前のシーケンスプログラム(置換前のプログラム)、画面102の右側が、共通のロジック部分Hをプログラム部品に置き換えた後のシーケンスプログラム(置換後のプログラム)である。部品化イメージ表示処理部22は、置換前のシーケンスプログラムのサイズおよび置換後のシーケンスプログラムのサイズを計算して画面102に表示させてもよい。この場合、共通のロジック部分Hをプログラム部品に置換することによるプログラムサイズの削減効果をユーザが事前に知ることが可能となり、置換を実行するか否かの判断材料とすることができる。図5では、1つの共通のロジック部分Hについて、プログラム部品に置き換えた後のシーケンスプログラムの構成を表示する画面の例を示したが、複数の共通のロジック部分Hについて、プログラム部品に置き換えた後のシーケンスプログラムの構成を表示するようにしてもよい。また、部品化イメージ表示処理部22は、ユーザからの操作に従い画面102の表示を上下にスクロールさせ、共通のロジック部分Hのすべてについて、プログラム部品に置き換えた後のシーケンスプログラムの構成をユーザが確認できるようにしてもよい。
 ステップS8を実行後、プログラム作成支援装置1は、図5に示した画面102を表示装置5に表示させた状態で、ユーザによって、プログラム部品による共通のロジック部分Hの置き換えを実行するか否かが選択されるのを待つ(ステップS9)。指示入力部16は、画面102の右下の「OK(実行)」ボタンが押下されると、すなわち、プログラム部品による共通のロジック部分Hの置き換えの実行が選択されると(ステップS9:実行)、部品化確定指示を生成して部品化イメージ表示処理部22に送る。また、指示入力部16は、画面102の右下の「キャンセル」ボタンが押下されると、すなわち、プログラム部品による共通のロジック部分Hの置き換えを実行しないことが選択されると(ステップS9:キャンセル)、キャンセル指示を生成して部品化イメージ表示処理部22に送る。
 部品化イメージ表示処理部22は、キャンセル指示を受け取ると、受け取ったキャンセル指示を部品定義表示処理部21に送り、画面102の表示装置5への表示を終了する。部品定義表示処理部21は、部品化イメージ表示処理部22経由でキャンセル指示を受け取った場合、画面101を表示装置5に表示させる。そして、部品定義表示処理部21は、ユーザによって、プログラム部品の生成する入出力引数が選択され、選択操作が終了するのを再度待つ。このように、図5に示した画面102の右下の「キャンセル」ボタンがユーザにより押下された場合、プログラム作成支援装置1は、ステップS7に戻る。
 一方、部品化イメージ表示処理部22は、部品化確定指示を受け取ると、部品定義表示処理部21から受け取って保持しておいた情報、具体的には、引数生成要否指示と、共通回路パターンGの構成情報とをプログラム部品登録部17に送る。
 プログラム部品登録部17は、部品化イメージ表示処理部22から引数生成要否指示と、共通回路パターンGの構成情報とを受け取ると、ステップS5で選択された共通回路パターンGをプログラム部品に変換する(ステップS10)。具体的には、プログラム部品登録部17は、部品化イメージ表示処理部22から受け取った、共通回路パターンGの構成情報が表す共通回路パターンGを、引数生成要否指示が示す入出力引数を有するプログラム部品に変換することでプログラム部品を作成する。プログラム部品登録部17は、変換したプログラム部品をプログラム部品格納部18に格納する(ステップS11)。このように、ユーザによって選択された共通回路パターンGが、プログラム部品としてプログラム部品格納部18に格納される。
 プログラム部品格納部18は、プログラム部品登録部17からプログラム部品を受け取ると、受け取ったプログラム部品を記憶する。部品化処理部19は、プログラム部品登録部17により作成されたプログラム部品がプログラム部品格納部18に格納されると、プログラム格納部12が保持しているシーケンスプログラムの中にある共通のロジック部分Hを、プログラム部品格納部18に格納されているプログラム部品に置き換える(ステップS12)。部品化処理部19は、共通のロジック部分Hをプログラム部品で置き換える際に、置き換えたプログラム部品の入出力引数の割付を行う。このとき、部品化処理部19は、共通判定部13から受け取って保持しておいた情報、具体的には、共通のロジック部分Hの場所と、共通のロジック部分Hが抽出されたシーケンスプログラムのプログラム識別情報とに基づいて、プログラム識別情報が示すシーケンスプログラムの共通のロジック部分Hをプログラム部品に置き換える。具体的には、部品化処理部19は、プログラム識別情報に基づいて、プログラム格納部12内から部品化対象のシーケンスプログラムを抽出する。そして、部品化処理部19は、抽出したシーケンスプログラムの共通のロジック部分Hにある回路パターンを、プログラム部品格納部18が保持しているプログラム部品で置き換える。プログラム部品がプログラム部品格納部18に格納されたか否かは、例えば、部品化処理部19がプログラム部品格納部18の状態を定期的に確認することにより把握する。なお、プログラム部品登録部17が、プログラム部品をプログラム部品格納部18に格納したことを部品化処理部19に通知してもよい。
 シーケンスプログラムの少なくとも一部がプログラム部品によって置き換えられた後、置換後のシーケンスプログラムは、プログラム格納部12に格納される。この後、ユーザが指示入力部16に出力指示を入力すると、この出力指示は指示入力部16から出力部20に送られる。出力部20は、出力指示で指定されたシーケンスプログラムをプログラム格納部12から抽出してシーケンスプログラム編集装置3に送る。これにより、シーケンスプログラム編集装置3では、ユーザの指示に従ってシーケンスプログラムの編集が行われる。
 プログラム作成支援装置1は、図3のステップS12を実行した後、ステップS4に戻って動作を継続するようにしてもよい。この場合、検索結果表示処理部15は、ステップS4において共通回路パターンGの構成および件数を表示装置5に一覧表示させる際、過去に実行したステップS5で選択された共通回路パターンG、すなわち、プログラム部品への部品化が済んでいる共通回路パターンGについては一覧表示に含めないようにする。
 なお、本実施の形態では、ユーザによって指定された共通回路パターンGを部品化したが、プログラム部品登録部17は、共通判定部13で抽出された全ての共通回路パターンGを部品化してもよい。この場合、プログラム作成支援装置1は、例えば、図3に示したステップS6~S9の処理を繰り返し実行し、全ての共通回路パターンGについてステップS6~S9の処理が終了すると、ステップS10~S12を実行する。
 また、本実施の形態において、プログラム作成支援装置1は、上記のステップS6およびS7において、プログラム部品の入出力引数をユーザに選択させるようにしたが、ユーザによる選択を受け付けない構成としてもよい。すなわち、共通回路パターンGに含まれる回路部品のうち、共通のロジック部分Hの全てでデバイス割付が一致している回路部品(第1の回路部品)については入出力引数を生成しないこととして、プログラム部品の入出力引数の数が最小となるようにしてもよい。この場合、プログラム作成支援装置1は、上記のステップS5に続いてステップS10を実行する。このとき、検索結果表示処理部15は、ステップS5でユーザに選択された共通回路パターンGの構成情報および付属情報を検索結果記憶部14から読み出して、プログラム部品登録部17に送る。
 また、本実施の形態では、プログラム作成支援装置1が取り扱うシーケンスプログラムがラダープログラムである場合の例について説明したが、シーケンスプログラムをラダープログラムに限定するものではない。
 また、プログラム作成支援装置1は、特許文献1に記載の発明と同様に、共通回路パターンGとして抽出するブロックのサイズをユーザに指定させるようにしてもよい。
 以上のように、本実施の形態にかかるプログラム作成支援装置1は、シーケンスプログラムを解析して構成が同じ回路パターンが複数存在するか否かを確認し、構成が同じ回路パターンである共通回路パターンGを抽出し、抽出した共通回路パターンGを表すプログラム部品を生成する。そして、プログラム作成支援装置1は、シーケンスプログラムに含まれる共通回路パターンGを、生成したプログラム部品に置き換える。また、プログラム作成支援装置1は、共通回路パターンGを抽出した後、共通回路パターンGに含まれる回路部品のそれぞれについて、抽出した全ての共通回路パターンGの間でデバイス割付が一致するか否かを確認し、確認結果を示す付属情報を生成する。そして、プログラム作成支援装置1は、プログラム部品を生成する際、全ての共通回路パターンGの間でデバイス割付が一致している第1の回路部品については、ユーザから指示された場合を除いて、デバイス割付を行うための入出力引数を生成しないこととした。これにより、プログラム部品の入出力引数の数を削減できる。この結果、シーケンスプログラムの可読性および保守性を高めることが可能となる。
 次に、プログラム作成支援装置1のハードウェア構成について説明する。図6は、実施の形態にかかるプログラム作成支援装置1のハードウェア構成を示す図である。プログラム作成支援装置1は、CPU(Central Processing Unit)91、ROM(Read Only Memory)92、RAM(Random Access Memory)93、通信インタフェース94および入力部95を有している。プログラム作成支援装置1では、これらのCPU91、ROM92、RAM93、通信インタフェース94および入力部95がバスラインBを介して接続されている。入力部95は、マウスやキーボードを備えて構成される。また、ROM92にはプログラム90が格納されている。プログラム90は、CPU91が共通判定部13、検索結果表示処理部15、プログラム部品登録部17、部品化処理部19、部品定義表示処理部21および部品化イメージ表示処理部22として動作するためのプログラムである。通信インタフェース94は、プログラム作成支援装置1がシーケンスプログラム作成装置2、シーケンスプログラム編集装置3などの他の機器との間で通信用の信号を送受信するための処理回路であり、例えばネットワークインタフェースカードである。バスラインBには表示装置5も接続されている。
 図2に示したプログラム作成支援装置1の各構成要素のうち、共通判定部13、検索結果表示処理部15、プログラム部品登録部17、部品化処理部19、部品定義表示処理部21および部品化イメージ表示処理部22は、CPU91およびROM92により実現される。すなわち、CPU91が、ROM92に格納されたプログラム90をROM92から読み出して実行することにより、上記の各構成要素が実現される。
 また、図2に示したプログラム作成支援装置1のプログラム格納部12、検索結果記憶部14およびプログラム部品格納部18は、RAM93により実現される。図2に示したプログラム作成支援装置1のプログラム入力部11および出力部20は通信インタフェース94により実現される。図2に示したプログラム作成支援装置1の指示入力部16は、入力部95により実現される。
 なお、ここでは、プログラム作成支援装置1の共通判定部13、検索結果表示処理部15、プログラム部品登録部17、部品化処理部19、部品定義表示処理部21および部品化イメージ表示処理部22として動作するためのプログラム(プログラム90)が予めROM92に格納されているものとしたがこれに限定されない。上記のプログラム90は、CD(Compact Disc)-ROM、DVD(Digital Versatile Disc)-ROMなどの記録媒体に書き込まれた状態でユーザに供給され、プログラム作成支援装置1を実現するハードウェアにユーザがインストールを行う形態であってもよい。この場合、プログラム作成支援装置1を実現するハードウェアは、記録媒体からプログラムを読み出すための読み取り装置、または、読み取り装置を接続するためのインタフェース回路を含む構成となる。また、上記のプログラム90は、インターネットなどの通信回線を介して提供される形態であってもよい。
 以上の実施の形態に示した構成は、本発明の内容の一例を示すものであり、別の公知の技術と組み合わせることも可能であるし、本発明の要旨を逸脱しない範囲で、構成の一部を省略、変更することも可能である。
 1 プログラム作成支援装置、2 シーケンスプログラム作成装置、3 シーケンスプログラム編集装置、5 表示装置、2a~4a,2b~4b 回路ブロック、11 プログラム入力部、12 プログラム格納部、13 共通判定部、14 検索結果記憶部、15 検索結果表示処理部、16 指示入力部、17 プログラム部品登録部、18 プログラム部品格納部、19 部品化処理部、20 出力部、21 部品定義表示処理部、22 部品化イメージ表示処理部、100 プログラム作成システム。

Claims (7)

  1.  シーケンスプログラム内の回路全体から共通のロジック部分を抽出し、抽出した共通のロジック部分に含まれる回路部品について、同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致しているか否かを示す付属情報を生成する共通判定部と、
     前記共通判定部が抽出した共通のロジック部分と前記付属情報とに基づいてプログラムコンポーネントを生成するプログラムコンポーネント生成部と、
     前記シーケンスプログラム内の前記共通のロジック部分の各々を、前記プログラムコンポーネントと前記プログラムコンポーネントの入出力引数に接続する回路部品とで置き換える置換部と、
     を備え、
     前記プログラムコンポーネント生成部は、前記付属情報のうち、同じ位置の回路部品に対するデバイス割付が全ての前記共通のロジック部分で一致している回路部品については、ユーザが入出力引数を生成するか否かを選択することができる、
     ことを特徴とするプログラム作成支援装置。
  2.  前記共通判定部が抽出した共通のロジック部分をプログラムコンポーネントの候補として表示装置に表示させる検索結果表示処理部、
     を備え、
     前記プログラムコンポーネント生成部は、前記プログラムコンポーネントの候補の中からユーザによって選択された共通のロジック部分と前記付属情報とに基づいてプログラムコンポーネントを生成する、
     ことを特徴とする請求項1に記載のプログラム作成支援装置。
  3.  前記プログラムコンポーネント生成部は、前記共通のロジック部分に含まれる回路部品のうち、前記共通のロジック部分内の位置およびデバイス割付が全ての共通のロジック部分で一致している回路部品である第1の回路部品に該当しない回路部品である第2の回路部品に対してデバイス割付を行う入出力引数を有するプログラムコンポーネントを生成する、
     ことを特徴とする請求項1または2に記載のプログラム作成支援装置。
  4.  前記第1の回路部品の中から、前記共通のロジック部分が前記プログラムコンポーネント生成部で生成されるプログラムコンポーネントに置き換えられた後に入出力引数を用いたデバイス割付が必要な第1の回路部品をユーザに選択させる選択受付部、
     を備え、
     前記プログラムコンポーネント生成部は、前記第2の回路部品に対してデバイス割付を行う入出力引数と、ユーザによって選択された第1の回路部品に対してデバイス割付を行う入出力引数とを有するプログラムコンポーネントを生成する、
     ことを特徴とする請求項3に記載のプログラム作成支援装置。
  5.  前記プログラムコンポーネント生成部が前記プログラムコンポーネントを生成して前記置換部が前記共通のロジック部分を前記プログラムコンポーネントで置き換える前に、前記共通のロジック部分が前記プログラムコンポーネントと前記プログラムコンポーネントの入出力引数に接続する回路部品とで置き換えられた後の前記シーケンスプログラムの構成を確認するための画面を表示装置に表示させる確認表示処理部、
     を備えることを特徴とする請求項4に記載のプログラム作成支援装置。
  6.  シーケンスプログラムの作成を支援するプログラム作成支援装置が実行するプログラム作成支援方法であって、
     シーケンスプログラム内の回路全体から共通のロジック部分を抽出する第1のステップと、
     前記第1のステップで抽出した共通のロジック部分に含まれる回路部品について、各共通のロジック部分の同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致しているか否かを示す付属情報を生成する第2のステップと、
     前記第1のステップで抽出した共通のロジック部分と前記付属情報とに基づいてプログラムコンポーネントを生成する第3のステップと、
     前記シーケンスプログラム内の前記共通のロジック部分を前記プログラムコンポーネントと前記プログラムコンポーネントの入出力引数に接続する回路部品とで置き換える第4のステップと、
     を含むことを特徴とするプログラム作成支援方法。
  7.  シーケンスプログラム内の回路全体から共通のロジック部分を抽出する第1のステップと、
     前記第1のステップで抽出した共通のロジック部分に含まれる回路部品について、各共通のロジック部分の同じ位置の回路部品に対するデバイス割付が全ての共通のロジック部分で一致しているか否かを示す付属情報を生成する第2のステップと、
     前記第1のステップで抽出した共通のロジック部分と前記付属情報とに基づいてプログラムコンポーネントを生成する第3のステップと、
     前記シーケンスプログラム内の前記共通のロジック部分を前記プログラムコンポーネントと前記プログラムコンポーネントの入出力引数に接続する回路部品とで置き換える第4のステップと、
     をコンピュータに実行させることを特徴とするプログラム作成支援プログラム。
PCT/JP2019/008657 2019-03-05 2019-03-05 プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム WO2020178983A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201980093411.0A CN113518947B (zh) 2019-03-05 2019-03-05 程序创建辅助装置、程序创建辅助方法及储存有程序创建辅助程序的记录介质
JP2019552927A JP6664563B1 (ja) 2019-03-05 2019-03-05 プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム
PCT/JP2019/008657 WO2020178983A1 (ja) 2019-03-05 2019-03-05 プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2019/008657 WO2020178983A1 (ja) 2019-03-05 2019-03-05 プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム

Publications (1)

Publication Number Publication Date
WO2020178983A1 true WO2020178983A1 (ja) 2020-09-10

Family

ID=70000323

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/008657 WO2020178983A1 (ja) 2019-03-05 2019-03-05 プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム

Country Status (3)

Country Link
JP (1) JP6664563B1 (ja)
CN (1) CN113518947B (ja)
WO (1) WO2020178983A1 (ja)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005092808A (ja) * 2003-09-19 2005-04-07 Keyence Corp ラダープログラムマクロ作成装置、ラダープログラムマクロ作成方法、ラダープログラムマクロ作成プログラムおよびコンピュータで読み取り可能な記録媒体
WO2014155717A1 (ja) * 2013-03-29 2014-10-02 三菱電機株式会社 シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
JP2016118883A (ja) * 2014-12-19 2016-06-30 ファナック株式会社 指定した信号の演算条件によりラダー回路を検索可能なラダープログラム検索装置
JP6370503B1 (ja) * 2017-04-17 2018-08-08 三菱電機株式会社 プログラム作成装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2526692B2 (ja) * 1990-03-02 1996-08-21 三菱電機株式会社 プログラマブルコントロ―ラのプログラミング方法
JP3755500B2 (ja) * 2002-09-06 2006-03-15 ソニー株式会社 Guiアプリケーション開発支援装置および方法、並びにコンピュータ・プログラム
CN103229175B (zh) * 2010-11-24 2016-02-03 三菱电机株式会社 系统设计装置
JP5677620B2 (ja) * 2012-03-19 2015-02-25 三菱電機株式会社 シーケンスプログラム作成装置
KR102056350B1 (ko) * 2015-01-28 2019-12-16 미쓰비시덴키 가부시키가이샤 인텔리전트 기능 유닛 및 프로그래머블 로직 컨트롤러 시스템

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005092808A (ja) * 2003-09-19 2005-04-07 Keyence Corp ラダープログラムマクロ作成装置、ラダープログラムマクロ作成方法、ラダープログラムマクロ作成プログラムおよびコンピュータで読み取り可能な記録媒体
WO2014155717A1 (ja) * 2013-03-29 2014-10-02 三菱電機株式会社 シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
JP5769900B2 (ja) * 2013-03-29 2015-08-26 三菱電機株式会社 シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
JP2016118883A (ja) * 2014-12-19 2016-06-30 ファナック株式会社 指定した信号の演算条件によりラダー回路を検索可能なラダープログラム検索装置
JP6370503B1 (ja) * 2017-04-17 2018-08-08 三菱電機株式会社 プログラム作成装置

Also Published As

Publication number Publication date
CN113518947B (zh) 2022-10-21
JPWO2020178983A1 (ja) 2021-03-11
JP6664563B1 (ja) 2020-03-13
CN113518947A (zh) 2021-10-19

Similar Documents

Publication Publication Date Title
JP5769900B2 (ja) シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
TW201923625A (zh) 翻譯支援裝置、翻譯支援程式及由資訊處理裝置支援翻譯之方法
JP2009098737A (ja) 設計管理装置、生産管理装置、生産管理システム
WO2020178983A1 (ja) プログラム作成支援装置、プログラム作成支援方法およびプログラム作成支援プログラム
JP2011039786A (ja) ソフトウェアテスト支援装置、ソフトウェアテスト支援方法、及びプログラム
JP4319082B2 (ja) プログラミングシステム
JP2008217534A (ja) アプリケーション画面作成システム、方法及びアプリケーションプログラム
JP2013084112A (ja) プログラマブルコントローラシステム、そのプログラミング装置、プログラマブルコントローラ、プログラム、デバッグ方法
JP4266334B2 (ja) ラダープログラムマクロ作成装置、ラダープログラムマクロ作成方法、ラダープログラムマクロ作成プログラムおよびコンピュータで読み取り可能な記録媒体
JP2019082927A (ja) 情報処理装置、情報処理方法、プログラム
JP2022027456A (ja) 情報処理装置、ラダープログラム生成装置、情報処理方法、ラダープログラム生成方法、物品の製造方法、プログラム、及び記録媒体
JP2006195751A (ja) 設計支援システムおよび設計支援方法
JP2011128996A (ja) 情報処理装置、情報処理方法、及びコンピュータプログラム
JP2006134092A (ja) 制御用表示装置、作画エディタ装置、表示制御プログラムおよび記録媒体
WO2021024791A1 (ja) 設計支援システム及び設計支援方法
JP5021020B2 (ja) データベースシステム
JPWO2018116449A1 (ja) プログラム開発支援装置およびプログラム部品の管理方法
JP4886910B1 (ja) 情報処理装置、情報処理装置の制御方法、プログラム、及びプログラムを記録した記録媒体
JP2011227726A (ja) プログラム、gui開発装置、gui開発方法
JP2006277460A (ja) マニュアル作成管理装置
JP2008046669A (ja) 稼動管理プログラム、稼動管理方法、この方法を実行する装置
JP6407481B1 (ja) プログラム作成装置
JP2007079954A (ja) 情報処理方法および装置、記録媒体、並びにプログラム
JP2018194898A (ja) 支援装置、支援装置の制御方法、情報処理プログラム、および記録媒体
CN114981743A (zh) 设计辅助装置、设计辅助方法及设计辅助程序

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2019552927

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19918204

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19918204

Country of ref document: EP

Kind code of ref document: A1