Numerical controller
11112774 · 2021-09-07
Assignee
Inventors
Cpc classification
G05B19/408
PHYSICS
G05B2219/35385
PHYSICS
G05B19/418
PHYSICS
G05B2219/35386
PHYSICS
International classification
G05B19/418
PHYSICS
Abstract
A numerical controller determines whether or not block prefetching from a program is sufficient based on whether at least one block subsequent to a predetermined reference block, which exists after a running block of the program and is needed to execute the reference block, has been prefetched or not. If the determination result is that prefetching is not sufficient, block prefetching from the program is performed.
Claims
1. A numerical controller having a function of prefetching blocks of a program, the numerical controller comprising: a prefetch sufficiency determination section configured to determine whether or not block prefetching from the program is sufficient based on whether or not a predetermined number of blocks subsequent to a predetermined reference block existing after a currently running block of the program has been prefetched, the predetermined number of blocks being needed to execute the reference block; and a prefetch analysis section configured to perform block prefetching of the predetermined number of blocks subsequent to the reference block, which are required for the execution of the reference block, from the program when the prefetch sufficiency determination section determines that block prefetching from the program is not sufficient, wherein the predetermined number of blocks is a number of blocks to be set according to a state of the currently running program, and wherein the prefetch analysis section is configured to stop prefetching of blocks when the prefetch sufficiency determination section determines that the prefetching of the blocks from the program is sufficient.
2. The numerical controller according to claim 1, wherein in the case where the reference block issues an axis feed command, the prefetch sufficiency determination section determines that block prefetching from the program is sufficient if an axis can be stopped before execution of the at least one prefetched block is finished when the axis is moved at a speed limit specified by the command.
3. The numerical controller according to claim 1, wherein the prefetch sufficiency determination section determines whether or not block prefetching from the program is sufficient based on any one of a required number of blocks and a formula for calculating a required number of blocks set for any one of each command and each function.
4. The numerical controller according to claim 1, wherein the reference block is statically set in advance in relation to the running block.
5. The numerical controller according to claim 1, further comprising: a reference block setting section configured to dynamically set the reference block based on a state of execution of the running block or time necessary to execute the at least one prefetched block.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
(10)
(11) A numerical controller 1 of the present invention can be implemented as, for example, a numerical controller that controls a machine tool based on a program.
(12) A CPU 11 of the numerical controller 1 according to this embodiment is a processor that wholly controls the numerical controller 1. The CPU 11 retrieves system programs stored in a ROM 12 through a bus 20, and controls the entire numerical controller 1 in accordance with the system programs. A RAM 13 temporarily stores temporary data such as calculation data and display data, various externally inputted data, and the like.
(13) A non-volatile memory 14, which is configured as, for example, a memory or a solid state drive (SSD) that has a battery (not shown) for memory backup, maintains the state of memory even when the power of the numerical controller 1 is shut off. The non-volatile memory 14 stores programs read from an external device 72 through an interface 15, programs inputted through a display/MDI unit 70, and the like. Such programs and various kinds of data stored in the non-volatile memory 14 may be developed in the RAM 13 at the time of execution/use. The ROM 12 stores various prewritten system programs such as a publicly-known analysis program.
(14) The interface 15 is an interface for connecting the CPU 11 of the numerical controller 1 and the external device 72, such as a USB device. Programs, various parameters, and the like that are used in the control of the machine tool are read from the external device 72. Programs, various parameters, and the like edited in the numerical controller 1 can be stored in external storage means (not shown) through the external device 72. A programmable logic controller (PLC) 16 outputs signals to the machine tool (not shown) and peripheral devices (for example, a tool changer, an actuator of a robot or the like, a sensor attached to the machine tool, or the like) of the machine tool through an I/O unit 17 in accordance with a built-in sequence program of the numerical controller 1 to control the machine tool and the peripheral devices. The PLC 16 receives signals from various switches on a control panel provided on a main body of the machine tool, peripheral devices, and the like, and passes the signals to the CPU 11 after performing necessary signal processing.
(15) The display/MDI unit 70 is a manual data input device having a display, a keyboard, and the like. An interface 18 receives commands and data from the keyboard of the display/MDI unit 70, and passes the commands and the data to the CPU 11. An interface 19 is connected to a control panel 71 having a manual pulse generator or the like that is used to manually drive each axis.
(16) An axis control circuit 30 for controlling an axis of the machine tool receives a commanded amount of travel for the axis from the CPU 11, and outputs a command for the axis to a servo amplifier 40. The servo amplifier 40 receives this command, and drives a servo motor 50 for moving the axis of the machine tool. The servo motor 50 of the axis incorporates a position and speed detector, and feeds a position and speed feedback signal received from the position and speed detector back to the axis control circuit 30 to perform position and speed feedback control. It should be noted that the hardware configuration diagram in
(17) A spindle control circuit 60 receives a spindle rotation command, and outputs a spindle speed signal to a spindle amplifier 61. The spindle amplifier 61 receives the spindle speed signal, and rotates a spindle motor 62 of the machine tool at the commanded rotational speed to drive the tool. A position coder 63 is coupled to the spindle motor 62. The position coder 63 outputs a feedback pulse in synchronization with the rotation of the spindle. The feedback pulse is read by the CPU 11.
(18)
(19) Each functional block illustrated in
(20) The numerical controller 1 of this embodiment includes a prefetch analysis section 100 and a program execution section 110. A program 200 for use in the control of a machine tool 2 is stored in advance in the non-volatile memory 14. An execution data buffer 210, which stores execution data needed to execute blocks of the program, is provided on the RAM 13 or the non-volatile memory 14.
(21) The prefetch analysis section 100 is implemented by the CPU 11 of the numerical controller 1 illustrated in
(22) The prefetch sufficiency determination section 102 determines whether or not block prefetching from the program 200 is sufficient. The prefetch sufficiency determination section 102 determines whether or not prefetching is sufficient based on whether or not a block or blocks that are needed for a reference block serving as a reference for prefetch sufficiency determination, which is one of already-prefetched blocks, to work have been prefetched. The reference block may be, for example, a block immediately after a block that the program execution section 110 is currently executing, or a block two or three blocks after the block that the program execution section 110 is currently executing. The reference block may be statically set in advance in a setting area provided in the non-volatile memory 14 in relation to the block that the program execution section 110 is currently executing. When a block set as the reference block has not been prefetched, the prefetch sufficiency determination section 102 always determines that prefetching is not sufficient.
(23) In the case where the reference block is, for example, a block that issues an axis feed command, the prefetch sufficiency determination section 102 determines whether or not prefetching is sufficient based on whether or not a block or blocks sufficient to reach a sufficient speed in the axis feed command in the reference block have been prefetched.
(24) The relationship between block prefetching and a restriction on axis feedrate will be described with reference to
(25)
(26) In the examples of
(27) In the example of
(28) Other than the above-described prefetch sufficiency determination based on the axis feedrate, the prefetch sufficiency determination section 102 may determine whether or not prefetching is sufficient based on whether or not an appropriate number of blocks required for the command of the reference block have been prefetched, using the required number of blocks that is, for example, predetermined for each command. Alternatively, the prefetch sufficiency determination section 102 may determine whether or not prefetching is sufficient based on whether or not an appropriate number of blocks required for a function (such as tool radius compensation function or curve approximation function) that is currently being used in the numerical controller 1 have been prefetched. In the case of the tool radius compensation function, to prevent a difference in level between blocks, the interference between the tool and a workpiece, and the like from being caused by tool radius compensation, at least two subsequent blocks need to be prefetched to analyze a compensated path. In the case of the curve approximation function, a curve approximated from a series of commanded points commanded by a plurality of blocks is calculated using a predetermined algorithm, and an appropriate number of blocks that are required for the algorithm or that command a sufficient number of commanded points that are sufficient to calculate a correct approximated curve by the algorithm need to be prefetched. In the case where a required number of blocks for each command or each function is used as described above, the required number of blocks or a formula for calculating the required number of blocks for each command or each function may be set in a setting area provided on the non-volatile memory 14 in advance.
(29) The analysis section 104 analyzes blocks prefetched from the program 200 and storing execution data obtained as the result of analysis in the execution data buffer 210. The execution data buffer 210 stores information such as modal information on each prefetched block, the amount of travel of each axis, the commanded number of revolutions of the spindle, and feedrate. The analysis of blocks performed by the analysis section 104 means conversion of blocks as source code into object code as execution data which can be recognized by the computer. This conversion includes the steps of (1) lexical analysis, (2) macro analysis, (3) macro execution, (4) syntactic analysis, (5) semantic analysis, (6) object code generation, (7) optimization, and the like. Details of analysis processing by the analysis section 104 are thoroughly described in, for example, Japanese Patent Application Laid-Open No. 2008-293261, and will therefore be omitted in the specification of the present application.
(30) The program execution section 110 is implemented by the CPU 11 of the numerical controller 1 illustrated in
(31) The numerical controller 1 having the above-described configuration according to this embodiment can perform control so as to prefetch an appropriate number of blocks required for a predetermined reference block based on the state of the currently running program. This prevents blocks from being prefetched more than necessary, and minimizes the influence of prefetching that exerts on the execution of macros. Moreover, since blocks are neither prefetched nor analyzed more than necessary, load concentration is reduced during program execution. For example, the influence of prefetching that exerts on cooperation between programs is expected to be reduced.
(32)
(33) Each functional block illustrated in
(34) The numerical controller 1 of this embodiment differs from the numerical controller 1 according to the first embodiment in that the prefetch analysis section 100 further includes a reference block setting section 106.
(35) The reference block setting section 106 dynamically sets, based on the state of execution of a currently running block and the time necessary to execute prefetched blocks, a reference block that is used by the prefetch sufficiency determination section 102 as a reference for determining whether or not block prefetching from the program 200 is sufficient. The reference block setting section 106 may set the reference block based on, for example, the time necessary to execute the currently running block and the time necessary to execute each prefetched block.
(36)
(37) The reference block setting section 106 sets, based on, for example, a threshold t.sub.th of the time necessary for prefetch analysis that is set in advance in a setting area of the non-volatile memory 14, a block immediately after a block that can be executed during the time equal to the threshold t.sub.th, as reference block. In the example of
(38) In the numerical controller 1 according to the first embodiment, a reference block is statically set in advance, and prefetch sufficiency determination processing is performed based on the set reference block. However, in the case where the execution of a currently running block or a block subsequent to the running block is finished within a short period of time, for example, if setting of the block immediately after the running block as a reference block is made static, execution of the reference block may in some cases be under way or may have already been completed at the time when prefetch sufficiency determination processing is finished. Accordingly, in the numerical controller 1 according to this embodiment, such a problem can be prevented by providing the reference block setting section 106 that dynamically sets a reference block.
(39) While embodiments of the present invention have been described above, the present invention is not limited to only the above-described exemplary embodiments, and can be carried out in various aspects by making appropriate modifications thereto.