JP2011096114A - Numerical control device, method of controlling machine tool, and control program of the machine tool - Google Patents

Numerical control device, method of controlling machine tool, and control program of the machine tool Download PDF

Info

Publication number
JP2011096114A
JP2011096114A JP2009251076A JP2009251076A JP2011096114A JP 2011096114 A JP2011096114 A JP 2011096114A JP 2009251076 A JP2009251076 A JP 2009251076A JP 2009251076 A JP2009251076 A JP 2009251076A JP 2011096114 A JP2011096114 A JP 2011096114A
Authority
JP
Japan
Prior art keywords
servo
interrupt
cycle
timer
processor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2009251076A
Other languages
Japanese (ja)
Inventor
Takeshi Irie
武志 入江
Kokichi Isoda
康吉 磯田
Tatsuo Aoki
起男 青木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2009251076A priority Critical patent/JP2011096114A/en
Publication of JP2011096114A publication Critical patent/JP2011096114A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Numerical Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To stably and allocate a fixed portion of processes of a processor to control processes of peripheral equipment, without fail, without increasing the complexity of software or hardware. <P>SOLUTION: A numerical control device for controlling a plurality of operations, regarding servos 3, 4 and the peripheral devices includes the processor 13; a system control cycle timer 111; a system control cycle interrupt generator 112, which generates a first interruption request to the processor 13 at a system control cycle; a servo-synchronizing cycle timer 122 which is different from the system control cycle timer 111; a servo-synchronizing cycle interrupt generator 123, which generates a second interrupt request to the processor 13 at a servo-synchronizing cycle; a timer cycle divider 123a, which divides the cycle of the second interruption request into a predetermined number of sections; and a servo-synchronizing cycle interrupt generator 123, which generates a third interruption request for controlling the peripheral equipment to the processor 13, at the start of a predetermined section. <P>COPYRIGHT: (C)2011,JPO&amp;INPIT

Description

本発明は、複数のサーボ駆動機構や周辺機器を備えた工作機械の動作を数値制御する数値制御装置、工作機械の制御方法、及び工作機械の制御プログラムに関する。   The present invention relates to a numerical control device that numerically controls the operation of a machine tool including a plurality of servo drive mechanisms and peripheral devices, a control method for the machine tool, and a control program for the machine tool.

一般的な工作機械は、複数のサーボ駆動機構を制御することにより被加工物や工具を動作する。工作機械によっては、当該工作機械を覆うスプラッシュカバーの扉の開閉装置、洗浄液や冷却液を噴出・循環させるクーラント装置、切り粉を排出するチップコンベア装置、被加工物の搬入・搬出を行うローダロボットなどの各種周辺機器の動作制御を行う必要がある。近年利用されているコンピュータで構成された数値制御装置(Numerical Control)により制御されるNC工作機械は、NCプログラムに従ってサーボ駆動機構及び周辺機器の自動制御を行う。   A general machine tool operates a workpiece or a tool by controlling a plurality of servo drive mechanisms. Depending on the machine tool, a splash cover door opening / closing device that covers the machine tool, a coolant device that jets and circulates cleaning liquid and coolant, a chip conveyor device that discharges chips, and a loader robot that loads and unloads workpieces It is necessary to control the operation of various peripheral devices. An NC machine tool controlled by a numerical control device (Numerical Control) composed of a computer that has been used in recent years performs automatic control of a servo drive mechanism and peripheral devices according to an NC program.

従来、上記複数のサーボ駆動機構や周辺機器をそれぞれ並行して制御するために、上記数値制御装置以外にも各周辺機器に対応してプログラマブルコントローラを設けていた。プログラマブルコントローラが、主に複数のサーボ駆動機構を動作制御する数値制御装置と連携しつつ、それぞれのシーケンシャルプログラムに従って各周辺機器の動作制御を行うことで、NC工作機械全体で調和の取れた動作を可能としていた。   Conventionally, in order to control the plurality of servo drive mechanisms and peripheral devices in parallel, a programmable controller is provided corresponding to each peripheral device in addition to the numerical control device. Programmable controller, mainly in cooperation with a numerical control device that controls the operation of multiple servo drive mechanisms, controls the operation of each peripheral device in accordance with each sequential program, so that the NC machine tool as a whole can be harmonized. It was possible.

近年では、プロセッサの高機能化に伴い、上記数値制御装置と複数のプログラマブルコントローラが個別に行っていた動作制御の全てを、数値制御装置の一つのプロセッサで処理することが可能となった。このように、従来、複数のプロセッサで実行していた制御処理を単一のプロセッサ上に統合する場合、従来性能を維持するには、元々別のプロセッサで行なっていた個々の制御処理に対して、新たなプロセッサの占有率(処理できる時間の配分)を、個々の制御処理の長さに影響を受けないように、配分することが求められる。   In recent years, it has become possible to process all of the operation control individually performed by the numerical control device and the plurality of programmable controllers with a single processor of the numerical control device, as the functions of the processor become higher. As described above, when the control processing conventionally executed by a plurality of processors is integrated on a single processor, in order to maintain the conventional performance, the individual control processing originally performed by another processor is not performed. Therefore, it is required to allocate a new processor occupancy ratio (distribution of processable time) so as not to be affected by the length of each control process.

そのための具体的な制御手法として、数値制御装置の一つのプロセッサが、リアルタイムOS上で多数の制御処理をそれぞれ所定時間ごとに切り替えて時分割的に並行処理する手法がある。その上で、各時分割処理の開始を要求する割り込みが発生した後、リアルタイムOSの内部に設けた経過時間判定処理が内部的に経過時間をカウントし、所定の経過時間が経過した際に制御処理の実行を開始するよう時間管理する方法がある(例えば、特許文献1参照)。   As a specific control method for that purpose, there is a method in which one processor of a numerical control device switches a large number of control processes on a real-time OS at predetermined time intervals and performs parallel processing in a time division manner. In addition, after an interrupt requesting the start of each time-sharing process occurs, an elapsed time determination process provided in the real-time OS internally counts the elapsed time and controls when a predetermined elapsed time has elapsed. There is a method of managing time so as to start execution of processing (see, for example, Patent Document 1).

各時分割処理の開始を要求する割り込みが発生した後、優先度の高い制御処理が終了すると、命令数で管理された機能が外部から指示された分だけ制御処理を行う方法もある(例えば、特許文献2参照)。   After an interrupt requesting the start of each time-sharing process occurs, when a control process with a high priority is completed, there is also a method of performing the control process by the amount instructed by the function managed by the number of instructions (for example, Patent Document 2).

特開2002−132306号公報JP 2002-132306 A 特開平8−320712号公報JP-A-8-320712

上述したような経過時間判定処理が制御処理の実行開始の時間管理を行う上記特許文献1記載の従来技術では、経過時間判定処理自体がリアルタイムOSのタイマ割り込みに依存している。この場合、数値制御装置にとって主たる制御処理であるサーボ制御の処理を行う周期であるサーボ同期周期よりも短く均一な周期で割り込みを設定する必要があり、不要な割り込み処理が発生し、処理時間の無駄になる。つまり、従来、プログラマブルコントローラで行っていた周辺機器の制御処理が、サーボ制御の処理の長さやサーボ同期周期の長さに影響を受けないようにするためには、サーボ同期周期よりも短く、周辺機器の制御処理に割り当てたいプロセッサの占有率を確保できる周期でタイマ割り込みを設定する必要があり、経過時間をカウントアップするだけの割り込みが過大となるという問題がある。   In the conventional technique described in Patent Document 1 in which the elapsed time determination process as described above manages the time for starting the execution of the control process, the elapsed time determination process itself depends on the timer interrupt of the real-time OS. In this case, it is necessary to set interrupts at a uniform period that is shorter than the servo synchronization period, which is the period for performing the servo control process that is the main control process for the numerical control device. It becomes useless. In other words, in order to prevent peripheral device control processing that has been performed by a programmable controller from being affected by the length of the servo control processing and the length of the servo synchronization cycle, the peripheral processing is shorter than the servo synchronization cycle. There is a problem that it is necessary to set a timer interrupt at a cycle that can ensure the occupation rate of the processor that is desired to be assigned to the control processing of the device, and an interrupt that only counts up the elapsed time becomes excessive.

制御処理を行う機能を命令数で管理する上記特許文献2記載の従来技術では、処理を命令数Nで管理する必要があり、命令数Nを管理する機能にプロセッサの能力を費やされる点で変わりはない。   In the conventional technique described in Patent Document 2 in which the control processing function is managed by the number of instructions, the processing needs to be managed by the number of instructions N, and the function of managing the number of instructions N is changed in that the capacity of the processor is consumed. There is no.

数値制御装置においては、別途、外部の割り込み機構を有し、任意のタイミングで割り込みを得て制御処理することが、プロセッサの能力を最大限利用する為には、相応しい構成であると考えられるが、同一の数値制御装置、同一のハードウェアで構成の異なる複数の工作機械を動作させたい為、構成の違い(サーボの数やサーボとの通信距離)によってサーボ同期周期が異なる場合、数値制御装置から外部の割り込み機構に対し割り込みタイミングを設定する機能を備える必要がある。この場合、数値制御装置から外部の割り込み機構に対し割り込みタイミングを設定するための専用通信線や、数値制御装置と外部の割り込み機構間で割り込みタイミングを設定するための専用プロトコルを生成する処理機構を設ける必要があり、数値制御装置のハードウェア規模ないし、ソフトウェアの開発コストが大きくなり、コストが増大してしまう。   In a numerical control device, it is considered that a separate configuration has an external interrupt mechanism and obtains an interrupt at an arbitrary timing to perform control processing in order to make maximum use of the processor capacity. If you want to operate multiple machine tools with different configurations with the same numerical control device and the same hardware, if the servo synchronization cycle varies depending on the configuration difference (number of servos and communication distance with servo), numerical control device It is necessary to provide a function for setting an interrupt timing to an external interrupt mechanism. In this case, a dedicated communication line for setting the interrupt timing from the numerical controller to the external interrupt mechanism and a processing mechanism for generating a dedicated protocol for setting the interrupt timing between the numerical controller and the external interrupt mechanism are provided. Therefore, the hardware scale of the numerical control device or the software development cost increases and the cost increases.

以上に挙げた従来技術は、いずれも数値制御装置の一つのプロセッサだけでサーボ制御処理に加え周辺機器の制御処理も併せて実行するために、リアルタイムOSや制御処理機構であるソフトウェア、及びハードウェアを大幅に複雑化させる原因となる。   All of the above-described prior arts execute a real-time OS, control processing mechanism software, and hardware in order to execute not only servo control processing but also peripheral device control processing by only one processor of the numerical control device. Cause a significant increase in complexity.

本発明の目的は、ソフトウェアやハードウェアを複雑化することなく、動作制御の演算手段であるプロセッサの処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる数値制御装置、工作機械の制御方法、及び工作機械の制御プログラムを提供することにある。   An object of the present invention is to stably and surely allocate a certain percentage of the processing of the processor, which is a calculation means for operation control, to the control processing of the peripheral device without complicating software and hardware. A numerical control device, a machine tool control method, and a machine tool control program are provided.

上記目的を達成するために、第1発明の数値制御装置は、工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御する数値制御装置であって、演算手段と、第1タイマと、前記第1タイマの計時における所定の周期で、前記演算手段に対し、当該演算手段の動作クロックの周期に応じた第1割り込みを発生させる第1割り込み発生手段と、第1タイマとは異なる第2タイマと、前記第2タイマの計時における所定の周期で、前記演算手段に対し、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる第2割り込み発生手段と、前記第2割り込み発生手段による前記第2割り込みの周期を所定の複数の区間に分割する分割手段と、前記分割手段により分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる第3割り込み発生手段とを有することを特徴とする。   In order to achieve the above object, a numerical controller according to a first aspect of the present invention includes a machine tool main body provided with a servomotor for moving a tool or a workpiece, and a plurality of peripheral devices related to predetermined peripheral equipment related to the machine tool main body. Is a numerical control device for controlling the operation of the calculation means with respect to the calculation means at a predetermined cycle in the timing of the calculation means, the first timer, and the first timer. A first interrupt generating means for generating a first interrupt according to a period; a second timer different from the first timer; and a predetermined period in the time counting of the second timer; Second interrupt generation means for generating a second interrupt for servo data transmission / reception, and the second interrupt cycle by the second interrupt generation means is divided into a plurality of predetermined sections. And a third interrupt generating means for generating a third interrupt for controlling the peripheral device to the computing means at the start of a predetermined section among the plurality of sections divided by the dividing means. It is characterized by having.

本願第1発明の数値制御装置は、第1タイマ及び第1割り込み発生手段を有する。第1割り込み発生手段は、第1タイマの計時による所定の周期で、演算手段の動作クロックの周期に応じて第1割り込みを発生させる。これにより、リアルタイムOS上の複数のプログラム機能のスケジュール管理を行う。   The numerical control device according to the first aspect of the present invention includes a first timer and a first interrupt generation means. The first interrupt generation means generates a first interrupt according to the period of the operation clock of the calculation means at a predetermined period measured by the first timer. Thereby, schedule management of a plurality of program functions on the real-time OS is performed.

本願第1発明の数値制御装置は、第2タイマ、第2割り込み発生手段、分割手段、及び第3割り込み発生手段を有する。第2割り込み発生手段は、第1タイマとは異なる第2タイマの計時による所定の周期で、サーボモータとのサーボデータ送受信用の第2割り込みを発生させる。分割手段は、第2割り込みの周期を所定の複数の区間に分割する。第3割り込み発生手段は、それら分割された複数の区間のうち所定の区間の開始時に、工作機械の周辺機器を制御するための第3割り込みを発生させる。   The numerical control apparatus according to the first aspect of the present invention includes a second timer, a second interrupt generating means, a dividing means, and a third interrupt generating means. The second interrupt generating means generates a second interrupt for servo data transmission / reception with the servo motor at a predetermined cycle by a time measured by a second timer different from the first timer. The dividing means divides the period of the second interrupt into a plurality of predetermined sections. The third interrupt generation means generates a third interrupt for controlling peripheral devices of the machine tool at the start of a predetermined section among the plurality of divided sections.

これにより、第2割り込みにおいてサーボモータとの間で予め決めた一定のタイミングでサーボモータに指令データを送信し、それに対する返信データを受信してサーボモータの現在位置等を取り込むことができる。また、サーボモータからの返信データの受信処理が確実に終了するようなタイミングに第3割り込みを設定することで、第3割り込みのタイミングにおいて性質の異なる周辺機器の制御処理を行い、次の第2割り込みのときに送信する指令データを、その周辺機器の制御処理を終了した後に作成することができる。   As a result, command data can be transmitted to the servo motor at a predetermined timing with the servo motor in the second interrupt, and the return data can be received to capture the current position of the servo motor. In addition, by setting the third interrupt at a timing at which the process of receiving the return data from the servo motor is surely completed, the control processing of the peripheral device having different properties is performed at the timing of the third interrupt. Command data to be transmitted at the time of interruption can be generated after the control processing of the peripheral device is completed.

