Data conflict detection device, data conflict detection method, and program

The data conflict detection device addresses the inaccuracy of existing techniques by analyzing access types and logs to identify potential conflicts in PLCs with multiple CPU cores, enhancing detection accuracy and efficiency in parallel execution environments.

WO2024224476A1PCT designated stage expired Publication Date: 2024-10-31MITSUBISHI ELECTRIC CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2023/016272
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-25
Publication Date
2024-10-31

Smart Images

  • Figure JP2023016272_31102024_PF_FP_ABST
    Figure JP2023016272_31102024_PF_FP_ABST
Patent Text Reader

Abstract

The present invention is provided with: a core allocation setting unit (101) that sets the allocation of CPU cores (201) for each sequence program (P) of a plurality of sequence programs (P) that operate on a PLC (20) provided with a plurality of the CPU cores (201); and a data conflict detection unit (103) that, on the basis of the allocation by the core allocation setting unit (101), detects a device in which data conflict may occur when two or more of the CPU cores (201) are accessing data and one or more CPU cores (201) from among the two or more CPU cores (201) are writing data during the parallel execution of the plurality of sequence programs (P) on the PLC (20).
Need to check novelty before this filing date? Find Prior Art

Description

Data race detection device, data race detection method and program

[0001] The present disclosure relates to a data race detection device, a data race detection method, and a program.

[0002] In the field of programmable logic controllers (hereinafter also referred to as PLCs), there are PLCs that have multiple central processing unit (CPU) cores to reduce the processing time of sequence programs. The processing time can be reduced by the multiple CPU cores executing sequence programs in parallel.

[0003] When multiple CPU cores execute sequence programs in parallel, there is a possibility of data conflicts occurring, where each CPU core reads and writes to the same device at an unintended timing. Note that "device" here refers to the memory area used by the sequence program executed by the PLC. Devices represent, for example, signals received from sensors, signals output to actuators, internal states, timers, etc.

[0004] When a data conflict occurs, it can cause problems that did not occur when there was only one CPU core. Therefore, it is necessary to identify the possibility of a data conflict occurring. However, because a data conflict may or may not occur depending on the timing of accesses to the same device by multiple CPU cores, identifying devices where a data conflict may occur requires a huge amount of work.

[0005] As a technology related to the above circumstances, Patent Document 1 discloses a technology for detecting a conflict between a program to be verified and an interrupt program by analyzing an access log to control signals including link signals transmitted and received between control processes and input / output signals transmitted and received between the control process and a hardware driver, and extracting conflict control signals.

[0006] International Publication No. 2014 / 199496

[0007] The technology of Patent Document 1 extracts contention control signals without considering the access type, so there is a possibility that control signals that do not actually cause problems during parallel execution may be extracted. As a result, there is a problem that the technology of Patent Document 1 cannot be directly applied to parallel execution by a PLC having multiple CPU cores.

[0008] In view of the above circumstances, an object of the present disclosure is to provide a data conflict detection device or the like that detects data conflicts taking into account the type of access to a device in an environment in which a programmable logic controller having multiple CPU cores executes sequence programs in parallel.

[0009] In order to achieve the above object, the data conflict detection device according to the present disclosure includes: a core allocation setting means for setting an allocation of CPU cores for each of a plurality of sequence programs that run on a programmable logic controller having a plurality of CPU (Central Processing Unit) cores; and a data conflict detection means for detecting, based on the allocation by the core allocation setting means, a device that is accessed by two or more CPU cores when the plurality of sequence programs are executed in parallel on the programmable logic controller, and to which one or more of the CPU cores may write data, resulting in a data conflict.

[0010] According to the present disclosure, in an environment in which a programmable logic controller having multiple CPU cores executes sequence programs in parallel, data conflicts can be detected taking into account the type of access to a device.

