WO2021005691A1 - 制御装置、プログラム監視方法及びプログラム - Google Patents

制御装置、プログラム監視方法及びプログラム Download PDF

Info

Publication number
WO2021005691A1
WO2021005691A1 PCT/JP2019/027022 JP2019027022W WO2021005691A1 WO 2021005691 A1 WO2021005691 A1 WO 2021005691A1 JP 2019027022 W JP2019027022 W JP 2019027022W WO 2021005691 A1 WO2021005691 A1 WO 2021005691A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
program
comparison
control
control device
Prior art date
Application number
PCT/JP2019/027022
Other languages
English (en)
French (fr)
Inventor
宏暉 劉
伴彰 ▲高▼木
Original Assignee
三菱電機株式会社
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 三菱電機株式会社 filed Critical 三菱電機株式会社
Priority to JP2020504428A priority Critical patent/JPWO2021005691A1/ja
Priority to PCT/JP2019/027022 priority patent/WO2021005691A1/ja
Publication of WO2021005691A1 publication Critical patent/WO2021005691A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts

Definitions

  • the present invention relates to a control device, a program monitoring method, and a program.
  • the control device controls various devices to realize production processes, processing processes, inspection processes, and other processes.
  • the control device executes a process arbitrarily specified by the user by executing a program provided by the user. When this process is executed, it is desirable to confirm the validity of the process content. Therefore, it is conceivable to use a technique for verifying data in the control device (see, for example, Patent Document 1).
  • Patent Document 1 describes a technique for verifying the validity of parameters that determine the operation mode of a programmable controller. It also describes verifying the validity of the parameters at the initial startup of the programmable controller.
  • a check code is calculated from a parameter, and when the calculated check code is different from the check code stored in the storage unit, the programmable controller reads the parameter and sets the operation mode. According to this technique, when the value of a parameter is changed, the parameter update can be reflected without restarting the programmable controller.
  • the validity of the parameters is verified at the initial startup, it is possible to prevent the programmable controller from operating in an erroneous operation mode.
  • An object of the present invention is to control the calculation load when executing the control process by controlling the timing of confirming the validity of the program.
  • control device of the present invention is a control device that executes a control process for controlling a device, and is a modification of a target program to be monitored included in a program for executing the control process.
  • a receiving means for receiving an execution instruction of code processing including a calculation process for calculating a detection code for detecting the above, a comparison process for comparing the calculated detection code with a comparison code calculated from a target program in the past, and It includes a calculation means for calculating a detection code from a target program, a determination means for determining whether or not the detection code is equal to a comparison code, and an execution means for executing code processing according to an execution instruction.
  • the receiving means receives an execution instruction of code processing including a calculation process and a comparison process, and the executing means executes the code process according to the execution instruction. Therefore, the user can arbitrarily set the timing at which the code processing is executed. This makes it possible to control the timing of calculation by the control device when confirming the validity of the program. Therefore, by controlling the timing for confirming the validity of the program, it is possible to control the calculation load when executing the control process.
  • the figure which shows the structure of the control system which concerns on embodiment of this invention The figure which shows the hardware configuration of the user terminal and the control device which concerns on embodiment.
  • the figure which shows the specific example of the ladder program which concerns on embodiment The figure which shows an example of the information stored in the storage part which concerns on embodiment. Flowchart showing code processing according to the embodiment
  • control device 10 according to the embodiment of the present invention will be described in detail with reference to the drawings.
  • FIG. 1 shows the configuration of the control system 100 formed by the control device 10 according to the present embodiment.
  • the control system 100 is a system built in a factory to operate a production line.
  • the control system 100 includes a control device 10 that controls the device 30, a user terminal 20 for setting a control process executed by the control device 10, and a device 30 installed on the production line.
  • the control system 100 may include a plurality of devices 30 to be controlled by the control device 10.
  • the control device 10 and the user terminal 20 are communicably connected via a dedicated line or a network.
  • the control device 10 and the user terminal 20 may be connected via a USB (Universal Serial Bus) cable or may be connected via a LAN (Local Area Network) cable.
  • the control device 10 and the device 30 are communicably connected via the FA network.
  • the control device 10 is a PLC (Programmable Logic Controller) that realizes a series of manufacturing lines by interlocking the devices 30 in the factory by controlling them in an integrated manner.
  • the control device 10 controls the device 30 by receiving a program from the user terminal 20 and executing a control process defined by the program.
  • This program is, for example, an executable object program compiled on the user terminal 20 from a ladder program written in the ladder language.
  • a program created by a user is also called a user program.
  • the control device 10 also functions as a program monitoring device that monitors a specific program and confirms the validity of the program. Details of this confirmation of legitimacy will be described later.
  • the user terminal 20 is a PC (Personal Computer) represented by an IPC (Industrial Personal Computer), a tablet terminal, and other UI (User Interface) terminals.
  • the user terminal 20 provides a screen for the user 21 to set a program, acquires a program input by the user 21, converts the program into an executable format, and then provides the program to the control device 10.
  • the user terminal 20 may acquire the program input by the user 21 by using the keyboard of the user terminal 20, or may read the program from the internal or external memory address specified by the user 21.
  • the device 30 is, for example, a sensor, an actuator, a robot, or other FA device installed on a production line.
  • the device 30 operates according to an instruction from the control device 10.
  • the device 30 which is a sensor notifies the control device 10 of the sensing result at a cycle specified by the control device 10.
  • the device 30 which is an actuator moves the work at the timing and speed specified by the control device 10.
  • FIG. 2 schematically shows the hardware configuration of the control device 10 and the user terminal 20.
  • the control device 10 and the user terminal 20 include a processor 41, a main storage unit 42, an auxiliary storage unit 43, a ROM (Read Only Memory) 44, an input unit 45, and an output unit 46. And a communication unit 47.
  • the main storage unit 42, the auxiliary storage unit 43, the ROM 44, the input unit 45, the output unit 46, and the communication unit 47 are all connected to the processor 41 via the internal bus 48.
  • the processor 41 includes a CPU (Central Processing Unit) or an MPU (Micro Processing Unit).
  • the processor 41 realizes various functions of the control device 10 and the user terminal 20 by executing the program P1 stored in the auxiliary storage unit 43 and the firmware P2 stored in the ROM 44, and executes the processing described later. ..
  • the main storage unit 42 includes a RAM (RandomAccessMemory).
  • the program P1 is loaded into the main storage unit 42 from the auxiliary storage unit 43, and the firmware P2 is loaded from the ROM 44. Then, the main storage unit 42 is used as a work area of the processor 41.
  • the auxiliary storage unit 43 and the ROM 44 each include a non-volatile memory represented by an EEPROM (Electrically Erasable Programmable Read-Only Memory) and an HDD (Hard Disk Drive).
  • the auxiliary storage unit 43 stores various data used in the processing of the processor 41.
  • the auxiliary storage unit 43 and the ROM 44 supply the data used by the processor 41 to the processor 41 according to the instructions of the processor 41. Further, the auxiliary storage unit 43 stores the data supplied from the processor 41.
  • the input unit 45 includes an input device typified by a hardware switch, an input key, and a pointing device.
  • the input unit 45 acquires the information input by the user 21 of the control device 10 or the user terminal 20, and notifies the processor 41 of the acquired information.
  • the output unit 46 includes an output device typified by an LED (Light Emitting Diode), an LCD (Liquid Crystal Display), and a speaker.
  • the output unit 46 presents various information to the user according to the instruction of the processor 41.
  • the communication unit 47 includes a network interface circuit for communicating with an external device.
  • the communication unit 47 receives a signal from the outside and outputs the data indicated by this signal to the processor 41. Further, the communication unit 47 transmits a signal indicating the data output from the processor 41 to an external device.
  • FIG. 2 typically shows one communication unit 47, but the present invention is not limited to this.
  • the control device 10 may individually have a communication unit 47 for communicating with the user terminal 20 and a communication unit 47 for communicating with the device 30.
  • the control device 10 exerts the function shown in FIG. 3 by the cooperation of the hardware components shown in FIG. As shown in FIG. 3, the control device 10 stores various information as its function, that is, a reception unit 11 that receives a program to be executed by the control device 10 from the user terminal 20 and receives an execution instruction of this program.
  • the storage unit 12 to execute the program, the execution unit 13 to execute the program according to the execution instruction, the calculation unit 14 to calculate the calculation code when the calculation command included in the program is executed, and the comparison command included in the program are executed. It has a determination unit 15 and a determination unit 15 for comparing and determining two calculation codes.
  • the calculation code is a code for detecting a change in specific data, and is also called a check code for checking the change.
  • the control device 10 is shown in FIG. Includes transmission paths for information not indicated by arrows.
  • the execution instruction received by the reception unit 11 is notified to the execution unit 13 realized by the processor 41 in the same manner as the reception unit 11.
  • the reception unit 11 is realized mainly by the cooperation of the input unit 45 of the control device 10, the communication unit 47, and the processor 41 that executes the firmware P2.
  • the reception unit 11 acquires the control processing program 120 and the code processing program 121 provided from the user terminal 20, and stores the acquired control processing program 120 and the code processing program 121 in the storage unit 12. Further, the reception unit 11 receives the execution instruction of the control processing program 120 and the execution instruction of the code processing program 121.
  • the reception unit 11 corresponds to an example of a reception means that receives an execution instruction for code processing in the control device 10.
  • the code processing is a process executed by the code processing program 121 as described later.
  • the control processing program 120 corresponds to the program P1 of the control device 10 shown in FIG.
  • the control processing program 120 is a program that defines a control processing for controlling the device 30 to be executed by the control device 10, and this processing is repeatedly executed by the control device 10.
  • the control device 10 executes the control process by executing the control process program 120.
  • the control processing program 120 includes a plurality of user programs arbitrarily set by the user 21 and a target program 122 to be monitored.
  • the code processing program 121 includes a command for monitoring the target program 122 and detecting a change in the target program 122. Specifically, the code processing program 121 uses the calculation command 1211 which is an execution command of the calculation process for calculating the calculation code for detecting the change of the target program 122, and the detection code which is the calculated first calculation code.
  • the comparison command 1212 which is an execution command for comparison processing to be compared with the comparison code, which is the second calculation code calculated from the target program 122 in the past, and the result command 1213, which is an execution command for result processing based on the comparison result, are used. Including.
  • the code processing program 121 defines a procedure for executing a series of code processing including calculation processing, comparison processing, and result processing specified by the user. That is, the code processing includes a calculation process for calculating the detection code and a comparison process for comparing the calculated detection code with the comparison code.
  • FIG. 4 shows a specific example of a ladder diagram corresponding to the source code of the code processing program 121.
  • the calculation command 1211 is a command called "SP.PIDRD".
  • the target program 122 is specified by name, "" target.
  • the first argument “prg” ", the second argument” D0 "which is the address of the storage area where the error code for identifying the error that occurred in the calculation process is stored, and the calculated comparison code are stored.
  • a third argument called "D10”, which is the address of the storage area, and a fourth argument, "M10", which is the address of the storage area in which the completion bit indicating whether or not the calculation process is completed are specified. There is.
  • the calculation command 1211 is described again, but the second argument is changed to "D1”, and the third argument is changed to "D20", which is the address of the storage area in which the calculated detection code is stored.
  • the argument has been changed and the fourth argument has been changed to "M20".
  • the address is a memory address indicating the location of data in the storage unit 12.
  • the calculation command 1211 shown in FIG. 4 is a command for calculating a comparison code and a detection code from the binary file of the target program 122 stored in the storage unit 12 according to the CRC (Cyclic Redundancy Check).
  • the calculation command 1211 is not limited to this, and may be a command for calculating a checksum or a command for calculating a hash value typified by MD5. If different comparison codes and detection codes are calculated before and after the change of the target program 122, the calculation method is arbitrary.
  • the target program 122 is specified by the name, it may be specified by the address or may be specified by another method.
  • the comparison command 1212 is a command "D ⁇ > D10 D20".
  • This command is a command for determining whether or not the value of the comparison code stored in the storage area indicated by the address D10 and the value of the detection code stored in the storage area indicated by the address D20 are different. is there. Then, as a result of the comparison between these comparison codes and the detection codes, the result command 1213 described following the comparison command 1212 is executed.
  • This result command 1213 is a command "SET M30", which stores a value of 1 in the storage area indicated by the address M30 when the comparison results are different, and is called M30 when the comparison results are the same.
  • An instruction to store a value of zero in the storage area indicated by the address That is, when the comparison code and the detection code are different, the value of the address "M30" becomes 1, and when the comparison code and the detection code are the same, the value of the address "M30" becomes zero.
  • the target program 122 may be a program described by the user 21 or a program prepared in advance by the user 21 and incorporated into the control processing program 120.
  • the target program 122 is a specific program included in the control processing program 120.
  • the control device 10 repeatedly executes the control processing program 120, and executes the code processing program 121 according to an execution instruction input at an arbitrary timing of the user.
  • the control process executed by the control device 10 includes a case where both the control process program 120 and the code process program 121 are executed, a case where only the control process program 120 is executed, and a case where only the code process program 121 is executed. Cases and may be included.
  • the execution unit 13 is mainly realized by the processor 41 of the control device 10.
  • the hardware switch which is the input unit 45 of the control device 10
  • the execution unit 13 receives a notification from the reception unit 11 that the RUN has been selected and stores it in the storage unit 12.
  • the control processing program 120 is executed. Further, when the reception unit 11 notifies that the execution unit 13 has received the execution instruction from the tool executed on the user terminal 20, the execution unit 13 executes the code processing program 121. Then, the execution unit 13 causes the calculation unit 14 to execute the calculation process for the calculation command 1211 included in the code processing program 121, and causes the determination unit 15 to perform the comparison process for the comparison command 1212 included in the code processing program 121. Let it run.
  • the execution unit 13 corresponds to an example of an execution means that executes code processing according to an execution instruction of code processing in the control device 10.
  • the calculation unit 14 is mainly realized by the processor 41 that executes the firmware P2 of the control device 10.
  • the calculation unit 14 acquires the first to fourth arguments of the calculation command, reads the target program 122 specified by the first argument from the storage unit 12, and reads the target program 122 from the read target program 122 by the CRC-32. And calculate the comparison code.
  • the calculation unit 14 puts a predetermined error code in the storage area indicated by the address specified by the second argument when the reading of the specified target program 122 fails. Store. Then, when the calculation unit 14 calculates the detection code and the comparison code, the calculated detection code and the comparison code are stored in the storage area indicated by the address specified by the third argument, and "1" indicating the completion of the calculation process.
  • the calculation unit 14 calculates the detection code 123 shown in FIG. 3 by the second calculation command 1211 shown in the middle of FIG. It is stored in the storage unit 12, and the comparison code 124 shown in FIG. 3 is calculated and stored in the storage unit 12 by the first calculation command 1211 shown in the upper part of FIG.
  • the calculation unit 14 corresponds to an example of a calculation means for calculating a detection code from the target program 122 in the control device 10.
  • the determination unit 15 is mainly realized by the processor 41 that executes the firmware P2 of the control device 10.
  • the determination unit 15 determines whether or not the values stored in the storage areas indicated by the two addresses specified by the comparison command 1212 are equal, and returns the determination result to the execution unit 13.
  • the determination unit 15 compares the detection code 123 and the comparison code 124 shown in FIG. Then, the result command in the code processing program 121 is executed according to the comparison result.
  • the determination unit 15 corresponds to an example of a determination means for determining whether or not the detection code is equal to the comparison code in the control device 10.
  • FIG. 5 shows a specific example of the comparison code, the detection code, and the comparison result written in the storage unit 12.
  • the address "D10” stores the value “0x34DB” as the calculated comparison code 124
  • the address "D20” stores the value "0x34DB” as the calculated detection code 123. Since the values of these comparison codes and detection codes are equal, the value of "zero" is stored in the address "M30" as the comparison result.
  • the control processing program 120 is executed by the control device 10 in parallel with this code processing.
  • the code processing is executed by the user observing the timing when the calculation load due to the control processing is small.
  • the control device 10 receives the code processing program 121 provided by the user 21 via the user terminal 20 (step S1). Specifically, the reception unit 11 receives the code processing program 121 from the user terminal 20 and stores it in the storage unit 12. As a result, the reception unit 11 receives the execution procedure specified by the user 21 for the calculation process, the comparison process, the result process, and other processes included in the code process.
  • the control device 10 receives the code processing execution instruction from the user 21 (step S2). Specifically, the reception unit 11 notifies the execution unit 13 of the execution instruction received from the user terminal 20.
  • the reception unit 11 may receive an instruction to execute code processing by switching the hardware switch of the control device 10.
  • Step S2 corresponds to an example of a reception step for receiving a code processing execution instruction in the program monitoring method executed by the control device 10.
  • Step S3 the control device 10 executes the code processing program 121 (step S3).
  • the execution unit 13 reads the code processing program 121 from the storage unit 12 and executes it.
  • Step S3 corresponds to an example of an execution step of executing code processing in the program monitoring method executed by the control device 10.
  • control device 10 calculates the comparison code 124 of the target program 122 to be monitored included in the control processing program 120 and stores it in the storage unit 12 (step S4). Specifically, the calculation unit 14 calculates the comparison code 124 of the target program 122 according to the calculation command 1211 and the argument described in the code processing program 121, and writes the calculated comparison code 124 in the storage unit 12.
  • the control device 10 calculates the detection code 123 for the target program 122 being executed and stores it in the storage unit 12 at a timing different from the timing when the comparison code 124 is calculated from the target program 122 in step S4. (Step S5). Specifically, the calculation unit 14 calculates the detection code 123 of the target program 122 according to the calculation command 1211 and the argument described in the code processing program 121, and writes the calculated detection code 123 in the storage unit 12. As a result, the detection code calculated at a timing different from the comparison code in step S4 is written to an address different from the address where the comparison code was written in step S4.
  • Step S5 corresponds to an example of a calculation step of calculating a detection code in the program monitoring method executed by the control device 10.
  • Step S6 the control device 10 determines whether or not the detection code 123 is equal to the comparison code 124 (step S6). Specifically, the determination unit 15 reads values from the two addresses specified in the code processing program 121, and determines whether or not the read values are equal for comparison. Step S6 corresponds to an example of a determination step of determining whether or not the detection codes are equal in the program monitoring method executed by the control device 10.
  • step S6 When it is determined that the detection code 123 is equal to the comparison code 124 (step S6; Yes), the control device 10 continues executing the control processing program 120 (step S7). In the example shown in FIG. 4, the execution of the target program 122 is continued when the value of the address “M30” is “zero”. After that, the control device 10 may repeat the processing after step S5 as shown in FIG. 6, or may end the code processing.
  • step S6 when it is determined that the detection code 123 is not equal to the comparison code 124 (step S6; No), the control device 10 notifies the user 21 that the target program 122 has been changed (step S8). If the target program 122 is changed while the control processing program 120 is being executed after the execution of step S4, it is determined that the comparison code and the detection code are different, and the notification to the user 21 is executed. In the example shown in FIG. 4, when the value of the address "M30" is 1, the notification to the user 21 is executed. The notification to the user 21 may be to display on the user terminal 20 that the change has been detected, or to turn on or blink the LED of the control device 10.
  • control device 10 stops the control process (step S9). Specifically, the execution unit 13 stops the execution of the control processing program. After that, the code processing ends.
  • the reception unit 11 receives the execution instruction of the code processing including the calculation process and the comparison process, and the execution unit 13 executes the code process according to the execution instruction. Therefore, the user can arbitrarily set the timing at which the code processing is executed. This makes it possible to control the timing of calculation by the control device when confirming the validity of the program. Therefore, by controlling the timing for confirming the validity of the program, it is possible to control the calculation load when executing the control process. For example, when the calculation load of the control device due to the calculation in the processing for controlling the device 30 performed by the control device is relatively small, the calculation load applied to the control device can be reduced by performing the code processing. That is, it is possible to reduce the calculation load when executing the control process while confirming the validity of the program.
  • the user 21 may execute the code processing program 121 that executes the calculation and comparison of the comparison code and the detection code each time the control processing program 120 is executed (execution of the code processing). Further, when the comparison code has already been calculated and written to the storage unit 12, the detection code included in the code processing program 121 is calculated and the detection code and the comparison code are used each time the control processing program 120 is executed. You may perform a comparison (execution of code processing). The calculation of the comparison code and the writing to the storage unit 12 are performed when the user intentionally rewrites all or part of the control processing program 120, all or part of the control processing program 120 or the control processing program 120.
  • the comparison code does not need to be calculated by executing the code processing program 121, and the comparison code received from the outside together with the code processing program 121 in step S1 may be stored in the storage unit 12.
  • control processing may be set so that the code processing is executed every 10 times the control processing program 120 is executed. Good. If the code processing is executed every time the control processing program 120 is executed 10 times, the code processing is automatically executed every time the control processing is executed a predetermined number of times, considering the calculation load of the control device. Can be done. As a result, the validity of the program can be confirmed on a regular basis.
  • the control device 10 that executes the ladder program shown in the ladder diagram repeatedly executes a cycle of executing both the control processing program 120 and the code processing program 121, but the code processing program 121 is one cycle out of 10 cycles.
  • the code is calculated and compared in, and no substantial processing is executed in the remaining 9 cycles.
  • the command group 51 composed of two lines of instructions, when the control process is executed for the first time, or when the user updates the control process program 120 and the above-mentioned comparison code 124 needs to be calculated. It has contacts that are executed in.
  • the calculation command 1211 in the command group 51 is a command similar to that shown in FIG.
  • the reset command 511 of the command group 51 is a command for resetting the value indicating the number of cycles stored in the address "D100" to zero.
  • the address "D100" may be an address in the storage unit 12 or an address indicating a storage area in the recording medium connected to the control device 10.
  • the command group 52 composed of three lines of instructions has a contact point that is always executed.
  • the upper addition command 521 is a command for adding "1" to the number of cycles stored in the address "D100".
  • the division command 522 in the middle row stores the quotient obtained by dividing the value stored in the address "D100” by the decimal integer 10 indicated by "K10" in the address "D200” and stores it in this address.
  • This command stores the remainder at the following address "D201".
  • the addresses "D200” and “D201” may be addresses in the storage unit 12 or may be addresses indicating a storage area in the recording medium connected to the control device 10.
  • the lower determination command 523 is a command for determining whether or not the number of cycles stored in the address "D100" is equal to or greater than the decimal integer "60000" indicated by "K60000". If the determination is affirmed, the storage command 524 is executed.
  • the storage command 524 is a command for storing a decimal integer "zero” represented by "K0" at the address "D100". When this storage command 524 is executed, the value of the address "D100" is reset to "zero".
  • the command group 53 consisting of two lines of instructions in FIG. 7 has a contact point to be executed when the value stored in the address "M30" is "zero".
  • the initial value of this address "M30" is zero, and when the control device 10 executes the ladder program for the first time, the command group 53 is executed, but after that, the value of the address "M30" is changed by the result command 1213. When it becomes 1, the command group 53 is not executed.
  • the upper determination command 531 of the command group 53 is a command for determining whether or not the remainder stored in the address "D201" is equal to the integer zero represented by "K0". If this determination is affirmed, the subsequent calculation command 1211, comparison command 1212, and result command 1213 are executed.
  • the execution unit 13 executes code processing according to the execution procedure specified by this ladder program. Specifically, if the remainder when the number of cycles stored in the address "D100" is divided by 10 is equal to zero, the calculation command 1211 for calculating the detection code, the comparison command 1212, and the result command 1213 are executed. .. That is, the command group 53 is substantially executed only once every 10 cycles. As a result, the influence of the control processing due to the calculation load of the code can be reduced. By changing the value of "K10" in the division command 522, the cycle in which the code processing is executed can be changed.
  • the time during which the control process repeatedly executed by the control device 10 completes is called the scan time. It is desirable that the scan time is a fixed time, but if there is a process with a large calculation load in the control process, the scan time may be affected. According to the control device 10 according to the present embodiment, it is possible to execute the control process in which the calculation load is reduced, so that the influence on the scan time can be reduced.
  • the comparison code and the detection code are different, the execution of the control process is stopped. Therefore, the execution of the target program 122 that is unintentionally changed by the user 21 is avoided. As a result, the execution of the target program 122 in the state set by the user 21 is guaranteed.
  • the detection code is a code for detecting a change in the target program 122 specified by the second argument of the calculation command 1211, and is calculated from the target program 122. That is, the detection code was calculated from the target program 122 corresponding to a part of the data specified by the user 21 in the control processing program 120. Therefore, the control device 10 can limit the monitoring range to the target program 122 without monitoring the entire control processing program 120. As a result, the important part of the control processing program can be monitored preferentially.
  • the control processing program 120 continues to be repeatedly executed during the execution of the code processing, but when the code processing is started, the control processing is performed.
  • the execution of the program 120 may be suspended, and the execution of the control processing program 120 may be resumed when the detection code and the comparison code receive the same result after the code processing is completed.
  • the temporary stop of the control processing program 120 at this time may be stopped during the execution of the control processing program 120, or may be stopped when the control processing program 120 makes a full cycle.
  • control processing program 120 may be resumed from the continuation of the paused portion, or the execution of the control processing program 120 may be resumed by returning to the initial point of the control processing program 120. Good.
  • the control processing program 120 By stopping the control processing program 120 at the start of the code processing in this way, the execution of the target program 122 included in the control processing program 120 unintentionally changed by the user 21 is avoided. As a result, the execution of the target program 122 in the state set by the user 21 is guaranteed.
  • control processing program 120 including a plurality of programs for controlling the device 30 and the code processing program 121 for performing the code processing are individually programmed has been described. Not limited to.
  • the code processing program 121 may be incorporated in the control processing program 120.
  • the code processing is executed for one target program 122 included in the control processing program 120, but the code processing is performed for a plurality of programs corresponding to a part of the control processing program 120 or all of them. May be executed.
  • the control processing program 120 does not necessarily have to include a plurality of programs, and only the target program 122 may be the control processing program 120.
  • control device 10 can be realized by dedicated hardware or by a normal computer system.
  • the program P1 executed by the processor 41 is stored in a non-temporary recording medium readable by a computer and distributed, and the program P1 is installed in the computer to configure an apparatus for executing the above-mentioned processing.
  • a recording medium for example, a flexible disc, a CD-ROM (Compact Disc Read-Only Memory), a DVD (Digital Versatile Disc), and an MO (Magneto-Optical Disc) can be considered.
  • the program P1 may be stored in a disk device of a server device on a communication network represented by the Internet, superposed on a carrier wave, and downloaded to a computer, for example.
  • the above process can also be achieved by starting and executing the program P1 while transferring it via the communication network.
  • processing can also be achieved by executing all or a part of the program P1 on the server device and executing the program while the computer sends and receives information on the processing via the communication network.
  • control device 10 is not limited to software, and a part or all thereof may be realized by dedicated hardware including a circuit.
  • the present invention is suitable for confirming the validity of a program.
  • control system 10 control device, 11 reception unit, 12 storage unit, 13 execution unit, 14 calculation unit, 15 judgment unit, 20 user terminal, 21 user, 30 equipment, 41 processor, 42 main storage unit, 43 auxiliary storage unit. , 44 ROM (Read Only Memory), 45 input unit, 46 output unit, 47 communication unit, 48 internal bus, 120 control processing program, 121 code processing program, 1211 calculation command, 1212 comparison command, 1213 result command, 1214 duplication command , 122 target program, 123 detection code, 124 comparison code, 51, 52, 53 command group, 511 reset command, 521 addition command, 522 division command, 523,531 judgment command, 524 storage command, P1 program, P2 firmware.
  • ROM Read Only Memory

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Programmable Controllers (AREA)

