System program optimization device, system program optimization system, and computer-readable storage medium
By using a system program optimization device and system, the system program of the numerical control device is optimized by utilizing the constant value of the external input signal. This solves the problem of redundant code for various machine tools and external devices, improves computational efficiency, and reduces hardware load.
Patent Information
- Application Number
- CN202280093692.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2024-11-01
AI Technical Summary
Existing numerical control system program optimization methods cannot effectively handle the specific input signals of various machine tools and external devices, resulting in increased redundant code and decreased computational efficiency.
The system program of the numerical control device is optimized by using the constant value of the external input signal through the system program optimization device and the system program optimization system, including constant value acquisition, compiler optimization and target program generation, to reduce unnecessary commands and branches.
It improves the computational efficiency of numerical control devices, reduces memory access and noise-induced malfunctions, and lowers hardware load and cost.
Smart Images

Figure CN118891592A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a system program optimization device, a system program optimization system and a computer-readable storage medium. Background Art
[0002] Currently, there is a technology called program optimization. Optimization refers to the process of making the program more efficient, shortening the execution time, and reducing the execution load. Through optimization, the number of memory executions is reduced, faster instructions are used, the memory hierarchy is used effectively, and high-parallel memory is used.
[0003] In order to reduce the number of times instructions are executed, there are deletion of common parts, convolution of constants, constant propagation, deletion of loop invariants, deletion of induction variables, reduction of operator strength, loop unrolling, loop fusion, deletion of unexecuted instructions, propagation of copies, rolling up of codes, specialization of procedure calls, and utilization of the properties of expressions.
[0004] In order to use the memory hierarchy efficiently, optimization is performed to effectively use registers in the memory hierarchy such as registers, caches (primary and secondary), memory, and disks. There is also optimization that changes the execution order to effectively use caches.
[0005] The important optimizations in the compiler are loop-related optimizations. By optimizing multiple loops, the execution time can be improved.
[0006] In the past, as a method for optimizing a program, the following method has been proposed: searching and analyzing the inside of a system program, determining whether a symbol (variable) included in the source code is used or not, and optimizing the symbol (variable) that can be determined to be unused. For example, refer to Patent Document 1.
[0007] Regarding the system program of the numerical controller, there is also a technology for optimizing unnecessary branch instructions of unused functions based on the use history of the functions when the machining program is executed. For example, refer to Patent Document 2.
[0008] Prior art literature
[0009] Patent Literature
[0010] Patent Document 1: Japanese Patent Application Publication No. 2000-207226
[0011] Patent Document 2: Japanese Patent Application Publication No. 2016-133911 Summary of the invention
[0012] Problems to be solved by the invention
[0013] A numerical control device is not a dedicated machine for a single machine tool, but a general-purpose machine that can be applied to multiple machine tools. Therefore, in the system program of the numerical control device, unnecessary source code and symbols (variables) are generated according to the system structure of the numerical control device, the machine tool, and the external device. In the past, the system program was optimized using the method disclosed in Patent Documents 1 and 2.
[0014] However, even if the system program is analyzed as in Patent Document 1, it is not possible to determine what kind of external input signal is input. Also, even if optimization is performed for each function as in Patent Document 2, it is not possible to optimize the external input signal in a more detailed manner in the function.
[0015] In the field of numerical control devices, a technology for optimizing system programs is desired.
[0016] Means for solving problems
[0017] As one method of the present invention, a system program optimization device manages a system program of a numerical control device, and the system program optimization device comprises: a constant value acquisition unit, which acquires a constant value set for an external input signal input from an external device connected to the numerical control device; a compiler, which converts the source code of the system program into a target program executable by the numerical control device, and the compiler comprises: an optimization unit, which optimizes the system program by using the constant value of the external input signal.
[0018] As one aspect of the present disclosure, a system program optimization system includes: an information processing device and a system program optimization device, the information processing device having: 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 a numerical control device; a constant value output unit that outputs the constant value to the system program optimization device, the system program optimization device manages the system program of the numerical control device and has: a constant value acquisition unit that acquires the constant value set for the external input signal input from the external device connected to the numerical control device; a compiler that converts the source code of the system program into a target program executable by the numerical control device, the compiler having: an optimization unit that optimizes the system program by the constant value of the external input signal.
[0019] A storage medium as one method of the present invention stores commands that can be read by a processor, and the commands are executed by one or more processors to obtain constant values set for external input signals input from an external device connected to a numerical control device, compile source code of a system program of the numerical control device into a target program that can be executed by the numerical control device, and during the compilation, optimize the system program using the constant values of the external input signals.
[0020] Effects of the Invention
[0021] According to one aspect of the present invention, it is possible to optimize a system program. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a conceptual diagram of the system program optimization system.
[0023] Figure 2 This is a diagram that explains the system program.
[0024] Figure 3 This is a diagram that explains the system program.
[0025] Figure 4 It is a block diagram of the system program optimization system.
[0026] Figure 5 This is an example of a constant value setting screen.
[0027] Figure 6 This is an example of a constant value setting screen.
[0028] Figure 7 This is a diagram showing the hardware configuration of a numerical control device.
[0029] Figure 8 It is a diagram showing the structure of the compiler.
[0030] Fig. 9 This is a diagram showing examples of source code and constant values of macro variables.
[0031] Fig.10 is a graph showing the changes in source code based on optimization.
[0032] Fig.11 This is a flowchart for explaining the process of setting a constant value of an external input signal.
[0033] Fig.12 It is a diagram showing the association between indexes and macro variables.
[0034] Fig.13 This is a flowchart of the process of reading out constant values and performing optimization.
[0035] Fig.14 This is a diagram showing the hardware structure of the system program optimization device. DETAILED DESCRIPTION
[0036] [First embodiment]
[0037] Hereinafter, the system program optimization system 1000 according to the first embodiment will be described. Figure 1 is a conceptual diagram of the system program optimization system 1000.
[0038] The system program optimization system 1000 includes a server as a system program optimization device 100 , a numerical controller 200 using a system program, and an information processing device 300 (including a PC: personal computer) connected to the numerical controller 200 .
[0039] The system program optimizing device 100 provides a system program to a user of the numerical control device 200 .
[0040] The system program is a basic program of the numerical controller 200. Figure 2 The system program is a program for controlling the basic operations of the numerical controller 200, such as storage of machining programs, editing of machining programs, execution of machining programs, axis motion, control and monitoring of peripheral devices, storage of tool calibration data, editing of tool calibration data, tool dimension calibration, tool management, workpiece management, tool measurement, workpiece measurement, monitoring of operating conditions, collection of status information, synchronous control with external devices (data exchange when tools are replaced), loading and unloading of workpieces, and task management (joint operation of multiple devices such as numerical controllers, robots, and PLCs).
[0041] like Figure 3 As shown, the system program includes a program for executing the above basic functions. The numerical control device 200 is a general-purpose device that can be applied to various machine tools. In the original system program, all functions are fully written. The original system program corresponds to a variety of machine tools and peripheral equipment, and therefore becomes redundant code. If the original system program is used directly, useless operations will be added, and the operation efficiency will be deteriorated. The system program optimization device 100 obtains the constant value of the external input signal from the user, optimizes the system program, and improves the operation efficiency of the numerical control device 200.
[0042] The system program optimization device 100 manages the system programs of a plurality of numerical controllers 200 in a unified manner. The system program optimization device 100 of the numerical controller manufacturer and the information processing device 300 of the numerical controller 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 the numerical controller 200, the type of the machine tool, the function of the numerical controller 200 used by the user, the constant value of the external input signal from the external device connected to the numerical controller 200, and the like. The manufacturer of the numerical controller 200 provides the user with the system program optimized for the numerical controller 200.
[0043] Figure 4 is a block diagram of a system program optimization system 1000.
[0044] The information processing device 300 on the user side (including the numerical control device 200 ) includes a constant value setting unit 31 and a constant value output unit 32 .
[0045] The constant value setting unit 31 receives setting of a constant value of an external input signal from a user. Figure 5 An example of a constant value setting screen is shown below. Figure 5 The constant value setting screen of 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 the constant value while referring to the name of the signal.
[0046] The constant value setting unit 31 displays the above-mentioned list of external input signals and accepts setting of constant values of external input signals.
[0047] Figure 6 This is another example of the constant value setting screen. Figure 6 In the constant value setting screen, the type of machine tool, the function of the machine tool, etc. are specified, and the input of the constant value of the external input signal related to the specified machine tool and function is accepted.
[0048] The structure of the constant value setting screen is not limited to Figure 5 as well as Figure 6 In the constant value setting screen, it is sufficient to obtain the address of the terminal assigned to the I / O unit described later, the constant value of the signal input to the terminal, and the index corresponding to the external input signal of the speed setting. In addition, the content of the external input signal changes according to the mode and operation state of the numerical controller 200. The address and constant value of the external input signal can also be set in association with the mode and operation state of the numerical controller 200.
[0049] The constant value output unit 32 outputs the index and the constant value thereof corresponding to the external input signal set by the user to the system program optimization device 100 .
[0050] Next, examples of external devices connected to the numerical controller 200 will be described. Figure 7 This is an example of the hardware configuration of the numerical control device 200 .
[0051] The numerical controller 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 , and the like.
[0052] The numerical controller 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. Inputs to the touch panel or the operation panel are output to the numerical controller 200 via a remote I / O 221 .
[0053] The numerical controller 200 has a mechanical input / output communication I / F 207. The mechanical input / output communication I / F 207 inputs and outputs signals with the limit switches, sensors, contactors, lamps, etc. of the machine tool via the remote I / O unit 231. The numerical controller 200 is connected to the spindle amplifier 241 and the servo amplifier 242 via the servo communication I / F 208. The numerical controller 200 obtains signals from the spindle motor and the servo motor via the servo communication I / F 208.
[0054] The numerical controller 200 includes a PLC control unit 206. The PLC control unit 206 obtains signals from sensors and devices incorporated in the numerical controller 200. In the present disclosure, signals from devices incorporated in the numerical controller 200, such as an operation panel and a sensor, are also referred to as external input signals.
[0055] Next, the system program optimization device 100 is described.
[0056] like Figure 4 As shown, 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 14 .
[0057] The system program management unit 11 manages the system programs of the numerical controllers 200 of multiple users in a centralized manner. The system program management unit 11 manages identification information of the numerical controller 200, system programs customized for the numerical controller 200, constant values of external input signals set for the numerical controller 200, and the like.
[0058] The constant value acquisition unit 12 acquires a constant value of an external input signal from an information processing device (including the numerical control device 200 ) 300 of a user.
[0059] The compiler 13 converts the source code of the system program recorded in a high-level language into a target program that can be interpreted / executed by the numerical control device 200. Figure 8 As shown, the compiler 13 includes a sentence analysis unit 15 , a syntax analysis unit 16 , a semantic analysis unit 17 , an optimization unit 18 , and a code generation unit 19 .
[0060] The word-sentence analysis unit 15 decomposes a character string of a source code into strings of language elements (tokens).
[0061] The syntax analysis unit 16 converts the sequence of tokens into a structure reflecting semantics. This structure is often expressed as a tree structure, which is called an abstract syntax tree.
[0062] The semantic analysis unit 17 analyzes the semantics of the syntax tree. The source code is converted into an intermediate code through the semantic analysis.
[0063] The optimization unit 18 transforms the intermediate code and converts it into a high-efficiency program. The optimization unit 18 of the present disclosure uses the constant value of the external input signal to perform optimization to reduce the number of execution times of the command. The processing of the optimization unit 18 will be described later.
[0064] The code generating unit 19 converts the internal code into the language of the target program, for example, converts the intermediate code into the assembly language of the numerical control device 200 .
[0065] The system program output unit 14 outputs the system program optimized by the constant value of the external input signal to the information processing device (including the numerical control device 200 ) 300 of the user.
[0066] Reference Fig. 9 and Fig.10 Optimization using constant values is described below.
[0067] Fig. 9 Examples of constant values representing source code and macro variables, Fig.10 Indicates changes in source code based on optimizations.
[0068] like Fig. 9 As shown, the constant value "0" is set for the macro variable "CNC_DATA_1", the constant value "1" is set for "CNC_DATA_2", the constant value "100" is set for "CNC_DATA_3", and the constant value "200" is set for "CNC_DATA_4".
[0069] 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:".
[0070] Reference Fig.10 Describes changes to the source code based on optimizations.
[0071] Function in the first line: When the function "If(CNC_DATA_1){func_1();}" before optimization is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_1" from the memory, performs conditional judgment, and calls func_1() when the result of the conditional judgment is "true".
[0072] When the constant value "0" is substituted into the macro variable "CNC_DATA_1" by optimization, the function becomes "If(0){func_1();}", and the conditional statement is always "false", and the function becomes a dead command and can be deleted. The numerical control device does not process the code in any way.
[0073] Function in the second line: When the function "If(CNC_DATA_2){func_2();}" before optimization is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_2" from the memory, performs conditional judgment, and calls func_2() when the result of the conditional judgment is "true".
[0074] When the constant value "1" is substituted into the macro variable "CNC_DATA_2" by optimization, the function is "If(1){func_2();}", and the conditional statement is always "true", and no conditional branch is required. In addition, the macro variable "CNC_DATA_2" is a constant, so there is no need to process the external input signal.
[0075] The formula of the third line: When the formula "val_3 = CNC_DATA_3;" before optimization is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_3" from the memory and substitutes it into the variable "val_3".
[0076] When the constant value "100" is substituted into "val_3" by optimization, the process of reading the external input signal is unnecessary.
[0077] The formula of the fourth line: When the formula "val_4+=CNC_DATA_4;" before optimization is executed, the numerical control device reads the external input signal corresponding to the macro variable "CNC_DATA_4" from the memory and adds it to the variable "val_4".
[0078] When the constant value "200" is substituted into "val_4" by optimization, the external input signal is not read, and 200 is added to the variable "val_4".
[0079] Through the above optimization, the number of command executions can be reduced.
[0080] Next, refer to Fig.11 as well as Fig.13 , the operation of the system program optimization system 1000 disclosed in the present invention is explained. Fig.11 This is a flowchart of the process of setting the constant value of the external input signal. Fig.13 is a flowchart of the process of performing optimization.
[0081] 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 the index corresponding to the external input signal and the address on the memory. The index is associated with the macro variable. Fig.12 In the example, "CNC_DATA_1", "CNC_DATA_2", "CNC_DATA_3", "CNC_DATA_4" ... are associated with "CNC_DATA_1_IDX", "CNC_DATA_2_IDX", "CNC_DATA_3_IDX", "CNC_DATA_4_IDX" ... The correspondence between the index and the macro variable is performed by the system program optimization device.
[0082] The constant value setting unit 31 sets the constant value designated by the user in the memory of the numerical controller 200 (step S2 ).
[0083] The constant value output unit 32 outputs the constant value and the index to the system program optimizing device 100 (step S3).
[0084] Reference Fig.13 The optimization process will be described.
[0085] The constant value acquisition unit 12 of the system program optimization device 100 acquires the index and constant value of the external input signal (step S11). The constant value acquisition unit 12 determines the macro variable corresponding to the index of the external input signal (step S12). The constant value acquisition unit 12 defines the macro variable by the constant value of the external input signal (step S13).
[0086] The optimization unit 18 replaces the macro variable with a constant value (step S14). The optimization unit 18 optimizes the system program (step S15). The system program output unit 14 determines 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).
[0087] The user installs the acquired system program in the numerical controller 200 (step S17 ).
[0088] 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 the constant value of the external input signal obtained from the user. The user installs the optimized system program in his own numerical control device 200.
[0089] [Second embodiment]
[0090] A specific example of the external input signal will be described.
[0091] An example of the 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 the 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. Usually, the main CPU 201 accesses the machine lock signal in a control cycle to determine whether it is in the machine lock state (the machine lock signal is turned on).
[0092] If the machine lock signal is set to off (constant value) for optimization, the main CPU 201 can determine that the machine is not locked without accessing the machine lock signal. Therefore, the standby time of the control cycle for obtaining the external input signal is shortened, and the time for processing the branch for determining the machine lock state is shortened.
[0093] [Third Embodiment]
[0094] An example of an external input signal in the third embodiment is a feed speed multiplier signal. The feed speed multiplier signal indicates a numerical value for adjusting the feed speed and rotation speed in cutting processing. The feed speed multiplier signal is usually a fixed speed (100%) and can be specified in a range of 0% to 200%. Usually, the main CPU 201 accesses the feed speed multiplier signal in a control cycle during cutting processing, reads the value of the feed speed multiplier signal from the memory, and controls the feed speed.
[0095] If the feed speed magnification signal is set to 100% (constant value) for optimization, the main CPU 201 does not access the feed speed magnification signal and controls the feed speed to be constant. Therefore, the waiting time of the control cycle for acquiring the external input signal is shortened.
[0096] [Fourth Embodiment]
[0097] An example of the external input signal in the fourth embodiment is a skip signal. When the skip signal is turned on, even if the program block (one line of the machining program) being executed has not ended, the main CPU 201 enters the next program block (the next line of the machining program) at the time when the signal is input. Usually, the main CPU 201 accesses the skip signal in a control cycle, and if the skip signal is turned on, the currently executing program block is skipped and the next program block is read out.
[0098] When the skip signal is set to OFF for optimization, the main CPU 201 executes the machining program without accessing the skip signal, thereby shortening the waiting time of the control cycle for acquiring the external input signal.
[0099] As described above, in the system program optimization system 1000 of the present disclosure, the user is allowed to set the constant value of the external input signal, and the system program is optimized using the set constant value. Through optimization, the access time of each control signal to the external input signal, the deletion of branch instructions, the convolution of constants, etc. can be performed, so the execution efficiency will be improved. In addition, if the unexecuted function is invalidated, the redundant code related to the unnecessary function can be deleted, so the execution efficiency will be improved.
[0100] Regarding external input signals, there is a risk of malfunction due to changes in voltage level caused by noise, but by setting a constant value, malfunctions due to noise will not occur. In addition, by setting it to a constant value, malfunctions due to noise will not occur, so the cost of noise countermeasure components can also be reduced.
[0101] When the system program is optimized, the code area and data area used for processing external input signals are reduced. Since the memory capacity required to run the system program can be reduced, the load on the hardware is reduced.
[0102] In the second to fourth embodiments, signals from input units such as a touch panel and an operation panel are cited as examples, but Figure 6 As shown, the external input signal input to the numerical controller 200 also includes signals from other external devices (limit switches, sensors, contactors, lamps, spindle motors, servo motors, etc. of machine tools).
[0103] In the first embodiment, the system program optimizing device 100 obtains the constant value of the external input signal via a network, but may also obtain it via a portable storage medium.
[0104] Conventionally, there is a technique for optimizing the system program by analyzing the specifications of the numerical control device 200 and the source code of the system program. However, the system program of the numerical control device 200 is optimized according to the user's specifications, but in the case of the present disclosure, further optimization can be promoted to match the environment actually used by the user.
[0105] [Hardware Structure]
[0106] Reference Fig.14 , the hardware structure of the system program optimization device 100 is described. The CPU 111 of the system program optimization device 100 is a processor that controls the system program optimization device 100 as a whole. The CPU 111 reads the operating system processed in the ROM 112 via the bus, and controls the entire system program optimization device 100 according to the operating system. Temporary calculation data, display data, various data input by the user via the input unit 71, etc. are temporarily stored in the RAM 113.
[0107] The display unit 70 is a monitor or the like attached to the system program optimization device 100 .
[0108] The input unit 71 is a keyboard, a touch panel, an operation button, etc. that is integrated with the display unit 70 or separate from the display unit 70. The user operates the input unit 71 to perform input to the screen displayed on the display unit 70, etc.
[0109] The non-volatile memory 114 is backed up by a battery (not shown), for example, and maintains the storage state even if the power of the system program optimization device 100 is disconnected. The non-volatile memory 114 stores management information of the system program. The management information of the system program includes identification information of the numerical control device, constant values of external input signals, etc. The non-volatile memory 114 stores programs read from external devices via an interface (not shown), programs input via the input unit 71, and various data obtained from various parts of the system program optimization device 100. The programs and various data stored in the non-volatile memory 114 can also be expanded in the RAM 113 when executed / used. In addition, various system programs are pre-written in the ROM 112.
[0110] Description of Reference Numerals
[0111] 1000 System Program Optimization System
[0112] 100 System Program Optimizer
[0113] 11 System Program Management Department
[0114] 12 Constant value acquisition unit
[0115] 13 Compiler
[0116] 14 System program output unit
[0117] 18 Optimization Department
[0118] 200 Numerical control device
[0119] 300 Information processing device
[0120] 31 Constant value setting section
[0121] 32 Constant value output section
[0122] 70 Display unit
[0123] 71 Input section
[0124] 111CPU
[0125] 112ROM
[0126] 113RAM
[0127] 114 non-volatile memory.
Claims
1. A system program optimization device for managing a system program of a numerical control device, characterized in that: The system program optimization device has: 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; a compiler that converts the source code of the system program into a target program executable by the numerical control device, The compiler includes an optimizing unit that optimizes the system program using a constant value of the external input signal.
2. The system program optimization device according to claim 1, characterized in that: The constant value acquisition unit acquires an index associated with an address on a memory of the numerical control device of the external input signal, and specifies a variable of a system program based on the index.
3. The system program optimization device according to claim 1, characterized in that: The system program optimization device has: A system program management unit that manages system programs of a plurality of numerical control devices; A system program output unit outputs the system program optimized using the constant value to a user's information processing device.
4. The system program optimization device according to claim 1, characterized in that: The original system program is a general program suitable for multiple numerical control devices. The optimization unit optimizes the original system program for the user's numerical control device.
5. A system program optimization system, characterized in that: Including: information processing device and system program optimization device, The information processing device includes: a constant value setting unit that receives a setting of a constant value for an external input signal input from an external device connected to the numerical control device; a constant value output unit, which outputs the constant value to the system program optimization device, The system program optimization device manages the system program of the numerical control device and has: 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; a compiler that converts the source code of the system program into a target program executable by the numerical control device, The compiler includes an optimizing unit that optimizes the system program using a constant value of the external input signal.
6. A storage medium, characterized in that: storing a command readable by a processor, the command being executed by one or more of the processors to obtain 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 a target program executable by the numerical control device, In the compiling, the system program is optimized by the constant value of the external input signal.