[0011] FIG. 1 is a diagram showing an overall configuration of a data race detection system according to an embodiment of the present disclosure. FIG. 2 is a diagram showing the correspondence between access types and the likelihood of data race occurrence in a data race detection system according to an embodiment of the present disclosure. FIG. 3 is a diagram showing an example of a core allocation setting screen displayed by a data race detection device according to an embodiment of the present disclosure. FIG. 4 is a diagram showing an example of static analysis by a data race detection device according to an embodiment of the present disclosure.

[0012] Hereinafter, an embodiment in which a data race detection device according to the present disclosure is applied to a data race detection system will be described with reference to the drawings. In each drawing, the same or equivalent parts are denoted by the same reference numerals.

[0013] (Embodiment) A data race detection system 1 according to an embodiment will be described with reference to Figure 1. The data race detection system 1 includes a data race detection device 10 and a PLC 20. The data race detection device 10 and the PLC 20 are communicatively connected. The data race detection system 1 is a data race detection system in which the data race detection device 10 detects devices in which a data race may occur when the PLC 20, which includes multiple CPU cores 201, executes multiple sequence programs P in parallel.

[0014] The PLC 20 is a programmable logic controller that is installed, for example, at a production site and controls field devices (not shown). The PLC 20 includes a storage unit 200 and multiple CPU cores 201. The PLC 20 executes multiple sequence programs P stored in the storage unit 200 in parallel using the multiple CPU cores 201. During parallel execution, the PLC 20 creates an access log L to devices and stores the access log L in the storage unit 200. The PLC 20 is an example of a programmable logic controller according to the present disclosure.

[0015] For simplicity, in the following description, it is assumed that the PLC has two CPU cores 201. However, the number of sequence programs P may be three or more. When there are two CPU cores 201 and three or more sequence programs P, at least one CPU core 201 executes two or more sequence programs P in parallel. Parallel execution is achieved, for example, by switching the sequence program P to be executed at regular intervals.

[0016] The data race detection device 10 is, for example, a personal computer on which an engineering tool program is installed. The data race detection device 10 detects devices in which a data race may occur when a PLC 20 executes multiple sequence programs P in parallel using multiple CPU cores 201. As will be described in detail later, the data race detection device 10 statically analyzes the sequence programs P to detect devices in which a data race may occur, and also detects devices in which a data race may occur by analyzing an access log L stored by the PLC 20. The functional configuration of the data race detection device 10 will be described in detail later. The data race detection device 10 is an example of a data race detection device according to the present disclosure.

[0017] The correspondence between the type of access to a device and the possibility of a data conflict occurring will be described with reference to Figure 2. Figure 2 shows the correspondence between combinations of access types and the possibility of a data conflict occurring when two CPU cores 201, named CPU core A and CPU core B, access the same device.

[0018] When the access type of both CPU cores A and B is "read," there is no possibility of a data conflict occurring. On the other hand, when the access type of one of CPU cores A and B is "read" and the access type of the other is "write," there is a possibility of a data conflict occurring. Furthermore, when the access type of both CPU cores A and B is "write," there is also a possibility of a data conflict occurring.

[0019] In other words, a data conflict may occur when the access type of at least one of CPU cores A and B is "write." Similarly, when there are three or more CPU cores 201, a data conflict may occur when the access type of at least one of the multiple CPU cores 201 is "write."

[0020] The data conflict detection device 10 uses the above correspondence relationship to detect devices in which a data conflict may occur.

[0021] 1, the functional configuration of the data race detection device 10 will be described. The data race detection device 10 includes a storage unit 100, a core allocation setting unit 101, a log acquisition unit 102, a data race detection unit 103, and a notification unit 104.

[0022] The storage unit 100 stores a plurality of sequence programs P. The plurality of sequence programs P are the same as those stored in the storage unit 200 of the PLC 20. For example, the data race detection device 10 transmits the plurality of sequence programs P to the PLC 20, and the PLC 20 stores the plurality of sequence programs P in the storage unit 200. As described above, when the data race detection device 10 is a personal computer on which an engineering tool program is installed, the data race detection device 10 is also used for developing sequence programs P. Therefore, it is conceivable that a user will develop a sequence program P on the data race detection device 10 and transmit it to the PLC 20.