Abstract

制御装置(10)は、機器を制御するための制御処理を実行し、受付部(11)と、算出部(14)と、判定部(15)と、実行部(13)と、を備える。受付部(11)は、制御処理を実行するためのプログラムに含まれる監視対象である対象プログラム(122)の変更を検出するための検出コードを算出する算出処理と、算出された検出コード(123)を過去に対象プログラム(122)から算出された比較コード(124)と比較する比較処理と、を含むコード処理の実行指示を受け付ける。算出部(14)は、対象プログラム(122)から検出コードを算出する。判定部(15)は、検出コード(123)が比較コード(124)に等しいか否かを判定する。実行部(13)は、実行手順に従ってコード処理を実行する。

Description

制御装置、プログラム監視方法及びプログラム
 本発明は、制御装置、プログラム監視方法及びプログラムに関する。
 FA(Factory Automation)の現場では、制御装置が種々の機器を制御することで、生産工程、加工工程、検査工程、その他の工程が実現される。通常、制御装置は、ユーザから提供されるプログラムを実行することで、ユーザによって任意に規定された処理を実行する。この処理が実行される際には、処理内容の正当性を確認することが望ましい。そこで、制御装置におけるデータを検証する技術を利用することが考えられる(例えば、特許文献1を参照)。
 特許文献1には、プログラマブルコントローラの動作モードを決定するパラメータの正当性を検証する技術について記載されている。また、プログラマブルコントローラの初期起動時にパラメータの正当性を検証することも記載されている。この技術では、パラメータからチェックコードが計算されて、計算されたチェックコードが記憶部に保持されたチェックコードと異なるときに、プログラマブルコントローラがパラメータを読み込んで動作モードの設定をする。この技術によれば、パラメータの値が変更されたときに、プログラマブルコントローラを再起動することなくパラメータの更新を反映することができる。また、初期起動時にパラメータの正当性を検証するので、プログラマブルコントローラが誤った動作モードで稼働することを防止することができる。
