JP2013156744A - Information processing device and data storage method - Google Patents
Information processing device and data storage method Download PDFInfo
- Publication number
- JP2013156744A JP2013156744A JP2012015460A JP2012015460A JP2013156744A JP 2013156744 A JP2013156744 A JP 2013156744A JP 2012015460 A JP2012015460 A JP 2012015460A JP 2012015460 A JP2012015460 A JP 2012015460A JP 2013156744 A JP2013156744 A JP 2013156744A
- Authority
- JP
- Japan
- Prior art keywords
- data
- task
- safety
- storage
- storage unit
- 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.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、情報処理装置及びデータ格納方法に関し、特に、データを格納するタスクと、そのデータよりも格納する優先度の高いデータを格納するタスクとを実行する情報処理装置及びデータ格納方法に関する。 The present invention relates to an information processing apparatus and a data storage method, and more particularly, to an information processing apparatus and a data storage method for executing a task for storing data and a task for storing higher priority data than the data.
サービスロボットは、外界センサや自己診断装置によって安全状態を常時監視し、何らかの危険を検知した場合に適切な安全制御ロジックを実行することで、機能安全を確保する必要がある。 Service robots must ensure functional safety by constantly monitoring the safety state with external sensors and self-diagnosis devices and executing appropriate safety control logic when any danger is detected.
上述したサービスロボットのほか、運輸機器等の電気的な原理で動作するシステムを対象とした機能安全に関する国際標準としてIEC 61508が制定されている。IEC 61508では、機能安全の確保のために設けられるシステムのことを安全関連系と呼んでいる。IEC 61508は、マイクロプロセッサ及びPLC(Programmable Logic Controller)等のハードウェアとコンピュータプログラム(ソフトウェア)によって安全関連系を構築するための様々な技法を定めている。IEC 61508で定められている技法を用いることで、コンピュータシステムを用いて安全関連系を構築することが可能となる。 In addition to the service robots described above, IEC 61508 has been established as an international standard for functional safety for systems that operate on electrical principles such as transportation equipment. In IEC 61508, a system provided for ensuring functional safety is called a safety-related system. IEC 61508 defines various techniques for constructing a safety-related system using hardware such as a microprocessor and a PLC (Programmable Logic Controller) and a computer program (software). By using the technique defined in IEC 61508, it is possible to construct a safety-related system using a computer system.
一方で、近年、マイクロプロセッサ等のプログラマブル電子機器の処理能力が向上している。このため、マルチタスクOS(Operating System)を利用し、1つのコンピュータシステム上で様々なアプリケーションプログラムを並列実行することで、サービスロボット及び自動車等の機器に搭載されている複数用途のコンピュータシステムを統合することができる。 On the other hand, in recent years, the processing capability of programmable electronic devices such as microprocessors has improved. For this reason, a multi-task OS (Operating System) is used, and various application programs are executed in parallel on one computer system, thereby integrating multiple-use computer systems installed in service robots and automobiles. can do.
例えば特許文献1に、機能安全の確保に関するアプリケーションプログラム(以下、安全関連アプリケーションと呼ぶ)を、その他のアプリケーションプログラム(以下、非安全関連アプリケーションと呼ぶ)と共に1つのコンピュータシステム上で動作させる技術が開示されている。
For example,
IEC 61508で定められている技法を、安全関連アプリケーションおよび非安全関連アプリケーションを含むソフトウェア全体に適用すると、非安全関連アプリケーションにまで適用する必要性が生じる。このため、ソフトウェア開発コストが増大するという問題がある。 When the technique defined in IEC 61508 is applied to the entire software including safety-related applications and non-safety-related applications, it is necessary to apply even to non-safety-related applications. For this reason, there is a problem that the software development cost increases.
そこで、特許文献1に開示される技術では、システムプログラムのタイム・パーティションニングによって、安全関連アプリケーション(安全監視プログラム及び安全制御プログラム)を非安全関連アプリケーション(通常制御プログラム)から独立させている。このため、通常制御プログラムを安全関連系から除外することができ、コンピュータシステムを用いて構成される安全関連系の低コスト化に寄与することができる。
Therefore, in the technique disclosed in
ここで、特許文献1に開示の技術では、リソース・パーティショニングという技術を採用している。この技術では、実行用メモリ等の固定的な資源をリソースパーティションと言われるパーティションにパーティショニングしている。そして、アプリケーションは、予め割り当てられたリソースパーティションを超えて他のリソースにアクセスすることが禁止される。
Here, the technique disclosed in
本願出願人は、特許文献1に開示されるような安全制御装置に基づいて、新たに、ログを保存する安全制御装置を検討するにあたり、以下に説明する課題を見出した。以下、その課題について説明する。なお、以下に説明する内容は、本願出願人が新たに検討した内容であって、従来技術を説明したものではない。
Based on the safety control device disclosed in
安全制御装置の動作・制御状況の調査を容易にする手法として、ログを保存することが考えられる。ここで、安全制御装置では、安全関連アプリケーションから起動される安全関連系タスクと、非安全関連アプリケーションから起動される非安全関連系タスクとが並列実行されることになる。 As a method for facilitating the investigation of the operation / control status of the safety control device, it is conceivable to save a log. Here, in the safety control device, a safety-related task activated from a safety-related application and a non-safety-related task activated from a non-safety-related application are executed in parallel.
このような調査において、十分な調査を可能とするためには、全てのタスク(安全関連系タスク及び非安全関連系タスク)のそれぞれでログを保存しておくことが好ましい。しかしながら、そのようにした場合には、タスクの並列実行状況によっては、期待するログが保存されなくなってしまう場合がある。 In such a survey, in order to enable a sufficient survey, it is preferable to save a log for each of all tasks (safety related tasks and non-safety related tasks). However, in such a case, the expected log may not be saved depending on the parallel execution status of the task.
具体的には、上述したような調査が必要となる主なケースとして、安全制御装置において異常が検出された場合が考えられる。ここで、安全制御装置における異常の検出は、主に、機能安全の確保に関する処理を実行する安全関連系タスクで行われることになる。しがたって、非安全関連系タスクが採取するログよりも、安全関連系タスクが採取する異常に関するログの方が、保存すべき優先度は高い。 Specifically, a case where an abnormality is detected in the safety control device can be considered as a main case that requires the above-described investigation. Here, the detection of an abnormality in the safety control device is mainly performed by a safety-related task that executes processing related to ensuring functional safety. Therefore, the log to be saved is higher in the log related to the abnormality collected by the safety related task than the log collected by the non-safety related task.
その一方で、異常検出時には、安全制御装置において各タスクを制御するマイクロコントローラをリセットして、安全制御装置の復旧を行う場合もある。この場合、ウォッチドッグタイマーに対する信号を停止させることで、一定時間の経過後に、マイクロコントローラをリセットさせることが考えられる。これによれば、この一定時間が経過するまでに、ログを採取することも可能となる。 On the other hand, when an abnormality is detected, the microcontroller that controls each task in the safety control device may be reset to restore the safety control device. In this case, it is conceivable to reset the microcontroller after a certain time has elapsed by stopping the signal to the watchdog timer. According to this, it is also possible to collect a log before the certain time elapses.
しかしながら、タスクの並列実行状況によっては、マイクロコントローラがリセットされるまでの一定時間の間に非安全関連系タスクが動作してしまい、非安全関連系タスクによってログの保存は行われるが、優先度の高いログを保存する安全関連系タスクの動作時間がなくなってしまい、安全関連系タスクによるログの保存が間に合わなくなってしまう場合がある。それに対して、マイクロコントローラをリセットするまでの時間を長くすることで、非安全関連系タスクの動作後においても、安全関連系タスクによるログの保存を間に合わせることもできる。しかしながら、そのようにしてしまうと、安全制御装置を復旧するまでの時間が長くなってしまい、運用上好ましくない。 However, depending on the parallel execution status of the task, the non-safety related task operates for a certain time until the microcontroller is reset, and the log is saved by the non-safety related task. In some cases, the operation time of the safety-related task that saves a high log is lost, and the saving of the log by the safety-related task is not in time. On the other hand, by lengthening the time until the microcontroller is reset, it is possible to save the log by the safety related task even after the operation of the non-safety related task. However, if this is done, it takes a long time to restore the safety control device, which is not preferable for operation.
これは、上述したケースに限られず、データを保存するタスクと、そのデータよりも保存する優先度の高いデータを保存するタスクとが動作するシステムであれば、同様のことが言える。 This is not limited to the case described above, and the same can be said for any system in which a task for storing data and a task for storing data having a higher priority than that data operate.
本発明は、上述した知見に基づいてなされたものであって、特定のタスクのデータを優先して保存することができる情報処理装置及びデータ格納方法を提供することを目的とする。 The present invention has been made based on the above-described knowledge, and an object thereof is to provide an information processing apparatus and a data storage method capable of preferentially storing data of a specific task.
本発明の第1の態様にかかる情報処理装置は、第1のデータと、前記第1のデータよりも格納する優先度の高い第2のデータとが格納される記憶部と、前記記憶部に前記第1のデータを格納する第1のタスクと、前記記憶部に前記第2のデータを格納する第2のタスクとをスケジューリングして実行するタスク実行部と、前記第1のタスクからのデータ格納要求に応じて、前記第1のタスクに代わって前記記憶部に前記第1のデータを格納するとともに、前記第2のタスクからのデータ格納要求に応じて、前記第2のタスクに代わって前記記憶部に前記第2のデータを格納するデータ格納制御と、を備え、前記データ格納制御部は、前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がある場合には、前記第1のタスクからのデータ格納要求がある場合であっても、前記第2のタスクからのデータ格納要求に応じて、前記記憶部に前記第2のデータを格納するものである。 An information processing apparatus according to a first aspect of the present invention includes: a storage unit that stores first data and second data that has higher priority than the first data; and the storage unit A task execution unit that schedules and executes a first task that stores the first data and a second task that stores the second data in the storage unit, and data from the first task In response to a storage request, the first data is stored in the storage unit in place of the first task, and in response to a data storage request from the second task, in place of the second task. Data storage control for storing the second data in the storage unit, and the data storage control unit receives a data storage request from the second task when storing the second data In the case, the first tag Even when there is a data storage request from the click, depending on the data storage request from the second task, and stores the second data in the storage unit.
本発明の第2の態様にかかるは、第1のデータと、前記第1のデータよりも格納する優先度の高い第2のデータとが格納される記憶部に前記第1のデータを格納する第1のタスクと、前記記憶部に前記第2のデータを格納する第2のタスクとをスケジューリングして実行開始する実行開始ステップと、前記第1のタスクからのデータ格納要求に応じて、前記第1のタスクに代わって前記記憶部に前記第1のデータを格納する第1のデータ格納ステップと、前記第2のタスクからのデータ格納要求に応じて、前記第2のタスクに代わって前記記憶部に前記第2のデータを格納する第2のデータ格納ステップと、を備え、前記第2のデータ格納ステップでは、前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がある場合には、前記第1のタスクからのデータ格納要求がある場合であっても、前記第2のタスクからのデータ格納要求に応じて、前記記憶部に前記第2のデータを格納するものである。 According to a second aspect of the present invention, the first data is stored in a storage unit that stores the first data and the second data having a higher priority than the first data. In response to a data storage request from the first task, an execution start step for scheduling and starting execution of the first task and the second task for storing the second data in the storage unit, In response to a data storage request from the second task, the first data storing step of storing the first data in the storage unit instead of the first task, the second task instead of the second task A second data storage step for storing the second data in a storage unit, and in the second data storage step, data from the second task is stored when the second data is stored. When there is a storage request Includes storing the second data in the storage unit in response to a data storage request from the second task even when there is a data storage request from the first task. .
上述した本発明の各態様によれば、特定のタスクのデータを優先して保存することができる情報処理装置及びデータ格納方法を提供することができる。 According to each aspect of the present invention described above, it is possible to provide an information processing apparatus and a data storage method capable of preferentially storing data of a specific task.
以下では、本発明を適用した具体的な実施の形態について、図面を参照しながら詳細に説明する。各図面において、同一要素には同一の符号が付されており、説明の明確化のため、必要に応じて重複説明は省略される。 Hereinafter, specific embodiments to which the present invention is applied will be described in detail with reference to the drawings. In the drawings, the same elements are denoted by the same reference numerals, and redundant description is omitted as necessary for the sake of clarity.
<発明の実施の形態>
本実施の形態にかかる安全制御装置1は、サービスロボットや運輸機器等に搭載されて機能安全確保のための安全制御を実行する。安全制御装置1は、安全関連アプリケーションと非安全関連アプリケーションを同一のコンピュータシステムで実行するよう構成される。図1は、本実施の形態にかかる安全制御装置1の構成例を示すブロック図である。
<Embodiment of the Invention>
The
プロセッサ10は、プログラム(命令ストリーム)の取得、命令のデコード、命令のデコード結果に応じた演算処理を行う。なお、図1では、1つのプロセッサ10のみを示しているが、安全制御装置1は、複数のプロセッサ10を有するマルチプロセッサ構成であってもよい。また、プロセッサ10は、マルチコアプロセッサでもよい。プロセッサ10は、システムプログラムとしてのオペレーティングシステム(OS)100を実行することによりマルチプログラミング環境を提供する。マルチプログラミング環境とは、複数のプログラムを定期的に切り替えて実行したり、あるイベントの発生に応じて実行するプログラムを切り替えたりすることによって、複数のプログラムがあたかも並列実行されているような環境を意味する。
The
マルチプログラミングは、マルチプロセス、マルチスレッド、マルチタスク等と呼ばれる場合もある。プロセス、スレッド及びタスクは、マルチプログラミング環境で並列実行されるプログラム単位を意味する。本実施の形態のプロセッサ10が具備するマルチプログラミング環境は、マルチプロセス環境でもよいし、マルチスレッド環境でもよい。
Multiprogramming is sometimes called multiprocess, multithread, multitask, and the like. A process, a thread, and a task mean a program unit that is executed in parallel in a multiprogramming environment. The multi-programming environment included in the
実行用メモリ11は、プロセッサ10によるプログラム実行のために使用されるメモリである。実行用メモリ11には、不揮発性メモリ13からロードされたプログラム(OS100及びアプリケーション101〜105等)、プロセッサ10の入出力データ等が記憶される。なお、プロセッサ10は、プログラムを不揮発性メモリ13から実行用メモリ11にロードすることなく、これらのプログラムを不揮発性メモリ13から直接実行してもよい。
The execution memory 11 is a memory used for program execution by the
具体的には、実行用メモリ11は、SRAM(Static Random Access Memory)、DRAM(Dynamic Random Access Memory)等のランダムアクセス可能な揮発性メモリとすればよい。図1の実行用メモリ11は、論理的な構成単位を示している。すなわち、実行用メモリ11は、例えば、複数のSRAMデバイスの組み合わせ、複数のDRAMデバイスの組み合わせ、又はSRAMデバイスとDRAMデバイスの組み合わせでもよい。 Specifically, the execution memory 11 may be a random accessible volatile memory such as SRAM (Static Random Access Memory) or DRAM (Dynamic Random Access Memory). The execution memory 11 in FIG. 1 represents a logical unit. That is, the execution memory 11 may be, for example, a combination of a plurality of SRAM devices, a combination of a plurality of DRAM devices, or a combination of an SRAM device and a DRAM device.
I/Oポート12は、外部デバイスとの間のデータ送受信に使用される。例えば、安全制御装置1がサービスロボットに搭載される場合であれば、外部デバイスは、各種センサ及びサービスロボットを動作させるアクチュエータ等である。この場合、各種センサは、例えば、サービスロボット周囲の障害物を計測可能な視覚センサ、サービスロボットの姿勢を検知するための姿勢センサ、及びサービスロボットのアクチュエータの状態を検知するための回転センタ等のサービスロボットの内外の状態を検出するセンサを含む。
The I /
不揮発性メモリ13は、電力の供給を受けることなく、実行用メモリ11に比べて安定的に記憶内容を維持することが可能なメモリデバイスである。例えば、不揮発性メモリ13は、ROM(Read Only Memory)、フラッシュメモリ、ハードディスクドライブ若しくは光ディスクドライブ、又はこれらの組み合わせである。不揮発性メモリ13は、OS100及びアプリケーション101〜105を格納する。なお、不揮発性メモリ13の少なくとも一部は安全制御装置1から取り外し可能に構成されてもよい。例えば、アプリケーション101〜103が格納されたメモリを取り外し可能としてもよい。また、不揮発性メモリ13の少なくとも一部は、安全制御装置1の外部に配置されてもよい。
The non-volatile memory 13 is a memory device capable of maintaining stored contents more stably than the execution memory 11 without receiving power supply. For example, the nonvolatile memory 13 is a ROM (Read Only Memory), a flash memory, a hard disk drive or an optical disk drive, or a combination thereof. The nonvolatile memory 13 stores the
EEPROM(Electrically Erasable Programmable Read-Only Memory)14は、電力の供給を受けることなく、実行用メモリ11に比べて安定的に記憶内容を維持することが可能なメモリデバイスである。EEPROM14は、アプリケーション101〜103によって、データWrite用アプリケーション104、105を介してログが格納される。EEPROM14は、安全関連アプリケーション101、103(安全関連系タスク)のログが格納される領域と、非安全関連アプリケーション102(非安全関連系タスク)のログが格納される領域とを含む。なお、アプリケーション101〜103によって、ログが格納される記憶装置として、EEPROM14以外に、フラッシュメモリ等のその他の不揮発性メモリを使用するようにしてもよい。また、本実施の形態では、EEPROM14にログが格納される場合について例示するが、EEPROM14に格納されるデータは、ログに限られない。
An EEPROM (Electrically Erasable Programmable Read-Only Memory) 14 is a memory device capable of maintaining stored contents more stably than the execution memory 11 without receiving power supply. In the
OS100は、プロセッサ10によって実行されることにより、プロセッサ10及び実行用メモリ11及び不揮発性メモリ13等のハードウェア資源を利用して、タスクスケジューリングを含むタスク管理、割り込み管理、時間管理、資源管理、タスク間同期およびタスク間通信機構の提供等を行う。
The
さらに、機能安全の確保に関連する安全監視アプリケーション101及び安全制御アプリケーション103の通常制御アプリケーション102からの独立性を高めるため、OS100は、ハードウェア資源を、時間的および空間的に保護する機能を有する。ここで、ハードウェア資源とは、プロセッサ10、実行用メモリ11、I/Oポート12を含む。
Further, in order to increase the independence of the safety monitoring application 101 and the
このうち、時間的な保護は、プロセッサ10の実行時間という時間的な資源をパーティショニングすることにより行う。具体的に述べると、時間的な保護は、プロセッサ10の実行時間をパーティショニングし、各パーティション(タイムパーティションと呼ぶ)にタスク(プロセス又はスレッド)を割り当てることにより行う。OS100のスケジューリング機能(パーティションスケジューラ21)は、各タイムパーティション(以下、TPと略称する場合がある。)に割り当てられたタスクに対して、プロセッサ10の実行時間を含む資源の利用を保証する。
Of these, temporal protection is performed by partitioning a temporal resource called the execution time of the
図2は、タイム・パーティショニングに関する概念図である。図2の例では、予め定められた1サイクル時間を3つのTP1、TP2及びTP3に分割する例を示している。例えば、1サイクル時間を100Tickとした場合、このうち前半の20TickがTP1、中間の30TickがTP2、後半の50TickがTP3と規定される。 FIG. 2 is a conceptual diagram related to time partitioning. In the example of FIG. 2, an example in which a predetermined cycle time is divided into three TP1, TP2, and TP3 is shown. For example, when one cycle time is 100 Tick, the first 20 Tick is defined as TP1, the middle 30 Tick is defined as TP2, and the second 50 Tick is defined as TP3.
また、図2の例では、第1アプリケーション(APL1)〜第4アプリケーション(APL4)が、TP1〜TP3のいずれかに割り当てられている。OS100のスケジューリング機能(パーティションスケジューラ21)は、時間の経過に応じて、TP1〜TP3のいずれをアクティブにするかを選択・決定する。そして、アクティブなTPに割り当てられているアプリケーションが、プロセッサ10で実行される。
In the example of FIG. 2, the first application (APL1) to the fourth application (APL4) are assigned to any one of TP1 to TP3. The scheduling function (partition scheduler 21) of the
一方、空間的な保護は、実行用メモリ11及びI/Oポート12を含む固定的な資源をパーティショニングし、各パーティション(リソースパーティションと呼ぶ)にタスクを割り当てることにより行う。OS100のスケジューリング機能(パーティションスケジューラ21)は、予め割り当てられたリソースパーティション(以下、RPと略称する場合がある。)を超えてタスクが他のリソースにアクセスすることを禁止する。
On the other hand, spatial protection is performed by partitioning fixed resources including the execution memory 11 and the I /
図3は、リソース・パーティショニングに関する概念図である。図3の例では、2つのRP(RP1及びRP2)を示している。RP1には、実行用メモリ11及び不揮発性メモリ13の一部(A領域)と、I/Oポート12の一部(ポートA)が割り当てられている。また、RP2には、実行用メモリ11及び不揮発性メモリ13の他の一部(B領域)と、I/Oポート12の他の一部(ポートB)が割り当てられている。RP1からはRP2に割り当てられたリソースへのアクセスが禁止され、RP2からはRP1に割り当てられたリソースへのアクセスが禁止される。
FIG. 3 is a conceptual diagram related to resource partitioning. In the example of FIG. 3, two RPs (RP1 and RP2) are shown. A part of the execution memory 11 and the nonvolatile memory 13 (A area) and a part of the I / O port 12 (port A) are allocated to RP1. Further, another part (B area) of the execution memory 11 and the nonvolatile memory 13 and another part (port B) of the I /
なお、全てのリソースがいずれかのRPに排他的に割り当てられる必要はない。つまり、複数のRPによって共有されるリソースがあってもよい。例えば、サービスロボットの安全制御を行う場合、アクチュエータには、通常制御アプリケーション102及び安全制御アプリケーション103の双方からアクセスできる必要がある。よって、通常制御アプリケーション102が属するRPと安全制御アプリケーション103が属するRPによって、アクチュエータを制御するためのI/Oポートを共有するとよい。
Note that not all resources need to be exclusively assigned to any RP. That is, there may be a resource shared by a plurality of RPs. For example, when performing safety control of a service robot, the actuator needs to be accessible from both the
図1に戻り説明を続ける。アプリケーション101〜105は、OS100及びプロセッサ10によって提供されるマルチプログラミング環境で実行される。このうち、安全監視アプリケーション101は、通常制御アプリケーション102の実行状況の監視と、安全制御アプリケーション103の実行状況の監視と、I/Oポート12への入出力データの監視と、をプロセッサ10に実行させるための命令コードを含む。さらに、安全監視アプリケーション101は、パーティションスケジューラ21への結果通知をプロセッサ10に実行させるための命令コードを含む。さらに、安全関連アプリケーション101は、ログの生成と、データWrite用アプリケーション105に対するログのEEPROM14への格納の要求と、をプロセッサ10に実行させるための命令コードを含む。つまり、安全監視アプリケーション101は、安全関連アプリケーションである。
Returning to FIG. The applications 101 to 105 are executed in a multiprogramming environment provided by the
また、通常制御アプリケーション102は、サービスロボット等の制御対象に通常の機能・動作を行わせるための制御手順をプロセッサ10に実行させるための命令コードを含む。さらに、通常制御アプリケーション102は、パーティションスケジューラ21への結果通知をプロセッサ10に実行させるための命令コードを含む。さらに、通常制御アプリケーション102は、ログの生成と、データWrite用アプリケーション106に対するログのEEPROM14への格納の要求と、をプロセッサ10に実行させるための命令コードを含む。つまり、通常制御アプリケーション102は、非安全関連アプリケーションである。
Further, the
また、安全制御アプリケーション103は、何らかの異常が検出された場合に対応して、機能安全を確保するために定められた制御手順をプロセッサ10に実行させるための命令コードを含む。さらに、安全制御アプリケーション103は、パーティションスケジューラ21への結果通知をプロセッサ10に実行させるための命令コードを含む。さらに、安全制御アプリケーション103は、ログの生成と、データWrite用アプリケーション105に対するログのEEPROM14への格納の要求と、をプロセッサ10に実行させるための命令コードを含む。つまり、安全制御アプリケーション103は、安全関連アプリケーションである。
Further, the
また、データWrite用アプリケーション105は、安全関連アプリケーション101、103からの要求に応じたログのEEPROM14への格納をプロセッサ10に実行させるための命令コードを含む。
The data write
また、データWrite用アプリケーション106は、非安全関連アプリケーション102からの要求に応じたログのEEPROM14への格納をプロセッサ10に実行させるための命令コードを含む。
Further, the data write application 106 includes an instruction code for causing the
リセット回路15は、OS100からの信号に基づき、マイクロコントローラ20のリセットを行う。パーティションスケジューラ21からリセット回路15に定期的に送信信号を送信するようにし、リセット回路15は、所定の時間の間、パーティションスケジューラ21からの送信信号が途絶えた場合に、マイクロコントローラ20をリセットする。すなわち、リセット回路15は、ウォッチドッグタイマーとして機能する。例えば、パーティションスケジューラ21は、後述するように、1Tickごとに動作するタイミングでリセット回路15に送信信号を送信する。そして、パーティションスケジューラ21は、OS100で異常を検知した場合、又は、アプリケーション101〜103のいずれかから異常を示す結果通知を受けた場合に、リセット回路15への送信信号の送信を停止する。これによって、所定の時間の経過後に、リセット回路15がマイクロコントローラ20をリセットする。
The
また、OS100で異常を検知した場合、又は、アプリケーション101〜105のいずれかから異常を示す結果通知を受けた場合に、パーティションスケジューラ21がリセット回路15にリセット信号を送信するようにして、それに応じて、リセット回路15がマイクロコントローラ20をリセットするようにしてもよい。このようにすることで、マイクロコントローラ20に不具合が発生した場合に、マイクロコントローラ20をリセットして復旧することができる。
Further, when an abnormality is detected by the
続いて以下では、パーティションスケジューラ21と、アプリケーション101〜105の起動により生成されるタスクと、の関係について、図4を用いて説明する。図4は、OS100によって提供されるマルチプログラミング環境で起動される、パーティションスケジューラ21とタスク24、26、28、29、30との関係を示す図である。
Subsequently, the relationship between the
マイクロコントローラ20は、プロセッサ10、実行用メモリ11、I/Oポート12、不揮発性メモリ13等を含む。なお、図4では、マイクロコントローラ20の外部にリセット回路15を備える構成を例示しているが、マイクロコントローラ20の内部にリセット回路15を含む構成としてもよい。
The
マイクロコントローラ20には、外部のクロック源からのクロック信号が供給され、プロセッサ10等は、このクロック信号に基づく所定のタイマー周期で動作する。本実施の形態では、所定のタイマー周期を、1Tickであるとして説明する。このため、プロセッサ10によりOS100が実行されることで、パーティションスケジューラ21が1Tickごとに動作すると共に、各TPにおいて、タスクスケジューラ23、25、27およびタスク(安全監視タスク24、通常制御タスク26、安全制御タスク28、データWrite用タスク29、30)が1Tickごとに動作する。
The
パーティションスケジューラ21は、1Tickごとに動作し、TPの切り替え(パーティション・スケジューリング)を行う。パーティションスケジューラ21は、次の1Tickの間にTP1〜TP3のいずれをアクティブにするかを選択・決定する。さらに、パーティションスケジューラ21は、選択したTPに関するタスクスケジューラの動作を開始させる。
The
パーティションスケジューラ21によるパーティション・スケジューリングについて具体的に述べると、パーティションスケジューラ21は、スケジューリングテーブル22を参照し、TPの設定を定めたスケジューリングパターンに従って、パーティション・スケジューリングを行う。
More specifically, partition scheduling by the
スケジューリングテーブル22は、TPの切り替え順序およびタイミングを規定したスケジューリングパターンを保持している。スケジューリングテーブル22は、例えば、実行用メモリ11に予め格納されている。なお、スケジューリングテーブル22は、少なくとも2つの異なるスケジューリングパターンを保持している。1つは、安全監視タスク24による異常検知が行われていない場合(つまり通常時)に適用されるスケジューリングパターンである。もう1つは、安全監視タスク24によって異常が検知された場合に適用されるスケジューリングパターンである。以下では、通常時に適用されるスケジューリングパターンを"通常制御スケジューリングパターン"と呼ぶ。また、異常検知時に適用されるスケジューリングパターンを"安全制御スケジューリングパターン"と呼ぶ。
The scheduling table 22 holds a scheduling pattern that defines the TP switching order and timing. For example, the scheduling table 22 is stored in advance in the execution memory 11. The scheduling table 22 holds at least two different scheduling patterns. One is a scheduling pattern that is applied when abnormality detection by the
図5Aは、通常制御スケジューリングパターンの具体例を示している。図5Aでは、通常制御タスク26が属するTP2が1サイクル時間の前半(T1)に割り当てられている。また、安全監視タスク24が属するTP1が1サイクル時間の後半(T2)に割り当てられている。図5Aのスケジューリングパターンによれば、通常制御タスク26と安全監視タスク24が繰り返しスケジューリングされる。
FIG. 5A shows a specific example of the normal control scheduling pattern. In FIG. 5A, TP2 to which the normal control task 26 belongs is assigned to the first half (T1) of one cycle time. In addition, TP1 to which the
図5Bは、安全制御スケジューリングパターンの具体例を示している。図5Bでは、安全制御タスク28が属するTP3が1サイクル時間の前半(T3)に割り当てられている。また、安全監視タスク24が属するTP1が1サイクル時間の後半(T4)に割り当てられている。図5Bのスケジューリングパターンによれば、安全制御タスク28と安全監視タスク24が繰り返しスケジューリングされる。
FIG. 5B shows a specific example of the safety control scheduling pattern. In FIG. 5B, TP3 to which the
図4に戻り説明を続ける。タスクスケジューラ23、25、27は、それぞれが属するTP内でのタスクのスケジューリングを行う。各TP内でのタスクのスケジューリングには、一般的な優先度ベースのスケジューリングを適用すればよい。なお、図4では、TP1は3つのタスクを含み、TP2及びTP3はそれぞれ1つのタスクのみを含むものとして図示しているが、それ以外のタスクが含まれるようにしてもよい。例えば、通常制御用のTP2内には、通常制御タスクA及び通常制御タスクBの2つのタスクが含まれていてもよい。 Returning to FIG. The task schedulers 23, 25, and 27 perform task scheduling in the TP to which each belongs. For scheduling tasks in each TP, general priority-based scheduling may be applied. In FIG. 4, TP1 is illustrated as including three tasks, and TP2 and TP3 are illustrated as including only one task, but other tasks may be included. For example, the normal control task A and the normal control task B may be included in the normal control TP2.
安全監視タスク24は、安全監視アプリケーション101の起動によって生成されるタスクである。図4の例では、安全監視タスク24は、TP1及びRP1に割り当てられている。安全監視タスク24は、非安全関連アプリケーションである通常制御タスク26の実行状況の監視と、安全関連アプリケーションである安全制御タスク28の実行状況の監視と、I/Oポート12の入出力データを監視する。さらに、安全監視タスク24は、タスクの実行状況を、パーティションスケジューラ21へ通知する。さらに、安全監視タスク24は、自身の処理に応じたログを生成して、生成したログのEEPROM14への格納をデータWrite用タスク29に要求する。安全監視タスク24は、自身が属するRP1に割り当てられた実行用メモリ11のリソースを使用しながら、自身の処理を実行するために必要な演算等を行う。
The
通常制御タスク26は、通常制御アプリケーション102の起動によって生成されるタスクである。図4の例では、通常制御タスク26は、TP2及びRP2に割り当てられている。通常制御タスク26は、サービスロボット等の制御対象に通常の機能・動作を行わせるための制御を行う。さらに、通常制御タスク26は、タスクの実行状況を、パーティションスケジューラ21へ通知する。さらに、通常制御タスク26は、自身の処理に応じたログを生成して、生成したログのEEPROM14への格納をデータWrite用タスク30に要求する。通常制御タスク26は、自身が属するRP2に割り当てられた実行用メモリ11のリソースを使用しながら、自身の処理を実行するために必要な演算等を行う。
The normal control task 26 is a task generated when the
安全制御タスク28は、安全制御アプリケーション103の起動によって生成されるタスクである。図4の例では、安全制御タスク28は、TP3及びRP3に割り当てられている。安全制御タスク28は、何らかの異常が検出された場合に対応して、機能安全を確保するために定められた制御を行う。さらに、安全制御タスク28は、タスクの実行状況を、パーティションスケジューラ21へ通知する。さらに、安全制御タスク28は、自身の処理に応じたログを生成して、生成したログのEEPROM14への格納をデータWrite用タスク29に要求する。安全制御タスク28は、自身が属するRP3に割り当てられた実行用メモリ11のリソースを使用しながら、自身の処理を実行するために必要な演算等を行う。
The
なお、各タスクからパーティションスケジューラ21へと結果を通知する具体的な構成としては、様々な手法を採用することができる。例えば、タスクがOS100のシステムコール(サービスコール)を呼び出し、OS100を介して、パーティションスケジューラ21に結果を通知することができる。また、例えば、タスクの実行状況に関するフラグを実行用メモリ11に格納するものとして、タスクがその実行状況に応じてフラグの値を設定し、パーティションスケジューラ21がフラグの設定値に応じてタスクの実行状況を判断することもできる。
Various methods can be adopted as a specific configuration for notifying the result from each task to the
上述したように、パーティションスケジューラ21が1Tickごとに動作し、TP1〜TP3のいずれをアクティブにするかを選択・決定する。さらに、パーティションスケジューラ21が、選択したTPに関するタスクスケジューラの動作を開始させる。そして、タスクスケジューラ23、25、27が動作を開始することでタスクのスケジューリングが行われ、プロセッサ10が、タスクスケジューラ23、25、27によりスケジューリングされた順序に従って、TP内でのタスクを実行していく。これによって、アクティブなTPに割り当てられているアプリケーションが、プロセッサ10で実行される。
As described above, the
データWrite用タスク29は、安全関連系タスク24、28からの要求に応じて、安全関連系タスク24、28が生成したログをEEPROM14に格納する。図4の例では、データWrite用タスク29は、TP1及びRP1に割り当てられている。データWrite用タスク29は、自身が属するRP1に割り当てられた実行用メモリ11のリソースを使用しながら、自身の処理を実行するために必要な演算等を行う。
The data write
データWrite用タスク30は、非安全関連系タスク26からの要求に応じて、非安全関連系タスク26が生成したログをEEPROM14に格納する。図4の例では、データWrite用タスク30は、TP1及びRP1に割り当てられている。データWrite用タスク29は、自身が属するRP1に割り当てられた実行用メモリ11のリソースを使用しながら、自身の処理を実行するために必要な演算等を行う。
The data write
ここで、データWrite用タスク29、30が割り当てられるTP及びRPは、図4に例示した場合に限られない。例えば、安全関連のTP1、TP3に限られず、非安全関連のTP2に属するようにしてもよく、データWrite用タスク29、30のみが属するデータWrite用のTPを用意して、それに属するようにしてもよい。なお、常にログの保存を可能とするためには、図5A及び図5Bで例示するTP1のように、通常制御スケジューリングパターン及び安全制御スケジューリングパターンのいずれのスケジューリングパターンにおいても、アクティブとなるTPで動作するようにすることが好ましい。
Here, the TP and RP to which the data write
ここで、各タスク24、26、28は、ログとして、それぞれの処理に応じた内容のデータを生成する。安全監視タスク24は、例えば、上述したような監視における監視内容等を示すデータをログとして生成する。すなわち、監視の結果、何らかの異常が検出された場合には、安全監視タスク24は、その異常原因に関するデータをログとして生成することになる。具体的には、安全監視タスク24は、ログとして、I/Oポート12を介して各種センサから取得したセンサ値及びセンサ値に基づいて算出した値等を生成する。例えば、通常制御タスク26又は安全制御タスク28からI/Oポート12を介して制御対象に対して出力された出力データ値、視覚センサから取得した画像データ、視覚センサから取得した画像データに基づいて算出した障害物までの距離、姿勢センサから取得した制御対象の姿勢を示す値、回転センサから取得した制御対象のアクチュエータの状態を示す値、及び、制御対象又はマイクロコントローラ20における回路の電流値等を示すデータである。また、通常制御タスク26及び安全制御タスク28のそれぞれは、例えば、制御対象に対する出力データの計算内容等を示すデータをログとして生成する。
Here, each of the
ここで、主に、ログに基づいた安全制御装置1の動作・制御状況の調査は、安全制御装置1において何らかの異常が検出された場合に、その異常原因を特定するために行われる。すなわち、安全監視タスク24によって採取されるログは、他のログと比較してEEPROM14に保存する優先度は高い。このように、安全関連系タスク24、28は、異常の検出及び検出した異常に応じた処理等の機能安全を確保するための処理を実行するタスクとなる。そのため、安全関連系タスク24、28が採取するログは、異常原因により強く関連したログとなるため、非安全関連系タスク26が採取するログと比較して、EEPROM14に保存する優先度は高くなる。
Here, the investigation of the operation / control state of the
そこで、本実施の形態では、非安全関連系タスクのログを保存するデータWrite用タスク30よりも、安全関連系タスクのログを保存するデータWrite用タスク29によるログの保存を優先的に行うことで、重要なログがより多く採取されるようにする。
Therefore, in this embodiment, the data write
続いて、図6を参照して、発明の実施の形態にかかる安全関連系タスク24、28及び非安全関連系タスク26と、データWrite用タスク29、30との関係について説明する。図6は、発明の実施の形態にかかる安全関連系タスク24、28及び非安全関連系タスク26と、データWrite用タスク29、30との関係を示す図である。
Next, the relationship between the safety-related
上述したように、OS100は、OS100上で動作するタスクに対してタスク間通信機能を提供する。具体的には、OS100は、OS100上で動作するタスクに対して、タスク間通信を行うためのシステムコールを提供する。
As described above, the
安全関連系タスク24、28は、自身が生成したログをEEPROM14に格納する場合には、ログの格納を要求するログ格納要求データを、タスク間通信によってデータWrite用タスク29に送信する。これは、安全関連系タスクが、ログ格納要求データを引数として指定して、OS100によって提供されるシステムコールを呼び出すことによって行われる。なお、ログ格納要求データには、安全関連系タスクが生成したログと、そのログを格納するEEPROM14のアドレスを示すデータとが含まれる。
When storing the log generated by itself in the
システムコールの呼び出しによって動作するOS100のルーチンは、安全関連系タスクによって指定されたログ格納要求データを、リクエスト用のデータキュー(DTQ)に格納する。すなわち、データキューは、「メッセージキュー」として機能する。なお、データキューは、実行用メモリ11の一部領域を利用して実現される。
The
データWrite用タスク29は、安全関連系タスクから送信されたログ格納要求データを、タスク間通信によって受信する。これは、データWrite用タスク29が、OS100によって提供されるシステムコールを呼び出すことによって行われる。システムコールの呼び出しによって動作するOS100のルーチンは、リクエスト用のデータキューに格納されたログ格納要求データを読み出して、データWrite用タスク29に受け渡す。具体的には、OS100のルーチンは、システムコールの戻り値として、ログ格納要求データを呼び出し元のデータWrite用タスク29に受け渡す。
The data write
データWrite用タスク29は、タスク間通信によって受信したログ格納要求データに含まれるログをEEPROM14に格納する。なお、データWrite用タスク29は、そのログ格納要求データが示すEEPROM14のアドレスにログを格納する。そして、データWrite用タスク29は、EEPROM14へのログの格納結果を通知する結果通知データを、タスク間通信によってログの格納の要求元の安全関連系タスクに送信する。これは、上述と同様に、データWrite用タスク29が、結果通知データを引数として、OS100によって提供されるシステムコールを呼び出すことによって行われる。システムコールの呼び出しによって動作するOS100のルーチンは、データWrite用タスク29によって指定された結果通知データを、レスポンス用のデータキューに格納する。
The data write
安全関連系タスクは、データWrite用タスク29から送信された結果通知データを、タスク間通信によって受信する。これは、上述と同様に、安全関連系タスクが、OS100によって提供されるシステムコールを呼び出すことによって行われる。システムコールの呼び出しによって動作するOS100のルーチンは、レスポンス用のデータキューに格納された結果通知データを読み出して、安全関連系タスクに受け渡す。具体的には、OS100のルーチンは、システムコールの戻り値として、結果通知データを安全関連系タスクに受け渡す。
The safety-related task receives the result notification data transmitted from the data write
なお、非安全関連系タスクからデータWrite用タスク30に対して、ログの格納を要求する場合も、同様にしてタスク間通信によって行われるため、説明を省略する。
Note that when the non-safety related task requests the data write
続いて以下では、パーティションスケジューラ21によるパーティション・スケジューリングについて、図7を用いて説明する。図7は、発明の実施の形態1にかかるパーティションスケジューラ21の処理手順の具体例を示すフローチャートである。
Next, partition scheduling by the
なお、図7では、通常制御スケジューリングパターン(例えば図5A)または安全制御スケジューリングパターン(例えば図5B)に従って、スケジューリングを実行する場合を例に説明する。すなわち、TP2またはTP3に続く次のTPはTP1であり、かつ、TP2での異常がTP1で検知された場合に、TP1からの結果を受けて次に選択・決定されるTPはTP3である場合を例に説明する。 In FIG. 7, a case where scheduling is executed according to a normal control scheduling pattern (for example, FIG. 5A) or a safety control scheduling pattern (for example, FIG. 5B) will be described as an example. That is, when the next TP following TP2 or TP3 is TP1, and when an abnormality in TP2 is detected in TP1, the next TP selected and determined based on the result from TP1 is TP3 Will be described as an example.
OS100は、1Tick経過するごとに(S11)、パーティションスケジューラ21を起動する(S12)。パーティションスケジューラ21は、スケジューリングパターンを参照して、TPの切り替えタイミングか否かを判定する(S13)。
The
TPの切り替えタイミングでないと判定した場合(S13でNo)、パーティションスケジューラ21は、同一のTPXについての動作を継続させる。このため、TPの切り替えタイミングとなるまでの間、S11〜S13、S15、S16の処理が繰り返される。ここで、変数XはTPの番号を示し、Xは1〜3のうちのいずれかの値となる。すなわち、通常制御スケジューリングパターンに従ってパーティション・スケジューリングを実施している場合は、安全制御用のTP3を除いた、TP2及びTP1のいずれかを動作させる。
If it is determined that it is not the TP switching timing (No in S13), the
一方、TPの切り替えタイミングであると判定した場合(S13でYes)、パーティションスケジューラ21は、TPの切り替えを実行する(S14)。このように、パーティションスケジューラ21は、次にアクティブにするTPを変更する(S13でYes)場合には、さらに、切り替え前のTPに属するタスクからの通知結果に応じて、切り替え前のTPが正常であったか否かを判断する。判断の結果、切り替え前のTPが異常であった場合、パーティションスケジューラ21は、次の1Tickの間にアクティブにするTPXを、安全制御スケジューリングパターンに従って、TP1及びTP3のいずれかから選択・決定する。判断の結果、正常であった場合、パーティションスケジューラ21は、次の1Tickの間にアクティブにするTPXを、通常制御スケジューリングパターンに従って、TP1及びTP2のいずれかを選択・決定する。
On the other hand, when it is determined that it is TP switching timing (Yes in S13), the
パーティションスケジューラ21は、現在アクティブになっているTPXのタスクスケジューラを動作させる(S15)。S15で動作を開始したTPXのタスクスケジューラは、TPX内のタスクを優先度に応じて実行する(S16)。
The
そして、1Tickが経過すると(S11)、パーティションスケジューラ21が、再びTPのスケジューリングを開始する(S12)。すなわち、パーティションスケジューラ21は、スケジューリングパターンに従って、次の1Tickの間にいずれのTPをアクティブにするかを選択・決定する。
When 1 Tick elapses (S11), the
図7で示した処理に関して、パーティション・スケジューリングの具体例を説明する。まず、図5Aに例示した通常制御スケジューリングパターンに従って、S15においてTP2がアクティブの状態からスケジューリングを開始した場合を説明する。この場合、S15ではTPX=TP2として開始し、続くS16、S11〜S13にかけてもTPX=TP2のままである。そして、S13でNoが続く限り、TPX=TP2の状態が維持される。S13でYesとなり、S14でTP2からTP1へと変更された場合、続くS15〜S16、S11〜S13にかけてTP1のままである。そして、S13でNoが続く限り、TPX=TP1の状態が維持される。TP1がアクティブのときに、S16で、TP2に関する実行状況(データ入出力等)が正常であると判定されていた場合には、次のS14では、TPX=TP2となる(つまり、TP2から開始する通常制御スケジューリングパターンが継続される。)。一方で、S16で、TP2に関する実行状況(データ入出力等)が異常であると判定されていた場合には、次のS14で、TPX=TP3となる(つまり、TP3から開始する安全制御スケジューリングパターンに切り替わる。)。 A specific example of partition scheduling will be described with respect to the processing shown in FIG. First, according to the normal control scheduling pattern illustrated in FIG. 5A, the case where scheduling is started from the active state of TP2 in S15 will be described. In this case, TPX = TP2 is started in S15, and TPX = TP2 remains even in subsequent S16 and S11 to S13. And as long as No continues in S13, the state of TPX = TP2 is maintained. If S13 is Yes and TP2 is changed to TP1 in S14, TP1 remains in S15 to S16 and S11 to S13. As long as No continues in S13, the state of TPX = TP1 is maintained. When it is determined in S16 that the execution status (data input / output, etc.) related to TP2 is normal when TP1 is active, TPX = TP2 in the next S14 (that is, start from TP2). Normal control scheduling pattern continues.) On the other hand, if it is determined in S16 that the execution status (data input / output, etc.) relating to TP2 is abnormal, TPX = TP3 (that is, a safety control scheduling pattern starting from TP3) in the next S14. Switch to.)
また、図5Bに例示した安全制御スケジューリングパターンに従って、S15においてTP3がアクティブの状態からスケジューリングを開始した場合を説明する。この場合、S15ではTPX=TP3として開始し、続くS16、S11〜S13にかけてもTPX=TP3のままである。そして、S13でNoが続く限り、TPX=TP3の状態が維持される。S13でYesとなり、S14でTP3からTP1へと変更された場合、続くS15〜S16、S11〜S13にかけてTP1のままである。そして、S13でNoが続く限り、TPX=TP1の状態が維持される。TP1がアクティブのときに、S16で、TP3に関する実行状況(データ入出力等)が正常であると判定されていた場合には、次のS14では、TPX=TP2とする(つまり、TP2から開始する通常制御スケジューリングパターンに切り替わる。)。一方で、S16で、TP3に関する実行状況(データ入出力等)に異常があると判定されていた場合には、次のS14で、TPX=TP3となる(つまり、TP3から開始する安全制御スケジューリングパターンが継続される。)。 Further, a case will be described in which scheduling is started from the active state of TP3 in S15 according to the safety control scheduling pattern illustrated in FIG. 5B. In this case, TPX = TP3 is started in S15, and TPX = TP3 remains even in subsequent S16 and S11 to S13. And as long as No continues in S13, the state of TPX = TP3 is maintained. If the answer is Yes in S13 and the TP3 is changed to TP1 in S14, TP1 remains as it is in subsequent S15 to S16 and S11 to S13. As long as No continues in S13, the state of TPX = TP1 is maintained. When it is determined in S16 that the execution status (data input / output, etc.) relating to TP3 is normal when TP1 is active, TPX = TP2 is set in the next S14 (that is, starting from TP2). Switch to normal control scheduling pattern.) On the other hand, if it is determined in S16 that there is an abnormality in the execution status (data input / output, etc.) related to TP3, TPX = TP3 (that is, a safety control scheduling pattern starting from TP3) in the next S14. Will continue.)
なお、上述の例では、スケジューリングパターンとして、3つのTP(安全監視用のTP1、通常制御用のTP2、安全制御用のTP3)のみを組み合わせた場合を例に説明したが、TP2のような通常制御用パーティションや、TP3のような安全制御用パーティションについては、それぞれ複数個存在するものとしてもよい。例えば、2つの通常制御用のTP2及びTP4と、安全監視用のTP1と、2つの安全制御用のTP3及びTP5と、が存在し、これら5つのTP(TP1〜TP5)を組み合わせてスケジューリングパターンを構成してもよい。この場合、S14では、パーティションスケジューラ21が、TPXに関する実行状況(データ入出力等)の異常状態の種類を判定し、その異常種類に応じて、安全制御用のTP3またはTP5のいずれかを選択すればよい。また、S14では、通常制御用のTP2またはTP4のいずれかを選択すればよい。
In the above-described example, a case where only three TPs (safety monitoring TP1, normal control TP2 and safety control TP3) are combined as a scheduling pattern has been described as an example. There may be a plurality of control partitions and safety control partitions such as TP3. For example, there are two TP2 and TP4 for normal control, TP1 for safety monitoring, and two TP3 and TP5 for safety control, and these five TPs (TP1 to TP5) are combined to form a scheduling pattern. It may be configured. In this case, in S14, the
上述したように、本実施の形態では、OS100は、安全監視用のTP1からの通知、または、各TPからの通知に応じて、次にアクティブとするパーティションを選択・決定するパーティションスケジューラ21を備えている。パーティションスケジューラ21は、各TPにおいて実行されるタスクとは独立して、所定のタイマー周期で動作する。
As described above, in this embodiment, the
独立に動作するパーティションスケジューラ21が、全てのTPから結果通知を受ける構成とすることで、パーティションスケジューラ21は、全てのTPに関する状況を一元的に把握することができる。このため、例えば、安全監視用のTP1からの結果通知に応じて、パーティションスケジューラ21が次のパーティションを決定・選択しようとする場合には、パーティションスケジューラ21は、各TPの状況を考慮した上で、正常状態にあるTPのみから次のパーティションを決定・選択することもできる。これによれば、より正確なパーティション・スケジューリングを実現することができるという効果を奏する。
With the configuration in which the
続いて、図8を参照して、本実施の形態にかかるログ格納の処理手順について説明する。図8は、本実施の形態にかかるログ格納の処理手順を示すフローチャートである。 Next, a log storage processing procedure according to this embodiment will be described with reference to FIG. FIG. 8 is a flowchart showing a log storage processing procedure according to the present embodiment.
安全関連系タスクが、EEPROM14へのログの格納を、データWrite用タスク29に対して要求しているか否かを判定する(S21)。ここで、本実施の形態では、安全関連系タスクがEEPROM14へのログの格納を要求しているか否かが判定されるケースとして、2つのケースが存在する。
It is determined whether or not the safety related task requests the data write
1つ目のケースは、データWrite用タスク29が、OS100が提供するシステムコールを呼び出すことによって、スリープして待ち状態となっているときに、OS100によって判定されるケースである。このシステムコールは、呼び出し元のタスクをスリープさせるとともに、呼び出し元のタスクに対するデータがリクエスト用のデータキューに格納されたときに、呼び出し元のタスクを起床させて、実行状態に遷移させる。
The first case is a case in which the data write
したがって、安全関連系タスクがEEPROM14へのログの格納をデータWrite用タスク29に要求している場合(S21:Yes)には、OS100は、タスクスケジューラ23によって、データWrite用タスク29を起床させて、実行状態に遷移させる。実行状態に遷移して動作を開始したデータWrite用タスク29は、上述したログ格納要求データを受信するシステムコールを呼び出して、ログ格納要求データを取得する(S24)。そして、データWrite用タスク29は、取得したログ格納要求データに基づいて、安全関連系タスクのログを格納する処理(S26〜S30)を行う。一方、安全関連系タスクがEEPROM14へのログの格納をデータWrite用タスク29に要求していない場合(S21:No)、OS100は、データWrite用タスク29の待ち状態を継続させるとともに、非安全関連系タスクがEEPROM14へのログの格納を、データWrite用タスク30に対して要求しているか否かを判定する(S22)。
Therefore, when the safety-related task requests the data write
2つ目のケースは、データWrite用タスク29が、実行状態となって動作しており、OS100が提供するシステムコールを呼び出すことによって判定を行うケースである。この判定は、例えば、データWrite用タスク29が、上述したログ格納要求データを受信するシステムコールを呼び出すことによって行う。データWrite用タスク29は、リクエスト用のデータキューにログ格納要求データが格納されており、システムコールの呼び出しによって、そのログ格納要求データを取得することができた場合には、安全関連系タスクがEEPROM14へのログの格納を要求していると判定する(S21:Yes、S24)。一方、データWrite用タスク29は、リクエスト用のデータキューにログ格納要求データが格納されておらず、システムコールの呼び出しによって、ログ格納要求データを取得することができなかった場合には、安全関連系タスクがEEPROM14へのログの格納を要求していないと判定する(S21:No)。すなわち、2つ目のケースでは、データWrite用タスク29が、ポーリングによって、安全関連系タスクがログの格納を要求しているか否かを判定する。
The second case is a case where the data write
安全関連系タスクがEEPROM14へのログの格納を要求している場合(S21:Yes)には、データWrite用タスク29は、取得したログ格納要求データに基づいて、安全関連系タスクのログを格納する処理(S26〜S30)を行う。一方、安全関連系タスクがEEPROM14へのログの格納を要求していない場合(S21:No)、上述したスリープするシステムコールを呼び出して、その実行を終了する。これによって、OS100に制御が移る。そして、OS100は、非安全関連系タスクがEEPROM14へのログの格納を、データWrite用タスク30に対して要求しているか否かを判定する(S22)。
When the safety-related task is requesting storage of the log in the EEPROM 14 (S21: Yes), the data write
ここで、非安全関連系タスクがEEPROM14へのログの格納を要求しているか否かが判定されるケースは、データWrite用タスク30が、上述したスリープするシステムコールを呼び出すことによって、待ち状態となっているときに、OS100によって判定されるケースのみである。
Here, in a case where it is determined whether or not the non-safety related task requests the storage of the log in the
そして、非安全関連系タスクがEEPROM14へのログの格納をデータWrite用タスク30に要求している場合(S22:Yes)には、OS100は、タスクスケジューラ23によって、データWrite用タスク30を起床させて、実行状態に遷移させる。実行状態に遷移して動作を開始したデータWrite用タスク30は、上述したログ格納要求データを受信するシステムコールを呼び出して、ログ格納要求データを取得する(S25)。そして、データWrite用タスク30は、取得したログ格納要求データに基づいて、非安全関連系タスクのログを格納する処理(S26〜S30)を行う。一方、非安全関連系タスクがEEPROM14へのログの格納をデータWrite用タスク30に要求していない場合(S22:No)、OS100は、データWrite用タスク30の待ち状態を継続させる。
When the non-safety related task requests the data write
このようにして、データWrite用タスク29又はデータWrite用タスク30に対して、ログの格納が要求されるまで、待ち合わせが行われる(S23)。この後も、S21及びS22が繰り返され、ログの格納の要求に応じて、ログを格納する処理(S26〜S30)を行うといった処理手順が繰り返される。
In this way, the data write
また、上述したように、先に安全関連系タスクからのログの格納要求を判定し、次に非安全関連系タスクからのログの格納要求が判定されるようにしている。これによれば、安全関連系のログと非安全関連系のログの保存が同時に要求されている場合であっても、優先度の高い安全関連系のログを優先してEEPROM14に格納することができる。これは、データWrite用タスク29を実行する優先度を、データWrite用タスク30よりも高くしておくことで、TP1においてデータWrite用タスク30よりもデータWrite用タスク29が先にスケジューリングされるようにすることで実現する。
Further, as described above, a log storage request from a safety-related task is first determined, and then a log storage request from a non-safety-related task is determined. According to this, even when the safety-related log and the non-safety-related log are requested to be stored at the same time, the safety-related log having a high priority can be preferentially stored in the
ログの格納が要求されたデータWrite用タスクは、ログ格納要求データで指定されるログを格納するアドレスが、許容範囲内か否かを判定する(S26)。具体的には、データWrite用タスクは、指定されたアドレスが、EEPROM14の有効アドレスに収まっているか否かを判定する。さらに、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク30である場合は、指定されたアドレスが、EEPROM14の安全関連系タスク用の領域を指定していないか否かを判定する。
The data write task requested to store the log determines whether the address storing the log specified by the log storage request data is within an allowable range (S26). Specifically, the data write task determines whether or not the designated address falls within the effective address of the
すなわち、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク29であるときは、指定されたアドレスが、EEPROM14の有効アドレスに収まっている場合には、アドレスが許容範囲内であると判定する(S27:Yes)。一方、指定されたアドレスが、EEPROM14の有効アドレスに収まっていない場合には、アドレスが許容範囲内でないと判定する(S27:No)。
That is, when the data write task for which log storage is requested is the data write
また、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク30であるときは、指定されたアドレスが、EEPROM14の有効アドレスに収まっており、かつ、EEPROM14の安全関連系タスク用の領域でない場合(又はEEPROM14の非安全関連系タスク用の領域である場合)には、アドレスが許容範囲内であると判定する(S27:Yes)。一方、指定されたアドレスが、EEPROM14の有効アドレスに収まっていない場合、又は、EEPROM14の安全関連系タスク用の領域である場合(又はEEPROM14の非安全関連系タスク用の領域でない場合)には、アドレスが許容範囲内でないと判定する(S27:No)。
When the data write task for which log storage is requested is the data write
アドレスが許容範囲内でないと判定した場合(S27:No)、データWrite用タスクは、EEPROM14へのログの格納は行わずに、異常を通知する結果通知データを、タスク間通信によって、要求元のタスクに対して送信する(S30)。
When it is determined that the address is not within the allowable range (S27: No), the data write task does not store the log in the
このようにすることで、安全関連系タスク用の領域に格納された、優先度の高い安全関連系タスクのログが、非安全関連系タスクのログで上書きされないようにすることができる。また、これによれば、低コストかつ省スペースで、非安全関連系タスクのログに対する、安全関連系タスクのログの独立性を保証することができる。例えば、安全関連系タスクのログと非安全関連系タスクのログのそれぞれが格納される2つEEPROMと、それぞれのEEPROMに対するデータの格納を処理する2つの処理ルーチン(例えば、ドライバ等)を設けることで、独立性を保証する方法も考えられる。しかしながら、この場合は、2つのEEPROMと、2つの処理ルーチンとを実装する必要があるため、コストが高くなってしまうという問題がある。また、2つのEEPROMを実装するために、実装スペースも消費してしまうという問題もある。それに対して、本実施形態によれば、1つのEEPROM14のみであっても、優先度の高い安全関連系タスクのログの上書きを防止することができる。そのため、低コストかつ省スペースで、ログの独立性を保証することができる。
By doing so, it is possible to prevent the log of the safety-related task having a high priority stored in the area for the safety-related task from being overwritten with the log of the non-safety-related task. Further, according to this, the independence of the safety-related task log with respect to the non-safety-related task log can be ensured at low cost and in a small space. For example, two EEPROMs for storing safety-related task logs and non-safety-related task logs, and two processing routines (for example, drivers) for processing data storage for the respective EEPROMs are provided. A method of guaranteeing independence is also conceivable. However, in this case, since it is necessary to mount two EEPROMs and two processing routines, there is a problem that the cost is increased. Moreover, since two EEPROMs are mounted, there is also a problem that a mounting space is consumed. On the other hand, according to this embodiment, even if only one
なお、上述した説明では、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク29である場合は、指定されたアドレスが、EEPROM14の非安全関連系タスク用の領域を指定していないか否かは判定していない。これよれば、非安全関連系タスクよりも、安全関連系タスクの方が、ログの優先度は高いことから、安全関連系タスク用の領域にログを格納する余裕がなくなった場合に、非安全関連系タスク用の領域にも、安全関連系タスクのログを格納可能となる。
In the above description, when the data write task for which log storage is requested is the data write
また、逆に、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク29である場合であっても、データWrite用タスク30と同様に、指定されたアドレスが、EEPROM14の非安全関連系タスク用の領域を指定していないか否かも判定するようにしてもよい。そのようにすることで、安全関連系タスクのログと、非安全関連系タスクのログとで、より高い独立性を保証するようにしてもよい。
Conversely, even when the data write task for which log storage is requested is the data write
データWrite用タスクから異常を通知する結果通知データを受信したタスクは、異常の通知に応じた処理を実行する。例えば、マイクロコントローラ20をリセットすることによって、復旧を試みるようにしてもよい。具体的には、結果通知データを受信したタスクは、パーティションスケジューラ21に異常を示す結果通知を通知する。そして、パーティションスケジューラ21は、通知に応じて、上述したように、リセット回路15への送信信号の送信を停止して、リセット回路15によってマイクロコントローラ20をリセットさせるようにする。
The task that has received the result notification data for notifying the abnormality from the data write task executes processing according to the abnormality notification. For example, recovery may be attempted by resetting the
また、このときに、マイクロコントローラ20をリセットする前に、パーティションスケジューラ21は、制御対象の安全を担保するために、制御対象を停止させるようにしてもよい。具体的には、図5Aに示す通常制御スケジューリングパターンに従って動作している場合、パーティションスケジューラ21は、スケジューリングパターンを、図5Bに示す安全制御スケジューリングパターンに切り替える。また、パーティションスケジューラ21は、次の動作タイミングで、TPを強制的にTP3に切り替えるようにしてもよい。そして、TP3へ切り替えた後は、例えば、安全制御タスク28によって制御対象を停止させる。また、パーティションスケジューラ21は、タスクの実行状況が異常である旨の通知を安全制御タスク28から通知された場合、パーティションスケジューラ21自身が、制御対象を停止させるように制御するようにしてもよい。
At this time, before resetting the
アドレスが許容範囲内であると判定した場合(S27:Yes)、データWrite用タスクは、ログ格納要求データに含まれるログを、EEPROM14に格納する(S28)。データWrite用タスクは、成功を通知する結果通知データを、タスク間通信によって、要求元のタスクに対して送信する(S29)。 If it is determined that the address is within the allowable range (S27: Yes), the data write task stores the log included in the log storage request data in the EEPROM 14 (S28). The data write task transmits result notification data for notification of success to the requesting task through inter-task communication (S29).
このとき、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク29である場合、データWrite用タスク29は、上述したようにポーリングによって、安全関連系タスクがログの格納を要求しているか否かを判定する(S21)。一方、ログの格納が要求されたデータWrite用タスクが、データWrite用タスク30である場合は、データWrite用タスク30は、上述したように、上述したスリープするシステムコールを呼び出すことによって、待ち状態に遷移する。これによって、OS100によって、安全関連系タスクがログの格納を要求しているか否かが判定される(S21)。
At this time, if the data write task for which log storage is requested is the data write
なお、以上の説明では、EEPROM14にログを格納する場合について例示したが、安全関連系タスク又は非安全関連系タスクがEEPROM14に格納されたデータを読み出す場合についても、同様にして処理を行うようにしてもよい。この場合、安全関連系タスク及び非安全関連系タスクからは、読み出すログが格納されたアドレスが指定された、ログの読み出しを要求するログ読み出しデータを、タスク間通信によって、データWrite用タスク29、30に送信することになる。そして、ログ格納要求データに代えて、ログ読み出しデータに対して、上述した処理が行われることになる。また、データWrite用タスク29、30は、S28ではログの格納に代えて、ログ読み出しデータで指定されるアドレスからログを読み出し、読み出したログを結果通知データに含めて、タスク間通信によって、要求元のタスクに対して送信することになる(S29)。
In the above description, the case where the log is stored in the
続いて、図9を参照して、本実施の形態にかかるログ格納の処理手順の具体例について説明する。図9は、図8を参照して説明した、本実施の形態にかかるログ格納の処理手順による具体的な処理例を示すシーケンス図である。 Next, a specific example of the log storage processing procedure according to the present embodiment will be described with reference to FIG. FIG. 9 is a sequence diagram illustrating a specific processing example according to the log storage processing procedure according to the present embodiment described with reference to FIG. 8.
まず、データWrite用タスク29は、実行状態であり、ミューテックスをロックしており(S41)、データWrite用タスク30は、実行可能状態であるものとする。データWrite用タスク29は、ポーリングによって、データキューからのログ格納要求データを受信できるか否かを確認する(S42)。
First, the data write
データWrite用タスク29は、ログ格納要求データを受信できなかった場合(S43:No)、ミューテックスをアンロックし(S44)、ログ格納要求データを待ち合わせるために待ち状態に遷移する(S45)。一方、データWrite用タスク29は、ログ格納要求データを受信できた場合(S43:Yes)、EEPROM制御処理を実行する(S49)。すなわち、ログをEEPROM14に格納する(S26〜S29)。そして、データWrite用タスク29は、再び、ポーリングによって、データキューからのログ格納要求データを受信できるか否かを確認する(S42)。これによって、安全関連系タスクからのログの格納要求がある場合には、それに応じた安全関連系タスクのログの格納を優先的に連続して実行することができる。
When the log
データWrite用タスク29が待ち状態に遷移した後(S45)、タスクスケジューラ23は、実行可能状態のデータWrite用タスク30を実行状態に遷移させる。ここで、データWrite用タスク30は、例えば、ログの格納を終了した状態であるものとする。データWrite用タスク30は、ログ格納要求データを待ち合わせるために待ち状態に遷移する(S46)。
After the data write
タスクスケジューラ23は、安全関連系タスクによって、データWrite用タスク29に対するログ格納要求データがリクエスト用のデータキューに格納されたとき、データWrite用タスク29を実行状態に遷移させる。実行状態に遷移したデータWrite用タスク29は、データキューからログ格納要求データを受信する(S47)。データWrite用タスク29は、ミューテックスをロックして(S48)、EEPROM制御処理を実行する(S49)。そして、データWrite用タスク29は、再び、データキューからのログ格納要求データを受信できるか否かを確認する(S42)。
When the log storage request data for the data write
一方、データWrite用タスク29が待ち状態に遷移した後に、データWrite用タスク30に対するログ格納要求データがリクエスト用のデータキューに格納されたとき、タスクスケジューラ23は、データWrite用タスク30を実行状態に遷移させる。実行状態に遷移したデータWrite用タスク30は、データキューからログ格納要求データを受信する(S50)。データWrite用タスク30は、ミューテックスをロックして(S51)、EEPROM制御処理を実行する(S52)。そして、データWrite用タスク29は、ミューテックスをアンロックして(S53)、ログ格納要求データを待ち合わせるために待ち状態に遷移する(S46)。
On the other hand, when the log storage request data for the data write
続いて、図10を参照して、本実施の形態にかかるログ格納の処理手順の具体例について説明する。図10は、図8を参照して説明した、本実施の形態にかかるログ格納の処理手順による具体的な処理例を示すシーケンス図である。図10では、図9を参照して説明した処理例とは、異なる例について説明する。 Next, a specific example of the log storage processing procedure according to the present embodiment will be described with reference to FIG. FIG. 10 is a sequence diagram illustrating a specific processing example according to the log storage processing procedure according to the present embodiment described with reference to FIG. 8. In FIG. 10, an example different from the processing example described with reference to FIG. 9 will be described.
まず、データWrite用タスク29とデータWrite用タスク30のそれぞれは、待ち状態であるものとする。データWrite用タスク29に対するログ格納要求データがリクエスト用のデータキューに格納されたとき、タスクスケジューラ23は、データWrite用タスク29を実行状態に遷移させる。実行状態に遷移したデータWrite用タスク29は、データキューからログ格納要求データを受信する(S61)。データWrite用タスク29は、ミューテックスをロックして、EEPROM制御処理を開始する(S63)。
First, it is assumed that each of the data write
ここで、図10に示す例では、データWrite用タスク29がシステムコールを呼び出す等のディスパッチの契機となる処理を行って、ディスパッチが発生したものとする。また、このときに、データWrite用タスク30に対するログ格納要求データがリクエスト用のデータキューに格納されているものとする。この場合、タスクスケジューラ23は、データWrite用タスク29を実行可能状態に遷移させるとともに(S64)、データWrite用タスク30を実行状態に遷移させる。
Here, in the example shown in FIG. 10, it is assumed that the dispatch has occurred by performing processing that triggers dispatch such as the data write
実行状態に遷移したデータWrite用タスク30は、データキューからログ格納要求データを受信する(S65)。データWrite用タスク30は、受信したログ格納要求に応じたEEPROM制御処理を実施するために、ミューテックスをロックする(S66)。しかしながら、すでにデータWrite用タスク29によってミューテックスがロックされているため(S62)、データWrite用タスク30は、ロック待ちとなる。そのため、タスクスケジューラ23は、データWrite用タスク30を待ち状態に遷移させる(S67)。
The data write
それによって、タスクスケジューラ23は、再び、実行可能状態となっている、データWrite用タスク29を実行状態に遷移させる(S67)。実行可能状態となったデータWrite用タスク29は、先ほど中断されたEEPROM制御処理を継続する。そして、データWrite用タスク29は、EEPROM制御処理を終了したとき(S68)、ポーリングによって、データキューからログ格納要求データを受信できるか否かを確認する(S69)。
As a result, the
データWrite用タスク29は、ログ格納要求データを受信できた場合(S70:Yes)、EEPROM制御処理を実行する(S71)。これ以降は、図9を参照して説明したS49以降の処理と同様であるため、説明を省略する。
If the data write
一方、データWrite用タスク29は、ログ格納要求データを受信できなかった場合(S70:No)、ミューテックスをアンロックし(S72)、ログ格納要求データを待ち合わせるために待ち状態に遷移する(S73)。
On the other hand, if the log
データWrite用タスク29が待ち状態に遷移した後は(S45)、データWrite用タスク29によってミューテックスがアンロックされているため(S72)、タスクスケジューラ23は、待ち状態のデータWrite用タスク30を実行状態に遷移させる。データWrite用タスク30は、ミューテックスをロックして(S74)、EEPROM制御処理を実行する(S75)。そして、データWrite用タスク30は、ミューテックスをアンロックして(S76)、ログ格納要求データを待ち合わせるために待ち状態に遷移する(S77)。
After the data write
上述した説明によれば、データWrite用タスク29が、EEPROM14にログを格納する前に、EEPROM14をロックし、EEPROM14にログを格納した後に、EEPROM14をアンロックするようにしている。これによれば、安全関連系のログの格納処理中に、データWrite用タスク29からデータWrite用タスク30へのディスパッチが発生したとしても、安全関連系のログの格納を優先することができる。すなわち、安全関連系のログの保存中に、非安全関連系のログの保存要求があったとしても、安全関連系のログを優先して保存することができる。
According to the above description, the data write
ここで、各タスク24、26、28からのデータWrite用タスク29、30に対して保存を要求するログのサイズが、タスク間通信によって1回で送信可能なサイズを超えている場合には、各タスク24、26、28は、ログを分割して、複数のログ格納要求データに分けて送信する。以下、そのときの処理について、図9及び図10を参照して説明する。
Here, when the size of the log requesting storage to the data write
この場合、データWrite用タスク30は、S50において、複数のログ格納要求データを受信する。これは、上述したログ格納要求データを受信するシステムコールを連続して呼び出すことによって行う。ここで、ログ格納要求データを受信する回数は、最初のログ格納要求データに、ログを何分割して送信したのかを示す情報を含めておくことによって特定可能とする。そして、データWrite用タスク30は、最後のログ格納要求データを受信したときに、ミューテックスをロックする(S51)。そして、受信した複数のログ格納要求データのそれぞれに含まれるログを結合して1つのログとして、EEPROM制御処理(S52)を行う。
In this case, the data write
それに対して、安全関連系タスクのログが分割される場合には、データWrite用タスク29は、最初のログ格納要求データを受信したときに(S47)、ミューテックスをロック(S48)して、後続するログ格納要求データを受信する。そして、データWrite用タスク29も、受信した複数のログ格納要求データのそれぞれに含まれるログを結合して1つのログとして、EEPROM制御処理(S49)を行う。
On the other hand, when the log of the safety-related task is divided, the data write
このようにすることで、データWrite用タスク29が、全てのログ格納要求データを受信するまでに、データWrite用タスク30へのディスパッチが発生してしまった場合であっても、図10に示すように、データWrite用タスク30は、ミューテックスのロック待ちとなり、再び、データWrite用タスク29に制御が戻ることになる。すなわち、安全関連系のログの保存中に、非安全関連系のログの保存要求があったとしても、安全関連系のログを優先して保存することができる。
By doing so, even if dispatch to the data write
また、データWrite用タスク30が、全てのログ格納要求データを受信するまでに、データWrite用タスク29へのディスパッチが発生してしまった場合は、データWrite用タスク30によって、まだミューテックスはロックされていない。そのため、データWrite用タスク29は、ミューテックスをロックして、ログの保存を行うことができる。すなわち、これによれば、非安全関連系のログの保存処理中に、安全関連系のログの保存要求があった場合であっても、安全関連系のログを優先して保存することが可能となる。
Also, if dispatch to the data write
なお、上述した説明では、EEPROM14のロックをかける機構として、ミューテックスを用いた場合について例示したが、これに限られない。EEPROM14のロックをかける機構として、ミューテックス、セマフォ、又はスピンロック等の任意のロック機構を用いてよい。
In the above description, the case where a mutex is used as the mechanism for locking the
以上に説明したように、本実施の形態では、安全関連系のタスクのログを格納したときに、安全関連系のタスクからのデータ格納要求がある場合には、非安全関連系のタスクからのデータ格納要求がある場合であっても、安全関連系のタスクからのデータ格納要求に応じて、EEPROM14に安全関連系のタスクのログを格納するようにしている。これによれば、優先度の高い安全関連系のタスクのログを優先的にEEPROM14に格納することができる。すなわち、特定のタスクのデータを優先して保存することができる。
As described above, in the present embodiment, when a safety-related task log is stored and there is a data storage request from a safety-related task, the non-safety-related task Even when there is a data storage request, a log of the safety-related task is stored in the
ここで、安全関連系のタスクから送信されたデータと非安全関連系のタスクから送信されたデータの両方がデータキューに格納されている場合には、先に送信されたデータが、先に受信されることになる。データキューにおいては、優先度の高い安全関連系のタスクからのデータを先に受信するという待ち合わせの仕方をすることはできない。それに対して、本実施の形態では、データの優先度に応じて別々のデータWrite用タスクを用意して、優先度の高いデータを保存するデータWrite用タスクを優先的に動作させるようにしている。 Here, if both data sent from safety-related tasks and data sent from non-safety-related tasks are stored in the data queue, the data sent first will be received first. Will be. In the data queue, it is not possible to wait for data received from safety-related tasks with high priority first. On the other hand, in the present embodiment, different data write tasks are prepared according to the priority of data, and the data write task for storing high priority data is preferentially operated. .
これによれば、データキュー(タスク間通信)及びマルチタスクの仕組みを利用して、低コストで、優先度の高い安全関連系のタスクのデータを優先して保存することが可能となる。 According to this, it is possible to preferentially store safety-related task data with high priority at a low cost by using a data queue (intertask communication) and a multitask mechanism.
<発明の他の実施の形態>
本実施の形態では、TPのそれぞれに属するタスクが、それぞれ安全監視タスク24、通常制御タスク26、及び安全制御タスク28である場合について例示したが、タスクの種類は、これに限られない。安全監視タスク24、通常制御タスク26及び安全制御タスク28に限られず、その他の制御対象の制御に関する任意の処理を実行するタスクを有するようにしてもよい。
<Other embodiments of the invention>
In the present embodiment, the case where the tasks belonging to each of the TPs are the
例えば、図11に示すようなタスク31〜33を有するようにしてもよい。なお、この場合、安全制御装置は、アプリケーション101〜103に代えて、タスク31〜33に対応するアプリケーションを有する必要があるが、その点は自明であるため図示及び説明を省略する。また、図11では、データWrite用タスク29、30の図示は省略している。
For example, you may make it have the tasks 31-33 as shown in FIG. In this case, the safety control device needs to have an application corresponding to the
監視制御タスク31は、制御対象を制御する。具体的には、監視制御タスク31は、通常制御タスク32及び安全制御タスク33からの指令値に基づいて、制御対象のアクチュエータを制御する。通常制御タスク32は、制御対象に通常の機能・動作を行わせるための制御計算を行う。具体的には、通常制御タスク32は、通常制御におけるアクチュエータの制御計算をして、アクチュエータの指令値を算出する。通常制御タスク32は、算出した指令値を監視制御タスク31に出力する。安全制御タスク33は、機能安全を確保するために定められた制御計算を行う。具体的には、安全制御タスク33は、安全制御におけるアクチュエータの制御計算をして、アクチュエータの指令値を算出する。安全制御タスク33は、算出した指令値を監視制御タスク31に出力する。監視制御タスク31は、通常制御タスク32又は安全制御タスク33から出力された指令値に基づいてアクチュエータを制御する。
The
さらに、監視制御タスク31は、制御対象のセンサから、センサ値を取得する。監視制御タスク31は、取得したセンサ値を通常制御タスク32及び安全制御タスク33に出力する。通常制御タスク32及び安全制御タスク33のそれぞれは、監視制御タスク31から出力されたセンサ値に基づいて、アクチュエータの制御計算を行うようにしてもよい。なお、各タスク31〜33間での指令値及びセンサ値の受け渡しは、タスク間通信で行ってもよく、実行用メモリ11に設けられた、各タスク31〜33で共有してアクセス可能な領域である共有メモリを介して行うようにしてもよい。
Furthermore, the
図11の例では、監視制御タスク31及び安全制御タスク33は、制御対象の監視や、機能安全を確保するために定められた制御計算等のように、制御対象の機能安全の確保に関する処理を実行するタスクとなる。それに対して、通常制御タスク32は、その他の制御対象の制御に関する処理を実行するタスクとなる。そのため、監視制御タスク31及び安全制御タスク33は、安全関連系タスクとなり、通常制御タスク32は、非安全関連系タスクとなる。
In the example of FIG. 11, the
また、その他に、例えば、図12に示すようなタスク34〜36を有するようにしてもよい。なお、この場合、安全制御装置は、アプリケーション101〜103に代えて、タスク34〜36に対応するアプリケーションを有する必要があるが、その点は自明であるため図示及び説明を省略する。また、図12では、データWrite用タスク29、30の図示は省略している。
In addition, for example, you may make it have the tasks 34-36 as shown in FIG. In this case, the safety control device needs to have applications corresponding to the
監視タスク34は、制御対象のセンサから、センサ値を取得する。このセンサには、上述したように制御対象の姿勢を検知するための姿勢センサを含む。ここで説明する例では、制御対象として、人が搭乗することができる走行装置に適用した場合について説明する。この場合、監視タスク34、搭乗者による重心移動を姿勢センサにより検知することができる。監視タスク34は、取得したセンサ値をHMI(Human Machine Interface)タスク36に出力する。
The
HMIタスク36は、監視タスク34から出力されたセンサ値に基づいて、制御対象のアクチュエータの制御計算をして、アクチュエータの指令値を算出する。HMIタスク36は、算出した指令値を制御タスク35に出力する。制御タスク35は、HMIタスク36から出力された指令値に基づいて、アクチュエータを制御する。なお、各タスク34〜36間での指令値及びセンサ値の受け渡しは、タスク間通信で行ってもよく、実行用メモリ11に設けられた、各タスク34〜36で共有してアクセス可能な領域である共有メモリを介して行うようにしてもよい。
Based on the sensor value output from the
図12の例では、監視タスク34、HMIタスク36及び制御タスク35によって、制御対象の監視、それに応じた制御計算、制御計算結果に基づいた制御対象の制御を行うことで、状況によっては制御対象の機能安全の確保に関する処理を実行する。そのため、監視タスク34、HMIタスク36及び制御タスク35のそれぞれは、安全関連系タスクとなる。この場合には、TP1〜TP3以外のTP(図示せず)に属する、その他の制御対象の制御に関する処理を実行するタスクが、非安全関連系タスクとなる。
In the example of FIG. 12, the
ここで、図12において説明した構成によれば、搭乗者の操作に応じて制御対象が制御されるというHMIを実現することができる。例えば、搭乗者が重心を前後に移動させることで制御対象が前後後退を行い、搭乗者が重心を左右に移動させることで制御対象が左右旋回を行うといった制御が可能となる。これについては、実施の形態及び図11によって説明した例についても同様のことが言える。具体的には、安全監視タスク24又は監視制御タスク31が取得したセンサ値に応じて、通常制御タスク26及び安全制御タスク28、もしくは、通常制御タスク32及び安全制御タスク33が同様の制御をすることで、HMIを実現することが可能である。
Here, according to the configuration described with reference to FIG. 12, it is possible to realize an HMI in which a control target is controlled in accordance with a passenger's operation. For example, it is possible to perform control such that the control object moves back and forth when the passenger moves the center of gravity back and forth, and the control object turns left and right when the passenger moves the center of gravity left and right. The same can be said for the example described in the embodiment and FIG. Specifically, the normal control task 26 and the
なお、走行装置として、例えば、立ち乗り方の同軸二輪車とすることもできる。その場合は、アクチュエータを制御することで、車輪が回転動作をすることになる。また、安全制御装置自体も制御対象に搭載される構成としてもよい。 In addition, as a traveling apparatus, it can also be set as the coaxial two-wheeled vehicle of standing up riding. In this case, the wheel rotates by controlling the actuator. Further, the safety control device itself may be mounted on the control target.
さらに、本発明は上述した実施の形態のみに限定されるものではなく、既に述べた本発明の要旨を逸脱しない範囲において種々の変更が可能であることは勿論である。 Furthermore, the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the gist of the present invention described above.
本実施の形態では、OSが、TP1〜TP3を有する場合について例示したが、TPの種類及び数は、これに限られない。スケジューリングパターンについても、本実施の形態に例示したものに限られない。 In the present embodiment, the case where the OS has TP1 to TP3 is illustrated, but the type and number of TPs are not limited to this. The scheduling pattern is not limited to that exemplified in the present embodiment.
本実施の形態では、タスクの数が5つである場合について例示したが、タスクの数は、これに限られない。例えば、本実施の形態では、TPがTP1〜TP3の3つである場合について例示したが、TPの数を3つ以外の数とし、それぞれのTPが任意の数のタスクを有するようにしてもよい。 In the present embodiment, the case where the number of tasks is five is exemplified, but the number of tasks is not limited to this. For example, in the present embodiment, the case where there are three TPs, TP1 to TP3, is exemplified, but the number of TPs may be other than three and each TP may have an arbitrary number of tasks. Good.
本実施の形態では、タイム・パーティショニングを採用したマルチタスクOSについて例示したが、これに限られない。タイム・パーティショニングを採用していないマルチタスクOSに適用することもできる。 In the present embodiment, the multitask OS adopting time partitioning is exemplified, but the present invention is not limited to this. The present invention can also be applied to a multitasking OS that does not employ time partitioning.
本実施の形態では、ログを格納する非安全関連系のタスクと、そのログよりも格納する優先度の高いログを格納する安全関連系のタスクとを実行する場合について例示したが、これに限られない。データを格納するタスクと、そのデータよりも優先度の高いデータを格納するタスクとを実行する情報処理装置であれば、同様にして適用することが可能である。すなわち、本実施の形態において対象となるデータは、ログに限られない。また、異なる優先度のデータを格納するタスク同士であれば、その分類は、安全関連系と非安全関連系とに限られることはない。 In this embodiment, the case of executing a non-safety related task storing a log and a safety related task storing a log having a higher priority than the log is illustrated, but the present invention is not limited thereto. I can't. Any information processing apparatus that executes a task for storing data and a task for storing data having a higher priority than the data can be applied in the same manner. That is, the target data in this embodiment is not limited to a log. Further, as long as tasks store data of different priorities, the classification is not limited to safety-related systems and non-safety-related systems.
1 安全制御装置
10 プロセッサ
11 実行用メモリ
12 I/Oポート
13 不揮発性メモリ
14 EEPROM
15 リセット回路
20 マイクロコントローラ
21 パーティションスケジューラ
22 スケジューリングテーブル
23、25、27 タスクスケジューラ
24 安全監視タスク
26、32 通常制御タスク
28、33 安全制御タスク
29、30 データWrite用タスク
31 監視制御タスク
34 監視タスク
35 制御タスク
36 HMIタスク
100 オペレーティングシステム
101 安全監視アプリケーション
102 通常制御アプリケーション
103 安全制御アプリケーション
104、105 データWrite用アプリケーション
1
15
Claims (10)
前記記憶部に前記第1のデータを格納する第1のタスクと、前記記憶部に前記第2のデータを格納する第2のタスクとをスケジューリングして実行するタスク実行部と、
前記第1のタスクからのデータ格納要求に応じて、前記第1のタスクに代わって前記記憶部に前記第1のデータを格納するとともに、前記第2のタスクからのデータ格納要求に応じて、前記第2のタスクに代わって前記記憶部に前記第2のデータを格納するデータ格納制御と、を備え、
前記データ格納制御部は、前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がある場合には、前記第1のタスクからのデータ格納要求がある場合であっても、前記第2のタスクからのデータ格納要求に応じて、前記記憶部に前記第2のデータを格納する、
情報処理装置。 A storage unit for storing first data and second data having higher priority than the first data;
A task execution unit that schedules and executes a first task that stores the first data in the storage unit and a second task that stores the second data in the storage unit;
In response to a data storage request from the first task, the first data is stored in the storage unit instead of the first task, and in response to a data storage request from the second task, Data storage control for storing the second data in the storage unit instead of the second task,
The data storage control unit, when storing the second data, when there is a data storage request from the second task, there is a data storage request from the first task, In response to a data storage request from the second task, the second data is stored in the storage unit.
Information processing device.
前記第1のデータ書き込みタスクは、前記記憶部に前記第1のデータを格納したときに、前記第1のタスクからのデータ格納要求があるか否かに関わらず、待ち状態に遷移し、
前記第2のデータ書き込みタスクは、前記記憶部に前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がある場合には、待ち状態に遷移せずに、当該データ格納要求に応じて、前記記憶部に前記第2のデータを格納する、
請求項1に記載の情報処理装置。 The task execution unit further includes a first data write task for storing the first data in the storage unit instead of the first task, and a data storage request from the second task, The second data writing task for storing the second data in the storage unit instead of the second task is scheduled and executed, thereby functioning as the data storage control unit,
When the first data write task stores the first data in the storage unit, regardless of whether there is a data storage request from the first task, the first data write task transitions to a wait state,
When the second data write task stores the second data in the storage unit and there is a data storage request from the second task, the second data write task does not transition to a wait state, In response to a storage request, the second data is stored in the storage unit.
The information processing apparatus according to claim 1.
前記第2のデータ書き込みタスクは、前記記憶部に前記第2のデータを格納したときに、前記メッセージキューから前記第2のタスクからのデータ格納要求を受信可能な場合に、待ち状態に遷移せずに、当該データ格納要求に応じて、前記記憶部に前記第2のデータを格納する、
請求項2に記載の情報処理装置。 The data storage request is transmitted via a message queue,
When the second data write task stores the second data in the storage unit and can receive a data storage request from the second task from the message queue, the second data write task shifts to a wait state. Without storing the second data in the storage unit in response to the data storage request,
The information processing apparatus according to claim 2.
請求項2又は3に記載の情報処理装置。 The second data write task has a higher priority than the first data write task;
The information processing apparatus according to claim 2 or 3.
前記第2のデータ書き込みタスクは、前記記憶部に前記第2のデータを格納する前に前記記憶部をロックし、前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がない場合に、前記記憶部をアンロックする、
請求項2乃至4のいずれか1項に記載の情報処理装置。 The first data write task locks the storage unit before storing the first data in the storage unit, and stores the data from the first task when the first data is stored. Regardless of whether there is a request, the storage unit is unlocked,
The second data write task locks the storage unit before storing the second data in the storage unit, and stores the data from the second task when the second data is stored. Unlocking the storage when there is no request;
The information processing apparatus according to any one of claims 2 to 4.
前記第1のタスク及び前記第2のタスクのそれぞれは、1つの前記データ格納要求に前記第1のデータ又は前記第2のデータを含めることができない場合は、当該第1のデータ又は当該第2のデータを複数の前記データ格納要求に分けて送信し、
前記第1のデータ書き込みタスクは、前記複数のデータ格納要求のうち、最後のデータ格納要求を受信したときに、記記憶部をロックし、
前記第2のデータ書き込みタスクは、前記複数のデータ格納要求のうち、最初のデータ格納要求を受信したときに、記記憶部をロックする、
請求項5に記載の情報処理装置。 In the data storage request, the first task or the second task requests the first data write task or the second data write task to store the first data or the second data. Contains data,
When each of the first task and the second task cannot include the first data or the second data in one data storage request, the first data or the second task Are divided into a plurality of the data storage requests and transmitted,
The first data write task locks the storage unit when receiving the last data storage request among the plurality of data storage requests,
The second data write task locks the storage unit when receiving a first data storage request among the plurality of data storage requests.
The information processing apparatus according to claim 5.
前記第1のデータ書き込みタスク及び前記第2のデータ書き込みタスクは、少なくとも同一のタイムパーティションに含まれる、
請求項2乃至6のいずれか1項に記載の情報処理装置。 The task execution unit indicates scheduling contents of a plurality of time partitions including any of the first task, the second task, the first data write task, and the second data write task. Scheduling and executing the first task, the second task, the first data write task, and the second data write task according to scheduling information;
The first data write task and the second data write task are included in at least the same time partition;
The information processing apparatus according to claim 2.
前記データ格納要求は、前記記憶部において、前記第1のデータ又は前記第2のデータを格納するアドレスを示す情報が含まれ、
前記データ格納制御部は、前記第1のタスクからのデータ格納要求で示されるアドレスが、前記第2のデータが格納される領域に含まれる場合には、当該第1のデータ格納要求に応じた前記第1のデータの格納を抑止する、
請求項1乃至7のいずれか1項に記載の情報処理装置。 The storage unit includes an area in which the first data is stored and an area in which the second data is stored,
The data storage request includes information indicating an address for storing the first data or the second data in the storage unit,
The data storage control unit responds to the first data storage request when the address indicated by the data storage request from the first task is included in the area where the second data is stored. Deter storage of the first data;
The information processing apparatus according to any one of claims 1 to 7.
前記第2のタスクは、前記情報処理装置において検出した異常に関するログを前記第2のデータとして格納し、
前記第1のタスクは、その他の前記制御対象の制御に関する処理を実行するとともに、当該処理に関するログを前記第1のデータとして格納する、
請求項1乃至8のいずれか1項に記載の情報処理装置。 The information processing apparatus is a control apparatus that controls a control target,
The second task stores a log relating to an abnormality detected in the information processing apparatus as the second data,
The first task executes processing related to control of the other control target, and stores a log related to the processing as the first data.
The information processing apparatus according to any one of claims 1 to 8.
前記第1のタスクからのデータ格納要求に応じて、前記第1のタスクに代わって前記記憶部に前記第1のデータを格納する第1のデータ格納ステップと、
前記第2のタスクからのデータ格納要求に応じて、前記第2のタスクに代わって前記記憶部に前記第2のデータを格納する第2のデータ格納ステップと、を備え、
前記第2のデータ格納ステップでは、前記第2のデータを格納したときに、前記第2のタスクからのデータ格納要求がある場合には、前記第1のタスクからのデータ格納要求がある場合であっても、前記第2のタスクからのデータ格納要求に応じて、前記記憶部に前記第2のデータを格納する、
データ格納方法。 A first task for storing the first data in a storage unit storing first data and second data having a higher priority than the first data; and An execution start step for scheduling and starting execution of a second task for storing second data;
A first data storage step of storing the first data in the storage unit in place of the first task in response to a data storage request from the first task;
A second data storage step of storing the second data in the storage unit in place of the second task in response to a data storage request from the second task,
In the second data storage step, when there is a data storage request from the second task when the second data is stored, there is a data storage request from the first task. Even if there is, the second data is stored in the storage unit in response to a data storage request from the second task.
Data storage method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012015460A JP5849731B2 (en) | 2012-01-27 | 2012-01-27 | Information processing apparatus and data storage method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012015460A JP5849731B2 (en) | 2012-01-27 | 2012-01-27 | Information processing apparatus and data storage method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2013156744A true JP2013156744A (en) | 2013-08-15 |
JP5849731B2 JP5849731B2 (en) | 2016-02-03 |
Family
ID=49051880
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012015460A Expired - Fee Related JP5849731B2 (en) | 2012-01-27 | 2012-01-27 | Information processing apparatus and data storage method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5849731B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017102647A (en) * | 2015-12-01 | 2017-06-08 | 富士通株式会社 | Information processing apparatus, information processing program, and information processing method |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004078401A (en) * | 2002-08-13 | 2004-03-11 | Hitachi Information Systems Ltd | Log output management integrating system |
-
2012
- 2012-01-27 JP JP2012015460A patent/JP5849731B2/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004078401A (en) * | 2002-08-13 | 2004-03-11 | Hitachi Information Systems Ltd | Log output management integrating system |
Non-Patent Citations (1)
Title |
---|
JPN6015014435; 角田裕,他3名: 'ログの重要度に基づく優先キューイングと集約による無線リンクを考慮したログ転送の効率化' 電子情報通信学会技術研究報告 第109巻,第190号, 20090903, pp.19-24, 社団法人電子情報通信学会 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2017102647A (en) * | 2015-12-01 | 2017-06-08 | 富士通株式会社 | Information processing apparatus, information processing program, and information processing method |
Also Published As
Publication number | Publication date |
---|---|
JP5849731B2 (en) | 2016-02-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5446447B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
US8706265B2 (en) | Safety controller and safety control method | |
US8756606B2 (en) | Safety controller and safety control method in which time partitions are scheduled according to a scheduling pattern | |
JP5321686B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
JP5136693B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
JP5240402B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
JP5834935B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
JP5621857B2 (en) | SAFETY CONTROL DEVICE AND SAFETY CONTROL METHOD | |
JP5664530B2 (en) | Operation check method of control device and memory protection device | |
JP5633501B2 (en) | Control apparatus and control method | |
JP2013140476A (en) | Information processing device, access authority giving method, program generation device, and method therefor | |
JP5849731B2 (en) | Information processing apparatus and data storage method | |
JP5906584B2 (en) | Control apparatus and control method | |
JP5845902B2 (en) | Information processing apparatus and memory access management method | |
JP6004057B2 (en) | Information processing apparatus and DMA controller operation check method | |
JP5811865B2 (en) | Control device and program execution method | |
JP5853716B2 (en) | Information processing apparatus and task control method | |
JP5803689B2 (en) | Information processing apparatus and DMA controller operation check method | |
JP5699910B2 (en) | Control apparatus and control method | |
JP2013109392A (en) | Information processing device and operation confirmation method of memory management device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20140821 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150318 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20150414 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20150513 |
|
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: 20151104 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20151117 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5849731 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
LAPS | Cancellation because of no payment of annual fees |