[0023] The core allocation setting unit 101 sets an allocation of which sequence programs P are executed by which CPU cores 201 when the multiple sequence programs P are executed in parallel by the multiple CPU cores 201 of the PLC 20. The core allocation setting unit 101 displays a core allocation setting screen shown in FIG. 3 on a display unit (not shown), for example, to allow a user to set core allocation. In the example shown in FIG. 3 , of the multiple sequence programs P, programs x and w are assigned to CPU core A, and programs y and z are assigned to CPU core B. This core allocation setting is also reflected in the PLC 20, and the multiple CPU cores 201 of the PLC 20 execute the multiple sequence programs P in parallel according to this allocation setting. The core allocation setting unit 101 is an example of a core allocation setting means according to the present disclosure.

[0024] The log acquisition unit 102 acquires, via communication, the access log L stored in the storage unit 200 of the PLC 20. The acquired access log L is used by the data conflict detection unit 103, which will be described later. The log acquisition unit 102 is an example of a log acquisition means according to the present disclosure.

[0025] The data conflict detection unit 103 detects devices in which a data conflict may occur by using the following two functions: The data conflict detection unit 103 is an example of a data conflict detection means according to the present disclosure.

[0026] As a first function, the data conflict detection unit 103 statically analyzes multiple sequence programs P stored in the storage unit 100, and detects devices in which data conflicts may occur based on the results of the static analysis and the core allocation set by the core allocation setting unit 101. In the static analysis, it is analyzed which device is accessed by which access type for each sequence program P. Therefore, the detection result by the first function also takes into account the access type.

[0027] A specific example of static analysis will be described with reference to Fig. 4. Note that Fig. 4 shows the results of the static analysis and the core allocation by the core allocation setting unit 101 together.

[0028] The data conflict detection unit 103 statically analyzes each sequence program P and identifies, for each sequence program, which device was accessed and by which access type. As a result, the columns of "sequence program," "accessed device," and "access type" shown in FIG. 4 are determined.

[0029] The data conflict detection unit 103 determines whether there is an access that may cause a data conflict between different CPU cores 201, based on the results of the static analysis and the core allocation. In the example shown in Figure 4, a write to device D0 by program z executed by CPU core B conflicts with a read from device D0 among reads from devices D0-D2 by program x executed by CPU core A. Similarly, a write to device D10 by program x executed by CPU core A conflicts with a read from device D10 by program y executed by CPU core B. Based on these results, the data conflict detection unit 103 detects devices D0 and D10 as devices where a data conflict may occur.

[0030] As a second function, the data conflict detection unit 103 analyzes the access log L acquired by the log acquisition unit 102 to detect devices in which a data conflict may occur. Since the access log L is an access log obtained by the multiple CPU cores 201 of the PLC 20 actually executing multiple sequence programs P in parallel, the analysis of the access log L is dynamic analysis. The reason why dynamic analysis is performed using the second function in addition to static analysis using the first function is as follows.

[0031] In general, the range of data access may change dynamically during execution of a sequence program. For example, a runtime-dependent dynamic value may be stored in an index register, and access may be based on an "offset" using the value stored in the index register. Specifically, if the index register value is 5 and the access range described by the sequence program is devices D0-D4, the range actually accessed during execution will not be devices D0-D4, but rather devices D5-D9, which are "offset" by 5.

[0032] Therefore, even if a data conflict does not appear to occur in static analysis, it may occur during execution. For example, assume that CPU core A's access range is devices D0-D3, and CPU core B's access range is devices D5-D8. Also, assume that the access type of at least one of CPU cores A and B is "write." In this case, the first function based on static analysis determines that there is no possibility of a data conflict because the access ranges do not overlap. However, during actual execution, if the index register of CPU core A is 5 and the index register of CPU core B is 2, the access range of CPU core A will be devices D5-D8, and the access range of CPU core B will be devices D7-D10, so there is a possibility of a data conflict between devices D7 and D8.