特開2009-187373号公報
 プログラムの正当性の確認に特許文献1の技術を適用する場合には、プログラムからチェックコードを計算することが考えられる。しかしながら、特許文献1の技術では、パラメータが更新される度にチェックコードが計算されるため、プログラマブルコントローラの制御処理による演算負荷の状態に関わらずチェックコードの計算負荷がかかり、制御装置の制御処理に影響を及ぼすおそれがあった。したがって、プログラムの正当性を確認するタイミングをコントロールすることで、制御処理を実行する際の演算負荷をコントロールすることが望ましい。
 本発明は、プログラムの正当性を確認するタイミングをコントロールすることで、制御処理を実行する際の演算負荷をコントロールすることを目的とする。
 上記目的を達成するため、本発明の制御装置は、機器を制御するための制御処理を実行する制御装置であって、制御処理を実行するためのプログラムに含まれる監視対象である対象プログラムの変更を検出するための検出コードを算出する算出処理と、算出された検出コードを過去に対象プログラムから算出された比較コードと比較する比較処理と、を含むコード処理の実行指示を受け付ける受付手段と、対象プログラムから検出コードを算出する算出手段と、検出コードが比較コードに等しいか否かを判定する判定手段と、実行指示に従ってコード処理を実行する実行手段と、を備える。
 本発明によれば、受付手段が、算出処理と比較処理とを含むコード処理の実行指示を受け付けて、実行手段が、実行指示に従ってコード処理を実行する。このため、コード処理が実行されるタイミングを、ユーザが任意に設定することができる。これにより、プログラムの正当性を確認する際の制御装置による演算のタイミングをコントロールすることが可能となる。したがって、プログラムの正当性を確認するタイミングをコントロールすることで、制御処理を実行する際の演算負荷をコントロールすることができる。
