Programmable Logic Controller

The PLC configuration with two microcomputers diagnoses CPU abnormalities by sharing operations and using incremented opcodes, reducing memory requirements and costs while maintaining accuracy.

JP7587147B2Active Publication Date: 2024-11-20DENSO WAVE INC
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2021048729
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-03-23
Publication Date
2024-11-20
Estimated Expiration
2041-03-23

AI Technical Summary

Technical Problem

Existing programmable logic controllers (PLCs) with multiple microcontrollers face increased memory capacity requirements for abnormality diagnosis, leading to higher costs due to the need to store expected values of various calculations, which is undesirable when diagnosis frequency is low.

Method used

A programmable logic controller configuration with two microcomputers, where one CPU executes a diagnostic routine, transmits opcodes and operands to the other CPU for processing, and compares results to diagnose abnormalities without storing expected values, using incremented or decremented opcodes for diagnosis.

Benefits of technology

This approach reduces memory capacity needed for abnormality diagnosis, allowing for smaller PLCs with improved diagnostic accuracy and reduced costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007587147000001
    Figure 0007587147000001
  • Figure 0007587147000002
    Figure 0007587147000002
  • Figure 0007587147000003
    Figure 0007587147000003
Patent Text Reader

Abstract

To provide a PLC capable of appropriately diagnosing CPU abnormalities while reducing the memory capacity used for abnormality diagnosis.SOLUTION: A PLC 100 includes a first microcomputer 10 having a first CPU 11, and a second microcomputer 20 having a second CPU 21. The first CPU 11 executes a first calculation for applying processing based on an opcode to an operand, and transmits an opcode used in the first calculation to the second CPU 21. The second CPU 21 executes a second calculation for applying processing based on the received opcode to the operand, and transmits calculation results to the first CPU 11. The first CPU 11 diagnoses whether or not an abnormality has occurred by comparing the calculation results of the first and second calculations. When it is diagnosed that no abnormality has occurred, an opcode generated by executing increment to the opcode used in the present first calculation is used as an opcode to be used in the next first calculation.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a programmable logic controller for use in fields such as industrial equipment. [Background technology]

[0002] As this type of programmable logic controller (hereinafter, PLC), there is known one that includes a microcomputer having a non-volatile memory and a CPU that reads a program from the memory and performs calculations, as shown in, for example, Patent Document 1. The CPU has calculation functions such as arithmetic calculations and logical calculations. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] JP 2016-45712 A Summary of the Invention [Problem to be solved by the invention]

[0004] As a configuration for realizing functional safety for PLCs, there are PLCs equipped with multiple microcomputers. Anomalies can occur in the calculation functions of the CPUs that make up this PLC. For this reason, it is required to periodically diagnose whether or not anomalies have occurred in the CPUs. The following methods are available for this anomaly diagnosis.

[0005] In each microcomputer, an expected value of a calculation result when a specific calculation is executed is stored in a memory. In each microcomputer, a 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.

[0006] Here, there are many types of calculations in a microcontroller. In this case, it is necessary to store in memory the expected value of the calculation result when each of the many calculations is executed. 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, when abnormality diagnosis is performed infrequently, it is not desirable to significantly increase the memory capacity used for abnormality diagnosis. When the memory capacity increases, the cost of the memory increases, and thus the cost of the PLC increases.

[0007] The present invention has been made in consideration of the above circumstances, and has as its main object to provide a programmable logic controller that can properly perform abnormality diagnosis of a CPU while reducing the memory capacity used for abnormality diagnosis. [Means for solving the problem]

[0008] The first invention is 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 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 executing the diagnostic routine, The first CPU, 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, 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, Diagnosing whether or not the abnormality has occurred by comparing the result of the first calculation with the result of the second calculation received; 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.

[0009] In a first aspect of the present invention, the PLC includes a first and a second microcomputer as a configuration for realizing functional safety for the PLC. A program is stored in a 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 CPU and the second CPU. When the first CPU constituting the first microcomputer starts executing the diagnostic routine, the following process is performed.

[0010] The first CPU executes a first operation for performing processing on the operand based on the opcode, and transmits the opcode used in the first operation to a second CPU constituting a second microcomputer. The second CPU executes a second operation for performing processing on the operand based on the received opcode, and transmits the operation result of the second operation to the first CPU.

[0011] The first CPU compares the result of the first operation with the result of the received second operation to diagnose whether or not an abnormality has occurred in at least one of the first and second CPUs. In this case, since it is not necessary 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.