[0033] Such data conflicts can also be detected by analyzing the access log L. An example of the access log L is shown in FIG. 5. In this example, device D10 is detected as a device where data conflicts may occur. As shown in FIG. 5, the access log L includes a log related to the access type. Therefore, the detection result by the second function also takes the access type into consideration.

[0034] The notification unit 104 notifies the user of devices that have been detected by the data conflict detection unit 103 and that may cause a data conflict, using a display device (not shown). The screen displayed by the notification unit 104 is, for example, as shown in Fig. 6. The notification unit 104 may further display the conflicting devices together with the sequence program P. For example, as shown in Fig. 7, the programs x and y may be displayed in a ladder diagram, and the relevant devices may be highlighted by the shading shown in Fig. 7.

[0035] Next, an example of the hardware configuration of the data race detection device 10 will be described with reference to Fig. 8. The data race detection device 10 shown in Fig. 8 is realized by a computer such as a personal computer, a smartphone, or a tablet.

[0036] The data race detection device 10 includes a processor 1001 , a memory 1002 , an interface 1003 , and a secondary storage device 1004 , which are connected to one another via a bus 1000 .

[0037] The processor 1001 is, for example, a CPU (Central Processing Unit). The processor 1001 loads an operating program stored in a secondary storage device 1004 into a memory 1002 and executes the program, thereby realizing each function of the data conflict detection device 10.

[0038] The memory 1002 is a main storage device configured, for example, by a RAM (Random Access Memory). The memory 1002 stores the operating program that the processor 1001 reads from the secondary storage device 1004. The memory 1002 also functions as a working memory when the processor 1001 executes the operating program.

[0039] The interface 1003 is an I / O (Input / Output) interface such as a serial port, a USB (Universal Serial Bus) port, or a network interface.

[0040] The secondary storage device 1004 is, for example, a flash memory, a hard disk drive (HDD), or a solid state drive (SSD). The secondary storage device 1004 stores the operating programs executed by the processor 1001. The secondary storage device 1004 realizes the functions of the storage unit 100.

[0041] Next, an example of the operation of data race detection by the data race detection device 10 will be described with reference to Fig. 9. The operation shown in Fig. 9 is started when, for example, a user operates the data race detection device 10 to instruct it to detect a data race.

[0042] The core allocation setting unit 101 of the data conflict detection device 10 sets core allocation, ie, which sequence program P is executed by which CPU core 201 (step S1).

[0043] The data conflict detection unit 103 of the data conflict detection device 10 statically analyzes each of the plurality of sequence programs P stored in the storage unit 100 (step S2).

[0044] The data conflict detection unit 103 detects devices with a possibility of data conflict based on the results of the static analysis in step S2 and the core allocation in step S1 (step S3).

[0045] The log acquisition unit 102 of the data conflict detection device 10 acquires the access log L from the PLC 20 (step S4).

[0046] The data conflict detection unit 103 analyzes the access log L acquired in step S4 and detects devices with a possibility of data conflict (step S5).

[0047] The notification unit 104 of the data conflict detection device 10 notifies the user of the devices detected in steps S3 and S5 that may have data conflicts (step S6).Then, the data conflict detection device 10 ends the data conflict detection operation.

[0048] The data race detection system 1 according to an embodiment has been described above. The data race detection device 10 of the data race detection system 1 detects devices with a possibility of data races based on the results of static analysis of a sequence program P and the core allocation by the core allocation unit 101. The access type is also analyzed during the static analysis. Therefore, in an environment in which a PLC 20 equipped with multiple CPU cores 201 executes multiple sequence programs P in parallel, data races can be detected taking into account the access type to the device.

[0049] Furthermore, the data conflict detection device 10 of the data conflict detection system 1 analyzes the access log L saved by the PLC 20 when the sequence program P is executed, to detect devices where a data conflict may occur. The access log L includes a log indicating the type of access. Therefore, in an environment where the PLC 20, which has multiple CPU cores 201, executes multiple sequence programs P in parallel, data conflicts can be detected taking into account the type of access to the device.

