Program development device and controller
By introducing and storing user-defined motion control commands in program development devices and controllers, users can change or add command words, solving the problem of functional limitations in the prior art, realizing new user-defined functions and higher flexibility.
Patent Information
- Application Number
- CN201980037227.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-07-13
- Filing Date
- 2019-06-18
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2039-06-18
AI Technical Summary
In the prior art, users cannot change or add command words in PLC or machine tools, resulting in functional limitations and the new functions they want cannot be realized.
A program development device and a controller are designed, including a first storage unit that stores established motion control commands and edits motion control commands according to user instructions. The user program may decide to call a manufacturer-defined instruction word or user-defined instruction word. , control the movement of the machinery through user programs.
Users can change or add the processing content of the command word to realize new functions undefined by the manufacturer, and improve the flexibility and functional expansion of mechanical motion control.
Smart Images

Figure CN112219172B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a program development device and a controller. Background Art
[0002] For the instruction words (codes in the program source) used in the motion control of machines such as programmable logic controllers (PLCs), machine tools, robots, etc., standardized or systematized instruction words are used. For example, as instruction words of PLCs, there are codes that comply with IEC61131-3 (JIS B 3503). In addition, the G code used in computer numerical control (CNC) is also standardized according to the International Organization for Standardization (ISO) and can be used as an instruction word.
[0003] Conventionally, in order to ensure the operation, PLCs and machine tools have a structure in which users cannot change the processing content of instruction words or add new instruction words.
[0004] Therefore, in PLC, there is a known technology that libraries a part of a user program and saves it as a unit, thereby making the user program realize the user's know-how to improve the reusability of the user program (for example, refer to Patent Documents 1 and 2).
[0005] Prior art literature
[0006] Patent Literature
[0007] Patent Document 1: Japanese Patent Gazette "Patent No. 3548829 Specification"
[0008] Patent Document 2: Japanese Patent Gazette "Patent No. 4973867 Specification" Summary of the invention
[0009] Problems to be solved by the invention
[0010] However, in the technology described in patent document 1 or patent document 2, in order to prevent the firmware or operating system from losing control or deadlocking due to improper use of the application programming interface (API) provided by the firmware or operating system, the user libraries the user programs using the instruction words provided by the manufacturer. The so-called program library refers to the user program described in accordance with IEC61131-3 being componentized in the form of function blocks or functions, so as to improve the reusability of the program or realize the concealment of the user program. However, the instruction words provided by the manufacturer sometimes impose functional restrictions in order to ensure the action, so the functions that can be realized in the combination of instruction words, i.e., the program library, are also limited, so that the changes desired by the user cannot be made.
[0011] An aspect of the present invention has been made in view of the above circumstances, and an object of the present invention is to provide a technology that enables a user to realize a new function not defined by a manufacturer by changing the processing content of a command word used in the motion control of a machine or adding a new command word.
[0012] Technical means of solving problems
[0013] In order to solve the above-mentioned problem, a program development device of one embodiment of the present invention produces a user program executed by a controller that controls the movement of a machine. The program development device structurally includes: a first storage unit that stores a predetermined first motion control command corresponding to an instruction word; and an editing unit that edits the motion control command corresponding to the instruction word according to the user's instructions.
[0014] In order to solve the problem, a controller of one scheme of the present invention controls the movement of a machine according to a user program, and the controller structurally includes: an execution unit, which executes the user program; a first command program library, which stores an execution code of a predetermined first motion control command corresponding to an instruction word; and a second command program library, which stores an execution code of a second motion control command defined by the user and corresponding to the instruction word, and the execution unit decides whether to call the execution code of the first motion control command or the execution code of the second motion control command according to the user program.
[0015] Effects of the Invention
[0016] According to one aspect of the present invention, a user can change the processing content of a command word used for motion control of a machine or add a new command word. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1This is a block diagram showing a schematic configuration of a system environment using a program development device and a controller according to an embodiment of the present invention.
[0018] Figure 2 This is a block diagram showing the main structure of the controller.
[0019] Figure 3 This is a block diagram showing the main structure of the program development device.
[0020] Figure 4 This is a table showing the comparison between the codes based on each standard and their predetermined processing contents.
[0021] Figure 5 (a) shows an example of a user program using G code. Figure 5 (b) is expressed in XY coordinate system. Figure 5 (a) shows the trajectory of the tool movement of the machine tool using the user program. Figure 5 (c) shows an example of a user program using a code compliant with IEC61131-3.
[0022] Figure 6 It is a diagram showing an example of a display screen of the program development device.
[0023] Figure 7 This is a flowchart showing the editing flow of the processing flow.
[0024] Figure 8 This is a diagram showing an example of a predetermined processing flow.
[0025] Fig. 9 This is a diagram showing an example of a process flow defined by a user.
[0026] Fig.10 This is a diagram showing the processing flow of the firmware API.
[0027] [Explanation of Symbols]
[0028] 1: Controller
[0029] 5: Program development device
[0030] 501: Instruction word designation unit
[0031] 502: User program editing department (Editing department)
[0032] 503: User program creation section
[0033] 504: Instruction Word Editing Department (Editing Department)
[0034] 505: Instruction word code verification unit
[0035] 506: instruction word creation unit
[0036] 507: Ministry of Communications
[0037] 508: User program code storage unit
[0038] 509: User program execution file storage unit
[0039] 510: First instruction word storage unit (first storage unit)
[0040] 511: Second instruction word storage unit (second storage unit)
[0041] 602: Firmware API
[0042] 604: Operating System
[0043] 605: Device Driver
[0044] 606: User program
[0045] 607: Interface (communication unit)
[0046] 610: Storage
[0047] 620: Execution Department DETAILED DESCRIPTION
[0048] Hereinafter, an embodiment of one aspect of the present invention (hereinafter also referred to as “the present embodiment”) will be described with reference to the drawings.
[0049] §1 Application examples
[0050] First, use Figure 1 An example of a scenario to which the present invention is applicable will be described. Figure 1 1 is a diagram showing an overview of a system environment using a program development device 5 and a controller 1 according to the present embodiment. The controller 1 controls the motion of a machine connected via a motion network cable 2. The controller 1 is, for example, a PLC, a machine tool controller, a robot controller, etc. When the controller 1 is a machine tool controller, for example, the controller 1 is connected to a servo driver 200 via a motion network cable 2, and drives a servo motor 201 connected to the servo driver 200. As a motion network, for example, EtherCAT (registered trademark) is used.
[0051] The program development device 5 has a function of editing the user program and the instruction word according to the user operation. In addition, the program development device 5 verifies the code of the edited instruction word to determine whether the machine as the control object of the controller 1 is operating normally. In addition, the program development device 5 creates the edited user program and instruction word, sets it to an executable file format, and transmits it to the controller 1 and saves it.
[0052] The user can change the processing content of the instruction word or add a new instruction word by operating through the program development device 5. In the program development device 5, the user can set the processing content to be implemented by the instruction word in the form of a dialogue with the program development device 5. The program development device 5 generates the processing content set by the user using a high-level language such as C or C++. In addition, the user can also program the processing content to be implemented by the instruction word in the program development device 5 using a high-level language such as C or C++.
[0053] The user program and instruction word edited by the user are generated after confirming through simulation that no call error of the controller firmware API will occur. In addition, the controller firmware API can only be executed in the firmware standby state, so the following structure is used, that is, the firmware state wait is performed, the API processing is accepted when the state is acceptable, and the API returns an error when the state is not acceptable, thereby preventing the firmware from becoming an improper state.
[0054] In this way, in the system environment using the program development device 5 and the controller 1 of this embodiment, the user can change the processing content of the instruction word used in the motion control of the machine or add a new instruction word. In addition, the program development device 5 can install the edited user program and instruction word in the controller 1 after confirming that the motion control of the machine is normally performed using the API of the controller firmware.
[0055] §2 Structure Example
[0056] The following describes the configuration of the program development device 5 and the controller 1 according to the embodiment of the present invention. Figure 1 , Figure 2 as well as Figure 3 Let me explain in detail. Figure 1 It is a diagram schematically showing a system environment using the program development device 5 and the controller 1 . Figure 2 2 is a block diagram showing a main part structure of the controller 1 . Figure 3 It is a block diagram showing the main structure of the program development device 5.
[0057] 〔About system environment〕
[0058] like Figure 1 As shown, the controller 1 is connected to the servo driver 200 of the machine tool as the control object via the motion network cable 2, and drives the servo motor 201 connected to the servo driver 200. The machine tool as the control object of the controller 1 includes a plurality of servo drivers 200, and the servo motors 201 connected to the respective servo drivers 200 are driven to perform processing on the processing object part. In addition, Figure 1In FIG. 1 , a structure in which the controller 1 controls the motion of a machine tool is shown. However, the controller 1 is not limited to a controller of a machine tool, and may be a PLC or a robot controller.
[0059] In addition to the servo driver 200 , a communication coupler 202 can be connected to the controller 1 via the motion network cable 2 . Figure 1 2 shows an example of connection in a daisy chain manner, but other connection methods can also be used to connect the servo driver 200 or the communication coupler 202. In addition, the general analog output unit 205, the general analog input unit 204, and the general digital input / output unit 203 can exchange data with the communication coupler 202 via the internal bus.
[0060] Furthermore, the controller 1 is connected to a touch panel 4 via a hub 3. The touch panel 4 is an operation panel of the controller 1. The touch panel 4 may be mounted on a machine tool or robot to be controlled, or may be provided independently of the machine tool or robot to be controlled.
[0061] Furthermore, the controller 1 is connected to a program development device 5 via a network hub 3 and an Ethernet (registered trademark) cable 301. The program development device 5 is, for example, a general-purpose computer. The program development device 5 stores a user program executed in the controller 1 and a command word used in the motion control of the machine tool by the controller 1. Although the details will be described later, the user can edit the user program and the command word executed in the controller 1 by operating the program development device 5.
[0062] [Regarding the structure of the controller 1]
[0063] like Figure 2 As shown, the controller 1 includes an interface 607 (communication unit) for transmitting and receiving data with the program development device 5, and is connected to the program development device 5 via the interface 607. The controller 1 includes a motion network unit 608, which is an interface for transmitting and receiving data with the servo driver 200. The motion network unit 608 communicates with the servo driver 200 via the motion network port 101.
[0064] The controller 1 includes a storage unit 610 and an execution unit 620. In addition, the controller 1 includes a firmware application program interface (API) 602, firmware 603, an operating system (OS) 604, and a device driver 605. In addition, in the following description, for the part where the function of each part is described without distinguishing between hardware and software, part or all of the function of each part can be executed by either hardware or software, or by the cooperation of hardware and software.
[0065] The storage unit 610 stores a user program 606, a manufacturer-defined instruction word group 600, and a user-defined instruction word group 601. The user program 606, the manufacturer-defined instruction word group 600, and the user-defined instruction word group 601 store programs described in codes conforming to IEC61131-3 when the controller 1 is a PLC, and stores programs described in G codes standardized according to ISO when the controller 1 is a motion controller for a machine tool.
[0066] The user program 606 is a program executed on the controller 1 and is a program for controlling the operation of the controller 1. That is, the controller 1 controls the motion of the machine as the control target according to the user program.
[0067] When the controller 1 is a PLC, the user program 606 is created and stored in the storage unit 610 in a binary format. When the controller 1 is a machine tool controller, the source code described in G code is stored in the storage unit 610 in a text format without creating a CNC user program.
[0068] The manufacturer-defined instruction word group 600 includes a plurality of instruction words and predetermined processing contents corresponding to each instruction word and implemented by the instruction word. The predetermined processing contents refer to processing contents corresponding to each instruction word defined by the manufacturer of the controller 1, for example, processing contents corresponding to the G code in accordance with the ISO standard. The control command for executing the predetermined processing corresponding to the instruction word is called the first motion control command.
[0069] The manufacturer defined command word group 600 includes a library of execution codes of the first motion control command in a binary format created corresponding to each command word. The area in the storage unit 610 storing the manufacturer defined command word group 600 is also referred to as a first command library.
[0070] The user-defined instruction word group 601 includes a plurality of instruction words and processing contents defined by the user and implemented by using the instruction words corresponding to each instruction word. The control command for executing the user-defined processing corresponding to the instruction word is called the second motion control command. In the user-defined instruction word group 601, corresponding to each instruction word, the execution code of the second motion control command, i.e., the user-defined instruction word, is included in the created binary format. In addition, the area in the storage unit 610 that stores the user-defined instruction word group 601 is also called the second instruction program library.
[0071] The execution unit 620 loads and executes the user program and the command program library stored in the storage unit 610. The execution unit 620 may also include, for example, a central processing unit (CPU) as a computing device and a memory. The execution unit 620 determines whether to call a predetermined instruction word stored in the manufacturer-defined instruction word group 600 or a user-defined instruction word stored in the user-defined instruction word group 601 according to the user program.
[0072] When the controller 1 is a PLC and the user program is a compiler-type program, the user program describes which of the execution code of the first motion control command and the execution code of the second motion control command should be called. The execution unit 620 can determine whether to call the execution code in the first command program library or the execution code in the second command program library by executing the user program.
[0073] Furthermore, when the user program is a CNC user program, the execution unit 620 reads the source file of the user program line by line and executes the commands of each line in sequence. When the execution code corresponding to the instruction word recorded in the user program exists in the second instruction program library, the execution unit 620 calls the execution code of the second motion control command. On the other hand, when the execution code corresponding to the instruction word recorded in the user program does not exist in the second instruction program library, the execution unit 620 calls the execution code of the first motion control command from the first instruction program library.
[0074] The firmware API 602 is called by the execution unit 620 that executes the instruction word defined by the user. The firmware API changes between a first state in which the execution unit 620 is allowed to call the firmware API and a second state in which the execution unit 620 is not allowed to call the firmware API.
[0075] When the execution unit 620 calls the execution code of the second motion control command according to the user program, the firmware API 602 is called by the execution unit 620 to execute the execution code of the second motion control command. In addition, when the execution unit 620 calls the execution code of the first motion control command according to the user program, the firmware API 602 is not called to execute the execution code of the first motion control command.
[0076] When the execution unit 620 calls the execution code of the second motion control command, the firmware API changes to the second state that does not allow further calling. When the execution unit 620 finishes the execution of the execution code of the second motion control command, the firmware API changes to the first state that allows calling.
[0077] The firmware 603 operates the machine as a control target according to the motion control command executed by the execution unit 620 .
[0078] The operating system 604 is system software of the controller 1 , and comprehensively controls each unit of the controller 1 .
[0079] The device driver 605 is software for enabling the hardware devices such as the Ethernet (registered trademark) port 100 or the motion network port 101 provided in the controller 1 to be controlled by the operating system 604. The firmware 603 and the operating system 604 communicate with the control object such as the servo driver 200 connected to the motion network port 101 via the device driver 605 to control the control object. Furthermore, the operating system 604 transmits and receives data with the program development device 5 connected to the Ethernet (registered trademark) port 100 via the device driver 605.
[0080] The controller 1 communicates with the program development device 5 via the interface 607, and receives the execution code of the second motion control command and the source code of the second motion control command from the program development device 5. Furthermore, the interface 607 includes (stores) the received execution code of the second motion control command and the source code of the second motion control command in the user-defined instruction word group 601 of the storage unit 610.
[0081] Furthermore, the controller 1 may be connected to a plurality of program development devices 5 via the interface 607. Furthermore, the interface 607 may transmit the execution code of the second motion control command and the source code of the second motion control command received from the program development device 5 and stored in the storage unit 610 to the other program development devices in response to requests from the other program development devices. Thus, for the user program executed by the controller 1, when the user-defined instruction word is used, the other program development devices can also know the content of its operation.
[0082] [Regarding the structure of the program development device 5]
[0083] like Figure 3 As shown, the program development device 5 provides a program development environment for creating a user program to be executed by the controller 1. The program development device 5 includes a user program code storage unit 508, a user program execution file storage unit 509, a first instruction word storage unit 510, and a second instruction word storage unit 511.
[0084] The user program code storage unit 508 stores source codes that are the same as the source codes written in the user program 606 in the controller 1 .
[0085] The user program execution file storage unit 509 stores the same execution file as the user program execution file in the user program 606 written in the controller 1. In this way, in the program development device 5, the source code of the user program and the execution file are stored separately.
[0086] In the first instruction word storage unit 510 (first storage unit), a first motion control command is stored corresponding to the instruction word, and the first motion control command executes a predetermined process defined by the manufacturer of the controller 1. In the first instruction word storage unit 510, source code, execution code, and processing content corresponding to the predetermined first motion control command included in the manufacturer-defined instruction word group 600 of the controller 1 are stored corresponding to the instruction word.
[0087] In the second instruction word storage unit 511 (second storage unit), second motion control instructions for executing processing defined by the user are stored in correspondence with the instruction words. In the second instruction word storage unit 511, source codes, execution codes, and processing contents corresponding to the user-defined second motion control instructions included in the user-defined instruction word group 601 are stored in correspondence with the instruction words.
[0088] In this way, the program development device 5 stores codes corresponding to the source code and execution code included in the user program 606 of the controller 1 , the manufacturer-defined instruction word group 600 , and the user-defined instruction word group 601 .
[0089] Here, the motion control command is explained. Figure 4 This is a table showing the comparison between the codes based on each standard and their predetermined processing contents. Figure 5 (a) and Figure 5 (c) shows an example of a user program using each code. Figure 4As shown, the motion control command may also have codes corresponding to commands using G codes, commands complying with IEC61131-3, and commands using robot language, which indicate the same content processing. For example, G01 using G codes, MC_MoveLinear using codes complying with IEC61131-3, and MOVES using robot language are all commands (instruction words) indicating linear interpolation actions.
[0090] User programs use these commands, such as Figure 5 (a) and Figure 5 It is produced as shown in (c). Figure 5 (a) shows an example of a source file of a user program using G codes. Figure 5 As shown in (a), in a user program using G codes, commands are recorded in each line. The command of line 001 is to perform linear interpolation (linear movement) to the position of X100, Y100, and the command of line 002 is to perform linear interpolation to the position of X100, Y200.
[0091] In addition, in each G code command, the processing flow of setting the moving target coordinates, specifying the moving speed, starting the movement, and waiting until the movement is completed is grouped together. When one set of processing flows is completed, one command ends.
[0092] Figure 5 (b) is an XY coordinate system that is used to represent the execution of the execution unit 620 of the controller 1. Figure 5 The execution unit 620 of the controller 1 reads the moving path of the tool of the machine tool line by line. Figure 5 The source code shown in (a) of FIG. 1 is executed sequentially, thereby, Figure 5 The tool of the machine tool is moved as shown by the arrow in (b).
[0093] and, Figure 5 (c) shows an example of a source file of a user program using a code conforming to IEC61131-3. In a user program using IEC61131-3, in addition to the direction of movement, speed, acceleration, deceleration, and jerk can be specified in a command. Figure 5 The example shown in (c) is Figure 5 Similarly, the user program using G code shown in (a) of FIG. 1 instructs linear interpolation to the position of X100, Y100, and then performs linear interpolation to the position of X100, Y200. In the user program using IEC61131-3, the speed is further 10mm / s and the acceleration is 100mm / s. 2 , deceleration 100mm / s2 , jerk 0 to control the movement of the machine tool's tool.
[0094] The program development device 5 includes an instruction word designation unit 501, a user program editing unit 502, a user program creation unit 503 (a first creation unit), an instruction word editing unit 504, an instruction word code verification unit 505, and an instruction word creation unit 506 (a second creation unit). In addition, the user program editing unit 502 and the instruction word editing unit 504 are also collectively referred to as an editing unit. In addition, the program development device 5 includes a communication unit 507.
[0095] The instruction word designation unit 501 receives a user's instruction as to whether to give priority to the first motion control command or the second motion control command as a process of the instruction word described in the source code of the user program executed by the controller 1. Thus, the instruction word designation unit 501 designates whether to set the motion control command corresponding to the instruction word executed by the controller 1 as the predetermined first motion control command or as the user-defined second motion control command.
[0096] The user program editing unit 502 edits the user program according to the user's instructions. The user can edit the source code of the user program stored in the user program code storage unit 508. The user program stored in the user program code storage unit 508 may be overwritten or stored as a revision.
[0097] The user program creation unit 503 creates the source code of the user program. The user program creation unit 503 compiles the user program to a binary (machine language) file and links it to the program library. In addition, the user program creation unit 503 does not need to create a CNC user program written in G code, so it does not create it. The user program creation unit 503 creates a PLC user program using a code that complies with IEC61131-3, or a user program for robot control using a robot instruction word.
[0098] If the second motion control command corresponding to the instruction word recorded in the source code of the user program exists in the second instruction word storage unit 511, the user program creation unit 503 creates the source code in association with the second motion control command. If the second motion control command corresponding to the instruction word recorded in the source code of the user program does not exist in the second instruction word storage unit 511, the user program creation unit 503 creates the source code in association with the first motion control command.
[0099] The user program creation unit 503 creates a source code based on the priority control command specified by the instruction word designation unit 501. The user program creation unit 503 creates the source code in association with the first motion control command when the first motion control command is prioritized, and creates the source code in association with the second motion control command when the second motion control command is prioritized.
[0100] The action of the user program creation unit 503 when specifying that the second motion control command is given priority is described. If the second motion control command corresponding to the instruction word recorded in the source code of the user program exists in the second instruction word storage unit 511, the user program creation unit 503 creates the source code in association with the second motion control command. Moreover, if the second motion control command corresponding to the instruction word recorded in the source code of the user program does not exist in the second instruction word storage unit 511, the user program creation unit 503 creates the source code in association with the first motion control command. That is, for example, if there is a user-defined MC_MoveLinear with respect to the instruction word MC_MoveLinear recorded in the user program, the user program is linked to the user-defined second motion control command. If there is no user-defined MC_MoveLinear with respect to the instruction word MC_MoveLinear, the user program is linked to the predetermined second motion control command.
[0101] The instruction word editing unit 504 edits the motion control command stored in the first instruction word storage unit 510 or the second instruction word storage unit 511 corresponding to the instruction word according to the user's instruction.
[0102] The motion control command edited by the instruction word editing unit 504 is stored in the second instruction word storage unit 511 as a second motion control command.
[0103] The instruction word code check unit 505 functions as a compiler that checks the code of the motion control command edited by the instruction word editing unit 504. Alternatively, the instruction word creation unit 506 may include the function of the instruction word code check unit 505.
[0104] The instruction word creation unit 506 creates the second motion control command. The instruction word creation unit 506 creates the second motion control command regardless of whether the second motion control command is a command based on a G code, a command based on a code compliant with IEC61131-3, or a command based on a robot instruction word.
[0105] The communication unit 507 communicates with the controller 1. The communication unit 507 sends the execution code of the second motion control command and the source code of the second motion control command to the controller 1. In addition, the communication unit 507 may also request the controller 1 to send the execution code of the second motion control command and the source code of the second motion control command, and receive the execution code of the second motion control command and the source code of the second motion control command from the controller 1.
[0106] [Regarding the editing of the processing flow in the program development device 5]
[0107] Figure 6 1 is a diagram showing an example of a display screen 551 when editing a process flow in the program development device 5. Selection buttons (process A, process B, process C, process D, etc.) representing representative processes may also be displayed on the display screen 551. In addition, a control process button 552 for inputting arrows representing the process flow, conditional branches, comment text, etc. may also be displayed on the display screen 551.
[0108] When the user selects a process that he or she wishes to edit from the selection buttons representing representative processes, the flow associated with the process is displayed on the flow display and editing section 550. The user can operate the control process button 552 in the flow displayed on the flow display and editing section 550 to add a process, delete a process, change the content of a process, etc. Furthermore, the user can also input a new process name to generate a code for an instruction word.
[0109] [About the editing process of the processing flow]
[0110] Figure 7 This is a flowchart showing the editing flow of the processing flow.
[0111] (Step S1)
[0112] The user sets (designates) the instruction word to be edited by operating the program development device 5. The user may set the instruction word to be edited by using either a name or a number. For example, when the user edits the process of G01, the user operates to set G01 on the program development device 5. The user may also operate to input or select G01 as the target instruction word to be edited on the process flow editing screen of the program development device 5, thereby setting the instruction word to be edited to G01.
[0113] (Step S2)
[0114] The program development device 5 determines whether the command word set by the user is a new command word. For example, when the command word set by the user is G01, since the command word is a predetermined command word of the G code, the program development device 5 determines that the command word set by the user is not a new command word (No in step S2), and proceeds to step S3. When the program development device 5 determines that the command word set by the user is a new command word (Yes in step S2), it proceeds to step S5.
[0115] (Step S3)
[0116] The program development device 5 displays a predetermined processing flow of the instruction words set by the user on the flow display editing unit 550 of the display screen 551 .
[0117] (Step S4)
[0118] The user specifies a portion that he wants to change in the processing flow displayed in the flow display editing unit 550 .
[0119] (Step S5)
[0120] The program development device 5 displays a screen for creating and editing a new processing flow on the display screen 551. Figure 6 As shown, selection buttons representing representative processes, a control process button 552 , and a flow display editing section 550 are displayed.
[0121] (Step S6)
[0122] The user creates a processing flow corresponding to the newly set instruction word on the display screen 551.
[0123] In step S4 and step S6, the user selects an icon displayed on the display screen 551 to add or delete a process, edit the content, and create or edit a process flow.
[0124] (Step S7)
[0125] The program development device 5 automatically generates source code (eg, source code written in a high-level language) corresponding to the processing flow created or edited in step S4 or step S6 through the function of the editing unit. For example, the program development device 5 pre-stores source code written in a high-level language corresponding to the processing flow.
[0126] (Step S8)
[0127] The user may also use a high-level language such as C or C++ to additionally install (edit) the content of the process that he or she wishes to change in the process flow created or edited in step S4 and step S6.
[0128] (Step S9)
[0129] The program development device 5 performs syntax checking of the code installed in step S8 by using the function of the editing unit.
[0130] (Step S10)
[0131] The program development device 5 creates codes for production, editing or installation through the function of the instruction word creation unit 506.
[0132] (Step S11)
[0133] The program development device 5 confirms through simulation on the program development device 5 that no error in calling the firmware API 602 of the controller 1 will occur due to the second motion control command of the created user-defined instruction word.
[0134] (Step S12)
[0135] The program development device 5 determines whether there is no error in calling the firmware API 602 of the controller 1. If no error has occurred (Yes in step S12), the program development device 5 proceeds to step S14. If an error has occurred (No in step S12), the program development device 5 proceeds to step S13.
[0136] (Step S13)
[0137] The program development device 5 displays the portion to be corrected on the display screen 551, and returns to step S8 to request the user to make corrections.
[0138] (Step S14)
[0139] The program development device 5 completes the creation, editing or additional installation of the instruction word and ends the process. In addition, the program development device 5 sends the second motion control command corresponding to the instruction word that has been generated to the controller 1 via the communication unit 507 in correspondence with the instruction word.
[0140] In this way, the instruction words created, edited or additionally installed in the program development device 5 are sent to the controller 1 after confirming that no call error of the firmware API 602 will occur. Therefore, even if new instruction words can be created or existing instruction words can be edited by the program development device 5, it is possible to avoid these user-defined instruction words from affecting the behavior of the controller 1 or the control of the controller 1.
[0141] Furthermore, the user can use icons displayed on the display screen 551 of the program development device 5 to set the creation of new instruction words or the editing of existing instruction words in a dialog form, and further, the source code is automatically generated, so the user can easily generate user-defined instruction words. Furthermore, the user can use a high-level language to add the processing that he wants to change to the processing flow of the instruction words, so the user can achieve the desired control with good accuracy through the controller 1.
[0142] Figure 8 This is a diagram showing an example of a predetermined processing flow displayed in the flow display editing unit 550 . Fig. 9 It means that the user Figure 8 The illustrated process flow is a diagram of an example of a user-defined process flow displayed on the process display editing unit 550 after the process flow has been changed.
[0143] like Figure 8 As shown in FIG. 1 , the processing flow defined by one instruction word (e.g., G01 or MC_MoveLinear) includes multiple processes P1 to P5, such as setting the target position (process P1), setting the target speed (process P2), starting the action (process P3), waiting for the action to be completed (process P4), and completing the action (process P5). The user can edit the parameters of each of the processes P1 to P5, sort the order of the processes, delete a process, or add a new process by operating the program development device 5.
[0144] For example, Fig. 9 As shown, the user can also perform the following editing, that is, after setting the target position (process P1), setting the target speed (process P2), starting the action (process P3), and waiting for the action to complete (process P4), add the processing of setting the second target position (process P15), starting the second action (process P16), and waiting for the second action to complete (process P17).
[0145] In this way, the instruction word defined by the user is transmitted to the controller 1 via the communication unit 507 and stored in the storage unit 610 of the controller 1 .
[0146] As described above, when it is specified that the second motion control command defined by the user is given priority, the execution unit 620 executes the motion control command by preferentially using the command words stored in the user-defined command word group 601 .
[0147] In addition, steps S7 to S8 (direct editing using a high-level language) can also be omitted. Steps S9 or S11 to S12 can also be omitted. Furthermore, steps S3 to S6 can also be omitted, and steps S7 to S8 of directly editing the processing flow corresponding to the instruction word using a high-level language can be performed.
[0148] [About the role of firmware API]
[0149] Furthermore, there is known a technique in which a C language application program that is different from the ladder language application program and operates on a microprocessor is called as a function from a ladder language application program used in a PLC.
[0150] In the case where a C language application is called as a function from an application executed on a PLC as described above, a pointer is sometimes used to specify a memory area used by the firmware to write data. In this case, there is a problem that the operation of the firmware becomes unstable. In addition, in the prior art, no countermeasures are taken regarding the impact on the firmware or the operating system, and the operation of the PLC may become unstable.
[0151] In this embodiment, the execution of the second motion control command is controlled by the function of the firmware application program interface (API) 602, thereby preventing the second motion control command from having adverse effects on the firmware or the operating system.
[0152] Fig.10 Schematically shows the processing flow of the firmware API 602. Fig.10 As shown, the firmware API 602 has a function of switching the status between initializing (step S101), waiting (step S102), and ending (step S105).
[0153] (Step S101)
[0154] The execution unit 620 of the controller 1 calls the firmware API 602 according to the user program to execute the execution code of the second motion control command. The firmware API 602 changes the state from initialization to standby.
[0155] (Step S102)
[0156] The firmware API 602 is in the first state where calls are permitted only when the system is in standby mode.
[0157] (Step S103)
[0158] When the firmware API 602 is called in the standby state and the execution code of the second motion control command is being executed, the state changes to the second state in which the call is not allowed. In the second state, the called firmware API 602 is a call error.
[0159] When the execution code of the second motion control command is completed, the state of the firmware API 602 changes to standby (step S102 ).
[0160] (Step S104)
[0161] When an abnormality occurs in the firmware API 602 or the execution code of the second motion control command during the execution of the execution code of the second motion control command, the firmware API 602 enters the stop process. When the stop process is completed, the firmware API 602 changes to the standby state (step S102).
[0162] (Step S105)
[0163] The firmware API 602 terminates its function when the execution unit 620 of the controller 1 stops operating.
[0164] (Step S120)
[0165] Furthermore, the firmware API 602 changes to the second state in which the call is not allowed when an error occurs in the firmware 603. The firmware API 602 maintains the second state in which the call is not allowed until the error in the firmware 603 is resolved.
[0166] Thus, in this embodiment, the firmware API 602 is changed to the second state that does not allow the firmware API 602 to be called during the execution of the execution code of the second motion control command or when an error occurs in the firmware 603. This prevents the firmware API 602 from being improperly used or the firmware 603 or the operating system 604 from being out of control or deadlocked.
[0167] 〔Example of implementation using software〕
[0168] The control block of the controller 1 (especially the execution unit 620, firmware 603 and firmware API 602) and the control block of the program development device 5 (especially the instruction word designation unit 501, the user program editing unit 502, the user program creation unit 503, the instruction word editing unit 504, the instruction word code verification unit 505 and the instruction word creation unit 506) can be implemented by a logic circuit (hardware) formed on an integrated circuit (IC (Integrated Circuit) chip) or the like, or by software.
[0169] In the latter case, the controller 1 and the program development device 5 include a computer that executes the commands of the software, i.e., the program, that realizes each function. The computer includes, for example, one or more processors and a computer-readable recording medium storing the program. In addition, in the computer, the program is read and executed from the recording medium by the processor, thereby achieving the purpose of the present invention. As the processor, for example, a central processing unit (CPU) can be used. As the recording medium, a "non-temporary tangible medium" can be used, for example, in addition to a read-only memory (ROM), a tape, a disk, a card, a semiconductor memory, a programmable logic circuit, etc. can also be used. Moreover, a random access memory (RAM) for expanding the program can also be included. Moreover, the program can also be provided to the computer via any transmission medium (communication network or broadcast wave, etc.) that can transmit the program. In addition, an embodiment of the present invention can also be implemented in the form of a data signal embedded in a carrier wave that materializes the program through electronic transmission.
[0170] 〔Summarize〕
[0171] A program development device according to one embodiment of the present invention produces a user program executed by a controller for controlling the movement of a machine. The program development device structurally includes: a first storage unit for storing a predetermined first motion control command corresponding to an instruction word; and an editing unit for editing the motion control command corresponding to the instruction word according to the user's instructions.
[0172] According to the above configuration, the motion control command for controlling the motion of the machine can be edited in accordance with the instruction of the user, thereby enabling the user to change the processing content of the instruction word used in the motion control of the machine or add a new instruction word.
[0173] Furthermore, the program development device according to one aspect of the present invention may include a second storage unit configured to store the edited motion control command as a second motion control command in correspondence with the instruction word.
[0174] According to the above configuration, the second motion control command for executing the process defined by the user can be stored independently of the established first motion control command in correspondence with the instruction word without rewriting the established first motion control command.
[0175] Moreover, a program development device according to one embodiment of the present invention may also include: a first creation unit, which creates the source code of the user program; and a second creation unit, which creates the second motion control command. If the second motion control command corresponding to the instruction word recorded in the source code exists in the second storage unit, the first creation unit creates the source code in association with the second motion control command. If the second motion control command corresponding to the instruction word recorded in the source code does not exist in the second storage unit, the first creation unit creates the source code in association with the first motion control command.
[0176] According to the structure, when the second motion control command exists in the second storage unit, the source code of the user program is created in association with the second motion control command. Thus, when the second motion control command defined by the user exists, the user program automatically executes the second motion control command. Thus, the user can execute the second motion control command by creating the second motion control command without specifying which of the first motion control command and the second motion control command to execute.
[0177] Moreover, a program development device according to one embodiment of the present invention may also include: a first creation unit, which creates the source code of the user program; a second creation unit, which creates the second motion control command; and an instruction word designation unit, which processes the instruction word recorded in the source code and accepts the user's instructions as to whether to give priority to the first motion control command or the second motion control command, wherein when the first motion control command is given priority, the first creation unit creates the source code in association with the first motion control command, and when the second motion control command is given priority, the first creation unit creates the source code in association with the second motion control command.
[0178] According to the structure, the user can specify whether to give priority to the first motion control command or the second motion control command by user operation. Therefore, the following structure can also be set, that is, the user can specify whether to execute the motion corresponding to the first motion control command or the motion corresponding to the second motion control command each time according to the parts produced in the machine tool, for example.
[0179] Moreover, a controller of one embodiment of the present invention controls the movement of a machine according to a user program, and the controller structurally includes: an execution unit that executes the user program; a first command program library that stores an execution code of a predetermined first motion control command corresponding to an instruction word; and a second command program library that stores an execution code of a second motion control command defined by a user corresponding to the instruction word, and the execution unit determines whether to call the execution code of the first motion control command or the execution code of the second motion control command based on the user program.
[0180] According to the above structure, the motion of the machine can be controlled by calling either the execution code of the predetermined first motion control command or the execution code of the second motion control command defined by the user. Therefore, by calling the execution code of the second motion control command defined by the user, the machine can perform the motion desired by the user.
[0181] Moreover, the controller of one embodiment of the present invention may also structurally include: a firmware application program interface (API), which switches between a first state in which calls are allowed and a second state in which calls are not allowed, and when the execution code of the second motion control command is called according to the user program, the execution unit calls the firmware API to execute the execution code of the second motion control command, and when the execution code of the first motion control command is called according to the user program, the execution unit does not call the firmware API to execute the execution code of the first motion control command.
[0182] According to the above configuration, by executing the execution code of the second motion control command via the firmware API, it is possible to specify the memory area used by the firmware, thereby preventing the operation of the firmware from becoming unstable.
[0183] Moreover, in a controller according to one aspect of the present invention, the firmware API may be configured such that the firmware API changes to the second state when the execution of the execution code of the second motion control command starts, and changes to the first state when the execution of the execution code of the second motion control command ends.
[0184] According to the above structure, calling the firmware API is not allowed during execution of the execution code of the second motion control command or when an error occurs in the firmware, thereby preventing the firmware API from being improperly used or the firmware or operating system from running out of control or deadlocking.
[0185] Moreover, the controller of one embodiment of the present invention may be such that, when the execution code corresponding to the instruction word recorded in the user program exists in the second command program library, the execution unit calls the execution code of the second motion control command; and when the execution code corresponding to the instruction word recorded in the user program does not exist in the second command program library, the execution unit calls the execution code of the first motion control command.
[0186] According to the above configuration, the execution code of the second motion control command in the second command library can be preferentially called and executed. Therefore, the motion of the machine to be controlled can be controlled by the second motion control command corresponding to the instruction word defined by the user.
[0187] Moreover, the controller of one embodiment of the present invention may also include: a communication unit, which communicates with a program development device that creates the user program, wherein the communication unit receives an execution code of the second motion control command and a source code of the second motion control command from the program development device, and saves the execution code of the second motion control command and the source code of the second motion control command in the second command program library, and sends the execution code of the second motion control command and the source code of the second motion control command saved in the second command program library to the other program development devices based on a request from the other program development devices.
[0188] According to the above configuration, when a user program executed by the controller uses a user-defined instruction word, other program development devices can also know the content of the operation.
[0189] The present invention is not limited to the above-described embodiments, and various modifications can be made within the scope of the claims. Embodiments obtained by appropriately combining technical components disclosed in different embodiments are also included in the technical scope of the present invention.
Claims
1. A program development device for producing a user program to be executed by a controller for controlling the movement of a machine, the program development device comprising: A first storage unit stores a predetermined first motion control command corresponding to the instruction word; as well as an editing unit, which edits a motion control command corresponding to the instruction word according to an instruction of a user, wherein the first motion control command is a command for executing a predetermined process defined by a manufacturer of the controller, and the edited motion control command is a command for executing a process defined by the user; a second storage unit, storing the edited motion control command as a second motion control command corresponding to the instruction word; A first creation unit, creating a source code of the user program; as well as A second creating unit is configured to create the second motion control command. The first creation unit determines whether the second motion control command corresponding to the instruction word recorded in the source code exists in the second storage unit, If the second motion control command corresponding to the instruction word recorded in the source code exists in the second storage unit, the first creation unit creates the source code in association with the second motion control command, If the second motion control command corresponding to the instruction word described in the source code does not exist in the second storage unit, the first creation unit creates the source code in association with the first motion control command.
2. A controller for controlling the movement of a machine according to a user program, the controller comprising: An execution unit, for executing the user program; A first command program library stores an execution code of a predetermined first motion control command corresponding to the instruction word; The second command library stores the execution code of the second motion control command defined by the user and corresponding to the instruction word, wherein the first motion control command is a command for executing a predetermined process defined by the manufacturer of the controller, and the edited motion control command is the second motion control command, which is a command for executing the process defined by the user. The execution unit determines whether to call the execution code of the first motion control command or the execution code of the second motion control command according to the user program; as well as The firmware application program interface switches between a first state in which the call is allowed and a second state in which the call is not allowed, determining whether the execution code corresponding to the instruction word recorded in the user program exists in the second instruction program library, When the execution code corresponding to the instruction word written in the user program exists in the second instruction library, When the execution code of the second motion control command is called according to the user program, the execution unit calls the firmware application program interface to execute the execution code of the second motion control command. When the execution code of the first motion control command is called according to the user program, the execution unit does not call the firmware application program interface to execute the execution code of the first motion control command. When the execution code corresponding to the instruction word described in the user program does not exist in the second instruction library, the execution unit calls the execution code of the first motion control instruction.
3. The controller according to claim 2, wherein The firmware application program interface changes to the second state when the execution of the execution code of the second motion control command starts, and changes to the first state when the execution of the execution code of the second motion control command ends.
4. The controller according to any one of claims 2 to 3, comprising: a communication unit for communicating with a program development device for producing the user program, The communication unit receives the execution code of the second motion control command and the source code of the second motion control command from the program development device, and saves the execution code of the second motion control command and the source code of the second motion control command into the second command program library. In response to a request from another program development device, the execution code of the second motion control command and the source code of the second motion control command stored in the second command library are sent to the other program development device.