[0012] Here, the opcode as a machine language is represented by binary data consisting of a string of two or more bits. Among the bit strings constituting the opcode, a new opcode generated by incrementing a target increment bit (e.g., the least significant bit) or decrementing a target decrement bit specifies an operation different from the opcode before the increment or decrement. In other words, by performing a process of incrementing or decrementing a base opcode, a different opcode to be diagnosed can be generated. In this case, the number of lines of a program in the diagnostic routine can be reduced, and the scale of the diagnostic routine can be reduced.

[0013] In view 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 an expected value of the operation result when each of the operations to be diagnosed is executed is stored in memory, or a configuration in which list data of a plurality of opcodes to be diagnosed is stored in memory.

[0014] Thus, according to the first aspect of the present invention, it is possible to appropriately perform abnormality diagnosis of the CPU while reducing the memory capacity used for abnormality diagnosis.

[0015] Incidentally, the number of microcomputers included in the PLC may be two or more than two. When there are three or more microcomputers, for example, one of the microcomputers may be designated as a first microcomputer and the remaining microcomputers may be designated as second microcomputers, and the first invention may be applied thereto.

[0016] Here, the first invention can be embodied, for example, as a second invention, in which the first CPU repeatedly executes the increment or decrement until a condition is satisfied that the first operation for each opcode to be diagnosed is completed.

[0017] A third invention is the first or second invention, wherein 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 a received operand.

[0018] According to the third aspect of the present invention, the operands used in the first and second operations can be made common, thereby improving the accuracy of CPU abnormality diagnosis.

[0019] 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.

[0020] In the fourth aspect of the present invention, the diagnostic routine is stored only in the memory of the first microcomputer out of the first and second microcomputers, which makes it possible to reduce the memory capacity of the second microcomputer and, in turn, to advantageously reduce the memory capacity of the PLC. [Brief description of the drawings]

[0021] [Figure 1] FIG. 1 is an overall configuration diagram of a control system according to an embodiment. [Diagram 2] 6 is a flowchart showing the procedure of a CPU abnormality diagnosis process. [Diagram 3] FIG. 4 is a diagram showing an example of an opcode that specifies an operation to be diagnosed. [Figure 4] FIG. 13 is a diagram showing an example of an opcode that defines an operation to be diagnosed according to another embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0022] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of a PLC according to the present invention will now be described with reference to the drawings. The PLC of this embodiment constitutes a control system for industrial equipment such as a robot or a belt conveyor.

[0023] 1, the PLC 100 includes a first microcomputer 10 and a second microcomputer 20. The microcomputers 10 and 20 are housed in a housing provided in the PLC 100.

[0024] The control system includes an input device 110 and a control target device 120. The control target device 120 includes, for example, a machine tool such as an articulated robot, and a belt conveyor. The input device 110 includes, for example, a sensor that detects the state (e.g., current, voltage, rotation speed) of the control target device 120, and an emergency switch that stops the operation of the control target device 120. The first microcomputer 10 and the second microcomputer 20 control the control target device 120.

[0025] 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.

[0026] 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 the programs.

[0027] 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.

[0028] The first microcomputer 10 and the second microcomputer 20 are capable of communicating with each other via a first communication unit 14 and a second communication unit 24, for example, by serial communication.

[0029] In this embodiment, only the first ROM 13 of the first ROM 13 and the second ROM 23 stores a diagnostic routine for diagnosing whether or not an abnormality occurs in the arithmetic 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.

[0030] The operations to be diagnosed include arithmetic operation instructions and logical operation instructions. The 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.

[0031] Fig. 3 shows a plurality of (15 are shown as an example) arithmetic functions to be diagnosed according to this embodiment. Fig. 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 bit string of 5 or more bits.

[0032] 2, in step S10, the first CPU 11 writes a diagnostic routine from among the programs stored in the first ROM 13 into the first RAM 12, and executes the diagnostic routine, thereby starting the abnormality diagnosis process.

[0033] In step S11, the first CPU 11 executes a first operation for performing a process on an operand based on a first opcode that specifies an arithmetic function to be diagnosed. Referring to Fig. 3, the first opcode is "0000".

[0034] In step S12, the first CPU 11 transmits the opcode and operand used in the first calculation in step S11 to the second CPU 21 via the first communication unit 14 and the second communication unit 24.

[0035] In step S21, the second CPU 21 determines whether or not the opcode and operand transmitted in the process of step S12 from the first CPU 11 have been received. If the second CPU 21 determines that they have not been received, the process proceeds to step S20.

[0036] If the second CPU 21 determines that it has received the opcode and the operand, the process proceeds to step S22. The second CPU 21 executes a second operation in which a process based on the received opcode is applied to the received operand.

[0037] In step S23, the second CPU 21 transmits the calculation result of the second calculation in step S22 to the first CPU 11 via the second communication unit 24 and the first communication unit .

[0038] 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.

[0039] Specifically, when 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, it determines that the calculation results match, and when the absolute value is greater than the threshold, it determines that the calculation results do not match. The threshold may be set to, for example, the maximum value of the error that may occur in the calculations of steps S11 and S22.

[0040] If the first CPU 11 determines that the operation is normal, the process proceeds to step S15, where the first CPU 11 determines whether the abnormality diagnosis for all the target opcodes is completed. Referring to Fig. 3, if the first CPU 11 determines that the opcode used in the first calculation in step S11 is "1110", the first CPU 11 determines that the abnormality diagnosis is completed.

[0041] When the first CPU 11 determines that the abnormality diagnosis is completed, the process proceeds to step S16, and 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.

[0042] The second CPU 21 determines whether or not the diagnosis completion notification transmitted in the process 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.

[0043] In step S15, if the first CPU 11 determines that the abnormality diagnosis is not complete, the process proceeds to step S17, where the first CPU 11 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 an increment bit, and increments the increment bit by "b0001". Note that "b" is a notation indicating 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.

[0044] 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 PLC 100 that an abnormality has occurred.

[0045] 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 of the end of the diagnosis.

[0046] In step S20, the second CPU 21 determines whether or not the diagnosis end notification transmitted by the process 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 an intermediate diagnosis target among the multiple arithmetic functions to be diagnosed, the abnormality diagnosis process is forcibly interrupted.

[0047] According to the present embodiment described above, the following effects can be obtained.

[0048] If it is determined in step S14 that no abnormality has occurred, the first CPU 11 increments the opcode used in the first operation in step S17 until the condition that the diagnosis is completed is satisfied in step S15. The first CPU 11 sets 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 with 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 a plurality of opcodes to be diagnosed is stored in the first ROM 13. This makes it possible to, for example, reduce the size of the housing of the PLC 100, and thus reduce the size of the PLC 100.

[0049] 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 to apply 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 common, thereby improving the accuracy of CPU abnormality diagnosis.

[0050] Of the first ROM 13 and the second ROM 23, the diagnostic routine is stored only in the first ROM 13. This makes it possible to reduce the memory capacity that the second microcomputer 20 should have.

[0051] <Other embodiments> The above embodiment may be modified as follows.

[0052] The plurality of arithmetic functions stored in the first ROM 13 may be divided into a plurality of groups, and the abnormality diagnosis process shown in Fig. 2 may be executed for each group. An example of a 5-bit opcode is shown in Fig. 4. The arithmetic 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.

[0053] When the abnormality diagnosis process is executed for the first group, the first CPU 11 sets the third least significant bit of the opcode as an increment bit in step S17 of FIG. 2, and increments the increment bit by "b00100".

[0054] When the abnormality diagnosis process is executed for the second group, the first CPU 11 changes the increment bit from the increment bit in the case of the first group in step S17. More specifically, the first CPU 11 sets the least significant bit of the opcode as the increment bit, and increments the increment bit by "b00001".

[0055] When the abnormality diagnosis process is executed for the third group, in step S17, the first CPU 11 sets the third least significant bit of the opcode as an increment bit, and increments the increment bit by "b00100".

[0056] The above-mentioned diagnostic routine may also be stored in the second ROM 23. In this case, the process on the first CPU 11 side shown in Fig. 2 is executed by the second CPU 21, and the process 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.

[0057] The first CPU 11 may use the least significant bit of the opcode used in the current first operation as a decrement bit in step S17 in Fig. 2, and may execute a decrement on the decrement bit. In this case, the first CPU 11 may set the initial opcode to be the base, for example, "1110" in Fig. 3, in the first step S11 after the start of the abnormality diagnosis process.

[0058] The electronic device that includes the first microcomputer and the second microcomputer and performs the control process of the controlled device and the abnormality diagnosis process described above is not limited to a programmable logic controller. [Explanation of symbols]

[0059] 10, 20...first and second microcontrollers, 11, 21...first and second CPUs, 13, 23...first and second ROMs, 100...PLC.

Claims

1. 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.

2. 2. 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.

Citation Information

Patent Citations

  • Arithmetic abnormality detecting device for controller

    JP1992295955A

  • Multiprocessor system, its diagnostic method, and recording medium recorded with its control program

    JP2000082052A

  • Safety PLC

    JP2009259134A

  • Electronic control unit

    JP2013242708A

  • Electronic controller for vehicle

    JP2014215656A