JP6075234B2 - Measuring method and computer apparatus - Google Patents

Measuring method and computer apparatus Download PDF

Info

Publication number
JP6075234B2
JP6075234B2 JP2013146321A JP2013146321A JP6075234B2 JP 6075234 B2 JP6075234 B2 JP 6075234B2 JP 2013146321 A JP2013146321 A JP 2013146321A JP 2013146321 A JP2013146321 A JP 2013146321A JP 6075234 B2 JP6075234 B2 JP 6075234B2
Authority
JP
Japan
Prior art keywords
value
measurement
timer
execution
stack
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.)
Active
Application number
JP2013146321A
Other languages
Japanese (ja)
Other versions
JP2015018475A (en
Inventor
鈴木 哲雄
哲雄 鈴木
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co 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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP2013146321A priority Critical patent/JP6075234B2/en
Publication of JP2015018475A publication Critical patent/JP2015018475A/en
Application granted granted Critical
Publication of JP6075234B2 publication Critical patent/JP6075234B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

この発明は、コンピュータ装置におけるプログラムの実行時間の計測技術に関する。   The present invention relates to a technique for measuring the execution time of a program in a computer apparatus.

近年、電気自動車が急速に普及しつつある。電気自動車には動力源として三相交流電動機などの電動機が搭載されているとともに、電動機の駆動制御を行うインバータなどの駆動装置と、駆動装置と通信しその制御を行う制御装置が搭載されている。制御装置は、駆動装置に与えるトルク指令等の各種指令値(例えば、x[Nm]など出力トルクの物理量を示す値)を運転者の操作に応じて生成する。駆動装置は、電動機に与える交流電力を制御装置から与えられた指令値に応じて調整する。これにより、電気自動車の走行制御が実現される。また、制御装置は、上記信号線を介して駆動装置のメモリに格納されている各種データ(例えば、出力トルクや回転速度(単位時間当たりの回転数)などの現在値を表すデータ)を取得し、それらデータに基づいて各種メータ類の表示制御を行う処理も実行する。これにより、車両の状態を運転者に把握させることができる。   In recent years, electric vehicles have been rapidly spreading. An electric vehicle is equipped with a motor such as a three-phase AC motor as a power source, and a drive device such as an inverter that controls the drive of the motor, and a control device that communicates with and controls the drive device. . The control device generates various command values such as a torque command given to the drive device (for example, a value indicating a physical quantity of output torque such as x [Nm]) according to the operation of the driver. The drive device adjusts the AC power supplied to the electric motor according to the command value given from the control device. Thereby, traveling control of the electric vehicle is realized. Further, the control device acquires various data (for example, data representing current values such as output torque and rotational speed (the number of revolutions per unit time)) stored in the memory of the driving device via the signal line. Also, processing for performing display control of various meters based on these data is also executed. Thereby, a driver | operator can be made to grasp | ascertain the state of a vehicle.

電動機へ与える電力を制御装置から与えられる指令値に応じて調整する処理は、駆動装置に予めインストールされた制御プログラムにしたがってその駆動装置のCPU(Central Processing Unit:以下、制御部)を作動させることで実現される。制御プログラムの開発工程では、当該処理の実行時間(換言すれば、制御部によるプログラムの実行時間)が要求仕様に応じて定まる時間内に収まっているか否かの検証が行われる。このような実行時間の計測は、ハードウェアタイマを使用して行われることが一般的である。制御プログラムにしたがって上記制御部が実行する処理はタイマ割り込み等によって一定の時間間隔で周期的に実行される定周期処理と、不定期に発生する割り込みによって実行される不定期処理とに大別される。優先度の高い他の処理の割り込みが発生する場合、当該他の処理の実行時間をハードウェアタイマによる計測時間から差し引かなければ、割り込まれた処理の正確な実行時間を計測することはできない。そこで、プログラムの実行時間を正確に計測することを可能にする技術が種々提案されており、その一例としては「スタック方式」と呼ばれる計測方法が挙げられる(特許文献1参照)。   The process of adjusting the electric power supplied to the electric motor according to the command value given from the control device is to operate a CPU (Central Processing Unit: hereinafter, control unit) of the drive device according to a control program installed in the drive device in advance. It is realized with. In the control program development process, it is verified whether or not the execution time of the processing (in other words, the execution time of the program by the control unit) is within a time determined according to the required specifications. Such measurement of the execution time is generally performed using a hardware timer. The processing executed by the control unit according to the control program is roughly divided into fixed-cycle processing that is periodically executed at regular time intervals by a timer interrupt or the like, and irregular processing that is executed by an interrupt that occurs irregularly. The When an interrupt of another process with a high priority occurs, the exact execution time of the interrupted process cannot be measured unless the execution time of the other process is subtracted from the time measured by the hardware timer. Various techniques have been proposed that make it possible to accurately measure the execution time of a program. One example is a measurement method called a “stack method” (see Patent Document 1).

特開2003−288237号公報JP 2003-288237 A

ところで、駆動装置における制御プログラムの実行過程では、数10マイクロ秒間隔といった短い時間間隔で割り込みが発生する。このような高速割り込みにより動作している装置では、従来のスタック方式によりプログラムの実行時間を計測したとしても、正確に計測することは難しい。従来のスタック方式では計測処理に要する時間が考慮されていない一方、高速割り込みにより動作する装置では割り込みマスクや符号付きの演算を行う関係上、計測処理に要する時間を無視できないからである。   By the way, in the execution process of the control program in the driving device, an interrupt occurs at a short time interval such as an interval of several tens of microseconds. In an apparatus operating by such a high-speed interrupt, even if the execution time of the program is measured by the conventional stack method, it is difficult to measure accurately. This is because the time required for the measurement process is not considered in the conventional stack method, but the time required for the measurement process cannot be ignored because an apparatus that operates with a high-speed interrupt performs an interrupt mask or a signed operation.

本発明は以上に説明した課題に鑑みて為されたものであり、高速割り込みにより動作する装置において実行される処理の実行時間を正確に計測することを可能にする技術を提供することを目的とする。   The present invention has been made in view of the above-described problems, and an object thereof is to provide a technique that makes it possible to accurately measure the execution time of a process executed in a device that operates by a high-speed interrupt. To do.

上記課題を解決するために本発明は、各々割り込みにより実行されるとともに各々割り込みの優先度が予め定められた複数の処理を制御部に実行させる場合における各処理の実行時間をフリーランタイマとスタックとを用いて計測する計測方法であって、以下の計測開始処理と計測終了処理とを含む計測方法を提供する。計測開始処理は、各処理の実行開始に先立って実行される処理である。この計測開始処理では、制御部は、フリーランタイマのタイマ値を読み込み、当該計測開始処理に後続する処理によって実行を中断される他の処理がない場合には当該読み込んだタイマ値をスタックへプッシュする一方、実行を中断される他の処理がある場合には当該タイマ値とスタックの最上段に格納されているタイマ値との差から予め定められた第1の補正値を減算して当該他の処理のそれまでの実行時間を表す値を算出して記憶装置に記憶させた後に、当該読み込んだタイマ値をスタックへプッシュする。計測終了処理は、各処理の実行終了を契機として実行される。この計測終了処理では、制御部は、フリーランタイマのタイマ値を読み込み、当該タイマ値と前記スタックの最上段の格納内容と当該実行を終了する処理のそれまでの実行時間を表すものとして記憶装置に記憶されている値とから算出される値を予め定められた第2の補正値を用いて補正し、当該実行を終了する処理の実行時間を算出する。   In order to solve the above problems, the present invention relates to a free-run timer and a stack of execution times of each process when the control unit executes a plurality of processes each of which is executed by an interrupt and whose priority of each interrupt is predetermined. And a measurement method including the following measurement start process and measurement end process. The measurement start process is a process executed prior to the start of execution of each process. In this measurement start process, the control unit reads the timer value of the free-run timer, and pushes the read timer value onto the stack when there is no other process interrupted by the process following the measurement start process. On the other hand, when there is other processing whose execution is interrupted, the predetermined first correction value is subtracted from the difference between the timer value and the timer value stored in the top level of the stack. After calculating a value representing the execution time until this processing and storing it in the storage device, the read timer value is pushed onto the stack. The measurement end process is executed when the execution of each process ends. In this measurement end process, the control unit reads the timer value of the free-run timer, and stores the timer value, the stored contents of the uppermost stage of the stack, and the execution time until the end of the process. A value calculated from the value stored in is corrected using a predetermined second correction value, and the execution time of the process for ending the execution is calculated.

ここで、第1の補正値は、割り込み発生から計測開始処理におけるタイマ値の読み込みまでの第1の所要時間と計測終了処理におけるタイマ値の読み込みから割り込み終了までの第2の所要時間との和に応じた値であり、第2の補正値は、計測開始処理におけるタイマ値の読み込みから当該計測開始処理の実行完了までの第3の所要時間と計測終了処理の実行開始から当該計測終了処理におけるタイマ値の読み込みまでの第4の所要時間との和に応じた値である。本発明の計測方法によれば、上記第1および第2の補正値の減算による補正を施すことで実行時間の計測に要する時間を差し引き、各処理の実行時間を他の処理によって実行が中断されるか否かを問わずに正確に計測することが可能になる。なお、スタックへフリーランタイマのタイマ値をプッシュする際には、特許文献1に開示の技術と同様に符号反転を行ってプッシュするようにしても良い。また、実行を中断される処理のそれまでの実行時間を表す値の格納先となる記憶装置はスタックとは別個のものであっても良いし、スタックに当該役割を兼ねさせても良い。   Here, the first correction value is the sum of the first required time from the occurrence of an interrupt to the reading of the timer value in the measurement start process and the second required time from the reading of the timer value in the measurement end process to the end of the interrupt. The second correction value is a third required time from the reading of the timer value in the measurement start process to the completion of execution of the measurement start process, and from the start of execution of the measurement end process to the measurement end process. This is a value corresponding to the sum of the fourth required time until the timer value is read. According to the measurement method of the present invention, the time required for measuring the execution time is subtracted by performing correction by subtracting the first and second correction values, and the execution time of each process is interrupted by other processes. It becomes possible to measure accurately regardless of whether or not. When pushing the timer value of the free-run timer to the stack, the sign may be inverted and pushed in the same manner as the technique disclosed in Patent Document 1. Further, the storage device that stores the value representing the execution time until the process whose execution is interrupted may be a separate storage device from the stack, or the stack may also play the role.

より好ましい態様においては、第1および第2の補正値は制御部の種類または仕様に応じて定められた値であるととともに、第1の補正値は計測開始処理に後続する処理の優先度に応じて定められた値である。このような態様によれば、各々優先度の異なる処理の実行時間をより正確に計測することが可能になる。   In a more preferred aspect, the first and second correction values are values determined according to the type or specification of the control unit, and the first correction value is set to the priority of the process subsequent to the measurement start process. It is a value determined accordingly. According to such an aspect, it is possible to more accurately measure the execution time of processes having different priorities.

また、上記課題を解決するために本発明は、各々割り込みにより実行されるとともに各々割り込みの優先度が予め定められた複数の処理を実行する制御部と、フリーランタイマと、スタック、とを備え、フリーランタイマとスタックとを用いて各処理の実行時間を計測する処理を上記制御部に実行させるとともに、上記計測開始処理と計測終了処理とを上記制御部に実行させることを特徴とするコンピュータ装置を提供する。このような態様によっても上記複数の処理の各々の実行時間を正確に計測することが可能になる。また、本発明の別の態様としては上記計測開始処理と計測終了処理とを上記制御部に実行させるプログラムを上記コンピュータ装置用のソフトウェアライブラリとして提供する態様が考えられる。このようなソフトウェアライブラリの具体的な提供態様としては、CD−ROM(Compact Disk-Read Only Memory)などのコンピュータ読み取り可能な記録媒体に書き込んで配布する態様やインターネットなどの電気通信回線経由のダウンロードにより配布する態様が考えられる。このようにして配布されるプログラムにしたがって一般的なコンピュータ装置の制御部を作動させることで当該コンピュータ装置において割り込みにより実行される各処理の実行時間を、本発明の計測方法により、従来よりも正確に計測することが可能になる。   In order to solve the above-described problem, the present invention includes a control unit that executes a plurality of processes each of which is executed by an interrupt and has a predetermined priority of each interrupt, a free-run timer, and a stack. A computer that causes the control unit to execute a process of measuring the execution time of each process using a free-run timer and a stack, and causes the control unit to execute the measurement start process and the measurement end process Providing equipment. Even in such an aspect, it is possible to accurately measure the execution time of each of the plurality of processes. Further, as another aspect of the present invention, an aspect in which a program for causing the control unit to execute the measurement start process and the measurement end process is provided as a software library for the computer apparatus can be considered. As a specific manner of providing such a software library, it is possible to write it on a computer-readable recording medium such as a CD-ROM (Compact Disk-Read Only Memory) and distribute it or download it via a telecommunication line such as the Internet. A distribution mode is conceivable. By operating the control unit of a general computer device in accordance with the program distributed in this way, the execution time of each process executed by the interrupt in the computer device can be accurately determined by the measurement method of the present invention. It becomes possible to measure.

より好ましい態様においては、上記コンピュータ装置はデータの書き換えが可能な不揮発性メモリを有し、前記第1および第2の補正値は前記制御部の種類に応じて予め定められているとともに、前記不揮発性メモリには、前記第1の処理の優先度に応じて定められた前記第1の補正値と、前記第2の処理の優先度に応じて定められた前記第2の補正値とが格納されることを特徴とする。   In a more preferred aspect, the computer device includes a nonvolatile memory capable of rewriting data, and the first and second correction values are predetermined according to the type of the control unit and the nonvolatile memory The memory stores the first correction value determined according to the priority of the first process and the second correction value determined according to the priority of the second process. It is characterized by being.

本発明の制御装置の一実施形態の駆動装置20を含む試験システム1の構成例を示す図である。It is a figure which shows the structural example of the test system 1 containing the drive device 20 of one Embodiment of the control apparatus of this invention. 同駆動装置20の構成例を示す図である。2 is a diagram illustrating a configuration example of the drive device 20. FIG. 同駆動装置20における実行時間計測を説明するための図である。FIG. 6 is a diagram for explaining execution time measurement in the drive device 20.

以下、図面を参照しつつ本発明の実施形態を説明する。
(A:構成)
図1は、本発明の計測方法により制御プログラムの実行時間を計測する機能を備えた駆動装置20を含む試験システム1の構成例を示す図である。駆動装置20は例えばインバータであり、電動機30とともに電気自動車に搭載される。試験システム1は、駆動装置20の保守点検や開発工程における各種試験を行うためのものである。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
(A: Configuration)
FIG. 1 is a diagram illustrating a configuration example of a test system 1 including a drive device 20 having a function of measuring the execution time of a control program by the measurement method of the present invention. The drive device 20 is an inverter, for example, and is mounted on the electric vehicle together with the electric motor 30. The test system 1 is for carrying out maintenance and inspection of the drive device 20 and various tests in the development process.

図1に示すように、試験システム1は、試験対象の駆動装置20および電動機30の他に、ツイストペアケーブルなどの信号線を介して駆動装置20に接続される試験装置10を含んでいる。試験装置10は、例えばパーソナルコンピュータであり、当該信号線を介して各種指令Mを駆動装置20に与える。本実施形態では、試験装置10から駆動装置20へ与える指令Mに応じて電動機30の動作にどのような変化が生じるのかを観察したり、駆動装置20から返信されてくるデータDを試験装置10を用いて確認したりすることで駆動装置20の試験が進められる。   As shown in FIG. 1, the test system 1 includes a test apparatus 10 connected to the drive apparatus 20 via a signal line such as a twisted pair cable in addition to the drive apparatus 20 and the electric motor 30 to be tested. The test apparatus 10 is a personal computer, for example, and gives various commands M to the drive apparatus 20 via the signal line. In the present embodiment, the change in the operation of the electric motor 30 is observed according to the command M given from the test apparatus 10 to the drive apparatus 20, and the data D returned from the drive apparatus 20 is used as the test apparatus 10. The test of the drive device 20 is advanced by confirming using

駆動装置20は、車載電池などの直流電源(図1では図示略)から供給される直流電力を交流電力PWに変換して電動機30に与える。駆動装置20は、予めインストールされた制御プログラムを実行する制御部(図示略)と、当該制御プログラムを実行する際のワークエリアとして使用されるメモリとを含んでいる。本実施形態では、上記制御プログラムを制御部に実行させることで、制御装置(本実施形態では試験装置10、駆動装置20および電動機30の実運用の際には車載コントローラ)から与えられる各種指令に応じて電動機30に与える交流電力PWを制御する処理が実現される。   The drive device 20 converts DC power supplied from a DC power source (not shown in FIG. 1) such as an in-vehicle battery into AC power PW and supplies the AC power PW to the motor 30. The drive device 20 includes a control unit (not shown) that executes a preinstalled control program, and a memory that is used as a work area when the control program is executed. In the present embodiment, by causing the control unit to execute the control program, various commands given from the control device (in the present embodiment, the on-board controller in the actual operation of the test device 10, the drive device 20, and the electric motor 30). Accordingly, a process for controlling the AC power PW applied to the electric motor 30 is realized.

加えて、本実施形態では、前述したスタック方式の計測方法を上記制御部に実行させることで上記制御プログラムにしたがって実行される各種処理の実行時間を計測することができるとともに、その計測方法を工夫することで従来よりも正確に実行時間を計測することが可能となっている。以下、本実施形態の特徴を顕著に示す駆動装置20を中心に説明する。   In addition, in the present embodiment, the execution time of various processes executed according to the control program can be measured by causing the control unit to execute the stack method, and the measurement method is devised. This makes it possible to measure the execution time more accurately than in the past. Hereinafter, the driving device 20 that remarkably shows the features of the present embodiment will be mainly described.

図2は、駆動装置20の構成例を示す図である。図2に示すように駆動装置20は、制御部110、通信インターフェース(図2では、「I/F」と略記、以下、本明細書においても同様)部120、電力変換部130、フリーランタイマ140、記憶部150、およびこれら構成要素間のデータ授受を仲介するバス160を含んでいる。   FIG. 2 is a diagram illustrating a configuration example of the driving device 20. As shown in FIG. 2, the driving device 20 includes a control unit 110, a communication interface (abbreviated as “I / F” in FIG. 2, hereinafter the same in this specification) unit 120, a power conversion unit 130, a free-run timer. 140, a storage unit 150, and a bus 160 that mediates data exchange between these components.

制御部110は例えばCPUである。制御部110は記憶部150(より正確には不揮発性記憶部154)に記憶されているプログラムを実行することにより駆動装置20の制御中枢として機能する。制御部110が上記プログラムにしたがって実行する処理については後に明らかにする。   The control unit 110 is a CPU, for example. The control unit 110 functions as a control center of the drive device 20 by executing a program stored in the storage unit 150 (more precisely, the nonvolatile storage unit 154). The processing executed by the control unit 110 according to the program will be clarified later.

通信I/F部120は例えばNIC(Network Interface Card)であり、通信線を介して試験装置10に接続されている。通信I/F部120は上記通信線を介して試験装置10から送られている各種指令Mを受信して制御部110に与える一方、制御部110から与えられた各種データDを上記通信線を介して試験装置10へ送信する。電力変換部130は前述した直流電源と電動機30とに接続されている。電力変換部130は、IGBTなどのスイッチング素子を含んでおり(図2では図示略)、当該スイッチング素子のスイッチング(オン/オフの切り替え)により、直流電源から供給される直流電力を交流電力PWに変換して電動機30に与える。電力変換部130に含まれるスイッチング素子のオン/オフ制御は制御部110によって行われる。フリーランタイマ140は、ハードウェアタイマであり、前述したスタック方式の実行時間計測に用いられる。   The communication I / F unit 120 is, for example, a NIC (Network Interface Card), and is connected to the test apparatus 10 via a communication line. The communication I / F unit 120 receives various commands M sent from the test apparatus 10 via the communication line and gives them to the control unit 110, while sending various data D given from the control unit 110 to the communication line. To the test apparatus 10. The power conversion unit 130 is connected to the DC power source and the motor 30 described above. The power conversion unit 130 includes a switching element such as an IGBT (not shown in FIG. 2). By switching the switching element (on / off switching), the DC power supplied from the DC power source is changed to the AC power PW. It converts and gives to the electric motor 30. On / off control of switching elements included in the power conversion unit 130 is performed by the control unit 110. The free-run timer 140 is a hardware timer and is used for the execution time measurement of the stack method described above.

記憶部150は揮発性記憶部152と不揮発性記憶部154とを含んでいる。揮発性記憶部152は例えばRAM(Random Access Memory)である。揮発性記憶部152は各種プログラムを実行する際のワークエリアとして制御部110によって利用される。また、揮発性記憶部152は上記スタック方式の実行時間計測を行う際のスタックとしても利用され、さらに制御プログラムにしたがって実行される電動機30の制御のための各種処理の実行時間を表すデータも格納される。不揮発性記憶部154は例えばハードディスクやEEPROM(Electrically Erasable Programmable Read-Only Memory)などデータの書き換えが可能な不揮発性メモリである。図2に示すように不揮発性記憶部154には、前述した制御プログラムの役割を果たすソフトウェアライブラリ(通信制御ライブラリ1542、電力変換部制御ライブラリ1544、および計測支援ライブラリ1546)が予め格納されている。   The storage unit 150 includes a volatile storage unit 152 and a nonvolatile storage unit 154. The volatile storage unit 152 is, for example, a RAM (Random Access Memory). The volatile storage unit 152 is used by the control unit 110 as a work area when executing various programs. The volatile storage unit 152 is also used as a stack when performing the execution time measurement of the above-described stack method, and also stores data representing the execution time of various processes for controlling the electric motor 30 executed according to the control program. Is done. The nonvolatile storage unit 154 is a nonvolatile memory that can rewrite data, such as a hard disk or an EEPROM (Electrically Erasable Programmable Read-Only Memory). As shown in FIG. 2, a software library (communication control library 1542, power conversion unit control library 1544, and measurement support library 1546) that plays the role of the above-described control program is stored in advance in the nonvolatile storage unit 154.

通信制御ライブラリ1542は、試験装置10と通信する処理(すなわち、各種指令Mの受信および各種データDの送信)を制御部110に実現させるためのプログラムの集合体である。電力変換部制御ライブラリ1544は、試験装置10から与えられる各種指令Mに応じて電力変換部130の作動制御を行う処理を制御部110に実行させるためのプログラムの集合体である。通信制御ライブラリ1542は、駆動装置20を組み込んで電気自動車を製造するメーカ等によってその電気自動車に搭載される車載ネットワークの仕様に応じて作成される。つまり、通信制御ライブラリ1542に含まれる各プログラムは、制御部110を、駆動装置20が搭載される電機自動車の車載ネットワーク毎に適宜カスタマイズされたカスタマイズ部として機能させるプログラムである。これに対して、電力変換部制御ライブラリ1544は、駆動装置20の製造元により作成される。電力変換部制御ライブラリ1544に含まれる各プログラムは、制御部110を、電力変換部130の作動制御を実現するコア部として機能させるプログラムである。   The communication control library 1542 is a collection of programs for causing the control unit 110 to realize processing for communicating with the test apparatus 10 (that is, reception of various commands M and transmission of various data D). The power conversion unit control library 1544 is a collection of programs for causing the control unit 110 to execute processing for controlling the operation of the power conversion unit 130 in accordance with various commands M given from the test apparatus 10. The communication control library 1542 is created according to the specifications of the in-vehicle network mounted on the electric vehicle by a manufacturer or the like that manufactures the electric vehicle by incorporating the drive device 20. That is, each program included in the communication control library 1542 is a program that causes the control unit 110 to function as a customization unit that is appropriately customized for each in-vehicle network of the electric vehicle on which the drive device 20 is mounted. In contrast, the power conversion unit control library 1544 is created by the manufacturer of the drive device 20. Each program included in the power conversion unit control library 1544 is a program that causes the control unit 110 to function as a core unit that realizes operation control of the power conversion unit 130.

通信制御ライブラリ1542或いは電力変換部制御ライブラリ1544に含まれるプログラムにしたがって制御部110が実行する処理は、前述した定周期処理と不定期処理とに大別される。本実施形態では、これらの処理の実行開始を指示する割り込みは数十マイクロ秒といった短い時間間隔で発生する。これらの処理には予め優先度が設定されており、定周期処理の優先度は最も低く設定されている。制御部110は、これら不定期処理および定周期処理の何れかの実行中に、当該実行中の処理よりも優先度の高い処理の実行を指示する割り込みが発生すると、実行中の処理を一旦中断し、当該優先度の高い処理を実行する。そして、当該優先度の高い処理の実行を完了すると制御部110は、実行を中断中の処理の実行を再開する。   The processing executed by the control unit 110 in accordance with a program included in the communication control library 1542 or the power conversion unit control library 1544 is roughly divided into the above-described regular cycle processing and irregular processing. In the present embodiment, an interrupt instructing the start of execution of these processes occurs at a short time interval such as several tens of microseconds. Priorities are set in advance for these processes, and the priority of the periodic processing is set to the lowest. When an interrupt instructing execution of a process having a higher priority than the currently executing process occurs during the execution of any of the irregular process and the fixed period process, the control unit 110 temporarily interrupts the executing process. Then, the process with the higher priority is executed. Then, when the execution of the process with the higher priority is completed, the control unit 110 resumes the execution of the process whose execution is suspended.

計測支援ライブラリ1546に含まれるプログラムは、通信制御ライブラリ1542或いは電力変換部制御ライブラリ1544に含まれるプログラムにしたがって実行される処理の実行時間を制御部110に計測させるためのプログラムである。なお、本実施形態では、通信制御ライブラリ1542或いは電力変換部制御ライブラリ1544に含まれるプログラムにしたがって実行される処理を実行時間の計測対象とするが、前者にしたがって実行される処理のみを実行時間の計測対象としても良い。前述したように、通信制御ライブラリ1542は、駆動装置20および電動機30の搭載される車両の製造元によって開発されるソフトウェアであり、通信制御ライブラリ1542に含まれる各プログラムの実行時間が予め定められた時間(駆動装置20の正常動作の保証という観点から駆動装置20の製造元により推奨された時間、或いは要求仕様等に応じて定まる時間)内に収まっているか否かを検証しておくことは上記車両の製造元にとって極めて重要だからである。   The program included in the measurement support library 1546 is a program for causing the control unit 110 to measure the execution time of processing executed according to the program included in the communication control library 1542 or the power conversion unit control library 1544. In the present embodiment, the processing executed according to the program included in the communication control library 1542 or the power conversion unit control library 1544 is an execution time measurement target, but only the processing executed according to the former is executed. It is good also as a measuring object. As described above, the communication control library 1542 is software developed by the manufacturer of the vehicle on which the drive device 20 and the electric motor 30 are mounted, and the execution time of each program included in the communication control library 1542 is a predetermined time. It is necessary to verify whether or not the vehicle is within the time recommended by the manufacturer of the drive device 20 from the viewpoint of guaranteeing the normal operation of the drive device 20 or the time determined according to the required specifications. This is because it is extremely important for the manufacturer.

本実施形態では、計測支援ライブラリ1546に含まれている各プログラムは、通信制御ライブラリ1542或いは電力変換部制御ライブラリ1544に含まれる各プログラムから所謂API(Application Programming Interface)として呼び出し可能なように駆動装置20に実装されている。例えば、ある処理の実行時間を計測するためには、当該処理を制御部110に実行させるプログラムの先頭に実行時間の計測を開始するための計測開始処理の実行を指示するAPI(以下、計測開始API)を呼び出すためのコードを埋め込んでおく。一方、当該プログラムの末尾には、実行時間の計測を終了するための計測終了処理の実行を指示するAPI(以下、計測終了API)を呼び出すためのコードを埋め込んでおくといった具合である。このようにすると、実行時間の計測対象の処理の実行を開始するための割り込みの発生を契機として、制御部110は、まず、計測開始処理を実行し、実行時間の計測対象の処理の実行終了を契機として計測終了処理を実行する。   In the present embodiment, each program included in the measurement support library 1546 can be called as a so-called API (Application Programming Interface) from each program included in the communication control library 1542 or the power converter control library 1544. 20 is implemented. For example, in order to measure the execution time of a certain process, an API (hereinafter referred to as measurement start) that instructs execution of a measurement start process for starting measurement of the execution time at the head of a program that causes the control unit 110 to execute the process. A code for calling (API) is embedded. On the other hand, at the end of the program, a code for calling an API (hereinafter referred to as a measurement end API) for instructing execution of a measurement end process for ending the execution time measurement is embedded. In this case, the control unit 110 first executes the measurement start process and the execution end of the process to be measured for the execution time, triggered by the occurrence of an interrupt for starting the execution of the process for the execution time measurement target. The measurement end process is executed in response to.

計測開始処理は、上記のように実行時間の計測対象の処理の実行開始に先立って実行される処理である。この計測開始処理では、制御部110は、まず、フリーランタイマ140のタイマ値を読み込む。次いで、制御部110は、当該計測開始処理に後続する処理(すなわち、実行時間の計測対象の処理)によって実行を中断される他の処理があるか否かを判定し、該当する他の処理がない場合には、読み込んだタイマ値を符号反転して揮発性記憶部152内に設けられたスタックへプッシュする。ここで、当該計測開始処理に後続する処理によって実行を中断される他の処理があるか否かについては、スタックにタイマ値が格納されているか否かに基づいて判定すれば良い。具体的には、スタックにタイマ値が格納されていれば、実行を中断される他の処理があると判定するといった具合である。また、読み込んだタイマ値を符号反転してスタックへプッシュするのは、特許文献1に開示の技術と同様の理由によるものである。   The measurement start process is a process that is executed prior to the start of execution of a process whose execution time is to be measured as described above. In this measurement start process, the control unit 110 first reads the timer value of the free-run timer 140. Next, the control unit 110 determines whether or not there is another process whose execution is interrupted by a process subsequent to the measurement start process (that is, a process subject to execution time measurement). If not, the read timer value is inverted and pushed to the stack provided in the volatile storage unit 152. Here, whether there is another process whose execution is interrupted by a process subsequent to the measurement start process may be determined based on whether a timer value is stored in the stack. Specifically, if a timer value is stored in the stack, it is determined that there is another process whose execution is interrupted. Further, the reason why the read timer value is inverted and pushed onto the stack is due to the same reason as the technique disclosed in Patent Document 1.

実行を中断される他の処理がある場合には、制御部110は、フリーランタイマ140のタイマ値と上記スタックの最上段に格納されているタイマ値との差から予め定められた第1の補正値を減算した値を当他の処理のそれまでの実行時間を表す値として算出し、上記スタックの最上段の格納内容を当該値で更新した後に、当該読み込んだタイマ値を符号反転して上記スタックへプッシュする。つまり、本実施形態の駆動装置20では、上記スタックは、優先度の高い処理の割り込みにより実行を中断される処理のそれまでの実行時間を示す値を記憶する記憶装置の役割を兼ねているのである。   When there is another process whose execution is interrupted, the control unit 110 determines the first predetermined value based on the difference between the timer value of the free-run timer 140 and the timer value stored in the top level of the stack. The value obtained by subtracting the correction value is calculated as the value representing the execution time until this processing, and the stored content at the top of the stack is updated with the value. Then, the read timer value is inverted. Push to the stack above. That is, in the drive device 20 of the present embodiment, the stack also serves as a storage device that stores a value indicating the execution time until that time of a process that is interrupted by a high-priority process interrupt. is there.

計測終了処理は、実行時間の計測対象の処理の実行終了を契機として実行される処理である。この計測終了処理では、制御部110は、フリーランタイマ140のタイマ値を読み込み、当該タイマ値と上記スタックの最上段に格納されているタイマ値との差から予め定められた第2の補正値を減算し、両タイマ値の示す期間における当該実行を終了する処理の実行時間を算出する。なお、当該処理について、上記期間以前の実行時間を示す値が揮発性記憶部152(詳細については後述するが、本実施形態では上記スタックの最上段)に記憶されていた場合には、制御部110は、上記減算結果に当該値を加算して当該実行を終了する処理の実行時間を算出する。   The measurement end process is a process that is executed when an execution time measurement target process ends. In this measurement end process, the control unit 110 reads the timer value of the free-run timer 140 and sets a second correction value determined in advance from the difference between the timer value and the timer value stored in the top level of the stack. Is subtracted, and the execution time of the process for ending the execution in the period indicated by both timer values is calculated. In addition, about the said process, when the value which shows the execution time before the said period was memorize | stored in the volatile memory | storage part 152 (it mentions later for details, but in this embodiment, the top stage of the said stack), a control part 110 calculates the execution time of the process which adds the said value to the said subtraction result and complete | finishes the said execution.

上記第1の補正値とは、図3に示すように、実行時間の計測対象の処理の実行開始を指示する割り込みの発生から計測開始処理MSにおけるタイマ値の読み込みまでの第1の所要時間Ta1と、計測終了処理MEにおけるタイマ値の読み込みから割り込み終了までの第2の所要時間Ta2との和に応じた値である。なお、図3に示す例では、計測開始処理MSに先行する符号WHおよび計測終了処理MEに後続する符号WHは割り込みハンドラを表している。一方、第2の補正値とは、計測開始処理におけるタイマ値の読み込みから当該計測開始処理の実行完了までの第3の所要時間Tc1eと、計測終了処理の実行開始から当該計測終了処理におけるタイマ値の読み込みまでの第4の所要時間Tc2sとの和に応じた値である。   As shown in FIG. 3, the first correction value is the first required time Ta1 from the occurrence of an interrupt instructing the start of execution of a process whose execution time is to be measured to the reading of the timer value in the measurement start process MS. And a value corresponding to the sum of the second required time Ta2 from the reading of the timer value in the measurement end processing ME to the end of the interrupt. In the example shown in FIG. 3, the code WH preceding the measurement start process MS and the code WH following the measurement end process ME represent an interrupt handler. On the other hand, the second correction value is the third required time Tc1e from the reading of the timer value in the measurement start process to the completion of the execution of the measurement start process, and the timer value in the measurement end process from the start of the measurement end process. This is a value corresponding to the sum of the fourth required time Tc2s until reading.

上記第1および第2の補正値の具体的な値については制御部110の種類や仕様に応じて定めるようにすれば良く、さらに第1の補正値(上記第1の時間Ta1および第2の時間Ta2)については実行時間の計測対象の処理の優先度に応じた値に定めるようにすれば良い。各々優先度の異なる処理の実行時間を正確に計測するためである。本実施形態では、最も優先度に高い処理についてはTa1=34マイクロ秒、Ta2=54マイクロ秒と定められており、その他の処理についてはTa1=60マイクロ秒、Ta2=78マイクロ秒と定められている。また、第2の補正値(上記第3の時間Tc1eおよび第4の時間Tc2s)については、Tc1e=52マイクロ秒、Tc2s=24マイクロ秒と定められている。本実施形態では、上記第1の補正値は上記優先度と対応付けて計測開始処理のプログラムに予め埋め込まれており、上記第2の補正値は計測終了処理のプログラムに予め埋め込まれている。
以上が駆動装置20の構成である。
The specific values of the first and second correction values may be determined in accordance with the type and specification of the control unit 110, and the first correction values (the first time Ta1 and the second time) may be determined. The time Ta2) may be set to a value corresponding to the priority of the process to be measured for execution time. This is to accurately measure the execution time of the processes having different priorities. In the present embodiment, Ta1 = 34 microseconds and Ta2 = 54 microseconds are set for the process with the highest priority, and Ta1 = 60 microseconds and Ta2 = 78 microseconds are set for the other processes. Yes. The second correction values (the third time Tc1e and the fourth time Tc2s) are determined as Tc1e = 52 microseconds and Tc2s = 24 microseconds. In the present embodiment, the first correction value is preliminarily embedded in the measurement start processing program in association with the priority, and the second correction value is preliminarily embedded in the measurement end processing program.
The above is the configuration of the driving device 20.