本発明の実施の形態に係る制御システムの構成を示す図 実施の形態に係るユーザ端末及び制御装置のハードウェア構成を示す図 実施の形態に係る制御装置の機能的な構成を示す図 実施の形態に係るラダープログラムの具体例を示す図 実施の形態に係る記憶部に記憶される情報の一例を示す図 実施の形態に係るコード処理を示すフローチャート 実施の形態に係るラダープログラムの一例を示す図
 以下、本発明の実施の形態に係る制御装置10について、図面を参照しつつ詳細に説明する。
 実施の形態1.
 図1には、本実施の形態に係る制御装置10により形成される制御システム100の構成が示されている。制御システム100は、製造ラインを稼働させるために工場に構築されるシステムである。制御システム100は、機器30を制御する制御装置10と、制御装置10によって実行される制御処理を設定するためのユーザ端末20と、製造ラインに設置された機器30と、を有する。なお、図1には、1つの機器30が代表的に示されているが、制御システム100は、制御装置10の制御対象である複数の機器30を含んでもよい。
 制御装置10とユーザ端末20とは、専用線又はネットワークを介して通信可能に接続される。例えば、制御装置10とユーザ端末20とは、USB(Universal Serial Bus)ケーブルを介して接続されてもよいし、LAN(Local Area Network)ケーブルを介して接続されてもよい。また、制御装置10と機器30とは、FAネットワークを介して通信可能に接続される。
 制御装置10は、工場内の機器30を統括的に制御することで連動させて、一連の製造ラインを実現させるPLC(Programmable Logic Controller)である。制御装置10は、ユーザ端末20からプログラムを受け付けて、当該プログラムにより規定される制御処理を実行することで機器30を制御する。このプログラムは、例えば、ラダー言語で記述されたラダープログラムからユーザ端末20においてコンパイルされた実行形式のオブジェクトプログラムである。ユーザによって作成されるプログラムは、ユーザプログラムとも呼称される。制御装置10は、特定のプログラムを監視して、当該プログラムの正当性を確認するプログラム監視装置としても機能する。この正当性の確認の詳細については、後述する。
 ユーザ端末20は、IPC(Industrial Personal Computer)に代表されるPC(Personal Computer)、タブレット端末、その他のUI(User Interface)端末である。ユーザ端末20は、ユーザ21がプログラムを設定するための画面を提供し、ユーザ21によって入力されたプログラムを取得して、当該プログラムを実行形式に変換してから制御装置10に提供する。ユーザ端末20は、ユーザ21がユーザ端末20のキーボードを用いることで入力されたプログラムを取得してもよいし、ユーザ21が指定した内部又は外部のメモリアドレスからプログラムを読み込んでもよい。
 機器30は、例えば、製造ラインに設置されるセンサ、アクチュエータ、ロボット、その他のFA機器である。機器30は、制御装置10からの指示に従って動作する。例えば、センサである機器30は、制御装置10から指定された周期で、センシング結果を制御装置10に通知する。また、アクチュエータである機器30は、制御装置10から指定されたタイミング及び速度でワークを移動させる。
 図2には、制御装置10及びユーザ端末20のハードウェア構成が模式的に示されている。図2に示されるように、制御装置10及びユーザ端末20は、プロセッサ41と、主記憶部42と、補助記憶部43と、ROM(Read Only Memory)44と、入力部45と、出力部46と、通信部47と、を有する。主記憶部42、補助記憶部43、ROM44、入力部45、出力部46及び通信部47はいずれも、内部バス48を介してプロセッサ41に接続される。
 プロセッサ41は、CPU(Central Processing Unit)又はMPU(Micro Processing Unit)を含む。プロセッサ41は、補助記憶部43に記憶されるプログラムP1及びROM44に記憶されるファームウェアP2を実行することにより、制御装置10及びユーザ端末20の種々の機能を実現して、後述の処理を実行する。
 主記憶部42は、RAM(Random Access Memory)を含む。主記憶部42には、補助記憶部43からプログラムP1がロードされ、ROM44からファームウェアP2がロードされる。そして、主記憶部42は、プロセッサ41の作業領域として用いられる。
 補助記憶部43及びROM44はそれぞれ、EEPROM(Electrically Erasable Programmable Read-Only Memory)及びHDD(Hard Disk Drive)に代表される不揮発性メモリを含む。補助記憶部43は、プログラムP1の他に、プロセッサ41の処理に用いられる種々のデータを記憶する。補助記憶部43及びROM44は、プロセッサ41の指示に従って、プロセッサ41によって利用されるデータをプロセッサ41に供給する。また、補助記憶部43は、プロセッサ41から供給されたデータを記憶する。
 入力部45は、ハードウェアスイッチ、入力キー及びポインティングデバイスに代表される入力デバイスを含む。入力部45は、制御装置10又はユーザ端末20のユーザ21によって入力された情報を取得して、取得した情報をプロセッサ41に通知する。
 出力部46は、LED(Light Emitting Diode)、LCD(Liquid Crystal Display)及びスピーカに代表される出力デバイスを含む。出力部46は、プロセッサ41の指示に従って、種々の情報をユーザに提示する。
 通信部47は、外部の装置と通信するためのネットワークインタフェース回路を含む。通信部47は、外部から信号を受信して、この信号により示されるデータをプロセッサ41へ出力する。また、通信部47は、プロセッサ41から出力されたデータを示す信号を外部の装置へ送信する。なお、図2には、通信部47が代表的に1つ示されているが、これには限定されない。例えば、制御装置10は、ユーザ端末20と通信するための通信部47と、機器30と通信するための通信部47と、を個別に有してもよい。
 図2に示されるハードウェアの構成要素が協働することで、制御装置10は、図3に示される機能を発揮する。制御装置10は、図3に示されるように、その機能として、制御装置10が実行すべきプログラムをユーザ端末20から受け付けて、このプログラムの実行指示を受け付ける受付部11と、種々の情報を記憶する記憶部12と、実行指示に従ってプログラムを実行する実行部13と、プログラムに含まれる算出のコマンドが実行されたときに算出コードを算出する算出部14と、プログラムに含まれる比較のコマンドが実行されたときに2つの算出コードを比較して判定する判定部15と、を有する。算出コードは、特定のデータの変更を検出するためのコードであって、変更をチェックするためのチェックコードとも呼称される。なお、図3中の矢印は、受付部11、実行部13、算出部14及び判定部15と、記憶部12と、の間における情報の授受を示しているが、制御装置10は、図3に矢印で示されていない情報の伝送経路を含む。例えば、受付部11が受け付けた実行指示は、受付部11と同様にプロセッサ41により実現される実行部13に通知される。
 受付部11は、主として制御装置10の入力部45、通信部47及びファームウェアP2を実行するプロセッサ41の協働により実現される。受付部11は、ユーザ端末20から提供される制御処理プログラム120及びコード処理プログラム121を取得して、取得した制御処理プログラム120及びコード処理プログラム121を記憶部12に格納する。また、受付部11は、制御処理プログラム120の実行指示及びコード処理プログラム121の実行指示を受け付ける。受付部11は、制御装置10においてコード処理の実行指示を受け付ける受付手段の一例に相当する。コード処理とは、後述するようにコード処理プログラム121により実行される処理である。
 制御処理プログラム120は、図2に示される制御装置10のプログラムP1に相当する。制御処理プログラム120は、制御装置10が実行すべき機器30を制御するための制御処理を規定するプログラムであって、この処理は、制御装置10によって繰り返し実行される。制御装置10は、制御処理プログラム120を実行することで制御処理を実行する。ここでは、制御処理プログラム120は、ユーザ21によって任意に設定された複数のユーザプログラムと、監視対象となる対象プログラム122と、を含む。
 コード処理プログラム121は、対象プログラム122を監視して、対象プログラム122の変更を検出するためのコマンドを含む。詳細には、コード処理プログラム121は、対象プログラム122の変更を検出するための算出コードを算出する算出処理の実行指令である算出コマンド1211と、算出された第1の算出コードである検出コードを過去に対象プログラム122から算出された第2の算出コードである比較コードと比較する比較処理の実行指令である比較コマンド1212と、比較結果に基づく結果処理の実行指令である結果コマンド1213と、を含む。コード処理プログラム121は、ユーザによって規定された算出処理、比較処理及び結果処理を含む一連のコード処理の実行手順を規定する。すなわち、コード処理は、検出コードを算出する算出処理と、算出された検出コードを比較コードと比較する比較処理と、を含む。
 図4には、コード処理プログラム121のソースコードに相当するラダー図の具体例が示されている。図4の上段において、算出コマンド1211は、「SP.PIDRD」というコマンドである。このコマンドには、対象プログラム122を名称により指定する「“target.prg”」という第1引数と、算出処理において発生したエラーを識別するためのエラーコードが格納される記憶領域のアドレスである「D0」という第2引数と、算出された比較コードが格納される記憶領域のアドレスである「D10」という第3引数と、算出処理が完了したか否かを示す完了ビットが格納される記憶領域のアドレスである「M10」という第4引数と、が指定されている。図4の中段においては、算出コマンド1211が再度記述されているが、第2引数が「D1」に変更され、算出された検出コードが格納される記憶領域のアドレスである「D20」に第3引数が変更され、第4引数が「M20」に変更されている。なお、アドレスは、記憶部12におけるデータの所在を示すメモリアドレスである。
 図4に示される算出コマンド1211は、記憶部12に記憶されている対象プログラム122のバイナリファイルからCRC(Cyclic Redundancy Check)に従って比較コード及び検出コードを算出するためのコマンドである。ただし、算出コマンド1211はこれに限定されず、チェックサムを算出するためのコマンドであってもよいし、MD5に代表されるハッシュ値を算出するためのコマンドであってもよい。対象プログラム122の変更の前後で異なる比較コードと検出コードが算出されれば、算出方式は任意である。また、図4では、名称により対象プログラム122が指定されたが、アドレスにより指定されてもよいし、他の方法により指定されてもよい。
 図4の下段において、比較コマンド1212は、「D<>D10 D20」というコマンドである。このコマンドは、D10というアドレスにより示される記憶領域に格納された比較コードの値と、D20というアドレスにより示される記憶領域に格納された検出コードの値と、が異なるか否かを判定するコマンドである。そして、これらの比較コードと検出コードとの比較の結果、比較コマンド1212に続いて記述された結果コマンド1213が実行される。この結果コマンド1213は、「SET M30」というコマンドであって、比較の結果が異なる場合に、M30というアドレスにより示される記憶領域に1という値を格納し、比較の結果が等しい場合に、M30というアドレスにより示される記憶領域にゼロという値を格納する命令である。すなわち、比較コードと検出コードが異なるときには、アドレス「M30」の値が1になり、比較コードと検出コードが等しいときには、アドレス「M30」の値がゼロになる。
 図3に戻り、対象プログラム122は、ユーザ21が記述したプログラムであってもよいし、ユーザ21が予め用意して制御処理プログラム120に組み込んだプログラムであってもよい。対象プログラム122は、制御処理プログラム120に含まれる特定のプログラムである。制御装置10は、制御処理プログラム120を繰り返し実行し、ユーザの任意のタイミングで入力した実行指示に従ってコード処理プログラム121を実行する。なお、制御装置10が実行する制御処理には、制御処理プログラム120とコード処理プログラム121との両方を実行する場合と、制御処理プログラム120のみを実行する場合と、コード処理プログラム121のみを実行する場合と、が含まれてもよい。
 実行部13は、主として制御装置10のプロセッサ41によって実現される。実行部13は、制御装置10の入力部45であるハードウェアスイッチがOFFからRUNに切り換えられると、RUNが選択されたことの通知を受付部11から受けて、記憶部12に記憶されている制御処理プログラム120を実行する。また、実行部13は、ユーザ端末20上で実行されるツールからの実行指示を受け付けたことが受付部11から通知されると、コード処理プログラム121を実行する。そして、実行部13は、コード処理プログラム121に含まれる算出コマンド1211については、算出部14に算出処理を実行させ、コード処理プログラム121に含まれる比較コマンド1212については、判定部15に比較処理を実行させる。実行部13は、制御装置10においてコード処理の実行指示に従ってコード処理を実行する実行手段の一例に相当する。
 算出部14は、主として制御装置10のファームウェアP2を実行するプロセッサ41によって実現される。算出部14は、算出コマンドの第1引数から第4引数までを取得し、第1引数によって指定された対象プログラム122を記憶部12から読み出して、読み出した対象プログラム122からCRC-32により検出コード及び比較コードを算出する。検出コード及び比較コードの算出に際して、算出部14は、指定された対象プログラム122の読み出しに失敗した場合に、予め定められたエラーコードを、第2引数により指定されたアドレスにより示される記憶領域に格納する。そして、算出部14は、検出コード及び比較コードを算出すると、算出した検出コード及び比較コードを第3引数により指定されたアドレスにより示される記憶領域に格納し、算出処理の完了を示す「1」という完了ビットを第4引数により指定されたアドレスにより示される記憶領域に格納する。図4に示されるコード処理プログラム121が実行される場合には、算出部14は、図4中の中段に示す2つ目の算出コマンド1211により、図3に示される検出コード123を算出して記憶部12に格納し、図4中の上段に示す1つ目の算出コマンド1211により、図3に示される比較コード124を算出して記憶部12に格納する。算出部14は、制御装置10において対象プログラム122から検出コードを算出する算出手段の一例に相当する。
 判定部15は、主として制御装置10のファームウェアP2を実行するプロセッサ41によって実現される。判定部15は、比較コマンド1212により指定された2つのアドレスにより示される記憶領域それぞれに格納されている値が等しいか否かを判定して、判定結果を実行部13に返す。図4に示されるコード処理プログラム121が実行される場合には、判定部15は、図3に示される検出コード123及び比較コード124を比較する。そして、比較結果に応じて、コード処理プログラム121のうちの結果コマンドが実行される。判定部15は、制御装置10において検出コードが比較コードに等しいか否かを判定する判定手段の一例に相当する。
 図5には、記憶部12に書き込まれる比較コード、検出コード及び比較結果の具体例が示されている。アドレス「D10」には、算出された比較コード124として「0x34DB」という値が格納され、アドレス「D20」には、算出された検出コード123として「0x34DB」という値が格納されている。これらの比較コード及び検出コードの値が等しいため、アドレス「M30」には、比較結果として「ゼロ」の値が格納されている。
 続いて、制御装置10によって実行されるコード処理の一例について、図6を参照して説明する。なお、このコード処理とは並列に、制御装置10によって制御処理プログラム120が実行される。コード処理は、制御処理による演算負荷が少ないタイミングをユーザが見計らうことで実行される。
 制御装置10は、ユーザ21により提供されるコード処理プログラム121を、ユーザ端末20を介して受け付ける(ステップS1)。具体的には、受付部11が、ユーザ端末20からコード処理プログラム121を受信して記憶部12に格納する。これにより、受付部11は、コード処理に含まれる算出処理、比較処理、結果処理、その他の処理について、ユーザ21により指定された実行手順を受け付けることとなる。
 次に、制御装置10は、ユーザ21からのコード処理の実行指示を受け付ける(ステップS2)。具体的には、受付部11が、ユーザ端末20から受信した実行の指示を実行部13に通知する。なお、受付部11は、制御装置10のハードウェアスイッチの切り換えによるコード処理の実行指示を受け付けてもよい。ステップS2は、制御装置10によって実行されるプログラム監視方法において、コード処理の実行指示を受け付ける受付ステップの一例に相当する。
 次に、制御装置10は、コード処理プログラム121を実行する(ステップS3)。具体的には、実行部13が、コード処理プログラム121を記憶部12から読み出して実行する。ステップS3は、制御装置10によって実行されるプログラム監視方法において、コード処理を実行する実行ステップの一例に相当する。
 次に、制御装置10は、制御処理プログラム120に含まれる監視対象である対象プログラム122の比較コード124を算出して記憶部12に格納する(ステップS4)。具体的には、算出部14が、コード処理プログラム121に記述された算出コマンド1211及び引数に従って、対象プログラム122の比較コード124を算出して、算出した比較コード124を記憶部12に書き込む。
 次に、制御装置10は、ステップS4で対象プログラム122から比較コード124を算出したタイミングとは異なるタイミングで、実行中の対象プログラム122に対して検出コード123を算出して記憶部12に格納する(ステップS5)。具体的には、算出部14が、コード処理プログラム121に記述された算出コマンド1211及び引数に従って、対象プログラム122の検出コード123を算出して、算出した検出コード123を、記憶部12に書き込む。これにより、ステップS4の比較コードとは異なるタイミングで算出された検出コードが、ステップS4で比較コードが書き込まれたアドレスとは異なるアドレスに書き込まれる。ステップS5は、制御装置10によって実行されるプログラム監視方法において、検出コードを算出する算出ステップの一例に相当する。
 次に、制御装置10は、検出コード123が比較コード124に等しいか否かを判定する(ステップS6)。具体的には、判定部15が、コード処理プログラム121において指定された2つのアドレスから値を読み出して、読み出した値が等しいか否かを判定することにより比較する。ステップS6は、制御装置10によって実行されるプログラム監視方法において、検出コードが等しいか否かを判定する判定ステップの一例に相当する。
 検出コード123が比較コード124に等しいと判定された場合(ステップS6;Yes)、制御装置10は、制御処理プログラム120の実行を続ける(ステップS7)。図4に示される例では、アドレス「M30」の値が「ゼロ」であるときに、対象プログラム122の実行が継続される。その後、制御装置10は、図6に示されるようにステップS5以降の処理を繰り返してもよいし、コード処理を終了してもよい。
 一方、検出コード123が比較コード124に等しくはないと判定された場合(ステップS6;No)、制御装置10は、対象プログラム122に変更があったことをユーザ21に報知する(ステップS8)。ステップS4の実行以降において制御処理プログラム120が実行される間に、対象プログラム122が変更された場合には、比較コードと検出コードが異なると判定されて、ユーザ21への報知が実行される。図4に示される例では、アドレス「M30」の値が1であるときに、ユーザ21への報知が実行される。ユーザ21への報知は、変更を検知したことをユーザ端末20に表示することであってもよいし、制御装置10のLEDを点灯或いは点滅させることであってもよい。
 次に、制御装置10は、制御処理を停止する(ステップS9)。具体的には、実行部13が、制御処理プログラムの実行を停止する。その後、コード処理が終了する。
 以上、説明したように、受付部11が、算出処理と比較処理とを含むコード処理の実行指示を受け付けて、実行部13が、実行指示に従ってコード処理を実行する。このため、コード処理が実行されるタイミングを、ユーザが任意に設定することができる。これにより、プログラムの正当性を確認する際の制御装置による演算のタイミングをコントロールすることが可能となる。したがって、プログラムの正当性を確認するタイミングをコントロールすることで、制御処理を実行する際の演算負荷をコントロールすることができる。例えば、制御装置が行う機器30を制御するための処理での演算による制御装置の演算負荷が比較的小さいときに、コード処理を行うことで制御装置にかかる演算負荷を軽減することができる。すなわち、プログラムの正当性を確認しつつ制御処理を実行する際の演算負荷を軽減することができる。
 換言すると、上述の特許文献1に記載の技術では、制御装置にチェックコードの計算負荷がかかり、制御装置の制御処理に影響を及ぼすおそれがあった。したがって、プログラムの正当性を確認するための計算負荷による制御処理への影響を軽減する余地があった。これに対して本実施の形態に係る制御装置10によれば、プログラムの正当性を確認するための計算負荷による制御処理への影響を軽減することが可能になる。
 また、ユーザ21は、制御処理プログラム120が1回実行される度に比較コードと検出コードの算出及び比較を実行するコード処理プログラム121を実行してもよい(コード処理の実行)。また、比較コードがすでに算出され記憶部12に書き込み完了している場合、制御処理プログラム120が1回実行される度にコード処理プログラム121に含まれる検出コードの算出及び検出コードと比較コードとの比較を実行してもよい(コード処理の実行)。なお、比較コードの算出と記憶部12への書き込みは、ユーザ21が制御処理プログラム120の全て、または一部をユーザが意図して書き換えた際に、制御処理プログラム120の全てまたは制御処理プログラム120に含まれる対象プログラム122に対して実行すればよく、コード処理プログラム121の実行の際に常に含まれる必要はない。さらに、比較コードは、コード処理プログラム121の実行により算出される必要はなく、ステップS1においてコード処理プログラム121とともに外部から受け付けられた比較コードが記憶部12に格納されてもよい。
