System program optimization device, system program optimization system, and computer-readable storage medium
The system program optimization device addresses inefficiencies in numerical control devices by optimizing system programs using external input signal constants, resulting in reduced execution times and improved performance.
Patent Information
- Application Number
- JP2024509700
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-03-25
AI Technical Summary
Numerical control devices generate unnecessary source code and symbols due to varying system configurations, and existing optimization methods fail to account for external input signals, leading to inefficiencies and increased execution times.
A system program optimization device that acquires constant values for external input signals and uses a compiler to convert system programs into optimized object programs, reducing redundant code and improving execution efficiency.
The optimization reduces execution times and memory usage by minimizing instruction executions and eliminating unnecessary branches, enhancing the performance of numerical control devices.
Smart Images

Figure 0007794950000001 
Figure 0007794950000002 
Figure 0007794950000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a system program optimization device, a system program optimization system, and a computer-readable storage medium. [Background technology]
[0002] Currently, there is a technology called program optimization. Optimization is a process that makes programs more efficient, shortens execution time, and reduces execution load. Optimization reduces the number of memory executions, uses faster instructions, makes efficient use of memory hierarchy, and uses highly parallel memory. Techniques to reduce the number of instruction executions include common subexpression elimination, constant folding, constant propagation, loop invariant elimination, induction variable elimination, operator strength reduction, loop unrolling, loop fusion, dead instruction elimination, duplication propagation, code hoisting, procedure call specialization, and exploiting properties of expressions. To use the memory hierarchy efficiently, optimization is performed to efficiently use registers out of the memory hierarchy of registers, cache (primary and secondary), memory, and disk. There is also optimization to efficiently use cache by changing the execution order. An important optimization in compilers is loop optimization. Optimizing a few loops can improve execution time.
[0003] Conventionally, a method has been proposed as a program optimization method in which the inside of a system program is searched and analyzed, and whether symbols (variables) contained in the source code are used or unused is determined, and then the symbols (variables) that are identified as unused are optimized (see, for example, Patent Document 1).
[0004] Regarding the system program of a numerical control device, there is also a technology that optimizes unnecessary branch instructions of unused functions based on the usage history of functions when a machining program is executed (see, for example, Patent Document 2). [Prior art documents] [Patent documents]
[0005] [Patent Document 1] Japanese Patent Application Laid-Open No. 2000-207226 [Patent Document 2] Japanese Patent Application Laid-Open No. 2016-133911 Summary of the Invention [Problem to be solved by the invention]
[0006] A numerical control device is not a dedicated machine specialized for one machine tool, but a general-purpose machine that can be applied to multiple machine tools. For this reason, in the system program of a numerical control device, unnecessary source code and symbols (variables) are generated depending on the system configuration of the numerical control device, machine tool, and external devices. Conventionally, system programs have been optimized using methods such as those disclosed in Patent Documents 1 and 2.
[0007] However, even if a system program is analyzed as in Patent Document 1, it is not possible to determine what external input signals will be input. Also, even if each function is optimized as in Patent Document 2, it is not possible to optimize the external input signals within each function.
[0008] In the field of numerical control devices, there is a demand for technology to optimize system programs. [Means for solving the problem]
[0009] A system program optimization device that is one aspect of the present disclosure is a system program optimization device that manages a system program of a numerical control device, and includes a constant value acquisition unit that acquires constant values set for external input signals input from an external device connected to the numerical control device, and a compiler that converts the source code of the system program into an object program that can be executed by the numerical control device, and the compiler includes an optimization unit that optimizes the system program using the constant values of the external input signals. A system program optimization system that is one aspect of the present disclosure includes: an information processing device that includes a constant value setting unit that accepts the setting of a constant value for an external input signal input from an external device connected to the numerical control device, and a constant value output unit that outputs a constant value to the system program optimization device; and a system program optimization device that manages the system program of the numerical control device, which includes a constant value acquisition unit that acquires a constant value set for an external input signal input from an external device connected to the numerical control device, and a compiler that converts the source code of the system program into an object program that can be executed by the numerical control device, wherein the compiler includes an optimization unit that optimizes the system program using the constant value of the external input signal. A storage medium according to one aspect of the present disclosure stores processor-readable instructions that, when executed by one or more processors, acquire constant values set for external input signals input from external devices connected to the numerical control device, compile source code of the system program of the numerical control device into an object program that can be executed by the numerical control device, and optimize the system program using the constant values of the external input signals during compilation. [Effects of the Invention]
[0010] One aspect of the present invention allows for system program optimization. [Brief explanation of the drawings]
[0011] [Figure 1] FIG. 1 is a conceptual diagram of a system program optimization system. [Figure 2] FIG. 2 is a diagram illustrating a system program. [Figure 3] FIG. 2 is a diagram illustrating a system program. [Figure 4] FIG. 1 is a block diagram of a system program optimization system. [Figure 5] 10 is an example of a constant value setting screen. [Figure 6] 10 is an example of a constant value setting screen. [Figure 7] FIG. 2 is a diagram illustrating a hardware configuration of a numerical control device. [Figure 8] FIG. 1 illustrates a configuration of a compiler. [Figure 9] FIG. 10 is a diagram illustrating an example of source code and constant values of macro variables. [Figure 10] FIG. 10 is a diagram illustrating changes in source code due to optimization. [Figure 11] 10 is a flowchart illustrating a process for setting a constant value of an external input signal. [Figure 12] FIG. 10 is a diagram illustrating the relationship between indexes and macro variables. [Figure 13] 10 is a flowchart of a process of reading constant values and performing optimization. [Figure 14] FIG. 2 is a diagram illustrating a hardware configuration of a system program optimization device. DETAILED DESCRIPTION OF THE INVENTION
[0012] [First embodiment] The system program optimization system 1000 according to the first embodiment will be described below. FIG. The system program optimization system 1000 comprises a server as the system program optimization device 100, a numerical control device 200 that uses the system program, and an information processing device 300 (including a PC: personal computer) connected to the numerical control device 200.
[0013] The system program optimization device 100 provides a system program to a user of the numerical control device 200. The system program is a basic program of the numerical control device 200 (Fig. 2). The system program is a program that controls the basic operations of the numerical control device 200, such as storing machining programs, editing machining programs, executing machining programs, controlling and monitoring axis operations and peripheral devices, storing tool compensation data, editing tool compensation data, tool dimension compensation, tool management, workpiece management, tool measurement, workpiece measurement, monitoring of operation status, collecting status information, synchronization control with external devices (data exchange when changing tools), loading and unloading of workpieces, and job management (collaboration of multiple devices such as numerical control devices, robots, and PLCs).
[0014] As shown in FIG. 3, the system program includes programs that execute the basic functions described above. The numerical control device 200 is a general-purpose device and can be applied to various types of machine tools. All functions are comprehensively written in the original system program. The original system program contains redundant code to accommodate a variety of machine tools and peripheral devices. If the original system program is used as is, unnecessary calculations will increase and calculation efficiency will decrease. The system program optimization device 100 obtains constant values of external input signals from the user, optimizes the system program, and improves the calculation efficiency of the numerical control device 200.
[0015] The system program optimization device 100 collectively manages the system programs of a plurality of numerical control devices 200. The system program optimization device 100 of the numerical control device manufacturer and the information processing device 300 of the numerical control device user are connected via an external network. The system program optimization device 100 optimizes the source code of the original system program using the type of numerical control device 200, the type of machine tool, the functions of the numerical control device 200 used by the user, constant values of external input signals from external devices connected to the numerical control device 200, etc. The manufacturer of the numerical control device 200 provides users with system programs optimized for each numerical control device 200.
[0016] FIG. 4 is a block diagram of a system program optimization system 1000 . The information processing device 300 (including the numerical control device 200) on the user side includes a constant value setting unit 31 and a constant value output unit 32. The constant value setting unit 31 accepts the setting of a constant value for an external input signal by the user. Fig. 5 shows an example of a constant value setting screen. The constant value setting screen in Fig. 5 displays a list of the name of the external device that outputs the external input signal, the name of the external input signal, the address of the external input signal, etc. The user inputs a constant value while referring to the name of the signal.
[0017] The constant value setting unit 31 displays a list of the above-mentioned external input signals and accepts the setting of constant values of the external input signals. Fig. 6 is another example of the constant value setting screen. On the constant value setting screen in Fig. 6, the type of machine tool, the function of the machine tool, etc. are specified, and the input of constant values of external input signals related to the specified machine tool or function is accepted. The configuration of the constant value setting screen is not limited to the configurations in Figures 5 and 6. The constant value setting screen only needs to acquire an address assigned to a terminal of an I / O unit or the like (described later), a constant value of a signal input to the terminal, and an index corresponding to the set external input signal. The content of the external input signal changes depending on the mode and operating state of the numerical control device 200. The address and constant value of the external input signal may be set in association with the mode and operating state of the numerical control device 200.
[0018] The constant value output unit 32 outputs an index corresponding to an external input signal set by the user and its constant value to the system program optimization device 100 .
[0019] Next, an example of an external device connected to the numerical control device 200 will be described. The numerical control device 200 includes a main CPU 201, a main memory 202, a serial I / O control unit 203, a parallel I / O control unit 204, an HMI communication I / F 205, a PLC control unit (PLC CPU) 206, a machine input / output communication I / F 207, a servo communication I / F 208, etc. The numerical control device 200 is connected to a display unit via an HMI communication I / F 205, and is connected to an input unit such as a touch panel or an operation panel via the display unit. Input to the touch panel or operation panel is output to the numerical control device 200 via a remote I / O 221. The numerical control device 200 includes a machine input / output communication I / F 207. The machine input / output communication I / F 207 inputs and outputs signals to and from limit switches, sensors, contactors, lamps, and the like of the machine tool via a remote I / O unit 231. The numerical control device 200 is connected to a spindle amplifier 241 and a servo amplifier 242 via a servo communication I / F 208. The numerical control device 200 acquires signals from the spindle motor and servo motor via the servo communication I / F 208. The numerical control device 200 includes a PLC control unit 206. The PLC control unit 206 acquires signals from sensors and devices incorporated in the numerical control device 200. In the present disclosure, signals from devices incorporated in the numerical control device 200, such as an operation panel and sensors, are also referred to as external input signals.
[0020] Next, the system program optimization device 100 will be described. As shown in FIG. 4, the system program optimization device 100 includes a system program management unit 11, a constant value acquisition unit 12, a compiler 13, and a system program output unit .
[0021] The system program management unit 11 collectively manages the system programs of multiple users' numerical control devices 200. The system program management unit 11 manages the identification information of the numerical control device 200, the system program customized for each numerical control device 200, the constant values of external input signals set for each numerical control device 200, and the like.
[0022] The constant value acquiring unit 12 acquires the constant value of an external input signal from the information processing device (including the numerical control device 200) 300 of the user.
[0023] The compiler 13 converts the source code of the system program written in a high-level language into an object program that can be interpreted and executed by the numerical control device 200. As shown in Fig. 8, the compiler 13 includes a lexical analysis unit 15, a syntax analysis unit 16, a semantic analysis unit 17, an optimization unit 18, and a code generation unit 19.
[0024] The lexical analysis unit 15 breaks down the character string of the source code into a sequence of language elements (tokens). The parser 16 converts the sequence of tokens into a structure that reflects the meaning. This structure is often represented as a tree structure, called an abstract syntax tree.
[0025] The semantic analysis unit 17 analyzes the meaning of the syntax tree. Through the semantic analysis, the source code is converted into intermediate code. The optimization unit 18 transforms the intermediate code and converts it into an efficient program. The optimization unit 18 of the present disclosure performs optimization to reduce the number of times instructions are executed using constant values of external input signals. The processing of the optimization unit 18 will be described later. The code generation unit 19 converts the internal code into an object program language, for example, converting the intermediate code into an assembly language of the numerical control device 200.
[0026] The system program output unit 14 outputs the system program optimized using the constant values of the external input signals to the user's information processing device (including the numerical control device 200) 300.
[0027] Optimization using constant values will be described with reference to FIGS. Figure 9 shows an example of source code and constant values of macro variables, and Figure 10 shows the changes in source code due to optimization. As shown in Figure 9, the macro variables "CNC_DATA_1" are set to a constant value of "0", "CNC_DATA_2" are set to a constant value of "1", "CNC_DATA_3" are set to a constant value of "100", and "CNC_DATA_4" are set to a constant value of "200". The source code is "If(CNC_DATA_1){func_1();}:", "If(CNC_DATA_2){func_2();}:", "val_3=CNC_DATA_3:", "val_4+=CNC_DATA_4:".
[0028] The changes in source code due to optimization will be described with reference to FIG. When the function on the first line: the function before optimization "If(CNC_DATA_1){func_1();}" is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_1" from memory, performs a conditional judgment, and if the result of the conditional judgment is "true", calls func_1(). If you assign a constant value of "0" to the macro variable "CNC_DATA_1" through optimization, the function becomes "If(0){func_1();}", and the conditional statement is always "false". This function becomes a dead command and can be deleted. The numerical control device does nothing with this code.
[0029] When the function on the second line: the function before optimization "If(CNC_DATA_2){func_2();}" is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_2" from memory, performs a conditional judgment, and if the result of the conditional judgment is "true", calls func_2(). When the constant value "1" is assigned to the macro variable "CNC_DATA_2" through optimization, the function becomes "If(1){func_2();}", the conditional statement is always "true", and conditional branching is no longer necessary. Also, since the macro variable "CNC_DATA_2" is a constant, there is no need to read the external input signal.
[0030] When the formula on the third line: the formula before optimization "val_3=CNC_DATA_3;" is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_3" from memory and assigns it to the variable "val_3." By optimizing and substituting the constant value "100" for "val_3", the process of reading the external input signal becomes unnecessary.
[0031] When the formula on the fourth line: the formula before optimization "val_4+=CNC_DATA_4;" is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_4" from memory and adds it to the variable "val_4." When the constant value "200" is assigned to "val_4" through optimization, 200 is added to the variable "val_4" without reading any external input signals. The optimizations described above can reduce the number of times an instruction is executed.
[0032] Next, the operation of the system program optimization system 1000 of the present disclosure will be described with reference to Fig. 11 and Fig. 13. Fig. 11 is a flowchart of a process for setting constant values of external input signals, and Fig. 13 is a flowchart of a process for performing optimization. The constant value setting unit 31 receives the setting of the constant value of the external input signal from the user (step S1). The constant value of the external input signal is associated with an index corresponding to the external input signal and an address in memory. The index is associated with a macro variable. In the example of FIG. 12, "CNC_DATA_1_IDX", "CNC_DATA_2_IDX", "CNC_DATA_3_IDX", "CNC_DATA_4_IDX", ... are linked to "CNC_DATA_1", "CNC_DATA_2", "CNC_DATA_3", "CNC_DATA_4", .... The system program optimization device associates the index with the macro variable.
[0033] The constant value setting unit 31 sets the constant value designated by the user in the memory of the numerical control device 200 (step S2). The constant value output unit 32 outputs the constant value and the index to the system program optimization device 100 (step S3).
[0034] The optimization process will be described with reference to FIG. The constant value acquisition unit 12 of the system program optimization device 100 acquires an index of an external input signal and a constant value (step S11). The constant value acquisition unit 12 identifies a macro variable corresponding to the index of the external input signal (step S12). The constant value acquisition unit 12 defines the macro variable with the constant value of the external input signal (step S13). The optimization unit 18 replaces the macro variables with constant values (step S14). The optimization unit 18 optimizes the system program (step S15). The system program output unit 14 identifies the user based on the information managed by the system program management unit 11, and outputs the system program to the user's information processing device (including the numerical control device 200) 300 (step S16). The user installs the acquired system program into the numerical control device 200 (step S17).
[0035] As described above, the system program optimization system 1000 of the present disclosure includes the system program optimization device 100. The system program optimization device 100 manages the system program of the numerical control device 200 via a network. The system program optimization device 100 optimizes the system program using constant values of external input signals acquired from a user. The user installs the optimized system program in his or her own numerical control device 200.
[0036] [Second embodiment] A specific example of the external input signal will be described. An example of an external input signal in the second embodiment is a machine lock signal. When the machine lock signal is turned on, the numerical control device 200 enters a machine lock state. In the machine lock state, even if a movement command is executed, the machine tool does not actually move, and only the position display is updated. Normally, the main CPU 201 accesses the machine lock signal every control cycle and determines whether or not the machine lock state (machine lock signal is on) is in effect.
[0037] When optimization is performed with the machine lock signal set to off (constant value), the main CPU 201 can determine that the machine lock state is not established without accessing the machine lock signal. This reduces the waiting time of the control cycle for acquiring the external input signal, and also reduces the time required to process the branch that determines the machine lock state.
[0038] [Third embodiment] An example of an external input signal in the third embodiment is a feedrate override signal. The feedrate override signal represents a numerical value that adjusts the feedrate and rotation speed during cutting. The feedrate override signal is usually a constant speed (100%), but can be specified within a range such as 0% to 200%. Normally, during cutting, the main CPU 201 accesses the feedrate override signal at a control cycle, reads the value of the feedrate override signal from memory, and controls the feedrate.
[0039] When optimization is performed with the feedrate override signal set to 100% (constant value), the main CPU 201 controls the feedrate to be constant without accessing the feedrate override signal, thereby reducing the waiting time of the control cycle for acquiring external input signals.
[0040] [Fourth embodiment] An example of an external input signal in the fourth embodiment is a skip signal. When the skip signal is turned on, the main CPU 201 proceeds to the next block (the next line of the machining program) at the time the signal is input, even if the currently executed block (one line of the machining program) has not yet ended. Normally, the main CPU 201 accesses the skip signal at a control cycle, and if the skip signal is on, skips the currently executed block and reads the next block.
[0041] When optimization is performed with the skip signal set to off, the main CPU 201 executes the machining program without accessing the skip signal, thereby reducing the waiting time of the control cycle for acquiring external input signals.
[0042] As described above, the system program optimization system 1000 of the present disclosure allows the user to set constant values for external input signals, and optimizes the system program using the set constant values. Optimization improves execution efficiency by enabling the reduction of access times to external input signals for each control signal, the deletion of branch instructions, and constant folding. Furthermore, disabling unused functions allows the deletion of redundant code related to unnecessary functions, thereby improving execution efficiency.
[0043] External input signals have the risk of malfunctioning due to changes in voltage level caused by noise, but by setting a constant value, malfunctions due to noise do not occur.In addition, setting a constant value prevents malfunctions due to noise, which reduces the cost of noise suppression components.
[0044] Optimizing the system program reduces the code and data areas used to process external input signals, and reduces the memory capacity required to run the system program, thereby reducing the load on the hardware.
[0045] In the second to fourth embodiments, signals from input units such as a touch panel or an operation panel have been given as examples, but as shown in FIG. 6, external input signals input to the numerical control device 200 also include signals from other external devices (such as limit switches, sensors, contactors, lamps, spindle motors, and servo motors of machine tools).
[0046] In the first embodiment, the system program optimization device 100 obtains the constant values of the external input signals via a network, but may obtain them via a portable storage medium.
[0047] Conventionally, there exists a technique for optimizing a system program by analyzing the specifications of the numerical control device 200 and the source code of the system program. However, while the system program of the numerical control device 200 is optimized based on the user's specifications, the present disclosure can encourage further optimization in accordance with the user's actual usage environment.
[0048] [Hardware configuration] 14, the hardware configuration of the system program optimization device 100 will be described. The CPU 111 provided in the system program optimization device 100 is a processor that controls the entire system program optimization device 100. The CPU 111 reads an operating system processed in the ROM 112 via the bus, and controls the entire system program optimization device 100 in accordance with the operating system. The RAM 113 temporarily stores temporary calculation data, display data, various data input by the user via the input unit 71, etc.
[0049] The display unit 70 is a monitor or the like attached to the system program optimization device 100 . The input unit 71 is a keyboard, a touch panel, an operation button, or the like that is integrated with the display unit 70 or is separate from the display unit 70. The user operates the input unit 71 to input data to the screen displayed on the display unit 70.
[0050] The nonvolatile memory 114 is a memory that maintains its stored state even when the system program optimization device 100 is powered off, for example, by being backed up by a battery (not shown). The nonvolatile memory 114 stores management information for the system program. The management information for the system program includes identification information for the numerical control device, constant values of external input signals, and the like. The nonvolatile memory 114 stores programs read from external devices via an interface (not shown), programs input via the input unit 71, and various data acquired from each unit of the system program optimization device 100. The programs and various data stored in the nonvolatile memory 114 may be expanded into the RAM 113 when executed / used. Furthermore, various system programs are written in the ROM 112 in advance. [Explanation of symbols]
[0051] 1000 System Program Optimization System 100 System Program Optimizer 11 System Program Management Department 12 Constant value acquisition section 13 Compiler 14 System program output section 18 Optimization Section 200 Numerical Control Device 300 Information processing device 31 Constant value setting section 32 Constant value output section 70 Display section 71 Input section 111 CPU 112 ROM 113 RAM 114 Non-volatile memory
Claims
1. A system program optimization device that manages a system program of a numerical control device, a constant value acquiring unit that acquires a constant value set for an external input signal input from an external device connected to the numerical control device; a compiler that converts the source code of the system program into an object program that can be executed by the numerical control device, The compiler includes an optimization unit that optimizes the system program using the constant value of the external input signal.
2. 2. The system program optimization device according to claim 1, wherein the constant value acquisition unit acquires an index associated with an address of the external input signal in the memory of the numerical control device, and identifies a variable of the system program based on the index.
3. a system program management unit that manages system programs of a plurality of numerical control devices; 2. The system program optimization device according to claim 1, further comprising a system program output unit that outputs the system program optimized using said constant value to a user's information processing device.
4. The original system program is a general-purpose program that is compatible with multiple numerical control devices.
2. The system program optimization device according to claim 1, wherein the optimization unit optimizes the original system program for a user's numerical control device.
5. a constant value setting unit that accepts a constant value setting for an external input signal input from an external device connected to the numerical control device; an information processing device including a constant value output unit that outputs the constant value to a system program optimization device; A system program optimization device that manages a system program of a numerical control device, a constant value acquiring unit that acquires a constant value set for an external input signal input from an external device connected to the numerical control device; a compiler that converts the source code of the system program into an object program that can be executed by the numerical control device, the compiler includes a system program optimization device that includes an optimization unit that optimizes the system program using constant values of the external input signals; A system program optimization system including:
6. When executed by one or more processors, Acquire a constant value set for an external input signal input from an external device connected to the numerical control device; Compiling the source code of the system program of the numerical control device into an object program that can be executed by the numerical control device; In the compiling, the system program is optimized with constant values of the external input signals. A storage medium that stores instructions that are readable by the processor.
Citation Information
Patent Citations
Man-machine interface device for nc device
JP1994289919A
Code optimizing device, language processor, and code optimization method
JP2000207226A
Apparatus and method for controlling a robot
JP2002006918A
Method and system for optimizing downloaded program by activating user profile data in small it device
JP2003216434A
Control system with function to optimize control software of numerical control unit in response to processing program
JP2016133911A