以上の結果、通常のリアルタイムOSへの時間を知らせる第1タイマによる第1割り込みは、第2タイマによるサーボ同期周期に対して十分大きく設定することができる。つまり、リアルタイムOS上のシステムクロックによる第1割り込みを細かくすることなく、サーボモータへの指令データをサーボモータと同期したタイミングで送信することができる。そして、サーボモータとの間の指令データや返信データの送受信処理が発生しない制御区間を、第3割り込みという形で確実に得ることができる。   As a result, the first interrupt by the first timer that informs the time to the normal real-time OS can be set sufficiently large with respect to the servo synchronization period by the second timer. That is, the command data to the servo motor can be transmitted at a timing synchronized with the servo motor without making the first interrupt due to the system clock on the real-time OS fine. A control section in which no transmission / reception process of command data and reply data with the servo motor occurs can be reliably obtained in the form of a third interrupt.

したがって、本願第1発明によれば、ソフトウェアやハードウェアを複雑化することなく、演算手段の処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる。   Therefore, according to the first invention of the present application, it is possible to stably and surely allocate a certain proportion of the processing of the computing means to the control processing of the peripheral device without complicating software and hardware.

第2発明の数値制御装置は、上記第1発明において、前記第2割り込み発生手段は、前記第1割り込み発生手段が発生させる前記第1割り込みの周期よりも短い周期で、前記第2割り込みを発生させることを特徴とする。   According to a second aspect of the present invention, in the first invention, the second interrupt generation unit generates the second interrupt at a cycle shorter than the cycle of the first interrupt generated by the first interrupt generation unit. It is characterized by making it.

これにより、リアルタイムOS上のシステムクロックに応じた第1割り込み発生手段による第1割り込みを細かくしなくても、第2割り込み発生手段による第2割り込みにおいてサーボモータへの指令データを確実にサーボモータと同期したタイミングで送信することができる。   As a result, the command data to the servo motor can be reliably transmitted to the servo motor in the second interrupt by the second interrupt generating means without making the first interrupt by the first interrupt generating means according to the system clock on the real-time OS fine. It can be transmitted at synchronized timing.

第3発明の数値制御装置は、上記第1又は第2発明において、前記サーボモータと前記演算手段との間で定期的に同期通信を行うために、当該サーボモータへ接続されたサーボ通信バスと前記演算手段との入出力制御を行うための第1通信インターフェース手段と、前記第2タイマの周期やタイミングを変更可能できる第2タイマ設定手段と、前記サーボ通信バスと前記第2タイマ設定手段との入出力制御を行うための、第2通信インターフェース手段と、前記サーボモータの動作タイミングを発生させるサーボタイマの周期やタイミングを変更できるサーボタイマ設定手段に対し、前記演算手段と前記サーボモータとを同期させるための周期及びタイミングを前記サーボ通信バスを介して設定すると共に、前記第2タイマ設定手段に対し、前記演算手段と前記第2割り込み発生手段及び前記第3割り込み発生手段とを同期させるための周期及びタイミングを前記サーボ通信バスを介して設定するタイマ設定手段とをさらに備えることを特徴とする。   A numerical control device according to a third aspect of the present invention is the first or second aspect of the invention, in order to perform synchronous communication periodically between the servo motor and the arithmetic means, a servo communication bus connected to the servo motor, First communication interface means for performing input / output control with the arithmetic means, second timer setting means capable of changing the cycle and timing of the second timer, the servo communication bus, and the second timer setting means, The arithmetic means and the servo motor are synchronized with the second communication interface means for performing the input / output control of the servo motor and the servo timer setting means capable of changing the cycle and timing of the servo timer for generating the operation timing of the servo motor. And setting the cycle and timing for the second timer setting means, via the servo communication bus, The period and timing for synchronizing with serial arithmetic means and said second interrupt generating means and the third interrupt generating means and further comprising a timer setting means for setting through the servo communication bus.

これにより、第2割り込み発生手段による第2割り込みと第3割り込み発生手段による第3割り込みとの同期を、サーボ通信バスを通じて確実に設定することができる。   Thereby, the synchronization of the second interrupt by the second interrupt generating means and the third interrupt by the third interrupt generating means can be set reliably through the servo communication bus.

第4発明の数値制御装置は、上記第1乃至第3発明のいずれかにおいて、前記第3割り込み発生手段は、前記複数の区間のうち前記サーボ通信バスの混雑区間を避けて、前記演算手段に対し前記第3割り込みを発生させることを特徴とする。   According to a fourth aspect of the present invention, in the numerical control device according to any one of the first to third aspects, the third interrupt generation means avoids a congested section of the servo communication bus from the plurality of sections, and On the other hand, the third interrupt is generated.

これにより、演算手段の負担を増大させることなく、演算手段の処理のうちの一定割合を周辺機器の制御処理に対し安定的に配分することができる。   As a result, a certain proportion of the processing of the computing means can be stably distributed to the control processing of the peripheral devices without increasing the burden on the computing means.

上記目的を達成するために、第5発明の工作機械の制御方法は、工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御する工作機械の制御方法であって、所定の第1周期で、前記工作機械に備えられた演算手段の動作クロックの周期に応じた第1割り込みを発生させる手順と、第1周期とは異なる所定の第2周期で、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる手順と、前記第2割り込みの周期を所定の複数の区間に分割する手順と、前記分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる手順とを備えることを特徴とする。   In order to achieve the above object, a machine tool control method according to a fifth aspect of the present invention relates to a machine tool body provided with a servo motor for moving a tool or a workpiece, and a predetermined peripheral device related to the machine tool body. A machine tool control method for controlling a plurality of operations by multitasking, wherein a first interrupt corresponding to a cycle of an operation clock of an arithmetic means provided in the machine tool is generated at a predetermined first cycle. A procedure, a procedure for generating a second interrupt for transmitting / receiving servo data with the servo motor at a predetermined second cycle different from the first cycle, and a cycle of the second interrupt are divided into a plurality of predetermined sections. And a procedure for causing the arithmetic means to generate a third interrupt for controlling the peripheral device at the start of a predetermined section of the plurality of divided sections. And features.

本願第5発明の工作機械の制御方法では、第1周期で、演算手段の動作クロックの周期に応じて第1割り込みを発生させる。これにより、リアルタイムOS上の複数のプログラム機能のスケジュール管理を行う。また、第1周期とは異なる第2周期で、サーボモータとのサーボデータ送受信用の第2割り込みを発生させる。また、第2割り込みの周期を所定の複数の区間に分割し、それら分割された複数の区間のうち所定の区間の開始時に、工作機械の周辺機器を制御するための第3割り込みを発生させる。   In the machine tool control method according to the fifth aspect of the present invention, the first interrupt is generated in the first cycle according to the cycle of the operation clock of the computing means. Thereby, schedule management of a plurality of program functions on the real-time OS is performed. A second interrupt for transmitting / receiving servo data with the servo motor is generated at a second period different from the first period. In addition, the second interrupt cycle is divided into a plurality of predetermined sections, and a third interrupt for controlling peripheral devices of the machine tool is generated at the start of the predetermined section among the divided sections.

これにより、第2割り込みにおいてサーボモータとの間で予め決めた一定のタイミングでサーボモータに指令データを送信し、それに対する返信データを受信してサーボモータの現在位置等を取り込むことができる。また、サーボモータからの返信データの受信処理が確実に終了するようなタイミングに第3割り込みを設定することで、第3割り込みのタイミングにおいて性質の異なる周辺機器の制御処理を行い、その周辺機器の制御処理を終了した後に、次の第2割り込みのときに送信する指令データを作成することができる。   As a result, command data can be transmitted to the servo motor at a predetermined timing with the servo motor in the second interrupt, and the return data can be received to capture the current position of the servo motor. In addition, by setting the third interrupt at a timing at which the process of receiving the return data from the servo motor is surely completed, the control processing of the peripheral device having different properties is performed at the timing of the third interrupt. After completing the control process, command data to be transmitted at the next second interrupt can be created.

以上の結果、通常のリアルタイムOSへの時間を知らせる第1割り込みの第1周期を、サーボモータの同期のための第2周期に対して十分大きく設定することができる。つまり、リアルタイムOS上のシステムクロックによる第1周期を細かくすることなく、サーボモータへの指令データをサーボモータと同期したタイミングで送信することができる。そして、サーボモータとの間の指令データや返信データの送受信処理が発生しない制御区間を、第3割り込みという形で確実に得ることができる。   As a result, the first period of the first interrupt for informing the time to the normal real-time OS can be set sufficiently larger than the second period for servo motor synchronization. That is, the command data to the servo motor can be transmitted at a timing synchronized with the servo motor without reducing the first cycle by the system clock on the real-time OS. A control section in which no transmission / reception process of command data and reply data with the servo motor occurs can be reliably obtained in the form of a third interrupt.

したがって、本願第5発明によれば、ソフトウェアやハードウェアを複雑化することなく、演算手段の処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる。   Therefore, according to the fifth aspect of the present invention, it is possible to stably and surely distribute a certain ratio of the processing of the arithmetic means to the control processing of the peripheral device without complicating software and hardware.

上記目的を達成するために、第6発明の工作機械の制御プログラムは、工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御するための工作機械の制御プログラムであって、コンピュータに、所定の第1周期で、前記工作機械に備えられた演算手段の動作クロックの周期に応じた第1割り込みを発生させる手順と、第1周期とは異なる所定の第2周期で、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる手順と、前記第2割り込みの周期を所定の複数の区間に分割する手順と、前記分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる手順とを実行させることを特徴とする。   In order to achieve the above object, a machine tool control program according to a sixth aspect of the present invention relates to a machine tool main body provided with a servo motor for moving a tool or a work, and a predetermined peripheral device related to the machine tool main body. , A machine tool control program for controlling a plurality of operations by multitasking, wherein a computer has a first program corresponding to a cycle of an operation clock of an arithmetic means provided in the machine tool at a predetermined first cycle. A procedure for generating one interrupt, a procedure for generating a second interrupt for servo data transmission / reception with the servo motor at a predetermined second cycle different from the first cycle, and a predetermined plurality of cycles for the second interrupt. A third division for controlling the peripheral device to the computing means at the start of a predetermined section among the plurality of divided sections. Characterized in that to execute the steps of generating only.

本願第6発明の工作機械の制御プログラムを実行するコンピュータは、第1周期で、演算手段の動作クロックの周期に応じて第1割り込みを発生させる。これにより、リアルタイムOS上の複数のプログラム機能のスケジュール管理を行う。また、第1周期とは異なる第2周期で、サーボモータとのサーボデータ送受信用の第2割り込みを発生させる。また、第2割り込みの周期を所定の複数の区間に分割し、それら分割された複数の区間のうち所定の区間の開始時に、工作機械の周辺機器を制御するための第3割り込みを発生させる。   The computer that executes the machine tool control program of the sixth invention of the present application generates a first interrupt in the first period according to the period of the operation clock of the computing means. Thereby, schedule management of a plurality of program functions on the real-time OS is performed. A second interrupt for transmitting / receiving servo data with the servo motor is generated at a second period different from the first period. In addition, the second interrupt cycle is divided into a plurality of predetermined sections, and a third interrupt for controlling peripheral devices of the machine tool is generated at the start of the predetermined section among the divided sections.

これにより、第2割り込みにおいてサーボモータとの間で予め決めた一定のタイミングでサーボモータに指令データを送信し、それに対する返信データを受信してサーボモータの現在位置等を取り込むことができる。また、サーボモータからの返信データの受信処理が確実に終了するようなタイミングに第3割り込みを設定することで、第3割り込みのタイミングにおいて性質の異なる周辺機器の制御処理を行い、その周辺機器の制御処理を終了した後に、次の第2割り込みにおいてサーボモータに対して送る指令データを作成することができる。   As a result, command data can be transmitted to the servo motor at a predetermined timing with the servo motor in the second interrupt, and the return data can be received to capture the current position of the servo motor. In addition, by setting the third interrupt at a timing at which the process of receiving the return data from the servo motor is surely completed, the control processing of the peripheral device having different properties is performed at the timing of the third interrupt. After the control process is completed, command data to be sent to the servo motor in the next second interrupt can be created.

以上の結果、通常のリアルタイムOSへの時間を知らせる第1割り込みの第1周期を、サーボモータの同期のための第2周期に対して十分大きく設定することができる。つまり、リアルタイムOS上のシステムクロックによる第1周期を細かくすることなく、サーボモータへの指令データをサーボモータと同期したタイミングで送信することができる。そして、サーボモータとの間の指令データや返信データの送受信処理が発生しない制御区間を、第3割り込みという形で確実に得ることができる。
したがって、本願第6発明によれば、ソフトウェアやハードウェアを複雑化することなく、演算手段の処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる。
As a result, the first period of the first interrupt for informing the time to the normal real-time OS can be set sufficiently larger than the second period for servo motor synchronization. That is, the command data to the servo motor can be transmitted at a timing synchronized with the servo motor without reducing the first cycle by the system clock on the real-time OS. A control section in which no transmission / reception process of command data and reply data with the servo motor occurs can be reliably obtained in the form of a third interrupt.
Therefore, according to the sixth aspect of the present invention, it is possible to stably and surely allocate a certain proportion of the processing of the arithmetic means to the control processing of the peripheral device without complicating software and hardware.

本発明によれば、ソフトウェアやハードウェアを複雑化することなく、演算手段の処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる。   According to the present invention, it is possible to stably and surely allocate a certain proportion of the processing of the calculation means to the control processing of the peripheral device without complicating software and hardware.

本発明の実施形態に係る数値制御装置及びサーボのシステム構成を模式的に表す機能ブロック図である。1 is a functional block diagram schematically showing a system configuration of a numerical control device and a servo according to an embodiment of the present invention. 各割り込み要求のタイミングと各処理の実行との関係を示すタイムチャートの一例である。It is an example of the time chart which shows the relationship between the timing of each interruption request | requirement, and execution of each process. サーボ同期周期とシステム制御周期との関係を示すタイムチャートの一例である。It is an example of the time chart which shows the relationship between a servo synchronous period and a system control period. 数値制御装置のプロセッサが実行する制御手順を表すフローチャートである。It is a flowchart showing the control procedure which the processor of a numerical controller performs. プロセッサと各機器との間のネットワーク形態を表す図である。It is a figure showing the network form between a processor and each apparatus. 通信インターフェース間の伝搬遅延時間、及び各周期間のオフセット時間の関係を表す図である。It is a figure showing the relationship of the propagation delay time between communication interfaces, and the offset time between each period. 図4中のステップS100の同期処理の詳細手順を表すフローチャートである。It is a flowchart showing the detailed procedure of the synchronous process of step S100 in FIG. プロセッサと各機器との間のネットワーク形態の変形例を表す図である。It is a figure showing the modification of the network form between a processor and each apparatus.

以下、本発明の一実施の形態を図面を参照しつつ説明する。   Hereinafter, an embodiment of the present invention will be described with reference to the drawings.