さらに、制御処理プログラム120が1回実行される度にコード処理を実行するのに代えて、制御処理プログラム120が10回実行される毎にコード処理を実行するように制御処理を設定してもよい。制御処理プログラム120が10回実行される度にコード処理が実行されれば、制御装置の演算負荷を考えたうえで、制御処理が所定回数だけ実行される毎に自動でコード処理を実行することができる。これにより、プログラムの正当性を定期的に確認することができる。
 ここで、制御処理を10回実行する度にコード処理を実行するラダー図の一例について、図7を参照して説明する。このラダー図に示されるラダープログラムを実行する制御装置10は、制御処理プログラム120とコード処理プログラム121との双方を実行するサイクルを繰り返し実行するが、コード処理プログラム121に関しては10サイクルのうち1サイクルでコードの算出及び比較を実行し、残りの9サイクルでは実質的な処理を実行しない。
 図7において、2行の命令からなるコマンド群51は、初めて制御処理が実行される場合、又は、ユーザが制御処理プログラム120を更新したことにより上述の比較コード124の算出が必要となった場合に実行される接点を備えている。コマンド群51のうちの算出コマンド1211は、図4に示されたものと同様のコマンドである。コマンド群51のうちのリセットコマンド511は、アドレス「D100」に格納されているサイクル数を示す値をゼロにリセットするコマンドである。アドレス「D100」は、記憶部12内のアドレスでもよいし、制御装置10に接続された記録媒体における記憶領域を示すアドレスでもよい。
 図7において3行の命令からなるコマンド群52は、常に実行される接点を備えている。コマンド群52のうち、上段の加算コマンド521は、アドレス「D100」に格納されているサイクル数に「1」を加算するコマンドである。また、中段の除算コマンド522は、アドレス「D100」に格納されている値を、「K10」により示される10進数の整数10で除して得る商をアドレス「D200」に格納し、このアドレスに続くアドレス「D201」に剰余を格納するコマンドである。アドレス「D200」,「D201」は、記憶部12内のアドレスでもよいし、制御装置10に接続された記録媒体における記憶領域を示すアドレスでもよい。また、下段の判定コマンド523は、アドレス「D100」に格納されているサイクル数が、「K60000」により示される10進数の整数「60000」以上であるか否かを判定するコマンドであって、この判定が肯定された場合には格納コマンド524が実行される。格納コマンド524は、「K0」により表される10進数の整数「ゼロ」をアドレス「D100」に格納するコマンドである。この格納コマンド524が実行されると、アドレス「D100」の値は「ゼロ」にリセットされる。
 図7において2行の命令からなるコマンド群53は、アドレス「M30」に格納されている値が「ゼロ」の場合に実行される接点を備えている。このアドレス「M30」の初期値はゼロであって、制御装置10がラダープログラムを初めて実行する際には、コマンド群53が実行されるが、その後に結果コマンド1213によりアドレス「M30」の値が1になると、コマンド群53は実行されない。
 コマンド群53のうち上段の判定コマンド531は、アドレス「D201」に格納されている剰余が「K0」により表される整数ゼロに等しいか否かを判定するコマンドである。この判定が肯定された場合には、続く算出コマンド1211、比較コマンド1212、及び結果コマンド1213が実行される。
 図7に示されるようなラダープログラムが実行されると、このラダープログラムにより規定される実行手順に従って実行部13がコード処理を実行する。具体的には、アドレス「D100」に格納されているサイクル数を10で除したときの剰余がゼロに等しければ、検出コードを算出する算出コマンド1211、比較コマンド1212及び結果コマンド1213が実行される。つまり、10サイクルに一度だけコマンド群53が実質的に実行される。これにより、コードの計算負荷による制御処理の影響を低減することができる。なお、除算コマンド522において「K10」の値を変更することで、コード処理が実行される周期を変更することができる。
 制御装置10によって繰り返し実行される制御処理が一巡する時間を、スキャンタイムという。スキャンタイムは一定の時間であることが望ましいが、制御処理において演算負荷が大きい処理があると、スキャンタイムに影響が及ぶことがある。本実施の形態に係る制御装置10によれば、演算負荷が軽減された制御処理の実行が可能になるため、スキャンタイムに与える影響を軽減することができる。
 また、比較コードと検出コードとが異なる場合に、制御処理の実行が停止される。このため、ユーザ21が意図せず変更された対象プログラム122の実行が回避される。これにより、ユーザ21が設定した状態の対象プログラム122の実行が保証される。
 また、検出コードは、算出コマンド1211の第2引数により指定された対象プログラム122の変更を検出するためのコードであって、当該対象プログラム122から算出された。すなわち、検出コードは、制御処理プログラム120のうちユーザ21によって指定された一部のデータに相当する対象プログラム122から算出された。このため、制御装置10は、制御処理プログラム120全体を監視することなく、監視範囲を対象プログラム122に限定することができる。これにより、制御処理プログラムのうち、重要な部分を優先的に監視することができる。
 以上、本発明の実施の形態について説明したが、本発明は上記実施の形態によって限定されるものではない。
 また、上記実施形態では、コード処理プログラム121によりコード処理が開始された場合でも、コード処理実行中に制御処理プログラム120は繰り返し実行され続けていたが、コード処理が開始された場合に、制御処理プログラム120の実行を一時停止することとし、コード処理完了後、検出コードと比較コードとが等しい結果を受けた場合に、制御処理プログラム120の実行を再開してもよい。なお、この時の制御処理プログラム120の一時停止は、制御処理プログラム120の実行途中で停止してもよいし、制御処理プログラム120が一巡したところで停止させてもよい。また、この時の制御処理プログラム120の再開は、一時停止した個所の続きから、制御処理プログラム120の実行を再開してもよいし、制御処理プログラム120の最初の時点に戻って再開してもよい。このように、コード処理開始時に制御処理プログラム120を停止することで、ユーザ21が意図せず変更された制御処理プログラム120に含まれる対象プログラム122の実行が回避される。これにより、ユーザ21が設定した状態の対象プログラム122の実行が保証される。
 また、上記実施の形態では、機器30を制御するための複数のプログラムを含む制御処理プログラム120とコード処理を行うためのコード処理プログラム121が、個別にプログラムされている場合について説明したが、これには限定されない。例えば、制御処理プログラム120にコード処理プログラム121が組み込まれていてもよい。
 また、上記実施の形態では、制御処理プログラム120に含まれる1つの対象プログラム122に対してコード処理を実行したが、制御処理プログラム120の一部に相当する複数のプログラム或いは全てに対してコード処理を実行してもよい。また、制御処理プログラム120は必ずしも複数のプログラムを含む必要はなく、対象プログラム122のみが制御処理プログラム120であってもよい。
 また、制御装置10の機能は、専用のハードウェアによっても、また、通常のコンピュータシステムによっても実現することができる。
 例えば、プロセッサ41によって実行されるプログラムP1を、コンピュータ読み取り可能な非一時的な記録媒体に格納して配布し、そのプログラムP1をコンピュータにインストールすることにより、上述の処理を実行する装置を構成することができる。このような記録媒体としては、例えばフレキシブルディスク、CD-ROM(Compact Disc Read-Only Memory)、DVD(Digital Versatile Disc)、MO(Magneto-Optical Disc)が考えられる。
 また、プログラムP1をインターネットに代表される通信ネットワーク上のサーバ装置が有するディスク装置に格納しておき、例えば、搬送波に重畳させて、コンピュータにダウンロードするようにしてもよい。
 また、通信ネットワークを介してプログラムP1を転送しながら起動実行することによっても、上述の処理を達成することができる。
 さらに、プログラムP1の全部又は一部をサーバ装置上で実行させ、その処理に関する情報をコンピュータが通信ネットワークを介して送受信しながらプログラムを実行することによっても、上述の処理を達成することができる。
 なお、上述の機能を、OS(Operating System)が分担して実現する場合又はOSとアプリケーションとの協働により実現する場合等には、OS以外の部分のみを媒体に格納して配布してもよく、また、コンピュータにダウンロードしてもよい。
 また、制御装置10の機能を実現する手段は、ソフトウェアに限られず、その一部又は全部を、回路を含む専用のハードウェアによって実現してもよい。
 本発明は、本発明の広義の精神と範囲を逸脱することなく、様々な実施の形態及び変形が可能とされるものである。また、上述した実施の形態は、本発明を説明するためのものであり、本発明の範囲を限定するものではない。つまり、本発明の範囲は、実施の形態ではなく、請求の範囲によって示される。そして、請求の範囲内及びそれと同等の発明の意義の範囲内で施される様々な変形が、本発明の範囲内とみなされる。
 本発明は、プログラムの正当性の確認に適している。
 100 制御システム、 10 制御装置、 11 受付部、 12 記憶部、 13 実行部、 14 算出部、 15 判定部、 20 ユーザ端末、 21 ユーザ、 30 機器、 41 プロセッサ、 42 主記憶部、 43 補助記憶部、 44 ROM(Read Only Memory)、 45 入力部、 46 出力部、 47 通信部、 48 内部バス、 120 制御処理プログラム、 121 コード処理プログラム、 1211 算出コマンド、 1212 比較コマンド、 1213 結果コマンド、 1214 複製コマンド、 122 対象プログラム、 123 検出コード、 124 比較コード、 51,52,53 コマンド群、 511 リセットコマンド、 521 加算コマンド、 522 除算コマンド、 523,531 判定コマンド、 524 格納コマンド、 P1 プログラム、 P2 ファームウェア。