(B:動作)
以下、制御部110が通信制御ライブラリ1542および電力変換部制御ライブラリ1544に含まれる各プログラムにしたがってn(nは2以上の自然数)種類の処理SLx(x=1〜n)を実行するとともにxの値が小さいほど優先度が高く設定されている状況下で、処理SL2の実行中に、割り込みにより処理SL1の実行が開始される場合を例にとって、計測開始処理および計測終了処理の処理内容を説明する。なお、以下に説明する動作例では、処理SL2の開始時点では他の処理は実行されていない。また、前述したように、処理SLx(x=1〜n)の各々を制御部110に実行させる各プログラム(通信制御ライブラリ1542に含まれるプログラム)には、その先頭に計測開始APIを呼び出すためのコードが埋め込まれており、その末尾には計測終了APIを呼び出すためのコードが埋め込まれている。また、計測開始APIの呼び出しの際にはその呼び出し元のプログラムにしたがって実現される処理の優先度を表す値が当該APIの引数として用いられる。呼び出し元の処理の優先度に応じて上記第1の補正値の値を異ならせるためである。
(B: Operation)
Hereinafter, the control unit 110 executes n (n is a natural number of 2 or more) types of processing SLx (x = 1 to n) according to each program included in the communication control library 1542 and the power conversion unit control library 1544, and x The processing contents of the measurement start process and the measurement end process will be described by taking as an example a case where the execution of the process SL1 is started by an interrupt while the process SL2 is being executed in a situation where the priority is set higher as the value is smaller. To do. In the operation example described below, no other process is executed at the start of the process SL2. As described above, each program (a program included in the communication control library 1542) that causes the control unit 110 to execute each of the processes SLx (x = 1 to n) is used to call the measurement start API at the head thereof. A code is embedded, and a code for calling the measurement end API is embedded at the end thereof. Further, when calling the measurement start API, a value indicating the priority of processing realized according to the calling source program is used as an argument of the API. This is because the value of the first correction value is made different according to the priority of the caller process.