図1は、数値制御装置及びサーボのシステム構成を模式的に表す機能ブロック図である。数値制御装置1は、工作機械本体(特に図示せず)の全体における複数の動作をマルチタスクで制御する(以下適宜、時分割的に制御するという)ものである。   FIG. 1 is a functional block diagram schematically showing the system configuration of the numerical controller and the servo. The numerical control device 1 controls a plurality of operations in the entire machine tool main body (not shown in particular) by multitasking (hereinafter referred to as time division control as appropriate).

図1に示すように、数値制御装置1は、サーボ通信バス2を介して複数のサーボ3,4と情報を送受信可能に接続している。図中では、図示の便宜上、2つのサーボ3,4だけがサーボ通信バス2に接続し、以下の説明においてもサーボを2つだけ接続する例で説明するが、実際にはより多くのサーボを接続する構成としてもよい。数値制御装置1はサーボ3,4以外の他の複数の周辺機器に対しても動作制御を行うものとしているが、それら周辺機器の図示は省略している。   As shown in FIG. 1, the numerical controller 1 is connected to a plurality of servos 3 and 4 via a servo communication bus 2 so as to be able to transmit and receive information. In the drawing, for convenience of illustration, only two servos 3 and 4 are connected to the servo communication bus 2, and in the following description, an example in which only two servos are connected will be described. It is good also as a structure to connect. Although the numerical control apparatus 1 performs operation control on a plurality of peripheral devices other than the servos 3 and 4, illustration of these peripheral devices is omitted.

数値制御装置1は、システム制御用割り込み回路11と、サーボ同期用割り込み回路12と、プロセッサ13とを有している。数値制御装置1は、上記プロセッサ13がサーボ通信バス2と通信可能に接続するための第1通信インターフェース手段としての第1通信インターフェース14と、上記サーボ同期用割り込み回路12が同じサーボ通信バス2に通信可能に接続するための第2通信インターフェース手段としての第2通信インターフェース15とを有している。図中においてこれら回路11,12とプロセッサ13はハードウェア的に区別して示しているが、それぞれが備える機能ブロックは内部の処理機能で区別して示している。特にプロセッサ13の内部の機能ブロックは、いずれもソフトウェア的な処理で区別したソフトウェアブロックで示している。   The numerical controller 1 includes a system control interrupt circuit 11, a servo synchronization interrupt circuit 12, and a processor 13. The numerical control apparatus 1 includes a first communication interface 14 as a first communication interface means for the processor 13 to be communicably connected to the servo communication bus 2, and the servo synchronization interrupt circuit 12 in the same servo communication bus 2. It has the 2nd communication interface 15 as a 2nd communication interface means for connecting so that communication is possible. In the figure, the circuits 11 and 12 and the processor 13 are distinguished from each other in terms of hardware, but the functional blocks provided in each are distinguished from each other by internal processing functions. In particular, all the functional blocks inside the processor 13 are shown as software blocks distinguished by software processing.

システム制御用割り込み回路11は、プロセッサ13がリアルタイムOS上で実行する複数の処理を時分割的に切り替える契機となる第1割り込み要求(後述の図2、図3参照)を出力する。システム制御用割り込み回路11は、システム制御周期タイマ111と、システム制御周期割り込み発生器112とを有している。各請求項記載の第1タイマとしてのシステム制御周期タイマ111は、プロセッサ13の基準クロックをカウントし、所定の時間長に設定したシステム制御周期(後述の図3参照)が経過するたびに報知する。各請求項記載の第1割り込み発生手段としてのシステム制御周期割り込み発生器112は、システム制御周期タイマ111が時間経過を報知した際、各請求項記載の第1割り込みである上記第1割り込み要求の信号を発生してプロセッサ13に出力する。   The system control interrupt circuit 11 outputs a first interrupt request (see FIGS. 2 and 3 to be described later) that triggers switching of a plurality of processes executed by the processor 13 on the real-time OS in a time division manner. The system control interrupt circuit 11 includes a system control cycle timer 111 and a system control cycle interrupt generator 112. The system control period timer 111 as the first timer described in each claim counts the reference clock of the processor 13 and notifies it every time a system control period (see FIG. 3 described later) set to a predetermined time length elapses. . The system control cycle interrupt generator 112 serving as the first interrupt generation means described in each claim, when the system control cycle timer 111 notifies of the passage of time, the first interrupt request which is the first interrupt described in each claim. A signal is generated and output to the processor 13.

サーボ同期用割り込み回路12は、プロセッサ13が各サーボ3,4と同期制御する基準となる所定の時間長のサーボ同期周期ごとに、各サーボ3,4の制御処理を開始する契機となる第2割り込み要求(後述の図2参照)を出力する。サーボ同期用割り込み回路12は、各サーボ同期周期中における同じ適宜のタイミングで、周辺機器の制御処理の開始と終了のそれぞれの契機となる2つの第3割り込み要求(後述の図2参照)を出力する。   The servo synchronization interrupt circuit 12 is a second trigger for starting the control processing of the servos 3 and 4 for each servo synchronization period of a predetermined time length as a reference for the processor 13 to perform synchronous control with the servos 3 and 4. An interrupt request (see FIG. 2 described later) is output. The servo synchronization interrupt circuit 12 outputs two third interrupt requests (see FIG. 2 to be described later) that trigger the start and end of the peripheral device control processing at the same appropriate timing during each servo synchronization period. To do.

サーボ同期用割り込み回路12は、サーボ同期周期設定器121と、サーボ同期周期タイマ122と、サーボ同期周期割り込み発生器123とを有している。第2タイマ設定手段としてのサーボ同期周期設定器121は、プロセッサ13から2つの通信インターフェース14,15とサーボ通信バス2とを介して受信する設定指令に従って、サーボ同期周期タイマ122に対しサーボ同期周期と位相すなわち、サーボ同期周期の開始タイミングを設定する。各請求項記載の第2タイマとしてのサーボ同期周期タイマ122は、サーボ同期用割り込み回路12の基準クロックをカウントし、設定したサーボ同期周期(後述の図2、図3参照)の始期が経過するたびに時間経過信号を出力する。なお、サーボ同期用割り込み回路12の基準クロックは、プロセッサ13の基準クロックと同一な基準クロックを使用する構成でも良い。   The servo synchronization interrupt circuit 12 includes a servo synchronization period setter 121, a servo synchronization period timer 122, and a servo synchronization period interrupt generator 123. The servo synchronization cycle setting unit 121 as the second timer setting means is configured to send a servo synchronization cycle to the servo synchronization cycle timer 122 in accordance with a setting command received from the processor 13 via the two communication interfaces 14 and 15 and the servo communication bus 2. And the phase, that is, the start timing of the servo synchronization period is set. The servo synchronization period timer 122 as the second timer described in each claim counts the reference clock of the servo synchronization interrupt circuit 12, and the start period of the set servo synchronization period (see FIGS. 2 and 3 to be described later) elapses. A time lapse signal is output each time. Note that the reference clock of the servo synchronization interrupt circuit 12 may be the same as the reference clock of the processor 13.

各請求項記載の第2割り込み発生手段及び第3割り込み発生手段としてのサーボ同期周期割り込み発生器123は、サーボ同期周期タイマ122から時間経過信号を入力した際に、各請求項記載の第2割り込みとしての上記第2割り込み要求の信号を発生してプロセッサ13に出力する。サーボ同期周期割り込み発生器123はその内部に、各請求項記載の分割手段としてのタイマ周期分割器123aを備えている。タイマ周期分割器123aが上記サーボ同期周期を分周して複数の区間に等分割する。サーボ同期周期割り込み発生器123は、そのうちの所定のタイミングにある2つの等分割区間のそれぞれの始期で各請求項記載の第3割り込みとしての上記2つの第3割り込み要求の信号を発生し、プロセッサ13に出力する(後述の図2参照)。   The servo synchronization period interrupt generator 123 serving as the second interrupt generation means and the third interrupt generation means according to each claim receives the time lapse signal from the servo synchronization period timer 122 and outputs the second interrupt according to each claim. The second interrupt request signal is generated and output to the processor 13. The servo synchronization period interrupt generator 123 includes a timer period divider 123a as a dividing means described in each claim. The timer period divider 123a divides the servo synchronization period and equally divides it into a plurality of sections. The servo synchronization period interrupt generator 123 generates the two third interrupt request signals as the third interrupt according to each claim at the start of each of the two equally divided sections at a predetermined timing, 13 (see FIG. 2 described later).

プロセッサ13は、制御プログラム等を実行することで、NCプログラムの解析や、上記サーボ3,4及び周辺機器を含めた工作機械の全体(特に図示せず)の動作を制御する各請求項記載の演算手段である。プロセッサ13は、上述したソフトウェアブロックとして、リアルタイムOSスケジューラ131、通常処置部132、割り込みスケジューラ133、周辺機器処理部134、サーボ指令生成部135、サーボ送受信処理部136、及び同期周期設定指令部137を有している。   The processor 13 executes the control program or the like to control the analysis of the NC program and the operation of the entire machine tool (not shown) including the servos 3 and 4 and peripheral devices. It is a calculation means. The processor 13 includes a real-time OS scheduler 131, a normal processing unit 132, an interrupt scheduler 133, a peripheral device processing unit 134, a servo command generation unit 135, a servo transmission / reception processing unit 136, and a synchronization cycle setting command unit 137 as the software blocks described above. Have.

リアルタイムOSスケジューラ131は、上記システム制御用割り込み回路11のシステム制御周期割り込み発生器112から上記第1割り込み要求の信号を入力するたびに、その時点でプロセッサ13がリアルタイムOS上で並行処理すべき複数の処理のうちそれ以降に実行すべきものを選択指定して、個々の処理を起動及び中断させる。通常処理部132は、リアルタイムOSスケジューラ131が選択指定した処理が、リアルタイムOSスケジューラ131が起動し中断されるまでの区間、通常処理(後述の図2参照)として実行する。   Each time the real-time OS scheduler 131 receives the first interrupt request signal from the system control cycle interrupt generator 112 of the system control interrupt circuit 11, the processor 13 is to execute a plurality of processes to be processed in parallel on the real-time OS at that time. The processes to be executed after that are selected and designated, and individual processes are started and interrupted. The normal processing unit 132 executes the process selected and specified by the real-time OS scheduler 131 as a normal process (see FIG. 2 described later) until the real-time OS scheduler 131 is activated and interrupted.

割り込みスケジューラ133は、上記サーボ同期用割り込み回路12のサーボ同期周期割り込み発生器123から上記第2割り込み要求または第3割り込み要求の信号を入力するたびに、通常処理よりも、リアルタイムOS上で処理優先度が高く設定されている、後述するサーボ送受信処理、周辺機器処理、及びサーボ指令生成処理のいずれか一つを適宜の順序で選択指定して、個々の処理を起動及び中断させる。   The interrupt scheduler 133 gives priority to processing on the real-time OS over normal processing every time the second interrupt request or third interrupt request signal is input from the servo synchronization period interrupt generator 123 of the servo synchronization interrupt circuit 12. One of servo transmission / reception processing, peripheral device processing, and servo command generation processing, which will be described later, which is set to a high degree, is selected and specified in an appropriate order to start and interrupt each processing.

周辺機器処理部134は、上記割り込みスケジューラ133が周辺機器処理を起動してから中断させるまでの間だけ、当該周辺機器処理を時分割的に実行する。サーボ指令生成部135は、上記割り込みスケジューラ133がサーボ指令生成処理を選択指定し起動したタイミングで、当該サーボ指令生成処理の実行を開始する。サーボ送受信処理部136は、上記割り込みスケジューラ133がサーボ送受信処理を選択指定し起動したタイミングで、サーボ送受信処理のうち、指令データを送信するサーボ指令送信処理の実行を開始する。このとき、サーボ送受信処理136は、第1サーボ3、第2サーボ4のサーボ制御機34に対して指令データを各通信インターフェース14、31とサーボ通信バス2とを介して送信する。そして、第1サーボ3、第2サーボ4は、指令データを受信した直後、返信データを各通信インターフェース14,31とサーボ通信バス2とを介して、サーボ送受信処理136に対して送信する。サーボ送受信処理部136は、その返信データを受信したタイミングで、サーボ送受信処理のうち、返信データを受信するサーボ応答受信処理を実行する。なお、後に詳述するが、サーボ送受信処理部136による指令データの送信処理と返信データの受信処理は、全てのサーボに対して、全ての指令データが送信及び返信データが受信できるまで、何度も分割・混合して実行する。   The peripheral device processing unit 134 executes the peripheral device processing in a time-sharing manner until the interrupt scheduler 133 starts the peripheral device processing and interrupts it. The servo command generation unit 135 starts executing the servo command generation processing at the timing when the interrupt scheduler 133 selects and activates the servo command generation processing. The servo transmission / reception processing unit 136 starts executing the servo command transmission process for transmitting command data in the servo transmission / reception process at the timing when the interrupt scheduler 133 selects and activates the servo transmission / reception process. At this time, the servo transmission / reception processing 136 transmits command data to the servo controllers 34 of the first servo 3 and the second servo 4 via the communication interfaces 14 and 31 and the servo communication bus 2. Then, immediately after receiving the command data, the first servo 3 and the second servo 4 transmit the reply data to the servo transmission / reception processing 136 via the communication interfaces 14 and 31 and the servo communication bus 2. The servo transmission / reception processing unit 136 executes a servo response reception process for receiving the return data in the servo transmission / reception process at the timing when the return data is received. As will be described in detail later, the transmission / reception processing of the command data by the servo transmission / reception processing unit 136 and the reception processing of the return data are repeated for all servos until all the command data can be transmitted and the return data can be received. Is also divided and mixed.

タイマ設定手段としての同期周期設定指令部137は、各通信インターフェース14,15,31とサーボ通信バス2とを介して、上記サーボ同期周期設定器121と、各サーボ3,4の後述するサーボ制御周期設定器32に対し、所定の時間長に設定したサーボ同期周期と開始タイミング、及び同じ時間長のサーボ制御周期と開始タイミングを各タイマ122,33に設定させるための設定指令を送信する。なお、サーボ同期周期設定器121と後述するサーボ制御周期設定器32が、同じハードウェアで構成される機構ないし、同期周期設定指令部137から送信される設定指令を受信することができ、言い換えると受信側のタイマの周期と開始タイミングを変更するように指令された通信上の共通のプロトコルを判別可能で、自身のタイマの周期と開始タイミングを変更可能な類似の機構であることが、同期周期設定指令部137の処理の規模を小さくでき、非常に望ましい。   The synchronization cycle setting command unit 137 serving as a timer setting means is connected to the servo synchronization cycle setting unit 121 and servo control (described later) of the servos 3 and 4 via the communication interfaces 14, 15 and 31 and the servo communication bus 2. A setting command for causing the timers 122 and 33 to set the servo synchronization cycle and start timing set to a predetermined time length and the servo control cycle and start timing of the same time length is transmitted to the cycle setter 32. The servo synchronization period setting unit 121 and a servo control period setting unit 32, which will be described later, can receive a setting command transmitted from a mechanism constituted by the same hardware or the synchronization cycle setting command unit 137, in other words. The synchronization cycle must be a similar mechanism that can determine the common communication protocol that is instructed to change the timer period and start timing of the receiving side, and that can change its timer period and start timing. The setting command unit 137 can reduce the scale of processing, which is very desirable.