Claims (5)

  1.  機器を制御するための制御処理を実行する制御装置であって、
     前記制御処理を実行するためのプログラムに含まれる監視対象である対象プログラムの変更を検出するための検出コードを算出する算出処理と、算出された前記検出コードを過去に前記対象プログラムから算出された比較コードと比較する比較処理と、を含むコード処理の実行指示を受け付ける受付手段と、
     前記対象プログラムから前記検出コードを算出する算出手段と、
     前記検出コードが前記比較コードに等しいか否かを判定する判定手段と、
     前記実行指示に従って前記コード処理を実行する実行手段と、
     を備える制御装置。
  2.  前記対象プログラムは、前記制御処理を実行するための複数のプログラムのうちユーザによって指定されたプログラムである、
     請求項1に記載の制御装置。
  3.  前記受付手段は、前記算出処理及び前記比較処理を含む前記コード処理を構成する処理の実行手順を受け付け、
     前記実行手段は、前記実行手順に従って前記コード処理を実行する、
     請求項1又は2に記載の制御装置。
  4.  機器を制御するための制御処理を実行する制御装置によって実行されるプログラム監視方法であって、
     受付手段が、前記制御処理を実行するためのプログラムに含まれる監視対象である対象プログラムの変更を検出するための検出コードを算出する算出処理と、算出された前記検出コードを過去に前記対象プログラムから算出された比較コードと比較する比較処理と、を含むコード処理の実行指示を受け付ける受付ステップと、
     算出手段が、前記対象プログラムから前記検出コードを算出する算出ステップと、
     判定手段が、前記検出コードが前記比較コードに等しいか否かを判定する判定ステップと、
     実行手段が、前記実行指示に従って、前記コード処理を実行する実行ステップと、
     を含むプログラム監視方法。
  5.  機器を制御するための制御処理を実行する制御装置を、
     前記制御処理を実行するためのプログラムに含まれる監視対象である対象プログラムの変更を検出するための検出コードを算出する算出処理と、算出された前記検出コードを過去に前記対象プログラムから算出された比較コードと比較する比較処理と、を含むコード処理の実行指示を受け付ける受付手段、
     前記対象プログラムから前記検出コードを算出する算出手段、
     前記検出コードが前記比較コードに等しいか否かを判定する判定手段、
     前記実行指示に従って、前記コード処理を実行する実行手段、
     として機能させるためのプログラム。