処理SL2の実行開始を指示する割り込みの発生時点では、他に実行中の処理はない。このため、図3に示すように、処理SL2の実行に先立って実行される計測開始処理MSでは、制御部110は、フリーランタイマ140のタイマ値T1を読み込み、当該タイマ値T1を符号反転してスタックへプッシュする。その後、制御部110は、処理SL2の実行を開始し、処理SL1の実行開始を指示する割り込みが発生すると、処理SL2の実行を中断する。制御部110は上記割り込みにより実行を指示されたプログラムを不揮発性記憶部154から揮発性記憶部152に読み出してその実行を開始するのであるが、当該プログラムの先頭にも前述した計測開始APIが含まれている。このため、制御部110は、まず、計測開始処理MSを実行する。   At the time of occurrence of an interrupt that instructs the start of execution of the process SL2, there is no other process being executed. For this reason, as shown in FIG. 3, in the measurement start process MS that is executed prior to the execution of the process SL2, the control unit 110 reads the timer value T1 of the free-run timer 140 and reverses the sign of the timer value T1. And push it onto the stack. Thereafter, the control unit 110 starts execution of the process SL2, and interrupts the execution of the process SL2 when an interrupt for instructing the execution start of the process SL1 occurs. The control unit 110 reads the program instructed to be executed by the interrupt from the nonvolatile storage unit 154 to the volatile storage unit 152 and starts the execution. The above-described measurement start API is also included at the top of the program. It is. For this reason, the control part 110 performs the measurement start process MS first.

