JP2010244213A - Programmable controller, program execution monitoring method, and program - Google Patents

Programmable controller, program execution monitoring method, and program Download PDF

Info

Publication number
JP2010244213A
JP2010244213A JP2009090549A JP2009090549A JP2010244213A JP 2010244213 A JP2010244213 A JP 2010244213A JP 2009090549 A JP2009090549 A JP 2009090549A JP 2009090549 A JP2009090549 A JP 2009090549A JP 2010244213 A JP2010244213 A JP 2010244213A
Authority
JP
Japan
Prior art keywords
execution
verification code
program
verification
programmable controller
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
Application number
JP2009090549A
Other languages
Japanese (ja)
Other versions
JP5515374B2 (en
Inventor
Motoharu Suzuki
元治 鈴木
Masayasu Kumagai
正康 熊谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Electric Systems Co Ltd filed Critical Fuji Electric Systems Co Ltd
Priority to JP2009090549A priority Critical patent/JP5515374B2/en
Publication of JP2010244213A publication Critical patent/JP2010244213A/en
Application granted granted Critical
Publication of JP5515374B2 publication Critical patent/JP5515374B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Hardware Redundancy (AREA)
  • Debugging And Monitoring (AREA)
  • Programmable Controllers (AREA)
  • Testing And Monitoring For Control Systems (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a programmable controller, a program execution monitoring method and a program by which the middle lapse of program execution can be verified even when this programmable controller is configured of hardware or software whose execution channels are different with a small memory quantity in a short time. <P>SOLUTION: Execution programs 26-1 and 26-2 including instructions to call a verification code generation routine are generated from a ladder figure 24. When the execution programs 26-1 and 26-2 are executed by an execution channel, a verification code is generated, and stored in a verification code storage area 22. Those verification codes are verified, so that it is possible to verify whether the execution programs 26-1 and 26-2 have been normally executed. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、プログラマブルコントローラに関し、更に詳しくはプログラマブルコントローラのプログラム実行を監視する技術に関する。   The present invention relates to a programmable controller, and more particularly to a technique for monitoring program execution of a programmable controller.

プログラマブルコントローラにおいては、プログラムが想定どおりの順序で実行されたか、そして正しく演算結果を算出したかを調べ、正常にプログラムが実行されているかを診断することが行われている。   In a programmable controller, it is checked whether a program has been executed in an expected order and whether a calculation result has been correctly calculated, and diagnosed whether the program is being executed normally.

特にCPUの多重化等の冗長化構成を持つプログラマブルコントローラにおいては、想定どおりの順序で実行されたか、そして演算結果が正しいかを診断をする技術が必要となる。   In particular, in a programmable controller having a redundant configuration such as multiplexing of CPUs, a technique for diagnosing whether the processing is executed in an expected order and whether the calculation result is correct is required.

プログラム実行の診断としては、最も単純な技術としては、ウォッチドッグタイマーによって実行時間を監視する方法が一般に知られている。例えば、特許文献1には、ウォッチドッグタイマーによりCPUに割り込みをかけることによって、暴走を監視するプログラマブルコントローラが開示されている。   As the simplest technique for diagnosing program execution, a method of monitoring execution time by a watchdog timer is generally known. For example, Patent Literature 1 discloses a programmable controller that monitors runaway by interrupting the CPU with a watchdog timer.

また特許文献2には、ウォッチドックタイマーを用いない監視を行うものとして、状態遷移時間を基準となる時間と比較することによって監視を行うプログラマブルコントローラが開示されている。   Patent Document 2 discloses a programmable controller that performs monitoring by comparing a state transition time with a reference time as monitoring without using a watchdog timer.

また特許文献3には、ウォッチドックタイマーを用いない監視方法として、プログラムにチェックプログラムを記載し、このチェックプログラムによってRAM内の値をインクリメントして書き込んでゆき、またRAMに書き込まれた数値が正常であるかをチェックすることによって暴走を検出する方法が開示されている。   In Patent Document 3, as a monitoring method that does not use the watchdog timer, a check program is described in the program, the value in the RAM is incremented and written by this check program, and the numerical value written in the RAM is normal. A method of detecting a runaway by checking whether or not is disclosed.

またその他の診断技術としては、プログラム内の実行通過ポイントをトレースメモリに記憶してゆき、このトレースメモリの内容を照合することによって診断を行う方法が知られている。   As another diagnostic technique, there is known a method of performing diagnosis by storing execution passage points in a program in a trace memory and collating the contents of the trace memory.

特開平6−250864号公報JP-A-6-250864 特開平5−313711号公報JP-A-5-313711 特開平6−324914号公報JP-A-6-324914

しかしながら上記した各監視方法には、以下の問題点がある。
特許文献1等のウォッチドッグタイマーによるプログラム実行監視方法では、プログラムスタートを示す命令の実行からプログラムエンドを示す命令の実行までが、規定の時間内に終了できたかを確認できる。しかし、プログラマブルコントローラが多重化構成を有していた場合、途中経過を調べて複数の実行チャネルにおいて等しく同じプログラム実行をできたかを検証することはできない。
However, each monitoring method described above has the following problems.
In the program execution monitoring method using the watchdog timer disclosed in Patent Document 1 or the like, it can be confirmed whether the execution from the execution of the instruction indicating the program start to the execution of the instruction indicating the program end can be completed within a specified time. However, when the programmable controller has a multiplexed configuration, it is not possible to verify whether the same program has been executed equally in a plurality of execution channels by checking the progress of the process.

また特許文献2の方法では、あらかじめ基準となる実行時間等の設定を行う必要があり、また状態遷移時間や基準時間を記憶するために用いるメモリ資源を必要とする。
更に特許文献3の方法では、実行プログラムがシーケンシャルなものである場合はチェックが可能である。しかし実行プログラムが単純なシーケンスプログラムである場合の適用に制限され、実行プログラムが分岐やループを含みダイナミックに実行先が変化する場合には向かない。
In the method of Patent Document 2, it is necessary to set a reference execution time or the like in advance, and memory resources used for storing the state transition time and the reference time are required.
Furthermore, in the method of Patent Document 3, if the execution program is sequential, it can be checked. However, the application is limited to the case where the execution program is a simple sequence program, and is not suitable when the execution program dynamically changes the execution destination including branches and loops.

そしてこれら特許文献1乃至3の方法はすべて単一の実行チャネルを備える構成の場合の監視、診断を行う技術である。
また実行プログラムの実行通過ポイントをトレースメモリに蓄積し、そのデータを照合することによって実行監視を行う方法は、途中経過の照合が可能となるが、トレースメモリの全内容を他の実行チャネルに転送してから各実行チャネル内で比較照合されるため、処理時間がかかる。また、実行プログラムのサイズが大きくなるほど、その分トレースメモリの容量や、処理時間もそれだけ長くかかる。例えば、1ポイントあたり2バイトであるとき、1000ポイント格納可能なトレースメモリは約2キロバイトの容量を必要とする。
The methods of Patent Documents 1 to 3 are all techniques for monitoring and diagnosing in the case of a configuration having a single execution channel.
Also, the execution monitoring method by accumulating execution pass points of the execution program in the trace memory and collating the data makes it possible to collate the progress, but transfer the entire contents of the trace memory to other execution channels. Then, since the comparison is made within each execution channel, processing time is required. Further, the larger the size of the execution program, the longer the trace memory capacity and the processing time. For example, when there are 2 bytes per point, a trace memory capable of storing 1000 points requires a capacity of about 2 kilobytes.

また冗長化を持たせたプログラマブルコントローラの複数の実行チャネルを全く同じハードウエア、同じ動作クロック、同じソフトウエアで構成し、実行チャネル間を完全に同期して動作させて、各実行チャネルからのハードウエア信号をモニタして相違発生時を以って異常とする方法もある。しかし機能安全に関する国際標準規格であるIEC61508に規定されている機能安全向け電子機器においては、同一のハードウエアによる系統的障害の影響を極力避けるための方策として、構成要素にハードウエア的あるいはソフトウエア処理方式的に違いを持たせる多様性(ダイバシティ)を持たせることが推奨されている。そのため、この構成を同じにして同期を取る方法では当規格を満たすことができない。   In addition, multiple execution channels of a programmable controller with redundancy are configured with exactly the same hardware, the same operation clock, and the same software, and the execution channels are operated in complete synchronization, and the hardware from each execution channel is configured. There is also a method in which a wear signal is monitored to make an abnormality when a difference occurs. However, in an electronic device for functional safety defined in IEC 61508, which is an international standard for functional safety, as a measure for avoiding the influence of systematic failure due to the same hardware as much as possible, hardware or software is used as a component. It is recommended to have diversity (diversity) that makes a difference in processing method. For this reason, this standard cannot be satisfied by a method of synchronizing with this configuration.

上記を鑑み本発明では、少ないメモリ量で、短い時間内に、また実行チャネルが異なるハードウエアやソフトウエアで構成されていても、プログラム実行の途中経過の検証が可能なプログラマブルコントローラを提供することを課題とする。   In view of the above, the present invention provides a programmable controller capable of verifying the progress of program execution even with a small amount of memory, within a short period of time, and even if the execution channel is composed of different hardware and software. Is an issue.

本発明のプログラマブルコントローラは、実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおいて、前記複数の実行チャネルは、当該実行チャネルにおいて前記実行プログラムが正常に実行されたかを検証するための検証コードを格納する検証コード格納部を備え、前記実行チャネルから呼び出され、前記検証コードを生成する検証コード生成ルーチンを格納する検証コード生成ルーチン格納領域と、を備えることを特徴とする。   The programmable controller of the present invention is a programmable controller comprising a plurality of execution channels for executing an execution program in parallel. The plurality of execution channels are verified for verifying whether the execution program has been normally executed in the execution channel. A verification code storage unit for storing a code, and a verification code generation routine storage area for storing a verification code generation routine that is called from the execution channel and generates the verification code.

本発明のプログラム実行監視方法は、実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおけるプログラム実行監視方法において、前記並列に実行される複数の前記実行プログラムから、当該実行プログラムが正常に実行されたかを検証するための検証コードを生成する検証コード生成ルーチンを呼び出し、当該検証コードを前記実行チャネル毎に備える検証コード格納領域に格納し、前記複数の実行チャネルそれぞれの前記検証コード格納領域内の検証コードを照合することによって前記実行プログラムが正常に実行されたかを検証する、ことを特徴とする。   The program execution monitoring method of the present invention is a program execution monitoring method in a programmable controller having a plurality of execution channels for executing an execution program in parallel. Call a verification code generation routine for generating a verification code for verifying whether or not it has been executed, store the verification code in a verification code storage area provided for each of the execution channels, and store the verification code storage area of each of the plurality of execution channels It is characterized by verifying whether the said execution program was normally executed by collating the verification code in this.

本発明によるプログラムは、実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおいて実行されるプログラムであって、前記実行プログラムから呼び出され、当該実行プログラムから引き渡されたパラメータ値及び当該検証コードを前記実行チャネル毎に設けられた検証コード格納領域内の値を用いて当該実行プログラムが正常に実行されたかを検証するための検証コードを生成し、当該検証コードを前記検証コード格納領域に格納する、ことを前記プログラマブルコントローラに実行させることを特徴とする。   The program according to the present invention is a program executed in a programmable controller having a plurality of execution channels for executing an execution program in parallel, and is called from the execution program and passed from the execution program and the verification code Is generated using a value in a verification code storage area provided for each execution channel, and a verification code for verifying whether the execution program has been executed normally is generated, and the verification code is stored in the verification code storage area And causing the programmable controller to execute.

本発明によれば、実行プログラムの実行に伴って検証コードを算出していくため、実行プログラムポイント、実行順序が実行チャネル間で、もし異なっていた場合には、異なる検証コードとなり照合によって異常の検出を行うことが出来る。   According to the present invention, since the verification code is calculated along with the execution of the execution program, if the execution program point and the execution order are different among the execution channels, the verification code becomes a different verification code and an error is detected by collation. Detection can be performed.

また検証コード生成ルーチンへのパラメータに、実行プログラムの演算結果を用いていた場合には実行順序のほかに演算結果の同一性もチェックすることが出来る。
さらに検証コードはサブルーチン内で算出されるので、実行チャネルのハードウエア、ソフトウエア処理方式には依存性がない。
また、検証コードに必要なメモリサイズも小さく、照合に要する時間も短い。
In addition, when the result of the execution program is used as a parameter for the verification code generation routine, it is possible to check the identity of the operation result in addition to the execution order.
Furthermore, since the verification code is calculated within the subroutine, there is no dependency on the hardware and software processing method of the execution channel.
Also, the memory size required for the verification code is small, and the time required for verification is short.

本実施形態におけるプログラマブルコントローラシステムの全体構成を示す図である。It is a figure showing the whole programmable controller system composition in this embodiment. ラダー図の例を示す図である。It is a figure which shows the example of a ladder diagram. 従来のプログラマブルコントローラで実行される実行プログラムの例を示す図である。It is a figure which shows the example of the execution program run with the conventional programmable controller. 本実施形態の実行プログラム生成部によって生成される実行プログラムの第1の例を示す図である。It is a figure which shows the 1st example of the execution program produced | generated by the execution program production | generation part of this embodiment. 本実施形態の実行プログラム生成部によって生成される実行プログラムの第2の例を示す図である。It is a figure which shows the 2nd example of the execution program produced | generated by the execution program production | generation part of this embodiment. 本実施形態の実行制御部が実行プログラムを実行した際の動作処理を示すフローチャートである。It is a flowchart which shows the operation | movement process at the time of the execution control part of this embodiment executing an execution program. 検証コード生成ルーチンの第1の動作例を示す図である。It is a figure which shows the 1st operation example of a verification code generation routine. 検証コード生成ルーチンの第2の動作例を示す図である。It is a figure which shows the 2nd operation example of a verification code generation routine.

本実施形態のプログラマブルコントローラでは、プログラム生成装置においてユーザがプログラマブルコントローラ用の言語で作成したプログラム(例えば、ラダー図)をコントローラが実行する実行プログラムに変換する際に、各実行チャネルで正常に実行プログラムを実行したかを検証するのに用いる検証コードを生成するルーチンをコールするコードを挿入する。   In the programmable controller of the present embodiment, when a program (for example, a ladder diagram) created by a user in the language for the programmable controller in the program generation device is converted into an execution program executed by the controller, the execution program is normally executed in each execution channel. Insert code that calls a routine that generates the verification code used to verify whether

そしてこの実行プログラムを実行するコントローラの各実行チャネルでは、それぞれに対応したプログラムを実行すると自己のメモリに検証コードが記録される。そして各実行チャネルは、実行プログラムによる動作を完了すると記録された検証コードを互いに比較し、両者が一致したときのみ処理を継続し、両者が一致しないときは機能安全エラー処理を行う。   In each execution channel of the controller that executes this execution program, the verification code is recorded in its own memory when the corresponding program is executed. Then, each execution channel compares the recorded verification codes with each other when the operation by the execution program is completed, and continues the process only when both match, and performs the functional safety error process when both do not match.

これにより、プログラマブルコントローラの機能安全のエラーチェックを検証コードの比較を行うという簡単な処理で実現でき、また必要とするメモリも検証コードの格納用に数byteだけである。   As a result, an error check for functional safety of the programmable controller can be realized by a simple process of comparing the verification codes, and only a few bytes are required for storing the verification codes.

次に本実施形態のプログラマブルコントローラシステムの詳細について説明する。
図1は本実施形態におけるプログラマブルコントローラシステムの全体構成を示す図である。
Next, the detail of the programmable controller system of this embodiment is demonstrated.
FIG. 1 is a diagram showing an overall configuration of a programmable controller system in the present embodiment.

図1のプログラマブルコントローラシステム1は、コントローラ10に転送ケーブル30を介してプログラム生成装置20が接続された構成となっている。
コントローラ10は、実行プログラムを実行する2つの実行チャネル16−1、16−2を備えた演算部11、各実行チャネル16−1、16−2の起動/停止を操作者が指示するための起動/停止スイッチ12、プログラマブルコントローラシステム1に接続されている外部機器からの外部入力を受け付ける入力部13、プログラム生成装置20から起動/停止コマンドを受信し、受信コマンドに基づいて実行チャネル16−1及び16−2に対して起動/停止を通知する起動/停止コマンド受信部14、及び実行プログラムの実行結果等を外部に出力する出力部15を有している。
The programmable controller system 1 in FIG. 1 has a configuration in which a program generation device 20 is connected to a controller 10 via a transfer cable 30.
The controller 10 includes a calculation unit 11 having two execution channels 16-1 and 16-2 for executing an execution program, and an activation for an operator to instruct activation / stopping of the execution channels 16-1 and 16-2. / Stop switch 12, input unit 13 for receiving external input from an external device connected to programmable controller system 1, start / stop command is received from program generator 20, and execution channel 16-1 and It has a start / stop command receiving unit 14 for notifying 16-2 of start / stop, and an output unit 15 for outputting the execution result of the execution program to the outside.

このうち各実行チャネル16−1、16−2は、ハードウエア的に独立したものであり、マイコン、メモリ、ロジックICなどのハードウエアおよびファームウエアによって実現される。   Of these, the execution channels 16-1 and 16-2 are independent in hardware, and are realized by hardware such as a microcomputer, a memory, and a logic IC, and firmware.

各実行チャネル16−1、16−2は、実行プログラムを実行する実行制御部17−1、17−2及び実行プログラムを記憶するメモリ18−1、18−2を備えている。また各メモリ18(18−1、18−2)には、実行プログラムを格納する実行プログラム格納領域19(19−1、19−2)、後述する検証コード生成ルーチンや照合をソフトウエア的に実現するためのファームウエアを格納する検証コード生成ルーチン格納領域21(21−1、21−2)、及び検証コードを格納する検証コード格納領域22(22−1、22−2)を有している。また検証コード生成ルーチン格納領域21内のファームウエアを実行制御部17が実行することにより各実行チャネル16−1、16−2によって生成された2つの検証コードを比較する照合部23(23−1、23−2)が実現される。   Each of the execution channels 16-1 and 16-2 includes execution control units 17-1 and 17-2 that execute execution programs and memories 18-1 and 18-2 that store the execution programs. Each memory 18 (18-1, 18-2) implements an execution program storage area 19 (19-1, 19-2) for storing an execution program, and a verification code generation routine and verification described later in software. Verification code generation routine storage area 21 (21-1 and 21-2) for storing firmware for performing verification, and verification code storage area 22 (22-1 and 22-2) for storing verification codes . The execution control unit 17 executes the firmware in the verification code generation routine storage area 21 to compare two verification codes generated by the execution channels 16-1 and 16-2. , 23-2) is realized.

またプログラム生成装置20は、ユーザがプログラム入力を行うためのものであり、例えば図2に示すラダー図24を使ってプログラム入力が可能である。以降、ラダー図24を使った例で説明するが、ユーザがプログラム入力を行う言語を限定するものではなく、電気標準国際会議(IEC)のIEC61131−3で規格が示されている他の言語(SFC、FBD、ST、IL)を用いても構わない。   The program generation device 20 is used by a user to input a program. For example, the program can be input using a ladder diagram 24 shown in FIG. Hereinafter, an example using the ladder diagram 24 will be described. However, the language in which the user inputs the program is not limited, and other languages (standards) shown in IEC 61131-3 of the International Electrotechnical Conference (IEC) ( SFC, FBD, ST, IL) may be used.

プログラム生成装置20は、入力されたユーザプログラムからコントローラ10が解釈実行できる実行プログラム26をコントローラ10側が備える実行チャネル16の数(図1の場合は2つ)だけ生成する。即ち、図1の場合、実行プログラム26−1、26−2が生成される。   The program generation device 20 generates the execution programs 26 that can be interpreted and executed by the controller 10 from the input user program by the number of execution channels 16 provided on the controller 10 side (two in the case of FIG. 1). That is, in the case of FIG. 1, execution programs 26-1 and 26-2 are generated.

なお図1では各実行チャネル16−1、16−2がそれぞれ検証コード生成ルーチン格納領域21−1、21−2を備える構成となっているが、各実行チャネル16−1、16−2が1つの検証コード生成ルーチン格納領域21を共用する構成としても良い。   In FIG. 1, each execution channel 16-1, 16-2 has a configuration including verification code generation routine storage areas 21-1, 21-2, but each execution channel 16-1, 16-2 is one. Two verification code generation routine storage areas 21 may be shared.

プログラム生成装置20は、転送ケーブル30によってコントローラ10と接続され、転送ケーブル30を経由して、実行プログラム26はコントローラ10内の各実行チャネル16のメモリ18へ転送される。   The program generation apparatus 20 is connected to the controller 10 via a transfer cable 30, and the execution program 26 is transferred to the memory 18 of each execution channel 16 in the controller 10 via the transfer cable 30.

プログラム生成装置20は、ユーザが作成したラダー図24からコントローラ10の各実行チャネル16−1、16−2が実行する実行プログラム26−1、26−2を生成する実行プログラム生成部25、及びコントローラ10の各実行チャネル16−1、16−2に対して起動/停止を指示する起動/停止コマンド生成部27を有している。   The program generation device 20 includes an execution program generation unit 25 that generates execution programs 26-1 and 26-2 executed by the execution channels 16-1 and 16-2 of the controller 10 from a ladder diagram 24 created by the user, and a controller. It has a start / stop command generator 27 for instructing start / stop to 10 execution channels 16-1 and 16-2.

実行プログラム生成部25−1は、ラダー図24から各実行チャネル16−1、16−2に対応した実行プログラム26−1及び26−2を生成する。この実行プログラム26−1及び26−2は、多様性(ダイバシティ)を持たせるため機能的には同じものであるが異なったコードのプログラムとなっている。また実行プログラム生成部25がラダー図24から実行プログラム26−1及び26−2を生成する際には、実行プログラム26−1、26−2に検証コードを生成する検証コード生成ルーチンを呼び出す命令を挿入する。この検証コード生成ルーチンを呼び出す命令は、どちらの実行チャネル16−1、16−2でも実行される位置に挿入されるが、その挿入方法としては様々な方法が考えられ、例えばラダー図24内のリレー等の機能毎に挿入する。   The execution program generation unit 25-1 generates execution programs 26-1 and 26-2 corresponding to the execution channels 16-1 and 16-2 from the ladder diagram 24. The execution programs 26-1 and 26-2 are functionally the same but different code programs in order to provide diversity. Further, when the execution program generation unit 25 generates the execution programs 26-1 and 26-2 from the ladder diagram 24, an instruction for calling a verification code generation routine for generating a verification code in the execution programs 26-1 and 26-2. insert. The instruction for calling the verification code generation routine is inserted at a position where it is executed in either execution channel 16-1 or 16-2. Various insertion methods can be considered, for example, in ladder diagram 24. Insert each function such as a relay.

図2にラダー図24の例を示す。
実行プログラム生成部25は、図2のようなラダー図24を実行プログラム26−1、26−2に変換する際には、接点・コイル等の要素に対応するポイント31−1〜31−6毎に検証コード生成ルーチンを呼び出す命令を挿入する。なお、ポイント31−1〜31−6は全てに検証コード生成ルーチンを呼び出す命令を挿入する必要は無く、プログラムの全体量やステップ数を鑑み、一定間隔ごとに挿入しても構わない。またポイント31の挿入は、予め定義したルールに従って機械的に行っても良いし、経験則や実行プログラムの処理時間に基いてユーザが挿入しても構わない。
FIG. 2 shows an example of the ladder diagram 24.
When the execution program generation unit 25 converts the ladder diagram 24 as shown in FIG. 2 into the execution programs 26-1 and 26-2, each of the points 31-1 to 31-6 corresponding to elements such as contacts and coils. Insert an instruction to call the verification code generation routine. Note that it is not necessary to insert an instruction for calling the verification code generation routine in all of the points 31-1 to 31-6, and may be inserted at regular intervals in consideration of the entire amount of the program and the number of steps. The point 31 may be inserted mechanically according to a predefined rule, or may be inserted by the user based on an empirical rule or a processing time of an execution program.

図3は、図2のラダー図24から生成された従来のプログラマブルコントローラで実行される実行プログラムの例を示す図、図4は図2のラダー図24から本実施形態の実行プログラム生成部25によって生成される実行プログラム26の例を示す図である。   3 is a diagram showing an example of an execution program executed by the conventional programmable controller generated from the ladder diagram 24 of FIG. 2, and FIG. 4 is an execution program generation unit 25 of the present embodiment from the ladder diagram 24 of FIG. It is a figure which shows the example of the execution program 26 produced | generated.

図3と図4を比較すると、図4の実行プログラムでは、3カ所に検証コード生成ルーチンを呼び出す(コールする)命令41−1〜41−3が挿入されている。
図4の検証コード生成ルーチンを呼び出す命令41中の“CRCGEN”は、呼び出しを行う検証コード生成ルーチンの名前を示し、続く“X’0000”〜“X’0002”は、検証コード生成ルーチンを呼び出した実行プログラム内での一意な値で、“X’”は、例えば、16進数であることを示す。ここで値を4桁とすると、0000〜FFFFの範囲となる。
Comparing FIG. 3 and FIG. 4, in the execution program of FIG. 4, instructions 41-1 to 41-3 for calling (calling) verification code generation routines are inserted at three locations.
“CRCGEN” in the instruction 41 for calling the verification code generation routine of FIG. 4 indicates the name of the verification code generation routine to be called, and the following “X′0000” to “X′0002” call the verification code generation routine. “X ′” is a unique value in the execution program and indicates, for example, a hexadecimal number. Here, if the value is 4 digits, the range is from 0000 to FFFF.

この図4の例では、検証コード生成ルーチンにパラメータとして、実行プログラム内において唯一の値をそれぞれ与えることにより、検証コード生成ルーチンでこの一意な値を用いて検証コードを生成する。これにより照合部23−1、23−2が実行チャネル16−1、16−2それぞれの検証コードを照合することによって実行プログラムの実行順序が検証可能となる。   In the example of FIG. 4, each verification code generation routine uses a unique value as a parameter to generate a verification code using this unique value. As a result, the collating units 23-1 and 23-2 collate the verification codes of the execution channels 16-1 and 16-2, so that the execution order of the execution programs can be verified.

また図4の実行プログラム26では、検証コードの生成ルーチンは含んでおらず、コントローラ10内の検証コード生成ルーチン格納領域21内の検証コード生成ルーチンを呼び出す構成なので、検証コードの生成のためには、実行プログラム26は数バイト〜数十バイト要するだけで実現できる。よって実行プログラム26の要所要所に検証コード生成ルーチンを呼び出す命令41を入れることが出来るので、実行プログラム中に複雑な分岐や条件式があっても、実行プログラム26の実行順序を検証することが出来る。又そのために必要な検証コードの格納領域22も2バイト程度のメモリ資源しか占有しない。   Further, the execution program 26 of FIG. 4 does not include a verification code generation routine and calls the verification code generation routine in the verification code generation routine storage area 21 in the controller 10. The execution program 26 can be realized with only several bytes to several tens of bytes. Therefore, since the instruction 41 for calling the verification code generation routine can be entered at a necessary place of the execution program 26, the execution order of the execution program 26 can be verified even if there are complicated branches and conditional expressions in the execution program. I can do it. The verification code storage area 22 required for this purpose also occupies only about 2 bytes of memory resources.

さらには検証コードはコントローラ10内に格納されている検証コード生成ルーチンによって生成されるので、実行チャネル16のハードウエアや、ソフトウエア処理方式には依存性がない。   Furthermore, since the verification code is generated by a verification code generation routine stored in the controller 10, there is no dependency on the hardware of the execution channel 16 or the software processing method.

図5は、本実施形態の実行プログラム生成部25によって生成される実行プログラムの第2の例を示す図である。
図5の実行プログラムでは、検証コード生成ルーチンを呼び出す命令42において、呼び出しを行う検証コード生成ルーチンの名前“CRCGEN2”に続いて、位置を示す引数“X’0000”〜“X’0002”に続いて、検証コードの生成に用いる値の引数“X’0000”、“Y00”、“Y01”が与えられている。この第2パラメータである検証コードの生成に用いる値は、実行プログラムの実行によって得られる演算結果である。なお、“Y00”、“Y01”は実行プログラム内の任意の変数の値を指す。
FIG. 5 is a diagram illustrating a second example of the execution program generated by the execution program generation unit 25 of the present embodiment.
In the execution program of FIG. 5, in the instruction 42 for calling the verification code generation routine, the name “CRCGEN2” of the verification code generation routine to be called is followed by the arguments “X′0000” to “X′0002” indicating the position. Thus, arguments “X'0000”, “Y00”, and “Y01” of values used for generating the verification code are given. The value used for generating the verification code, which is the second parameter, is a calculation result obtained by executing the execution program. “Y00” and “Y01” indicate values of arbitrary variables in the execution program.

この図5の第2の例では、パラメータとして、実行プログラムでの位置を示す情報に加えて、演算結果をも検証コード生成ルーチンに送る。そしてこれらを元に検証コード生成ルーチンで生成される検証コードを検証することにより、実行プログラム26の実行順序だけでなく演算結果の一致性も診断できる。   In the second example of FIG. 5, in addition to the information indicating the position in the execution program, the calculation result is also sent to the verification code generation routine as a parameter. By verifying the verification code generated by the verification code generation routine based on these, not only the execution order of the execution program 26 but also the consistency of the operation results can be diagnosed.

この図4若しくは図5に示した実行プログラム26が実行チャネル16で実行されると、検証コード生成ルーチンが呼び出されて検証コードが生成され、これがメモリ18の検証コード格納領域22に格納される。そして実行プログラム26の実行が完了すると、各実行チャネル16−1、16−2の照合部23−1、23−2は自己の実行チャネル16のメモリ18内の検証コード格納領域22の値と、もう一方の実行チャネル16のメモリ18内の検証コード格納領域22の値を照合する。そしてコントローラ10は、この照合の結果、両者が一致したときのみ処理を続行し、両者が一致しないときは機能安全エラー処理を行う。   When the execution program 26 shown in FIG. 4 or 5 is executed on the execution channel 16, the verification code generation routine is called to generate a verification code, which is stored in the verification code storage area 22 of the memory 18. When the execution of the execution program 26 is completed, the collation units 23-1 and 23-2 of the execution channels 16-1 and 16-2 receive the value of the verification code storage area 22 in the memory 18 of the own execution channel 16, and The value of the verification code storage area 22 in the memory 18 of the other execution channel 16 is collated. And as a result of this collation, the controller 10 continues the process only when the two match each other, and performs the functional safety error process when both do not match.

なお検証コード生成ルーチンでは、パラメータ値を用いて検証コードを生成するが、その検証コードの生成アルゴリズムは、チェックサム(単純和)、CRC(Cyclic redundancy checksum)、ハッシュ値(Hash value)などが考えられるが特に限定されるものではなく、プログラマブルコントローラが必要とされる診断精度に応じて適宜なアルゴリズムを選択して用いればよい。   In the verification code generation routine, the verification code is generated using the parameter value. The verification code generation algorithm may be a checksum (simple sum), CRC (Cyclic redundancy checksum), hash value (Hash value), or the like. However, it is not particularly limited, and an appropriate algorithm may be selected and used according to the diagnostic accuracy for which the programmable controller is required.

上述した、図4、図5では、実行プログラム26−1、26−2は各実行チャネル16−1、16−2の実行制御部17−1、17−2によって実行される。このとき、2つの実行チャンネル16−1、16−2は同期して動作し、入力部13から外部入力を取り込む「入力」、実行プログラム26を実行する「演算」、2つの実行チャネル16−1及び16−2間での検証コード格納領域22−1、22−2内の値が一致することを確認する「照合」、「演算」や「照合」の結果を出力部15から外部へ出力する「出力」の各フェーズを経て1つのスキャンのサイクルとし、処理を行う。そして「照合」において2つの検証コードが一致している間は、スキャンを繰り返す。   In FIGS. 4 and 5 described above, the execution programs 26-1 and 26-2 are executed by the execution control units 17-1 and 17-2 of the execution channels 16-1 and 16-2. At this time, the two execution channels 16-1 and 16-2 operate in synchronization, “input” for fetching external input from the input unit 13, “calculation” for executing the execution program 26, and two execution channels 16-1. And the results of “collation”, “calculation”, and “collation” for confirming that the values in the verification code storage areas 22-1 and 22-2 between 16-2 match are output from the output unit 15 to the outside. Each phase of “output” is processed as one scan cycle. The scanning is repeated while the two verification codes match in “collation”.

実行プログラム26が実行されると、検証コード生成ルーチンをコールする度に検証コードが生成され、メモリ18内の検証コード格納領域22の値は更新される。そして実行プログラム26の実行が完了すると、各実行チャネル16−1、16−2では、照合部23−1、23−2が2つの検証コード格納領域22−1、22−2内の値を照合し、両者が一致するのを確認する。この照合の結果、2つの検証コードが一致すればコントローラ10は、演算結果を出力し、不一致の場合にはエラーを示す出力を行って、演算結果は出力しない。   When the execution program 26 is executed, the verification code is generated every time the verification code generation routine is called, and the value of the verification code storage area 22 in the memory 18 is updated. When execution of the execution program 26 is completed, in each of the execution channels 16-1 and 16-2, the collation units 23-1 and 23-2 collate the values in the two verification code storage areas 22-1 and 22-2. And confirm that they match. As a result of this collation, if the two verification codes match, the controller 10 outputs a calculation result. If the two verification codes do not match, the controller 10 outputs an error and does not output the calculation result.

なお、照合部23−1及び照合部23−2の各々で照合を行うのは、照合処理自体も二重化することにより機能安全を満たす側面がある。これは、実行チャネル16−1と実行チャネル16−2とを、異なったハードウエア構成(ダイバシティの確保)とすることにより、実行チャネル16−1と実行チャネル16−2とがハードウエア的な問題により“同時に誤照合する可能性”を回避する点にある。   Note that the collation by the collation unit 23-1 and the collation unit 23-2 has an aspect of satisfying functional safety by duplicating the collation processing itself. This is because the execution channel 16-1 and the execution channel 16-2 have different hardware configurations (to ensure diversity), so that the execution channel 16-1 and the execution channel 16-2 have a hardware problem. This avoids the possibility of “mismatching at the same time”.

一方で、このような制約を設けない場合は、例えば、照合部23を一つで構成したり、実行チャネル16の外部に設けるように構成しても構わない。
また、照合部23は、検証コード格納領域22−1、22−2内の値の取得・照合及びその照合結果の出力制御機能を有しておればよく、ハードウエア的な構造であってもソフトウエア的に実現するためのファームウエア(プログラム)であっても構わない。例えば、照合部23は実行制御部17からアクセス可能な照合ルーチンとしてメモリ18内に格納されていても構わない。
On the other hand, when such a restriction is not provided, for example, the collation unit 23 may be configured as a single unit or provided outside the execution channel 16.
Moreover, the collation part 23 should just have the acquisition control of the value in verification code storage area 22-1 and 22-2, and the output control function of the collation result, even if it is a hardware structure. Firmware (program) for realizing in software may be used. For example, the collation unit 23 may be stored in the memory 18 as a collation routine accessible from the execution control unit 17.

次に各実行チャネル16−1、16−2の実行制御部17−1、17−2の処理フローについて説明する。
図6は、実行制御部17が実行プログラム26を実行した際の動作処理を示すフローチャートである。なお図6の例では検証コード生成ルーチンとして、後述する図7のCRCGENのルーチンを用いた場合を例として示している。
Next, the processing flow of the execution control units 17-1 and 17-2 of the execution channels 16-1 and 16-2 will be described.
FIG. 6 is a flowchart showing an operation process when the execution control unit 17 executes the execution program 26. In the example of FIG. 6, a case where a CRCGEN routine of FIG. 7 described later is used as the verification code generation routine is shown as an example.

なお図6の処理は、2つの実行チャネル16−1及び16−2において同期して処理される。また本実施形態のプログラマブルコントローラシステム1では、起動、停止、故障など様々な事象により対応する挙動があるが、図6の処理フローは本実施形態の検証コードに関連する部分のみを記載し、他の部分は省略化している。   Note that the processing of FIG. 6 is processed in synchronization in the two execution channels 16-1 and 16-2. Further, in the programmable controller system 1 of this embodiment, there are behaviors corresponding to various events such as start, stop, and failure, but the processing flow of FIG. 6 describes only the part related to the verification code of this embodiment, and others. Is omitted.

図6のフローにおいて、まずステップS1として実行チャネル16の初期化を行う。
この初期化処理では、コントローラ10は実行プログラム26の実行環境を整え、初期化処理が終了するとスキャンサイクルに入る。
In the flow of FIG. 6, first, the execution channel 16 is initialized as step S1.
In this initialization process, the controller 10 prepares the execution environment of the execution program 26, and enters the scan cycle when the initialization process is completed.

スキャンサイクルでは、実行制御部17はまずステップS2として外部入力取り込みを行う。この外部入力取り込みでは入力部13から外部入力データを実行制御部17に取り込む。   In the scan cycle, the execution control unit 17 first performs external input capture as step S2. In this external input capture, external input data is captured from the input unit 13 to the execution control unit 17.

次に、ステップS3として実行制御部17は、検証コードが格納される検証コード格納領域22内の値の初期化を行う。
初期化が終了すると、実行制御部17は、ステップS4として、実行プログラム格納領域19から実行プログラム26を読み込む。そしてステップS5としてステップS4で読み込んだ実行プログラム26の実行処理を行う。この実行プログラム26の実行処理は、実行制御部17が実行プログラム26のプログラムコードに従い、命令実行を進める。
Next, in step S3, the execution control unit 17 initializes the value in the verification code storage area 22 in which the verification code is stored.
When the initialization is completed, the execution control unit 17 reads the execution program 26 from the execution program storage area 19 as step S4. In step S5, the execution program 26 read in step S4 is executed. In the execution process of the execution program 26, the execution control unit 17 advances instruction execution according to the program code of the execution program 26.

このステップS5の実行プログラム26の実行処理中、CAL CRCGEN,X’xxxx命令等の検証コード生成ルーチンを呼び出す命令を実行すると、処理を検証コード生成ルーチン格納領域21内の検証コード生成ルーチンに処理を移す。   When an instruction for calling a verification code generation routine such as a CAL CRCGEN, X′xxxx instruction or the like is executed during the execution process of the execution program 26 in step S5, the process is processed by the verification code generation routine in the verification code generation routine storage area 21. Transfer.

検証コード生成ルーチンでは、ステップS6として、パラメータ値X’xxxx等を用いて検証コードを生成し、これを検証コード格納領域22に格納後、処理をステップS5に戻す。   In the verification code generation routine, in step S6, a verification code is generated using the parameter value X'xxxx and the like, stored in the verification code storage area 22, and the process returns to step S5.

この検証コード生成ルーチンは、検証コード生成ルーチンを呼び出す命令が実行される度に呼び出され、検証コード格納領域22内の検証コードを更新する。
なおこの検証コード生成ルーチンの詳細については後述する。
This verification code generation routine is called every time an instruction for calling the verification code generation routine is executed, and the verification code in the verification code storage area 22 is updated.
Details of this verification code generation routine will be described later.

ステップS5の実行プログラム26の実行が完了すると、実行制御部17は、ステップS7として検証コード格納領域22内の検証コードをもう一つの実行チャネル16に通知する。本例の場合には、実行チャネル16−1は実行チャネル16−2に、実行チャネル16−2は実行チャネル16−1に、自己の検証コードを通知する。   When the execution of the execution program 26 in step S5 is completed, the execution control unit 17 notifies the verification code in the verification code storage area 22 to another execution channel 16 in step S7. In this example, the execution channel 16-1 notifies the execution channel 16-2, and the execution channel 16-2 notifies the execution channel 16-1 of its own verification code.

他の実行チャネル16からの検証コードを受け取ったら(ステップS8)、実行制御部17は、ステップS9として照合部23によって自チャネルの検証コードと比較照合を行う。   When receiving the verification code from the other execution channel 16 (step S8), the execution control unit 17 performs comparison and verification with the verification code of the own channel by the verification unit 23 as step S9.

そしてステップS9の検証コードの照合の結果、両者が不一致の場合(ステップS10、NO)、プログラム実行順序が実行チャネル16−1と実行チャネル16−2で異なっていたことを示すので、ステップS12として異常通知等の異常処理を行って処理を終了する。コントローラ10は以降プログラム実行をしない。また実行プログラム26の実行結果は出力しない。   As a result of verification of the verification code in step S9, if they do not match (NO in step S10), it indicates that the program execution order is different between the execution channel 16-1 and the execution channel 16-2. Anomaly processing such as anomaly notification is performed and the process is terminated. The controller 10 does not execute the program thereafter. The execution result of the execution program 26 is not output.

一方、ステップS8の検証コードの照合の結果、両者が一致する場合は(ステップS10、YES)、2つのチャネル16でプログラム実行順序が同じであったことを示し、正常であるので、ステップS11として演算結果を出力する。この出力データは、出力部15を経由して、外部へ出力される。   On the other hand, if the result of verification code verification in step S8 is the same (step S10, YES), it indicates that the program execution order is the same in the two channels 16, and is normal. Output the calculation result. This output data is output to the outside via the output unit 15.

演算結果を出力後、実行制御部17は、ステップS13として実行プログラム26の実行継続かどうかの判断を行う。
プログラムコントローラ1は、プログラム生成装置20をユーザが操作することによって、起動/停止コマンド生成部27が起動/停止コマンドをコントローラ10に対して発行し、実行チャネル16による実行プログラム26の実行/停止を行うことが出来る。
After outputting the calculation result, the execution control unit 17 determines whether or not the execution program 26 is to be continued in step S13.
In the program controller 1, when the user operates the program generation device 20, the start / stop command generation unit 27 issues a start / stop command to the controller 10, and execution / stop of the execution program 26 by the execution channel 16 is performed. Can be done.

ステップS13において、停止コマンドがプログラム生成装置20から入力されていない場合、及び起動/停止スイッチ12によって停止が指示されていない場合には、実行制御部17は、実行プログラム26の実行を継続し(ステップS13、YES)、処理をステップS2に移してスキャンループの先頭に戻り、再び入力、演算、照合、出力の動作を繰り返す。   In step S13, when the stop command is not input from the program generation device 20, and when stop is not instructed by the start / stop switch 12, the execution control unit 17 continues the execution of the execution program 26 ( In step S13, YES), the process moves to step S2 to return to the head of the scan loop, and the operations of input, calculation, collation, and output are repeated again.

以降、検証コード不一致が検出されるか、ユーザから停止を指示されるまで、スキャンループを繰り返す。そしてユーザから停止指示を受けると(ステップS13、NO)、実行プログラムの実行を終了する。   Thereafter, the scan loop is repeated until a verification code mismatch is detected or a stop is instructed by the user. When a stop instruction is received from the user (step S13, NO), execution of the execution program is terminated.

このようにして本実施形態のプログラマブルコントローラシステム1では、実行プログラムを実行し、また検証コードを用いて機能安全エラーを検出する。
なお上記例では、検証コード生成ルーチンとして図7のCRCGENのルーチンを用いているが、後述する図8のCRCGEN2のルーチンを用いても良い。このCRCGEN2のルーチンを用いた場合、パラメータ値として実行プログラム26での位置を示す値と実行プログラムによる演算結果も与えるので、実行プログラム26の実行順序だけでなく演算結果の一致性も診断できる。
Thus, in the programmable controller system 1 of this embodiment, an execution program is executed and a functional safety error is detected using a verification code.
In the above example, the CRCGEN routine of FIG. 7 is used as the verification code generation routine, but a CRCGEN2 routine of FIG. 8 to be described later may be used. When this CRCGEN2 routine is used, a value indicating the position in the execution program 26 and a calculation result by the execution program are also given as parameter values, so that not only the execution order of the execution program 26 but also the consistency of the calculation results can be diagnosed.

また上記例のコントローラは、2つの実行チャネル16を備える構成を前提としているが本実施形態のプログラマブルコントローラシステム1は、3つ以上の実行チャネル16を備える場合も想定している。実行チャネル16を3つ以上備える場合には、機能安全の検証としては、全ての実行チャネル16で生成された検証コードが全て一致したときのみ正常と判断し、1つでも値が異なる場合にはエラー処理を行う。   In addition, the controller of the above example is premised on a configuration including two execution channels 16, but the programmable controller system 1 of the present embodiment is also assumed to include three or more execution channels 16. When three or more execution channels 16 are provided, the functional safety is verified as normal only when all the verification codes generated in all the execution channels 16 match, and even if one of the values is different. Perform error handling.

次に検証コード算出ルーチンの詳細について説明する。
図7は、図4の実行プログラム26で呼び出されるCRCGENの検証コード生成ルーチンの動作例を示す図である。同図のルーチンは、例えば、2バイト長の1つのパラメータを与えられて呼び出される。また検証コードの生成アルゴリズムとしては、デジタルデータ通信での使用実績が多いCRC16を使用した場合を例として示している。
Next, details of the verification code calculation routine will be described.
FIG. 7 is a diagram showing an operation example of the CRCGEN verification code generation routine called by the execution program 26 of FIG. The routine shown in the figure is called with one parameter having a length of 2 bytes, for example. Further, as an example of the verification code generation algorithm, a case where a CRC 16 having a large use record in digital data communication is used is shown as an example.

本実施形態においては、検証コードの生成アルゴリズムは特に限定しないが、単純和をとるチェックサムよりも、巡回冗長符号と呼ばれるCRCの方が、データ誤り検出の確実性があると一般に知られており、本例ではこのCRC16を用いて検証コードを生成している。   In this embodiment, the verification code generation algorithm is not particularly limited, but it is generally known that a CRC called a cyclic redundancy code has more certainty of data error detection than a checksum that takes a simple sum. In this example, the CRC 16 is used to generate a verification code.

図7のCRCGENのルーチンが呼び出されると、まずステップS21として実行プログラム26からルーチン呼び出し命令で与えられる入力パラメータ値をCRC計算アルゴリズムの入力パラメータ1にセットする。   When the CRCGEN routine of FIG. 7 is called, first, in step S21, the input parameter value given by the routine call instruction from the execution program 26 is set to the input parameter 1 of the CRC calculation algorithm.

次にステップS22として検証コード格納領域22から現在の検証コードを読み出し、この値をCRC計算アルゴリズムの入力パラメータ2にセットする。
そしてステップS23として、CRC16計算アルゴリズムによって更新された検証コードを生成する。このCRC16計算アルゴリズムでは、入力パラメータ2に入力パラメータ1の2バイト分の値を下位バイト、上位バイトの順に反映させて新しいCRCコードを生成する。
In step S22, the current verification code is read from the verification code storage area 22, and this value is set as the input parameter 2 of the CRC calculation algorithm.
In step S23, a verification code updated by the CRC16 calculation algorithm is generated. In this CRC16 calculation algorithm, a new CRC code is generated by reflecting the 2-byte value of the input parameter 1 in the input parameter 2 in the order of the lower byte and the upper byte.

そして最後に、ステップS24としてステップS23で生成したCRCコードを更新した検証コードとして検証コード格納領域22に格納後、処理を実行プログラム26に戻す。   Finally, as step S24, the CRC code generated in step S23 is stored in the verification code storage area 22 as an updated verification code, and then the process is returned to the execution program 26.

2つの実行チャネル16−1、16−2が、常に実行プログラム26−1、26−2のプログラムコードに忠実に処理を進めていった場合には、常に同じ値の入力パラメータ値を伴って図7のルーチンが呼ばれるため、2つの実行チャネル16−1、16−2の検証コードの値は一致する。しかし、例えば、分岐命令での誤った分岐実行や、ジャンプ先ミス、コード生成不良等のなんらかの異常より実行プログラムの実行順序に差が生じた場合は、異なった検証コードが算出され、照合部23による実行プログラム26終了後の検証コードの照合で不一致を検出する。   When the two execution channels 16-1 and 16-2 always proceeded with processing faithfully to the program codes of the execution programs 26-1 and 26-2, the input parameter values always have the same value. Since the routine 7 is called, the verification code values of the two execution channels 16-1 and 16-2 match. However, for example, when a difference occurs in the execution order of the execution program due to an erroneous branch execution in a branch instruction, a jump destination miss, a code generation failure, or the like, a different verification code is calculated, and the collating unit 23 A mismatch is detected by verification of the verification code after the execution program 26 ends.

したがって検証コードを照合することによって、実行プログラム26の実行順序を検証することが出来る。
図8は、図5の実行プログラム26で呼び出されるCRCGEN2の検証コード生成ルーチンの動作例を示す図である。同図のルーチンは、2バイト長の入力パラメータを2つ与えられて呼び出される。
Therefore, the execution order of the execution program 26 can be verified by verifying the verification code.
FIG. 8 is a diagram showing an operation example of a CRCGEN2 verification code generation routine called by the execution program 26 of FIG. The routine shown in the figure is called with two 2-byte input parameters.

図8のルーチンが呼び出されると、まずステップS31として実行プログラム26からルーチン呼び出し命令で与えられる第1のパラメータ値をCRC計算アルゴリズムの入力パラメータ1にセットする。   When the routine of FIG. 8 is called, first, in step S31, the first parameter value given by the routine call instruction from the execution program 26 is set to the input parameter 1 of the CRC calculation algorithm.

次にステップS32として検証コード格納領域22から現在の検証コードを読み出し、これをCRC計算アルゴリズムの入力パラメータ2にセットする。
そしてステップS33として、CRC16計算アルゴリズムによって更新された検証コードを生成する。このCRC16計算アルゴリズムでは、入力パラメータ2に入力パラメータ1の2バイト分の値を下位バイト、上位バイトの順に反映させて新しいCRCコードを生成する。
Next, in step S32, the current verification code is read from the verification code storage area 22, and this is set in the input parameter 2 of the CRC calculation algorithm.
In step S33, a verification code updated by the CRC16 calculation algorithm is generated. In this CRC16 calculation algorithm, a new CRC code is generated by reflecting the 2-byte value of the input parameter 1 in the input parameter 2 in the order of the lower byte and the upper byte.

次にステップS34として実行プログラム26からルーチン呼び出し命令で与えられる第2のパラメータ値をCRC計算アルゴリズムの入力パラメータ1にセットする。
そして次にステップS35としてステップS33で求めたCRCコードをCRC計算アルゴリズムの入力パラメータ2にセットする。
In step S34, the second parameter value given by the routine call instruction from the execution program 26 is set to the input parameter 1 of the CRC calculation algorithm.
In step S35, the CRC code obtained in step S33 is set in the input parameter 2 of the CRC calculation algorithm.

そしてこの入力パラメータ1及び入力パラメータ2を用いて、ステップS36として、ステップS33と同様なCRC16計算アルゴリズムによってCRCコードを求める。
そして最後にステップS37としてステップS36で生成したCRCコードを検証コードとして検証コード格納領域22に格納後処理を実行プログラム26に戻す。
Then, using the input parameter 1 and the input parameter 2, as step S36, a CRC code is obtained by a CRC16 calculation algorithm similar to step S33.
Finally, in step S37, the CRC code generated in step S36 is stored in the verification code storage area 22 as a verification code, and the post-processing is returned to the execution program 26.

このように図8の検証コード生成ルーチンでは、実行プログラム26内の一意な値を示すパラメータと実行プログラムによる演算結果のパラメータを用いて検証コードを生成している。そのためこの図8の検証コード生成ルーチンを用いることにより、プログラム実行順序の差異検出のみならず、演算結果の差異検出も行うことが出来る。   As described above, in the verification code generation routine of FIG. 8, the verification code is generated using the parameter indicating the unique value in the execution program 26 and the parameter of the calculation result by the execution program. Therefore, by using the verification code generation routine of FIG. 8, not only the difference in the program execution order but also the difference in the calculation result can be detected.

なお図7、図8の検証コード生成ルーチンではCRCコードを検証コードとしていたが、本実施形態はこのようなものに限定されるものではなく、上記したチェックサムの他にも、例えば、CRCコードに比較してサイズが大きくなるが、MDやSHA等デジタルデータ通信でのメッセージ認証コード(MAC)で採用実績が多いハッシュアルゴリズムを用いることも出来る。このハッシュコードの場合、CRCコードよりもさらに誤り検出の確実性があると一般に知られており、プログラム実行監視をより厳密にしたい場合は、ハッシュアルゴリズムを採用すればよい。   Although the CRC code is used as the verification code in the verification code generation routines of FIGS. 7 and 8, the present embodiment is not limited to this, and other than the above checksum, for example, a CRC code Although the size is larger than the above, it is possible to use a hash algorithm that has been widely used in message authentication codes (MAC) in digital data communication such as MD and SHA. In the case of this hash code, it is generally known that there is more certainty of error detection than the CRC code, and if it is desired to monitor program execution more strictly, a hash algorithm may be employed.

なお上記例では検証コード生成ルーチンには、1乃至2のパラメータ値を引き渡していたが、検証コード生成ルーチンに3つ以上のパラメータ値を引き渡して、検証コード生成ルーチンがこれらを用いて検証コードを生成するようにしても良い。   In the above example, one or two parameter values are passed to the verification code generation routine. However, three or more parameter values are passed to the verification code generation routine, and the verification code generation routine uses these to pass the verification code. You may make it produce | generate.

このように、必要な厳密性に基づいて検証コードの生成アルゴリズムを選択し、コントローラの検証コード算出ルーチンを実装することで所望のプログラム実行監視精度を備えたプログラマブルコントローラを実現することができる。   Thus, a programmable controller having a desired program execution monitoring accuracy can be realized by selecting a verification code generation algorithm based on required strictness and implementing a verification code calculation routine of the controller.

また異なるハードウエアおよびソフトウエアで構成される実行チャネルであっても、プログラム実行の途中経過の検証が、少ないメモリ量で、短い時間内に行うことが出来る。
更には実行プログラムの複雑度には影響されずに適用が可能で、冗長化された実行チャネルでのプログラム実行順序、結果の同一性の検査を行うことが出来る。
Even in the case of an execution channel composed of different hardware and software, verification of the progress of program execution can be performed in a short time with a small amount of memory.
Furthermore, the present invention can be applied without being influenced by the complexity of the execution program, and the program execution order and the result can be checked in the redundant execution channel.

1 プログラマブルコントローラシステム
10 (プログラマブル)コントローラ
11 演算部
12 起動停止スイッチ
13 入力部
14 起動コマンド受信部
15 出力部
16 実行チャネル
17 実行制御部
18 メモリ
19 実行プログラム格納領域
20 プログラム生成装置
21 検証コード生成ルーチン格納領域
22 検証コード格納領域
23 照合部
24 ラダー図
25 実行プログラム生成部
26 実行プログラム
27 起動/停止コマンド生成部
30 転送ケーブル
DESCRIPTION OF SYMBOLS 1 Programmable controller system 10 (Programmable) controller 11 Operation part 12 Startup stop switch 13 Input part 14 Startup command receiving part 15 Output part 16 Execution channel 17 Execution control part 18 Memory 19 Execution program storage area 20 Program generation apparatus 21 Verification code generation routine Storage area 22 Verification code storage area 23 Verification unit 24 Ladder diagram 25 Execution program generation unit 26 Execution program 27 Start / stop command generation unit 30 Transfer cable

Claims (10)

実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおいて、
前記複数の実行チャネルは、当該実行チャネルにおいて前記実行プログラムが正常に実行されたかを検証するための検証コードを格納する検証コード格納部と、
前記実行プログラムの実行が完了すると、前記複数の実行チャネルの前記検証コード格納領域内の検証コードを照合する照合部と、
を備え、
前記実行チャネルから呼び出され、前記検証コードを生成する検証コード生成ルーチンを格納する検証コード生成ルーチン格納領域と、
を備えることを特徴とするプログラマブルコントローラ。
In a programmable controller comprising a plurality of execution channels for executing an execution program in parallel,
The plurality of execution channels include a verification code storage unit that stores a verification code for verifying whether the execution program has been normally executed in the execution channel;
When the execution of the execution program is completed, a verification unit for verifying verification codes in the verification code storage area of the plurality of execution channels;
With
A verification code generation routine storage area that stores a verification code generation routine that is called from the execution channel and generates the verification code;
A programmable controller comprising:
前記照合部による照合の結果、前記複数の実行チャネルの前記検証コード格納領域内の検証コードが全て一致したとき、前記実行プログラムは正常に実行されたと判定することを特徴とする請求項1に記載のプログラマブルコントローラ。   The execution program is determined to have been executed normally when all verification codes in the verification code storage areas of the plurality of execution channels match as a result of the verification by the verification unit. Programmable controller. 前記照合部は、前記複数の実行チャネルの前記検証コード格納領域内の検証コードが一致しないものがあるとき、エラー処理を行うことを特徴とする請求項2に記載のプログラマブルコントローラ。   The programmable controller according to claim 2, wherein the verification unit performs error processing when there is a code that does not match the verification code in the verification code storage area of the plurality of execution channels. 前記実行プログラムは、前記検証コード生成ルーチンを呼び出す際、当該実行プログラム内において一意な値を取る第1のパラメータを当該検証コード生成ルーチンに引き渡すことを特徴とする請求項1乃至3の何れか1つに記載のプログラマブルコントローラ。   4. The execution program according to claim 1, wherein when the verification code generation routine is called, the execution program delivers a first parameter that takes a unique value in the execution program to the verification code generation routine. Programmable controller described in 1. 前記実行プログラムは、前記検証コード生成ルーチンを呼び出す際、当該実行プログラムによる実行結果である第2のパラメータをも当該検証コード生成ルーチンに引き渡すことを特徴とする請求項4に記載のプログラマブルコントローラ。   5. The programmable controller according to claim 4, wherein when the execution program calls the verification code generation routine, the execution parameter is also transferred to the verification code generation routine by a second parameter that is an execution result of the execution program. 前記検証コード生成ルーチンは、前記パラメータを用いて前記検証コードを生成することを特徴とする請求項4に記載のプログラマブルコントローラ。   The programmable controller according to claim 4, wherein the verification code generation routine generates the verification code using the parameter. 前記検証コード生成ルーチンは、前記1つ以上のパラメータ値を用いて、チェックサムのアルゴリズム、CRCコードのアルゴリズム、またはハッシュコードのアルゴリズムの何れかを用いて前記検証コードを生成することを特徴とする請求項6に記載のプログラマブルコントローラ。   The verification code generation routine generates the verification code using any one of a checksum algorithm, a CRC code algorithm, and a hash code algorithm using the one or more parameter values. The programmable controller according to claim 6. ユーザが前記プログラマブルコントローラ用の言語で作成したプログラムから、複数の前記検証コード生成ルーチンを呼び出すコードを含む前記実行プログラムを生成するプログラム生成部を更に備えることを特徴とする請求項1乃至7の何れか1つに記載のプログラマブルコントローラ。   The program generation part which produces | generates the said execution program including the code | cord | chord which calls the said several verification code production | generation routine from the program created in the language for the said programmable controller by the user is further provided. The programmable controller as described in any one. 実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおけるプログラム実行監視方法において、
前記並列に実行される複数の前記実行プログラムから、当該実行プログラムが正常に実行されたかを検証するための検証コードを生成する検証コード生成ルーチンを呼び出し、当該検証コードを前記実行チャネル毎に備える検証コード格納領域に格納し、
前記複数の実行チャネルそれぞれの前記検証コード格納領域内の検証コードを照合することによって前記実行プログラムが正常に実行されたかを検証する
ことを特徴とするプログラム実行監視方法。
In a program execution monitoring method in a programmable controller having a plurality of execution channels for executing an execution program in parallel,
A verification code generation routine for generating a verification code for verifying whether or not the execution program has been normally executed is called from the plurality of execution programs executed in parallel, and the verification code is provided for each execution channel. Store it in the code storage area,
A program execution monitoring method comprising: verifying whether or not the execution program has been executed normally by collating verification codes in the verification code storage area of each of the plurality of execution channels.
実行プログラムを並列に実行する複数の実行チャネルを備えるプログラマブルコントローラにおいて実行されるプログラムであって、
前記実行プログラムから呼び出され、当該実行プログラムから引き渡されたパラメータ値及び当該検証コードを前記実行チャネル毎に設けられた検証コード格納領域内の値を用いて当該実行プログラムが正常に実行されたかを検証するための検証コードを生成し、
当該検証コードを前記検証コード格納領域に格納する
ことを前記プログラマブルコントローラに実行させることを特徴とするプログラム。
A program executed in a programmable controller having a plurality of execution channels for executing execution programs in parallel,
Verifies whether the execution program has been executed normally using the parameter value called from the execution program and passed from the execution program and the value in the verification code storage area provided for each execution channel. Generate verification code to
A program for causing the programmable controller to store the verification code in the verification code storage area.
JP2009090549A 2009-04-02 2009-04-02 Programmable controller, program execution monitoring method, and program Expired - Fee Related JP5515374B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009090549A JP5515374B2 (en) 2009-04-02 2009-04-02 Programmable controller, program execution monitoring method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009090549A JP5515374B2 (en) 2009-04-02 2009-04-02 Programmable controller, program execution monitoring method, and program

Publications (2)

Publication Number Publication Date
JP2010244213A true JP2010244213A (en) 2010-10-28
JP5515374B2 JP5515374B2 (en) 2014-06-11

Family

ID=43097185

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009090549A Expired - Fee Related JP5515374B2 (en) 2009-04-02 2009-04-02 Programmable controller, program execution monitoring method, and program

Country Status (1)

Country Link
JP (1) JP5515374B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015201132A (en) * 2014-04-10 2015-11-12 株式会社ジェイテクト Device for assisting creation of program for programmable logic controller and method for assisting creation of program for programmable logic controller
KR20150145629A (en) * 2014-06-20 2015-12-30 주식회사 큐브피아 Protecting method of binary file and executing method of protected binary file
US9569404B2 (en) 2011-12-28 2017-02-14 Denso Corporation In-vehicle controller and non-transitory tangible computer readable medium
WO2021005691A1 (en) * 2019-07-08 2021-01-14 三菱電機株式会社 Control device, program monitoring method, and program

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05313711A (en) * 1992-05-06 1993-11-26 Omron Corp Programmable controller
JPH06250864A (en) * 1993-02-26 1994-09-09 Fuji Electric Co Ltd Method for preventing generation of error output from programmable controller
JPH06324914A (en) * 1993-05-13 1994-11-25 Fuji Electric Co Ltd Runaway detecting method for computer
JP2005084896A (en) * 2003-09-08 2005-03-31 Mitsubishi Electric Corp On-vehicle electronic control device
JP2006209523A (en) * 2005-01-28 2006-08-10 Yokogawa Electric Corp Information processor and information processing method
JP2006338425A (en) * 2005-06-03 2006-12-14 Hitachi Ltd Controller

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05313711A (en) * 1992-05-06 1993-11-26 Omron Corp Programmable controller
JPH06250864A (en) * 1993-02-26 1994-09-09 Fuji Electric Co Ltd Method for preventing generation of error output from programmable controller
JPH06324914A (en) * 1993-05-13 1994-11-25 Fuji Electric Co Ltd Runaway detecting method for computer
JP2005084896A (en) * 2003-09-08 2005-03-31 Mitsubishi Electric Corp On-vehicle electronic control device
JP2006209523A (en) * 2005-01-28 2006-08-10 Yokogawa Electric Corp Information processor and information processing method
JP2006338425A (en) * 2005-06-03 2006-12-14 Hitachi Ltd Controller

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9569404B2 (en) 2011-12-28 2017-02-14 Denso Corporation In-vehicle controller and non-transitory tangible computer readable medium
JP2015201132A (en) * 2014-04-10 2015-11-12 株式会社ジェイテクト Device for assisting creation of program for programmable logic controller and method for assisting creation of program for programmable logic controller
KR20150145629A (en) * 2014-06-20 2015-12-30 주식회사 큐브피아 Protecting method of binary file and executing method of protected binary file
KR101641769B1 (en) * 2014-06-20 2016-07-29 주식회사 큐브피아 Protecting method of binary file and executing method of protected binary file
WO2021005691A1 (en) * 2019-07-08 2021-01-14 三菱電機株式会社 Control device, program monitoring method, and program
JPWO2021005691A1 (en) * 2019-07-08 2021-09-13 三菱電機株式会社 Control device, program monitoring method and program

Also Published As

Publication number Publication date
JP5515374B2 (en) 2014-06-11

Similar Documents

Publication Publication Date Title
CN109240197B (en) Monitoring and reconstruction method and device of software defined Programmable Logic Controller (PLC)
CN105511911B (en) The generation method and device of system firmware upgrade package
JP5515374B2 (en) Programmable controller, program execution monitoring method, and program
US20100235682A1 (en) I/o unit and industrial controller
EP1956449A2 (en) Numerical controller
JP2017167653A (en) Evaluation system, evaluation program, and evaluation method
CN106873443A (en) Method for being programmed to safety governor
KR20120020867A (en) Controller with double structure and method for operating that controller
CN111651352B (en) Warehouse code merging method and device
JP5422448B2 (en) Control device
WO2019121516A1 (en) Seamless and safe upgrade of software intensive systems during operation
US9921565B2 (en) Programming assist device for programmable logic controller program and programming assist method for the program
JP6477553B2 (en) Program development support apparatus, program development support program, and program development support method
JP5992777B2 (en) Programmable controller, program creation support device, and program
CN107924356A (en) Zero-overhead code coverage is analyzed
JP2017167652A (en) Evaluation system, evaluation program, and evaluation method
CN116011026B (en) Database configuration security rapid verification method, system, equipment and storage medium
US8776071B2 (en) Microprocessor operation monitoring system
JP2018010331A (en) Diagnosis device and diagnosis method
CN111966523A (en) Method, system, equipment and medium for managing electric appliance parameters
JP2007304972A (en) Microprocessor system
CN103885769B (en) Systems for debugging model based message sequences
JP4872357B2 (en) Program test support system, method and program
JP2006155047A (en) Verification system and verification method
CN111638905A (en) Version number generation method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20110422

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120313

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131212

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131217

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140213

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: 20140304

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140317

R150 Certificate of patent or registration of utility model

Ref document number: 5515374

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees