Program creation support device and program
The program creation support device simplifies the process of adding comments to PLC user programs by converting ladder programs to general-purpose programming language, generating summaries through an LLM interface, and allowing user-driven editing, thereby enhancing understanding and efficiency.
Patent Information
- Application Number
- PCT/JP2024/042873
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-25
- Filing Date
- 2024-12-04
- Publication Date
- 2025-07-03
AI Technical Summary
The task of understanding and adding comments to user programs in programmable logic controllers (PLCs), such as ladder programs, is cumbersome and often requires significant time and effort, especially when programs are modified or when the original author is different from the person making changes, due to varying input accuracy and completeness of comments.
A program creation support device that includes a first display unit for ladder programs, a reception unit for selecting ranges, a conversion unit for converting into general-purpose programming language, a prompt generation unit for natural language summaries, an LLM interface for generating responses, and an editing unit for adding comments based on user instructions, utilizing a large language model (LLM) to facilitate comment addition.
Enhances the ease and accuracy of adding comments to user programs, improving understanding and reducing the time required for program modifications by providing detailed summaries and explanations.
Smart Images

Figure JP2024042873_03072025_PF_FP_ABST
Abstract
Description
Program creation support device and program
[0001] The present invention relates to a program creation support device and a program.
[0002] A programmable logic controller (PLC) controls actuators and motors by executing user programs such as ladder diagrams (ladder languages). When debugging or modifying a user program, the user must understand the contents of the user program. If a lot of time has passed since the program was written, or if the person who originally wrote the user program is different from the person who is now modifying it, it can take a huge amount of time to understand the user program.
[0003] According to Patent Document 1, the readability of a program can be improved by allowing the user to input comments in natural language for each layer, which is expected to make it easier for users to understand the program.
[0004] Patent No. 6948450
[0005] However, the accuracy and thoroughness of comments entered for user programs varies from user to user. Comments entered with low accuracy can actually make the task of understanding the program more difficult. Furthermore, if comments are not entered thoroughly enough, there are no comments to refer to, making the task of understanding the program more difficult. Furthermore, when a user program is modified, comments about the modifications may not be left, or incorrect comments may be added. These factors also make the task of understanding a user program more difficult. Therefore, it is necessary to add appropriate and thorough comments to user programs, but this task is not easy.
[0006] Therefore, an object of the present invention is to facilitate the task of adding comments to user programs such as ladder programs.
[0007] The present invention provides, for example, a program creation support device that supports the creation of a program to be used in a programmable logic controller, comprising: a first display unit that displays a ladder program; a reception unit that receives a selection of a range in the ladder program displayed on the first display unit to be converted into program code in a general-purpose programming language; a first conversion unit that converts the range received by the reception unit into the program code in the general-purpose programming language; a prompt generation unit that generates the program code in the general-purpose programming language and a natural language prompt that requests a summary of the control content of the program code; an LLM interface that sends the prompt generated by the prompt generation unit to a large-scale language model (LLM) and receives an answer sentence corresponding to the prompt from the large-scale language model; a second display unit that displays text contained in the answer sentence received via the LLM interface; and an editing unit that edits the ladder program so as to add at least a portion of the text as a comment to the ladder program in accordance with user instructions.
[0008] According to the present invention, the task of adding comments to a user program such as a ladder program becomes easier.
[0009] PLC system diagram: setting support device (program creation support device) diagram: basic unit diagram: CPU function diagram: sequence diagram showing the procedure from creating a summary, etc. to transferring a user program flowchart: CPU diagram: setting software user interface diagram: device comment editing user interface diagram: user interface for sending prompts diagram: user interface for displaying answer text diagram: user interface for displaying a ladder program with a summary reflected diagram: other specific examples diagram: prompt of other specific examples diagram: answer text of other specific examples diagram: prompt of other specific examples diagram: answer text of other specific examples sequence diagram showing the procedure from creating a summary, etc. to transferring a user program flowchart: CPU diagram: ladder program of other specific examples diagram: ladder program of other specific examples with a summary reflected
[0010] Hereinafter, the embodiments will be described in detail with reference to the accompanying drawings. Note that the following embodiments do not limit the scope of the invention as claimed, and not all combinations of features described in the embodiments are necessarily essential to the invention. Two or more of the features described in the embodiments may be arbitrarily combined. Furthermore, the same reference numerals are used for the same or similar components, and redundant explanations will be omitted.
[0011] <PLC System> Figure 1 shows an example configuration of a programmable logic controller system (hereinafter referred to as PLC system 1) according to an embodiment of the present invention. As shown in Figure 1, this PLC system 1 includes a PC, which is a setting support device for editing user programs such as ladder programs, a basic unit 3, which is a PLC (Programmable Logic Controller) for comprehensively controlling various control devices installed in a factory or the like, and multiple motor drivers 4a-4c. The multiple motor drivers 4a-4c drive motors 10a, 10b, and 10c, respectively. The motor drivers 4a-4c may also be referred to as motor amplifiers or motion units. The motors 10a, 10b, and 10c drive loads, which are the objects of control.
[0012] The user program created by PC2, which is a setting support device, may be created using a graphical programming language such as ladder language, a flow chart format motion program, or structured text (ST) language, or may be created using a high-level programming language such as C language.
[0013] In the PLC system 1, one or more expansion units (e.g., an I / O unit, an analog input unit, an analog output unit, a communication unit, motor drivers 4a to 4c, etc.) are connected to the basic unit 3. The basic unit 3 is sometimes called a CPU unit.
[0014] The basic unit 3 has a display unit 5 and an operation unit 6. The display unit 5 can display the operating status of the motor drivers 4a to 4c. The display unit 5 may switch the display content depending on the operation of the operation unit 6. The display unit 5 typically displays the current values (device values) of devices in the PLC system 1 and error information (presence or absence of alarms or warnings) that has occurred within the PLC system 1. A device is a memory area provided for storing device values (device data) and is sometimes called a data memory or device memory. Device values are information indicating the input status from input devices, the output status to output devices, and the status of internal relays (auxiliary relays), timers, counters, data memories, etc. set in a user program. Device values are classified into bit and word types. A bit device stores a 1-bit device value. A word device stores a 1-word device value.
[0015] The motor drivers 4a to 4c are provided to expand the functions of the PLC system 1. The motors 10a to 10c are controlled by the motor drivers 4a to 4c, respectively. The motor drivers 4a to 4c supply power to the motors 10a to 10c and control the amount of rotation and the like in accordance with commands from the basic unit 3. The motors 10a to 10c are, for example, servo motors or stepping motors.
[0016] The PC 2 is a computer that provides a development environment for the PLC system 1. The PC 2 is, for example, a portable notebook or tablet personal computer and includes a display unit 7 and an operation unit 8. A ladder program, which is an example of a user program for controlling the PLC system 1, is created using the PC 2. The created ladder program is converted into mnemonic code within the PC 2. The PC 2 is connected to the basic unit 3 of the PLC system 1 via a communication cable 9a such as a universal serial bus (USB) and sends the ladder program converted into mnemonic code to the basic unit 3. The basic unit 3 converts the ladder program into machine code and stores it in a memory provided in the basic unit 3. Note that, although the mnemonic code is transmitted to the basic unit 3 in this example, the present invention is not limited to this. For example, the PC 2 may convert the mnemonic code into intermediate code and transmit the intermediate code to the basic unit 3.
[0017] 1, the operation unit 8 of the PC 2 may include a pointing device such as a mouse connected to the PC 2. The PC 2 may also be configured to be detachably connected to the basic unit 3 via a communication cable 9a other than USB. The PC 2 may also be connected wirelessly to the basic unit 3 without using the communication cable 9a. In this case, the communication cable 9a may be understood to represent a wireless link.
[0018] The basic unit 3 and motor driver 4a are connected by a communication cable 9b and can communicate with each other via the communication cable 9b. The motor drivers 4a and 4b are connected by a communication cable 9c and can communicate with each other via the communication cable 9c. The motor driver 4b can communicate with the basic unit 3 via the communication cables 9b and 9c. The motor drivers 4b and 4c are connected by a communication cable 9d and can communicate with each other via the communication cable 9d. Furthermore, the motor driver 4c can communicate with the basic unit 3 via the communication cables 9b, 9c, and 9d.
[0019] In the following, when common matters are described for the motor drivers 4a to 4c, they will be referred to as the motor driver 4. Similarly, when common matters are described for the motors 10a to 10c, they will be referred to as the motor 10.
[0020] The LLM server 100 is, for example, a server computer or service connected to the Internet. PC2 accesses the LLM server 100 via the Internet, sends prompts, and receives responses (answer sentences) to the prompts. The LLM server 100 has machine-learned numerous source codes written in general-purpose programming languages such as Python, Java, C++, JavaScript, and C#. For example, when PC2 sends a prompt to the LLM server 100 that includes a desired program written in C and its related information, requesting a summary of the program, the LLM server 100 receives an answer sentence including the summary.
[0021] The database (DB) 150 is a server computer or storage device that stores related information, such as configuration information for the PLC system 1 and definitions of devices used in ladder programs. While the LLM server 100 may be built inside the PC 2, the DB 150 may also be built inside the PC 2. When the DB 150 receives a query from the PC 2 about a code element used in the program, it searches for and extracts information associated with that element (related information) and returns the related information to the PC 2. The DB 150 may also store documentation, such as instruction manuals for various types of PLC devices (e.g., basic units, expansion units, displays, motor amplifiers, motors, etc.) and ladder language manuals.
[0022] <Setting Support Device> Figure 2 is a block diagram for explaining the electrical configuration of a PC 2 that operates as a setting support device. As shown in Figure 2, the PC 2 includes a CPU 11, a display unit 7, an operation unit 8, a storage device 12, and a communication unit 13. The display unit 7, operation unit 8, storage device 12, and communication unit 13 are each electrically connected to the CPU 11. The storage device 12 includes RAM, ROM, HDD, and SSD, and may further include a removable memory card. CPU is an abbreviation for central processing unit. ROM is an abbreviation for read-only memory. RAM is an abbreviation for random access memory. HDD is an abbreviation for hard disk drive. SSD is an abbreviation for solid state drive.
[0023] The user of the PC 2 causes the CPU 11 to execute the setting software 21 stored in the storage device 12, edits the user program 22 via the operation unit 8, and transmits the user program 22 to the basic unit 3. The setting software 21 also has a module that sends prompts to the LLM server 100 and receives responses from the LLM server 100 to assist in the creation of the user program 22. Details of this will be described later. The PC 2 may also be called an engineering tool or a program creation support device. The user program 22 is a ladder program, a motion program, or the like.
[0024] The PLC system configuration information 23 includes information indicating the connection positions of the multiple motor drivers 4 relative to the basic unit 3, information indicating the functions (e.g., communication function and positioning function) provided in the basic unit 3, information indicating the functions of the motor drivers 4, and device allocation information. The user program 22 and the PLC system configuration information 23 are part of the project data. Here, editing the project data includes creating and changing (re-editing) the project data. The user reads out the project data stored in the storage device 12 as needed and changes the project data using the setting software 21.
[0025] Symbol definitions 24 are definitions of various symbols (e.g., variables, devices) used in the PLC system 1. Templates 25 are existing text information used in creating prompts to be sent to the LLM server 100.
[0026] The communication unit 13 communicates with the basic unit 3 via the communication cable 9a. The CPU 11 transfers project data (such as the user program 22 and configuration information 23) to the basic unit 3 via the communication unit 13. The communication unit 13 includes a communication circuit capable of performing communication compliant with the USB standard, a communication circuit for performing wired LAN communication, and a communication circuit for performing wireless LAN communication.
[0027] The communication unit 13 communicates with the LLM server 100 and DB 150 via a communication cable, the Internet, or a local network. The communication protocol between the PC 2 and the basic unit 3 may be a general-purpose protocol or a unique protocol.
[0028] <Basic Unit> Fig. 3 shows the hardware configuration of the basic unit 3. The CPU 31 writes information to the memory 32 and reads information from the memory 32. The memory 32 includes RAM, ROM, HDD, SSD, and may further include a removable memory card. The project storage unit 32a is a ROM area that stores project data created by the PC 2 and transferred thereto. The project data includes the user program 22, configuration information 23, and the like. Furthermore, the CPU 31 accepts information input from the operation unit 6. The CPU 31 displays various information on the display unit 5.
[0029] The CPU 31 is connected to the PC 2 via a communication unit 33a, and is also connected to the motor driver 4 via a communication unit 33b to perform communication. The communication unit 33a is, for example, a communication circuit compatible with USB. The communication unit 33b is a communication circuit capable of executing communication compatible with industrial Ethernet protocols (e.g., EtherCAT, EtherNet / IP, PROFINET, MECHATROLINK-III).
[0030] The program execution unit 36 is a calculation processing circuit that executes the user program 22. The program execution unit 36 may be implemented in a CPU different from the CPU 31. The motion control unit 34 controls the motor driver 4 in cooperation with the program execution unit 36.
[0031] <Editing a User Program> FIG. 4 shows some of the various functions realized by the CPU 11 of the PC 2 executing the setting software 21. The UI unit 40 displays the user interface of the setting software 21 on the display unit 7. The UI unit 40 has various functions. The project display unit 41 displays the project name, the program modules constituting the project, the configuration information 23, etc. on the display unit 7. The program display unit 42 displays the user program 22, which is edited in accordance with user instructions received by the reception unit 61, on the display unit 7. The prompt display unit 43 displays a prompt generated by the prompt generation unit 62 in accordance with the user instructions received by the reception unit 61 and transmitted to the LLM server 100 on the display unit 7. The answer display unit 44 displays an answer received from the LLM server 100 on the display unit 7. The text included in the answer may include an explanatory statement explaining the logic of a selected range in the ladder program or an interpretation statement indicating an interpretation of the logic.
[0032] The editing unit 50 edits project data including the user program 22. The project editing unit 51 edits the project data in accordance with user instructions received by the receiving unit 61. The unit editing unit 52 edits configuration information 23 indicating the types of basic units 3 and expansion units (motor drivers 4) that make up the PLC system 1, as well as the connection positions of the expansion units, in accordance with the user instructions received by the receiving unit 61. The program editing unit 53 edits the user program 22 in accordance with the user instructions received by the receiving unit 61. The comment editing unit 54 edits comments to be added to the user program 22, etc., in accordance with the user instructions received by the receiving unit 61.
[0033] The accepting unit 61 accepts the selection of a range in the user program 22 displayed on the display unit 7 to be converted into program code in a general-purpose programming language. For example, a portion of a ladder program is designated by the user, and the designated portion is converted into program code in a general-purpose programming language by the language conversion unit 64. This range may be designated for each circuit block, which is the smallest unit operable as a ladder program. This range may also be designated for each group of multiple circuit blocks described in the ladder program. This range may also be designated for each function block described in the ladder program.
[0034] The prompt generation unit 62 generates a prompt to request the LLM server 100 to create a summary or comment on a portion of the user program 22 specified by the user via the reception unit 61. For example, the prompt generation unit 62 may generate program code written in a general-purpose programming language and a natural language prompt requesting a summary of the control content of the program code. The prompt generated by the prompt generation unit 62 may include at least one of, for example, comments added to input / output elements in a ladder program, information about instructions or program modules in the ladder program, configuration information 23 of multiple units forming the programmable logic controller, a project name of a project including the ladder program, module names of program modules included in the project, point parameters used as movement coordinates of a control target in a motion unit controlled according to the ladder program, and setting information for variables described in the ladder program.
[0035] The LLM interface 63 controls the communication unit 13 to transmit prompts generated by the prompt generation unit 62 to the LLM server 100 and to receive answer sentences corresponding to the prompts from the LLM server 100 .
[0036] The language conversion unit 64 converts the part of the user program 22 accepted by the acceptance unit 61 into program code in a general-purpose programming language.
[0037] The prompt generation unit 62 may generate a first prompt that instructs the LLM server 100 to perform an element analysis of the program code. In this case, the LLM interface 63 receives a first response sentence in response to the first prompt from the LLM server 100. The prompt generation unit 62 may access the DB 150 to obtain related information based on the results of the element analysis (e.g., device comments) included in the first response sentence, and generate a second prompt including the related information. In this case, the LLM interface 63 transmits a second prompt to the LLM server 100 and receives a second response sentence corresponding to the second prompt from the LLM server 100. The response display unit 44 may display text included in the second response sentence received via the LLM interface 63 on the display unit 7.
[0038] The user program 22 may be composed of a first ladder program and a second ladder program. The prompt generation unit 62 may create a prompt requesting a summary of the first ladder program to obtain a first answer sentence, and create a prompt requesting a summary of the second ladder program to obtain a second answer sentence. Furthermore, the prompt generation unit 62 may generate a third prompt to instruct the user to summarize the first answer sentence and the second answer sentence. In this case, the LLM interface 63 will receive a third answer sentence in response to the third prompt from the LLM server 100. The answer display unit 44 may display text included in the third answer sentence received via the LLM interface 63 on the display unit 7. The editing unit 50 may edit the user program 22 in accordance with a user instruction so as to add at least a portion of the text included in the third answer sentence (e.g., an overall summary of the user program 22) to the user program 22 as a comment.
[0039] The prompt generation unit 62 may divide a prompt including program code in a general-purpose programming language into a first prompt and a second prompt when the size of the prompt exceeds the maximum size that can be input by the LLM server 100. The LLM interface 63 may send the first prompt and the second prompt separately to the LLM server 100, and receive a first answer sentence corresponding to the first prompt and a second answer sentence corresponding to the second prompt.
[0040] The reception unit 61 may receive a selection of a range of a program module displayed on the display unit 7 to be converted into program code written in a general-purpose programming language. The language conversion unit 64 converts the range received by the reception unit 61 into program code written in a general-purpose programming language. The prompt generation unit 62 generates program code written in a general-purpose programming language and a natural language prompt requesting a summary of the control content of the program code. The LLM interface 63 transmits the prompt generated by the prompt generation unit to the LLM server 100 and receives an answer sentence corresponding to the prompt from the LLM server 100. The answer display unit 44 may display text included in the answer sentence received via the LLM interface 63 on the display unit 7. The editing unit 50 edits the program module in accordance with a user instruction so as to add at least a portion of the text to the program module as a comment.
[0041] The response received from the LLM server 100 may include text suggesting that the LLM server 100 cannot create a comment using only the information provided in the prompt. In this case, the prompt generation unit 62 may generate a prompt including additional information to be input by the user and cause the LLM interface 63 to transmit the prompt. This may increase the likelihood of obtaining the desired response. Note that the text suggesting that a comment cannot be created using only the information provided in the prompt may include text indicating that a device comment for a specific device described in the ladder program is missing. The accepting unit 61 and the comment editing unit 54 may accept input of a device comment for a specific device. The prompt generation unit 62 may generate a prompt including the device comment as additional information. As a result, the LLM server 100 generates a response based on the prompt including the device comment as additional information.
[0042] The user may not be able to understand the content of the answer. In this case, the prompt generator 62 may generate a prompt to ask the LLM server 100 a question about part of the content of the answer. The LLM server 100 then creates an answer to the question and transmits the answer to the PC 2. The user may be able to correctly understand the answer by reading the answer.
[0043] <Sequence> FIG. 5 shows a series of steps from creating the user program 22 to transferring it.
[0044] In S1, the PC 2 creates a prompt based on program code in a general-purpose programming language generated by the language conversion unit 64 from a range of the user program 22 designated by the user and related information, and transmits the prompt to the LLM server 100. The LLM server 100 receives the prompt from the PC 2.
[0045] In S2, the LLM server 100 creates a response statement including a summary of the program code in a general-purpose language, comments, explanations, interpretations, etc. in accordance with the prompts, and transmits the response statement to the PC 2. The PC 2 receives the response statement from the LLM server 100.
[0046] The sending and receiving of the prompt in S3 and the sending and receiving of the answer sentence in S4 are optional because the sending and receiving of the prompt and answer sentence may take more than two round trips. The more complex the user program 22, the more frequently the prompt and answer sentence will be sent and received. For example, the CPU 11 may create a prompt for each of multiple user-specified ranges that make up the user program 22, and send and receive the prompt and answer sentence for each specified range.
[0047] In S5, the PC 2 transfers the completed user program 22 to the PLC (the basic unit 3 and the motor driver 4). The program execution unit 36 of the basic unit 3 executes the user program 22.
[0048] <Flowchart> Fig. 6 shows a program editing operation that the CPU 11 executes in accordance with the setting software 21. Here, a ladder program is used as the user program 22 as an example.
[0049] In S601, the CPU 11 (accepting unit 61) accepts a specification of a range to be summarized in the ladder program, which is input by the user via the operation unit 8. Note that the summary is only an example, and the specified range may be a detailed explanation of the logic or an interpretation of the logic.
[0050] In S602, the CPU 11 (language conversion unit 64) converts the range specified by the user into a general-purpose programming language. If the language conversion unit 64 supports multiple general-purpose programming languages, the reception unit 61 may receive from the user a selection of one general-purpose programming language from the multiple general-purpose programming languages. The language conversion unit 64 converts the specified range into the general-purpose programming language selected by the user.
[0051] In S603, the CPU 11 (prompt generation unit 62) creates a prompt including the program code in the general-purpose language generated by the language conversion unit 64. Here, the prompt generation unit 62 may include information related to the program code (e.g., device comments) in the prompt as additional information.
[0052] In S604 , the CPU 11 (LLM interface 63 ) transmits the prompt created by the prompt creating unit 62 to the LLM server 100 .
[0053] In S605, the CPU 11 (LLM interface 63) receives the reply message from the LLM server 100.
[0054] In S606 , the CPU 11 (answer display unit 44 ) displays the answer received from the LLM server 100 on the display unit 7 .
[0055] In S607, the CPU 11 (editing unit 50) acquires text such as a summary from the answer sentence based on the user's instruction.
[0056] In S608, the CPU 11 (editing unit 50) writes the acquired text into the ladder program.
[0057] <User Interface> (1) Project and User Program Editing UI FIG. 7 shows an example of a user interface (UI) 70 for the configuration software 21 (the UI 70 is displayed on the display unit 7 by executing the configuration software 21). A mode selection menu 71 displays multiple selectable modes provided by the configuration software 21. These modes include edit mode, monitor mode, and replay mode (debug mode). The edit mode shown in FIG. 7 is a mode for editing a ladder program displayed in a program display area 74. A project display area 72 displays information constituting the project. This information includes specification information and setting information for the basic unit 3 and expansion unit (motor driver 4) constituting the PLC system 1, device assignment information, operation record setting information, and the ladder program. In the edit mode, the program display area 74 displays an editable ladder program specified in the project display area 72. FIG. 7 shows a ladder program having program modules named "Main" (e.g., a per-scan module) and "Fashion Blocks" (FB01, FB02). In particular, a plurality of program modules can be selected by tabs 73, and in FIG. 7, the tab 73 corresponding to Main is selected.
[0058] As shown in Figure 7, a ladder program is displayed as a ladder diagram. A ladder program is divided into multiple circuit blocks, each of which is assigned a line number. However, there may be lines containing comments or other information without including any circuit blocks. As shown in Figure 7, line 00001 is a blank line containing no circuit blocks. Line 00002 describes two relay devices, R000 and R001. R000 is an input device, and R001 is an output device. Specifically, when R000 is turned on, R001 is also turned on, opening the automatic door. A device comment is assigned to each relay device in advance.
[0059] The bottom of the UI 70 is provided with a Logic Explanation button 76, a Logic Summary button 77, and a Device Comment Edit button 78. The user can operate the pointer 103 via the operation unit 8 to specify a line or operate one of the buttons. The Logic Explanation button 76 is a button for requesting an explanation of the logic in the specified range from the LLM server 100. The Logic Summary button 77 is a button for requesting a summary of the logic in the specified range from the LLM server 100. The Device Comment Edit button 78 is a button for calling up a UI ( FIG. 8 ) for editing comments for devices written in a ladder program.
[0060] (2) Device Comment Editing UI FIG. 8 shows the device comment editing UI 90. The comment input field 91 accepts the input of comments for each of the multiple devices described in the ladder program. In this example, the relay device assigned the device number R000 has the comment "Automatic Door Human Sensor Input." The relay device assigned the device number R001 has the comment "Automatic Door Open Command Relay." The user can select the comment input field 91 by operating the pointer 103 via the operation unit 8 and input a comment in the selected comment input field 91. When the save button 92 is pressed, the comment editing unit 54 saves the comment in the symbol definition 24. When the back button 93 is pressed, the UI unit 40 closes the device comment editing UI 90 and activates the UI 70. When a comment is edited, the program display unit 42 updates the device comment assigned to the associated device. Note that the relay device (bit device) is merely an example, and comments may be edited for word devices such as data memories (DMs), buffer memories, and the like.
[0061] (3) Prompt Confirmation and Transmission UI Fig. 9 shows a prompt UI 80 that displays a prompt generated by the prompt generation unit 62. A prompt display area 81 displays the prompt. Here, as an example, the prompt that is displayed when the logic summary button 77 is pressed is shown.
[0062] In this example, the prompt indicates to the LLM server 100 that C language program information and related information will be provided, and that a summary of the C language program information should be created. The C language program information is program code generated by the language conversion unit 64 when line 0002 shown in FIG. 7 is specified by the user. The related information includes device comments obtained by the prompt generation unit 62 from the symbol definition 24 for R000 and R001 included in the C language program information generated by the language conversion unit 64. When the send button 82 is pressed, the LLM interface 63 sends this prompt to the LLM server 100. When the cancel button 83 is pressed, sending of the prompt is canceled.
[0063] (4) UI for Displaying Answers Figure 10 shows an answer display UI 85 displayed on the display unit 7 by the answer display unit 44. The answer display area 86 displays the answer received from the LLM server 100. By reading the summary included in the answer, users will be able to easily understand the content of ladder programs created by others. Alternatively, users will be able to easily add summaries to ladder programs created by themselves or others.
[0064] When the back button 87 is pressed, the CPU 11 closes the answer display UI 85 and activates the UI 70. After the user checks the summary displayed in the answer display area 86, the user may select and copy the summary with the pointer 103 (i.e., the summary is stored in the copy buffer). This allows the user to paste the summary stored in the copy buffer into line 0001 (comment field) of the ladder program.
[0065] (5) Reflecting Information Obtained from the LLM Server in the User Program Figure 11 shows a UI 70 displaying a user program 22 that reflects a summary 75 generated by the LLM server 100. The user selects line 0001 and pastes the summary 75 included in the answer statement onto line 0001. The editing unit 50 writes the summary 75 pasted onto line 0001 into the ladder program (user program 22). This allows other users to instantly understand the summary 75 of the ladder program when they view it.
[0066] 10 and 11 show an example of a summary generated when the Logic Summary button 77 is pressed. When the Logic Explanation button 76 is pressed, a response sentence including an explanation of the logic is obtained, such as "When the automatic door's human sensor input (R000) turns ON, the automatic door's open command relay (R100) turns ON." The summary may also be the result of a specific interpretation of the logic explanation.
[0067] <Other Specific Examples> (1) First Specific Example Fig. 12 shows an example of the UI 70 of the configuration software 21. In the ladder program displayed in the program display area 74, when a relay device called userinput_start starts up, if a relay device called emergency_stop is off, a relay device called operation_request_output is turned on. Alternatively, if a relay device called operation_request_output is on, and operation_complete is off, and a relay device called emergency_stop is off, the relay device called operation_request_output is turned on. That is, if operation_complete is not emergency_stop and userinput_start is on, or operation_request_output is on and operation_complete is off, it indicates that the loop processing continues.
[0068] FIG. 13 shows a prompt created when the Logic Explanation button 76 is pressed. In this example, line 0002 is designated by pointer 103, and line 0002 is converted to generate program code written in C#. In this example, operation_request_output, userinput_start, userinput_start, and operation_complete are defined as Boolean variables. The while statement also indicates that a loop should be executed as long as the condition described in relation to FIG. 12 is true. The prompt generator 62 also includes the instruction, "The following code is a C program modeled after a PLC ladder program. Please explain the meaning of this program."
[0069] Figure 14 shows an example of a response. This example shows that the C program mimics a PLC ladder program and includes a detailed explanation of the program. For example, it explains that four Boolean variables are defined; operation_request_output is a variable that indicates the output request status; emergency_stoph is a variable that indicates the emergency stop status; userinput_start is a variable that indicates the start input from the user; operation_complete is a variable that indicates whether the operation is complete; and the value of operation_request_output is updated within a while(true) loop as follows: The detailed explanation of the update includes the expression within the while(true) loop setting operation_request_output to true if the following condition is met: That is, the conditions are that an emergency stop (emergency_stop) has not occurred (!emergency_stop is true), and that there is a start input from the user (userinput_start is true), or that an output request has already been made and the operation has not yet been completed (operation_request_output AND !operation_complete is true). It is also explained that this program will continue to make output requests if there is a start input from the user or if the previous output request has not been completed, as long as there is no emergency stop.
[0070] In this way, it becomes possible to obtain a detailed explanation of the logic of the ladder program within the range specified by the user.
[0071] (2) Second Specific Example Figure 15 shows a prompt generated for another specific example. The ladder program of the second specific example is the same as the ladder program of the first specific example. Here, in the symbol definition 24, operation_request_output is assigned to the positioning start signal for axis 3 of motor driver 4, which is a motion unit. Furthermore, the configuration information 23 includes "initial conveyor" as a comment for axis setting for axis 3.
[0072] The prompt generation unit 62 acquires, from the symbol definition 24 for operation_complete included in the C language program code generated from the specified range of the ladder program, that operation_request_output is assigned to the positioning start signal for axis 3 of the motor driver 4, which is a motion unit. Furthermore, the prompt generation unit 62 acquires "initial stage conveyor" as a comment for the axis setting of axis 3 from the configuration information 23 for axis 3. As a result, the prompt generation unit 62 adds the comment "initial stage conveyor" to operation_complete as additional information and generates a prompt.
[0073] Figure 16 shows an example of a response. Compared to Figure 14, Figure 16 provides a response that takes into account additional information, such as "The purpose of the program is to control the operation request output of the first-stage conveyor when there is no emergency stop signal. The meaning of each variable and program is explained below." Also, a specific response that takes into account the additional information is obtained for the explanation of the variables.
[0074] <Modifications> (1) Element Analysis (1-1) Sequence Fig. 17 shows the sequence of a modification. In this example, to create a prompt for a summary or the like, program code written in a general-purpose programming language is subjected to element analysis in advance, and related information for each element is obtained from DB 150.
[0075] In S11, the PC 2 converts the specified range of the ladder program in the language conversion unit 64 to generate a mnemonic, creates a prompt for element analysis of the mnemonic, and transmits it to the LLM server 100. Upon receiving the element analysis prompt, the LLM server 100 performs element analysis on the mnemonic included in the prompt. As a result, a response sentence including the element analysis results is generated.
[0076] In S12, the LLM server 100 transmits the reply to the PC 2. The PC 2 receives the reply from the LLM server 100.
[0077] In S13, in order to acquire related information for each element extracted from the answer sentence, PC2 transmits a query to DB150. Upon receiving the query, DB150 searches for and extracts related information for each element included in the query, and creates search results including the extracted related information.
[0078] In S14, DB 150 transmits a response including the related information to PC 2. Thereafter, in S1, PC 2 adds the related information obtained from DB 150 as additional information to the program code to create a prompt, and transmits the prompt to LLM server 100. The following procedure has already been described.
[0079] (1-2) Flowchart Fig. 18 shows the procedure for acquiring related information, which is executed by the CPU 11 in accordance with the setting software 21. Steps S181 to S1802 shown in Fig. 18 may be executed, for example, as part of step S603 shown in Fig. 6. Here, after steps S601 and S602 are executed, the following processing is executed as part of step S603.
[0080] In S1801, the CPU 11 (prompt generation unit 62) analyzes the program code written in the general-purpose programming language generated by the language conversion unit 64 into elements. Here, the analysis of the elements may be performed by sending a prompt to the LLM server 100, or may be performed in accordance with the setting software 21 in the PC 2.
[0081] In S1802, the CPU 11 (prompt generating unit 62) creates a query for inquiring the DB 150 about the related information of the element acquired by the element analysis.
[0082] In S1803 , the CPU 11 (prompt generating unit 62 ) controls the communication unit 13 to send a query to the DB 150 .
[0083] In S1804, the CPU 11 (prompt generating unit 62) receives related information for each element from the DB 150 as a response to the query.
[0084] In S1805, the CPU 11 (prompt generating unit 62) generates a prompt by adding additional information (such as related information of elements) to the code in the general-purpose programming language. After that, the processing from S604 onwards is executed.
[0085] (2) Specific Example (2-1) Ladder Program Figure 19 shows an example of a ladder program that causes the motor driver 4 to perform one-point operation. According to Figure 19, when MR000 is turned on, operation is permitted. Also, when MR000 is turned on, the servo for axis 1 in the motor driver 4 is turned on. CR2002 is a relay device that is always on. The MOV instruction assigns 3 to DM100. When MR001 rises, the UWRIT instruction sets 2100 as the positioning start point number for axis 1. When MR002 rises, or when positioning of axis 1 has started, and the motor driver 4 is operable, and positioning control for axis 1 has not started and is not currently in axis control, positioning control for axis 1 is started. When positioning control start is complete, the completion code read by the UREAD instruction is written to EM0. After that, positioning control start is completed, and positioning of axis 1 is completed.
[0086] Assume that the entire ladder program shown in Fig. 19 is specified as a range. In this case, the language conversion unit 64 may convert the specified range into a mnemonic. The following is an example of a mnemonic: LD MR000 OUT R34000 LD MR000 OUT R34305 LD CR2002 MOV #1 @DM100 LDP MR001 UWRIT #1 #2100 @DM100 #1 LDP MR002 OR R34200 AND R40600 ANB R40800 ANB R40903 OUT R34200 LD R40800 UREAD #1 #4050 EM0 #1 LD R40800 AND<> #0 EM0 SET @MR000 LD R40802 OUT R34202 (2-2) Element Analysis Prompt The prompt to request element analysis from the LLM server 100 for the above mnemonic is as follows: "You will be given the following information: 1. Unique format 2. Unique program information 3. Example of output for example input 1. Unique format Command Space First argument Space Second argument Space 2. Unique program information LD MR000 OUT R34000 LD MR000 OUT R34305 LD CR2002 MOV #1 @DM100 LDP MR001 UWRIT #1 #2100 @DM100 #1 LDP MR002 OR R34200 AND R40600 ANB R40800 ANB R40903 OUT R34200 LD R40800 UREAD #1 #4050 EM0 #1 LD R40800 AND<> #0 EM0 SET @MR000 LD R40802 OUT R34202 3. Example of output for example input Input example LD R000 OUT R100 Output example First command: LD, first argument: R000 Second command: OUT, first argument: R100" (2-3) Element analysis response text The following is an example of a response text received from the LLM server 100. "First command: Command: LD, first argument: MR000 Second command: Command: OUT, first argument: R34000 Third command: Command: LD, first argument: MR000 Fourth command:Command: OUT First argument: R34305 5th command Command: LD First argument: CR2002 6th command Command: MOV First argument: #1 Second argument: @DM100 7th command Command: LDP First argument: MR001 8th command Command: UWRIT First argument: #1 Second argument: #2100 Third argument: @DM100 4th argument: #1 9th command Command: LDP First argument: MR002 10th command Command: OR First argument: R34200 11th command Command: AND First argument: R40600 12th command Command: ANB First argument: R40800 13th command Command: ANB First argument: R40903 14th command Command: OUT First argument: R34200 15th command Command: LD First argument: R40800 16th command Command: UREAD First argument: #1 Second argument: #4050 Third argument: EM0 Fourth argument: #1 17th command Command: LD First argument: R40800 18th command Command: AND<> First argument: #0 Second argument: EM0 19th command Command: SET First argument: @MR000 20th command Command: LD First argument: R40802 21st command Command: OUT First argument: R34202 (2-4) Obtaining related information Here, among the multiple elements, assume that the second argument of the UWRIT command is #2100, and that highly related information is extracted from DB150. The response from DB150 is as follows: / / Sample program for starting Axis 1 with point operation No. 5 / / First relay number R30000 / / First DM number DM10000 / / Axis 1 positioning control start relay R30200 / / Axis 1 positioning control start completion relay R36800 / / Axis 1 positioning completion relay R36802 / / Axis 1 positioning completion clear relay R30202 / / [Axis 1 positioning start point number] #2100 / / [Axis 1 positioning control start completion code] #4050 void pointMove_ziku1_point5(){ const intpointMoveNo = 5; if(MR000){ R30000 = true; R30305 = true;}else{ R30000 = false; R30305 = false;} if(!preMR001 && MR001){ UWRIT(1, 2100, pointMoveNo, 1);} preMR001 = MR001; if(((!preMR002 && MR002) || R30200) && R36600 && R36800 && R36903){ R30200 = true;} else { R30200 = false;} preMR002 = MR002; if(R36800){ UREAD(1, 4050, EM0, 1);} if(R36800 && 0!=EM0){ @MR000 = True;} if(R36802){ R30202 = True;}else{ R30202 = False;}}" (2-5) Prompts for summaries, etc. The following is an example of a prompt to which related information based on element analysis is added as additional information. "We will provide you with the following information: 1. C language program information 2. Related information Output a summary of 1 by referring to 2. Output the summary as a function comment for this function. 1. C language program information void func(){ if(MR000){ R34000 = true; R34305 = true;}else{ R34000 = false; R34305 = false;} atDM100 = 1 if(!preMR001 && MR001){ UWRIT(1, 2100, atDM100, 1);}preMR001 = MR001; if(((!preMR002 && MR002) || R34200) && R40600 && R40800 && R40903){ R34200 = true;} else { R34200 = false;} preMR002 = MR002; if(R40800){ UREAD(1, 4050, EM0, 1);} if(R40800 && 0!=EM0){ @MR000 = True;} if(R40802){ R34202 = True;}else{ R34202 = False;}} 2. Related information 1 / / Sample program for starting axis 1 with point operation No. 5 / / First relay number R30000 / / First DM number DM10000 / / Axis 1 positioning control start relay R30200 / / Axis 1 positioning control start completion relay R36800 / / Axis 1 positioning completion relay R36802 / / Axis 1 positioning completion clear relay R30202 / / [Axis 1 positioning start point number] #2100 / / [Axis 1 positioning control start completion code] #4050 void pointMove_ziku1_point5(){ const int pointMoveNo = 5; if(MR000){ R30000 = true; R30305 = true;}else{ R30000 = false; R30305 = false;} if(!preMR001 && MR001){ UWRIT(1, 2100, pointMoveNo,} preMR001 = MR001; if(((!preMR002 && MR002) || R30200) && R36600 && R36800 && R36903){ R30200 = true;} else{ R30200 = false;} preMR002 = MR002; if(R36800){ UREAD(1, 4050, EM0, 1);} if(R36800 && 0!=EM0){ @MR000 = True;} if(R36802){ R30202 = True;}else{ R30202 = False;}} 2 Special device comments R34000KV-16ML[1] Operation permitted R34200KV-16ML[1] Axis 1 positioning control start R34202KV-16ML[1] Axis 1 positioning complete clear R34305KV-16ML[1] Axis 1 servo ON R40600KV-16ML[1] Operation possible R40800KV-16ML[1] Axis 1 positioning start complete R40802KV-16ML[1] Axis 1 Positioning completed R40903KV-16ML[1] Axis 1 Axis control in progress 3 Buffer number 2100 Axis 1 Positioning start point number 4050 Axis 1 Positioning control start Completion code 4 Point parameters No. 1 50 cm in the positive direction No. 2 25 cm in the positive direction No. 3 10 cm in the positive direction No. 4 10 cm in the negative direction No. 5 50 cm in the negative direction 5 Axis configuration information Axis 1 Slave type: SV2 Controls the tip of ball screw 1 in process 1 Axis 2 Slave type: Servo Controls the tip of ball screw 3 in process 2 Note that a special device comment is a comment obtained from DB150, for example, and assigned to a special device.
[0087] (2-6) Summary contained in the answer An example of an answer to the above prompt is as follows: "Move the tip of ball screw 1 of process 1 controlled by SV2 50 cm in the positive direction."
[0088] 20 shows an example in which a summary has been added to line 0001. It can be seen that the summary contained in the answer sentence in line 0001, "Move the tip of ball screw 1 in process 1 controlled by SV2 by 50 cm in the + direction," has been added.
[0089] <Technical Ideas Derived from the Examples> [Viewpoint 1] The PC 2 is an example of a program creation support device that supports the creation of a program used in a programmable logic controller. The CPU 11, the display unit 7, the program display unit 42, and the program display area 74 are an example of a first display unit that displays a ladder program. The CPU 11, the operation unit 8, and the reception unit 61 may receive a selection of a range in the ladder program displayed on the first display unit to be converted into program code written in a general-purpose programming language. The CPU 11 and the language conversion unit 64 may function as a first conversion unit that converts the range received by the reception unit 61 into program code written in a general-purpose programming language. The CPU 11 and the prompt generation unit 62 may generate program code written in a general-purpose programming language and a natural language prompt that requests a summary of the control content of the program code. The CPU 11, the communication unit 13, and the LLM interface 63 may function as an LLM interface that sends a prompt generated by the prompt generation unit 62 to a large-scale language model (LLM) and receives a response sentence corresponding to the prompt from the large-scale language model. The CPU 11, display unit 7, answer display unit 44, and answer display UI 85 function as a second display unit that displays text contained in an answer received via the LLM interface 63. The CPU 11 and editing unit 50 may edit the ladder program according to user instructions so that at least a portion of the text is added to the ladder program as a comment. This facilitates the task of adding comments to user programs such as ladder programs. Generative artificial intelligence (AI) such as generative pre-trained transformers (GPTs) is a type of LLM, and has recently seen remarkable advances. However, while generative AI excels at learning natural language sentences and program code written in general-purpose programming languages, it is not adept at learning ladder programs. Therefore, by converting a ladder program into program code written in a general-purpose programming language, the learning results of the program code written in the general-purpose programming language can be used.The ladder program is one example, and this embodiment would be useful for user programs written in a graphical programming language for PLC, such as Motion Flow.
[0090] [Viewpoint 2] The prompt may include at least one of the following: comments added to input / output elements (e.g., input devices, output devices) in the ladder program; information about instructions or program modules (e.g., function blocks) in the ladder program; configuration information about multiple units (e.g., base unit, expansion units) that form the programmable logic controller; the project name of the project that includes the ladder program; module names of program modules included in the project; point parameters used as movement coordinates for a controlled object in a motion unit (e.g., motor driver 4) controlled according to the ladder program; and variable setting information (e.g., symbol definition 24) described in the ladder program. This information will be useful for the LLM server 100 in interpreting the program code. In other words, the accuracy of obtaining a summary of the program code (e.g., logic overview, detailed logic description) will be improved.
[0091] [Viewpoint 3] The text included in the answer may include an explanatory text that explains the logic of the selected range in the ladder program. By reading the explanatory text of the logic, the user will be able to easily understand the logic of the ladder program created by someone else.
[0092] [Viewpoint 4] The text included in the answer sentence may include an interpretation that indicates an interpretation of the logic included in the selected range in the ladder program. By reading the interpretation of the logic, a user will be able to easily understand the logic of a ladder program created by someone else.
[0093] [Viewpoint 5] The prompt generation unit 62 may generate a first prompt instructing the LLM server 100 to perform element analysis of the program code. The LLM interface 63 may receive a first response sentence in response to the first prompt from the LLM server 100. The prompt generation unit 62 may acquire related information based on the results of the element analysis included in the first response sentence and generate a second prompt including the related information. The LLM interface 63 may send a second prompt to the LLM server 100 and receive a second response sentence corresponding to the second prompt from the LLM server 100. As illustrated in Figures 14 and 16, the second display unit (e.g., the response display UI 85) may display text included in the second response sentence received via the LLM interface 63. In this manner, element analysis may be performed on program code written in a general-purpose programming language generated by converting a ladder program. This makes it possible to acquire related information for each element from the DB 150. Furthermore, because the related information for each element is added to the program code as additional information, it may be possible to obtain an answer sentence including a more detailed summary or explanation.
[0094] [Viewpoint 6] The prompt generation unit 62 may access a database (e.g., DB 150) to acquire related information based on the results of the element analysis of the first response sentence. DB 150 may be implemented inside the PC 2.
[0095] [Viewpoint 7] The prompt generation unit 62 may determine whether the size of a prompt including program code written in a general-purpose programming language exceeds the maximum size (threshold) that can be input by the LLM server 100. If the size of the prompt exceeds the threshold, the prompt generation unit 62 may divide the prompt into a first prompt and a second prompt. The LLM interface 63 may send the first prompt and the second prompt separately to the LLM server 100 and receive a first answer sentence corresponding to the first prompt and a second answer sentence corresponding to the second prompt. This may make it possible to obtain answer sentences from the LLM server 100 even if the size of the program code is large.
[0096] 7, the scope of the summary or explanation may be specified for each circuit block, which is the smallest unit operable as a ladder program. For example, only line 00002 may be specified in the ladder program.
[0097] 19, the range to be summarized or explained may be specified for each group of multiple circuit blocks described in a ladder program. For example, lines 00002 to 00009 in a ladder program may be specified collectively.
[0098] [Viewpoint 10] The scope of the summary or explanation may be specified for each function block described in the ladder program. The scope of the summary or explanation may be specified for each program module.
[0099] [Viewpoint 11] The reception unit 61 may receive a selection of a range of a program module displayed on the first display unit (e.g., UI 70) to be converted into program code written in a general-purpose programming language. The first conversion unit (e.g., language conversion unit 64) may convert the range received by the reception unit 61 into program code written in a general-purpose programming language. The prompt generation unit 62 may generate program code written in a general-purpose programming language and a natural language prompt requesting a summary of the control content of the program code. The LLM interface 63 may transmit a prompt generated by the prompt generation unit to the LLM server 100 and receive an answer sentence corresponding to the prompt from the large-scale language model. The second display unit (e.g., answer display UI 85) may display text included in the answer sentence received via the LLM interface 63. The editing unit 50 may edit the program module in accordance with a user instruction so as to add at least a portion of the text to the program module as a comment. In this manner, a summary or the like may be generated for a specific program module among multiple program modules included in a project. For example, if multiple program modules are created independently by multiple programmers, the accuracy of the comments provided will vary. Therefore, by using the invention according to this embodiment, the variation in the comments provided will be reduced.
[0100] [Viewpoint 12] The answer may include text that suggests that the LLM server 100 cannot create a comment based on the information provided by the prompt. In this case, the prompt generator 62 may generate a prompt that includes the additional information entered by the user and send the prompt to the LLM interface 63. This may make it easier for the user to obtain the answer they desire.
[0101] [Viewpoint 13] The text suggesting that a comment cannot be created using only the information provided by the prompt may include text indicating that a device comment for a specific device described in the ladder program is missing. The editing unit 50 may accept input of a device comment for a specific device. For example, the CPU 11 may display a device comment editing UI 90 on the display unit 7, prompting the user to edit the specific device comment, and accept the input of the device comment. The prompt generation unit 62 may generate a prompt that includes the device comment as additional information. The LLM interface 63 transmits the prompt to the LLM server 100 and receives a response from the LLM server 100. This may result in a response that reflects the specific device comment.
[0102] [Viewpoint 14] The prompt generator 62 may generate a prompt to ask a question about a part of the answer. The user may read the answer but not understand it. In this case, the CPU 11 may ask the LLM server 100 about the answer, thereby obtaining an answer that is easy for the user to understand.
[0103] [Aspect 15] The setting software 21 is an example of a computer program that supports the creation of a program used in a programmable logic controller. The setting software 21 may cause a computer to execute the following steps: a first display step of displaying a ladder program; a receiving step of receiving a selection of a range in the ladder program displayed in the first display step to be converted into program code written in a general-purpose programming language; a first conversion step of converting the range received in the receiving step into program code written in the general-purpose programming language; a prompt generation step of generating the program code written in the general-purpose programming language and a natural language prompt requesting a summary of control content of the program code; a sending and receiving step of sending the prompt generated in the prompt generation step to a large-scale language model (LLM) and receiving from the large-scale language model a response sentence corresponding to the prompt; a second display step of displaying text included in the response sentence received from the large-scale language model; and an editing step of editing the ladder program so as to add at least a portion of the text as a comment to the ladder program in accordance with a user instruction.
[0104] <Others> In the above-described embodiment, a summary is created for each specified range of a ladder program or for each project module. However, the prompt generation unit 62 may create a prompt that requests the LLM server 100 to create a summary for the entire project. Also, if the project is divided into multiple layers, the prompt generation unit 62 may create a prompt that requests the LLM server 100 to create a summary for each layer. In the above-described embodiment, the specified range is set on a line-by-line basis, but the specified range may also be set on a function-by-function basis.
[0105] The prompt generation unit 62 may create individual prompts for each of the different ladder programs and obtain answer sentences such as summaries for each of the ladder programs. Furthermore, the prompt generation unit 62 may create a prompt for summarizing the answer sentences and obtain an overall summary of the answer sentences from the LLM server 100.
[0106] The invention is not limited to the above-described embodiment, and various modifications and variations are possible within the scope of the gist of the invention.
Claims
1. A program creation support device for supporting the creation of a program used in a programmable logic controller, comprising: a first display unit for displaying a ladder program; a reception unit for receiving a selection of a range to be converted into program code in a general-purpose programming language in the ladder program displayed on the first display unit; a first conversion unit for converting the range received by the reception unit into the program code in the general-purpose programming language; a prompt generation unit for generating a natural language prompt for summarizing the control content of the program code in the general-purpose programming language; an LLM interface for transmitting the prompt generated by the prompt generation unit to a large language model (LLM) and receiving a response sentence corresponding to the prompt from the large language model; a second display unit for displaying the text included in the response sentence received via the LLM interface; and an editing unit for editing the ladder program so as to assign at least a part of the text as a comment to the ladder program according to a user instruction. The program creation support device is characterized by having the above components.
2. The prompt includes at least one of the following: comments attached to input / output elements in the ladder program; information about instructions or program modules in the ladder program; configuration information of a plurality of units forming the programmable logic controller; the project name of a project including the ladder program; the module name of a program module included in the project; a point parameter used as a movement coordinate of a control target in a motion unit controlled according to the ladder program; and setting information of variables described in the ladder program. The program creation support device according to claim 1 is characterized by this.
3. The text included in the response sentence includes an explanatory text for explaining the logic of the selected range in the ladder program. The program creation support device according to claim 1 is characterized by this.
4. The program creation support device according to claim 1, wherein the text included in the response text includes an interpretation text indicating an interpretation of the logic included in the selected range in the ladder program.
5. The prompt generation unit generates a first prompt for instructing the large language model to perform element analysis of the program code. The LLM interface receives a first response text for the first prompt from the large language model. The prompt generation unit obtains relevant information based on the result of the element analysis included in the first response text and generates a second prompt including the relevant information. The LLM interface transmits the second prompt to the large language model and receives a second response text corresponding to the second prompt from the large language model. The second display unit displays the text included in the second response text received via the LLM interface. The program creation support device according to claim 1 is characterized by the above.
6. The program creation support device according to claim 5, wherein the prompt generation unit obtains relevant information based on the result of the element analysis included in the first response text from a database.
7. When the size of the prompt including the program code in the general-purpose programming language exceeds the maximum size that can be input by the large language model, the prompt generation unit divides the prompt into a first prompt and a second prompt. The LLM interface transmits the first prompt and the second prompt to the large language model separately and receives a first response text corresponding to the first prompt and a second response text corresponding to the second prompt. The program creation support device according to claim 1 is characterized by the above.
8. The program creation support device according to claim 1, wherein the range is specified for each circuit block, which is the smallest unit operable as a ladder program.
9. The program creation support device according to claim 1, wherein the range is specified for each group of a plurality of circuit blocks described in the ladder program.
10. The program creation support device according to claim 1, wherein the range is specified for each function block described in the ladder program.
11. The reception unit receives a selection of a range to be converted into program code in a general-purpose programming language in the program module displayed on the first display unit. The first conversion unit converts the range received by the reception unit into the program code in the general-purpose programming language. The prompt generation unit generates a natural language prompt for summarizing the program code in the general-purpose programming language and the control content of the program code. The LLM interface transmits the prompt generated by the prompt generation unit to the large language model (LLM), and receives a response sentence corresponding to the prompt from the large language model. The second display unit displays the text included in the response sentence received via the LLM interface. The editing unit edits the program module so as to add at least a part of the text as a comment to the program module according to a user instruction. The program creation support device according to claim 1, characterized in that.
12. When the response sentence includes text suggesting that the large language model (LLM) cannot create the comment only with the information provided by the prompt, the prompt generation unit generates a prompt including additional information input by the user, and causes the LLM interface to transmit the prompt. The program creation support device according to claim 1, characterized in that.
13. The text suggesting that the comment cannot be created only with the information provided by the prompt includes text indicating that there is a lack of device comments about a specific device described in the ladder program. The editing unit receives an input of device comments about the specific device. The prompt generation unit generates the prompt including the device comments as the additional information. The program creation support device according to claim 12, characterized in that.
14. The prompt generation unit generates a prompt for asking questions about part of the content of the response sentence. The program creation support device according to claim 1, characterized in that.
15. A computer program for assisting in creating a program used in a programmable logic controller, the computer program causing the computer to perform: a first display step of displaying a ladder program; a reception step of receiving a selection of a range to be converted into program code in a general-purpose programming language in the ladder program displayed in the first display step; a first conversion step of converting the range received in the reception step into the program code in the general-purpose programming language; a prompt generation step of generating a natural language prompt for summarizing the program code in the general-purpose programming language and the control content of the program code; a transmission / reception step of transmitting the prompt generated in the prompt generation step to a large language model (LLM) and receiving a response sentence corresponding to the prompt from the large language model; a second display step of displaying the text included in the response sentence received from the large language model; and an editing step of editing the ladder program so as to assign at least a part of the text as a comment to the ladder program according to a user instruction.
Citation Information
Patent Citations
Program generator
JP1996272412A
Programmable controller
JP2010134593A
Development support program, recording medium, development support method, and development support device
JP2017016411A
Dialogue- and machine learning-facilitated code development
US20230195427A1