[0050] 8, the data race detection device 10 includes a secondary storage device 1004. However, the present invention is not limited to this, and the secondary storage device 1004 may be provided external to the data race detection device 10, and the data race detection device 10 and the secondary storage device 1004 may be connected via an interface 1003. In this configuration, removable media such as a USB flash drive or memory card may also be used as the secondary storage device 1004.

[0051] 8, data race detection device 10 may be configured with a dedicated circuit using an ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array), etc. In the hardware configuration shown in FIG. 8, some of the functions of data race detection device 10 may be realized by a dedicated circuit connected to interface 1003, for example.

[0052] The program used in the data race detection device 10 can be stored and distributed on a computer-readable recording medium such as a CD-ROM (Compact Disc Read Only Memory), a DVD (Digital Versatile Disc), a USB flash drive, a memory card, or a HDD. By installing such a program on a specific or general-purpose computer, the computer can function as the data race detection device 10.

[0053] Furthermore, the above-mentioned program may be stored in a storage device owned by another server on the Internet, and the program may be downloaded from that server.

[0054] The present disclosure allows various embodiments and modifications without departing from the broad spirit and scope of the present disclosure. Furthermore, the above-described embodiments are intended to explain the present disclosure and do not limit the scope of the present disclosure. In other words, the scope of the present disclosure is defined by the claims, not the embodiments. Various modifications made within the scope of the claims and the meaning of equivalent disclosures are considered to be within the scope of the present disclosure.

[0055] 1 Data conflict detection system, 10 Data conflict detection device, 20 PLC, 100 Memory unit, 101 Core allocation setting unit, 102 Log acquisition unit, 103 Data conflict detection unit, 104 Notification unit, 200 Memory unit, 201 CPU core, 1000 Bus, 1001 Processor, 1002 Memory, 1003 Interface, 1004 Secondary storage device, L Access log, P Sequence program.

Claims

1. A data conflict detection device comprising: a core allocation setting means for setting a CPU core allocation for each of a plurality of sequence programs that run on a programmable logic controller having a plurality of CPU (Central Processing Unit) cores; and a data conflict detection means for detecting a device that may be accessed by two or more CPU cores and to which one or more of the CPU cores write data when the plurality of sequence programs are executed in parallel on the programmable logic controller based on the allocation by the core allocation setting means, thereby potentially causing a data conflict.

2. The data conflict detection device according to claim 1, wherein said data conflict detection means statically analyzes each of said plurality of sequence programs, and detects devices in which a data conflict may occur based on the results of the static analysis and the allocation made by said core allocation setting means.

3. A data conflict detection device according to claim 1 or 2, further comprising a log acquisition means for acquiring an access log when each of the plurality of sequence programs is executed in parallel on the programmable logic controller, wherein the data conflict detection means detects a device in which a data conflict may occur by analyzing the access log acquired by the log acquisition means.

4. A data conflict detection method comprising: setting an allocation of CPU cores for each of a plurality of sequence programs that run on a programmable logic controller having a plurality of CPU (Central Processing Unit) cores; and detecting, based on the allocation, a device that may be accessed by two or more CPU cores and to which one or more of the CPU cores write data, resulting in a data conflict, when the plurality of sequence programs are executed in parallel on the programmable logic controller.

5. A program that causes a computer to set an allocation of CPU cores for each of a plurality of sequence programs that run on a programmable logic controller having multiple CPU (Central Processing Unit) cores, and based on the allocation, detects devices that may be accessed by two or more CPU cores and that may cause data conflicts when one or more of the CPU cores write data to the devices when the plurality of sequence programs are executed in parallel on the programmable logic controller.

Citation Information

Patent Citations

  • Control method of programmable controller, user program development support device, program for user program development support, recording medium, programmable controller system, and programmable controller

    JP2012208933A

  • Source code verification system

    JP2016091138A

  • Programmable controller, management device, and control system

    JP2018106440A

  • Software debugging method, information processing device, and program

    WO2015015591A1