なお、上記構成の数値制御装置1が備える各回路11,12及びプロセッサ13のうち、システム制御用割り込み回路11とサーボ同期用割り込み回路12については、それぞれ実行速度が速く専用のプログラムを必要としない比較的単純な構造のハードウェア回路で構成することができる。プロセッサ13のみが、専用のプログラムに基づいて作動するプログラマブルコントローラとして機能する。   Of the circuits 11 and 12 and the processor 13 included in the numerical controller 1 having the above-described configuration, the system control interrupt circuit 11 and the servo synchronization interrupt circuit 12 each have a high execution speed and do not require a dedicated program. It can be configured by a hardware circuit having a relatively simple structure. Only the processor 13 functions as a programmable controller that operates based on a dedicated program.

サーボ通信バス2は、この例ではEthernet(登録商標)の規格に準じた構成となっている。サーボ通信バス2は他のシリアル通信を利用する構成としてもよい。   In this example, the servo communication bus 2 has a configuration conforming to the Ethernet (registered trademark) standard. The servo communication bus 2 may be configured to use other serial communication.

第1通信インターフェース14は、プロセッサ13に対し、パケット単位のデータを送受するタイミングで、後述するサーボ指令送信割り込み要求及びサーボ応答受信割り込み要求の信号を出力する割り込み回路として機能する。   The first communication interface 14 functions as an interrupt circuit that outputs signals of a servo command transmission interrupt request and a servo response reception interrupt request, which will be described later, at a timing at which data in packet units is transmitted to and received from the processor 13.

各サーボ3,4は、特に図示しない工具やワークを移動させるための各請求項記載のサーボモータであり、サーボ通信インターフェース31と、サーボ制御周期設定器32と、サーボ制御周期タイマ33と、サーボ制御器34とを有している。サーボ3,4が備える機能ブロックは内部の処理機能で区別して示しており、第2サーボ4の内部の機能ブロックは省略している。   Each of the servos 3 and 4 is a servo motor according to claims for moving a tool or a workpiece (not shown), and includes a servo communication interface 31, a servo control cycle setter 32, a servo control cycle timer 33, a servo And a controller 34. The functional blocks included in the servos 3 and 4 are distinguished by internal processing functions, and the internal functional blocks of the second servo 4 are omitted.

サーボタイマ設定手段としてのサーボ制御周期設定器32は、プロセッサ13から2つの通信インターフェース14,31とサーボ通信バス2とを介して受信する設定指令に従って、上記サーボ同期周期と同じ時間長のサーボ制御周期と、サーボ制御周期の位相つまり、サーボ制御周期の開始タイミングをサーボ制御周期タイマ33に設定する。サーボタイマとしてのサーボ制御周期タイマ33は、設定した開始タイミングでサーボ制御周期の計時動作を開始し、設定した時間長のサーボ制御周期の始期が経過するたびに時間経過信号を出力する。サーボ制御器34は、プロセッサ13から2つの通信インターフェース14,31とサーボ通信バス2とを介して受信した指令データの内容に基づくサーボ3,4の駆動制御を、サーボ制御周期タイマ33から時間経過信号を入力した際に実行開始する。また、指令データを受信した際には、当該サーボ3,4の実際の位置や電流値を測定しサーボ制御応答としての返信データをプロセッサ13へ返信する。上記サーボ制御指令の指令データ及びサーボ制御応答の返信データが、各請求項記載のサーボデータに相当する。   The servo control cycle setting unit 32 as a servo timer setting means has a servo control cycle having the same length as the servo synchronization cycle according to a setting command received from the processor 13 via the two communication interfaces 14 and 31 and the servo communication bus 2. The servo control cycle phase, that is, the start timing of the servo control cycle is set in the servo control cycle timer 33. The servo control cycle timer 33 as a servo timer starts a time measurement operation of the servo control cycle at the set start timing, and outputs a time lapse signal every time the start of the servo control cycle of the set time length elapses. The servo controller 34 controls the drive control of the servos 3 and 4 based on the contents of the command data received from the processor 13 via the two communication interfaces 14 and 31 and the servo communication bus 2 from the servo control cycle timer 33. Execution starts when a signal is input. When the command data is received, the actual positions and current values of the servos 3 and 4 are measured, and return data as a servo control response is returned to the processor 13. The command data of the servo control command and the response data of the servo control response correspond to the servo data described in each claim.

プロセッサ13における各割り込み要求と各処理との関係を具体的に説明する。図2は、本実施形態における各割り込み要求のタイミングと各処理の実行との関係を示すタイムチャートの一例を表している。プロセッサ13は、各割り込み要求の信号を、それぞれどの割り込み回路11,12からどの内容の割り込み要求であるか区別可能に入力する。   The relationship between each interrupt request and each process in the processor 13 will be specifically described. FIG. 2 shows an example of a time chart showing the relationship between the timing of each interrupt request and the execution of each process in the present embodiment. The processor 13 inputs each interrupt request signal from which interrupt circuit 11 or 12 so as to be able to distinguish which content is the interrupt request.

図2に示す例では、上記サーボ同期用割り込み回路12のサーボ同期周期タイマ122が繰り返し出力する時間経過信号の時間間隔、つまりサーボ同期周期を200μsecに設定している。サーボ同期周期割り込み発生器123のタイマ周期分割器123aは、この例では上記サーボ同期周期を3回分周して8つの区間に等分割している。サーボ同期周期割り込み発生器123はそれら8つのうちの最初の等分割区間の始期、つまりサーボ同期周期全体の始期のタイミングで、第2割り込み要求を出力する。この例では、サーボ同期周期割り込み発生器123が、8つのうちの6番目と7番目の等分割区間のそれぞれの始期で第3割り込み要求を出力する。   In the example shown in FIG. 2, the time interval of the time lapse signal repeatedly output by the servo synchronization period timer 122 of the servo synchronization interrupt circuit 12, that is, the servo synchronization period is set to 200 μsec. In this example, the timer period divider 123a of the servo synchronization period interrupt generator 123 divides the servo synchronization period three times and equally divides it into eight sections. The servo synchronization period interrupt generator 123 outputs a second interrupt request at the beginning of the first equally divided section of these eight, that is, at the beginning of the entire servo synchronization period. In this example, the servo synchronization period interrupt generator 123 outputs a third interrupt request at the start of each of the sixth and seventh equally divided sections of the eight.

プロセッサ13は、基本的に通常処理を通常時に実行し、上記の各割り込み要求を入力した際には、割り込みスケジューラ133を最優先的に動作させ、割り込みスケジューラ133が上述したサーボ指令送信処理、サーボ応答受信処置、周辺機器処理、及びサーボ指令生成処理のいずれか一つを適宜の順序で選択指定して実行させる、いわゆるハードウェア割り込みを行う。   The processor 13 basically executes normal processing at normal time, and when each interrupt request is input, the processor 13 operates the interrupt scheduler 133 with the highest priority, and the interrupt scheduler 133 performs the above-described servo command transmission processing, servo A so-called hardware interrupt is performed in which any one of response reception processing, peripheral device processing, and servo command generation processing is selected and executed in an appropriate order.

具体的には、プロセッサ13は、サーボ同期周期全体の始期にサーボ同期周期割り込み発生器123から第2割り込み要求を入力した際に、サーボ指令送信処理の実行を開始する。サーボ指令送信処理は、工作機械が備える複数のサーボ3,4に対してそれぞれ対応する後述のサーボ制御指令を送信する処理である。プロセッサ13は、上記サーボ制御指令の実行を終了したサーボ3,4からサーボ制御応答を受信した際に、サーボ応答受信処理を実行する。   Specifically, the processor 13 starts executing the servo command transmission process when the second interrupt request is input from the servo synchronization period interrupt generator 123 at the beginning of the entire servo synchronization period. The servo command transmission process is a process of transmitting a corresponding servo control command to be described later to each of the plurality of servos 3 and 4 included in the machine tool. The processor 13 executes a servo response reception process when receiving a servo control response from the servos 3 and 4 that have finished executing the servo control command.

上記サーボ指令送信処理は複数のサーボ3,4に対して順番にサーボ制御指令を送信する。各サーボ3,4のサーボ制御指令を受信してからサーボ制御応答を返信するまでの実行時間は、比較的短い。サーボ3,4の設置数が多い場合には、プロセッサ13は、サーボ指令送信処理による全てのサーボ制御指令の送信を完全に終了する前に、最初のサーボ制御応答がプロセッサ13に到着してサーボ応答受信処理を開始する場合が多い。   In the servo command transmission process, servo control commands are transmitted to the plurality of servos 3 and 4 in order. The execution time from receiving the servo control command of each servo 3, 4 to returning the servo control response is relatively short. When the number of installed servos 3 and 4 is large, the processor 13 receives the first servo control response at the processor 13 and completes the servo before completely transmitting all the servo control commands by the servo command transmission process. Response reception processing is often started.

上述したようにこの例では、サーボ通信バス2がEthernet(登録商標)に準じた構成となっているため、プロセッサ13及びサーボ3,4は、上記サーボ制御指令とサーボ制御応答のデータを容量の小さいパケット単位に分割して送受信する。通信インターフェース14,31間でパケットを送受信している間に、プロセッサ13は通常処理を時分割的に実行する。パケットの送受が完了した際に、第1通信インターフェース14から特に図示しない割り込み要求を入力することによって、プロセッサ13はサーボ指令送信処理またはサーボ応答受信処理のいずれかに復帰する。プロセッサ13は、上記第2割り込み要求の一度の入力を契機として、通常処理とサーボ指令送信処理とサーボ応答受信処理とを繰り返し分割・混合して実行する。   As described above, in this example, since the servo communication bus 2 has a configuration conforming to Ethernet (registered trademark), the processor 13 and the servos 3 and 4 store the servo control command and servo control response data in a capacity. Send and receive in small packets. While transmitting and receiving packets between the communication interfaces 14 and 31, the processor 13 executes normal processing in a time division manner. When the packet transmission / reception is completed, the processor 13 returns to either the servo command transmission process or the servo response reception process by inputting an interrupt request (not shown) from the first communication interface 14. The processor 13 divides and mixes the normal process, the servo command transmission process, and the servo response reception process repeatedly with the input of the second interrupt request as a trigger.

プロセッサ13は、サーボ応答受信処理が終了した後、6番目の等分割区間の始期でサーボ同期周期割り込み発生器123から1回目の第3割り込み要求を入力した際には、周辺機器処理に切り替えて実行を開始する。周辺機器処理は、工作機械が備える各種の周辺機器に対して動作制御を行う処理である。プロセッサ13が、制御対象となる周辺機器処理を複数備えている場合には、ここに周辺機器のスケジューラを持ち、1番目の第3割り込みがくるたびに順番に処理を開始させるなどして実行するが、ここではその詳細を省略する。   The processor 13 switches to the peripheral device processing when the first third interrupt request is input from the servo synchronization cycle interrupt generator 123 at the beginning of the sixth equally divided section after the servo response reception processing is completed. Start execution. Peripheral device processing is processing for performing operation control on various peripheral devices included in the machine tool. When the processor 13 includes a plurality of peripheral device processes to be controlled, the processor 13 has a peripheral device scheduler, and executes the processing by sequentially starting the processing every time the first third interrupt is received. However, the details are omitted here.

プロセッサ13は、7番目の等分割区間の始期で、サーボ同期周期割り込み発生器123から2回目の第3割り込み要求を入力した際には、それまで継続して実行していた周辺機器処理を中断し、サーボ指令生成処理に切り替えて実行を開始する。サーボ指令生成処理は、次のサーボ同期周期におけるサーボ指令送信処理で各サーボ3,4に送信するサーボ制御指令である指令データを生成する処理である。この例では、プロセッサ13は、同じサーボ同期周期のサーボ応答受信処理で受信した各サーボ3,4のサーボ制御応答である返信データを参照し、次のサーボ同期周期における各サーボ3,4の動作目標値などの各サーボ制御指令である指令データを生成することにより、各サーボ3,4に対していわゆるセミ・クローズド・ループ制御を行う。プロセッサ13は、各サーボ3,4に対応する全てのサーボ制御指令の生成が完了した際に、通常処理に切り替えて実行を再開する。   When the processor 13 inputs the third interrupt request for the second time from the servo synchronization period interrupt generator 123 at the beginning of the seventh equally divided section, the processor 13 interrupts the peripheral processing that has been continuously executed until then. Then, switching to servo command generation processing is started. The servo command generation process is a process of generating command data that is a servo control command to be transmitted to each of the servos 3 and 4 in the servo command transmission process in the next servo synchronization cycle. In this example, the processor 13 refers to the return data that is the servo control response of each servo 3 and 4 received in the servo response reception process of the same servo synchronization period, and the operation of each servo 3 and 4 in the next servo synchronization period. By generating command data which is each servo control command such as a target value, so-called semi-closed loop control is performed on each servo 3 and 4. When generation of all servo control commands corresponding to the servos 3 and 4 is completed, the processor 13 switches to normal processing and resumes execution.

以上のようにして、プロセッサ13の割り込みスケジューラ133は、各回のサーボ同期周期中でそれぞれ5つの処理を同じ適宜の順序で選択指定し、それぞれ対応する各処理部または生成部によって時分割的に実行させる。上記説明したサーボ同期周期とその区間分割数、及び各割り込み要求のタイミングなどの設定は一例であり、サーボ3,4の設置数や周辺機器の設置態様などといった工作機械の構成・作動環境に応じて各設定を適宜変更してもよい。   As described above, the interrupt scheduler 133 of the processor 13 selects and designates five processes in the same appropriate order in each servo synchronization period, and executes them in a time-sharing manner by the corresponding processing units or generation units. Let The above-described setting of the servo synchronization period, the number of divided sections, and the timing of each interrupt request is an example, depending on the configuration and operating environment of the machine tool, such as the number of servos 3 and 4 and the installation mode of peripheral devices. Each setting may be changed as appropriate.