処理SL1に先立つ計測開始処理MSでは制御部110は、まず、フリーランタイマ140のタイマ値T2を読み込む。本動作例では、処理SL1により実行を中断される処理があるため、制御部110は、上記実行を中断される処理についての上記割り込みが発生するまでの実行時間を表す値Tα´をタイマ値T2とスタックの最上段の格納内容と第1の補正値とに基づいて算出する。より詳細に説明すると、制御部110は、上記タイマ値T2に、スタックの最上段に格納されている値(−T1)を加算し、さらに第1の補正値を減算することで、上記値Tα´(Tα´=T2−T1−Ta2−Ta1)を算出する。次いで、制御部110は、スタックの最上段の格納内容を当該値Tα´に更新し、その後、フリーランタイマ140から読み込んだタイマ値T2を符号反転してスタックへプッシュする(図3参照)。なお、スタックへのタイマ値のプッシュを符号反転せずに行う場合には、フリーランタイマ140のタイマ値T2とスタックの最上段に格納されているタイマ値T1との差を算出し、さらに上記第1の補正値を減算することで上記値Tα´を算出する処理を制御部110に実行させるようにすれば良い。   In the measurement start process MS prior to the process SL1, the control unit 110 first reads the timer value T2 of the free-run timer 140. In the present operation example, since there is a process whose execution is interrupted by the process SL1, the control unit 110 sets a value Tα ′ representing the execution time until the interrupt for the process whose execution is interrupted to the timer value T2. And based on the stored contents of the uppermost stage of the stack and the first correction value. More specifically, the control unit 110 adds the value (−T1) stored in the top level of the stack to the timer value T2, and further subtracts the first correction value, thereby obtaining the value Tα. '(Tα' = T2-T1-Ta2-Ta1) is calculated. Next, the control unit 110 updates the stored content at the top of the stack to the value Tα ′, and then reverses the sign of the timer value T2 read from the free-run timer 140 and pushes it onto the stack (see FIG. 3). When the timer value is pushed onto the stack without sign inversion, the difference between the timer value T2 of the free-run timer 140 and the timer value T1 stored at the top of the stack is calculated. What is necessary is just to make the control part 110 perform the process which calculates the said value T (alpha) 'by subtracting a 1st correction value.