PCT/JP2019/027022 2019-07-08 2019-07-08 制御装置、プログラム監視方法及びプログラム WO2021005691A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2020504428A JPWO2021005691A1 (ja) 2019-07-08 2019-07-08 制御装置、プログラム監視方法及びプログラム
PCT/JP2019/027022 WO2021005691A1 (ja) 2019-07-08 2019-07-08 制御装置、プログラム監視方法及びプログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2019/027022 WO2021005691A1 (ja) 2019-07-08 2019-07-08 制御装置、プログラム監視方法及びプログラム

Publications (1)

Publication Number Publication Date
WO2021005691A1 true WO2021005691A1 (ja) 2021-01-14

Family

ID=74114007

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/027022 WO2021005691A1 (ja) 2019-07-08 2019-07-08 制御装置、プログラム監視方法及びプログラム

Country Status (2)

Country Link
JP (1) JPWO2021005691A1 (ja)
WO (1) WO2021005691A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023275942A1 (ja) * 2021-06-28 2023-01-05 三菱電機株式会社 通信周期決定装置、通信周期決定方法および通信周期決定プログラム

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58221405A (ja) * 1982-06-16 1983-12-23 Omron Tateisi Electronics Co プログラマブル・コントロ−ラ
JPH07311607A (ja) * 1994-04-25 1995-11-28 Canon Inc シーケンス制御方法
JP2009187373A (ja) * 2008-02-07 2009-08-20 Fuji Electric Systems Co Ltd プログラマブルコントローラ
JP2010244213A (ja) * 2009-04-02 2010-10-28 Fuji Electric Systems Co Ltd プログラマブルコントローラ、プログラム実行監視方法及びプログラム
WO2019003313A1 (ja) * 2017-06-27 2019-01-03 三菱電機株式会社 デバッグ装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3502465B2 (ja) * 1995-01-24 2004-03-02 富士通株式会社 データ処理システム
JP4335707B2 (ja) * 2004-02-06 2009-09-30 Necエレクトロニクス株式会社 プログラム改竄検出装置、及びプログラム改竄検出プログラムおよびプログラム改竄検出方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58221405A (ja) * 1982-06-16 1983-12-23 Omron Tateisi Electronics Co プログラマブル・コントロ−ラ
JPH07311607A (ja) * 1994-04-25 1995-11-28 Canon Inc シーケンス制御方法
JP2009187373A (ja) * 2008-02-07 2009-08-20 Fuji Electric Systems Co Ltd プログラマブルコントローラ
JP2010244213A (ja) * 2009-04-02 2010-10-28 Fuji Electric Systems Co Ltd プログラマブルコントローラ、プログラム実行監視方法及びプログラム
WO2019003313A1 (ja) * 2017-06-27 2019-01-03 三菱電機株式会社 デバッグ装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023275942A1 (ja) * 2021-06-28 2023-01-05 三菱電機株式会社 通信周期決定装置、通信周期決定方法および通信周期決定プログラム
JPWO2023275942A1 (ja) * 2021-06-28 2023-01-05
JP7317269B2 (ja) 2021-06-28 2023-07-28 三菱電機株式会社 通信周期決定装置、通信周期決定方法および通信周期決定プログラム
TWI830085B (zh) * 2021-06-28 2024-01-21 日商三菱電機股份有限公司 通訊周期決定裝置、通訊周期決定方法及通訊周期決定程式產品