プロセッサ13は、システム制御周期割り込み発生器112から第1割り込み要求を入力した際に、リアルタイムOSスケジューラ131がリアルタイムOS上で次に実行すべき通常処理として選択指定した処理を、通常処理部132に実行させる。通常処理の具体的な処理内容としては、例えば特に図示しない操作画面の表示データの作成や、操作部での入力検出、消耗品の使用時間のカウントアップ、NCプログラムの命令の読み取りや解析などがある。これら通常処理は、上記サーボ同期周期より比較的長い周期で切り替えて時分割的に実行しても十分な機能を得るものである。例えば図3に示すように、サーボ同期周期は上記の200μsec程度の短い周期に設定する必要があるのに対し、通常処理はおよそ数msecのオーダーの比較的長いシステム制御周期に設定できる。上記図2のタイムチャートは、この図3中の範囲部分IIを拡大して示している。   When the processor 13 receives the first interrupt request from the system control cycle interrupt generator 112, the processor 13 selects the normal processing that the real-time OS scheduler 131 selects and designates as the normal processing to be executed next on the real-time OS. Let it run. Specific processing contents of the normal processing include, for example, creation of operation screen display data (not shown), input detection at the operation unit, counting up of usage time of consumables, reading and analysis of NC program instructions, etc. is there. These normal processes obtain sufficient functions even if they are switched in a period relatively longer than the servo synchronization period and executed in a time-sharing manner. For example, as shown in FIG. 3, the servo synchronization cycle needs to be set to a short cycle of about 200 μsec, whereas the normal processing can be set to a relatively long system control cycle of the order of several milliseconds. The time chart of FIG. 2 shows the range portion II in FIG. 3 in an enlarged manner.

以上の行程に従うことにより、プロセッサ13は、リアルタイムOS上の複数の処理をシステム制御周期に適正に同期して実行できるとともに、複数のサーボ3,4及び周辺機器の制御処理をサーボ同期周期に適正に同期して実行することができる。プロセッサ13自身は、時間長が大きく異なるシステム制御周期及びサーボ同期周期に対して、それぞれの周期の計時を行うことなく、外部のハードウェア回路から各種の割り込み要求を入力したタイミングでそれぞれに対応する各種の処理を時分割的に実行するだけでよい。プロセッサ13自身は、複数の周期に基づく周期処理を複合的に行うために複雑な計時処理などを行う必要がなく、そのためリアルタイムOS上のオーバーヘッド(無駄な処理時間)を格段に小さくすることができ、プロセッサ13の処理パワーを大きく軽減できる。多数のサーボ3,4や周辺機器を備える工作機械全体の動作制御を行う上で、プログラマブルコントローラの単一化を機能的に実現できる。   By following the above process, the processor 13 can execute a plurality of processes on the real-time OS in appropriate synchronization with the system control period, and can appropriately control a plurality of servos 3 and 4 and peripheral devices in the servo synchronization period. Can be executed synchronously. The processor 13 itself responds to timings when various interrupt requests are input from an external hardware circuit, without measuring each cycle, with respect to system control cycles and servo synchronization cycles having greatly different time lengths. It is only necessary to execute various processes in a time-sharing manner. The processor 13 itself does not need to perform complicated timing processing and the like in order to perform periodic processing based on a plurality of cycles, so that overhead (unnecessary processing time) on the real-time OS can be significantly reduced. The processing power of the processor 13 can be greatly reduced. In performing the operation control of the entire machine tool including a large number of servos 3 and 4 and peripheral devices, the unification of the programmable controller can be functionally realized.

次に、上記説明した本実施形態による同期制御を行うための同期周期設定指令部137の具体的な制御手順を、図4を参照して説明する。数値制御装置1は、電源投入の際、またはユーザが所定の操作を行った際にこのフローを開始する。   Next, a specific control procedure of the synchronization cycle setting command unit 137 for performing the synchronization control according to the present embodiment described above will be described with reference to FIG. The numerical controller 1 starts this flow when the power is turned on or when a user performs a predetermined operation.

ステップS5において、数値制御装置1のプロセッサ13は、サーボ通信バス2と各通信インターフェース14,15,31を介したブロードキャスト通信などにより、当該サーボ通信バス2に接続しているサーボ3,4の数や、それらの種類、接続経路などを調べる。本実施形態の例では、プロセッサ13は、上記図1に示したように、一つのサーボ同期用割り込み回路12と、複数個のサーボ3,4を検出する。   In step S5, the processor 13 of the numerical controller 1 determines the number of servos 3, 4 connected to the servo communication bus 2 by broadcast communication via the servo communication bus 2 and the communication interfaces 14, 15, 31. Check their types, connection routes, etc. In the example of this embodiment, the processor 13 detects one servo synchronization interrupt circuit 12 and a plurality of servos 3 and 4 as shown in FIG.

ステップS10へ移り、数値制御装置1のプロセッサ13は、上記ステップS5で検出したサーボ3,4の種類や数に応じてサーボ同期周期を算出する。具体的には、まずプロセッサ13が各サーボ3,4との同期通信で送受信するデータの総量に基づく送受信処理の必要時間と、各サーボ3,4へ送信するサーボ制御指令を全て生成するための必要時間とを算出する。本実施形態の例では、上記図2におけるサーボ指令送信処理とサーボ応答受信処理を通して実行するために必要な時間と、サーボ指令生成処理の実行に必要な時間を算出する。   Moving to step S10, the processor 13 of the numerical controller 1 calculates a servo synchronization period according to the type and number of servos 3 and 4 detected in step S5. Specifically, first, the processor 13 generates all the time required for transmission / reception processing based on the total amount of data transmitted / received in synchronous communication with the servos 3 and 4 and the servo control commands to be transmitted to the servos 3 and 4. Calculate the required time. In the example of the present embodiment, the time required to execute through the servo command transmission process and the servo response reception process in FIG. 2 and the time required to execute the servo command generation process are calculated.

数値制御装置1のプロセッサ13は、これらの必要時間とともに、通常処理と周辺機器処理をそれぞれ十分に実行できる必要時間を考慮して、サーボ同期周期を算出する。また、各サーボ3,4がサーボ同期周期に応答できるかどうかの性能に応じてサーボ同期周期変更することもある。   The processor 13 of the numerical control device 1 calculates the servo synchronization period in consideration of the necessary time for sufficiently executing the normal processing and the peripheral device processing together with the necessary time. Further, the servo synchronization period may be changed according to the performance of whether each servo 3, 4 can respond to the servo synchronization period.

本実施形態の数値制御装置1は、上記の算出・設定を行うことにより、多様な工作機械の仕様に対応できる汎用性を備える。数値制御装置1は、サーボ同期周期の設定を、工作機械の仕様に対応してあらかじめ固定的に設定・記憶していてもよい。その場合には、このステップS10の手順を省略できる。   The numerical control device 1 according to the present embodiment has versatility that can correspond to various machine tool specifications by performing the above calculation and setting. The numerical control apparatus 1 may set and store the servo synchronization period in a fixed manner in advance corresponding to the specifications of the machine tool. In that case, the procedure of step S10 can be omitted.

ステップS15へ移り、数値制御装置1のプロセッサ13は、サーボ同期用割り込み回路12のサーボ同期周期設定器121に上記ステップS10で算出したサーボ同期周期を設定するとともに、各サーボ3,4のサーボ制御周期設定器32に上記ステップS10で算出したサーボ同期周期をサーボ制御周期として設定する。具体的には、プロセッサ13の同期周期設定指令部137が、ステップS10で算出したサーボ同期周期を含む設定指令をサーボ同期周期設定器121に送信し、同じくステップS10で算出したサーボ制御周期を含む設定指令を各サーボ制御周期設定器32に送信する。各周期設定器がそれぞれ対応する各タイマ121,32に対して計時周期を設定し、当該各タイマ121,35の計時動作を開始させる。   Proceeding to step S15, the processor 13 of the numerical controller 1 sets the servo synchronization period calculated in step S10 in the servo synchronization period setting unit 121 of the servo synchronization interrupt circuit 12, and performs servo control of the servos 3 and 4. The servo synchronization period calculated in step S10 is set as the servo control period in the period setter 32. Specifically, the synchronization cycle setting command unit 137 of the processor 13 transmits a setting command including the servo synchronization cycle calculated in step S10 to the servo synchronization cycle setting unit 121, and similarly includes the servo control cycle calculated in step S10. A setting command is transmitted to each servo control cycle setting unit 32. Each cycle setter sets a clocking period for each timer 121, 32 corresponding thereto, and starts the clocking operation of each timer 121, 35.

ステップS20へ移り、数値制御装置1のプロセッサ13は、第1通信インターフェース14と、サーボ同期用割り込み回路12及び各サーボ3,4のそれぞれの通信インターフェース15,31との間でデータを送受する際の伝搬遅延時間を計測・算出する。   In step S20, the processor 13 of the numerical controller 1 transmits and receives data between the first communication interface 14 and the communication interfaces 15 and 31 of the servo synchronization interrupt circuit 12 and the servos 3 and 4, respectively. Measure and calculate the propagation delay time.

以下に、本実施形態の例において伝搬遅延時間を計測・算出する具体的な手法について詳しく説明する。図5に示すように、本実施形態の例において、プロセッサ13は、サーボ同期用割り込み回路12と2つのサーボ3,4に対してそれぞれ個別にデータを送受するネットワーク形態となっている。この場合に、データの送信と受信のそれぞれの伝搬遅延時間が同じであるとすると、IEEE1588準拠のSync/Delay Reqパケットを通信インターフェース14,15,31どうしで互いに発信することにより、一方向つまり片道での伝搬遅延時間を計測・算出することができる。   Hereinafter, a specific method for measuring and calculating the propagation delay time in the example of the present embodiment will be described in detail. As shown in FIG. 5, in the example of this embodiment, the processor 13 has a network configuration in which data is individually transmitted to and received from the servo synchronization interrupt circuit 12 and the two servos 3 and 4. In this case, assuming that the propagation delay times of the data transmission and reception are the same, by sending the Sync / Delay Req packets compliant with IEEE 1588 to each other between the communication interfaces 14, 15, and 31, one-way or one-way Propagation delay time can be measured and calculated.

図5に示すように、例えばプロセッサ13側からSyncパケットを送信した時刻をT0、サーボ同期用割り込み回路12側でこのSyncパケットを受信した時刻をT1とし、このSyncパケットに対応して返信するDelay Reqパケットをサーボ同期用割り込み回路12側から送信した時刻をT1′、プロセッサ13側でこのDelay Reqパケットを受信した時刻をT0′とする。   As shown in FIG. 5, for example, the time when the Sync packet is transmitted from the processor 13 side is T0, and the time when the Sync packet is received on the servo synchronization interrupt circuit 12 side is T1, and a response corresponding to this Sync packet is returned. The time when the Req packet is transmitted from the servo synchronization interrupt circuit 12 side is T1 ′, and the time when the processor 13 receives the Delay Req packet is T0 ′.

サーボ同期用割り込み回路12側で検出する時刻T1,T1′は、この例のサーボ同期周期である0〜200μsecまでを繰り返し計時するサーボ同期周期タイマ122の計時時刻である。プロセッサ13側で検出する時刻T0,T0′は、電源が投入されてからプロセッサ13の基準クロックをカウントして生成されるシステムタイマを、サーボ同期周期の時間長の200μsecで除算したときの余りの時間であり、時刻T0,T0′もまた、0〜200μsecを繰り返す計時時刻である。   The times T1 and T1 ′ detected on the servo synchronization interrupt circuit 12 side are the time measured by the servo synchronization period timer 122 that repeatedly measures the servo synchronization period of 0 to 200 μsec in this example. The times T0 and T0 ′ detected on the processor 13 side are the remainders when the system timer generated by counting the reference clock of the processor 13 after the power is turned on is divided by the servo synchronization cycle time length of 200 μsec. Time T0 and T0 ′ are also timed times that repeat 0 to 200 μsec.

以上の場合に、各時刻T0,T0′,T1,T1′の関係は、図6(a)に示すようになる。システム制御周期タイマ111とサーボ同期周期タイマ122はそれぞれ無関係に計時を開始する場合、図中に示すようにそれぞれの計時時刻の0基点つまり、位相にズレが生じている。この例において、システム制御周期タイマ111の0基点を基準としたサーボ同期周期タイマ122の0基点のズレ、つまり2つタイマ間の位相のズレを第1オフセット時間To1とし、プロセッサ13とサーボ同期用割り込み回路12との間のデータの伝搬遅延時間を第1伝搬遅延時間Td1とすると、図示する関係から以下の式が成立する。   In the above case, the relationship between the times T0, T0 ′, T1, and T1 ′ is as shown in FIG. When the system control cycle timer 111 and the servo synchronization cycle timer 122 start timing independently of each other, as shown in the figure, there is a deviation in the zero base point of each timing, that is, the phase. In this example, the deviation of the zero base point of the servo synchronization period timer 122 with respect to the zero base point of the system control period timer 111, that is, the phase deviation between the two timers is defined as the first offset time To1, and the servo synchronization cycle with the processor 13 is used. Assuming that the propagation delay time of data with the interrupt circuit 12 is the first propagation delay time Td1, the following equation is established from the relationship shown in the figure.

Td1=(T1+To1)−T0
Td1=T0′−(T1′+To1)
第1伝搬遅延時間Td1は、
Td1=(T1−T1′−T0+T0′)/2
となる。
Td1 = (T1 + To1) −T0
Td1 = T0 ′ − (T1 ′ + To1)
The first propagation delay time Td1 is
Td1 = (T1-T1'-T0 + T0 ') / 2
It becomes.

図示する関係から以下の式も成立する。
T0+Td1=To1+T1
第1オフセット時間To1は、
To1=T0−T1+Td1
但し上記結果がTo1>200ならば、To1は、To1−200となり、また上記結果がTo1<0ならば、To1はTo1+200となる。
From the relationship shown in the figure, the following equation is also established.
T0 + Td1 = To1 + T1
The first offset time To1 is
To1 = T0−T1 + Td1
However, if the result is To1> 200, To1 is To1-200, and if the result is To1 <0, To1 is To1 + 200.

なお、上記図1に示す数値制御装置1の構成において、システム制御周期タイマ111と、サーボ同期周期タイマ122の基準クロックを同一のハードウェアを使用する場合は、To1は0となることもありこの場合は、省略できる。   In the configuration of the numerical control device 1 shown in FIG. 1, when the same hardware is used as the reference clock for the system control cycle timer 111 and the servo synchronization cycle timer 122, To1 may be 0. In case, it can be omitted.

他の各サーボに対しても同様の手法により、データ送受の伝搬遅延時間とタイマ間の位相差を計測・算出することができ、それらの関係は図6(b)に示すようになる。図6(a)と図6(b)は、図中の右方向に向かう時間軸上で同期している。   With respect to the other servos, the data transmission / reception propagation delay time and the phase difference between the timers can be measured and calculated by the same method, and their relationship is as shown in FIG. 6 (a) and 6 (b) are synchronized on the time axis in the right direction in the figure.

図6(b)において、第2オフセット時間To2は、システム制御周期タイマ111と第1サーボ3のサーボ制御周期タイマ33との間の位相差を示し、第2伝搬遅延時間Td2は、プロセッサ13と第1サーボ3との間のデータ送受の伝搬遅延時間を示している。第3オフセット時間To3は、システム制御周期タイマ111と第2サーボ4のサーボ制御周期タイマ33との間の位相差を示し、第3伝搬遅延時間Td3は、プロセッサ13と第2サーボ4との間のデータ送受の伝搬遅延時間を示している。   In FIG. 6B, the second offset time To2 indicates the phase difference between the system control cycle timer 111 and the servo control cycle timer 33 of the first servo 3, and the second propagation delay time Td2 The propagation delay time of data transmission / reception with the first servo 3 is shown. The third offset time To3 indicates the phase difference between the system control cycle timer 111 and the servo control cycle timer 33 of the second servo 4, and the third propagation delay time Td3 is between the processor 13 and the second servo 4. The propagation delay time of data transmission / reception is shown.