ここで注目すべき点は、上記割り込みが発生するまでの処理SL2の実際の実行時間Tα(図3に示すように、Tα=T2−T1−Tc1e−Ta1)は上記の要領で算出される値Tα´とは微妙に異なっているという点である。このように、処理SL2の実際の実行時間Tαと計測開始処理MSにて算出される値Tα´は微妙に異なるのであるが、両者の誤差は処理SL2に後続する計測終了処理MEにおいて補正されるため、特段の問題は生じない。この点については後に詳細に説明する。なお、優先度の高い処理の割り込みにより実行を中断される処理のそれまでの実行時間を示す値を記憶する役割をスタックとは異なる他の記憶装置に担わせる場合には、処理SL1に先立つ計測開始処理MSにおいては、スタックの最上段の値をプルし、当該値とフリーランタイマ140のタイマ値とから上記値Tα´を算出し、処理SL2と対応付けて上記記憶装置に記憶させた後に、上記タイマ値を符号反転してスタックへプッシュする処理を制御部110に実行させるようにすれば良い。   What should be noted here is that the actual execution time Tα (Tα = T2−T1−Tc1e−Ta1 as shown in FIG. 3) of the processing SL2 until the interruption occurs is a value calculated in the above manner. Tα ′ is slightly different from Tα ′. Thus, although the actual execution time Tα of the process SL2 and the value Tα ′ calculated in the measurement start process MS are slightly different, the error between them is corrected in the measurement end process ME subsequent to the process SL2. Therefore, no particular problem occurs. This point will be described in detail later. In the case where another storage device different from the stack has the role of storing the value indicating the execution time until the process interrupted due to the interrupt of the process having a high priority, the measurement prior to the process SL1 is performed. In the start process MS, the value at the top of the stack is pulled, the value Tα ′ is calculated from the value and the timer value of the free-run timer 140, and stored in the storage device in association with the process SL2. The control unit 110 may execute the process of inverting the sign of the timer value and pushing it to the stack.

