Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7587147B2 - Programmable Logic Controller - Google Patents
[go: Go Back, main page]

JP7587147B2 - Programmable Logic Controller - Google Patents

Programmable Logic Controller Download PDF

Info

Publication number
JP7587147B2
JP7587147B2 JP2021048729A JP2021048729A JP7587147B2 JP 7587147 B2 JP7587147 B2 JP 7587147B2 JP 2021048729 A JP2021048729 A JP 2021048729A JP 2021048729 A JP2021048729 A JP 2021048729A JP 7587147 B2 JP7587147 B2 JP 7587147B2
Authority
JP
Japan
Prior art keywords
cpu
opcode
calculation
microcomputer
abnormality
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2021048729A
Other languages
Japanese (ja)
Other versions
JP2022147474A (en
Inventor
杜彦 裏川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Wave Inc
Original Assignee
Denso Wave Inc
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 Denso Wave Inc filed Critical Denso Wave Inc
Priority to JP2021048729A priority Critical patent/JP7587147B2/en
Publication of JP2022147474A publication Critical patent/JP2022147474A/en
Application granted granted Critical
Publication of JP7587147B2 publication Critical patent/JP7587147B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Programmable Controllers (AREA)

Description

本発明は、産業用機器等の分野で用いられるプログラマブルロジックコントローラに関する。 The present invention relates to a programmable logic controller used in fields such as industrial equipment.

この種のプログラマブルロジックコントローラ(以下、PLC)としては、例えば特許文献1に見られるように、不揮発性のメモリと、メモリからプログラムを読み出して演算を行うCPUとを有するマイコンを備えるものが知られている。CPUは、算術演算又は論理演算等の演算機能を有している。 As an example of this type of programmable logic controller (hereinafter referred to as PLC), one that is known is one that includes a microcomputer with a non-volatile memory and a CPU that reads a program from the memory and performs calculations, as seen in Patent Document 1. The CPU has calculation functions such as arithmetic calculations and logical calculations.

特開2016-45712号公報JP 2016-45712 A

PLCに対する機能安全を実現するための構成として、マイコンを複数備えるPLCがある。このPLCを構成するCPUの演算機能に異常が発生し得る。このため、CPUに異常が発生しているか否かを定期的に診断することが要求される。この異常診断方法としては、以下に説明するものがある。 As a configuration for achieving functional safety for PLCs, there are PLCs equipped with multiple microcomputers. Anomalies can occur in the calculation functions of the CPU that constitutes this PLC. For this reason, it is necessary to periodically diagnose whether or not an abnormality has occurred in the CPU. The following is an example of such anomaly diagnosis method.

各マイコンにおいて、特定の演算を実行した場合における演算結果の期待値がメモリに記憶されている。各マイコンにおいて、CPUは、特定の演算を実行する。そして、各マイコンにおいて、CPUは、演算結果と期待値とを比較することにより、異常が発生しているか否かを診断する。 In each microcomputer, the expected value of the calculation result when a specific calculation is executed is stored in memory. In each microcomputer, the CPU executes the specific calculation. Then, in each microcomputer, the CPU compares the calculation result with the expected value to diagnose whether or not an abnormality has occurred.

ここで、マイコンにおける演算の種類は多数存在する。この場合、多数の演算それぞれを実行した場合における演算結果の期待値をメモリに記憶させる必要がある。その結果、異常診断に用いられるメモリ容量が増加してしまう。マイコンが複数備えられるPLCにおいては、各マイコンのメモリ容量が増加してしまうため、異常診断に用いられるメモリ容量の増加が顕著になってしまう。例えば、異常診断の実行頻度が低い場合、異常診断に用いられるメモリ容量が顕著に増加するのは好ましくない。メモリ容量が増加すると、メモリのコストが増加し、ひいてはPLCのコストが増加してしまう。 Here, there are many types of calculations that can be performed in a microcontroller. In this case, it is necessary to store in memory the expected values of the calculation results when each of the many calculations is performed. As a result, the memory capacity used for abnormality diagnosis increases. In a PLC equipped with multiple microcontrollers, the memory capacity of each microcontroller increases, and the increase in memory capacity used for abnormality diagnosis becomes significant. For example, if abnormality diagnosis is performed infrequently, it is not desirable to have a significant increase in memory capacity used for abnormality diagnosis. An increase in memory capacity increases the cost of the memory, which in turn increases the cost of the PLC.

本発明は、上記事情に鑑みてなされたものであり、異常診断に用いられるメモリ容量を削減しつつ、CPUの異常診断を適正に行うことができるプログラマブルロジックコントローラを提供することを主たる目的とするものである。 The present invention was made in consideration of the above circumstances, and its main objective is to provide a programmable logic controller that can properly diagnose CPU abnormalities while reducing the memory capacity used for abnormality diagnosis.

第1の発明は、不揮発性のメモリ、及び前記メモリからプログラムを読み出して演算を行う第1CPUを有する第1マイコンと、
第2CPUを有する第2マイコンと、を備えるプログラマブルロジックコントローラにおいて、
前記プログラムには、前記第1CPU及び前記第2CPUの少なくとも一方に異常が発生しているか否かを診断する診断ルーチンが含まれており、
前記第1CPUにより前記診断ルーチンの実行が開始されることにより、
前記第1CPUは、
オペコードに基づく処理をオペランドに施す第1演算を実行し、
前記第1演算で用いたオペコードを前記第2CPUに対して送信し、
前記第2CPUは、
受信したオペコードに基づく処理をオペランドに施す第2演算を実行し、
前記第2演算の演算結果を前記第1CPUに対して送信し、
前記第1CPUは、
前記第1演算の演算結果と、受信した前記第2演算の演算結果とを比較することにより、前記異常が発生しているか否かを診断し、
前記異常が発生していないと診断した場合、今回の前記第1演算で用いたオペコードに対するインクリメント又はデクリメントを実行することにより生成されたオペコードを、次回の前記第1演算で用いるオペコードとする。
A first invention is a first microcomputer having a non-volatile memory and a first CPU that reads a program from the memory and performs a calculation;
A programmable logic controller including a second microcomputer having a second CPU,
the program includes a diagnostic routine for diagnosing whether or not an abnormality has occurred in at least one of the first CPU and the second CPU;
When the first CPU starts execution of the diagnostic routine,
The first CPU is
performing a first operation on an operand based on an opcode;
Transmitting an opcode used in the first operation to the second CPU;
The second CPU is
performing a second operation on the operand based on the received opcode;
Transmitting a result of the second operation to the first CPU;
The first CPU is
by comparing a result of the first calculation with a result of the second calculation received, it is determined whether or not the abnormality has occurred;
If it is determined that no abnormality has occurred, the opcode generated by incrementing or decrementing the opcode used in the current first operation is set as the opcode to be used in the next first operation.

第1の発明では、PLCに対する機能安全を実現するための構成として、PLCは、第1,第2マイコンを備えている。第1マイコンを構成するメモリにはプログラムが記憶されており、プログラムには、第1CPU及び第2CPUの少なくとも一方に異常が発生しているか否かを診断する診断ルーチンが含まれている。第1マイコンを構成する第1CPUにより診断ルーチンの実行が開始されると、以下の処理が行われる。 In the first invention, the PLC is provided with a first and second microcomputer as a configuration for realizing functional safety for the PLC. A program is stored in the memory constituting the first microcomputer, and the program includes a diagnostic routine for diagnosing whether or not an abnormality has occurred in at least one of the first and second CPUs. When the first CPU constituting the first microcomputer starts executing the diagnostic routine, the following processing is performed.

第1CPUは、オペコードに基づく処理をオペランドに施す第1演算を実行し、第1演算で用いたオペコードを、第2マイコンを構成する第2CPUに対して送信する。第2CPUは、受信したオペコードに基づく処理をオペランドに施す第2演算を実行し、第2演算の演算結果を第1CPUに対して送信する。 The first CPU executes a first operation that processes the operands based on the opcode, and transmits the opcode used in the first operation to the second CPU constituting the second microcomputer. The second CPU executes a second operation that processes the operands based on the received opcode, and transmits the result of the second operation to the first CPU.

第1CPUは、第1演算の演算結果と、受信した第2演算の演算結果とを比較することにより、第1CPU及び第2CPUの少なくとも一方に異常が発生しているか否かを診断する。この場合、複数のオペコードそれぞれに対応する演算結果の期待値をメモリに記憶させておく必要がないため、異常診断に用いられるメモリ容量を削減することができる。 The first CPU compares the result of the first operation with the result of the received second operation to diagnose whether an abnormality has occurred in at least one of the first and second CPUs. In this case, since there is no need to store in memory the expected values of the operation results corresponding to each of the multiple opcodes, the memory capacity used for abnormality diagnosis can be reduced.

ここで、機械語としてのオペコードは、2以上のビット列からなる2進数データで表される。オペコードを構成するビット列のうち、対象となるインクリメントビット(例えば、最下位のビット)にインクリメントを実行する、又は対象となるデクリメントビットにデクリメントを実行することにより新たに生成されたオペコードは、インクリメント又はデクリメント前のオペコードとは異なる演算を規定するものとなる。つまり、ベースとなるオペコードにインクリメント又はデクリメントを実行するといった処理により、診断対象となる別のオペコードを生成することができる。この場合、診断ルーチンにおけるプログラムの行数を短くできる等、診断ルーチンの規模を小さくできる。 Here, the opcode as machine language is represented by binary data consisting of two or more bit strings. Among the bit strings that make up the opcode, a new opcode is generated by incrementing the target increment bit (e.g., the least significant bit) or decrementing the target decrement bit, and the new opcode specifies a different operation from the opcode before the increment or decrement. In other words, by performing a process such as incrementing or decrementing the base opcode, a different opcode to be diagnosed can be generated. In this case, the scale of the diagnostic routine can be reduced, for example by reducing the number of lines of the program in the diagnostic routine.

この点に鑑み、第1CPUは、異常が発生していないと判定した場合、今回の第1演算で用いたオペコードに対するインクリメント又はデクリメントを実行することにより生成されたオペコードを、次回の第1演算で用いるオペコードとする。これにより、診断対象となる演算それぞれを実行した場合における演算結果の期待値をメモリに記憶させる構成や、診断対象となる複数のオペコードのリストデータをメモリに記憶させる構成と比較して、異常診断に用いられるメモリ容量を好適に削減することができる。 In consideration of this, when the first CPU determines that no abnormality has occurred, it sets the opcode generated by incrementing or decrementing the opcode used in the current first operation as the opcode to be used in the next first operation. This makes it possible to suitably reduce the memory capacity used for abnormality diagnosis, compared to a configuration in which the expected values of the operation results when each operation to be diagnosed is executed is stored in memory, or a configuration in which list data of multiple opcodes to be diagnosed is stored in memory.

このように、第1の発明によれば、異常診断に用いられるメモリ容量を削減しつつ、CPUの異常診断を適正に行うことができる。 In this way, according to the first invention, it is possible to properly diagnose abnormalities in the CPU while reducing the memory capacity used for abnormality diagnosis.

ちなみに、PLCが備えるマイコンは、2つであってもよいし、3つ以上であってもよい。マイコンが3つ以上の場合、例えば、各マイコンのうち1つを第1マイコンとし、残りを第2マイコンとして第1の発明が適用されればよい。 The number of microcomputers that a PLC has may be two or more. When there are three or more microcomputers, for example, one of the microcomputers may be a first microcomputer and the rest may be second microcomputers, and the first invention may be applied.

ここで、第1の発明は、例えば第2の発明のように具体化することができる。第2の発明では、前記第1CPUは、診断対象となる各オペコードに対する前記第1演算が完了するとの条件が成立するまで、前記インクリメント又は前記デクリメントを繰り返し実行する。 Here, the first invention can be embodied, for example, as a second invention. In the second invention, the first CPU repeatedly executes the increment or decrement until a condition is met that indicates that the first operation for each opcode to be diagnosed is completed.

第3の発明は、第1又は第2の発明において、前記第1CPUは、前記第1演算で用いたオペコード及びオペランドを前記第2CPUに対して送信し、
前記第2CPUは、前記第2演算として、受信したオペコードに基づく処理を、受信したオペランドに施す演算を実行する。
In a third aspect, in the first or second aspect, the first CPU transmits an opcode and an operand used in the first arithmetic operation to the second CPU;
The second CPU executes, as the second operation, an operation of performing a process based on the received opcode on the received operand.

第3の発明によれば、第1演算及び第2演算で用いられるオペランドを共通化することができ、CPUの異常診断精度を高めることができる。 According to the third invention, the operands used in the first and second operations can be made common, thereby improving the accuracy of CPU abnormality diagnosis.

第4の発明は、第3の発明において、前記第2マイコンは、不揮発性のメモリを有し、
前記第2マイコンのメモリには、前記診断ルーチンが記憶されていない。
A fourth aspect of the present invention is the third aspect of the present invention, wherein the second microcomputer has a non-volatile memory;
The diagnostic routine is not stored in the memory of the second microcomputer.

第4の発明では、第1,第2マイコンのうち第1マイコンのメモリにのみ診断ルーチンが記憶される。このため、第2マイコンのメモリ容量を削減でき、ひいてはPLCのメモリ容量を好適に削減することができる。 In the fourth invention, the diagnostic routine is stored only in the memory of the first microcomputer out of the first and second microcomputers. This allows the memory capacity of the second microcomputer to be reduced, and thus the memory capacity of the PLC to be reduced in an advantageous manner.

一実施形態に係る制御システムの全体構成図。FIG. 1 is an overall configuration diagram of a control system according to an embodiment. CPUの異常診断処理の手順を示すフローチャート。4 is a flowchart showing a procedure for a CPU abnormality diagnosis process. 診断対象となる演算を規定するオペコードの一例を示す図。FIG. 4 is a diagram showing an example of an opcode that specifies an operation to be diagnosed. その他の実施形態に係る診断対象となる演算を規定するオペコードの一例を示す図。FIG. 13 is a diagram showing an example of an opcode that defines an operation to be diagnosed according to another embodiment.

以下、本発明に係るPLCを具体化した一実施形態について、図面を参照しつつ説明する。本実施形態のPLCは、ロボットやベルトコンベア等の産業用機器の制御システムを構成する。 Below, an embodiment of the PLC according to the present invention will be described with reference to the drawings. The PLC of this embodiment constitutes a control system for industrial equipment such as robots and belt conveyors.

図1に示すように、PLC100は、第1マイコン10と、第2マイコン20とを備えている。各マイコン10,20は、PLC100が備える筐体に収容されている。 As shown in FIG. 1, the PLC 100 includes a first microcomputer 10 and a second microcomputer 20. Each of the microcomputers 10 and 20 is housed in a housing provided for the PLC 100.

制御システムは、入力側機器110と、制御対象機器120とを備えている。制御対象機器120は、例えば、多関節ロボット等の工作機械、及びベルトコンベアを含む。入力側機器110は、例えば、制御対象機器120の状態(例えば、電流、電圧、回転速度)を検出するセンサ、及び制御対象機器120の動作を停止させる非常スイッチを含む。第1マイコン10及び第2マイコン20は、制御対象機器120の制御を行う。 The control system includes an input device 110 and a controlled device 120. The controlled device 120 includes, for example, a machine tool such as an articulated robot, and a conveyor belt. The input device 110 includes, for example, a sensor that detects the state of the controlled device 120 (for example, current, voltage, rotation speed), and an emergency switch that stops the operation of the controlled device 120. The first microcomputer 10 and the second microcomputer 20 control the controlled device 120.

第1マイコン10は、第1CPU11、第1RAM12、不揮発性のメモリである第1ROM13、及びインターフェース部として機能する第1通信部14を備えている。第1CPU11は、ALU(Arithmetic Logic Unit)と、内部レジスタとを備えている。本実施形態において、第1ROM13は、フラッシュメモリである。 The first microcomputer 10 includes a first CPU 11, a first RAM 12, a first ROM 13 which is a non-volatile memory, and a first communication unit 14 which functions as an interface unit. The first CPU 11 includes an ALU (Arithmetic Logic Unit) and an internal register. In this embodiment, the first ROM 13 is a flash memory.

第1ROM13には、第1CPU11により実行されるプログラム等が記憶されている。第1RAM12は、第1CPU11によりプログラムが実行される場合に使用される作業用のメモリである。 The first ROM 13 stores programs and the like executed by the first CPU 11. The first RAM 12 is a working memory used when the first CPU 11 executes programs.

第2マイコン20は、第2CPU21、第2RAM22、不揮発性のメモリである第2ROM23、及びインターフェース部として機能する第2通信部24を備えている。第2CPU21は、ALUと、内部レジスタとを備えている。本実施形態において、第2ROM23は、フラッシュメモリである。 The second microcomputer 20 includes a second CPU 21, a second RAM 22, a second ROM 23 which is a non-volatile memory, and a second communication unit 24 which functions as an interface unit. The second CPU 21 includes an ALU and an internal register. In this embodiment, the second ROM 23 is a flash memory.

第1マイコン10と第2マイコン20とは、第1通信部14及び第2通信部24を介して、例えばシリアル通信により、相互に通信が可能とされている。 The first microcontroller 10 and the second microcontroller 20 can communicate with each other via the first communication unit 14 and the second communication unit 24, for example, by serial communication.

本実施形態では、第1ROM13及び第2ROM23のうち第1ROM13のみに、第1CPU11及び第2CPU21のうち少なくとも一方の演算機能に異常が発生しているか否かを診断するための診断ルーチンが記憶されている。第1CPU11により診断ルーチンの実行が開始された場合に異常診断処理が実行される(図2参照)。この処理は、例えば、1時間に1回等、定期的に実行される。 In this embodiment, of the first ROM 13 and the second ROM 23, only the first ROM 13 stores a diagnostic routine for diagnosing whether an abnormality has occurred in the calculation function of at least one of the first CPU 11 and the second CPU 21. When the first CPU 11 starts executing the diagnostic routine, an abnormality diagnosis process is executed (see FIG. 2). This process is executed periodically, for example, once an hour.

診断対象となる演算には、算術演算命令及び論理演算命令等が含まれる。算術演算命令には、加減算命令、乗除算命令、シフト演算命令及び比較命令が含まれる。例えば、加算命令は、第1オペランドと第2オペランドとの間で加算を行う命令である。 The operations to be diagnosed include arithmetic operation instructions and logical operation instructions. Arithmetic operation instructions include addition/subtraction instructions, multiplication/division instructions, shift operation instructions, and comparison instructions. For example, an addition instruction is an instruction that performs addition between a first operand and a second operand.

図3に、本実施形態に係る診断対象となる複数(15個を例示)の演算機能を示す。図3には、演算機能を示す各オペコードに対応するニーモニック、整数演算,浮動小数点演算の場合の演算の意味、及びコンディションフラグを示す。本実施形態において、診断対象となるオペコードは4ビット列からなる2進数データで表され、オペランドは2進数データで表される。ただし、オペコードは、4ビット列に限らず、例えば、3ビット列であってもよいし、5以上のビット列であってもよい。 Figure 3 shows multiple (15 are shown) arithmetic functions to be diagnosed in this embodiment. Figure 3 also shows the mnemonic corresponding to each opcode indicating the arithmetic function, the meaning of the operation in the case of integer operation and floating-point operation, and the condition flag. In this embodiment, the opcode to be diagnosed is represented by binary data consisting of a 4-bit string, and the operand is represented by binary data. However, the opcode is not limited to a 4-bit string, and may be, for example, a 3-bit string or a string of 5 or more bits.

図2に示すように、ステップS10では、第1CPU11は、第1ROM13に記憶されているプログラムのうち診断ルーチンを第1RAM12に書き込み、診断ルーチンを実行する。これにより、異常診断処理が開始される。 As shown in FIG. 2, in step S10, the first CPU 11 writes a diagnostic routine from among the programs stored in the first ROM 13 to the first RAM 12 and executes the diagnostic routine. This starts the abnormality diagnosis process.

ステップS11では、第1CPU11は、診断対象となる演算機能を規定する最初のオペコードに基づく処理をオペランドに施す第1演算を実行する。図3を参照すると、最初のオペコードは「0000」である。 In step S11, the first CPU 11 executes a first operation that performs processing on an operand based on a first opcode that specifies the arithmetic function to be diagnosed. Referring to FIG. 3, the first opcode is "0000".

ステップS12では、第1CPU11は、ステップS11の第1演算で用いたオペコード及びオペランドを、第1通信部14及び第2通信部24を介して第2CPU21に対して送信する。 In step S12, the first CPU 11 transmits the opcode and operands used in the first operation in step S11 to the second CPU 21 via the first communication unit 14 and the second communication unit 24.

ステップS21では、第2CPU21は、ステップS12の処理により第1CPU11から送信されたオペコード及びオペランドを受信したか否かを判定する。第2CPU21は、受信していないと判定した場合、ステップS20に移行する。 In step S21, the second CPU 21 determines whether or not the opcode and operands transmitted from the first CPU 11 by the processing of step S12 have been received. If the second CPU 21 determines that they have not been received, it proceeds to step S20.

第2CPU21は、オペコード及びオペランドを受信したと判定した場合、ステップS22に進む。第2CPU21は、受信したオペコードに基づく処理を、受信したオペランドに施す第2演算を実行する。 If the second CPU 21 determines that an opcode and an operand have been received, the process proceeds to step S22. The second CPU 21 executes a second operation in which processing based on the received opcode is applied to the received operand.

ステップS23では、第2CPU21は、ステップS22における第2演算の演算結果を、第2通信部24及び第1通信部14を介して第1CPU11に対して送信する。 In step S23, the second CPU 21 transmits the result of the second calculation performed in step S22 to the first CPU 11 via the second communication unit 24 and the first communication unit 14.

ステップS13において、第1CPU11は、ステップS22における第2演算の演算結果を受信するまで待機する。第1CPU11は、第2演算の演算結果を受信したと判定した場合、ステップS14に進み、ステップS11における第1演算の演算結果と、受信した第2演算の演算結果とを比較する。第1CPU11は、第1演算の演算結果と第2演算の演算結果とが一致していると判定した場合、第1CPU11及び第2CPU21の双方の演算機能が正常であると判定する。一方、第1CPU11は、第1演算の演算結果と第2演算の演算結果とが一致しないと判定した場合、第1CPU11及び第2CPU21のうち少なくとも一方の演算機能に異常が発生していると判定する。 In step S13, the first CPU 11 waits until it receives the calculation result of the second calculation in step S22. If the first CPU 11 determines that it has received the calculation result of the second calculation, it proceeds to step S14 and compares the calculation result of the first calculation in step S11 with the received calculation result of the second calculation. If the first CPU 11 determines that the calculation result of the first calculation matches the calculation result of the second calculation, it determines that the calculation functions of both the first CPU 11 and the second CPU 21 are normal. On the other hand, if the first CPU 11 determines that the calculation result of the first calculation does not match the calculation result of the second calculation, it determines that an abnormality has occurred in the calculation function of at least one of the first CPU 11 and the second CPU 21.

具体的には、第1CPU11は、第1演算の演算結果(演算値)と第2演算の演算結果(演算値)との差の絶対値が閾値以下であると判定した場合、演算結果が一致していると判定し、絶対値が閾値よりも大きいと判定した場合、演算結果が一致していないと判定する。閾値は、例えば、ステップS11,S22の演算において発生し得る誤差の最大値に設定されていればよい。 Specifically, if the first CPU 11 determines that the absolute value of the difference between the calculation result (calculated value) of the first calculation and the calculation result (calculated value) of the second calculation is equal to or less than a threshold value, it determines that the calculation results match, and if it determines that the absolute value is greater than the threshold value, it determines that the calculation results do not match. The threshold value may be set to, for example, the maximum value of the error that can occur in the calculations of steps S11 and S22.

第1CPU11は、正常であると判定した場合、ステップS15に進み、対象となる全てのオペコードに対する異常診断が完了したか否かを判定する。図3を参照すると、第1CPU11は、今回のステップS11の第1演算で用いたオペコードが「1110」であると判定した場合、異常診断が完了したと判定する。 If the first CPU 11 determines that the operation is normal, it proceeds to step S15 and determines whether or not abnormality diagnosis has been completed for all target opcodes. Referring to FIG. 3, if the first CPU 11 determines that the opcode used in the first calculation in step S11 this time is "1110", it determines that abnormality diagnosis has been completed.

第1CPU11は、異常診断が完了したと判定した場合、ステップS16に進み、第1通信部14及び第2通信部24を介して第2CPU21に対して診断完了を通知する。その後、第1CPU11は、図2に示す一連の処理を一旦終了する。 If the first CPU 11 determines that the abnormality diagnosis is complete, the process proceeds to step S16, where the first CPU 11 notifies the second CPU 21 of the completion of the diagnosis via the first communication unit 14 and the second communication unit 24. After that, the first CPU 11 temporarily ends the series of processes shown in FIG. 2.

第2CPU21は、ステップS16の処理により送信された診断完了通知を受信したか否かを判定する。第2CPU21は、診断完了通知を受信していないと判定した場合、ステップS21に進む。一方、第2CPU21は、診断完了通知を受信したと判定した場合、図2に示す一連の処理を一旦終了する。 The second CPU 21 determines whether or not the diagnosis completion notification transmitted by the processing of step S16 has been received. If the second CPU 21 determines that the diagnosis completion notification has not been received, the process proceeds to step S21. On the other hand, if the second CPU 21 determines that the diagnosis completion notification has been received, the process of FIG. 2 is temporarily terminated.

ステップS15において、第1CPU11は、異常診断が完了していないと判定した場合、ステップS17に進み、今回のステップS11の第1演算で用いたオペコードに対するインクリメントを実行する。具体的には、第1CPU11は、オペコードの最下位のビットをインクリメントビットとし、そのインクリメントビットに対する「b0001」のインクリメントを実行する。なお、「b」は2進数であることを示す表記である。その後、第1CPU11は、ステップS11に移行する。これにより、次回のステップS11の第1演算において、インクリメントが実行されたオペコードが用いられる。例えば、今回の第1演算で用いられたオペコードが「0000」である場合、ステップS17の処理により新たに生成されたオペコードは「0001」となり、このオペコードが次回の第1演算に用いられる。 If the first CPU 11 determines in step S15 that the abnormality diagnosis is not complete, the process proceeds to step S17, where it increments the opcode used in the current first calculation in step S11. Specifically, the first CPU 11 sets the least significant bit of the opcode as the increment bit, and increments the increment bit by "b0001". Note that "b" is a notation indicating that the number is a binary number. The first CPU 11 then proceeds to step S11. As a result, the incremented opcode is used in the next first calculation in step S11. For example, if the opcode used in the current first calculation is "0000", the opcode newly generated by the process in step S17 becomes "0001", and this opcode is used in the next first calculation.

一方、第1CPU11は、ステップS14において異常が発生していると判定した場合には、ステップS18に進む。ステップS18では、第1CPU11は、異常が発生した旨を、PLC100に対して上位の制御装置(不図示)に通知する。 On the other hand, if the first CPU 11 determines in step S14 that an abnormality has occurred, the process proceeds to step S18. In step S18, the first CPU 11 notifies a higher-level control device (not shown) of the occurrence of an abnormality with respect to the PLC 100.

続くステップS19では、第1CPU11は、第1通信部14及び第2通信部24を介して第2CPU21に対して、診断終了を通知する。 In the next step S19, the first CPU 11 notifies the second CPU 21 via the first communication unit 14 and the second communication unit 24 that the diagnosis has ended.

ステップS20では、第2CPU21は、ステップS19の処理により送信された診断終了通知を受信したか否かを判定する。第2CPU21は、診断終了通知を受信していないと判定した場合、ステップS21に進む。一方、第2CPU21は、診断終了通知を受信したと判定した場合、図2に示す一連の処理を一旦終了する。つまり、診断対象となる複数の演算機能のうち、途中の診断対象において異常が発生していると判定された場合、異常診断処理が強制的に中断されることとなる。 In step S20, the second CPU 21 determines whether or not the diagnosis end notification transmitted by the processing of step S19 has been received. If the second CPU 21 determines that the diagnosis end notification has not been received, the process proceeds to step S21. On the other hand, if the second CPU 21 determines that the diagnosis end notification has been received, the process temporarily ends the series of processes shown in FIG. 2. In other words, if it is determined that an abnormality has occurred in one of the multiple calculation functions to be diagnosed, the abnormality diagnosis process is forcibly interrupted.

以上説明した本実施形態によれば、以下の効果が得られるようになる。 The present embodiment described above provides the following advantages:

第1CPU11は、ステップS14において異常が発生していないと判定した場合、ステップS15において診断が完了するとの条件が成立するまで、ステップS17において、第1演算で用いたオペコードに対するインクリメントを実行する。第1CPU11は、インクリメントの実行により生成されたオペコードを、次回の第1演算で用いるオペコードとする。これにより、診断対象となる演算それぞれを実行した場合における演算結果の期待値を第1ROM13に記憶させる構成や、診断対象となる複数のオペコードのリストデータを第1ROM13に記憶させる構成と比較して、異常診断に用いられるメモリ容量を好適に削減することができる。これにより、例えば、各マイコン10,20に対して外付けされる不揮発性メモリを備える必要がなくなるため、PLC100の筐体を小型化でき、ひいてはPLC100を小型化することができる。 When the first CPU 11 determines in step S14 that no abnormality has occurred, in step S17, it increments the opcode used in the first operation until the condition for completing the diagnosis is met in step S15. The first CPU 11 uses the opcode generated by the increment as the opcode to be used in the next first operation. This makes it possible to suitably reduce the memory capacity used for abnormality diagnosis compared to a configuration in which the expected value of the operation result when each operation to be diagnosed is executed is stored in the first ROM 13, or a configuration in which list data of multiple opcodes to be diagnosed is stored in the first ROM 13. This makes it possible to, for example, eliminate the need to provide an external nonvolatile memory for each microcomputer 10, 20, thereby making it possible to reduce the size of the housing of the PLC 100 and, ultimately, the size of the PLC 100.

第1CPU11は、ステップS12において、第1演算で用いたオペコード及びオペランドを第2CPUに対して送信する。第2CPUは、ステップS22において、受信したオペコードに基づく処理を、受信したオペランドに施す演算を実行する。これにより、ステップS11の第1演算及びステップS22の第2演算で用いられるオペランドを共通化することができ、CPUの異常診断精度を高めることができる。 In step S12, the first CPU 11 transmits the opcode and operands used in the first operation to the second CPU. In step S22, the second CPU executes an operation that applies processing based on the received opcode to the received operands. This allows the operands used in the first operation in step S11 and the second operation in step S22 to be standardized, thereby improving the accuracy of CPU abnormality diagnosis.

第1ROM13及び第2ROM23のうち第1ROM13のみに診断ルーチンが記憶されている。これにより、第2マイコン20が備えるべきメモリ容量を削減することができる。 Of the first ROM 13 and the second ROM 23, the diagnostic routine is stored only in the first ROM 13. This allows the memory capacity required for the second microcomputer 20 to be reduced.

<その他の実施形態>
なお、上記実施形態は、以下のように変更して実施してもよい。
<Other embodiments>
The above embodiment may be modified as follows.

・第1ROM13に記憶されている複数の演算機能が複数のグループに分けられ、各グループに対して図2に示す異常診断処理が実行されてもよい。図4に、5ビットのオペコードの一例を示す。図4に示す演算機能は、No.1~3の第1グループと、No.4~7の第2グループと、No.8~11の第3グループとに分けられている。 -The multiple calculation functions stored in the first ROM 13 may be divided into multiple groups, and the abnormality diagnosis process shown in FIG. 2 may be executed for each group. FIG. 4 shows an example of a 5-bit opcode. The calculation functions shown in FIG. 4 are divided into a first group of No. 1 to 3, a second group of No. 4 to 7, and a third group of No. 8 to 11.

第1グループについて異常診断処理が実行される場合、第1CPU11は、図2のステップS17において、オペコードの最下位から3番目のビットをインクリメントビットとし、そのインクリメントビットに対する「b00100」のインクリメントを実行する。 When abnormality diagnosis processing is performed for the first group, in step S17 of FIG. 2, the first CPU 11 sets the third least significant bit of the opcode as the increment bit and increments the increment bit to "b00100".

第2グループについて異常診断処理が実行される場合、第1CPU11は、ステップS17において、インクリメントビットを第1グループの場合におけるインクリメントビットから変更する。詳しくは、第1CPU11は、オペコードの最下位のビットをインクリメントビットとし、そのインクリメントビットに対する「b00001」のインクリメントを実行する。 When abnormality diagnosis processing is performed for the second group, the first CPU 11 changes the increment bit from the increment bit for the first group in step S17. In detail, the first CPU 11 sets the least significant bit of the opcode as the increment bit, and increments the increment bit by "b00001".

第3グループについて異常診断処理が実行される場合、第1CPU11は、ステップS17において、オペコードの最下位から3番目のビットをインクリメントビットとし、そのインクリメントビットに対する「b00100」のインクリメントを実行する。 When abnormality diagnosis processing is performed for the third group, in step S17, the first CPU 11 sets the third least significant bit of the opcode as the increment bit and increments the increment bit to "b00100".

・第2ROM23にも上述した診断ルーチンが記憶されていてもよい。この場合、図2に示した第1CPU11側の処理が第2CPU21により実行され、図2に示した第2CPU21側の処理が第1CPU11により実行される。この場合、第2CPU21が第1演算を実行し、第1CPU11が第2演算を実行し、第2CPU21が異常の有無を判定する。 - The above-mentioned diagnostic routine may also be stored in the second ROM 23. In this case, the processing on the first CPU 11 side shown in FIG. 2 is executed by the second CPU 21, and the processing on the second CPU 21 side shown in FIG. 2 is executed by the first CPU 11. In this case, the second CPU 21 executes the first calculation, the first CPU 11 executes the second calculation, and the second CPU 21 determines whether or not there is an abnormality.

・第1CPU11は、図2のステップS17において、今回の第1演算で用いたオペコードの最下位のビットをデクリメントビットとし、そのデクリメントビットに対するデクリメントを実行してもよい。この場合、第1CPU11は、異常診断処理が開始されてからの最初のステップS11において、ベースとなる最初のオペコードを、例えば図3の「1110」とすればよい。 - In step S17 of FIG. 2, the first CPU 11 may set the least significant bit of the opcode used in this first operation as a decrement bit and execute a decrement on that decrement bit. In this case, in the first step S11 after the start of the abnormality diagnosis process, the first CPU 11 may set the first opcode that serves as the base to, for example, "1110" in FIG. 3.

・第1マイコン及び第2マイコンを備え、制御対象機器の制御処理及び上述した異常診断処理を行う電子装置としては、プログラマブルロジックコントローラに限らない。 -An electronic device that includes a first microcomputer and a second microcomputer and performs the control process for the controlled device and the abnormality diagnosis process described above is not limited to a programmable logic controller.

10,20…第1,第2マイコン、11,21…第1,第2CPU、13,23…第1,第2ROM、100…PLC。 10, 20...first and second microcomputers, 11, 21...first and second CPUs, 13, 23...first and second ROMs, 100...PLC.

Claims (2)

不揮発性のメモリ、及び前記メモリからプログラムを読み出して演算を行う第1CPUを有する第1マイコンと、
不揮発性のメモリ、及び第2CPUを有する第2マイコンと、を備えるプログラマブルロジックコントローラにおいて、
前記プログラムには、前記第1CPU及び前記第2CPUの少なくとも一方に異常が発生しているか否かを診断する診断ルーチンが含まれており、
前記第1CPUにより前記診断ルーチンの実行が開始されることにより、
前記第1CPUは、
オペコードに基づく処理をオペランドに施す第1演算を実行し、
前記第1演算で用いたオペコード及びオペランドを前記第2CPUに対して送信し、
前記第2CPUは、
受信したオペコードに基づく処理を、受信したオペランドに施す第2演算を実行し、
前記第2演算の演算結果を前記第1CPUに対して送信し、
前記第1CPUは、
前記第1演算の演算結果と、受信した前記第2演算の演算結果とを比較することにより、前記異常が発生しているか否かを診断し、
前記異常が発生していないと診断した場合、今回の前記第1演算で用いたオペコードに対するインクリメント又はデクリメントを実行することにより生成されたオペコードを、次回の前記第1演算で用いるオペコードとし、
前記第2マイコンのメモリには、前記診断ルーチンが記憶されていない、プログラマブルロジックコントローラ。
a first microcomputer having a non-volatile memory and a first CPU that reads a program from the memory and performs calculations;
A programmable logic controller including a non-volatile memory and a second microcomputer having a second CPU,
the program includes a diagnostic routine for diagnosing whether or not an abnormality has occurred in at least one of the first CPU and the second CPU;
When the first CPU starts execution of the diagnostic routine,
The first CPU is
performing a first operation on an operand based on an opcode;
Sending an opcode and an operand used in the first operation to the second CPU;
The second CPU is
performing a second operation on the received operand based on the received opcode;
Transmitting a result of the second operation to the first CPU;
The first CPU is
by comparing a result of the first calculation with a result of the second calculation received, it is determined whether or not the abnormality has occurred;
When it is determined that the abnormality has not occurred, the opcode generated by incrementing or decrementing the opcode used in the current first operation is set as the opcode to be used in the next first operation ;
The diagnostic routine is not stored in the memory of the second microcomputer .
前記第1CPUは、診断対象となる各オペコードに対する前記第1演算が完了するとの条件が成立するまで、前記インクリメント又は前記デクリメントを繰り返し実行する、請求項1に記載のプログラマブルロジックコントローラ。 The programmable logic controller according to claim 1, wherein the first CPU repeatedly executes the increment or the decrement until a condition is met that the first operation for each opcode to be diagnosed is completed.
JP2021048729A 2021-03-23 2021-03-23 Programmable Logic Controller Active JP7587147B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021048729A JP7587147B2 (en) 2021-03-23 2021-03-23 Programmable Logic Controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2021048729A JP7587147B2 (en) 2021-03-23 2021-03-23 Programmable Logic Controller

Publications (2)

Publication Number Publication Date
JP2022147474A JP2022147474A (en) 2022-10-06
JP7587147B2 true JP7587147B2 (en) 2024-11-20

Family

ID=83462635

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021048729A Active JP7587147B2 (en) 2021-03-23 2021-03-23 Programmable Logic Controller

Country Status (1)

Country Link
JP (1) JP7587147B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000082052A (en) 1998-09-04 2000-03-21 Nec Eng Ltd Multiprocessor system, its diagnostic method, and recording medium recorded with its control program
JP2009259134A (en) 2008-04-21 2009-11-05 Koyo Electronics Ind Co Ltd Safety plc
JP2013242708A (en) 2012-05-21 2013-12-05 Denso Corp Electronic control unit
JP2014215656A (en) 2013-04-23 2014-11-17 日立オートモティブシステムズ株式会社 Electronic controller for vehicle
JP2020135046A (en) 2019-02-13 2020-08-31 オムロン株式会社 Control unit

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000082052A (en) 1998-09-04 2000-03-21 Nec Eng Ltd Multiprocessor system, its diagnostic method, and recording medium recorded with its control program
JP2009259134A (en) 2008-04-21 2009-11-05 Koyo Electronics Ind Co Ltd Safety plc
JP2013242708A (en) 2012-05-21 2013-12-05 Denso Corp Electronic control unit
JP2014215656A (en) 2013-04-23 2014-11-17 日立オートモティブシステムズ株式会社 Electronic controller for vehicle
JP2020135046A (en) 2019-02-13 2020-08-31 オムロン株式会社 Control unit

Also Published As

Publication number Publication date
JP2022147474A (en) 2022-10-06

Similar Documents

Publication Publication Date Title
EP2569694B1 (en) Conditional compare instruction
EP0766169B1 (en) Processor and control method for performing proper saturation operation
JP5348499B2 (en) I/O units and industrial controllers
EP0286354B1 (en) A method and apparatus for modifying micro-instructions using a macro-instruction pipeline
US10006455B2 (en) Drive control apparatus
US11281178B2 (en) Controlling apparatus for industrial products
EP2386960A2 (en) Computer system
JP7587147B2 (en) Programmable Logic Controller
US7991982B2 (en) Microcomputer and encoding system for executing peripheral function instructions
JP2009129463A (en) Method for handling temporary error in real-time system of vehicle control apparatus
JP5182101B2 (en) Electric power steering device
JP7809934B2 (en) Processor
EP0397414B1 (en) Control device having a function of modifying a microinstruction
JPS63268002A (en) Programmable controller
JP2009122831A (en) Electronic control unit
US6195779B1 (en) Microprocessor having built-in CRC section and method for performing CRC operations using the same
JP5157129B2 (en) Information processing apparatus and circuit design method therefor
JP4747028B2 (en) Microprocessor, information processing method and program using the same
JPS63240602A (en) Sequence controller abnormality diagnosis device
WO2011142015A1 (en) Operator anomaly assessment device and method
KR100962003B1 (en) On-the-Fly Testing Method and System of Embedded Software Using SPEC Component
JP5088566B2 (en) PLC with interrupt function
JP3500623B2 (en) Analog signal input / output device
JP2024001493A (en) Task monitoring system and task monitoring program
JP2025066221A5 (en)

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230724

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240308

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240507

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20240626

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20240902

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20241021

R150 Certificate of patent or registration of utility model

Ref document number: 7587147

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150