本実施形態では、各サーボ3,4の制御動作が同時に開始できるよう、各サーボ制御周期タイマ33の位相差を適宜のタイミングで一致させる補正を行う。具体的には、まずサーボまでの伝搬遅延時間が最も長い、図示する例では第2伝搬遅延時間Td2をもとに、新たな位相の0基点を決定する。図示するようにサーボ同期周期タイマ122の位相の0基点を基準として、そこから第2伝搬遅延時間Td2と余裕時間Tmを加算したサーボ同時基点TSsを、新たな位相の0基点とする。   In the present embodiment, correction is performed to match the phase difference of each servo control cycle timer 33 at an appropriate timing so that the control operations of the servos 3 and 4 can be started simultaneously. Specifically, first, the zero base point of a new phase is determined based on the longest propagation delay time to the servo, which is the second propagation delay time Td2 in the illustrated example. As shown in the figure, the servo simultaneous base point TSs obtained by adding the second propagation delay time Td2 and the margin time Tm from the zero base point of the phase of the servo synchronization period timer 122 is set as the zero base point of the new phase.

余裕時間Tmは、プロセッサ13が全てのサーボ3,4にサーボ制御指令を送信するのに必要な時間、上記図2におけるサーボ指令送信処理を完全に終了させるのに必要な時間よりも十分に長い時間に設定する。プロセッサ13がサーボ同期周期タイマ122の位相の0基点である時刻Ts1からサーボ指令送信処理を開始すると、サーボ同時基点TSsの時刻に到達するまでには全てのサーボ3,4がサーボ制御指令の受信を完了することができる。全てのサーボ3,4がサーボ同時基点TSsの時刻で一斉に直前に得たサーボ制御指令に対するサーボ制御動作を開始することができる。   The margin time Tm is sufficiently longer than the time required for the processor 13 to transmit servo control commands to all the servos 3 and 4 and the time required to completely end the servo command transmission processing in FIG. Set to time. When the processor 13 starts the servo command transmission process from the time Ts1, which is the zero base point of the servo synchronization cycle timer 122, all the servos 3, 4 receive the servo control command until the time of the servo simultaneous base point TSs is reached. Can be completed. All servos 3 and 4 can start the servo control operation for the servo control command obtained immediately before at the time of the servo simultaneous base point TSs.

第1サーボ3のサーボ制御周期タイマ33の位相において初期の0基点を上記サーボ同時基点TSsへ移すために必要な位相補正値R2は、
R2=To1+Td2+Tm−To2
となる。
In the phase of the servo control cycle timer 33 of the first servo 3, the phase correction value R2 necessary for moving the initial 0 base point to the servo simultaneous base point TSs is:
R2 = To1 + Td2 + Tm-To2
It becomes.

同様にして、第2サーボ4のサーボ制御周期タイマ33の位相において初期の0基点を上記サーボ同時基点TSsへ移すために必要な位相補正値R3は、
R3=To1+Td2+Tm−To3
となる。
Similarly, the phase correction value R3 necessary for moving the initial 0 base point to the servo simultaneous base point TSs in the phase of the servo control cycle timer 33 of the second servo 4 is:
R3 = To1 + Td2 + Tm-To3
It becomes.

各通信インターフェース14,15,31やサーボ通信バス2の仕様によっては、上記の各伝搬遅延時間が長くなりすぎてしまい、上記図2に示した周辺機器処理の割り込みスケジュールに影響を与える。図2において、サーボ指令送信処理開始からサーボ応答受信処理終了までの時間が、サーボ同期周期の5/8を超える場合は、前述に相当する。これらのような問題が生じる場合には、上記ステップS10でサーボ同期周期の長さをさらに大きくするよう再設定すればよい。   Depending on the specifications of the communication interfaces 14, 15, 31 and the servo communication bus 2, the propagation delay times described above become too long, which affects the interrupt schedule of the peripheral device processing shown in FIG. In FIG. 2, the case where the time from the start of the servo command transmission process to the end of the servo response reception process exceeds 5/8 of the servo synchronization period corresponds to the above. If such a problem occurs, it may be reset so as to further increase the length of the servo synchronization period in step S10.

図4に戻り、次のステップS25で、数値制御装置1のプロセッサ13は、以上のようにして決定した位相補正値をそれぞれ対応する各サーボのサーボ制御周期設定器32に送信し、各サーボ制御周期の位相の0基点を同一のサーボ同時基点TSsに一致させる。   Returning to FIG. 4, in the next step S <b> 25, the processor 13 of the numerical controller 1 transmits the phase correction value determined as described above to the servo control cycle setting unit 32 of each corresponding servo, and each servo control. The zero base point of the phase of the period is made to coincide with the same servo simultaneous base point TSs.

ステップS30へ移り、数値制御装置1のプロセッサ13は、サーボ通信バス2上に接続するサーボ同期用割り込み回路12及び各サーボ3,4にそれぞれ通信確立を送信して同期制御を開始させる。サーボ同期用割り込み回路12のサーボ同期周期割り込み発生器123は、サーボ同期周期タイマ122の計時がサーボ同期周期の0基点となった際に第2割り込み要求をプロセッサ13に出力し、6番目及び7番目の等分割区間のそれぞれの始期で第3割り込み要求をプロセッサ13に出力する(上記図2参照)。上記サーボ同期周期の位相の0基点から上記第2伝搬遅延時間Td2と余裕時間Tmを加算したサーボ同時基点TSsで、全てのサーボ制御器34が一斉に直前に得たサーボ制御指令に対するサーボ制御動作を開始できる。   In step S30, the processor 13 of the numerical controller 1 transmits communication establishment to the servo synchronization interrupt circuit 12 and the servos 3 and 4 connected to the servo communication bus 2 to start synchronization control. The servo synchronization period interrupt generator 123 of the servo synchronization interrupt circuit 12 outputs a second interrupt request to the processor 13 when the time of the servo synchronization period timer 122 reaches the zero point of the servo synchronization period, and the sixth and seventh A third interrupt request is output to the processor 13 at the beginning of each of the first equally divided sections (see FIG. 2 above). Servo control operation for the servo control command obtained immediately before by all the servo controllers 34 at the servo simultaneous base point TSs obtained by adding the second propagation delay time Td2 and the margin time Tm from the zero base point of the servo synchronization period. Can start.

以上の手順により、サーボ通信バス2上の全ての機器に同期制御を行わせる設定準備が完了した後、数値制御装置1のプロセッサ13は、サーボを制御し続けている間、次のステップS100で同期処理を実行する。   After completing the preparation for setting all devices on the servo communication bus 2 to perform the synchronous control by the above procedure, the processor 13 of the numerical controller 1 continues to control the servo in the next step S100. Perform synchronous processing.

上記図4中のステップS100において実行する同期処理の詳細手順を、図7に示す。この同期処理は、図3に示すようにシステム制御周期に同期して通常処理を時分割的に実行するとともに、図2に示すようにサーボ同期周期に同期してサーボ指令送信処理、サーボ応答受信処理、周辺機器処理、及びサーボ指令生成処理の時分割的実行を並行して行う。図中において破線で示す手順経路は、各種の割り込み要求による制御手順の呼び出しに対応するものである。   FIG. 7 shows the detailed procedure of the synchronization process executed in step S100 in FIG. As shown in FIG. 3, the synchronization processing is performed in a time-sharing manner in synchronization with the system control cycle as shown in FIG. 3, and the servo command transmission processing and servo response reception are synchronized with the servo synchronization cycle as shown in FIG. Processing, peripheral device processing, and servo command generation processing are performed in a time-sharing manner in parallel. A procedure path indicated by a broken line in the figure corresponds to a call for a control procedure by various interrupt requests.

この同期処理において、数値制御装置1のプロセッサ13は、上述したように基本的にステップS105の通常処理を継続的に実行しており、上記システム制御用割り込み回路11から第1割り込み要求を入力した際にはステップS110へ移る。プロセッサ13は、上記サーボ同期用割り込み回路12から第2割り込み要求または第3割り込み要求を入力した際にはステップS120へ移る。プロセッサ13は、第1通信インターフェース14から、後述するサーボ指令送信割り込み要求やサーボ応答受信割り込み要求を入力した際も、それぞれその時の状況に応じた制御手順へ移る。   In this synchronization process, the processor 13 of the numerical control apparatus 1 basically executes the normal process of step S105 as described above, and inputs the first interrupt request from the system control interrupt circuit 11. In this case, the process proceeds to step S110. When receiving the second interrupt request or the third interrupt request from the servo synchronization interrupt circuit 12, the processor 13 proceeds to step S120. Even when a servo command transmission interrupt request or a servo response reception interrupt request, which will be described later, is input from the first communication interface 14, the processor 13 moves to a control procedure corresponding to the situation at that time.

第1割り込み要求の入力によりステップS110へ移った場合、数値制御装置1のプロセッサ13は、リアルタイムOSスケジューラ131の選択指定に基づいて通常処理の処理内容を切り替える。   When the process proceeds to step S110 due to the input of the first interrupt request, the processor 13 of the numerical controller 1 switches the processing content of the normal process based on the selection designation of the real-time OS scheduler 131.

このとき、S120〜185の処理が実行中でない場合は、S105に戻ってS110で選択指定された通常処理に切り替える。S120〜185の処理が実行中の場合はS120〜185を継続し、S120〜185の処理が終了/中断した後、S105に戻ってS110で選択指定された通常処理に切り替える。   At this time, if the processes of S120 to 185 are not being executed, the process returns to S105 and switches to the normal process selected and designated in S110. When the processing of S120 to 185 is being executed, S120 to 185 are continued. After the processing of S120 to 185 is completed / interrupted, the processing returns to S105 and switches to the normal processing selected and specified in S110.

第2割り込み要求または第3割り込み要求の入力によりステップS120へ移った場合、数値制御装置1のプロセッサ13は、入力した当該割り込み要求が第2割り込み要求であるか否かを判定する。入力した割り込み要求が第2割り込み要求である場合(ステップS120でYes)、新たなサーボ同期周期が開始したものとみなして次のステップS125へ移る。   When the process proceeds to step S120 due to the input of the second interrupt request or the third interrupt request, the processor 13 of the numerical controller 1 determines whether or not the input interrupt request is the second interrupt request. If the input interrupt request is the second interrupt request (Yes in step S120), it is considered that a new servo synchronization period has started, and the process proceeds to the next step S125.

ステップS125では、数値制御装置1のプロセッサ13は、同一のサーボ同期周期における第3割り込み要求の入力回数を計数するためのカウント変数Cの値を0にリセットする。   In step S125, the processor 13 of the numerical controller 1 resets the value of the count variable C for counting the number of times the third interrupt request is input in the same servo synchronization period to 0.

ステップS130へ移り、数値制御装置1のプロセッサ13は、この時点でサーボ指令生成処理が完全に終了しているか否かを判定する。この時点でまだサーボ指令生成処理が完全に終了していない場合(ステップS130でNo)、現行のサーボ同期周期での設定では良好な同期制御ができないものとみなし、ステップS135へ移る。ステップS135では、数値制御装置1のプロセッサ13は、図示しない表示部にエラー表示を行なったり、上記ステップS10でのサーボ同期周期の再設定を行うなどのエラー処理を行い、このフローを終了する。この時点でサーボ指令生成処理が完全に終了している場合(ステップS130でYes)、次のステップS140へ移り、サーボ指令送信処理を開始する。   Proceeding to step S130, the processor 13 of the numerical controller 1 determines whether or not the servo command generation processing has been completed at this point. If the servo command generation process has not been completely completed at this time (No in step S130), it is considered that good synchronization control cannot be performed with the setting in the current servo synchronization period, and the process proceeds to step S135. In step S135, the processor 13 of the numerical controller 1 performs error processing such as displaying an error on a display unit (not shown) or resetting the servo synchronization period in step S10, and ends this flow. If the servo command generation process is completely completed at this time (Yes in step S130), the process proceeds to the next step S140, and the servo command transmission process is started.

ステップS140では、数値制御装置1のプロセッサ13は、第1通信インターフェース14及びサーボ通信バス2を介して目的のサーボ3,4にサーボ制御指令を送信する。上述したように本実施形態の例では、サーボ通信バス2がEthernet(登録商標)の規格に準じた構成となっているため、プロセッサ13はサーボ制御指令のデータを容量の小さいパケットの単位に分割して送信する。このステップS140では、第1通信インターフェース14が一つのパケットだけを送信開始して、次のステップS145へ移る。   In step S140, the processor 13 of the numerical controller 1 transmits a servo control command to the target servos 3 and 4 via the first communication interface 14 and the servo communication bus 2. As described above, in the example of the present embodiment, the servo communication bus 2 has a configuration conforming to the Ethernet (registered trademark) standard. Therefore, the processor 13 divides the servo control command data into small packet units. Then send. In step S140, the first communication interface 14 starts transmitting only one packet, and proceeds to the next step S145.

ステップS145では、数値制御装置1のプロセッサ13は、各サーボ3,4に対する全てのサーボ制御指令の全てのパケットを送信完了したか否かを判定する。送信すべきサーボ制御指令のパケットが残っている場合(ステップS145でNo)、直前のステップS140でのパケット送信が終了するまでステップS105に戻り通常処理の実行を再開する。ステップS140でのパケット送信が終了した際には、第1通信インターフェース14がプロセッサ13に対して特に図示しないサーボ指令送信割り込み要求を出力し、これを検知したプロセッサ13はステップS140に戻って残りのパケットを送信する。   In step S145, the processor 13 of the numerical controller 1 determines whether or not transmission of all packets of all servo control commands for the servos 3 and 4 has been completed. If there are remaining servo control command packets to be transmitted (No in step S145), the process returns to step S105 until the previous packet transmission in step S140 is completed, and the normal process is resumed. When the packet transmission in step S140 is completed, the first communication interface 14 outputs a servo command transmission interrupt request (not shown) to the processor 13, and the processor 13 that has detected this returns to step S140 and returns to the rest. Send the packet.

各サーボ3,4に対する全てのサーボ制御指令の全てのパケットを送信完了した場合(ステップS145でYes)、数値制御装置1のプロセッサ13は、ステップS105に戻り通常処理の実行を再開する。第1通信インターフェース14が各サーボからサーボ制御応答を受信した際には、プロセッサ13に対して特に図示しないサーボ応答受信割り込み要求を出力し、これを検知したプロセッサ13は次のステップS150へ移り、サーボ応答受信処理を開始する。   When transmission of all packets of all servo control commands for the servos 3 and 4 has been completed (Yes in step S145), the processor 13 of the numerical controller 1 returns to step S105 and resumes execution of normal processing. When the first communication interface 14 receives a servo control response from each servo, it outputs a servo response reception interrupt request (not shown) to the processor 13, and the processor 13 that has detected this moves to the next step S150, Starts servo response reception processing.