上記の要領で処理SL1の実行を開始した制御部110は、当該処理SL1の実行終了を契機として計測終了処理MEを実行する。この計測終了処理MEでは制御部110は、スタックの最上段に格納されている値(本実施形態では、−T2)をプルし、当該値とフリーランタイマ140から読み込んだタイマ値との和(本動作例では、スタックの最上段に保持されているタイマ値とフリーランタイマ140から読み込んだタイマ値との差)を算出し、さらにその算出結果から第2の補正値を減算する。これにより、本動作例では、処理SL1の実行時間を表す値Tx(Tx=T3−T2−Tc1e−Tc2s)が算出される。制御部110は、このようにして算出した処理SL1の実行時間Txを当該処理SL1と対応づけて揮発性記憶部152の所定領域に書き込む。図3を参照すれば明らかように、上記の要領で算出される値Txは処理SL1の実際の実行時間と一致する。   The control unit 110 that has started the execution of the process SL1 as described above executes the measurement end process ME when the execution of the process SL1 ends. In this measurement end processing ME, the control unit 110 pulls a value (−T2 in the present embodiment) stored in the top level of the stack, and sums the value and the timer value read from the free-run timer 140 ( In this operation example, the difference between the timer value held at the top of the stack and the timer value read from the free-run timer 140 is calculated, and the second correction value is subtracted from the calculation result. Thereby, in this operation example, a value Tx (Tx = T3-T2-Tc1e-Tc2s) representing the execution time of the process SL1 is calculated. The control unit 110 writes the execution time Tx of the process SL1 calculated in this way in a predetermined area of the volatile storage unit 152 in association with the process SL1. As is clear from FIG. 3, the value Tx calculated in the above manner matches the actual execution time of the process SL1.

次いで、制御部110は、スタックの最上段の格納内容(本動作例では、Tα´)を、フリーランタイマ140から読み込んだタイマ値T3を減算した値(本動作例では、−T3+Tα´)に更新し、計測終了処理MEを終了する。なお、優先度の高い処理の割り込みにより実行を中断される処理のそれまでの実行時間を示す値を記憶する役割をスタックとは異なる他の記憶装置に担わせる場合には、本計測終了処理MEにおいては、スタックの最上段の値をプルし、当該値とフリーランタイマ140のタイマ値とから上記値Txを算出して上記記憶装置に記憶させた後に、上記タイマ値を符号反転してスタックへプッシュする処理を制御部110に実行させるようにすれば良い。   Next, the control unit 110 subtracts the stored value at the top of the stack (Tα ′ in this operation example) from the timer value T3 read from the free-run timer 140 (−T3 + Tα ′ in this operation example). Update and end the measurement end processing ME. Note that this measurement end processing ME is performed when a storage device different from the stack has a role of storing a value indicating an execution time until a processing whose execution is interrupted by a high-priority processing interrupt. , Pull the value at the top of the stack, calculate the value Tx from the value and the timer value of the free-run timer 140, store the value in the storage device, and then reverse the sign of the timer value to stack. The controller 110 may be made to execute the process of pushing to

図3に示すように、処理SL1についての割り込みが終了すると、制御部110は処理SL2の実行を再開する。しかし、本動作例では、再度、処理SL1の実行開始を指示する割り込みが発生するため、処理SL2の実行は再度中断される。図3に示すように、当該再度の割り込みによる計測開始処理MSでは制御部110は、フリーランタイマ140のタイマ値T2´を読み込み、当該タイマ値T2´とスタックの最上段の格納内容(−T3+Tα´)とに基づいて処理SL2についての当該割り込みが発生するまでの実行時間を表す値Tα´+Tγ´(ただし、Tγ´=T2´−T3−Ta2−Ta1)を算出し、当該値で上記スタックの最上段の格納内容を更新する。その後、制御部110は、フリーランタイマ140から読み込んだタイマ値T2´を符号反転して上記スタックへプッシュする。なお、上記割り込みが発生するまでの処理SL2の実際の実行時間Tγは、図3に示すように、上記の要領で算出される値Tγ´と一致する。以降、処理SL1の実行終了を契機として計測終了処理MEが実行される点、この計測終了処理MEでは処理SL1の実行時間Ty(Ty=T3´−T2´−Tc1e−Tc2s)が算出される点、上記実行時間Tyの出力後、スタックの最上段の格納内容が(−T3´+Tα´+Tγ´)に更新される点、および上記の要領で算出された値Tyは処理SL1の実際の実行時間と一致する点は前述した1回目の処理SL1の実行における場合と同様である。   As illustrated in FIG. 3, when the interrupt for the process SL1 is completed, the control unit 110 resumes the execution of the process SL2. However, in this operation example, since an interrupt for instructing the start of execution of the process SL1 occurs again, the execution of the process SL2 is interrupted again. As shown in FIG. 3, in the measurement start processing MS by the second interruption, the control unit 110 reads the timer value T2 ′ of the free-run timer 140, and stores the timer value T2 ′ and the stored content at the top of the stack (−T3 + Tα). ′) And a value Tα ′ + Tγ ′ (where Tγ ′ = T2′−T3−Ta2−Ta1) representing the execution time until the interruption for the process SL2 is generated, and the stack is calculated with the value. Update the stored contents of the top row of. Thereafter, the control unit 110 inverts the sign of the timer value T2 ′ read from the free-run timer 140 and pushes it to the stack. Note that the actual execution time Tγ of the process SL2 until the interrupt occurs coincides with the value Tγ ′ calculated in the above manner, as shown in FIG. Thereafter, the measurement end process ME is executed when the execution of the process SL1 is terminated, and the execution time Ty (Ty = T3′−T2′−Tc1e−Tc2s) of the process SL1 is calculated in the measurement end process ME. After the execution time Ty is output, the stored content at the top of the stack is updated to (−T3 ′ + Tα ′ + Tγ ′), and the value Ty calculated in the above manner is the actual execution time of the process SL1. Is the same as in the execution of the first processing SL1 described above.

処理SL1についての割り込みが終了すると、制御部110は、再度、処理SL2の実行を再開し、処理SL2の実行が終了すると、計測終了処理MEを実行する。この計測終了処理MEでは制御部110は、スタックの最上段の格納内容(Tα´+Tγ´−T3´)とフリーランタイマ140から読み込んだタイマ値T4とからそれまでの処理SL2の実行時間を表す値Tα´+Tγ´+Tβ´(ただし、Tβ´=T4−T3´−Tc1e−Tc2s)を算出する。なお、優先度の高い処理の割り込みにより実行を中断される処理のそれまでの実行時間を示す値を記憶する役割をスタックとは異なる他の記憶装置が担っている場合には、スタックの最上段には−T3´のみが格納されているため、当該値とフリーランタイマ140から読み込んだタイマ値T4との和から上記第2の補正値を減算して値Tβ´を算出し、上記記憶装置に記憶されているTα´およびTγ´を加算して処理SL2の実行時間を表す値を算出する処理を制御部110に実行させるようにすれば良い。   When the interrupt for the process SL1 ends, the control unit 110 resumes the execution of the process SL2, and when the execution of the process SL2 ends, executes the measurement end process ME. In this measurement end process ME, the control unit 110 represents the execution time of the process SL2 from the stored content (Tα ′ + Tγ′−T3 ′) at the top of the stack and the timer value T4 read from the free-run timer 140. The value Tα ′ + Tγ ′ + Tβ ′ (where Tβ ′ = T4−T3′−Tc1e−Tc2s) is calculated. When another storage device different from the stack plays a role of storing a value indicating the execution time until the processing of which processing is interrupted due to a high-priority processing interrupt, the top level of the stack Since only -T3 'is stored, the second correction value is subtracted from the sum of the value and the timer value T4 read from the free-run timer 140 to calculate the value Tβ', and the storage device It is only necessary to cause the control unit 110 to execute a process of calculating a value representing the execution time of the process SL2 by adding Tα ′ and Tγ ′ stored in the process S2.

