JP2023074675A - Safety PLC - Google Patents
Safety PLC Download PDFInfo
- Publication number
- JP2023074675A JP2023074675A JP2021187717A JP2021187717A JP2023074675A JP 2023074675 A JP2023074675 A JP 2023074675A JP 2021187717 A JP2021187717 A JP 2021187717A JP 2021187717 A JP2021187717 A JP 2021187717A JP 2023074675 A JP2023074675 A JP 2023074675A
- Authority
- JP
- Japan
- Prior art keywords
- microcomputer
- timer
- time
- predetermined period
- measurement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Safety Devices In Control Systems (AREA)
- Programmable Controllers (AREA)
Abstract
Description
本発明は、安全PLC(Programmable Logic Controller)に関する。 The present invention relates to a safety PLC (Programmable Logic Controller).
従来、外部機器から入力される入力信号の処理をそれぞれ同一のプログラムで同期実行する少なくとも2つのマイコンを有し、一方のマイコンは自身の処理状態を示すデータと他のマイコンの処理状態を示すデータとを比較し、両データが不一致であれば異常があるとして制御対象機器への制御出力を停止する安全PLCがある(特許文献1参照)。 Conventionally, there are at least two microcomputers that synchronously execute processing of an input signal input from an external device with the same program, and one microcomputer has data indicating its own processing state and data indicating the processing state of the other microcomputer. There is a safety PLC that compares the two data and stops the control output to the controlled device if the two data do not match (see Patent Document 1).
ところで、一般に、各マイコンは自身のタイマを用いてウオッチドッグ動作を実行し、タイマの制限時間内に信号が入力されることでタイマをリセットして相手マイコンの処理時間を監視する処置を、周期的に継続して行っている。その際に、各マイコンは、各周期をタイマにより計測し、各周期開始時にマイコン同士でハンドシェイク通信をしてタイマ同期させている。 By the way, in general, each microcomputer executes a watchdog operation using its own timer, and when a signal is input within the time limit of the timer, the timer is reset to monitor the processing time of the other microcomputer. continue to do so. At that time, each microcomputer measures each cycle by a timer, and performs handshake communication between the microcomputers at the start of each cycle to synchronize the timers.
このタイマ同期を詳しく説明すると、まず一方のマイコン(第1マイコンと呼称)がタイマ同期開始を希望するタイミングで、他方のマイコン(第2マイコンと呼称)にハンドシェイク信号を送る。それを受けた第2マイコンは、タイマのゼロリセット及び計測開始(タイマ同期開始)を行うと共に、第1マイコンにハンドシェイク信号を送る。それを受けた第1マイコンは、タイマのゼロリセット及び計測開始(タイマ同期開始)を行う。 To explain this timer synchronization in detail, first, one microcomputer (referred to as the first microcomputer) sends a handshake signal to the other microcomputer (referred to as the second microcomputer) at the timing at which it wishes to start timer synchronization. The second microcomputer receiving it resets the timer to zero and starts measurement (timer synchronization start), and also sends a handshake signal to the first microcomputer. The first microcomputer receiving this resets the timer to zero and starts measurement (timer synchronization start).
しかし、この方法では、タイマ同期開始を希望するタイミングに対して、第1マイコン及び第2マイコンの双方のタイマ同期開始タイミングが、毎周期必ず一定時間遅延することとなる。 However, with this method, the timer synchronization start timings of both the first microcomputer and the second microcomputer are always delayed by a certain period of time with respect to the timing at which timer synchronization is desired.
また、現状のウオッチドッグ動作のタイマは、第1マイコンも第2マイコンも極めて短周期でゼロリセットされるので別制御への併用には向いていない。近年PLCの制御が高度化してきているため、このようなウオッチドッグ動作のためのタイマに、別制御の時間計測への併用可能性を付与することを本願発明者は考案した。 In addition, the current watchdog operation timer is not suitable for use in separate control because both the first microcomputer and the second microcomputer are reset to zero in an extremely short period. Since PLC control has become more sophisticated in recent years, the inventors of the present invention devised the possibility of using a timer for such a watchdog operation in combination with time measurement for another control.
本発明は、上記課題を解決するためになされたものであり、その主たる目的は、安全PLCにおいて、複数のマイコンでのタイマ同期に際し、タイマ同期開始を希望するタイミングから実際のタイマ同期開始タイミングまでの遅延を抑制しつつ、少なくとも1つのタイマに別制御の時間計測への併用可能性を付与することにある。 The present invention has been made to solve the above problems, and its main purpose is to provide a safety PLC in which, when synchronizing the timers of a plurality of microcomputers, the timing from the timing at which timer synchronization is desired to the actual timer synchronization start timing is controlled. To provide at least one timer with the possibility of being used together for time measurement of another control while suppressing the delay of .
上記課題を解決するための第1の手段は、
第1マイコン及び第2マイコンを含む二重化回路を備える安全PLCであって、
前記第1マイコンは、第1タイマを備え、前記第1タイマにより計測した第1時間が第1所定周期である場合に、同期信号を前記第2マイコンへ送信するとともに前記第1タイマをゼロリセットして計測を開始することを繰り返し、
前記第2マイコンは、第2タイマを備え、前記第2タイマにより計測した第2時間が前記第1所定周期よりも長い第2所定周期を超えて且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットして計測を開始することを繰り返し、
前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続し、且つ前記第2タイマによる計測開始から前記同期信号を受信した回数に前記第1所定周期を掛けた中間目標時間と前記第2時間とが等しいとみなせるか否かに基づいて、前記第1マイコン及び前記第2マイコンが正常であるか否か判定する。
The first means for solving the above problems is
A safety PLC comprising a redundant circuit including a first microcomputer and a second microcomputer,
The first microcomputer has a first timer, and transmits a synchronization signal to the second microcomputer and resets the first timer to zero when the first time measured by the first timer is a first predetermined period. to start measurement,
The second microcomputer has a second timer, and the second time measured by the second timer exceeds a second predetermined period longer than the first predetermined period and receives the synchronization signal from the first microcomputer. In the case, repeat resetting the second timer to zero and starting measurement,
The second microcomputer performs measurement by the second timer without resetting the second timer to zero when the second time does not exceed the second predetermined period and the synchronization signal is received from the first microcomputer. Based on whether the intermediate target time obtained by multiplying the number of times the synchronization signal is received from the start of measurement by the second timer by the first predetermined period can be regarded as equal to the second time. It is determined whether or not the first microcomputer and the second microcomputer are normal.
上記構成によれば、安全PLCは、第1マイコン及び第2マイコンを含む二重化回路を備えている。このため、第1マイコン及び第2マイコンの一方が故障した場合であっても、他方によりプログラム等を実行することができ、安全PLCの安全性を確保することができる。 According to the above configuration, the safety PLC has a redundant circuit including the first microcomputer and the second microcomputer. Therefore, even if one of the first microcomputer and the second microcomputer fails, the other can execute a program or the like, and the safety of the safety PLC can be ensured.
前記第1マイコンは、第1タイマを備え、前記第1タイマにより計測した第1時間が第1所定周期である場合に、同期信号を前記第2マイコンへ送信するとともに前記第1タイマをゼロリセットして計測を開始することを繰り返す。このため、第1所定周期毎に第1マイコンから第2マイコンへ、ウオッチドッグ動作及びタイマ同期に用いる同期信号を送信することができる。前記第2マイコンは、第2タイマを備え、前記第2タイマにより計測した第2時間が前記第1所定周期よりも長い第2所定周期を超えて且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットして計測を開始することを繰り返す。このため、第1所定周期がウオッチドッグ動作用に短く設定されていても、第1所定周期よりも長い任意の第2所定周期まで、第2タイマにより時間を計測することが可能となる。したがって、第2タイマに別制御の時間計測への併用可能性を付与することができる。 The first microcomputer has a first timer, and transmits a synchronization signal to the second microcomputer and resets the first timer to zero when the first time measured by the first timer is a first predetermined period. to start measurement. Therefore, the synchronization signal used for the watchdog operation and timer synchronization can be transmitted from the first microcomputer to the second microcomputer every first predetermined period. The second microcomputer has a second timer, and the second time measured by the second timer exceeds a second predetermined period longer than the first predetermined period and receives the synchronization signal from the first microcomputer. In this case, resetting the second timer to zero and starting measurement are repeated. Therefore, even if the first predetermined period is set short for the watchdog operation, the second timer can measure time up to an arbitrary second predetermined period longer than the first predetermined period. Therefore, the second timer can be given the possibility of being used together for time measurement of another control.
さらに、第1マイコンが同期信号を第2マイコンへ送信した時に第1タイマのゼロリセット及び計測開始(タイマ同期開始)が行われ、第2時間が第2所定周期を超えて第2マイコンが同期信号を受信した時に第2タイマのゼロリセット及び計測開始(タイマ同期開始)が行われる。このため、タイマ同期開始を希望するタイミング(第1マイコンによる同期信号の送信タイミング)から実際のタイマ同期開始タイミング(第2マイコンによる同期信号の受信タイミング)までの遅延を、第2所定周期の開始から終了までに、第2所定周期の開始時に第2マイコンに生じる1回のみにすることができる。したがって、タイマ同期開始を希望するタイミングに対して第1マイコン及び第2マイコンの双方のタイマ同期開始タイミングが第1所定周期毎に必ず一定時間遅延する従来技術と比較して、タイマ同期開始を希望するタイミングから実際のタイマ同期開始タイミングまでの遅延を大幅に抑制することができる。 Furthermore, when the first microcomputer transmits a synchronization signal to the second microcomputer, the first timer is reset to zero and measurement is started (timer synchronization is started), and when the second time exceeds the second predetermined period, the second microcomputer is synchronized. When the signal is received, the second timer is reset to zero and measurement is started (timer synchronization is started). For this reason, the delay from the timing at which timer synchronization is desired (timing for transmitting the synchronization signal by the first microcomputer) to the actual timing for starting timer synchronization (timing for receiving the synchronization signal by the second microcomputer) is set to the start of the second predetermined cycle. to end can be only one time, which occurs in the second microcomputer at the beginning of the second predetermined period. Therefore, compared to the conventional technology in which the timer synchronization start timings of both the first microcomputer and the second microcomputer are always delayed by a certain period of time with respect to the desired timer synchronization start timing, the timer synchronization start is desired. It is possible to greatly reduce the delay from the timing to start timer synchronization to the actual timer synchronization start timing.
しかも、前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続し、且つ前記第2タイマによる計測開始から前記同期信号を受信した回数に前記第1所定周期を掛けた中間目標時間と前記第2時間とが等しいとみなせるか否かに基づいて、前記第1マイコン及び前記第2マイコンが正常であるか否か判定する。ここで、前記第1マイコン及び前記第2マイコンの一方でも異常が生じると、前記第2タイマによる計測開始から前記同期信号を受信した回数に前記第1所定周期を掛けた中間目標時間と前記第2時間とが等しいとみなせなくなる。したがって、第2所定周期の中間においても第1所定周期毎に、前記第1マイコン及び前記第2マイコンの双方が正常であるか否か判定することができ、すなわちウオッチドッグ動作を実行することができる。 Moreover, the second microcomputer does not reset the second timer to zero when the second time does not exceed the second predetermined period and the synchronization signal is received from the first microcomputer. Based on whether or not the intermediate target time obtained by continuing measurement and multiplying the number of times the synchronization signal is received from the start of measurement by the second timer by the first predetermined period and the second time can be considered equal, It is determined whether or not the first microcomputer and the second microcomputer are normal. Here, if an abnormality occurs in either one of the first microcomputer and the second microcomputer, an intermediate target time obtained by multiplying the number of times the synchronization signal is received from the start of measurement by the second timer by the first predetermined period and the second microcomputer 2 hours can no longer be considered equal. Therefore, it is possible to determine whether or not both the first microcomputer and the second microcomputer are normal at each first predetermined cycle even in the middle of the second predetermined cycle, that is, to execute the watchdog operation. can.
第2の手段では、
前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記中間目標時間と前記第2時間との差の絶対値が第1所定値よりも小さければ、前記中間目標時間と前記第2時間とが等しいとみなせるとし、前記差の絶対値が前記第1所定値よりも大きければ、前記中間目標時間と前記第2時間とが等しいとみなせないとし、
前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記差の絶対値が前記第1所定値よりも小さい第2所定値よりも小さければ、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続し、前記差の絶対値が前記第2所定値よりも大きく且つ前記第1所定値よりも小さければ、前記第2時間を前記中間目標時間に優先的に修正して前記第2タイマによる計測を継続する、請求項1に記載の安全PLC。
In a second way,
When the second time does not exceed the second predetermined period and the synchronization signal is received from the first microcomputer, the second microcomputer determines that the absolute value of the difference between the intermediate target time and the second time is If it is smaller than the first predetermined value, the intermediate target time and the second time can be regarded as equal, and if the absolute value of the difference is larger than the first predetermined value, the intermediate target time and the second time cannot be considered equal, and
The second microcomputer, when the second period does not exceed the second predetermined period and receives the synchronization signal from the first microcomputer, provides a second microcomputer in which the absolute value of the difference is smaller than the first predetermined value. If it is smaller than the predetermined value, the measurement by the second timer is continued without resetting the second timer to zero, and if the absolute value of the difference is larger than the second predetermined value and smaller than the first predetermined value 2. The safety PLC according to
上記構成によれば、第2マイコンは、第2所定周期の中間において前記中間目標時間と前記第2時間との差の絶対値が第1所定値よりも小さければ、前記中間目標時間と前記第2時間とが等しいとみなせるとして、第1マイコン及び第2マイコンが正常であると判定する。一方、第2マイコンは、第2所定周期の中間において前記差の絶対値が前記第1所定値よりも大きければ、前記中間目標時間と前記第2時間とが等しいとみなせないとして、第1マイコン及び第2マイコンの少なくとも一方が正常でないと判定する。 According to the above configuration, if the absolute value of the difference between the intermediate target time and the second time in the middle of the second predetermined period is smaller than the first predetermined value, the second microcomputer determines the intermediate target time and the second time. It is determined that the first microcomputer and the second microcomputer are normal, assuming that two hours are equal. On the other hand, if the absolute value of the difference is greater than the first predetermined value in the middle of the second predetermined cycle, the second microcomputer determines that the intermediate target time and the second time cannot be considered equal. and at least one of the second microcomputer is not normal.
ここで、第2タイマによる計測時間は、第2所定周期を超えるまでゼロリセットされない。このため、第1マイコン及び第2マイコンが正常であっても、第2所定周期の間に第1タイマによる計測時間と第2タイマによる計測時間とのずれが積算され、第1マイコン及び第2マイコンの少なくとも一方が正常でないと誤判定されるおそれがある。 Here, the time measured by the second timer is not reset to zero until the second predetermined cycle is exceeded. Therefore, even if the first microcomputer and the second microcomputer are normal, the difference between the time measured by the first timer and the time measured by the second timer is accumulated during the second predetermined period, and the first microcomputer and the second microcomputer At least one of the microcomputers may be erroneously determined to be abnormal.
この点、前記第2マイコンは、第2所定周期の中間において前記差の絶対値が前記第1所定値よりも小さい第2所定値よりも小さければ、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続する。一方、前記第2マイコンは、第2所定周期の中間において前記差の絶対値が前記第2所定値よりも大きく且つ前記第1所定値よりも小さければ、前記第2時間を前記中間目標時間に優先的に修正して前記第2タイマによる計測を継続する。このため、第1マイコン及び第2マイコンが正常であると判定した場合であっても、前記中間目標時間と前記第2時間との差の絶対値が第2所定値よりも大きければ、第1タイマに基づいて第2タイマの計測時間を修正することができる。 In this regard, the second microcomputer does not reset the second timer to zero if the absolute value of the difference is smaller than a second predetermined value smaller than the first predetermined value in the middle of the second predetermined period. 2 Continue the measurement by the timer. On the other hand, if the absolute value of the difference is larger than the second predetermined value and smaller than the first predetermined value in the middle of the second predetermined period, the second microcomputer adjusts the second time to the intermediate target time. Correction is given priority and the measurement by the second timer is continued. Therefore, even if it is determined that the first microcomputer and the second microcomputer are normal, if the absolute value of the difference between the intermediate target time and the second time is greater than the second predetermined value, the first The measurement time of the second timer can be corrected based on the timer.
第3の手段では、前記第2マイコンは、前記第1マイコンによる前記同期信号の送信タイミングから前記第2マイコンによる前記同期信号の受信タイミングまでの遅れ時間を予め取得し、前記第2タイマをゼロリセットしてから前記第2タイマにより計測された時間に前記遅れ時間を足した時間を前記第2時間とする。こうした構成によれば、第2マイコンのタイマ同期開始タイミングを、実質的にタイマ同期開始を希望するタイミング(第1マイコンによる同期信号の送信タイミング)に一致させることができる。したがって、タイマ同期開始を希望するタイミングから実際のタイマ同期開始タイミングまでの遅延をさらに抑制することができる。 In the third means, the second microcomputer obtains in advance a delay time from the transmission timing of the synchronization signal by the first microcomputer to the reception timing of the synchronization signal by the second microcomputer, and sets the second timer to zero. A time obtained by adding the delay time to the time measured by the second timer after resetting is defined as the second time. According to such a configuration, the timer synchronization start timing of the second microcomputer can substantially match the desired timing of timer synchronization start (transmission timing of the synchronization signal by the first microcomputer). Therefore, it is possible to further reduce the delay from the timing at which timer synchronization is desired to the timing at which timer synchronization is actually started.
以下、安全PLCに具現化した一実施形態について、図面を参照しつつ説明する。 An embodiment embodied in a safety PLC will be described below with reference to the drawings.
図1に示すように、安全PLC100は、安全入力機器30から信号を入力し、入力した信号に基づいてプログラムを実行して、実行結果に基づいて制御対象機器40へ信号を出力する。安全入力機器30は、例えば非常停止ボタン、安全ドアスイッチ、セーフティセンサ等である。制御対象機器40は、例えばロボット、工作機械、バルブ、モータ等である。
As shown in FIG. 1, the
安全PLC100は、第1マイコン10、第1水晶発振子18、第2マイコン20、第2水晶発振子28等を備えている。第1水晶発振子18及び第2水晶発振子28は、共通の所定周波数でクロック信号を発信する。ただし、第1水晶発振子18と第2水晶発振子28との精度の違いから、第1水晶発振子18のクロック信号の周波数と第2水晶発振子28のクロック信号の周波数とに僅かなずれが存在する。
The
第1マイコン10は、第1タイマ11、メモリ12、CPU13、シリアル通信ポートUART、GPIO(General Purpose Input/Output)ポート等を備えている。
The
第1タイマ11は、第1水晶発振子18からのクロック信号に基づいて時間を計測する。以後、第1タイマ11により計測した時間を第1時間Tm1という。第1タイマ11の計測開始、リセット等は、CPU13により制御される。
The
メモリ12は、CPU13により実行する各種プログラムや、データ等を記憶する。各種プログラムは、第1マイコン10と第2マイコン20とが共通で実行する所定プログラムと、それ以外のプログラムとを含んでいる。プログラムは、一纏まりの命令(処理)であるタスクを複数含んでいる。
The memory 12 stores various programs executed by the
CPU13は、第1水晶発振子18からのクロック信号により動作する。CPU13は、メモリ12に記憶された各種プログラムを実行する。すなわち、CPU13(第1マイコン10)は、上記所定プログラムに含まれる各タスクを実行する。第1マイコン10は、安全入力機器30から入力された信号を処理し、その処理結果に基づいて制御対象機器40への信号を作成する。
The
第2マイコン20も、第1マイコン10と同様の構成を備えており、第1マイコン10と同様のタスクを実行する。すなわち、安全PLC100は、第1マイコン10及び第2マイコン20を含む二重化回路を備えている。
The
安全PLC100は、第1マイコン10が作成した信号と第2マイコン20が作成した信号とが一致する場合に、その信号を制御対象機器40へ出力する。一方、安全PLC100は、第1マイコン10が作成した信号と第2マイコン20が作成した信号とが一致しない場合に、異常を検知し、所定のフェールセーフ処理を実行する。所定のフェールセーフ処理は、例えばロボットへの電力供給を停止する等の処理である。
When the signal created by the
まず、図4を参照して、比較例の各信号及び各タイマ11,21の計測時間について説明する。
First, referring to FIG. 4, each signal and the measurement time of each
第1マイコン10及び第2マイコン20は、第1所定周期Pd1毎にGPIOハンドシェイクを実行する。具体的には、第1マイコン10及び第2マイコン20は、第1所定周期Pd1毎にGPIOポートを介してハンドシェイク信号を送受信して、それぞれ第1タイマ11及び第2タイマ21をゼロリセットしてそれらによる計測を開始する。第1所定周期Pd1は、ウオッチドッグ動作における各タイマ11,21の上限値に対応して設定されており、例えば100[μs]である。マイコン10,20は、ウオッチドッグ動作の上限値に達するまでに、ハンドシェイク信号を受信しなかった場合に異常を検知する。
The
また、CPU13,23は、各第1所定周期Pd1において、所定プログラムに含まれる同一のタスクの処理をそれぞれ実行する。そして、CPU13,23は、各第1所定周期Pd1において所定のタイミングで、シリアル通信ポートUARTを介して、互いに実行した処理の履歴を交換する。CPU13,23は、履歴が一致しない場合に異常を検知し、所定のフェールセーフ処理を実行する。
Also, the
図5は、比較例の各タイマ11,21の同期態様を示すタイムチャートである。
FIG. 5 is a time chart showing how the
第1マイコン10は、タイマ同期開始を希望するタイミングt21において、GPIOポートを介してハンドシェイク信号を第2マイコン20へ送信する。第2マイコン20は、タイミングt21から遅れ時間Δt1後のタイミングt22において、GPIOポートを介してハンドシェイク信号を受信する。
The
第2マイコン20は、ハンドシェイク信号を受信すると、第2タイマ21をゼロリセットして計測を開始するとともに、GPIOポートを介してハンドシェイク信号を第1マイコン10へ送信する。第1マイコン10は、タイミングt21から遅れ時間Δt2後のタイミングt23において、GPIOポートを介してハンドシェイク信号を受信する。第1マイコン10は、ハンドシェイク信号を受信すると、第1タイマ11をゼロリセットして計測を開始する。
Upon receiving the handshake signal, the
このように比較例では、タイマ同期開始を希望するタイミングt21に対して、第2タイマ21の同期開始タイミング(t22)は遅れ時間Δt1だけ遅れ、第1タイマ11の同期開始タイミング(t23)は遅れ時間Δt2だけ遅れる。しかも、これらの同期開始タイミングの遅れは、第1所定周期Pd1の開始時に毎回生じる。
Thus, in the comparative example, the synchronization start timing (t22) of the
そこで、本実施形態では、以下のように各タイマ11,21の同期を実行する。図2は、各信号及び各タイマ11,21の計測時間を示すタイムチャートである。なお、ここでは、説明の簡便化のために、第2タイマ21をゼロリセットする第2所定周期Pd2を、第1所定周期Pd1の2倍にした例を示している。第2所定周期Pd2は、第1所定周期Pd1の何万倍や、何億倍(任意の倍数)に設定することもできる。なお、第2所定周期Pd2は、第1所定周期Pd1の何万倍や、何億倍に所定値を加減した値に設定することもできる。
Therefore, in this embodiment, the
第1マイコン10は、第1所定周期Pd1毎に第2マイコン20へ一方的に指示をする。具体的には、第1マイコン10は、第1所定周期Pd1毎にGPIOポートを介して同期信号Syを送信するとともに、第1タイマ11をゼロリセットして計測を開始する。第1所定周期Pd1は、上記比較例と同様に設定されている。第2マイコン20は、第2所定周期Pd2の中間において、同期信号Syを受信した場合に第2タイマ21をゼロリセットせず第2タイマ21による計測を継続する。第2マイコン20は、同期信号Syを受信した回数nに第1所定周期Pd1を掛けた中間目標時間T(n)と第2タイマ21による計測時間とが等しいとみなせるか否か判定する(T(n)=n×Pd1)。第2マイコン20は、中間目標時間T(n)と第2タイマ21による計測時間とが等しいとみなせないと判定した場合に異常を検知する。
The
また、CPU13,23は、各第1所定周期Pd1において、所定プログラムに含まれる同一のタスクの処理をそれぞれ実行する。そして、CPU13,23は、各第1所定周期Pd1において所定のタイミングで、シリアル通信ポートUARTを介して、互いに実行した処理の履歴を交換する。CPU13,23は、履歴が一致しない場合に異常を検知し、所定のフェールセーフ処理を実行する。
Also, the
図3は、各タイマ11,21の同期態様を示すタイムチャートである。
FIG. 3 is a time chart showing how the
第1マイコン10は、タイマ同期開始を希望するタイミングt11において、GPIOポートを介して同期信号Syを第2マイコン20へ送信する。第2マイコン20は、タイミングt21から遅れ時間Δt1後のタイミングt12において、GPIOポートを介して同期信号Syを受信する。第2マイコン20は、同期信号Syを受信すると、第2タイマ21をゼロリセットして計測を開始する。なお、タイミングt12において、第2タイマ21により計測した時間(以下、「第2時間Tm2」という)が、第2所定周期Pd2を超えているとする。
The
第1マイコン10は、次にタイマ同期開始を希望するタイミングt13において、GPIOポートを介して同期信号Syを第2マイコン20へ送信する。第2マイコン20は、タイミングt13から遅れ時間Δt1後のタイミングt14において、GPIOポートを介して同期信号Syを受信する。
The
第2マイコン20は、第2時間Tm2が第2所定周期Pd2を超えず且つ第1マイコン10から同期信号Syを受信した場合に、第2タイマ21をゼロリセットせず第2タイマ21による計測を継続する。さらに、第2マイコン20は、第2タイマ21による計測開始(タイミングt12)から同期信号Syを受信した回数n(ここではn=1)に第1所定周期Pd1を掛けた中間目標時間T(n)と第2時間Tm2とが等しいとみなせるか否かに基づいて、第1マイコン10及び第2マイコン20が正常であるか否か判定する。
When the second time Tm2 does not exceed the second predetermined period Pd2 and the synchronization signal Sy is received from the
詳しくは、第2マイコン20は、中間目標時間T(n)と第2時間Tm2との差の絶対値(|T(n)-Tm2|)が第1所定値Tr1よりも小さければ、中間目標時間T(n)と第2時間Tm2とが等しいとみなせるとする。第2マイコン20は、|T(n)-Tm2|が第1所定値Tr1よりも大きければ、中間目標時間T(n)と第2時間Tm2とが等しいとみなせないとする。
Specifically, if the absolute value of the difference (|T(n)-Tm2|) between the intermediate target time T(n) and the second time Tm2 is smaller than the first predetermined value Tr1, the
第2マイコン20は、中間目標時間T(n)と第2時間Tm2とが等しいとみなせる場合に、第1マイコン10及び第2マイコン20の双方が正常であると判定する。第2マイコン20は、中間目標時間T(n)と第2時間Tm2とが等しいとみなせない場合に、第1マイコン10及び第2マイコン20の少なくとも一方が異常であると判定する。
The
第1マイコン10は、次にタイマ同期開始を希望するタイミングt15において、GPIOポートを介して同期信号Syを第2マイコン20へ送信する。第2マイコン20は、タイミングt15から遅れ時間Δt1後のタイミングt16において、GPIOポートを介して同期信号Syを受信する。タイミングt16において、第2時間Tm2は第2所定周期Pd2を超えている。このため、第2マイコン20は、第2タイマ21をゼロリセットして計測を開始する。
The
以上詳述した本実施形態は、以下の利点を有する。 The embodiment detailed above has the following advantages.
・第1マイコン10は、第1タイマ11を備え、第1タイマ11により計測した第1時間Tm1が第1所定周期Pd1である場合に、同期信号Syを第2マイコン20へ送信するとともに第1タイマ11をゼロリセットして計測を開始することを繰り返す。このため、第1所定周期Pd1毎に第1マイコン10から第2マイコン20へ、ウオッチドッグ動作及びタイマ同期に用いる同期信号Syを送信することができる。第2マイコン20は、第2タイマ21を備え、第2タイマ21により計測した第2時間Tm2が第1所定周期Pd1よりも長い第2所定周期Pd2を超えて且つ第1マイコン10から同期信号Syを受信した場合に、第2タイマ21をゼロリセットして計測を開始することを繰り返す。このため、第1所定周期Pd1がウオッチドッグ動作用に短く設定されていても、第1所定周期Pd1よりも長い任意の第2所定周期Pd2まで、第2タイマ21により時間を計測することが可能となる。したがって、第2タイマ21に別制御の時間計測への併用可能性を付与することができる。なお、第1所定周期Pd1はウオッチドッグ動作用に短く設定されているため、別制御の時間計測への併用は困難である。
The
・第1マイコン10が同期信号Syを第2マイコン20へ送信した時に第1タイマ11のゼロリセット及び計測開始(タイマ同期開始)が行われ、第2時間Tm2が第2所定周期Pd2を超えて第2マイコン20が同期信号Syを受信した時に第2タイマ21のゼロリセット及び計測開始(タイマ同期開始)が行われる。このため、タイマ同期開始を希望するタイミング(第1マイコン10による同期信号Syの送信タイミング)から実際のタイマ同期開始タイミング(第2マイコン20による同期信号Syの受信タイミング)までの遅延を、第2所定周期Pd2の開始から終了までに、第2所定周期Pd2の開始時に第2マイコン20に生じる1回のみにすることができる。したがって、タイマ同期開始を希望するタイミングに対して第1マイコン10及び第2マイコン20の双方のタイマ同期開始タイミングが第1所定周期Pd1毎に必ず一定時間遅延する従来技術と比較して、タイマ同期開始を希望するタイミングから実際のタイマ同期開始タイミングまでの遅延を大幅に抑制することができる。
・When the
・第2マイコン20は、第2時間Tm2が第2所定周期Pd2を超えず且つ第1マイコン10から同期信号Syを受信した場合に、第2タイマ21をゼロリセットせず第2タイマ21による計測を継続し、且つ第2タイマ21による計測開始から同期信号Syを受信した回数nに第1所定周期Pd1を掛けた中間目標時間T(n)と第2時間Tm2とが等しいとみなせるか否かに基づいて、第1マイコン10及び第2マイコン20が正常であるか否か判定する。ここで、第1マイコン10及び第2マイコン20の一方でも異常が生じると、第2タイマ21による計測開始から同期信号Syを受信した回数nに第1所定周期Pd1を掛けた中間目標時間T(n)と第2時間Tm2とが等しいとみなせなくなる。したがって、第2所定周期Pd2の中間においても第1所定周期Pd1毎に、第1マイコン10及び第2マイコン20の双方が正常であるか否か判定することができ、すなわちウオッチドッグ動作を実行することができる。
When the second time Tm2 does not exceed the second predetermined period Pd2 and the synchronization signal Sy is received from the
なお、上記実施形態を、以下のように変更して実施することもできる。上記実施形態と同一の部分については、同一の符号を付すことにより説明を省略する。 It should be noted that the above embodiment can be modified as follows. Parts that are the same as those in the above embodiment are denoted by the same reference numerals, and descriptions thereof are omitted.
・第2マイコン20は、第2時間Tm2が第2所定周期Pd2を超えず且つ第1マイコン10から同期信号Syを受信した場合に、中間目標時間T(n)と第2時間Tm2との差の絶対値(|T(n)-Tm2|)が第1所定値Tr1よりも小さい第2所定値Tr2よりも小さければ、第2タイマ21をゼロリセットせず第2タイマ21による計測を継続し、|T(n)-Tm2|が第2所定値Tr2よりも大きく且つ第1所定値Tr1よりも小さければ、第2時間Tm2を中間目標時間T(n)に優先的に修正して第2タイマ21による計測を継続してもよい。
The
ここで、第2タイマ21による計測時間は、第2所定周期Pd2を超えるまでゼロリセットされない。このため、第1マイコン10及び第2マイコン20が正常であっても、第2所定周期Pd2の間に第1タイマ11による計測時間(第1時間Tm1)と第2タイマ21による計測時間(第2時間Tm2)とのずれが積算され、第1マイコン10及び第2マイコン20の少なくとも一方が正常でないと誤判定されるおそれがある。
Here, the time measured by the
この点、第2マイコン20は、第2所定周期Pd2の中間において|T(n)-Tm2|が第1所定値Tr1よりも小さい第2所定値Tr2よりも小さければ、第2タイマ21をゼロリセットせず第2タイマ21による計測を継続する。一方、第2マイコン20は、第2所定周期Pd2の中間において|T(n)-Tm2|が第2所定値Tr2よりも大きく且つ第1所定値Tr1よりも小さければ、第2時間Tm2を中間目標時間T(n)に優先的に修正して第2タイマ21による計測を継続する。このため、第1マイコン10及び第2マイコン20が正常であると判定した場合であっても、|T(n)-Tm2|が第2所定値Tr2よりも大きければ、第1タイマ11に基づいて第2タイマ21の計測時間を修正することができる。
In this regard, the
なお、中間目標時間T(n)と第2時間Tm2との差の絶対値(|T(n)-Tm2|)に代えて、中間目標時間T(n)と第2時間Tm2との比(T(n)/Tm2)を用いることもできる。その場合は、|T(n)-Tm2|が第1所定値Tr1よりも小さいか否かに代えて、T(n)/Tm2が1よりも小さい第3所定値Tr3よりも大きく、且つT(n)/Tm2が1よりも大きい第4所定値Tr4よりも小さいか否か判定すればよい。また、|T(n)-Tm2|が第2所定値Tr2よりも小さいか否かに代えて、T(n)/Tm2が、1よりも小さく且つ第3所定値Tr3よりも大きい第5所定値Tr5よりも大きく、且つT(n)/Tm2が、1よりも大きく且つ第4所定値Tr4よりも小さい第6所定値Tr6よりも小さいか否か判定すればよい。 Instead of the absolute value of the difference between the intermediate target time T(n) and the second time Tm2 (|T(n)-Tm2|), the ratio T(n)/Tm2) can also be used. In that case, instead of determining whether |T(n)-Tm2| It is only necessary to determine whether (n)/Tm2 is smaller than a fourth predetermined value Tr4 greater than one. is smaller than the second predetermined value Tr2, T(n)/Tm2 is smaller than 1 and greater than the third predetermined value Tr3. It may be determined whether T(n)/Tm2 is larger than the value Tr5 and smaller than a sixth predetermined value Tr6 which is larger than 1 and smaller than the fourth predetermined value Tr4.
・第2マイコン20は、第1マイコン10による同期信号Syの送信タイミングから第2マイコン20による同期信号Syの受信タイミングまでの遅れ時間Δt1を予め取得し、第2タイマ21をゼロリセットしてから第2タイマ21により計測された時間に遅れ時間Δt1を足した時間を第2時間Tm2とすることもできる。なお、遅れ時間Δt1は、予め試験等に基づいて取得しておくことができる。こうした構成によれば、第2時間Tm2は、タイミングt11から第2タイマ21により計測を開始した場合の計測時間と等しくなる。このため、第2マイコン20のタイマ同期開始タイミングを、実質的にタイマ同期開始を希望するタイミングT1(第1マイコン10による同期信号Syの送信タイミング)に一致させることができる。したがって、タイマ同期開始を希望するタイミングT1から実際のタイマ同期開始タイミングまでの遅延をさらに抑制することができる。
・The
・安全PLC100は、第2マイコン20と同様の機能を有する第3マイコン、第4マイコン等を備えていてもよい。
- The
なお、上記の各変更例を組み合わせて実施することもできる。 It should be noted that it is also possible to implement a combination of the above modified examples.
10…第1マイコン、11…第1タイマ、20…第2マイコン、21…第2タイマ、100…安全PLC。 10... First microcomputer, 11... First timer, 20... Second microcomputer, 21... Second timer, 100... Safety PLC.
Claims (3)
前記第1マイコンは、第1タイマを備え、前記第1タイマにより計測した第1時間が第1所定周期である場合に、同期信号を前記第2マイコンへ送信するとともに前記第1タイマをゼロリセットして計測を開始することを繰り返し、
前記第2マイコンは、第2タイマを備え、前記第2タイマにより計測した第2時間が前記第1所定周期よりも長い第2所定周期を超えて且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットして計測を開始することを繰り返し、
前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続し、且つ前記第2タイマによる計測開始から前記同期信号を受信した回数に前記第1所定周期を掛けた中間目標時間と前記第2時間とが等しいとみなせるか否かに基づいて、前記第1マイコン及び前記第2マイコンが正常であるか否か判定する、安全PLC。 A safety PLC comprising a redundant circuit including a first microcomputer and a second microcomputer,
The first microcomputer has a first timer, and transmits a synchronization signal to the second microcomputer and resets the first timer to zero when the first time measured by the first timer is a first predetermined period. to start measurement,
The second microcomputer has a second timer, and the second time measured by the second timer exceeds a second predetermined period longer than the first predetermined period and receives the synchronization signal from the first microcomputer. In the case, repeat resetting the second timer to zero and starting measurement,
The second microcomputer performs measurement by the second timer without resetting the second timer to zero when the second time does not exceed the second predetermined period and the synchronization signal is received from the first microcomputer. Based on whether the intermediate target time obtained by multiplying the number of times the synchronization signal is received from the start of measurement by the second timer by the first predetermined period can be regarded as equal to the second time. A safety PLC that determines whether the first microcomputer and the second microcomputer are normal.
前記第2マイコンは、前記第2時間が前記第2所定周期を超えず且つ前記第1マイコンから前記同期信号を受信した場合に、前記差の絶対値が前記第1所定値よりも小さい第2所定値よりも小さければ、前記第2タイマをゼロリセットせず前記第2タイマによる計測を継続し、前記差の絶対値が前記第2所定値よりも大きく且つ前記第1所定値よりも小さければ、前記第2時間を前記中間目標時間に優先的に修正して前記第2タイマによる計測を継続する、請求項1に記載の安全PLC。 When the second time does not exceed the second predetermined period and the synchronization signal is received from the first microcomputer, the second microcomputer determines that the absolute value of the difference between the intermediate target time and the second time is If it is smaller than the first predetermined value, the intermediate target time and the second time can be regarded as equal, and if the absolute value of the difference is larger than the first predetermined value, the intermediate target time and the second time cannot be considered equal, and
The second microcomputer, when the second period does not exceed the second predetermined period and receives the synchronization signal from the first microcomputer, provides a second microcomputer in which the absolute value of the difference is smaller than the first predetermined value. If it is smaller than the predetermined value, the measurement by the second timer is continued without resetting the second timer to zero, and if the absolute value of the difference is larger than the second predetermined value and smaller than the first predetermined value 2. The safety PLC according to claim 1, wherein said second time is preferentially corrected to said intermediate target time and measurement by said second timer is continued.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021187717A JP2023074675A (en) | 2021-11-18 | 2021-11-18 | Safety PLC |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021187717A JP2023074675A (en) | 2021-11-18 | 2021-11-18 | Safety PLC |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2023074675A true JP2023074675A (en) | 2023-05-30 |
Family
ID=86541313
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2021187717A Pending JP2023074675A (en) | 2021-11-18 | 2021-11-18 | Safety PLC |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2023074675A (en) |
-
2021
- 2021-11-18 JP JP2021187717A patent/JP2023074675A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3026515B1 (en) | Programmable controller system | |
WO2021035867A1 (en) | Redundancy control method for main and standby controllers | |
JP2011257889A (en) | Safety control system | |
US11307553B2 (en) | Control device and control method | |
JP2011199420A (en) | Ring-shape synchronous network system | |
CA2530149C (en) | Starting control method, duplex platform system, and information processor | |
JP2023074675A (en) | Safety PLC | |
US8060769B2 (en) | Duplexed field controller | |
JP2003296133A (en) | Controller | |
JP4616054B2 (en) | Measuring system | |
US11137794B2 (en) | Systems and methods for synchronization of multiple processors | |
JP2013033374A (en) | Distributed monitoring control system | |
TW202137728A (en) | Communication device, communication system, communication method and program | |
JP6722055B2 (en) | Process synchronization control system and process synchronization control method | |
JP2018106513A (en) | Detection device | |
JP6377659B2 (en) | Semiconductor device and control method thereof | |
JP6357806B2 (en) | Controller redundancy system, its controller | |
JP2014157386A (en) | Data processing system | |
JPH08305664A (en) | Method and device for cpu monitoring | |
JPH08305611A (en) | Cpu monitoring method and device | |
JP2011234212A (en) | Task control device | |
JP2020067685A (en) | Computer system | |
JPH07141307A (en) | Synchronizing circuit of multiprocessor system | |
JP4290067B2 (en) | Data synchronization method and program for serial communication system | |
EP3814868A1 (en) | Precision timing between systems |