上記ステップS145の判定で送信すべきパケットが残っているために判定を満たさず、ステップS105の手順を実行している状態、つまりサーボ指令送信処理の途中の状態でも、第1通信インターフェース14がサーボ制御応答を受信する場合がある。この場合でも第1通信インターフェース14からサーボ応答受信割り込み要求を検知したプロセッサ13はステップS150へ移り、サーボ応答受信処理を開始する。   Since the packet to be transmitted remains in the determination of step S145, the determination does not satisfy the determination, and the first communication interface 14 is in a state where the procedure of step S105 is being executed, that is, in the middle of the servo command transmission process. A control response may be received. Even in this case, the processor 13 that has detected the servo response reception interrupt request from the first communication interface 14 proceeds to step S150 and starts the servo response reception process.

ステップS150では、数値制御装置1のプロセッサ13は、第1通信インターフェース14を介してサーボ制御応答を受信する。プロセッサ13は、このサーボ制御応答もパケット単位で受信する。   In step S <b> 150, the processor 13 of the numerical controller 1 receives a servo control response via the first communication interface 14. The processor 13 also receives this servo control response in units of packets.

ステップS155へ移り、数値制御装置1のプロセッサ13は、各サーボ3,4から全てのサーボ制御応答の全てのパケットを受信完了したか否かを判定する。プロセッサ13は、受信すべきサーボ制御応答のパケットが残っている場合(ステップS155でNo)、直前のステップS150でのパケット受信が終了するまでステップS105に戻り通常処理の実行を再開する。ステップS150でのパケット受信が終了した際には、第1通信インターフェース14がプロセッサ13に対して特に図示しないサーボ応答受信割り込み要求を出力し、これを検知したプロセッサ13はステップS150に戻って残りのパケットを受信する。   Proceeding to step S155, the processor 13 of the numerical controller 1 determines whether or not reception of all packets of all servo control responses from the servos 3 and 4 has been completed. When the servo control response packet to be received remains (No in step S155), the processor 13 returns to step S105 and resumes the execution of the normal process until the packet reception in the immediately preceding step S150 is completed. When the packet reception in step S150 is completed, the first communication interface 14 outputs a servo response reception interrupt request (not shown) to the processor 13, and the processor 13 that has detected this returns to step S150 and returns to the rest. Receive the packet.

数値制御装置1のプロセッサ13は、各サーボ3,4から全てのサーボ制御応答の全てのパケットを受信完了した場合(ステップS155でYes)、ステップS105に戻り通常処理の実行を再開する。この時点で、通常では、サーボ指令送信処理及びサーボ応答受信処理のいずれも送受信完了している状態であり、プロセッサ13は次に第3割り込み要求を入力するまでステップS105の通常処理を継続実行する。   When the processor 13 of the numerical controller 1 completes reception of all packets of all servo control responses from the servos 3 and 4 (Yes in step S155), the processor 13 returns to step S105 and resumes execution of normal processing. At this time, normally, both of the servo command transmission process and the servo response reception process are completed, and the processor 13 continues to execute the normal process of step S105 until the next interrupt request is input. .

上記ステップS120の判定において、直前に入力した割り込み要求が第3割り込み要求である場合(ステップS120でNo)、次のステップS160へ移る。   If it is determined in step S120 that the interrupt request input immediately before is the third interrupt request (No in step S120), the process proceeds to the next step S160.

ステップS160では、数値制御装置1のプロセッサ13は、カウンタ変数Cの値を1増加して次のステップS165へ移る。   In step S160, the processor 13 of the numerical controller 1 increments the value of the counter variable C by 1, and proceeds to the next step S165.

ステップS165では、数値制御装置1のプロセッサ13は、この時点のカウンタ変数Cの値が1であるか2であるかを判定する。言い換えると、直前に入力した第3割り込み要求が現行のサーボ同期周期において最初に入力したものか2番目に入力したものかを判定する。この時点のカウンタ変数Cの値が1である場合、周辺機器処理の開始タイミングであるとみなし、ステップS170へ移る。   In step S165, the processor 13 of the numerical controller 1 determines whether the value of the counter variable C at this time is 1 or 2. In other words, it is determined whether the third interrupt request input immediately before is input first or second in the current servo synchronization period. If the value of the counter variable C at this time is 1, it is regarded as the start timing of the peripheral device processing, and the process proceeds to step S170.

ステップS170では、数値制御装置1のプロセッサ13は、上記ステップS155と同様の判定、現行のサーボ同期周期におけるサーボ応答受信処理がすでに完了しているか否かを判定する。この時点でまだサーボ応答受信処理が完全に終了していない場合(ステップS170でNo)、現行のサーボ同期周期での設定では良好な同期制御ができないものとみなし、ステップS135でのエラー処理を行った後、このフローを終了する。この時点でサーボ応答受信処理が完全に終了している場合(ステップS170でYes)、次のステップS175へ移る。   In step S170, the processor 13 of the numerical controller 1 determines whether or not the same determination as in step S155, that is, the servo response reception process in the current servo synchronization period has already been completed. If the servo response reception processing has not been completed yet at this point (No in step S170), it is considered that good synchronization control cannot be performed with the setting in the current servo synchronization period, and the error processing in step S135 is performed. After that, this flow is finished. If the servo response reception process is completely completed at this time (Yes in step S170), the process proceeds to the next step S175.

ステップS175では、数値制御装置1のプロセッサ13は、周辺機器処理を開始する。ここで、周辺機器処理を複数備えている場合には、ここに周辺機器のスケジューラを持ち、1番目の第3割り込みがくるたびに順番に処理を開始させるなどして実行するが、ここではその詳細を省略する。そして2番目の第3割り込み要求を入力した際にステップS120へ戻る。   In step S175, the processor 13 of the numerical controller 1 starts peripheral device processing. Here, if there are a plurality of peripheral device processes, the peripheral device scheduler is provided here, and each time the first third interrupt is received, the processing is started in order. Details are omitted. When the second third interrupt request is input, the process returns to step S120.

上記ステップS165の判定において、プロセッサ13は、この時点のカウンタ変数Cの値が2である場合、周辺機器処理の終了タイミングであるとみなし、ステップS180へ移る。   In the determination of step S165, if the value of the counter variable C at this time is 2, the processor 13 regards it as the end timing of the peripheral device processing, and proceeds to step S180.

ステップS180では、数値制御装置1のプロセッサ13は、それまで継続していた周辺機器処理の実行を中断する、いわゆるサスペンド処理を行う。次のサーボ同期制御で周辺機器処理を開始する際には、この続きから再開する。   In step S180, the processor 13 of the numerical controller 1 performs a so-called suspend process in which the execution of the peripheral device process that has been continued is interrupted. When the peripheral device processing is started in the next servo synchronization control, the continuation is resumed.

ステップS185へ移り、数値制御装置1のプロセッサ13は、サーボ指令生成処理を実行する。サーボ指令生成処理では、上記ステップS150で受信した各サーボ3,4のサーボ制御応答に基づいて、次回のサーボ同期周期で各サーボ3,4が制御すべき制御動作量を算出し、それぞれのサーボ制御指令を生成する。サーボ指令生成処理が終了した後に、ステップS105へ戻って通常処理を継続実行する。   Moving to step S185, the processor 13 of the numerical control apparatus 1 executes a servo command generation process. In the servo command generation process, based on the servo control responses of the servos 3 and 4 received in step S150, the control operation amount to be controlled by the servos 3 and 4 is calculated in the next servo synchronization period. Generate control commands. After the servo command generation process ends, the process returns to step S105 to continue normal processing.

上記制御手順に従って同期処理を行うことにより、以下の利点が得られる。数値制御装置1と各サーボ間で行われる指令データや応答データの送受信を、本実施形態の例のようにEthernet(登録商標)やシリアル通信で行うため、第1通信インターフェース14からの割り込み要求に対してプロセッサ13は高い優先度で対応する必要がある。プロセッサ13とサーボ3,4との間でデータの送受信をパケット単位で多数回に分けて行うため、それだけ高い頻度で送受信の割り込み要求に対応する必要がある。これに対して上記同期処理では、サーボ指令送信処理とサーボ応答受信処理をサーボ同期周期の最初のいくつかの等分割区間内で集中的に対応し、その後の等分割区間で他の優先度の高い周辺機器処理に専念している。優先度の高い双方の処理の重複を回避して互いに影響を与えることなく実行することができ、プロセッサ13のオーバーヘッド(無駄な処理時間)を低減できる。   By performing the synchronization process according to the above control procedure, the following advantages can be obtained. Since command data and response data sent and received between the numerical controller 1 and each servo are transmitted by Ethernet (registered trademark) or serial communication as in the example of the present embodiment, an interrupt request from the first communication interface 14 is received. On the other hand, the processor 13 needs to cope with high priority. Since data is transmitted and received between the processor 13 and the servos 3 and 4 in a packet unit many times, it is necessary to respond to transmission / reception interrupt requests with such a high frequency. On the other hand, in the above synchronous process, the servo command transmission process and the servo response reception process are intensively handled in the first several equally divided sections of the servo synchronization period, and other priorities in the subsequent equally divided sections. Dedicated to high peripheral processing. It is possible to execute the processes without affecting each other by avoiding the duplication of both processes having high priorities, and the overhead (unnecessary processing time) of the processor 13 can be reduced.

以上説明したように、本実施形態においては、通常のリアルタイムOSへの時間を知らせるシステム制御周期タイマ111による第1割り込み要求は、サーボ同期周期タイマ122によるサーボ3,4のサーボ同期周期に対して十分大きく設定することができる。リアルタイムOS上のシステムクロックによる第1割り込み要求を細かくすることなく、サーボ3,4へのサーボ制御指令をサーボ3,4と同期して送信することができる。サーボ3,4の送受信処理のための第2割り込み要求が発生しない制御区間を、第3割り込み要求という形で確実に得ることができる。   As described above, in the present embodiment, the first interrupt request by the system control cycle timer 111 that informs the time to the normal real-time OS is in response to the servo synchronization cycle of the servos 3 and 4 by the servo synchronization cycle timer 122. It can be set sufficiently large. The servo control command to the servos 3 and 4 can be transmitted in synchronization with the servos 3 and 4 without making the first interrupt request by the system clock on the real-time OS fine. A control section in which the second interrupt request for the transmission / reception processing of the servos 3 and 4 is not generated can be reliably obtained in the form of the third interrupt request.

本実施形態によれば、ソフトウェアやハードウェアを複雑化することなく、プロセッサ13の処理のうちの一定割合を安定的かつ確実に周辺機器の制御処理に対して配分することができる。   According to the present embodiment, it is possible to stably and surely allocate a certain proportion of the processing of the processor 13 to the control processing of the peripheral device without complicating software and hardware.

この実施形態では特に、システム制御周期割り込み発生器112が発生させる第1割り込み要求の周期よりも短い周期で、サーボ同期周期割り込み発生器123が第2割り込み要求を発生させる。リアルタイムOS上のシステムクロックに応じたシステム制御周期割り込み発生器112による第1割り込み要求を細かくしなくても、サーボ同期周期割り込み発生器123による第2割り込み要求においてサーボ3,4へのサーボ制御指令を確実にサーボ3,4と同期して送信することができる。   Particularly in this embodiment, the servo synchronous cycle interrupt generator 123 generates the second interrupt request at a cycle shorter than the cycle of the first interrupt request generated by the system control cycle interrupt generator 112. Servo control commands to the servos 3 and 4 in the second interrupt request by the servo synchronization period interrupt generator 123 without making the first interrupt request by the system control period interrupt generator 112 according to the system clock on the real-time OS fine. Can be reliably transmitted in synchronization with the servos 3 and 4.

この実施形態では特に、数値制御装置1が、サーボ3,4とプロセッサ13との間で定期的に同期通信を行うために、当該サーボ3,4へ接続したサーボ通信バス2とプロセッサ13との入出力制御を行うための第1通信インターフェース14と、サーボ同期周期タイマ122のサーボ同期周期や位相、すなわち開始タイミングを変更可能できるサーボ同期周期設定器121と、サーボ通信バス2とサーボ同期周期設定器121との入出力制御を行うための、第2通信インターフェース15と、サーボ3,4の動作タイミングを発生させるサーボ制御周期タイマ33のサーボ制御周期や開始タイミングを変更できるサーボ制御周期設定器32に対し、プロセッサ13とサーボ3,4とを同期させるための上記サーボ同期周期と同じ時間長のサーボ制御周期及び開始タイミングをサーボ通信バス2を介して設定すると共に、サーボ同期周期設定器121に対し、プロセッサ13とサーボ同期周期割り込み発生器123とを同期させるためのサーボ同期周期及び開始タイミングをサーボ通信バス2を介して設定する同期周期設定指令部137とをさらに備えている。   Particularly in this embodiment, in order for the numerical controller 1 to periodically perform synchronous communication between the servos 3 and 4 and the processor 13, the servo communication bus 2 connected to the servos 3 and 4 and the processor 13 The first communication interface 14 for performing input / output control, the servo synchronization period and phase of the servo synchronization period timer 122, that is, the servo synchronization period setting unit 121 that can change the start timing, the servo communication bus 2, and the servo synchronization period setting Servo control cycle setting unit 32 that can change the servo control cycle and start timing of servo control cycle timer 33 that generates the operation timing of second communication interface 15 and servos 3 and 4 for performing input / output control with device 121. On the other hand, the same length of time as the servo synchronization period for synchronizing the processor 13 and the servos 3 and 4 is used. The servo control cycle and start timing are set via the servo communication bus 2 and the servo synchronization cycle and start timing for synchronizing the processor 13 and the servo synchronization cycle interrupt generator 123 to the servo synchronization cycle setter 121 are set. A synchronization cycle setting command unit 137 that is set via the servo communication bus 2 is further provided.

サーボ同期周期割り込み発生器123による第2割り込み要求と第3割り込み要求との同期を、サーボ通信バス2を通じて確実に設定することができる。   The synchronization between the second interrupt request and the third interrupt request by the servo synchronization period interrupt generator 123 can be reliably set through the servo communication bus 2.

サーボ同期周期設定器121とサーボ制御周期設定器32が、自身のタイマに対し周期や開始タイミングを変更可能な同一ないし類似のハードウェアを利用できる。通常、数値制御装置に備わっているサーボ制御周期設定器32に対しての同期周期設定指令部137が、サーボ同期周期設定器121に対しても利用している点で、ソフトウェアが肥大化しない。   The servo synchronization period setting unit 121 and the servo control period setting unit 32 can use the same or similar hardware capable of changing the period and the start timing for its own timer. Usually, the software does not bloat in that the synchronization cycle setting command unit 137 for the servo control cycle setting device 32 provided in the numerical control device is also used for the servo synchronization cycle setting device 121.