図3を参照すれば明らかように、2回目の処理SL1についての割り込み終了後、処理SL2の実行が完了するまでの実際の実行時間Tβ(図3に示すように、Tβ=T4−T3´−Ta2−Tc2s)と上記の要領で算出される値Tβ´とは微妙に異なっている。しかし、TβとTβ´の差(Tβ―Tβ´)は−Ta2+Tc1sであり、TαとTα´の差Ta2−Tc1sと相殺する。つまり、Tα´+Tγ´+Tβ´=Tα+Tγ+Tβとなり、処理SL2の実行時間が正確に算出される。   As apparent from FIG. 3, after the interruption for the second process SL1, the actual execution time Tβ until the execution of the process SL2 is completed (Tβ = T4-T3′− as shown in FIG. 3). Ta2-Tc2s) is slightly different from the value Tβ ′ calculated in the above manner. However, the difference between Tβ and Tβ ′ (Tβ−Tβ ′) is −Ta2 + Tc1s, which cancels out the difference Ta2−Tc1s between Tα and Tα ′. That is, Tα ′ + Tγ ′ + Tβ ′ = Tα + Tγ + Tβ, and the execution time of the processing SL2 is accurately calculated.

以上説明したように本実施形態によれば、他の処理によって実行を中断されない処理(上記動作例では処理SL1)の実行時間を正確に算出することができることは勿論、他の処理の割り込みにより実行を中断される処理(上記動作例では処理SL2)の実行時間を正確に計測することが可能になる。   As described above, according to the present embodiment, it is possible to accurately calculate the execution time of a process whose process is not interrupted by another process (process SL1 in the above operation example). It is possible to accurately measure the execution time of the process that is interrupted (process SL2 in the above operation example).

(C:変形)
以上本発明の実施形態について説明したが、この実施形態に以下の変形を加えても勿論良い。
(1)上記実施形態では、電動機30の駆動装置20における電力変換部130の作動制御を行うプログラムにしたがって制御部110が実行する各種処理の実行時間を計測する場合について説明した。しかし、本発明の計測方法による実行時間の計測対象の処理は、駆動装置20にて実行される処理に限定されるものではない。例えば家庭用ゲーム機や携帯型ゲーム機において実行される処理の実行時間を計測対象としても良く、また、スマートフォンやタブレット型コンピュータなどの携帯型コンピュータにおいて実行される処理、或いはルータなどのネットワーク機器において実行される処理の実行時間を計測対象としても良い。要は、コンピュータ装置において割り込みにより実行される処理であって、処理毎に優先度が予め定められている処理であれば、本発明の計測方法を適用することでその実行時間を正確に計測することができ、特に、割り込みが数十マイクロ秒といった極めて短い時間間隔で発生する場合に効果的である。
(C: deformation)
Although the embodiment of the present invention has been described above, it goes without saying that the following modifications may be added to this embodiment.
(1) In the above-described embodiment, a case has been described in which the execution time of various processes executed by the control unit 110 is measured in accordance with a program that controls the operation of the power conversion unit 130 in the drive device 20 of the electric motor 30. However, the process for which the execution time is measured by the measurement method of the present invention is not limited to the process executed by the drive device 20. For example, the execution time of a process executed in a home game machine or a portable game machine may be measured, and in a process executed in a portable computer such as a smartphone or a tablet computer, or in a network device such as a router The execution time of the process to be executed may be measured. In short, if the process is executed by an interrupt in the computer apparatus and the priority is predetermined for each process, the execution time is accurately measured by applying the measurement method of the present invention. This is particularly effective when interrupts occur at extremely short time intervals such as several tens of microseconds.

(2)上記実施形態では、第1および第2の補正値として制御部110の種類や仕様に応じて定められる値を用い、かつ第1の補正値として実行時間の計測対象の処理の優先度に応じた値を用いたが、制御部110の種類または仕様のみに応じて定められた値を用いても良く、また実行時間の計測対象の処理の優先度のみに応じて定められた値を用いても良い。このような態様によれば、上記実施形態に比較して実行時間の計測精度が低下するものの、これら補正値を用いた補正を行う分だけ従来のスタック方式よりも精度良く実行時間を計測することが可能になるからでる。 (2) In the above embodiment, the first and second correction values are values determined according to the type and specification of the control unit 110, and the priority of the processing to be executed is measured as the first correction value. However, a value determined only in accordance with the type or specification of the control unit 110 may be used, and a value determined only in accordance with the priority of the processing subject to measurement of the execution time. It may be used. According to such an aspect, although the measurement accuracy of the execution time is reduced as compared with the above embodiment, the execution time is measured more accurately than the conventional stack method by the amount of correction using these correction values. Because it becomes possible.

(3)上記実施形態では、第1の補正値および第2の補正値が計測支援ライブラリ1546の各プログラムに埋め込まれていたが、これら補正値を書き込んだテーブルを上記各プログラムとは別個に不揮発性記憶部154に記憶させ、各プログラムにしたがって作動する制御部110には当該テーブルから各補正値を読み込んで使用する処理を実行させるようにしても良い。このように実行時間計測用のプログラムとは別個に各補正値を記憶させておけば、例えば制御部110の換装(より高性能なものへの置き換え)や各処理の割り込みレベルの変更が発生した場合であっても上記テーブルの書き換えによって柔軟に対処することが可能になる。 (3) In the above embodiment, the first correction value and the second correction value are embedded in each program of the measurement support library 1546. However, the table in which these correction values are written is non-volatile separately from the above programs. The control unit 110 stored in the property storage unit 154 and operating according to each program may execute processing for reading each correction value from the table and using it. In this way, if each correction value is stored separately from the execution time measurement program, for example, replacement of the control unit 110 (replacement with a higher performance one) or change of the interrupt level of each process occurs. Even in such a case, it is possible to cope flexibly by rewriting the table.

(4)上記実施形態では、最も優先度の高い処理とその他の処理とで第1の補正値の値を異ならせる場合について説明したが、最も優先度の高い処理に先立って実行される計測開始処理とその他の処理に先立って実行される計測開始処理とで処理内容を異ならせても良い。具体的には、計測開始処理の実行中は他の処理による割り込みを禁止するために、計測開始処理の冒頭で割り込み禁止制御を行い、計測開始処理の末尾で当該禁止を解除する制御を行うことが一般的であるが、最も優先度の高い処理に先行する計測開始処理では、他の処理による割り込みが発生することはないため、上記禁止制御や禁止の解除を省略するのである。計測終了処理についても同様に、最も優先度の高い処理に後続する計測終了処理では、上記禁止制御や禁止の解除を省略し、その他の処理に後続する計測終了処理では上記禁止制御や禁止の解除を実行するようにしても良い。 (4) In the above embodiment, the case where the first correction value is made different between the process with the highest priority and the other processes has been described. However, the measurement is started prior to the process with the highest priority. The processing contents may be different between the processing and the measurement start processing executed prior to other processing. Specifically, during execution of measurement start processing, in order to prohibit interruption by other processing, interrupt prohibition control is performed at the beginning of measurement start processing, and control is performed to cancel the prohibition at the end of measurement start processing. However, in the measurement start process preceding the process with the highest priority, an interrupt due to another process does not occur, and thus the prohibition control and the cancellation of the prohibition are omitted. Similarly, in the measurement end process, the prohibition control and prohibition release are omitted in the measurement end process subsequent to the process with the highest priority, and the prohibition control and prohibition release are performed in the measurement end process subsequent to other processes. May be executed.

1…試験システム、10…試験装置、110…制御部、120…通信I/F部、130…電力変換部、140…フリーランタイマ、150…記憶部、152…揮発性記憶部、154…不揮発性記憶部、1542…通信制御ライブラリ、1544…電力変換部制御ライブラリ、1546…計測支援ライブラリ、160…バス、30…電動機。   DESCRIPTION OF SYMBOLS 1 ... Test system, 10 ... Test apparatus, 110 ... Control part, 120 ... Communication I / F part, 130 ... Power conversion part, 140 ... Free run timer, 150 ... Memory | storage part, 152 ... Volatile memory part, 154 ... Nonvolatile 1542 ... Communication control library, 1544 ... Power converter control library, 1546 ... Measurement support library, 160 ... Bus, 30 ... Electric motor.

Claims (5)