Also Published As

Publication number Publication date
JPWO2021005691A1 (ja) 2021-09-13

Similar Documents

Publication Publication Date Title
JP5039428B2 (ja) プログラマブルコントローラ及びplcシステム
US7818465B2 (en) I/O module expansion unit and distributed automation system
US20140123121A1 (en) Rack and method thereof for simultaneously updating basic input output systems
US9696692B2 (en) Industrial automation control system
US20120079470A1 (en) System, method, and apparatus for software maintenance of sensor and control systems
JP2011145910A (ja) 情報処理装置及び情報処理装置のファームウェア更新方法
JP6139386B2 (ja) プログラマブルコントローラ
JP2017049627A (ja) 検証システム、検証装置、及び、車両制御装置
CN112015447B (zh) 电子设备的系统更新方法及装置、电子设备及存储介质
WO2021005691A1 (ja) 制御装置、プログラム監視方法及びプログラム
JP2013205866A (ja) 情報処理装置、情報処理方法、およびプログラム
JP5012548B2 (ja) プログラマブルコントローラ
JP2013257640A (ja) コンフィグレーション制御装置、コンフィグレーション制御方法及びコンフィグレーション制御プログラム
JP7067273B2 (ja) サポート装置、制御システム、および開発支援プログラム
CN117908910A (zh) 一种mcu升级方法、装置、电子设备及存储介质
CN115296776B (zh) 通讯数据的校验处理方法、系统、设备及介质
JP5365875B2 (ja) 産業用コントローラ
JP6149393B2 (ja) 通信カプラ、情報処理装置、制御方法およびプログラム
JP2016024798A (ja) 冗長化コントローラシステム、その待機系コントローラ
JP2011110687A (ja) ロボットコントロール・システム、ロボットコントロール方法
CN105320030B (zh) 工程装置、工程系统以及下载处理方法
KR20220075652A (ko) Plc 프로그램의 데이터 관리 방법, 장치 및 그 plc 시스템
JP2005092695A (ja) 二重化コントローラ、その等値化モード決定方法
JP2009003557A (ja) 装置起動時診断方法、診断プログラム及び起動時診断装置
JP2018180608A (ja) プログラム実行装置およびプログラム実行方法

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2020504428

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19936868

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19936868

Country of ref document: EP

Kind code of ref document: A1