WO2021192152A1 - プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法 - Google Patents

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

Info

Publication number
WO2021192152A1
WO2021192152A1 PCT/JP2020/013714 JP2020013714W WO2021192152A1 WO 2021192152 A1 WO2021192152 A1 WO 2021192152A1 JP 2020013714 W JP2020013714 W JP 2020013714W WO 2021192152 A1 WO2021192152 A1 WO 2021192152A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
display component
circuit display
programming support
circuit
Prior art date
Application number
PCT/JP2020/013714
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 CN202080098862.6A priority Critical patent/CN115335782A/zh
Priority to US17/797,725 priority patent/US20230065428A1/en
Priority to JP2020544689A priority patent/JP6854982B1/ja
Priority to PCT/JP2020/013714 priority patent/WO2021192152A1/ja
Publication of WO2021192152A1 publication Critical patent/WO2021192152A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • 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
    • 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
    • G05B19/056Programming the PLC
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/10Machine learning using kernel methods, e.g. support vector machines [SVM]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/323Visualisation of programs or trace data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming

Definitions

  • This disclosure relates to a programming support program, a programming support device, and a programming support method used to support the creation of a program executed by a programmable logic controller.
  • the program executed by the programmable logic controller has generally been written in a highly readable program such as a ladder language and an FBD (Function Block Diagram) language.
  • FBD Field Block Diagram
  • ST Structured Text
  • Patent Document 1 a technique for converting a program written in a certain programming language into a program written in another programming language has been proposed (for example, Patent Document 1).
  • This disclosure has been made in view of the above, and when a program written in a programming language other than a procedural language is converted into a program written in a procedural language, the work efficiency is improved due to a decrease in the readability of the program.
  • the purpose is to obtain a programming support program that can prevent the decline.
  • the programming support program is a first program that converts a first program written in a ladder language into a second program written in an intermediate language. It includes a conversion step and a second conversion step that converts the second program into a third program written in a procedural language. Further, the programming support program includes a circuit display component generation step of generating a circuit display component representing the contents of the block satisfying the condition when the analysis result for each block of the second program satisfies a predetermined condition, and a third. The computer is made to perform a display step of displaying the program and the circuit display component in a recognizable format as to which block of the third program the circuit display component corresponds to.
  • the programming support program according to the present disclosure prevents a decrease in work efficiency due to a decrease in the readability of the program when a program written in a programming language other than the procedural language is converted into a program described in the procedural language. It has the effect of being able to do it.
  • Flow chart showing the first ST program generation operation by the programming support device Diagram showing an example of the conversion target program specification screen
  • Diagram showing the functional block configuration of the machine learning device included in the programming support device The figure which shows the structural example of the learning data which a machine learning apparatus uses for machine learning Diagram showing a configuration example of a neural network
  • FIG. 1 Flow chart showing the second ST program generation operation by the programming support device
  • FIG. 1 shows an example of the conversion code correspondence table
  • FIG. 1 shows the conversion code correspondence table
  • FIG. 1 shows the 2nd example of the display method of the circuit display component by a programming support device.
  • FIG. 1 is a diagram showing an example of a functional block configuration of the programming support device according to the embodiment.
  • the programming support device 1 shown in FIG. 1 is used for developing a program executed by a programmable logic controller.
  • the programming support device 1 includes a ladder program data storage unit 2, a P code generation unit 3, a data operation unit 4, a display unit 5, a circuit display component storage unit 6, an ST program data storage unit 7, and an ST program generation unit 8.
  • the ladder program data storage unit 2 stores the ladder program data 21 which is the data of the ladder program.
  • the P code generation unit 3 converts the ladder program into a program written in P code, which is an intermediate language.
  • the P code generation unit 3 is a first conversion unit that converts a first program written in a ladder language into a second program written in an intermediate language.
  • the computer cannot understand the contents of the program written in the programming language. Therefore, it is necessary to convert a program written in a programming language into a machine language that can be deciphered by a computer. At this time, it is common that the program written in the programming language is not directly converted into the machine language program, but is once converted into the intermediate representation program and then reconverted into the machine language program. ..
  • An intermediate language is used when a program written in a programming language is used as an intermediate representation.
  • P-code is one of various types of intermediate languages used when creating intermediate representation programs.
  • the data manipulation unit 4 receives operations such as editing operations on the data handled by the programming support device 1 from the user.
  • the display unit 5 displays various screens such as a program confirmation screen and an edit screen to the user.
  • the circuit display component storage unit 6 stores circuit display components, which will be described later.
  • the ST program data storage unit 7 stores ST program data 71, which is ST program data.
  • the ST program generation unit 8 converts the program described in the P code into an ST program.
  • the ST program generation unit 8 includes a P code analysis unit 81, a machine learning device 82, an ST template storage unit 83, and a program conversion unit 84.
  • the P code analysis unit 81 and the machine learning device 82 constitute a circuit display component generation unit 80.
  • the P-code analysis unit 81 analyzes the P-code program, which is a program written in P-code, to generate data related to the structure of the program, and also generates circuit display components when the generated data satisfies a predetermined condition. do.
  • the machine learning device 82 learns the conditions under which the P code analysis unit 81 generates a circuit display component based on the data generated by the P code analysis unit 81 and the data input from the data manipulation unit 4.
  • the ST template storage unit 83 stores a template for converting a P code program into an ST program.
  • the program conversion unit 84 converts the P code program into an ST program.
  • the program conversion unit 84 is a second conversion unit that converts the second program into a third program written in a procedural language.
  • the programming support device 1 is realized by the computer 100 as shown in FIG.
  • the electronic computer 100 is, for example, a personal computer, and is composed of a CPU (Central Processing Unit), a storage device, a display device, an input device, a communication device, and the like.
  • the storage device is a non-volatile or volatile semiconductor memory such as a RAM (Random Access Memory), a ROM (Read Only Memory), a flash memory, a magnetic disk, or the like.
  • the display device is a liquid crystal display or the like, and realizes the display unit 5. Input devices are mice, keyboards, and the like.
  • the communication device is a network interface card or the like.
  • FIG. 1 shows a configuration example in which the computer 100 includes a display device, the display device may be another device independent of the computer 100.
  • Each function of the programming support device 1 is realized by the CPU and the storage device of the computer 100. That is, the programming support device, which is a program for realizing each function of the programming support device 1, is stored in the storage device, and the CPU reads and executes the program stored in the storage device, thereby executing the programming support device. Each function of 1 is realized. Further, the ladder program data storage unit 2, the circuit display component storage unit 6, and the ST program data storage unit 7 of the programming support device 1 are realized by the storage device of the computer 100.
  • the input device of the computer 100 is used when the user operates the programming support device 1.
  • the communication device of the computer 100 is used when the programming support device 1 communicates with an external device of the computer 100.
  • the above programming support program is supplied to the user in a state of being written on a storage medium such as a CD (Compact Disc) -ROM or a DVD (Digital Versatile Disc) -ROM.
  • a storage medium such as a CD (Compact Disc) -ROM or a DVD (Digital Versatile Disc) -ROM.
  • the above programming support program may be supplied to the user via the Internet or the like.
  • the operation of converting the ladder program and generating the ST program (referred to as the first ST program generation operation) in the state where the learning by the machine learning device 82 has not been completed, and the learning by the machine learning device 82 have been completed.
  • the operation of converting the ladder program and generating the ST program (referred to as the second ST program generation operation) and the operation of displaying the circuit display components together with the converted ST program (referred to as the program display operation).
  • the operation of editing the generated circuit display component (referred to as the circuit display component editing operation) will be described respectively.
  • First ST program generation operation The first ST program generation operation in which the programming support device 1 converts the ladder program and generates the ST program when the learning by the machine learning device 82 has not been completed will be described. In this first ST program generation operation, the programming support device 1 converts the ladder program into the ST program and learns the conditions for generating the circuit display component.
  • FIG. 2 is a flowchart showing the first ST program generation operation by the programming support device 1.
  • the programming support device 1 receives the operation for instructing the start of generation of the ST program
  • the first ST program generation operation is performed when the learning by the machine learning device 82, that is, the learning of the conditions for generating the circuit display component is not completed. To start.
  • the data manipulation unit 4 first accepts the designation of the program to be converted (step S101).
  • step S101 the data operation unit 4 cooperates with the display unit 5, for example, displays the conversion target program designation screen 301 shown in FIG. 3 on the display unit 5, and accepts an operation from the user.
  • FIG. 3 is a diagram showing an example of the conversion target program designation screen 301.
  • the data manipulation unit 4 receives from the user a specification of which ladder program is to be converted into the ST program among the ladder programs included in the ladder program data 21. Further, the data manipulation unit 4 accepts the selection of the range to be actually converted (conversion range selection) for each of the ladder programs to be converted.
  • the acceptance of the conversion range selection is not essential, and the user may omit the input of the conversion range selection.
  • the programming support device 1 treats the entire program to be converted as the conversion range.
  • the user can add the selected program to the program to be converted by selecting the program in the column described as "whole” and clicking the left arrow button 302.
  • the user can exclude the selected program from the conversion target program by selecting the program (conversion target program) in the column described as "conversion target” and clicking the right arrow button 303. Can be done.
  • the conversion target program designation screen 301 includes a check box 304 for accepting a designation for forcibly creating a circuit display component.
  • the programming support device 1 creates circuit display components for all the blocks constituting the program to be converted regardless of whether or not the conditions for creating circuit display components are satisfied. do. In the following description, it is assumed that the check box 304 is not checked.
  • step S101 ends and the process proceeds to step S102.
  • step S101 the P code generation unit 3 then acquires the ladder program specified in step S101 from the ladder program data 21 (step S102), and converts each block constituting the acquired ladder program into a P code. The conversion is performed to generate a P code program (step S103).
  • the P code analysis unit 81 determines the condition unit and the execution unit for each block of the P code program (step S104).
  • a ladder program can be divided into a condition unit consisting of instructions such as contact instructions and comparison operation instructions, and an execution unit consisting of character string processing, real number processing, output instructions, and the like.
  • this can be replaced with a conditional expression and an execution statement in the IF statement. Therefore, in step S104, the P code analysis unit 81 analyzes the program (P code program) described in the P code as shown in step 2 of FIG. 4, and executes the code corresponding to the conditional statement of the IF statement.
  • the code corresponding to the statement is discriminated, and each is used as a conditional part and an execution part.
  • FIG. 4 is a diagram showing an outline of the operation of the programming support device 1 converting the ladder program into the ST program.
  • FIG. 4 shows an outline of the operation of converting one block of the ladder program into the ST program. Step 1 shown in FIG. 4 corresponds to step S103 described above.
  • step S104 After the processing of step S104 is completed, the ST program generation processing shown in steps S105 to S107 and the learning processing shown in steps S401 to S403 are executed in parallel for one block subjected to the determination processing in step S104. ..
  • the ST program generation process of steps S105 to S107 and the learning process of steps S401 to S403 will be described separately.
  • step S104 the program conversion unit 84 acquires a template for conversion processing from the ST template storage unit 83 (step S105), and creates an ST program using the template (step S105).
  • step S106 the program conversion unit 84 creates an ST program by applying the result of the P code analysis unit 81 analyzing the P code program to the template.
  • the program conversion unit 84 stores the created ST program in the ST program data storage unit 7 (step S107).
  • the machine learning device 82 performs the learning process of steps S401 to S403.
  • the functional block configuration of the machine learning device 82 is as shown in FIG.
  • FIG. 5 is a diagram showing a functional block configuration of the machine learning device 82 included in the programming support device 1. That is, the machine learning device 82 is acquired by the data acquisition unit 821 that acquires the teacher data used for machine learning, the state observation unit 822 that observes the state variables input from the P code analysis unit 81, and the data acquisition unit 821. It is provided with a learning unit 823 that learns the generation conditions of circuit display components based on the teacher data and the observation result of the state variable by the state observation unit 822.
  • FIG. 6 is a diagram showing a configuration example of learning data used by the machine learning device 82 for machine learning.
  • the learning data is composed of teacher data acquired by the data acquisition unit 821 and state variables observed by the state observation unit 822.
  • Inputs 1 to 3 shown in FIG. 6 are data input from the P code analysis unit 81 to the machine learning device 82, and correspond to state variables observed by the state observation unit 822.
  • the data of inputs 1 to 3 includes information regarding the configuration of the ladder program to be converted.
  • the "number of conditions for executing one instruction" of input 1 indicates the number of conditions that affect the execution of one instruction. This is because as the number of conditions constituting the circuit simply increases, the number of terms in the conditional statement of the IF statement increases, and the conditional expression becomes complicated.
  • “Number of instructions sharing one condition” of input 2 indicates the number of instructions sharing one condition for each condition. Of these conditions, the parts that are grouped by AND and OR are set together.
  • the "number of instructions sharing one condition" of input 2 affects the number of branches of the IF statement.
  • the "number of ANBs, ORBs, MPSs, MRDs, and MPPs that make up the circuit” of input 3 is the number of ANBs that are circuit block series connection instructions, the number of ORBs that are circuit block parallel connection instructions, and the operation result push instruction.
  • the number of MPSs, the number of MRDs that are operation result read instructions, and the number of MPPs that are operation result pop instructions are shown.
  • the data at input 3 indicates the complexity of the circuit configuration.
  • the teacher data is data as a result of a user who confirms the ST program obtained by converting the ladder program determines whether or not it is necessary to generate a circuit display component corresponding to the confirmed ST program. And.
  • step S401 the state observation unit 822 acquires the analysis result of the program from the P code analysis unit 81 (step S401). That is, in step S401, the state observation unit 822 observes the data of inputs 1 to 3 shown in FIG. 6 input from the P code analysis unit 81 as state variables.
  • step S402 the display unit 5 reads the ST program generated by the program conversion unit 84 in step S106 from the ST program data storage unit 7 and displays it. Further, the data manipulation unit 4 receives an input from the user of a determination result as to whether or not it is necessary to generate a circuit display component corresponding to the ST program displayed by the display unit 5, and uses it as the teacher data shown in FIG. Output to the machine learning device 82. In the machine learning device 82, the data acquisition unit 821 acquires teacher data from the data operation unit 4. When steps S401 and S402 are completed, learning data having the configuration shown in FIG. 6 is obtained.
  • the learning unit 823 learns the conditions for generating the circuit display component based on the learning data (step S403).
  • Step S403 will be described in detail.
  • the learning unit 823 learns the generation conditions of the circuit display component based on the data set created based on the combination of the state variables observed by the state observation unit 822 and the teacher data acquired by the data acquisition unit 821. do.
  • the dataset is data in which state variables and teacher data are associated with each other.
  • the machine learning device 82 is used in the programming support device 1 to learn the generation conditions of the circuit display components.
  • the machine learning device 82 is connected to the programming support device 1 via a network, and is connected to the programming support device 1. May be a separate device. In this case, the machine learning device 82 may exist on the cloud server.
  • the learning unit 823 learns the generation conditions of circuit display components by so-called supervised learning according to, for example, a neural network model.
  • supervised learning by giving a large amount of data sets, which are a set of data of a certain input and a result (label), to the learning unit 823, the features in those data sets are learned, and the result is obtained from the input. Refers to the model to be estimated.
  • a neural network is composed of an input layer composed of a plurality of neurons, an intermediate layer (hidden layer) composed of a plurality of neurons, and an output layer composed of a plurality of neurons.
  • the intermediate layer may be one layer or two or more layers.
  • FIG. 7 is a diagram showing a configuration example of a neural network.
  • a three-layer neural network as shown in FIG. 7, when a plurality of inputs are input to the input layer (X1-X3), the value is multiplied by the weight W1 (w11-w16). It is input to the intermediate layer (Y1-Y2), and the result is further multiplied by the weight W2 (w21-w26) and output from the output layer (Z1-Z3). This output result depends on the values of the weights W1 and W2.
  • the neural network learns the generation conditions of circuit display components that are easy for the user to see when the ladder program is converted into the ST program by so-called supervised learning according to the above data set. That is, the neural network learns the generation conditions of circuit display components by inputting state variables to the input layer and adjusting the weights W1 and W2 so that the result output from the output layer approaches the value of the teacher data. do.
  • the neural network can also learn the generation conditions of circuit display components by so-called unsupervised learning.
  • Unsupervised learning is to learn how the input data is distributed by giving a large amount of input data to the machine learning device, and to the input data without giving the corresponding teacher output data. This is a method for learning a device that performs compression, classification, shaping, and the like. Neural networks can cluster features in input data among similar people. Using this result, it is possible to predict the output by setting some criteria and allocating the output to optimize it.
  • the learning unit 823 may learn the generation conditions of the circuit display components according to the data sets created for the plurality of programming support devices 1.
  • the learning unit 823 may acquire a data set from a plurality of programming support devices 1 used at the same site, or may acquire a data set from a programming support device 1 used independently at different sites. You may. Further, the programming support device 1 that collects the data set can be added to the target in the middle of learning, or conversely, can be removed from the target. Further, a machine learning device 82 that has learned the conditions for generating circuit display components for a certain programming support device 1 is attached to another programming support device 1, and the conditions for generating circuit display components for the other programming support device 1 are set. You may relearn and update.
  • the learning algorithm used in the learning unit 823 deep learning that learns the extraction of the feature amount itself can also be used. Further, the learning unit 823 may execute learning according to other known methods such as genetic programming, functional logic programming, and a support vector machine.
  • FIG. 8 is a diagram showing a first example of learning data used for learning by the machine learning device 82.
  • the ladder program that is the basis of the learning data and the converted ST program are shown together.
  • the learning data of the first example shown in FIG. 8 is an example when the teacher data is "no circuit display component generation", that is, when the user selects not to generate the circuit display component.
  • the data of input 1 includes "Y0,8" and "Y1,8".
  • “Y0,8” indicates that the condition portion that affects the value of the output Y0 is eight conditions of X0 to X7. The same applies to "Y1, 8".
  • the data of input 2 includes "X0 AND X1, 2", “X2 AND X3, 2", “X4 AND X5, 2" and “X6 AND X7, 2".
  • "X0 AND X1, 2" indicates that X0 and X1 are combined by an AND operation and treated as one condition, and this condition is used by two instructions Y0 and Y1. The same applies to “X2 AND X3,2”, “X4 AND X5,2" and "X6 AND X7,2".
  • the data of input 3 includes "ANB, 1", “ORB, 2", “MPS, 0”, “MRD, 0” and “MPP, 0".
  • ANB, 1 indicates that there is one ANB, which is a circuit block series connection instruction.
  • ORB, 2 indicates that there are two ORBs, which are circuit block parallel connection instructions.
  • MPS, 0 indicates that the MPS that is the operation result push instruction does not exist.
  • MRD, 0 indicates that there is no MRD that is an operation result reading instruction.
  • MPP, 0 indicates that the MPP which is the operation result pop instruction does not exist.
  • the depth of the IF statement is two steps
  • the number of logical operation terms of the conditional expression of the IF statement is the maximum of two terms
  • the original ladder program can be easily inferred from the converted ST program. Judges that it is not necessary to generate circuit display components.
  • FIG. 9 is a diagram showing a second example of learning data used for learning with the machine learning device 82. Similar to FIG. 8, FIG. 9 shows both the ladder program that is the basis of the learning data and the ST program after conversion.
  • the learning data of the second example shown in FIG. 9 is an example when the teacher data is "circuit display component generation", that is, when the user selects to generate the circuit display component.
  • the data of input 1 includes “Y0,9”, “Y1,9”, “Y2,10”, and “Y3,1".
  • the data of input 2 is “X0,4", “X1 OR X4 OR X5,3", “X2,3”, “X3,1”, “X6,3”, “X7 OR X8,3”, “X9”. , 2 ”and“ X10,1 ”are included.
  • the data at input 3 includes “ANB, 3", “ORB, 1", “MPS, 2", “MRD, 0" and “MPP, 2".
  • the data of the input 1 indicates that the number of conditions for executing one instruction is large
  • the data of the input 2 indicates that the conditions of X1 to X10 are related to the output values of Y0 to Y2.
  • the data of the input 3 has a series circuit block and a parallel circuit block, and is a circuit that needs to be calculated using the stack. Since it is difficult to infer the configuration of the original ladder program from the converted ST program, the user determines that it is necessary to generate a circuit display component.
  • step S108 the ST program generation unit 8 analyzes all the blocks of the program to be converted, that is, about all the blocks. , It is confirmed whether the conversion process to the ST program and the learning process of the generation condition of the circuit display component are completed (step S108).
  • step S108: Yes the analysis of all blocks is completed
  • step S108: No the operation shown in FIG. 2 is completed.
  • step S104 the analysis of all blocks is not completed.
  • the above first ST program generation operation is performed until the learning operations shown in steps S401 to S403 are repeated until the learning of the generation conditions of the circuit display components is sufficiently advanced. Whether or not the learning of the generation conditions of the circuit display component has sufficiently progressed is determined by, for example, whether or not the number of times of repeating steps S401 to S403 has reached a predetermined value.
  • FIG. 10 is a flowchart showing a second ST program generation operation by the programming support device 1.
  • the programming support device 1 receives the operation for instructing the start of generation of the ST program
  • the second ST program generation operation is performed when the learning by the machine learning device 82, that is, the learning of the conditions for generating the circuit display component is completed. To start.
  • the flowchart shown in FIG. 10 has a configuration in which steps S401 to S403 are deleted from the flowchart shown in FIG. 2 and steps S109 to S111 are added. Since steps S101 to S108 of the flowchart shown in FIG. 10 are the same as steps S101 to S108 of the flowchart shown in FIG. 2, description thereof will be omitted.
  • steps S109 to S111 are executed in parallel with the ST program generation processing of steps S105 to S107 described above after step S104.
  • the P code analysis unit 81 determines whether or not to generate a circuit display component (step S109).
  • the P code analysis unit 81 determines whether or not to generate the circuit display component based on the learning result by the machine learning device 82 and the analysis result of the ladder program to be converted.
  • the analysis result of the ladder program to be converted here is the same analysis result as that used by the machine learning device 82 when learning the generation conditions of the circuit display component. It is the same data as the input 1 to the input 3 of the learning data shown.
  • step S109 When it is determined that the circuit display component is generated (step S109: Yes), the P code analysis unit 81 generates the circuit display component and stores it in the circuit display component storage unit 6 (step S110), and the information is stored in the conversion code correspondence table. Is stored (step S111).
  • step S110 the P code analysis unit 81 extracts one block from the ladder program and stores it in the circuit display component storage unit 6 as a circuit display component.
  • the target block to be extracted from the ladder program is a block corresponding to the block in the P code program to be determined in step S104, and is converted into the P code in step 1 shown in FIG. 4, for example, in the ladder program.
  • One block is applicable.
  • the conversion code correspondence table for storing information in step S111 is a table in which various information indicating the correspondence between the ladder program before conversion and the ST program after conversion is registered. More specifically, the conversion code correspondence table is information indicating which part (block) of the ladder program before conversion corresponds to which part (block) of the ST program after conversion, and the blocks constituting the ST program. For each, it is a table in which information indicating whether or not a corresponding circuit display component exists, information indicating which block of the ST program each of the generated circuit display components corresponds to, and the like are registered. For example, the circuit display component storage unit 6 holds the conversion code correspondence table. The circuit display component generation unit 80 or the display unit 5 may hold the conversion code correspondence table.
  • FIG. 11 is a diagram showing an example of a conversion code correspondence table.
  • Information about any one of the blocks constituting the ladder program to be converted is stored in each record constituting the conversion code correspondence table. That is, the conversion code correspondence table includes the records corresponding to each of the blocks constituting the ladder program to be converted.
  • the ladder program name, ST program name, LD position information, part presence / absence, part number, and ST position information are registered in one record of the conversion code correspondence table.
  • the "ladder program name” is the name of the ladder program before conversion
  • the "ST program name” is the name of the ST program after conversion.
  • the "LD position information” is information indicating the position in the dollar program before conversion, and indicates one of the blocks constituting the ladder program.
  • the "LD position information” indicates which position of the block in the ladder program.
  • Part presence / absence is information indicating the presence / absence of a circuit display component corresponding to the block indicated by the LD position information.
  • the "ST position information” is information indicating a position (block) in the ST program corresponding to the position (block) in the ladder program indicated by the LD position information of the same record.
  • step S109 When it is determined that the circuit display component is not generated (step S109: No), the P code analysis unit 81 executes step S111 without executing step S110.
  • the conversion code correspondence table is used when the display unit 5 displays the ST program generated by converting the ladder program.
  • step S111 the ST program generation unit 8 confirms whether the analysis of all blocks of the program to be converted has been completed (step S108).
  • the programming support device 1 determines whether or not it is necessary to generate the circuit display component when the machine learning has been completed, and generates the circuit display component when it is determined to be necessary. And said. That is, in the first ST program generation operation, the user determines whether or not it is necessary to generate the circuit display component, but the circuit display component is not actually generated. However, the circuit display component may be generated also in the first ST program generation operation. When the circuit display component is generated also in the first ST program generation operation, for example, when the user determines that the circuit display component needs to be generated in step S402 of the flowchart of FIG. 2 showing the first ST program generation operation. In addition, the same processing as in steps S110 and S111 described above may be executed.
  • a circuit display component is generated. It should be.
  • the same processing as in steps S109 to S111 shown in FIG. 10 is performed in parallel with the processing of steps S105 to S107 and the processing of steps S401 to S403 of the flowchart shown in FIG.
  • the condition used for determining whether or not to generate the circuit display component at this time is, for example, "when the ST program contains an IF statement having three or more IF nests and five or more conditional statements". do.
  • the number of nested IFs and the number of terms in conditional statements are examples and are not limited to these numbers.
  • FIG. 12 is a flowchart showing a program display operation by the programming support device 1.
  • the programming support device 1 receives an operation instructing the user to start displaying the ST program data 71 stored in the ST program data storage unit 7 on the display unit 5, the programming support device 1 starts the program display operation.
  • step S201 the display unit 5 acquires one record of the conversion code correspondence table (see FIG. 11) (step S201), and confirms whether or not the circuit display component exists (step S202). That is, in step S201, the display unit 5 confirms whether the "presence / absence of parts" in the record acquired in step S201 indicates that the circuit display parts exist (whether it is TRUE).
  • step S202 the display unit 5 stores the circuit display component corresponding to the circuit display component, that is, the circuit display component corresponding to the "part number" in the record acquired in step S201. Obtained from unit 6 (step S203).
  • step S204 the display unit 5 displays the circuit display component acquired in step S203 (step S204) and displays the ST program (step S205).
  • step S205 the display unit 5 displays the block in the ST program indicated by the "ST position information" in the record acquired in step S201.
  • the display unit 5 displays which part (block) of the ST program the circuit display component represents in a user-recognizable format. The details of how the display unit 5 displays the circuit display component and the ST program will be described separately.
  • step S202 When the circuit display component does not exist (step S202: No), the display unit 5 displays the ST program without executing steps S203 and S204 (step S205).
  • step S205 the display unit 5 confirms whether the processing of all the records in the conversion code corresponding table is completed, that is, whether steps S201 to S205 are executed for all the records (step S206).
  • step S206: Yes the processing of all records is completed
  • step S206: No the process returns to step S201.
  • circuit display component editing operation Next, the operation of editing the generated circuit display component will be described.
  • FIG. 13 is a flowchart showing a circuit display component editing operation by the programming support device 1.
  • the programming support device 1 receives an operation instructing the user to start editing the circuit display component stored in the circuit display component storage unit 6, the programming support device 1 starts the circuit display component editing operation.
  • the data operation unit 4 accepts the operation of changing the contents of the circuit display component (step S301).
  • the operation for changing the contents of the circuit display component may be any operation as long as the generated circuit display component can be edited.
  • An example of the operation of accepting the content change operation of the circuit display component will be briefly described.
  • the programming support device 1 receives the circuit display stored in the circuit display component storage unit 6.
  • the list of parts is displayed on the display unit 5, and the data manipulation unit 4 accepts the designation of the circuit display parts to be edited.
  • the programming support device 1 displays the editing work screen of the designated circuit display component on the display unit 5, and the data operation unit 4 accepts the operation of changing the circuit display component.
  • the circuit display component is one block constituting the ladder program
  • the operation of changing the circuit display component is the same as the general operation of changing the ladder program.
  • step S302 the programming support device 1 executes steps S103 to S111, but description thereof will be omitted because these steps are the same as steps S103 to S111 in the flowchart shown in FIG.
  • FIG. 14 is a diagram for explaining a display method of the circuit display component by the programming support device 1.
  • the programming support device 1 converts the ladder program into the ST program
  • the generation condition of the circuit display component is satisfied, that is, a certain block constituting the ladder program is described in the ST program (description in ST language). If it is judged that the readability is reduced by converting to, a circuit display component is generated.
  • the programming support device 1 displays the ST program, if the circuit display component corresponding to the block in the ST program exists, the user can determine which block in the ST program the circuit display component corresponds to. Display in a recognizable format.
  • the display unit 5 of the programming support device 1 displays the ST program and the circuit display component 501 in a separate window, and which part (block) of the ST program is displayed by the circuit display component 501 being displayed. ) Is supported by enclosing the relevant part with a broken line to notify the user.
  • FIG. 15 is a diagram showing a second example of a method of displaying circuit display components by the programming support device 1
  • FIG. 16 is a diagram showing a third example of a method of displaying circuit display components by the programming support device 1.
  • the display unit 5 of the programming support device 1 displays the circuit display component 502 together with the corresponding portion of the ST program.
  • the display unit 5 of the programming support device 1 displays the circuit display component 503 in a balloon display overlaid on the corresponding portion of the ST program.
  • the display unit 5 has a circuit display component corresponding to the block of the ST program at the cursor position.
  • the circuit display component 503 is displayed.
  • the display unit 5 displays the circuit display component 503 if one of the blocks of the ST program is selected with the mouse and the right click is performed, if the corresponding circuit display component exists. May be good.
  • the programming support device 1 has a function of accepting the setting of the display attribute of the circuit display component from the user.
  • the display attributes can be set individually for each circuit display component.
  • FIG. 17 is a diagram showing an example of a display attribute setting screen of the circuit display component.
  • the user determines whether or not to display the circuit display component (the circuit display component is not displayed), the color used when filling the display of the circuit display component (fill color), and the display of the circuit display component. It is possible to set the transmittance of the circuit display component, the scaling factor of the display of the circuit display component, the condition for displaying the circuit display component (display condition), and whether or not the editing of the circuit display component is prohibited (editing of the circuit display component is prohibited). It is possible.
  • the programming support device 1 may display the corresponding circuit display components together when displaying the ST program. do not.
  • the programming support device 1 When the "Always display” check box of the display condition is checked, the programming support device 1 always displays the corresponding circuit display component together when displaying the ST program. When the "Device specification” check box of the display condition is checked, the programming support device 1 accepts the device specification and the trigger condition specification, and when displaying the ST program, the specified device is specified. When the set trigger condition is satisfied, the corresponding circuit display component is always displayed together.
  • the device indicates a specific area of the internal memory of the programmable logic controller. "When the device satisfies the specified trigger condition" means "when the data stored in the memory area indicated by the device satisfies the trigger condition".
  • the programming support device 1 causes the user to specify one of the eight types of conditional expressions shown in FIG. 18 as a trigger condition.
  • FIG. 18 is a diagram showing an example of a trigger condition for displaying a circuit display component.
  • the programming support device 1 may accept a specification of a trigger condition different from that shown in FIG. 18 from the user.
  • the programming support device 1 realized by the programming support program according to the present embodiment has a function of converting the ladder program into an ST program for each block. Further, when converting one block of the ladder program into the ST program, the programming support device 1 generates a circuit display component if the predetermined conditions are satisfied. That is, the programming support device 1 determines that the readability of the converted ST program is lowered when the predetermined condition (generation condition) is satisfied, and holds one block of the ladder program to be converted as a circuit display component. Further, when displaying the converted ST program, the programming support device 1 displays the circuit display component in association with the portion determined to be deteriorated in readability.
  • the programming support device 1 includes a machine learning device 82 that learns the generation conditions of the circuit display component, and determines whether or not to generate the circuit display component based on the learning result.
  • the programming support device 1 generates a circuit display component written in a highly readable ladder language for a part where the readability of the ST program is low, and when displaying the ST program, the generated circuit display component is generated. Since they are displayed together, it is possible to prevent the readability from being lowered due to the conversion to the ST program and the efficiency of the work performed on the converted ST program from being lowered.
  • the configuration shown in the above embodiment is an example of the content, can be combined with another known technique, and a part of the configuration is omitted or changed without departing from the gist. It is also possible.
  • 1 programming support device 2 ladder program data storage unit, 3 P code generation unit, 4 data operation unit, 5 display unit, 6 circuit display component storage unit, 7 ST program data storage unit, 8 ST program generation unit, 21 ladder program Data, 71 ST program data, 80 circuit display component generation unit, 81 P code analysis unit, 82 machine learning device, 83 ST template storage unit, 84 program conversion unit, 100 computer, 821 data acquisition unit, 822 state observation unit, 823 learning unit, 301 conversion target program specification screen, 302 left arrow button, 303 right arrow button, 304 check box, 401 display attribute setting screen, 501 to 503 circuit display parts.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Automation & Control Theory (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Programmable Controllers (AREA)

Abstract

プログラミング支援プログラムは、ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する第1の変換ステップと、第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換ステップと、第2のプログラムの1ブロックごとの解析結果が定められた条件を満たすと、条件を満たすブロックの内容を表す回路表示部品を生成する回路表示部品生成ステップと、第3のプログラムおよび回路表示部品を、回路表示部品が第3のプログラムのどのブロックに対応するか認識可能な形式で表示する表示ステップと、を電子計算機(100)に実行させる。

Description

プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法
 本開示は、プログラマブルロジックコントローラが実行するプログラムの作成支援に用いられるプログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法に関する。
 従来、プログラマブルロジックコントローラが実行するプログラムは、ラダー言語およびFBD(Function Block Diagram)言語といった、可読性が高いプログラムで記述することが一般的であった。これに対し、近年は、ラダー言語などの代わりにST(Structured Text)言語のような手続型言語を使用してプログラムを記述する要望も高まってきている。
 プログラムの開発では、過去に開発したプログラムを流用して新たなプログラムの作成作業を効率的に行うことが広く行われている。ここで、新たなプログラムを作成する場合、例え同じハードウェアで使用するプログラムであっても、作成しようとしているプログラムとは異なるプログラム言語で記述されたプログラムを直接流用することはできない。そのため、あるプログラム言語で記述されたプログラムを他のプログラム言語で記述されたプログラムに変換する技術が提案されている(例えば、特許文献1)。
特開2001-22412号公報
 ラダー言語で記述されたプログラムを手続型言語で記述されたプログラムに変換した場合、プログラムの可読性が低下するという問題がある。可読性は、変換する前のプログラムのブロックが複雑な構成になればなるほど低下する。可読性が低下すると、プログラムの開発および編集といった作業の効率も低下する。
 本開示は、上記に鑑みてなされたものであって、手続型言語以外のプログラム言語で記述したプログラムを手続型言語で記述したプログラムに変換した場合に、プログラムの可読性の低下に伴い作業効率が低下するのを防止することが可能なプログラミング支援プログラムを得ることを目的とする。
 上述した課題を解決し、目的を達成するために、本開示にかかるプログラミング支援プログラムは、ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する第1の変換ステップと、第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換ステップとを含む。また、プログラミング支援プログラムは、第2のプログラムの1ブロックごとの解析結果が定められた条件を満たすと、条件を満たすブロックの内容を表す回路表示部品を生成する回路表示部品生成ステップと、第3のプログラムおよび回路表示部品を、回路表示部品が第3のプログラムのどのブロックに対応するか認識可能な形式で表示する表示ステップと、をコンピュータに実行させる。
 本開示にかかるプログラミング支援プログラムは、手続型言語以外のプログラム言語で記述したプログラムを手続型言語で記述したプログラムに変換した場合に、プログラムの可読性の低下に伴い作業効率が低下するのを防止することができる、という効果を奏する。
実施の形態にかかるプログラミング支援装置の機能ブロック構成の一例を示す図 プログラミング支援装置による第1のSTプログラム生成動作を示すフローチャート 変換対象プログラム指定画面の一例を示す図 プログラミング支援装置がラダープログラムをSTプログラムに変換する動作の概要を示す図 プログラミング支援装置が備える機械学習装置の機能ブロック構成を示す図 機械学習装置が機械学習に用いる学習用データの構成例を示す図 ニューラルネットワークの構成例を示す図 機械学習装置での学習に使用する学習用データの第1の例を示す図 機械学習装置での学習に使用する学習用データの第2の例を示す図 プログラミング支援装置による第2のSTプログラム生成動作を示すフローチャート 変換コード対応テーブルの一例を示す図 プログラミング支援装置によるプログラム表示動作を示すフローチャート プログラミング支援装置による回路表示部品編集動作を示すフローチャート プログラミング支援装置による回路表示部品の表示方法を説明するための図 プログラミング支援装置による回路表示部品の表示方法の第2の例を示す図 プログラミング支援装置による回路表示部品の表示方法の第3の例を示す図 回路表示部品の表示属性設定画面の一例を示す図 回路表示部品を表示するトリガ条件の一例を示す図
 以下に、本開示の実施の形態にかかるプログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法を図面に基づいて詳細に説明する。
実施の形態.
 本実施の形態では、プログラマブルロジックコントローラが実行するプログラムの開発に用いられるプログラミング支援装置について説明する。このプログラミング支援装置は、ラダー言語で記述されたプログラムであるラダープログラムをST言語で記述されたプログラムであるSTプログラムに変換する機能を有する。図1は、実施の形態にかかるプログラミング支援装置の機能ブロック構成の一例を示す図である。図1に示すプログラミング支援装置1は、プログラマブルロジックコントローラが実行するプログラムの開発に用いられる。
 プログラミング支援装置1は、ラダープログラムデータ格納部2、Pコード生成部3、データ操作部4、表示部5、回路表示部品格納部6、STプログラムデータ格納部7およびSTプログラム生成部8を備える。
 ラダープログラムデータ格納部2は、ラダープログラムのデータであるラダープログラムデータ21を格納する。Pコード生成部3は、ラダープログラムを中間言語であるPコードで記述されたプログラムに変換する。Pコード生成部3は、ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する変換する第1の変換部である。ここで、コンピュータはプログラミング言語で記述されたプログラムの内容を理解することができない。そのため、プログラミング言語で記述されたプログラムをコンピュータが解読可能なマシン語に変換する必要がある。このとき、プログラミング言語で記述されたプログラムをマシン語のプログラムに直接変換することはせずに、中間表現のプログラムに一度変換した後、さらにマシン語のプログラムに再変換することが一般的である。中間言語は、プログラミング言語で記述されたプログラムを中間表現とする場合に用いられる。中間言語には様々な種類が存在し、中間言語は中間コードと称される場合もある。Pコードは、中間表現のプログラムを作成する場合に用いられる様々な種類の中間言語の中の1種である。データ操作部4は、プログラミング支援装置1が取り扱うデータに対する編集操作などの操作をユーザから受け付ける。表示部5は、ユーザに対してプログラムの確認画面、編集画面などの各種画面を表示する。回路表示部品格納部6は、後述する回路表示部品を格納する。STプログラムデータ格納部7は、STプログラムのデータであるSTプログラムデータ71を格納する。STプログラム生成部8は、Pコードで記述されたプログラムをSTプログラムに変換する。
 STプログラム生成部8は、Pコード解析部81、機械学習装置82、STテンプレート格納部83およびプログラム変換部84を備える。Pコード解析部81および機械学習装置82は回路表示部品生成部80を構成する。
 Pコード解析部81は、Pコードで記述されたプログラムであるPコードプログラムを解析してプログラムの構造に関するデータを生成するとともに、生成したデータが定められた条件を満たす場合に回路表示部品を生成する。機械学習装置82は、Pコード解析部81が生成したデータおよびデータ操作部4から入力されるデータに基づき、Pコード解析部81が回路表示部品を生成する条件を学習する。STテンプレート格納部83は、PコードプログラムをSTプログラムに変換するためのテンプレートを格納する。プログラム変換部84は、PコードプログラムをSTプログラムに変換する。プログラム変換部84は、第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換部である。
 ここで、プログラミング支援装置1は、図1に示すように電子計算機100で実現される。電子計算機100は例えばパーソナルコンピュータであり、CPU(Central Processing Unit)、記憶装置、表示装置、入力装置、通信装置などで構成される。記憶装置は、RAM(Random Access Memory)、ROM(Read Only Memory)、フラッシュメモリー、等の、不揮発性または揮発性の半導体メモリ、磁気ディスク等である。表示装置は液晶ディスプレイ等であり、表示部5を実現する。入力装置はマウス、キーボードなどである。通信装置はネットワークインタフェースカードなどである。なお、図1では、電子計算機100が表示装置を備える構成例について示したが、表示装置は電子計算機100から独立した別の装置であってもよい。
 プログラミング支援装置1が有する各機能は、電子計算機100のCPUおよび記憶装置で実現される。すなわち、プログラミング支援装置1が有する各機能を実現するためのプログラムであるプログラミング支援プログラムを記憶装置に格納しておき、CPUが記憶装置に格納されたプログラムを読み出して実行することにより、プログラミング支援装置1が有する各機能が実現される。また、プログラミング支援装置1のラダープログラムデータ格納部2、回路表示部品格納部6およびSTプログラムデータ格納部7は電子計算機100の記憶装置で実現される。なお、電子計算機100の入力装置はユーザがプログラミング支援装置1を操作する場合に利用される。電子計算機100の通信装置は、プログラミング支援装置1が電子計算機100の外部の装置と通信する場合に利用される。上記のプログラミング支援プログラムは、例えば、CD(Compact Disc)-ROM、DVD(Digital Versatile Disc)-ROMなどの記憶媒体に書き込まれた状態でユーザに供給される。上記のプログラミング支援プログラムは、インターネットなどを介してユーザに供給される形態であってもよい。
 つづいて、プログラミング支援装置1の動作の詳細について説明する。具体的には、機械学習装置82による学習が済んでいない状態でラダープログラムを変換してSTプログラムを生成する動作(第1のSTプログラム生成動作とする)と、機械学習装置82による学習が済んでいる状態でラダープログラムを変換してSTプログラムを生成する動作(第2のSTプログラム生成動作とする)と、変換後のSTプログラムとともに回路表示部品を表示する動作(プログラム表示動作とする)と、生成済みの回路表示部品を編集する動作(回路表示部品編集動作とする)とについて、それぞれ説明する。
[第1のSTプログラム生成動作]
 機械学習装置82による学習が済んでいない状態のときにプログラミング支援装置1がラダープログラムを変換してSTプログラムを生成する第1のSTプログラム生成動作について説明する。この第1のSTプログラム生成動作において、プログラミング支援装置1は、ラダープログラムをSTプログラムに変換するとともに、回路表示部品を生成する条件の学習を行う。
 図2は、プログラミング支援装置1による第1のSTプログラム生成動作を示すフローチャートである。プログラミング支援装置1は、STプログラムの生成開始を指示する操作を受け付けた時点で機械学習装置82による学習すなわち回路表示部品を生成する条件の学習が完了していない場合、第1のSTプログラム生成動作を開始する。
 第1のSTプログラム生成動作では、まず、データ操作部4が、変換するプログラムの指定を受け付ける(ステップS101)。このステップS101において、データ操作部4は表示部5と連携し、例えば、図3に示す変換対象プログラム指定画面301を表示部5に表示させて、ユーザからの操作を受け付ける。図3は、変換対象プログラム指定画面301の一例を示す図である。データ操作部4は、ラダープログラムデータ21に含まれるラダープログラムのうち、どのラダープログラムをSTプログラムへの変換対象とするかの指定をユーザより受け付ける。また、データ操作部4は、変換対象としたラダープログラムそれぞれについて、実際に変換する範囲の選択(変換範囲選択)を受け付ける。なお、変換範囲選択の受け付けは必須ではなく、ユーザは変換範囲選択の入力を省略してもよい。変換範囲選択の入力が省略された場合、プログラミング支援装置1は、変換対象とされたプログラムの全体が変換範囲であるものとして取り扱う。なお、ユーザは、「全体」と記載された欄の中のプログラムを選択して左矢印ボタン302をクリックすることで、選択したプログラムを変換対象のプログラムに追加することができる。また、ユーザは、「変換対象」と記載された欄の中のプログラム(変換対象のプログラム)を選択して右矢印ボタン303をクリックすることで、選択したプログラムを変換対象のプログラムから除外することができる。また、変換対象プログラム指定画面301は、回路表示部品を強制的に作成する指定を受け付けるためのチェックボックス304を含む。チェックボックス304にチェックが入っている場合、プログラミング支援装置1は、変換対象のプログラムを構成する全てのブロックについて、回路表示部品を作成する条件を満たしているか否かに関係なく回路表示部品を作成する。なお、これ以降では、チェックボックス304にチェックが入っていないものとして説明を行う。
 変換ボタンがクリックされるとステップS101が終了となりステップS102に遷移する。
 ステップS101が終了すると、次に、Pコード生成部3が、ラダープログラムデータ21からステップS101で指定されたラダープログラムを取得し(ステップS102)、取得したラダープログラムを構成する各ブロックをPコードに変換してPコードプログラムを生成する(ステップS103)。
 次に、Pコード解析部81が、Pコードプログラムの1ブロックごとに条件部と実行部を判定する(ステップS104)。ここで、一般的にラダープログラムは、接点命令および比較演算命令といった命令からなる条件部と、文字列処理、実数処理、出力命令などからなる実行部とに分ける事ができる。これはSTプログラムに変換する場合、IF文における条件式と実行文とに置き換える事ができる。そのため、ステップS104において、Pコード解析部81は、図4の手順2に示すように、Pコードで記述されたプログラム(Pコードプログラム)を解析し、IF文の条件文に相当するコードと実行文に相当するコードとを判別し、それぞれを条件部および実行部とする。図4は、プログラミング支援装置1がラダープログラムをSTプログラムに変換する動作の概要を示す図である。図4では、ラダープログラムの1つのブロックをSTプログラムに変換する動作の概要を示している。図4に示す手順1は、上記のステップS103に相当する。
 ステップS104の処理が終了した後は、ステップS104で判定処理を行った1ブロックを対象として、ステップS105~S107に示すSTプログラム生成処理とステップS401~S403に示す学習処理とが並列に実行される。以下では、ステップS105~S107のSTプログラム生成処理と、ステップS401~S403の学習処理とに分けて説明する。
(STプログラム生成処理)
 STプログラム生成処理では、上記のステップS104に続いて、プログラム変換部84が、STテンプレート格納部83から変換処理用のテンプレートを取得し(ステップS105)、テンプレートを使用してSTプログラムを作成する(ステップS106)。すなわち、図4の手順3に示すように、プログラム変換部84は、Pコード解析部81がPコードプログラムを解析した結果をテンプレートに当てはめ、STプログラムを作成する。プログラム変換部84は、作成したSTプログラムをSTプログラムデータ格納部7に格納する(ステップS107)。
(学習処理)
 ステップS401~S403の学習処理は、機械学習装置82が行う。機械学習装置82の機能ブロック構成は図5に示したものとなる。図5は、プログラミング支援装置1が備える機械学習装置82の機能ブロック構成を示す図である。すなわち、機械学習装置82は、機械学習に用いる教師データを取得するデータ取得部821と、Pコード解析部81から入力される状態変数を観測する状態観測部822と、データ取得部821が取得した教師データおよび状態観測部822による状態変数の観測結果に基づいて回路表示部品の生成条件を学習する学習部823とを備える。
 図6は、機械学習装置82が機械学習に用いる学習用データの構成例を示す図である。学習用データは、データ取得部821が取得する教師データと、状態観測部822が観測する状態変数とで構成される。図6に示す入力1~入力3は、Pコード解析部81から機械学習装置82に入力されるデータであり、状態観測部822が観測する状態変数に相当する。入力1~入力3のデータは、変換する対象のラダープログラムの構成に関する情報を含む。入力1の「1命令を実行するための条件数」は、1命令を実行するために影響を与える条件の数を示す。これは単純に回路を構成する条件の数が増えると、IF文の条件文の項数が増え、条件式が複雑になるためである。入力2の「1条件を共有する命令数」は、1条件を共有する命令の数を条件ごとに示す。この条件のうち、ANDやORでまとめられる箇所はまとめて設定する。入力2の「1条件を共有する命令数」はIF文の分岐数に影響する。入力3の「回路を構成するANB、ORB、MPS、MRD、MPPの数」は、回路ブロック直列接続命令であるANBの数と、回路ブロック並列接続命令であるORBの数と、演算結果プッシュ命令であるMPSの数と、演算結果読み出し命令であるMRDの数と、演算結果ポップ命令であるMPPの数と、を示す。入力3のデータは回路構成の複雑度を示す。本実施の形態では、教師データは、ラダープログラムを変換して得られたSTプログラムを確認したユーザが、確認したSTプログラムに対応する回路表示部品の生成が必要か否かを判断した結果のデータとする。
 機械学習装置82による学習処理では、上記のステップS104に続いて、状態観測部822が、Pコード解析部81からプログラムの解析結果を取得する(ステップS401)。すなわち、ステップS401において、状態観測部822は、Pコード解析部81から入力される、図6に示す入力1~入力3のデータを状態変数として観測する。
 次に、上記のステップS106で作成されたSTプログラムを元にユーザが回路表示部品の生成有無を判定し、判定結果を教師データとする(ステップS402)。このステップS402では、表示部5が、ステップS106でプログラム変換部84が生成したSTプログラムをSTプログラムデータ格納部7から読み出して表示する。また、データ操作部4が、表示部5が表示しているSTプログラムに対応する回路表示部品を生成する必要があるか否かの判定結果の入力をユーザから受け付け、図6に示す教師データとして機械学習装置82に出力する。機械学習装置82では、データ取得部821が、データ操作部4から教師データを取得する。ステップS401およびS402が終了すると、図6に示す構成の学習用データが得られる。
 次に、学習部823が、学習用データに基づいて、回路表示部品を生成する条件を学習する(ステップS403)。
 ステップS403について詳しく説明する。ステップS403において、学習部823は、状態観測部822が観測した状態変数およびデータ取得部821が取得した教師データの組合せに基づいて作成されるデータセットに基づいて、回路表示部品の生成条件を学習する。ここで、データセットは状態変数および教師データを互いに関連付けたデータである。
 なお、機械学習装置82は、プログラミング支援装置1において、回路表示部品の生成条件を学習するために使用されるが、例えば、ネットワークを介してプログラミング支援装置1に接続され、このプログラミング支援装置1とは別個の装置であってもよい。この場合、機械学習装置82は、クラウドサーバ上に存在していてもよい。
 学習部823は、例えば、ニューラルネットワークモデルに従って、いわゆる教師あり学習により回路表示部品の生成条件を学習する。ここで、教師あり学習とは、ある入力と結果(ラベル)のデータの組であるデータセットを大量に学習部823に与えることで、それらのデータセットにある特徴を学習し、入力から結果を推定するモデルをいう。
 ニューラルネットワークは、複数のニューロンからなる入力層と、複数のニューロンからなる中間層(隠れ層)と、複数のニューロンからなる出力層とで構成される。中間層は、1層、又は2層以上でもよい。
 図7は、ニューラルネットワークの構成例を示す図である。例えば、図7に示すような3層のニューラルネットワークであれば、複数の入力が入力層に入力層(X1-X3)に入力されると、その値に重みW1(w11-w16)を掛けて中間層(Y1-Y2)に入力され、その結果にさらに重みW2(w21-w26)を掛けて出力層(Z1-Z3)から出力される。この出力結果は、重みW1およびW2の値によって変わる。
 本実施の形態において、ニューラルネットワークは、上記のデータセットに従って、いわゆる教師あり学習により、ラダープログラムをSTプログラムに変換した際にユーザが見やすくなる回路表示部品の生成条件を学習する。すなわち、ニューラルネットワークは、入力層に状態変数を入力して出力層から出力された結果が、教師データの値に近づくように重みW1およびW2を調整することで、回路表示部品の生成条件を学習する。
 また、ニューラルネットワークは、いわゆる教師なし学習によって、回路表示部品の生成条件を学習することもできる。教師なし学習とは、入力データのみを大量に機械学習装置に与えることで、入力データがどのような分布をしているか学習し、対応する教師出力データを与えなくても、入力データに対して圧縮、分類、整形等を行う装置を学習する手法である。ニューラルネットワークは、入力データにある特徴を似た者どうしにクラスタリングすること等ができる。この結果を使って、何らかの基準を設けてそれを最適にするような出力の割り当てを行うことで、出力の予測を実現することができる。また、教師なし学習と教師あり学習の中間的な問題設定として、半教師あり学習と呼ばれるものもある。半教師あり学習では、一部のみ入力データと教師データのデータセットが存在し、それ以外は入力データのみの学習用データを使用する。
 学習部823は、複数のプログラミング支援装置1に対して作成されるデータセットに従って回路表示部品の生成条件を学習するようにしてもよい。なお、学習部823は、同一の現場で使用される複数のプログラミング支援装置1からデータセットを取得してもよいし、異なる現場で独立して使用されるプログラミング支援装置1からデータセットを取得してもよい。さらに、データセットを収集するプログラミング支援装置1を学習の途中で対象に追加し、或いは、逆に対象から除去することも可能である。また、あるプログラミング支援装置1に関して回路表示部品の生成条件を学習した機械学習装置82を、これとは別のプログラミング支援装置1に取り付け、当該別のプログラミング支援装置1に関して回路表示部品の生成条件を再学習して更新するようにしてもよい。
 また、学習部823に用いられる学習アルゴリズムとしては、特徴量そのものの抽出を学習する深層学習(Deep Learning)を用いることもできる。また、学習部823は、他の公知の方法、例えば遺伝的プログラミング、機能論理プログラミング、サポートベクターマシンなどに従って学習を実行してもよい。
 本実施の形態で使用する学習用データの具体例を説明する。図8は、機械学習装置82での学習に使用する学習用データの第1の例を示す図である。図8では、学習用データの根拠となるラダープログラムと、変換後のSTプログラムを併せて記載している。図8に示す第1の例の学習用データは、教師データが「回路表示部品生成なし」の場合、すなわち、回路表示部品を生成しないことをユーザが選択した場合の例である。
 入力1のデータは、「Y0,8」および「Y1,8」を含む。「Y0,8」は、出力Y0の値に影響する条件部がX0~X7の8条件である事を表す。「Y1,8」も同様である。
 入力2のデータは、「X0 AND X1,2」、「X2 AND X3,2」、「X4 AND X5,2」および「X6 AND X7,2」を含む。「X0 AND X1,2」は、X0とX1をAND演算でまとめ1条件として扱い、この条件をY0およびY1の2命令が使用することを表す。「X2 AND X3,2」、「X4 AND X5,2」および「X6 AND X7,2」も同様である。
 入力3のデータは、「ANB,1」、「ORB,2」、「MPS,0」、「MRD,0」および「MPP,0」を含む。「ANB,1」は、回路ブロック直列接続命令であるANBが1箇所であることを表す。「ORB,2」は、回路ブロック並列接続命令であるORBが2箇所であることを表す。「MPS,0」は、演算結果プッシュ命令であるMPSが存在しないことを表す。「MRD,0」は、演算結果読み出し命令であるMRDが存在しないことを表す。「MPP,0」は、演算結果ポップ命令であるMPPが存在しないことを表す。
 第1の例では、IF文の深さが2段、IF文の条件式の論理演算項数は2項が最大となり、変換後のSTプログラムから容易に元のラダープログラムを推測できるため、ユーザは回路表示部品の生成が必要ないと判断している。
 図9は、機械学習装置82での学習に使用する学習用データの第2の例を示す図である。図8と同様に、図9では、学習用データの根拠となるラダープログラムと、変換後のSTプログラムを併せて記載している。図9に示す第2の例の学習用データは、教師データが「回路表示部品生成」の場合、すなわち、回路表示部品を生成することをユーザが選択した場合の例である。
 入力1のデータは、「Y0,9」、「Y1,9」、「Y2,10」、「Y3,1」を含む。入力2のデータは、「X0,4」、「X1 OR X4 OR X5,3」、「X2,3」、「X3,1」、「X6,3」、「X7 OR X8,3」、「X9,2」および「X10,1」を含む。入力3のデータは、「ANB,3」、「ORB,1」、「MPS,2」、「MRD,0」および「MPP,2」を含む。
 第2の例では、入力1のデータが、1命令を実行するための条件数が多い事を表し、入力2のデータが、X1~X10の条件がY0~Y2の出力値に関係することを表し、入力3のデータが、直列回路ブロックおよび並列回路ブロックがあること、スタックを使用した計算を行う必要がある回路であること、を表している。変換後のSTプログラムから元のラダープログラムの構成を推測できることが難しいため、ユーザは回路表示部品の生成が必要と判断している。
 図2の説明に戻り、ステップS105~S107のSTプログラム生成処理およびステップS401~S403の学習処理が終了すると、STプログラム生成部8は、変換対象のプログラムの全ブロックの解析、すなわち、全ブロックについて、STプログラムへの変換処理および回路表示部品の生成条件の学習処理が終了したかを確認する(ステップS108)。全ブロックの解析が終了した場合(ステップS108:Yes)、図2に示す動作は終了となる。一方、全ブロックの解析が終了していない場合(ステップS108:No)、ステップS104に戻る。
 以上の第1のSTプログラム生成動作は、上記のステップS401~S403に示す学習動作が繰り返され、回路表示部品の生成条件の学習が十分に進むまで行う。回路表示部品の生成条件の学習が十分に進んだかどうかは、例えば、ステップS401~S403を繰り返した回数が定められた値に達したかどうかで判断する。
[第2のSTプログラム生成動作]
 つづいて、機械学習装置82による学習が済んでいる状態のときにプログラミング支援装置1がラダープログラムを変換してSTプログラムを生成する第2のSTプログラム生成動作について説明する。この第2のSTプログラム生成動作において、プログラミング支援装置1は、ラダープログラムをSTプログラムに変換するとともに、機械学習装置82による学習結果を使用して、回路表示部品の生成が必要か否か判断する。すなわち、機械学習装置82による学習結果は、回路表示部品の生成条件が成立しているか否かの判定処理に用いられる。プログラミング支援装置1は、回路表示部品の生成が必要と判断すると、回路表示部品を生成する。
 図10は、プログラミング支援装置1による第2のSTプログラム生成動作を示すフローチャートである。プログラミング支援装置1は、STプログラムの生成開始を指示する操作を受け付けた時点で機械学習装置82による学習すなわち回路表示部品を生成する条件の学習が完了している場合、第2のSTプログラム生成動作を開始する。
 図10に示すフローチャートは、図2に示すフローチャートからステップS401~S403を削除し、ステップS109~S111を追加した構成である。図10に示すフローチャートのステップS101~S108は、図2に示すフローチャートのステップS101~S108と同一であるため、説明を省略する。
 第2のSTプログラム生成動作では、ステップS104の次に、上述したステップS105~S107のSTプログラム生成処理と並列に、ステップS109~S111を実行する。具体的には、Pコード解析部81が、回路表示部品を生成するか否かを判定する(ステップS109)。ステップS109において、Pコード解析部81は、機械学習装置82による学習結果と、変換対象のラダープログラムの解析結果とに基づいて、回路表示部品を生成するか否かを判定する。ここでの変換対象のラダープログラムの解析結果とは、機械学習装置82が回路表示部品の生成条件を学習する際に使用するものと同様の解析結果であり、具体的には、図6などに示す学習用データの入力1~入力3と同様のデータである。
 回路表示部品を生成すると判断した場合(ステップS109:Yes)、Pコード解析部81は、回路表示部品を生成して回路表示部品格納部6に格納し(ステップS110)、変換コード対応テーブルに情報を格納する(ステップS111)。ステップS110において、Pコード解析部81は、ラダープログラムから1つのブロックを抽出し、これを回路表示部品として回路表示部品格納部6に格納する。ラダープログラムから抽出する対象のブロックは、ステップS104で判定対象としたPコードプログラム内のブロックに対応するブロックであり、例えば、図4に示す手順1でPコードへ変換される、ラダープログラム内の1ブロックが該当する。ステップS111で情報を格納する変換コード対応テーブルとは、変換前のラダープログラムと変換後のSTプログラムの対応関係を示す各種情報が登録されるテーブルである。より詳細には、変換コード対応テーブルは、変換前のラダープログラムのどの部分(ブロック)と変換後のSTプログラムのどの部分(ブロック)が対応しているかを示す情報、STプログラムを構成するブロックのそれぞれについて、対応する回路表示部品が存在するか否かを示す情報、生成された回路表示部品のそれぞれがSTプログラムのどのブロックに対応しているかを示す情報、などが登録されるテーブルである。変換コード対応テーブルは例えば回路表示部品格納部6が保持する。なお、回路表示部品生成部80または表示部5が変換コード対応テーブルを保持するようにしてもよい。
 図11は、変換コード対応テーブルの一例を示す図である。変換コード対応テーブルを構成する各レコードには、変換対象のラダープログラムを構成する各ブロックの中のいずれか一つについての情報が格納される。つまり、変換コード対応テーブルには、変換対象のラダープログラムを構成するブロックのそれぞれに対応するレコードが含まれる。変換コード対応テーブルの1つのレコードには、ラダープログラム名、STプログラム名、LD位置情報、部品有無、部品番号およびST位置情報が登録される。「ラダープログラム名」は、変換前のラダープログラムの名称であり、「STプログラム名」は、変換後のSTプログラムの名称である。「LD位置情報」は、変換前のダラープログラム内の位置を示す情報であり、ラダープログラムを構成する各ブロックの中の1つを示す。すなわち、「LD位置情報」は、ラダープログラム内のどの位置のブロックであるかを示す。「部品有無」は、LD位置情報が示すブロックに対応する回路表示部品の有無を示す情報である。「部品有無=TRUE」は回路表示部品が存在することを示し、「部品有無=FALSE」は回路表示部品が存在しないことを示す。「部品番号」は回路表示部品に付与された管理番号であり、「部品有無=TRUE」の場合は数値が入り、「部品有無=FALSE」の場合は「-」となる。「ST位置情報」は、同一レコードのLD位置情報が示すラダープログラム内の位置(ブロック)に対応する、STプログラム内の位置(ブロック)を示す情報である。
 回路表示部品を生成しないと判断した場合(ステップS109:No)、Pコード解析部81は、ステップS110を実行せずにステップS111を実行する。なお、変換コード対応テーブルは、ラダープログラムを変換して生成したSTプログラムを表示部5が表示する際に利用される。
 ステップS111を実行した後、STプログラム生成部8は、変換対象のプログラムの全ブロックの解析が終了したかを確認する(ステップS108)。
 なお、本実施の形態では、機械学習が済んでいる場合にプログラミング支援装置1が回路表示部品を生成する必要があるか否かを判断し、必要と判断した場合に回路表示部品を生成することとした。すなわち、第1のSTプログラム生成動作では、回路表示部品を生成する必要があるか否かをユーザが判断するが、回路表示部品を実際に生成することは行わないこととした。しかし、第1のSTプログラム生成動作においても回路表示部品を生成するようにしてもよい。第1のSTプログラム生成動作においても回路表示部品を生成する場合は、例えば、第1のSTプログラム生成動作を示す図2のフローチャートのステップS402でユーザが回路表示部品の生成が必要と判断したときに、上述したステップS110およびS111と同様の処理を実行するようにすればよい。または、機械学習が済んでいない状態のときは予め定められた条件を用いて回路表示部品を生成する必要があるか否かを判断し、必要と判断した場合には回路表示部品を生成するようにすればよい。この場合、例えば、図2に示すフローチャートのステップS105~S107の処理およびステップS401~S403の処理と並列に、図10に示すステップS109~S111と同様の処理を行うようにする。このときの回路表示部品を生成するか否かの判断に用いる条件は、例えば、「IFの入れ子が3つ以上かつ条件文の項数が5以上のIF文がSTプログラムに含まれる場合」とする。IFの入れ子の数および条件文の項数は一例であり、これらの数に限定するものではない。
[プログラム表示動作]
 つづいて、STプログラムデータ格納部7に格納されているSTプログラムデータ71を表示部5が表示するプログラム表示動作について説明する。
 図12は、プログラミング支援装置1によるプログラム表示動作を示すフローチャートである。プログラミング支援装置1は、STプログラムデータ格納部7に格納されているSTプログラムデータ71の表示部5への表示開始を指示する操作をユーザから受け付けると、プログラム表示動作を開始する。
 プログラム表示動作では、まず、表示部5が、変換コード対応テーブル(図11参照)の1レコードを取得し(ステップS201)、回路表示部品が存在するかを確認する(ステップS202)。すなわち、表示部5は、ステップS201では、ステップS201で取得したレコード内の「部品有無」が、回路表示部品が存在する旨を示しているか(TRUEであるか)を確認する。
 回路表示部品が存在する場合(ステップS202:Yes)、表示部5は、該当の回路表示部品、すなわち、ステップS201で取得したレコード内の「部品番号」に対応する回路表示部品を回路表示部品格納部6から取得する(ステップS203)。次に、表示部5は、ステップS203で取得した回路表示部品を表示するとともに(ステップS204)、STプログラムを表示する(ステップS205)。ステップS205において、表示部5は、ステップS201で取得したレコード内の「ST位置情報」が示す、STプログラム内のブロックを表示する。表示部5は、回路表示部品およびSTプログラムを表示する際、回路表示部品がSTプログラムのどの部分(ブロック)を表しているのかをユーザが認識可能な形式で表示する。表示部5が、回路表示部品およびSTプログラムをどのような形式で表示するかの詳細については別途説明する。
 回路表示部品が存在しない場合(ステップS202:No)、表示部5は、ステップS203およびS204は実行せずに、STプログラムを表示する(ステップS205)。
 表示部5は、ステップS205を実行した後、変換コード対応テーブルの全レコードの処理が終了したか、すなわち、全レコードについて、ステップS201~S205を実行したか、を確認する(ステップS206)。全レコードの処理が終了した場合(ステップS206:Yes)、図12に示す動作は終了となる。一方、全レコードの処理が終了していない場合(ステップS206:No)、ステップS201に戻る。
[回路表示部品編集動作]
 つづいて、生成済みの回路表示部品を編集する動作について説明する。
 図13は、プログラミング支援装置1による回路表示部品編集動作を示すフローチャートである。プログラミング支援装置1は、回路表示部品格納部6に格納されている回路表示部品の編集開始を指示する操作をユーザから受け付けると、回路表示部品編集動作を開始する。
 回路表示部品編集動作では、まず、データ操作部4が、回路表示部品の内容変更操作を受け付ける(ステップS301)。回路表示部品の内容変更操作は、生成済みの回路表示部品の編集が可能であればどのようなものであってもよい。回路表示部品の内容変更操作受け付ける動作の一例を簡単に説明する。例えば、プログラミング支援装置1は、回路表示部品格納部6に格納されている回路表示部品の編集開始を指示する操作をデータ操作部4で受け付けると、回路表示部品格納部6に格納済みの回路表示部品のリストを表示部5に表示し、編集対象の回路表示部品の指定をデータ操作部4で受け付ける。次に、プログラミング支援装置1は、指定された回路表示部品の編集作業画面を表示部5に表示し、回路表示部品を変更する操作をデータ操作部4が受け付ける。本実施の形態では、回路表示部品はラダープログラムを構成する1つのブロックであるため、回路表示部品を変更する操作は、ラダープログラムを変更する一般的な操作と同様の操作となる。
 ユーザによる回路表示部品の内容変更操作が終了すると、変更後の回路表示部品を回路表示部品格納部6に格納する(ステップS302)。ステップS302が終了すると、プログラミング支援装置1はステップS103~S111を実行するが、これらのステップは、図10に示すフローチャートのステップS103~S111と同様の処理であるため説明は省略する。
 つづいて、プログラミング支援装置1が回路表示部品を表示する方法の具体例について説明する。図14は、プログラミング支援装置1による回路表示部品の表示方法を説明するための図である。上述したように、プログラミング支援装置1は、ラダープログラムをSTプログラムに変換する際、回路表示部品の生成条件が成立すると、すなわち、ラダープログラムを構成するあるブロックをSTプログラム(ST言語での記述)に変換すると可読性が落ちると判断すると、回路表示部品を生成する。また、プログラミング支援装置1は、STプログラムを表示する際、STプログラム内のブロックに対応する回路表示部品が存在していれば、回路表示部品がSTプログラム内のどのブロックに対応するかをユーザが認識可能な形式で表示する。STプログラムとともに回路表示部品を表示することにより、STプログラムを確認する際の可読性が落ちるのを防止することができ、STプログラムのコーディングおよびデバッグといった作業の効率が低下するのを防止できる。図14に示す例の場合、プログラミング支援装置1の表示部5は、STプログラムと回路表示部品501とを別ウインドウで表示し、また、表示中の回路表示部品501がSTプログラムのどの部分(ブロック)に対応しているかを、該当部分を破線で囲んでユーザに通知する。
 図14に示す表示方法では、STプログラムと回路表示部品501とを別ウインドウで表示しているが、その他の表示方法として図15および図16に示す表示方法としてもよい。図15は、プログラミング支援装置1による回路表示部品の表示方法の第2の例を示す図、図16は、プログラミング支援装置1による回路表示部品の表示方法の第3の例を示す図である。
 図15に示す第2の例では、プログラミング支援装置1の表示部5は、回路表示部品502を、STプログラムの対応する箇所に一緒に表示する。図16に示す第3の例では、プログラミング支援装置1の表示部5は、回路表示部品503を、吹き出し表示によりSTプログラムの対応する箇所に重ねて表示する。図16に示す例の場合、表示部5は、例えば、マウスのカーソルがSTプログラムの上に置かれた状態のとき、カーソル位置のSTプログラムのブロックに対応する回路表示部品が存在していれば、回路表示部品503を表示する。表示部5は、STプログラムのブロックの1つがマウスで選択され、右クリックが行われた場合に、対応する回路表示部品が存在していれば回路表示部品503を表示するようにする、などとしてもよい。
 また、プログラミング支援装置1は、回路表示部品の表示属性の設定をユーザから受け付ける機能を有する。表示属性の設定は回路表示部品ごとに個別に行うことを可能とする。図17は、回路表示部品の表示属性設定画面の一例を示す図である。プログラミング支援装置1は、回路表示部品の表示属性の設定をユーザから受け付ける場合、図17に示すような表示属性設定画面401を表示部5で表示し、表示属性の設定を受け付ける。
 表示属性設定画面401の場合、ユーザは、回路表示部品を表示するか否か(回路表示部品を表示しない)、回路表示部品の表示を塗りつぶす場合に用いる色(塗りつぶし色)、回路表示部品の表示の透過率、回路表示部品の表示の拡縮率、回路表示部品を表示する条件(表示条件)、回路表示部品の編集を禁止するか否か(回路表示部品の編集禁止)、を設定することが可能である。
 表示属性設定画面401の「回路表示部品を表示しない」のチェックボックスにチェックが入っている場合、プログラミング支援装置1は、STプログラムを表示する際に該当の回路表示部品を一緒に表示することはしない。
 表示条件の「常に表示」のチェックボックスおよび「デバイス指定」のチェックボックスについては、いずれか一方のチェックを可能とする。表示条件の「常に表示」のチェックボックスにチェックが入っている場合、プログラミング支援装置1は、STプログラムを表示する際に該当の回路表示部品を常に一緒に表示する。表示条件の「デバイス指定」のチェックボックスにチェックが入っている場合、プログラミング支援装置1は、デバイスの指定およびトリガ条件の指定を受け付け、STプログラムを表示する際には、指定されたデバイスが指定されたトリガ条件を満たす場合に、該当の回路表示部品を常に一緒に表示する。なお、デバイスはプログラマブルロジックコントローラが有する内部メモリの特定の領域を示す。「デバイスが指定されたトリガ条件を満たす場合」とは、「デバイスが示すメモリ領域に格納されたデータがトリガ条件を満たす場合」を意味する。プログラミング支援装置1は、トリガ条件として、図18に示す8種類の条件式のうちの1つをユーザに指定させる。図18は、回路表示部品を表示するトリガ条件の一例を示す図である。プログラミング支援装置1は、図18に示すものとは異なるトリガ条件の指定をユーザから受け付けるようにしても構わない。
 以上のように、本実施の形態にかかるプログラミング支援プログラムが実現するプログラミング支援装置1は、ラダープログラムを1ブロックごとにSTプログラムに変換する機能を有する。また、プログラミング支援装置1はラダープログラムの1ブロックをSTプログラムに変換する際、定められた条件を満たしていれば、回路表示部品を生成する。すなわち、プログラミング支援装置1は、定められた条件(生成条件)を満たす場合は変換後のSTプログラムの可読性が低下すると判断し、変換するラダープログラムの1ブロックを回路表示部品として保持する。また、プログラミング支援装置1は、変換後のSTプログラムを表示する際、可読性が低下すると判断した箇所と対応付けて、回路表示部品を表示する。また、プログラミング支援装置1は、回路表示部品の生成条件を学習する機械学習装置82を備え、学習結果に基づいて、回路表示部品を生成するか否かを判断する。プログラミング支援装置1は、STプログラムの可読性が低い箇所については可読性が高いラダー言語で記述された回路表示部品を生成しておき、STプログラムを表示する際には生成しておいた回路表示部品を一緒に表示するため、STプログラムに変換したことに伴い可読性が低下し、変換後のSTプログラムに対して行う作業の効率が低下するのを防止できる。
 以上の実施の形態に示した構成は、内容の一例を示すものであり、別の公知の技術と組み合わせることも可能であるし、要旨を逸脱しない範囲で、構成の一部を省略、変更することも可能である。
 1 プログラミング支援装置、2 ラダープログラムデータ格納部、3 Pコード生成部、4 データ操作部、5 表示部、6 回路表示部品格納部、7 STプログラムデータ格納部、8 STプログラム生成部、21 ラダープログラムデータ、71 STプログラムデータ、80 回路表示部品生成部、81 Pコード解析部、82 機械学習装置、83 STテンプレート格納部、84 プログラム変換部、100 電子計算機、821 データ取得部、822 状態観測部、823 学習部、301 変換対象プログラム指定画面、302 左矢印ボタン、303 右矢印ボタン、304 チェックボックス、401 表示属性設定画面、501~503 回路表示部品。

Claims (13)

  1.  ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する第1の変換ステップと、
     前記第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換ステップと、
     前記第2のプログラムの1ブロックごとの解析結果が定められた条件を満たすと、前記条件を満たすブロックの内容を表す回路表示部品を生成する回路表示部品生成ステップと、
     前記第3のプログラムおよび前記回路表示部品を、前記回路表示部品が前記第3のプログラムのどのブロックに対応するか認識可能な形式で表示する表示ステップと、
     をコンピュータに実行させることを特徴とするプログラミング支援プログラム。
  2.  前記回路表示部品生成ステップでは、前記解析結果を確認したユーザから指示を受けると前記回路表示部品を生成する、
     ことを特徴とする請求項1に記載のプログラミング支援プログラム。
  3.  前記回路表示部品生成ステップでは、
     前記解析結果と、前記解析結果を確認したユーザによる、前記回路表示部品の生成が必要か否かの判断結果と、を含む学習用データに基づき機械学習装置が前記回路表示部品の生成条件を学習した結果を使用して、前記回路表示部品を生成するか否かを決定する、
     ことを特徴とする請求項1に記載のプログラミング支援プログラム。
  4.  前記解析結果と、前記解析結果を確認したユーザによる、前記回路表示部品の生成が必要か否かの判断結果と、を含む学習用データに基づいて前記回路表示部品の生成条件を学習する機械学習ステップ、
     を含み、
     前記回路表示部品生成ステップでは、前記機械学習ステップによる学習結果を使用して、前記回路表示部品を生成するか否かを決定する、
     ことを特徴とする請求項1に記載のプログラミング支援プログラム。
  5.  前記機械学習ステップは、
     前記第2のプログラムを1ブロックごとに解析して得られる情報のうち、1命令を実行するための条件数、1条件を共有する命令数および回路構成の複雑度を状態変数として観測する状態観測ステップと、
     回路表示部品を生成する必要があるか否かをユーザが判定した結果を教師データとして取得するデータ取得ステップと、
     前記状態変数および前記教師データの組合せに基づいて作成されるデータセットに従って、前記生成条件を学習する学習ステップと、
     を含むことを特徴とする請求項4に記載のプログラミング支援プログラム。
  6.  前記機械学習ステップによる前記生成条件の学習が済んでいない状態の場合、
     前記回路表示部品生成ステップでは、前記第3のプログラムの可読性を判定するための条件を使用して、前記回路表示部品を生成するか否かを決定する、
     ことを特徴とする請求項4または5に記載のプログラミング支援プログラム。
  7.  前記回路表示部品は、前記条件を満たすブロックの内容をラダー言語で表現する、
     ことを特徴とする請求項1から5のいずれか一つに記載のプログラミング支援プログラム。
  8.  前記回路表示部品生成ステップで生成した回路表示部品の内容を変更するための操作を受け付けるデータ操作ステップと、
     前記データ操作ステップで受け付けた操作の内容に従い、ユーザに指定された回路表示部品を変更する第1の変更ステップと、
     前記第1の変更ステップで前記回路表示部品を変更した内容に合わせて、前記第3のプログラムの対応する箇所を変更する第2の変更ステップと、
     を含むことを特徴とする請求項1から7のいずれか一つに記載のプログラミング支援プログラム。
  9.  前記表示ステップで前記回路表示部品を表示する際の表示属性をユーザが設定可能とする、
     ことを特徴とする請求項1から8のいずれか一つに記載のプログラミング支援プログラム。
  10.  前記表示属性は、前記回路表示部品生成ステップで作成済みの回路表示部品を表示する条件と、前記回路表示部品を表示する際の塗りつぶし色、透過率および拡縮率と、を含む、
     ことを特徴とする請求項9に記載のプログラミング支援プログラム。
  11.  前記回路表示部品生成ステップで作成済みの回路表示部品を表示する条件を、前記第1のプログラムまたは前記第3のプログラムに基づく実行ファイルが書き込まれる装置の内部メモリに格納されたデータの値を利用してユーザが指定可能とする、
     ことを特徴とする請求項10に記載のプログラミング支援プログラム。
  12.  ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する第1の変換部と、
     前記第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換部と、
     前記第2のプログラムの1ブロックごとの解析結果が定められた条件を満たすと、前記条件を満たすブロックの内容を表す回路表示部品を生成する回路表示部品生成部と、
     前記第3のプログラムおよび前記回路表示部品を、前記回路表示部品が前記第3のプログラムのどのブロックに対応するか認識可能な形式で表示する表示部と、
     を備えることを特徴とするプログラミング支援装置。
  13.  プログラムの開発に用いられるプログラミング支援装置が実行するプログラミング支援方法であって、
     ラダー言語で記述された第1のプログラムを中間言語で記述された第2のプログラムに変換する第1の変換ステップと、
     前記第2のプログラムを手続型言語で記述された第3のプログラムに変換する第2の変換ステップと、
     前記第2のプログラムの1ブロックごとの解析結果が定められた条件を満たすと、前記条件を満たすブロックの内容を表す回路表示部品を生成する回路表示部品生成ステップと、
     前記第3のプログラムおよび前記回路表示部品を、前記回路表示部品が前記第3のプログラムのどのブロックに対応するか認識可能な形式で表示する表示ステップと、
     を含むことを特徴とするプログラミング支援方法。
PCT/JP2020/013714 2020-03-26 2020-03-26 プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法 WO2021192152A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202080098862.6A CN115335782A (zh) 2020-03-26 2020-03-26 编程辅助程序、编程辅助装置及编程辅助方法
US17/797,725 US20230065428A1 (en) 2020-03-26 2020-03-26 Programming support program storage medium, programming support device, and programming support method
JP2020544689A JP6854982B1 (ja) 2020-03-26 2020-03-26 プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法
PCT/JP2020/013714 WO2021192152A1 (ja) 2020-03-26 2020-03-26 プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2020/013714 WO2021192152A1 (ja) 2020-03-26 2020-03-26 プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法

Publications (1)

Publication Number Publication Date
WO2021192152A1 true WO2021192152A1 (ja) 2021-09-30

Family

ID=75267896

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/013714 WO2021192152A1 (ja) 2020-03-26 2020-03-26 プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法

Country Status (4)

Country Link
US (1) US20230065428A1 (ja)
JP (1) JP6854982B1 (ja)
CN (1) CN115335782A (ja)
WO (1) WO2021192152A1 (ja)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05274011A (ja) * 1992-01-23 1993-10-22 Mitsubishi Electric Corp プログラマブルコントローラ及びその制御方法
JPH10283005A (ja) * 1997-04-04 1998-10-23 Mitsubishi Electric Corp シーケンスプログラムの表示方法、および、実行方法
JP2001195108A (ja) * 2000-01-12 2001-07-19 Mitsubishi Electric Corp コントロール装置
WO2014136240A1 (ja) * 2013-03-07 2014-09-12 三菱電機株式会社 ラダープログラム表示プログラムおよびラダープログラム表示装置
WO2014155717A1 (ja) * 2013-03-29 2014-10-02 三菱電機株式会社 シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
JP2016224557A (ja) * 2015-05-27 2016-12-28 株式会社キーエンス プログラム作成支援装置、プログラムおよび判別方法

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5586328A (en) * 1994-10-21 1996-12-17 Microsoft Corporation Module dependency based incremental compiler and method
JPH10340109A (ja) * 1997-06-05 1998-12-22 Yaskawa Electric Corp プログラマブルコントローラのマルチプログラム表示装置
JP3819639B2 (ja) * 1999-07-09 2006-09-13 株式会社東芝 プログラミング装置
JP2003084813A (ja) * 2001-09-14 2003-03-19 Fuji Electric Co Ltd ラダー回路の編集装置、および、その編集方法
JP3847665B2 (ja) * 2002-05-30 2006-11-22 株式会社デジタル 制御プログラム検索装置、および、そのプログラム
JP4851390B2 (ja) * 2007-05-22 2012-01-11 株式会社デジタル エディタ装置およびエディタプログラム
CN101957745B (zh) * 2009-07-16 2013-04-17 沈阳高精数控技术有限公司 梯形图语言转换为结构文本语言的方法
WO2015030722A1 (en) * 2013-08-27 2015-03-05 Ge Intelligent Platforms, Inc. Method and apparatus for handling multiple language representations of computer code
US10102320B2 (en) * 2015-02-26 2018-10-16 Autodesk, Inc. Predictive multi-user client-server electronic circuit design system utilizing machine learning techniques
DE112016007220T5 (de) * 2016-09-14 2019-06-06 Mitsubishi Electric Corporation Kontaktplanprogrammbearbeitungsunterstützungsvorrichtung und Kontaktplanprogrammbearbeitungsverfahren
JP7172864B2 (ja) * 2019-06-07 2022-11-16 オムロン株式会社 サポート装置およびサポートプログラム
EP3835943A1 (en) * 2019-12-13 2021-06-16 Siemens Aktiengesellschaft Method and system for generating engineering diagrams in an engineering system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05274011A (ja) * 1992-01-23 1993-10-22 Mitsubishi Electric Corp プログラマブルコントローラ及びその制御方法
JPH10283005A (ja) * 1997-04-04 1998-10-23 Mitsubishi Electric Corp シーケンスプログラムの表示方法、および、実行方法
JP2001195108A (ja) * 2000-01-12 2001-07-19 Mitsubishi Electric Corp コントロール装置
WO2014136240A1 (ja) * 2013-03-07 2014-09-12 三菱電機株式会社 ラダープログラム表示プログラムおよびラダープログラム表示装置
WO2014155717A1 (ja) * 2013-03-29 2014-10-02 三菱電機株式会社 シーケンスプログラム部品作成プログラムおよびシーケンスプログラム部品作成装置
JP2016224557A (ja) * 2015-05-27 2016-12-28 株式会社キーエンス プログラム作成支援装置、プログラムおよび判別方法

Also Published As

Publication number Publication date
JP6854982B1 (ja) 2021-04-07
US20230065428A1 (en) 2023-03-02
CN115335782A (zh) 2022-11-11
JPWO2021192152A1 (ja) 2021-09-30

Similar Documents

Publication Publication Date Title
JP6424557B2 (ja) 情報処理装置及び情報処理プログラム
CN109844773A (zh) 使用卷积神经网络处理序列
US8830266B1 (en) Merging electronic diagrams
CN104823158B (zh) 用于简化的知识工程的方法与系统
JP5112085B2 (ja) 事務フロー生成装置およびその方法
JPWO2004025463A1 (ja) 要件定義方法、ソフトウェアの開発方法、及び、要件単語の変更方法並びに新規規定方法
JP2017506390A (ja) ソフトウェアコードの視覚的実現方法及び装置
CN111652453A (zh) 用于零件设计、仿真和制造的智能工作流程顾问
JP5921765B2 (ja) プログラムグラフ表示装置、プログラムグラフ表示方法およびプログラムグラフ表示プログラム
JP6854982B1 (ja) プログラミング支援プログラム、プログラミング支援装置およびプログラミング支援方法
JP2019021343A (ja) 情報処理装置及び情報処理プログラム
CN117897710A (zh) 解决工业数据转换问题的人工智能方法
US20210019122A1 (en) Information processing method, information processing apparatus, and program
JP7105683B2 (ja) 電子計算機、方法及びプログラム
JP2000237937A (ja) 生産システムの設計支援方法
WO2021260888A1 (ja) 情報処理装置、情報処理方法、及び、記録媒体
JP7185888B1 (ja) 情報処理システム、情報処理方法及び情報処理プログラム
US20230409956A1 (en) Machine learning prediction of additional steps of a computerized workflow
JP2010218319A (ja) 債権ポートフォリオ制御装置、債権ポートフォリオ制御プログラム及び債権ポートフォリオ制御方法
JP7477027B1 (ja) 情報処理装置、情報処理方法、及びプログラム
JP4103791B2 (ja) プログラム生成システムおよび方法
EP4283546A1 (en) Machine learning prediction of additional steps of a computerized workflow
Pribeanu Tool support for handling mapping rules from domain to task models
CN110637522B (zh) 控制律增益模型自动生成方法及系统
KR20220098948A (ko) 전자 장치 및 이의 제어 방법

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2020544689

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: 20926734

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: 20926734

Country of ref document: EP

Kind code of ref document: A1