各々割り込みにより実行されるとともに各々割り込みの優先度が予め定められた複数の処理を制御部に実行させる場合における各処理の実行時間をフリーランタイマとスタックとを用いて計測する計測方法において、
前記複数の処理の各々に先立って実行される計測開始処理であって、前記フリーランタイマのタイマ値を読み込み、当該計測開始処理に後続する処理によって実行を中断される他の処理がない場合には当該読み込んだタイマ値を前記スタックへプッシュする一方、実行を中断される他の処理がある場合には当該タイマ値と前記スタックの最上段に格納されているタイマ値との差から予め定められた第1の補正値を減算して当該他の処理のそれまでの実行時間を表す値を算出して記憶装置に記憶させた後に、当該読み込んだタイマ値を前記スタックへプッシュする計測開始処理と、
前記複数の処理の各々の実行終了を契機として実行される計測終了処理であって、前記フリーランタイマのタイマ値を読み込み、当該タイマ値と前記スタックの最上段の格納内容と当該実行を終了する処理のそれまでの実行時間を表すものとして前記記憶装置に記憶されている値とから算出される値を予め定められた第2の補正値を用いて補正し、当該実行を終了する処理の実行時間を算出する計測終了処理と、
を前記制御部に実行させることを特徴とする計測方法。
In a measurement method for measuring the execution time of each process using a free-run timer and a stack when the control unit executes a plurality of processes each of which is executed by an interrupt and each of which has a predetermined priority,
A measurement start process that is executed prior to each of the plurality of processes, when the timer value of the free-run timer is read and there is no other process that is interrupted by a process subsequent to the measurement start process Pushes the read timer value onto the stack, while there is another process that is interrupted, it is determined in advance from the difference between the timer value and the timer value stored at the top level of the stack. A measurement start process for subtracting the first correction value to calculate a value representing the execution time until the other process and storing the value in the storage device, and then pushing the read timer value to the stack; ,
A measurement end process that is executed when each of the plurality of processes ends. The timer value of the free-run timer is read, and the timer value, the stored content at the top of the stack, and the execution are ended. Execution of a process for correcting a value calculated from a value stored in the storage device as representing the execution time until the process using a predetermined second correction value and ending the execution Measurement end processing to calculate time,
The control method causes the control unit to execute.
前記第1の補正値は、割り込み発生から前記計測開始処理におけるタイマ値の読み込みまでの第1の所要時間と前記計測終了処理におけるタイマ値の読み込みから割り込み終了までの第2の所要時間との和に応じた値であり、前記第2の補正値は、前記計測開始処理におけるタイマ値の読み込みから当該計測開始処理の実行完了までの第3の所要時間と前記計測終了処理の実行開始から当該計測終了処理におけるタイマ値の読み込みまでの第4の所要時間との和に応じた値である
ことを特徴とする請求項1に記載の計測方法。
The first correction value is a sum of a first required time from the occurrence of an interrupt to reading of a timer value in the measurement start process and a second required time from the reading of the timer value in the measurement end process to the end of interruption. The second correction value is a third required time from the reading of the timer value in the measurement start process to the completion of the execution of the measurement start process, and from the start of the measurement end process to the measurement. The measurement method according to claim 1, wherein the value is a value corresponding to a sum of the fourth required time until the timer value is read in the termination process.
前記第1および第2の補正値は前記制御部の種類または仕様に応じて定められた値であるととともに、前記第1の補正値は、前記計測開始処理に後続する処理の優先度に応じて定められた値であることを特徴とする請求項2に記載の計測方法。   The first and second correction values are values determined in accordance with the type or specification of the control unit, and the first correction value is in accordance with the priority of processing subsequent to the measurement start processing. The measurement method according to claim 2, wherein the measurement value is determined as follows. 各々割り込みにより実行されるとともに各々割り込みの優先度が予め定められた複数の処理を実行する制御部と、
フリーランタイマと、
スタック、とを備え、
前記制御部は、
前記複数の処理の各々に先立って実行される計測開始処理であって、前記フリーランタイマのタイマ値を読み込み、当該計測開始処理に後続する処理によって実行を中断される他の処理がない場合には当該読み込んだタイマ値を前記スタックへプッシュする一方、実行を中断される他の処理がある場合には当該タイマ値と前記スタックの最上段に格納されているタイマ値との差から予め定められた第1の補正値を減算して当該他の処理のそれまでの実行時間を表す値を算出して記憶装置に記憶させた後に、当該読み込んだタイマ値を前記スタックへプッシュする計測開始処理と、
前記複数の処理の各々の実行終了を契機として実行される計測終了処理であって、前記フリーランタイマのタイマ値を読み込み、当該タイマ値と前記スタックの最上段の格納内容と当該実行を終了する処理のそれまでの実行時間を表すものとして前記記憶装置に記憶されている値とから算出される値を予め定められた第2の補正値を用いて補正し、当該実行を終了する処理の実行時間を算出する計測終了処理と、を実行する
ことを特徴とするコンピュータ装置。
A control unit that executes a plurality of processes that are executed by each interrupt and that have a predetermined priority of each interrupt;
A free-run timer,
Stack, and
The controller is
A measurement start process that is executed prior to each of the plurality of processes, when the timer value of the free-run timer is read and there is no other process that is interrupted by a process subsequent to the measurement start process Pushes the read timer value onto the stack, while there is another process that is interrupted, it is determined in advance from the difference between the timer value and the timer value stored at the top level of the stack. A measurement start process for subtracting the first correction value to calculate a value representing the execution time until the other process and storing the value in the storage device, and then pushing the read timer value to the stack; ,
A measurement end process that is executed when each of the plurality of processes ends. The timer value of the free-run timer is read, and the timer value, the stored content at the top of the stack, and the execution are ended. Execution of a process for correcting a value calculated from a value stored in the storage device as representing the execution time until the process using a predetermined second correction value and ending the execution And a measurement end process for calculating time.
データの書き換えが可能な不揮発性メモリを有し、
前記第1および第2の補正値は前記制御部の種類または仕様に応じて予め定められた前記第1の補正値および前記第2の補正値が前記不揮発性メモリに格納されており、前記第1の補正値は、前記実行を中断される処理の優先度に応じた値に定められている
ことを特徴とする請求項4に記載のコンピュータ装置。
It has a non-volatile memory that can rewrite data,
The first and second correction values are stored in the non-volatile memory as the first correction value and the second correction value, which are predetermined according to the type or specification of the control unit. The computer apparatus according to claim 4, wherein the correction value of 1 is set to a value according to a priority of the process whose execution is interrupted.
JP2013146321A 2013-07-12 2013-07-12 Measuring method and computer apparatus Active JP6075234B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013146321A JP6075234B2 (en) 2013-07-12 2013-07-12 Measuring method and computer apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013146321A JP6075234B2 (en) 2013-07-12 2013-07-12 Measuring method and computer apparatus

Publications (2)

Publication Number Publication Date
JP2015018475A JP2015018475A (en) 2015-01-29
JP6075234B2 true JP6075234B2 (en) 2017-02-08

Family

ID=52439392

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013146321A Active JP6075234B2 (en) 2013-07-12 2013-07-12 Measuring method and computer apparatus

Country Status (1)

Country Link
JP (1) JP6075234B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101587636B1 (en) * 2015-07-07 2016-01-25 주식회사 삼보컴퓨터 Apparatus and method for saving product date

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008310748A (en) * 2007-06-18 2008-12-25 Honda Motor Co Ltd Task execution time recording device, task execution time recording method, and task execution recording program

Also Published As

Publication number Publication date
JP2015018475A (en) 2015-01-29

Similar Documents

Publication Publication Date Title
CN102163047B (en) Robot with learning control function
US20150268996A1 (en) Real-Time Multi-Task Scheduling Method and Apparatus
WO2006009261A1 (en) Real time processing software control device and method
US8539448B2 (en) System and method for automatically testing a program for safety-related automation systems
US7168075B1 (en) Automation device and updating method
JP6075234B2 (en) Measuring method and computer apparatus
CN112154399B (en) Rocker calibration method, remote control terminal and computer readable storage medium
US20200192316A1 (en) Method for Starting Up a Controller System, and Controller System
JP2019133494A (en) Setting support device and setting support program
JP5962860B2 (en) Monitoring method and computer apparatus
CN103003763B (en) The computer installation of the access coordination of internal storage and operation method
CN106844025A (en) A kind of asynchronous interrupt processing method and interrupt control unit
CN115657537A (en) Calibration data management method, apparatus and medium for vehicle and electronic control unit
JP6888251B2 (en) Controls, drives, control methods, and control programs
EP2750295B1 (en) Conversion device, peripheral device, and programmable controller
JP7512944B2 (en) Update control system, update control method, update control program, and on-board control device
CN108445856A (en) Beam piece production process monitoring method, device, management system and storage medium
JP2000056989A (en) Task designing method
JP2008276674A (en) Electronic computer capable of specifying execution time of task, and program for electronic computer
JP6463445B1 (en) In-vehicle control device
JP4853390B2 (en) Measuring device
JP7230511B2 (en) SOFTWARE EXECUTION LOAD FACTOR MEASUREMENT IN CONTROLLER
JP2009230425A (en) Information processor
US11396098B2 (en) Control of a robot system
CN112169317B (en) Vehicle operation control method and system, electronic device and readable storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160215

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20161111

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20161213

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20161226

R150 Certificate of patent or registration of utility model

Ref document number: 6075234

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250