本実施形態において、プロセッサ13がサーボ同期用割り込み回路12及び各サーボ3,4との間でデータを送受するサーボ通信バス2のネットワーク形態は、上記図5に示すようにプロセッサ13から各機器に対して個別に送受する形態となっている。本発明はこれに限られず、例えば図8に示すようにプロセッサ13と各機器とをリングネットワークの形態で接続してもよい。この場合には、プロセッサ13が一つに繋がったサーボ制御指令のパケットを送信し、各機器が当該一つの繋がったパケット内から必要な指令データのみを取り合い、かつ、一連の繋がったパケットに必要な返信データを書き足して次のリングネットワーク先へ送信する構成となる。この構成では、上記図4のフローにおけるステップS25とステップS30の手順での計算方法も適宜変更する必要がある。   In the present embodiment, the network form of the servo communication bus 2 in which the processor 13 sends and receives data to and from the servo synchronization interrupt circuit 12 and each of the servos 3 and 4 is as shown in FIG. On the other hand, it is a form to send and receive individually. The present invention is not limited to this, and for example, as shown in FIG. 8, the processor 13 and each device may be connected in the form of a ring network. In this case, the processor 13 transmits a packet of servo control commands connected to one, and each device takes only necessary command data from the one connected packet and is necessary for a series of connected packets. The reply data is added and transmitted to the next ring network destination. In this configuration, the calculation method in steps S25 and S30 in the flow of FIG. 4 needs to be appropriately changed.

この実施形態では特に、プロセッサ13に対する一連の繋がったパケットを必ず最後にサーボ同期用回路12がプロセッサ13へ送信することから、サーボ同期用回路12がプロセッサ13のサーボ応答受信タイミングを自身の送信タイミングから把握でき、サーボ同期周期割り込み発生器123は、複数の等分割区間のうちサーボ通信バス2の混雑区間を自動的に避けて、プロセッサ13に対し第3割り込み要求を発生させることができる。プロセッサ13の負担を増大させることなく、プロセッサ13の処理のうちの一定割合を周辺機器の制御処理に対し安定的に配分することができる。   Particularly in this embodiment, since the servo synchronization circuit 12 always transmits a series of connected packets to the processor 13 to the processor 13 last, the servo synchronization circuit 12 determines the servo response reception timing of the processor 13 as its transmission timing. The servo synchronization period interrupt generator 123 can automatically avoid the congested section of the servo communication bus 2 among a plurality of equally divided sections and generate a third interrupt request to the processor 13. Without increasing the load on the processor 13, it is possible to stably distribute a certain proportion of the processing of the processor 13 to the control processing of the peripheral devices.

1 数値制御装置
2 サーボ通信バス
3,4 サーボ(サーボモータ)
11 システム制御用割り込み回路
12 サーボ同期用割り込み回路
13 プロセッサ(演算手段)
14 第1通信インターフェース(第1通信インターフェース手段)
15 第2通信インターフェース(第2通信インターフェース手段)
31 サーボ通信インターフェース
32 サーボ制御周期設定器(サーボタイマ設定手段)
33 サーボ制御周期タイマ(サーボタイマ)
34 サーボ制御器
111 システム制御周期タイマ(第1タイマ)
112 システム制御周期割り込み発生器(第1割り込み発生手段)
121 サーボ同期周期設定器(第2タイマ設定手段)
122 サーボ同期周期タイマ(第2タイマ)
123 サーボ同期周期割り込み発生器(第2割り込み発生手段、第3割り込み発生手段)
123a タイマ周期分割器(分割手段)
131 リアルタイムOSスケジューラ
132 通常処理部
133 割り込みスケジューラ
134 周辺機器処理部
135 サーボ指令生成部
136 サーボ送受信処理部
137 同期周期設定指令部(タイマ設定手段)
1 Numerical control device 2 Servo communication bus 3, 4 Servo (servo motor)
11 Interrupt circuit for system control 12 Interrupt circuit for servo synchronization 13 Processor (calculation means)
14 First communication interface (first communication interface means)
15 Second communication interface (second communication interface means)
31 Servo communication interface 32 Servo control cycle setting device (servo timer setting means)
33 Servo control cycle timer (servo timer)
34 Servo controller 111 System control cycle timer (first timer)
112 System control cycle interrupt generator (first interrupt generation means)
121 Servo synchronization cycle setting device (second timer setting means)
122 Servo synchronization cycle timer (second timer)
123 Servo synchronization period interrupt generator (second interrupt generating means, third interrupt generating means)
123a Timer period divider (dividing means)
131 Real-time OS scheduler 132 Normal processing unit 133 Interrupt scheduler 134 Peripheral device processing unit 135 Servo command generation unit 136 Servo transmission / reception processing unit 137 Synchronization cycle setting command unit (timer setting means)

Claims (6)

工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御する数値制御装置であって、
演算手段と、
第1タイマと、
前記第1タイマの計時における所定の周期で、前記演算手段に対し、当該演算手段の動作クロックの周期に応じた第1割り込みを発生させる第1割り込み発生手段と、
第1タイマとは異なる第2タイマと、
前記第2タイマの計時における所定の周期で、前記演算手段に対し、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる第2割り込み発生手段と、
前記第2割り込み発生手段による前記第2割り込みの周期を所定の複数の区間に分割する分割手段と、
前記分割手段により分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる第3割り込み発生手段と
を有することを特徴とする数値制御装置。
A machine tool main body provided with a servo motor for moving a tool or a workpiece, and a numerical control device for controlling a plurality of operations related to predetermined peripheral devices related to the machine tool main body by multitasking,
Computing means;
A first timer;
First interrupt generation means for generating a first interrupt corresponding to the period of the operation clock of the calculation means at a predetermined cycle when the first timer counts;
A second timer different from the first timer;
Second interrupt generating means for generating a second interrupt for transmitting / receiving servo data to / from the servo motor with respect to the calculating means at a predetermined cycle when the second timer counts;
Dividing means for dividing the period of the second interrupt by the second interrupt generating means into a plurality of predetermined sections;
And a third interrupt generation means for causing the arithmetic means to generate a third interrupt for controlling the peripheral device at the start of a predetermined section among the plurality of sections divided by the dividing means. Characteristic numerical control device.
請求項1記載の数値制御装置において、
前記第2割り込み発生手段は、
前記第1割り込み発生手段が発生させる前記第1割り込みの周期よりも短い周期で、前記第2割り込みを発生させる
ことを特徴とする数値制御装置。
The numerical control device according to claim 1,
The second interrupt generation means includes
The numerical controller according to claim 1, wherein the second interrupt is generated in a cycle shorter than a cycle of the first interrupt generated by the first interrupt generation unit.
請求項1又は請求項2記載の数値制御装置において、
前記サーボモータと前記演算手段との間で定期的に同期通信を行うために、当該サーボモータへ接続されたサーボ通信バスと前記演算手段との入出力制御を行うための第1通信インターフェース手段と、
前記第2タイマの周期やタイミングを変更可能できる第2タイマ設定手段と、
前記サーボ通信バスと前記第2タイマ設定手段との入出力制御を行うための、第2通信インターフェース手段と、
前記サーボモータの動作タイミングを発生させるサーボタイマの周期やタイミングを変更できるサーボタイマ設定手段に対し、前記演算手段と前記サーボモータとを同期させるための周期及びタイミングを前記サーボ通信バスを介して設定すると共に、前記第2タイマ設定手段に対し、前記演算手段と前記第2割り込み発生手段及び前記第3割り込み発生手段とを同期させるための周期及びタイミングを前記サーボ通信バスを介して設定するタイマ設定手段と
をさらに備えることを特徴とする数値制御装置。
In the numerical control device according to claim 1 or 2,
A first communication interface means for performing input / output control between the servo communication bus connected to the servo motor and the calculation means in order to perform synchronous communication periodically between the servo motor and the calculation means; ,
Second timer setting means capable of changing the cycle and timing of the second timer;
Second communication interface means for performing input / output control between the servo communication bus and the second timer setting means;
For the servo timer setting means that can change the period and timing of the servo timer that generates the operation timing of the servo motor, the period and timing for synchronizing the arithmetic means and the servo motor are set via the servo communication bus. Timer setting means for setting, via the servo communication bus, a cycle and timing for synchronizing the arithmetic means with the second interrupt generating means and the third interrupt generating means with respect to the second timer setting means; The numerical control device further comprising:
請求項1乃至請求項3のいずれか1項記載の数値制御装置において、
前記第3割り込み発生手段は、
前記複数の区間のうち前記サーボ通信バスの混雑区間を避けて、前記演算手段に対し前記第3割り込みを発生させる
ことを特徴とする数値制御装置。
In the numerical control device according to any one of claims 1 to 3,
The third interrupt generation means includes
The numerical control apparatus, wherein the arithmetic unit generates the third interrupt while avoiding a congested section of the servo communication bus among the plurality of sections.
工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御する工作機械の制御方法であって、
所定の第1周期で、前記工作機械に備えられた演算手段の動作クロックの周期に応じた第1割り込みを発生させる手順と、
第1周期とは異なる所定の第2周期で、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる手順と、
前記第2割り込みの周期を所定の複数の区間に分割する手順と、
前記分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる手順と
を備えることを特徴とする工作機械の制御方法。
A machine tool control method for controlling a plurality of operations related to a machine tool main body provided with a servo motor for moving a tool or a workpiece and a predetermined peripheral device related to the machine tool main body by multitasking. ,
A procedure for generating a first interrupt according to a cycle of an operation clock of an arithmetic means provided in the machine tool at a predetermined first cycle;
Generating a second interrupt for transmitting / receiving servo data to / from the servo motor at a predetermined second period different from the first period;
Dividing the period of the second interrupt into a plurality of predetermined sections;
A machine tool control comprising: a step of generating a third interrupt for controlling the peripheral device to the computing means at a start of a predetermined section among the plurality of divided sections. Method.
工具又はワークを移動させるためのサーボモータを備えた工作機械本体、及び、前記工作機械本体に係わる所定の周辺機器に係わる、複数の動作を、マルチタスクで制御するための工作機械の制御プログラムであって、
コンピュータに、
所定の第1周期で、前記工作機械に備えられた演算手段の動作クロックの周期に応じた第1割り込みを発生させる手順と、
第1周期とは異なる所定の第2周期で、前記サーボモータとのサーボデータ送受信用の第2割り込みを発生させる手順と、
前記第2割り込みの周期を所定の複数の区間に分割する手順と、
前記分割された前記複数の区間のうち所定の区間の開始時に、前記演算手段に対し、前記周辺機器を制御するための第3割り込みを発生させる手順と
を実行させることを特徴とする工作機械の制御プログラム。
A machine tool control program for controlling a plurality of operations related to a machine tool main body having a servo motor for moving a tool or a workpiece and a predetermined peripheral device related to the machine tool main body in a multitasking manner. There,
On the computer,
A procedure for generating a first interrupt according to a cycle of an operation clock of an arithmetic means provided in the machine tool at a predetermined first cycle;
Generating a second interrupt for transmitting / receiving servo data to / from the servo motor at a predetermined second period different from the first period;
Dividing the period of the second interrupt into a plurality of predetermined sections;
A step of causing the arithmetic means to generate a third interrupt for controlling the peripheral device at the start of a predetermined section of the plurality of divided sections. Control program.
JP2009251076A 2009-10-30 2009-10-30 Numerical control device, method of controlling machine tool, and control program of the machine tool Pending JP2011096114A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009251076A JP2011096114A (en) 2009-10-30 2009-10-30 Numerical control device, method of controlling machine tool, and control program of the machine tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009251076A JP2011096114A (en) 2009-10-30 2009-10-30 Numerical control device, method of controlling machine tool, and control program of the machine tool

Publications (1)

Publication Number Publication Date
JP2011096114A true JP2011096114A (en) 2011-05-12

Family

ID=44112928

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009251076A Pending JP2011096114A (en) 2009-10-30 2009-10-30 Numerical control device, method of controlling machine tool, and control program of the machine tool

Country Status (1)

Country Link
JP (1) JP2011096114A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020060962A (en) * 2018-10-10 2020-04-16 東洋電機製造株式会社 Control arithmetic operation unit and control system
JP2020061015A (en) * 2018-10-11 2020-04-16 ファナック株式会社 Numerical control device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04195205A (en) * 1990-11-22 1992-07-15 Fanuc Ltd Program executing system for cnc device
JPH103307A (en) * 1996-06-17 1998-01-06 Fanuc Ltd Numerical controller
JP2004206511A (en) * 2002-12-26 2004-07-22 Fanuc Ltd Numerical control device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04195205A (en) * 1990-11-22 1992-07-15 Fanuc Ltd Program executing system for cnc device
JPH103307A (en) * 1996-06-17 1998-01-06 Fanuc Ltd Numerical controller
JP2004206511A (en) * 2002-12-26 2004-07-22 Fanuc Ltd Numerical control device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020060962A (en) * 2018-10-10 2020-04-16 東洋電機製造株式会社 Control arithmetic operation unit and control system
JP2020061015A (en) * 2018-10-11 2020-04-16 ファナック株式会社 Numerical control device
US11287797B2 (en) 2018-10-11 2022-03-29 Fanuc Corporation Numerical control device

Similar Documents

Publication Publication Date Title
US8190941B2 (en) Field control system
US7343437B2 (en) Synchronization method and control system for the time synchronization of slave units and a synchronizable slave unit
JP4973792B1 (en) Arithmetic unit, output control method, and program
EP3076293A2 (en) Control apparatus
KR101618537B1 (en) Communication device, communication system, and synchronous control method
EP3026515A1 (en) Programmable controller system and controller therefor
US9319237B2 (en) Method and device for controlling a bus system and a corresponding bus system
JP2007140655A (en) Motion controller
CN108398916B (en) Control system and pulse output device
JP4241343B2 (en) Transmission timing determination method, bus usage right arbitration method, network system, program
JP2019101480A (en) Control device and control method
EP3940998A1 (en) Control system, apparatus, and control method
JP2006350768A (en) Motion control system
JP2011096114A (en) Numerical control device, method of controlling machine tool, and control program of the machine tool
US9677920B2 (en) Automation device and method for reducing jitter
KR101558084B1 (en) Plc system having a plurality of cpu modules and control method thereof
JP4961589B2 (en) Network system and slave synchronization method
JP6429842B2 (en) Control cycle independent allocation method for each axis in PLC position determination system
JP5067670B2 (en) Machine controller system
JP5837146B1 (en) Numerical control system with reduced external input signal capture time
JP2007050812A (en) Load control system, communication control unit and load control method
JP5763961B2 (en) COMMUNICATION DEVICE, COMMUNICATION SYSTEM, COMMUNICATION DEVICE CONTROL METHOD, AND PROGRAM
JP2019133206A (en) Motor drive system, motor control system and mobile robot
TWI735401B (en) Communication device, communication system, communication method and program
JP5540928B2 (en) Programmable controller system and application startup method thereof

Legal Events

Date Code Title Description
A621 Written request for application examination

Effective date: 20120215

Free format text: JAPANESE INTERMEDIATE CODE: A621

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130327

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130327

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20130802