Control device, recording medium, and control method
By designing a scheduler switching unit in a control device such as a PLC, the program execution priority of the management processor is solved, and the problem of uncertain system service time during the control cycle is realized, ensuring the time for system service within a predetermined period is realized.
Patent Information
- Application Number
- CN202080097305.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-03-31
- Filing Date
- 2020-12-17
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2040-12-17
AI Technical Summary
In control devices such as PLC, the program execution priority of the control object is high, resulting in the program execution priority of the system service related to the system service, and the time for the system service cannot be ensured within a predetermined period. As control becomes more complex, the execution time of the control program becomes longer, resulting in the idle time during the control cycle disappearing.
A control device is designed, including a processor, a storage unit and a scheduler. The device is executed by managing the program of the processor according to the priority level within a predetermined period. Specifically, the first program is a real-time control program with the highest priority execution, the second program is an association processing program associated with the real-time control, and the third program is a system service program with the lowest priority execution. Under the condition of interruption of the second program execution, the scheduler switch unit causes the processor to interrupt the execution of the second program and starts executing the third program.
In this way, the time for executing system services can be ensured during the control cycle, the problem of uncertain system service time is solved, and the overall efficiency of the control device is improved.
Smart Images

Figure CN115176208B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to a control device that executes multiple programs with different priorities. Background Art
[0002] In various production sites, FA (Factory Automation) technology using control devices such as PLCs (Programmable Logic Controllers) has been widely popularized. In such control devices, there is a need to execute multiple programs within a control cycle. Japanese Patent Application Laid-Open No. 2019-36043 (Patent Document 1) discloses a control device that sequentially executes multiple tasks according to the priorities of the respective tasks.
[0003] Prior Art Documents
[0004] Patent Documents
[0005] Patent Document 1: Japanese Patent Application Laid-Open No. 2019-36043 Summary of the Invention
[0006] Problems to be Solved by the Invention
[0007] In control devices such as PLCs, the execution priority of a program for controlling a control object is set relatively high. In contrast, the execution priority of a program related to a so-called system service different from control is set relatively low and is executed during the idle time of the control cycle.
[0008] As control becomes more complex, the execution time of the control program becomes longer, and there is a tendency for the idle time within the control cycle to disappear. On the other hand, there is also a need to ensure the time for implementing system services. Therefore, a structure that can ensure the time for implementing system services within a predetermined cycle is desired.
[0009] Means for Solving the Problems
[0010] The control device for controlling a control object according to the present disclosure includes: a processor; a storage unit that stores multiple programs; and a scheduler that manages programs to be executed by the processor according to priorities within a predetermined cycle. The multiple programs in the storage unit include: a first program that is the program with the highest execution priority to be executed by the processor during the cycle and is used for real-time control processing of the control object; a second program that has a lower execution priority than the first program and is used for associated processing related to real-time control; and a third program for system services that has a lower execution priority than the second program and is executed when there is idle time of the processor during the cycle. The scheduler includes a switching unit that, when the execution of the second program is started within the cycle and then a predetermined type of command code is executed in the second program, causes the processor to interrupt the execution of the second program and start executing the third program.
[0011] According to the above disclosure, in the case where the processor executes programs according to priorities within a cycle, when the execution of the second program starts and then a command code of a predetermined type is executed in the second program, the switching unit of the scheduler interrupts the execution of the second program and starts the execution of the third program. Thereby, it is possible to ensure the time for executing the third program within the cycle, and it is possible to implement system services within this cycle.
[0012] In the above disclosure, the real-time control processing includes the following processing: generating an instruction value for a control object based on intermediate code generated by the association processing, and the command code of a predetermined type includes the following command code: this command code generates intermediate code that spans multiple cycles when it is executed.
[0013] According to the above disclosure, even if the execution of the second program is interrupted, in the real-time control processing, it is possible to generate an instruction value based on the intermediate code that has been generated and spans multiple cycles.
[0014] In the above disclosure, the command code of a predetermined type includes a wait command code, and the wait command code is described using a wait condition and a code for determining whether the wait condition is satisfied.
[0015] According to the above disclosure, in the case where the association processing is in a wait state before the wait command code is executed and the wait condition is satisfied, it is possible to interrupt the execution of the second program by the processor and start the execution of the third program.
[0016] In the above disclosure, the second program includes a program described in an interpreter language.
[0017] According to the above disclosure, the control device can determine whether to execute a command code of a predetermined type by using the analysis result of the command code by the interpreter.
[0018] In the above disclosure, the system service includes the processing of a time-series database that saves records in time series, and the records include data related to a control object.
[0019] According to the above disclosure, by interrupting the execution of the second program and starting the execution of the third program, the control device can ensure the processing time of the time-series database that saves records in time series within a cycle, and the records include data related to a control object.
[0020] In the above disclosure, the control device further has: a data generation unit that generates, for each cycle, data for constituting a record to be stored in the time series database; and a non-blocking queue formed on a volatile main storage device that sequentially stores the data generated by the data generation unit. The system service includes the following processing: reading data from the non-blocking queue and storing it in the time series database. According to the above disclosure, data generated relatively quickly within a cycle can be stored in the time series database with a relatively slow access speed via the non-blocking queue.
[0021] In the above disclosure, the control device has a time series database.
[0022] According to the above disclosure, the control device can have a time series database internally.
[0023] In the above disclosure, the control device further has a margin monitoring unit that monitors the memory margin of the non-blocking queue. Based on the comparison result between the memory margin and a threshold value, the switching unit interrupts the execution of the second program being executed by the processor and starts the execution of the third program.
[0024] According to the above disclosure, the control device can interrupt the execution of the second program being executed by the processor and start the execution of the third program based on the comparison result between the memory margin of the non-blocking queue and a threshold value.
[0025] In the above disclosure, the first program includes command codes for associated processing that are executed when the execution of the second program is interrupted.
[0026] According to the above disclosure, when the execution of the second program is interrupted, the control device can execute the command codes for associated processing during the execution of the first program.
[0027] The program of the present disclosure is executed by a control device having a processor for controlling a control object. The program has: a scheduler program that manages programs for causing the processor to execute according to priorities within a predetermined cycle; a first program that is the program with the highest execution priority executed by the processor during the cycle and is used for real-time control processing of the control object; a second program that is a program with an execution priority lower than that of the first program and is used for associated processing related to real-time control; and a third program of the system service that has an execution priority lower than that of the second program and is executed when there is idle time of the processor during the cycle. The scheduler program includes a switching program. When the execution of the second program is started within the cycle and then a command code of a predetermined type is executed in the second program, the switching program interrupts the execution of the second program by the processor and starts the execution of the third program.
[0028] According to the present disclosure, during the process of a processor executing programs according to priorities, by executing a switching program, it is possible to ensure the time for executing the third program within a cycle. Thereby, a structure can be provided that can ensure the time for implementing system services within a predetermined cycle.
[0029] The control method of the present disclosure is a control method for controlling a control device having a processor for controlling a control object. The control device has: a first program, which is the program with the highest execution priority executed by the processor in a predetermined cycle and is used for real-time control processing of the control object; a second program, which is a program with an execution priority lower than that of the first program and is used for associated processing related to real-time control; and a third program for system services, which has an execution priority lower than that of the second program and is executed when there is idle time of the processor in the cycle. The control method has a step of managing the programs for the processor to execute according to priorities within the cycle. The step of management includes the following steps within the cycle: determining whether to start executing the second program, and then executing a command code of a predetermined type in the second program; and in the case of a positive determination, interrupting the execution of the second program by the processor and starting to execute the third program.
[0030] According to the present disclosure, during the process of a processor executing programs according to priorities, it is possible to ensure the time for executing the third program within a cycle. Thereby, a structure can be provided that can ensure the time for implementing system services within a predetermined cycle.
[0031] Effects of the Invention
[0032] According to the present disclosure, within the control cycle, the time for implementing system services can be ensured. Description of the Drawings
[0033] Figure 1 It is a diagram schematically showing an application example.
[0034] Figure 2 It is a schematic diagram showing an overall structural example of the control system 1 of the embodiment.
[0035] Figure 3 It is a block diagram showing a hardware structural example of the control device 100 of the embodiment.
[0036] Figure 4 It is a block diagram showing a software structural example of the control device 100 of the present embodiment.
[0037] Figure 5 It is a schematic diagram showing an example of the functional structure of the control device 100 of the embodiment.
[0038] Figure 6It is a schematic diagram showing the main part of the processing related to the time series database 180 in the control device 100 of the present embodiment.
[0039] Figure 7 It is a diagram showing an example of the data structure of the records stored in the time series database 180 in the control device 100 of the embodiment.
[0040] Figure 8 It is a diagram showing an example of the data structure of the records stored in the time series database 180 in the control device 100 of the embodiment.
[0041] Figure 9 It is a schematic diagram showing an example of the periodic control in the control device 100 of the embodiment.
[0042] Figure 10 It is a schematic diagram showing an example of the periodic control in the control device 100 of the embodiment.
[0043] Figure 11 It is a schematic diagram showing an example of the periodic control in the control device 100 of the embodiment.
[0044] Figure 12 It is a schematic diagram showing an example of the periodic control in the control device 100 of the embodiment.
[0045] Figure 13 It is a flowchart schematically showing the processing of the control application processing unit 30 of the embodiment.
[0046] Figure 14 It is a flowchart showing the processing of the program analysis unit 34 of the embodiment.
[0047] Figure 15 It is a table showing the correspondence between the types of command codes and program codes of the embodiment.
[0048] Figure 16 It is a flowchart schematically showing the processing of the scheduler 25 of the embodiment.
[0049] Figure 17 It is a diagram schematically showing a part of the control application program 1542 of the embodiment.
[0050] Figure 18 It is a flowchart schematically showing the processing of the switching unit 26 of the embodiment.
[0051] Figure 19 It is a diagram schematically showing an example of the command code executed by the control application processing unit 301 of the embodiment.
[0052] Figure 20This is a diagram illustrating an example of an application that uses the time-series data stored in the time-series database 180 of the control device 100 in the embodiment. Detailed Embodiment
[0053] Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following description, the same reference numerals are assigned to the same components and constituent elements. Their names and functions are also the same. Therefore, detailed descriptions thereof will not be repeated.
[0054] <A. Application Example>
[0055] Figure 1 This is a diagram schematically showing an application example. Referring to Figure 1 an example of a scenario to which the present disclosure is applied will be described. Referring to Figure 1 a control device 100 that controls a control target in the production site of FA includes a processor 102, a secondary storage device 108 such as an HDD (Hard Disc Drive), a scheduler 25, and a time-series database 180. The control device 100 includes a controller such as a PLC. The "control target" includes machines or devices, sensors, etc. that are to be controlled in the FA production line. Machines or devices include mechanical mechanisms such as robots, workbenches, and conveyors.
[0056] The scheduler 25 manages programs that cause the processor 102 to execute according to priorities within a predetermined period. The time-series database 180 is configured to store records including data related to the control target generated for each period in a time series in a memory. In the present embodiment, the predetermined period corresponds to the control period T.
[0057] The secondary storage device 108 stores a plurality of programs in a manner readable by the processor 102. The programs stored in the secondary storage device 108 include a first program, a second program, and a third program. The first program is the program with the highest execution priority to be executed by the processor 102 in the control period T and is executed for real-time control processing of the control target. The second program is a program with an execution priority lower than that of the first program and is executed for associated processing related to real-time control. The third program is a program for system services with an execution priority lower than that of the second program and is executed when there is an idle time of the processor 102 in the control period T. In the embodiment, the idle time of the processor 102 represents a period of an idle state in which the processor 102 does not execute programs (processes, tasks).
[0058] For example, the first program includes an "IEC program". An IEC program is a term for a program that is scanned in its entirety each time it is executed and that calculates one or more instruction values each time it is executed. An IEC program typically includes a program composed of one or more commands described by the international standard IEC 61131-3 stipulated by the International Electrotechnical Commission (IEC). The IEC program may include commands for a logic processing unit for sequential control and a motion processing unit for motion control. The IEC program executes (scans) all programs in each control cycle T. The IEC program is suitable for control that requires immediacy and high speed, such as real-time control of an object. In addition, as an IEC program, it is not limited to commands described by the international standard IEC 61131-3, and may also include commands independently stipulated by the manufacturer or supplier of the PLC, etc.
[0059] The logic processing unit for sequential control is basically a method of sequentially executing a program (sequential program) from start to end, and the program (sequential program) is described by one or more logic circuits that calculate input values, output values, internal values, etc. In one control cycle T, it is executed from the start to the end of the program, and in the next control cycle T, it is executed again from the start to the end of the program. In addition, the sequential program is a program that represents a circuit.
[0060] The motion processing unit for motion control includes the following processing: according to the intermediate code output by the control application processing unit described later, for actuators such as servo motors included in the control object, values such as position, speed, acceleration, jerk, angle, angular velocity, angular acceleration, and angular jerk are calculated as instruction values. In motion control, in one control cycle T as well, the program (motion processing program) described by a function block or a numerical arithmetic expression, etc. is executed from start to end. That is, the instruction value is calculated (updated) in each control cycle T. Most of the intermediate codes used by the motion processing unit include commands that can calculate instruction values over multiple control cycles T, so the timing at which the motion processing unit obtains the intermediate code may not be each control cycle T.
[0061] The second program includes a control application program. By executing the control application program by the control application processing unit, for example, it is possible to implement the processing related to the control of a device or machine that performs specific processing or actions using a CNC (Computer Numerical Control) and / or an industrial robot and their control.
[0062] The second program includes a program consisting of one or more commands for implementing associated processing related to real-time control of a control object, and basically includes programs such as control application programs not included in the "IEC program". As an example, the second program is described using the G language in a CNC and using a robot language in industrial robot control. These languages include interpreter languages. The second program described in the interpreter language is executed in an interpreter manner that sequentially interprets and executes command codes. In addition, the second program is not limited to a program described in the interpreter language and can also be described in the same language as the IEC program of the first program.
[0063] The processor 102 provides an interpreter by executing an interpreter program. The interpreter interprets one or more command codes described in the second program and generates intermediate codes for the operation instruction values of the motion processing unit in each control cycle T based on the content of the interpretation. Since the intermediate codes are generated for each of the one or more command codes described in the second program, multiple intermediate codes are mostly generated from one second program. The generation of such intermediate codes can be included in the above-mentioned associated processing.
[0064] In each intermediate code, a function that can operate an instruction value with the time (or moment) of the control cycle T as an input can be specified. That is, the intermediate code can also be a function for the motion processing unit to operate an instruction value in each control cycle T. By using such a function, the motion processing unit can sequentially refer to the intermediate codes generated by the second program to operate the instruction values in each control cycle T.
[0065] The scheduler 25 causes the processor 102 to execute the first program, the second program, and the third program according to the priorities of the respective programs within the control cycle T. The first to third programs are respectively set with priorities indicating the degree to which the program should be executed prior to other programs. Within the control cycle T, the processor 102 starts executing the first program (time t0), and when the execution of the first program ends, it starts executing the second program (time t1). Then, when a predetermined type of command code is executed in the second program (step R1), the switching unit 26 of the scheduler 25 switches the program to be executed by the processor 102 (steps R2, time t2). In the switching, the switching unit 26 causes the processor 102 to interrupt the execution of the second program and start executing the third program (steps R3, R4).
[0066] By interrupting the execution of the second program in this way, an idle time of the processor 102 is set within the control cycle T, and the third program is executed during this idle time. Thereby, within the control cycle T, the time for implementing system services can be ensured.
[0067] System services may include, for example, the processing of the time series database 180. Therefore, it is possible to ensure the processing time of the time series database 180 within the control cycle T.
[0068] <Example of the overall structure of the control system>
[0069] First, an example of the overall structure of the control system 1 including the control device of the present embodiment will be described.
[0070] Figure 2 is a schematic diagram showing an example of the overall structure of the control system 1 of the embodiment. Refer to Figure 2 The control system 1 of the embodiment includes a control device 100 that controls a controlled object as a main component.
[0071] The control device 100 can also be embodied as a computer such as a PLC. The control device 100 is connected to the field device group 8 via the field bus 2 and is connected to one or more display devices 300 via the field bus 4. The control device 100 exchanges data with the connected devices via each bus or network. Generally, "field bus" is also referred to as "field network", but for the sake of simplicity of description, it is collectively referred to as "field bus" in the following description. That is, the "field bus" of the embodiment may include "field network" in addition to "field bus".
[0072] The control device 100 performs control operations, and the control operations execute various operations for controlling manufacturing devices and equipment. In addition to performing control operation processing, the control device 100 also performs input / output processing, which acquires the data measured by the field device group 8 and transmitted to the control device 100 (hereinafter, also referred to as "input data") and various data calculated by the control operation processing.
[0073] The control device 100 also has a time series database 180. As described later, the time series database 180 stores various data acquired through input / output processing in time series. In Figure 2 it, the time series database 180 is denoted as time series DB 180.
[0074] Specifically, the control device 100 performs data generation processing for generating a record including data related to the controlled object specified, and the time series database 180 stores the data generated through the data generation processing in time series.
[0075] The group of records stored in the time series database 180 is also referred to as "time series data". In this specification, "time series data" refers to a series of values obtained by continuously (or discontinuously at a certain interval) observing the temporal change of data (observation values) regarding an arbitrary object.
[0076] In this specification, "observed value" is a concept that collectively refers to values (actual values) that can be used in the control operation of the control device 100. Typically, it may include values obtained from the controlled object and input into the control operation (measurement values obtained from the field, etc.), output values for the controlled object determined based on the obtained input values through the control operation (command values given to the field, etc.), calculated operation values (arbitrary variable values), etc. in the process of the control operation. That is, the "observed value" includes any value that can be stored as data in the control device 100 or can be output as data from the control device 100 to the outside.
[0077] The field buses 2 and 4 are preferably buses or networks that ensure the arrival time of data and perform communication at a constant cycle. As buses or networks that perform such constant-cycle communication, EtherCAT (registered trademark), etc. are known. In addition, EtherNet / IP (registered trademark), DeviceNet (registered trademark), CompoNet (registered trademark), etc. can also be used.
[0078] The field device group 8 includes devices that collect input data from the controlled object or manufacturing devices or production lines related to control (hereinafter, also collectively referred to as "the field"). As such devices that collect input data, input relays, various sensors (such as analog sensors, temperature sensors, vibration sensors, etc.) are envisioned. The field device group 8 also includes devices that exert a certain action on the field based on instructions (hereinafter, also referred to as "output data") generated by the control device 100. As such devices that exert a certain action on the field, output relays, contactors, servo drivers, servo motors, and any other actuators can be envisioned.
[0079] The field device group 8 exchanges data including input data and output data with the control device 100 via the field bus 2. In Figure 2 the shown structural example, the field device group 8 includes a remote I / O (Input / Output) device 12 and a relay group 14, an image sensor 18 and a camera 20, a servo driver 22 and a servo motor 24, an industrial robot 251 and a robot controller 23. As the field device group 8, it is not limited to these, and any device can be used as long as it can collect input data or can perform certain actions based on output data.
[0080] The remote I / O device 12 includes a communication coupler that communicates via the field bus 2 and an input / output unit (hereinafter, also referred to as an "I / O unit") for obtaining input data and outputting output data. Through such an I / O unit, input data and output data are exchanged between the control device 100 and the field.Figure 2 An example of exchanging digital signals as input data and output data via the relay group 14 is shown.
[0081] The I / O unit can also be directly connected to the fieldbus. Figure 2 An example of directly connecting the I / O unit 16 to the fieldbus 2 is shown.
[0082] The image sensor 18 performs image measurement processing such as pattern matching on the image data captured by the camera 20, and outputs the processing result to the control device 100.
[0083] The servo driver 22 drives the servo motor 24 according to the output data (such as position command, speed command, etc.) from the control device 100.
[0084] As described above, data is exchanged between the control device 100 and the field device group 8 via the fieldbus 2, and the exchanged data is updated at extremely short cycles of several hundred μsec to several tens of msec. In addition, the update process of such exchanged data is also called I / O refresh processing.
[0085] In addition, the display device 300 connected to the control device 100 via the fieldbus 4 accepts operations from the user, outputs commands corresponding to the user operations to the control device 100, and graphically displays the calculation results in the control device 100, etc.
[0086] The control device 100 can also be connected to the support device 200. The support device 200 is a device that assists the control device 100 in preparing for controlling the control object. Specifically, the support device 200 provides a development environment for the programs executed in the control device 100 (program creation and editing tools, analyzers, compilers, etc.), a setting environment for setting parameters (configurations) of the control device 100 and various devices connected to the control device 100, a process of outputting the generated user program to the control device 100, a process of online correcting / changing the user program executed on the control device 100, etc.
[0087] The control device 100 also has a gateway process of outputting the data obtained through input / output processing and / or the data stored in the time series database 180 to an external device.
[0088] As the external device, Figure 2Among them, as a typical example, a Manufacturing Execution System (MES) 400 and an IoT (Internet of Things) service 450 connected to the control device 100 via the upper network 6 are illustrated. The control device 100 can provide information from manufacturing devices and equipment to be controlled to these external systems and external services.
[0089] The manufacturing execution system 400 acquires information from manufacturing devices and equipment to be controlled, monitors and manages the overall production, and can also process order information, quality information, shipping information, etc. A database for storing information can also be configured inside the manufacturing execution system 400 or in parallel with the manufacturing execution system 400. The control device 100 can acquire manufacturing data indicating the manufacturing status, etc. in the manufacturing devices and equipment to be controlled from the manufacturing execution system 400.
[0090] The IoT service 450 is envisioned as a type of cloud service composed of one or more computers connected to the upper network 6 or connected to the Internet connected to the upper network 6. The system constituting the IoT service 450 refers to the following system: performing communication processing, processing any information sent from the control device 100 by one or more processors (for example, CPU (Central Processing Unit), MPU (Micro-Processing Unit), GPU (Graphics Processing Unit), etc.), and performing a prescribed output.
[0091] As the IoT service 450, a system that acquires information from manufacturing devices and equipment to be controlled and performs macroscopic or microscopic analysis, etc. is envisioned. For example, data mining that extracts certain characteristic trends contained in the information from the information from manufacturing devices and equipment to be controlled, and machine learning tools for machine learning based on information from devices and machinery to be controlled, etc. can be envisioned.
[0092] The control device 100 may sometimes be connected to other control devices 100 in a communicable manner.
[0093] <C. Hardware Structure Example of Control Device>
[0094] An example of the hardware structure of the control device 100 in the embodiment will be described.
[0095] Figure 3 It is a block diagram showing an example of the hardware structure of the control device 100 in the embodiment. Refer to Figure 3, the control device 100 includes an arithmetic processing unit and one or more I / O units 124-1, 124-2,....
[0096] The control device 100 includes a processor 102, a chipset 104, a main storage device 106, a secondary storage device 108 equivalent to an internal memory, an upper network controller 110, a USB (Universal Serial Bus) controller 112, an external memory interface 114, a local bus controller 122, field bus controllers 118, 120, a counter 126, and an RTC (Real Time Clock) 128.
[0097] The processor 102 is composed of a CPU, an MPU, a GPU, etc., reads out various programs stored in the secondary storage device 108, expands and executes them in the main storage device 106, thereby realizing control corresponding to the control object and various processes as described later. The secondary storage device 108 is composed of a non-volatile storage device such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive), etc. The main storage device 106 is composed of a volatile storage device such as a DRAM (Dynamic Random Access Memory) or an SRAM (Static Random Access Memory).
[0098] The chipset 104 realizes the processing of the entire control device 100 by controlling the processor 102 and each device.
[0099] In the secondary storage device 108, in addition to the system program for realizing the basic operation, a user program created according to the manufacturing device or equipment as the control object is also stored.
[0100] The upper network controller 110 exchanges data with the manufacturing execution system 400 or the IoT service 450 (refer to Figure 2 ) etc. via the upper network 6. The upper network controller 110 is typically implemented using a dedicated circuit such as an ASIC (Application Specific Integrated Circuit) or an FPGA (Field-Programmable Gate Array).
[0101] The USB controller 112 controls data exchange with the support device 200 via a USB (Universal Serial Bus) connection. The USB controller 112 is typically implemented using dedicated circuits such as ASICs and FPGAs.
[0102] The external memory interface 114 is configured to be able to load and unload the external memory 116, write data to the external memory 116, and read various data (user programs, trace data, etc.) from the external memory 116. The external memory 116 is, for example, a volatile storage device composed of a flash memory such as an SD card.
[0103] The counter 126 serves as a time reference for managing the execution timing of various processes in the control device 100. The counter 126 typically increments or decrements the counter value at each specified cycle. As the counter 126, a high-precision event timer (HPET: High Precision Event Timer), which is a hardware timer configured on the system bus of the drive processor 102, etc., can be used for installation, or a dedicated circuit such as an ASIC or FPGA can also be used for installation.
[0104] The RTC 128 is a type of counter that performs a timing operation and provides the current time to the processor 102, etc.
[0105] The local bus controller 122 is an interface for exchanging data with the I / O units 124-1, 124-2,... mounted on the control device 100. The local bus controller 122 is typically implemented using dedicated circuits such as ASICs or FPGAs, but can also be implemented by software installation. In the case of software installation, the local bus controller 122 is mainly composed of a processor, a main storage device, a memory, etc. The processor reads a system program (firmware), etc. stored in the memory, expands and executes it in the main storage device, thereby implementing the necessary processing.
[0106] The local bus controller 122 has a counter 123, and the counter 123 is used as a time reference for managing timing with other devices connected via the local bus 112, namely the I / O units 124-1, 124-2,.... Similarly, the I / O units 124-1, 124-2,... also each have a counter 125, and the counter 125 is used as a time reference for managing timing with the local bus controller 122 and other I / O units. For the counter 123 and the counter 125, the same structure as the above-mentioned counter 126 can be adopted.
[0107] The fieldbus controller 118 controls data exchange with other devices via the fieldbus 2. The fieldbus controller 118 is typically implemented using dedicated circuits such as ASICs and FPGAs, but can also be implemented by software installation. In the case of software installation, the fieldbus controller 118 mainly consists of a processor, a main storage device, a memory, etc. The processor reads system programs (firmware) etc. stored in the memory, expands and executes them in the main storage device, thereby implementing necessary processing. The fieldbus controller 118 has a counter 119, and the counter 119 is used as a time reference for managing timing with other devices.
[0108] Similarly, the fieldbus controller 120 exchanges data with other devices via the fieldbus 4. The fieldbus controller 120 is typically implemented using dedicated circuits such as ASICs and FPGAs, but can also be implemented by software installation. In the case of software installation, the fieldbus controller 120 mainly consists of a processor, a main storage device, a memory, etc. The processor reads system programs (firmware) etc. stored in the memory, expands and executes them in the main storage device, thereby implementing necessary processing. The fieldbus controller 120 has a counter 121, and the counter 121 is used as a time reference for managing timing with other devices.
[0109] In addition, each device also has a counter that is used as a time reference for managing timing with the fieldbus controller 118 or the fieldbus controller 120.
[0110] Regarding the counter 119, the counter 121, and the counters of each device, the same structure as the above-mentioned counter 126 can be adopted.
[0111] The fieldbus controllers 118 and 120 operate as communication masters for performing constant-cycle communication via the fieldbus, successively monitoring the difference between the counter values indicated by the counters of each device connected to the fieldbus and the counter values indicated by the counters 119 and 121, and outputting a synchronization signal for instructing correction to the device with a deviation in the counter value as needed. In this way, the fieldbus controllers 118 and 120 perform synchronization management processing, and the synchronization management processing provides an instruction for making the counter value indicated by the counter of the device consistent with the counter values indicated by the counters 119 and 121 to the device.
[0112] The secondary storage device 108 stores a plurality of programs including the system program 149 and the user program. The system program 149 includes an OS (Operating System) and an interpreter program 151 for implementing an interpreter, etc.
[0113] The user program includes a control program 152, a system service program 195 that implements system services, a variable management program 160, a scheduler program 170 that implements a scheduler 25 when executed, an input program 172, and an output program 174. The scheduler program 170 includes a switching program 171 that implements a switching unit 26 when executed.
[0114] The control program 152 includes an IEC program 1541 as an example of the "first program", a control application program 1542 as an example of the "second program", a database writing program 156, and a margin monitoring program 1544. When the database writing program 156 and the margin monitoring program 1544 are executed, processing associated with a later-described NBQ (Non-Blocking Queue) 158 is implemented. The NBQ 158 is provided in the control device 100 in association with database processing.
[0115] The system service program 195 includes a database program 190 as an example of the "third program", an upper-layer connection program 192, and a gateway program 194. The database program 190 includes a database reading program 191 that reads data from the NBQ 158 and saves it to the time-series database 180 when executed.
[0116] The time-series database 180 included in the control device 100 of the embodiment can also be implemented using a storage area provided by the secondary storage device 108 and / or the external memory 116. In the following description, the secondary storage device 108 and the external memory 116 may sometimes be simply collectively referred to as "memory". In addition, in comparison with the "memory", the volatile main storage device 106 may sometimes be referred to as "memory".
[0117] In addition, the time-series database 180 in the present embodiment includes, in addition to the storage area for storing database files, processing based on the processor 102 or the like for implementing various operations such as generation, writing, and reading of database files, and buffer areas or work areas for implementing various operations. The storage area included in the time-series database 180 can be set in the main storage device 106 or the secondary storage device 108.
[0118] In Figure 3 it shows a structural example of providing required processing by executing a program by the processor 102, but a dedicated hardware circuit (such as an ASIC or an FPGA, etc.) can also be used to install a part or all of these provided processing. Alternatively, hardware following a general architecture (such as an industrial personal computer based on a general personal computer) can also be used to implement the main part of the control device 100. In this case, virtualization technology can also be used to execute multiple OSs with different uses in parallel, and execute required applications on each OS.
[0119] In the control system 1 shown above Figure 2 and Figure 3 the control device 100, the support device 200, and the display device 300 are each separately configured, but a structure in which all or part of these processes are integrated into a single device may also be adopted.
[0120] <D. Software Structure Example of Control Device>
[0121] Next, a software structure example of the control device 100 of the embodiment will be described.
[0122] Figure 4 is a block diagram showing a software structure example of the control device 100 of the present embodiment. Referring to Figure 4 , the control device 100 includes a PLC engine 150, a time series database 180, an upper layer connection program 192, and a gateway program 194.
[0123] Typically, the PLC engine 150 provides an execution environment for various programs by reading the system program stored in the secondary storage device 108 based on the OS through the processor 102 of the control device 100 and expanding and executing it in the main storage device 106, and various programs can be executed in this execution environment.
[0124] More specifically, the PLC engine 150 is configured to be able to selectively execute a control program 152, a variable management program 160, a scheduler program 170, an input program 172, and an output program 174. An NBQ 158 is implemented in the PLC engine 150.
[0125] The NBQ 158 is implemented, for example, using a shared memory area prepared in the memory (volatile main storage device 106) that shares access from multiple tasks or processes. In addition to the shared memory area on the main storage device 106, the NBQ 158 is also implemented through buffer management processing provided by the processor 102 executing the system program. The buffer management processing includes the following processing: defining a buffer pool composed of a plurality of data areas (shared buffers described later) divided by a specified size in the shared memory area, and managing the states (idle, data saving, reservation, etc.) of each shared buffer. The system program for implementing the buffer management processing includes processor commands such as a CAS (Compare And Swap) command for implementing processing such as writing data to an empty buffer.
[0126] In addition, the buffer management process for implementing the NBQ 158 has an interface for accepting data writes from the control program 152 and an interface for accepting dequeue from the database manager 182. Through these respective interfaces, the NBQ 158 can be utilized separately in the logical data transfer path from the database write program 156 to the time series database 180.
[0127] Regarding the variable management program 160, the scheduler program 170, the input program 172, and the output program 174, they can also be installed as part of the system program. In this case, each process provided by these programs can also be provided by a single system program.
[0128] The control program 152 includes the IEC program 1541, the control application program 1542, the database write program 156, and the margin monitoring program 1544. The margin monitoring program 1544 monitors the memory margin indicating the size of the free area of the NBQ 158 and outputs the monitoring result. Since the data stored in the NBQ 158 is read out and stored in the time series database 180, the storage area storing the read data constitutes a free area before data is written later.
[0129] The database write program 156 corresponds to the code that provides at least a part of the data generation process of the control device 100. For example, it is called at each predetermined cycle (e.g., each control cycle) by a command described in the IEC program 1541 to generate data for constituting the record to be saved in the time series database 180. More specifically, the NBQ 158 is configured in the data transfer path from the database write program 156 to the time series database 180, and the database write program 156 does not directly write the specified data to the time series database 180, but writes it to the NBQ 158.
[0130] The NBQ 158 is a buffer for continuing the process of the database write program 156 without waiting for the completion of data writing to the time series database 180. In the NBQ 158, the data from the database write program 156 is stored in the form of a queue. The NBQ 158 sequentially stores the data generated by the database write program 156. The data (queue) stored in the NBQ 158 is sequentially read out and stored in the time series database 180.
[0131] In addition, the serialization communication program can also be combined with the database writing program 156. The serialization communication program serializes the data written from the database writing program 156 to the time series database 180. More specifically, the serialization communication program is executed by the PLC engine 150, and performs a process (serialization) of converting time series data into a saveable byte string. Before storing the object data in the time series database 180, the object data is converted into a specified byte string through the serialization process.
[0132] At least a part of the time series database 180 is constituted by using a memory (secondary storage device 108 or external memory 116). In addition to the database file 186 that stores the data from the database writing program 156 in time series, the time series database 180 also includes a database manager 182 and a write buffer 184.
[0133] The database manager 182 is typically implemented by the processor 102 of the control device 100 executing the database program 190. The database manager 182 is responsible for appending records to the database file 186 and retrieving and extracting the records constituting the database file 186 corresponding to requests from the outside. When the database read program 191 is called and executed by the database program 190, the read processing unit 183 is implemented (refer to Figure 5 ). The read processing unit 183 sequentially reads the data stored in the NBQ 158 and appends it to the database file 186.
[0134] The write buffer 184 is implemented, for example, by using a storage area prepared on the main storage device 106 or a storage area prepared on the cache memory built into the memory.
[0135] The database writing program 156 generates records of time series data based on the data read from the NBQ 158 by the read processing unit 183, and sequentially stores the generated records of time series data in the database file 186. At least a part of the input data, output data, arithmetic data calculated in the control operation of the control program 152, manufacturing data, and event data is stored in the database file 186 in time series.
[0136] The variable management program 160 manages values that can be used by the PLC engine 150, such as input data and output data, in the form of variables. More specifically, the variable management program 160 manages system variables 162 representing the state of the control device 100, device variables 164 representing the values held by various devices connected to the control device 100 via the local bus or field bus, and user variables 166 representing the values held by the IEC program 1541 executed by the control device 100.
[0137] The scheduler program 171 that switches the program 171 manages resource allocation, execution timing, etc. for processes, tasks, etc. equivalent to the execution units of the programs executed by the control device 100.
[0138] The input program 172 performs processing to obtain input data from various devices connected to the control device 100 via a local bus or a field bus.
[0139] The output program 174 outputs the command value (output data) calculated by the IEC program 1541 and the control application program 1542 executed in the control device 100 to the target device connected via a local bus or a field bus.
[0140] In addition, it may also have a statistical recording program executed by the PLC engine 150 that writes to the time series database 180 after performing statistical processing on the input data, output data, arithmetic data, manufacturing data, event data, etc. managed by the control device 100. As statistical processing, for example, methods such as Piecewise Aggregate Approximation (PAA) and Symbolic Aggregate approximation (SAX) of discrete strings can be used. PAA can find patterns in time series data and make compression easier through the discovered patterns. Or, SAX can make compression and pattern discovery easier by converting time series data into strings.
[0141] The upper-level connection program 192 of the control device 100 obtains manufacturing data from the manufacturing execution system 400. The variable management program 160 manages these obtained input data and manufacturing data as variables.
[0142] The IEC program 1541 executes a pre-specified control operation while referring to the system variables 162, device variables 164, and user variables 166 managed by the variable management program 160, and outputs the execution result (output data) to the variable management program 160.
[0143] The database write program 156 writes the specified observed values of the variables managed by the variable management program 160 to the NBQ 158. The database manager 182 of the time series database 180 sequentially reads the data stored in the NBQ 158 in the form of a queue, and sequentially appends the records composed of the read data to the database file 186.
[0144] The upper connection program 192 outputs, as time-series data, the values of the specified variables among the variables managed by the variable management program 160 and / or the specified records among the records of the database file 186 that constitutes the time-series database 180 to the manufacturing execution system 400.
[0145] In the case where the manufacturing execution system 400 has a database or a database is configured separately from the manufacturing execution system 400, the manufacturing execution system 400 may also set a database connection program instead of the upper connection program 192, or set a database connection program as a part of the upper connection program 192. Such a database connection program may, for example, send a query such as SQL to a relational database and perform the process of receiving a response.
[0146] The gateway program 194 outputs, as time-series data, the values of the specified variables among the variables managed by the variable management program 160 and / or the specified records among the records of the database file 186 that constitutes the time-series database 180 to the IoT service 450. Based on the time-series data from the control device 100, the IoT service 450 performs behavior analysis and performs predictive maintenance of devices, apparatuses, etc. that are control objects.
[0147] <E. Example of the functional structure of the control device>
[0148] Figure 5 is a schematic diagram showing an example of the functional structure of the control device 100 of the embodiment. Refer to Figure 5 , the control device 100 includes a control application processing unit 30, a program processing unit 40, an I / O processing unit 50, a scheduler 25, a switching unit 26, a field network interface 55, an upper network interface 51, and a system service processing unit 185. Figure 5 The control device 100 associated with these components also includes an NBQ 158 and a time-series database 180.
[0149] The scheduler 25 implements the control application processing unit 30, the program processing unit 40, the I / O processing unit 50, and the system service processing unit 185 in the order based on the execution priorities of the programs corresponding to these respective parts. The implementation order based on the priorities will be described later.
[0150] The control application processing unit 30 executes the control application program 1542 at a cycle synchronized with the control cycle T according to the scheduling of the scheduler 25. For example, the control application program 1542 is executed every 2 control cycles T, that is, every 2T. In addition, the execution cycle of the control application program 1542 is not limited to 2T.
[0151] The control application processing unit 30 includes a program analysis unit 34 and a buffer 32 that stores intermediate code 33. The program analysis unit 34 analyzes the command codes described in the control application program 1542 by using an interpreter 31. The control application program 1542 generates intermediate code 33 when executed and stores it in the buffer 32. A part of the memory of the control device 100 constitutes the buffer 32. If the program analysis unit 34 detects that a command code of a predetermined type has been executed during the execution of the control application program 1542, the detection result is saved as a flag F in the shared memory 159. A part of the memory of the control device 100 constitutes the shared memory 159.
[0152] The interpreter 31 of the control application processing unit 30 interprets at least a part of the control application program 1542 and generates intermediate code 33. That is, the interpreter 31 successively interprets and executes the control application program 1542 to generate intermediate code 33, and stores the generated intermediate code 33 in the buffer 32.
[0153] The program processing unit 40 executes the IEC program 1541 in each control cycle T according to the scheduling of the scheduler 25.
[0154] The program processing unit 40 executes (scans) the IEC program 1541 every predetermined control cycle T to calculate one or more instruction values. That is, the program processing unit 40 calculates instruction values in each control cycle T according to the IEC program 1541.
[0155] The program processing unit 40 includes: a logic processing unit 41 that processes logic commands such as sequence programs included in the IEC program 1541; a motion processing unit 42 that processes motion commands included in the IEC program 1541; a database writing unit 43; and a margin monitoring unit 44.
[0156] The motion processing unit 42 provides the following function: calculates instruction values in each control cycle T according to the motion commands included in the IEC program 1541. Specifically, the motion processing unit 42 calculates instruction values in each control cycle T according to the intermediate code 33 generated in advance by the interpreter 31. That is, the motion processing unit 42 provides the following function: calculates instruction values in each control cycle T according to the intermediate code 33 stored in the buffer 32 in advance. Generally speaking, since the commands (codes) described in the control application program 1542 are successively executed, it is impossible to guarantee the calculation cycle of the instruction values. However, by using the intermediate code 33, the motion processing unit 42 can calculate instruction values in each control cycle T. The commands described in the intermediate code 33 can also use coordinate systems corresponding to each control application.
[0157] In this way, the interpreter 31 successively queues up the generated intermediate code 33 in the buffer 32, and the motion processing unit 42 reads out the intermediate code 33 in the order queued in the buffer 32.
[0158] In the embodiment, the "intermediate code" is a concept including commands for calculating instruction values in each control cycle T. The "intermediate code" includes one or more commands or one or more functions. In this embodiment, the intermediate code 33 may be any code as long as the motion processing unit 42 can calculate the instruction value in each control cycle T.
[0159] The database writing unit 43 executes the database writing program 156 called during the execution of the IEC program 1541. The margin monitoring unit 44 executes the margin monitoring program 1544 called during the execution of the IEC program 1541. The database writing unit 43 that executes the database writing program 156 in each control cycle T is equivalent to the "data generation unit", which generates data for constituting records to be saved in the time series database 180 in each control cycle T. Specifically, the database writing unit 43 saves the generated data in the free area of the NBQ 158.
[0160] In addition, the margin monitoring unit 44 monitors the memory margin equivalent to the size of the free area of the NBQ 158, compares the memory margin with a threshold value, and sets the value indicating the comparison result as the variable MR of the shared memory 159.
[0161] The system service processing unit 185 executes the database program 190 during the idle time of the processor 102 in the control cycle T according to the scheduling of the scheduler 25. The system service processing unit 185 includes a database manager 182, and the database manager 182 has a read processing unit 183. The read processing unit 183 is implemented by calling and executing the database read program 191 during the execution of the database program 190.
[0162] The read processing unit 183 implements the process of reading data from the NBQ 158 and saving it to the time series database 180.
[0163] The upper network interface 51 mediates data exchange between the program processing unit 40 and the control application processing unit 30 and the devices connected via the upper network 6.
[0164] The field network interface 55 is an interface between the I / O processing unit 50 and the field.
[0165] The I / O processing unit 50 executes the variable management program 160. Before the program processing unit 40 executes the IEC program 1541, the I / O processing unit 50 performs I / O refresh processing for updating input data and output data. In the I / O refresh processing, the values input from the field via the field network interface 55 are set as the system variable 162, the device variable 164, and the user variable 166. The logic processing unit 41 and the motion processing unit 42 perform operations using the input data set for the system variable 162, the device variable 164, and the user variable 166. In the I / O refresh processing of the next control cycle T, one or more command values (basically logical values) calculated by the logic processing unit 41 and one or more command values (basically numerical values) calculated by the motion processing unit 42 in the previous control cycle T are set as the system variable 162, the device variable 164, and the user variable 166, and the set command values are output to the field via the field network interface 55.
[0166] (e1. Avoidance of memory exhaustion)
[0167] In the embodiment, for example, the NBQ 158 is prepared in the memory (volatile main storage device 106), so the memory capacity (size) of the NBQ 158 is limited. Therefore, when the system service processing unit 185 cannot be given the right to use the resources including the processor 102 due to the lack of idle time of the processor 102, that is, when the system service processing unit 185 cannot execute the database program 190, the free area of the NBQ 158, that is, the memory margin is insufficient. That is, data is sequentially written to the NBQ 158 by the database writing unit 43. On the other hand, since data is not read from the NBQ 158 by the reading processing unit 183, the free area for writing data to the NBQ 158 is insufficient. Hereinafter, the insufficiency of the free area of the NBQ 158 will be referred to as "memory exhaustion".
[0168] In the embodiment, the control device 100 is configured to ensure the idle time of the processor 102 that enables the system service processing unit 185 to execute the database program 190. Thereby, memory exhaustion can be addressed.
[0169] More specifically, when the switching unit 26 of the scheduler 25 detects that a command code of a predetermined type has been executed in the control application program 1542 based on the value of the flag F, the switching unit 26 interrupts the execution of the control application program 1542 by the processor 102, ensures the idle time of the processor 102, and causes the processor 102 to start executing the database program 190 (more specifically, the database reading program 191) during the ensured idle time.
[0170] In addition, when the switching unit 26 of the scheduler 25 detects a possibility of memory exhaustion based on the value of the variable MR, it interrupts the execution of the control application program 1542 by the processor 102, ensures the idle time of the processor 102, and causes the processor 102 to start executing the database program 190 (more specifically, the database read program 191) during the ensured idle time.
[0171] In this way, the switching unit 26 is configured to switch the program executed by the processor 102 from the control application program 1542 to the database program 190 based on the value of the flag F or the variable MR during the execution of the control application program 1542 in the control cycle T. Thereby, in the control cycle T, the idle time for executing the database read program 191 can be ensured, and the memory exhaustion of the NBQ 158 can be avoided.
[0172] <F. Data writing process to the time series database>
[0173] Next, the data writing process to the time series database 180 of the embodiment will be described.
[0174] Figure 6 is a schematic diagram showing the main part of the process related to the time series database 180 in the control device 100 of the present embodiment. Refer to Figure 6 , the control device 100 exchanges input data and output data with the field device group 8 via a local bus or a field bus or the like.
[0175] In the control device 100, the control program 152 for controlling various operations of the manufacturing device and equipment is repeatedly executed in a control cycle T. The control program 152 includes a command for starting the database writing program 156 when the data writing condition is satisfied.
[0176] The database writing program 156 issues a command for writing the specified data (one or more variable values) to the time series database 180. For example, in Figure 5 shows a "put" command. In addition, the data collection and processing 153 for collecting and processing the data written from the database writing program 156 to the time series database 180 may be executed within the control program 152 or in parallel with the control program 152.
[0177] In the time series database 180, the data (time series data) from the database writing program 156 is stored in time series. The time series data stored in the time series database 180 may also be sent to an upper-level system for analysis processing or the like.
[0178] In Figure 6In the structure shown, connection processing 402 configured in a host system such as manufacturing execution system 400 and IoT service 450 is utilized to extract required time series data from time series database 180. Then, in the host system, analysis processing 404 such as time series analysis and data mining is performed on the extracted time series data.
[0179] Alternatively, the time series data stored in time series database 180 can also be utilized in anomaly detection processing 198. Anomaly detection processing 198 is implemented by the PLC engine 150 executing necessary programs. Anomaly detection processing 198 makes a judgment that some anomaly has occurred or a sign of an anomaly has been detected in the controlled object by comparing the time series data from time series database 180 with previously obtained teacher data, etc.
[0180] In control device 100, control program 152 is cyclically executed at a control cycle T (e.g., several hundred microseconds to several milliseconds). Sometimes, data writing to time series database 180 is also executed synchronously with the cyclic execution of control program 152. On the other hand, time series database 180 is basically constituted by using a memory (secondary storage device 108 or external memory 116 (refer to Figure 3 ). Such a memory generally has a large storage capacity, but compared with the main storage device, the access speed (especially the writing speed) is low, and the fluctuation of the access speed is large (e.g., 100 milliseconds to 1000 milliseconds).
[0181] Therefore, control device 100 of the present embodiment also provides a structure that can achieve data writing synchronized with control cycle T for time series database 180 that utilizes a memory with a not-high access speed.
[0182] Specifically, during the process of writing data from control program 152 (database writing program 156) to time series database 180, NBQ 158 configured as a lock-free queue is provided (refer to Figure 4 ). By adopting such NBQ 158, even when the cycle of the database writing program 156 issuing data writing commands is short compared with the access speed of the memory, the execution of database writing program 156 can be prevented from being interrupted due to data writing waiting. That is, data writing to time series database 180 synchronized with control cycle T can be achieved.
[0183] By saving such time-series data synchronized with the control period T and using the commands included in the control program 152, it is possible to save input data (e.g., measurement values of analog sensors, etc.), output data (e.g., position commands, speed commands, etc.), arithmetic data (e.g., filter parameters for anomaly detection processing, feature quantities, etc.), and manufacturing data (e.g., manufacturing status, product numbers, etc.) in a non-volatile memory for each control period T.
[0184] <G. Data Structure>
[0185] An example of the data structure of the records stored in the time-series database 180 of the embodiment will be described.
[0186] The control device 100 may also generate records including observed values associated with the control object, the time corresponding to the observed values represented by time management processing, and / or the counter values corresponding to the observed values represented by the internal counter. The observed values are values that can be utilized by the processor 102.
[0187] Figure 7 and Figure 8 is a diagram showing an example of the data structure of the records stored in the time-series database 180 in the control device 100 of the embodiment. Refer to Figure 7 , the record includes a time field 1821, a counter value field 1822, an index field 1823, and an observed value field 1824.
[0188] The time field 1821 and the counter value field 1822 store information indicating the timing of obtaining the corresponding data (one or more observed values).
[0189] More specifically, the time indicating the timing of obtaining the corresponding data (e.g., the time managed by the RTC 128) is stored in the time field 1821.
[0190] In the counter value field 1822, at least any one of the counter value of the counter managed by the control device 100 when obtaining the corresponding data or the counter value of the counter used for managing the timing in the fieldbus / local bus is stored. By storing the time in the time field 1821 and the counter value in the counter value field 1822, it is possible to assist the post hoc analysis of the corresponding data (observed values).
[0191] The index field 1823 stores a value (index value) that increases / decreases by a specified value according to the write operation of writing a record to the database, etc. Typically, a value that increases by 1 each time a record is saved is used. For example, when a command to start the database write program 156 is described in the IEC program 1541, the index value may be incremented along with the execution of the start command.
[0192] Save the specified data (one or more observations) in the observation value field 1824. As the data saved in the observation value field 1824, it includes input data, output data, operation data, manufacturing data, event data, etc.
[0193] Specifically, as the input data, it includes digital signals (status values), analog signals (various measurement signals), etc. obtained from various sensors. In addition to the observation values, information for determining the sensor that output the observation value can also be saved together.
[0194] As the output data, command values, etc. output to a motion driver or an opening regulator can also be saved. In addition to the command values, information about the actuator for determining the output destination of the command value can also be saved together.
[0195] As the operation data, variable values, transient values, etc. calculated by the execution of the IEC program 1541 can also be saved. In addition to the variable values or transient values, information about the IEC program 1541 or task, etc. for determining the one that output the operation data can also be saved together.
[0196] As the manufacturing data, an execution command value group received from the manufacturing execution system 400 (for example, product number, lot number, recipe number, etc. of a workpiece) can also be saved. As the execution command value group, information for uniquely determining the identification number of the workpiece, determining the type of the workpiece, etc. can also be included.
[0197] As the event data, information in the case where the observation value exceeds or is lower than a pre-determined threshold, information in the case where a pre-determined exception flag, etc. is turned on can also be saved. Information about the variable, etc. that generated the event data can also be included.
[0198] Furthermore, regarding the event data, it may not be time-series data generated or saved repeatedly at a pre-determined cycle, but generated when a pre-determined condition is satisfied. In this case, the counter value synchronized with the counter and / or the time can also be associated.
[0199] Generate and output the above records in each control cycle T or a specified event. For example, in Figure 8 the example shown, an example of generating and outputting records every 500 μsec is shown. In this way, by generating and outputting records containing the specified observation values in time series, various analyses can be performed based on these time series data.
[0200] It can also be structured in the form of Key-Value (key-value pair) Figure 7 or Figure 8The records shown. In this case, for example, the time field 1821 and the count value field 1822 can also be set as the Key, and the index field 1823 and the observation value field 1824 can be set as the Value. That is, each record of the time series data includes the time corresponding to the observation value and the count value as the Key, and includes the observation value as the corresponding Value.
[0201] In the above description, the process of the control device 100 saving records in the time series database 180 within the device is taken as a typical example for illustration, but it is not limited to this. Records can also be sent to a host system or the like. In this case, records as shown can also be generated in each control cycle T and sent to the target external device through the system service processing unit 185. Figure 7 or Figure 8 shown, and sent to the target external device through the system service processing unit 185.
[0202] Furthermore, the database manager 182 and the database file 186 that make up the time series database 180 of the control device 100 may not be configured within the same control device 100. That is, in the control device 100, the database manager 182 of the system service processing unit 185 can also read data from the NBQ 158 and write records to the database file 186 located outside the control device 100. As the outside of the control device 100, the memory of other control devices 100 or the memory on the network (network memory) etc. are envisioned.
[0203] The NBQ 158 configured in the logical data transmission path from the database write program 156 to the time series database 180 in the control device 100 of the present embodiment has the effect of compensating for the delay in the write speed to the memory, but can also obtain the effect of compensating for the delay in the write speed to the network memory.
[0204] By adopting such a structure capable of writing records on the network memory, compared with the structure of saving records as the database file 186 within the control device 100, more data can be stored. Furthermore, it can also be a structure in which multiple control devices 100 respectively write records to a single network memory, and the memories can be merged. Thus, there are also advantages in terms of data management and security.
[0205] <H. Period Control and Switching>
[0206] Figures 9 - 12 is a schematic diagram showing an example of the period control in the control device 100 of the embodiment. Refer to Figures 9 - 12 , and explain the period control and the ensuring of the idle time for the system service processing unit 185.
[0207] Figure 9An example of sequentially executing the I / O processing unit 50, the logic processing unit 41 having a database writing unit 43 (abbreviated as the DB writing unit 43 in the figure), the motion processing unit 42, the control application processing unit 30, and the system service processing unit 185 is shown. Each of these processing units is processed as a "task" in the control device 100. A task is a basic unit that is a control object for allocating resources (computing resources) of the processor 102 of the control device 100, and one or more programs to be executed are registered or set in each task. That is, when resources are allocated to an arbitrary task and it becomes a state where the task can be executed, the execution of one or more programs registered or set in the task is started or restarted. In the embodiment, tasks include, for example, a main task, a secondary task, and a system service task.
[0208] The main task includes programs with the highest execution priority (hereinafter, also simply referred to as "priority") executed by the processor 102 of the control device 100. The main task includes the I / O processing unit 50, the logic processing unit 41, and the motion processing unit 42. It is ensured that the main task is executed in each control cycle T.
[0209] The secondary task is a task with a lower priority than the main task but with an ensured execution cycle. For example, it includes the control application processing unit 30. The control application processing unit 30 of the secondary task is executed, for example, at a cycle that is an integer multiple of the control cycle T. In the embodiment, the control application processing unit 30 is executed, for example, at a cycle of 2T, that is, every two times the control cycle T.
[0210] The interpreter 31 of the control application processing unit 30 with low priority execution pauses the interpretation of the control application program 1542 before the pre-determined control application synchronization cycle (cycle 2T) arrives. The timing of pausing includes the timing of ending the interpretation of all the codes of the control application program 1542.
[0211] At this timing of pausing, data synchronization 230 is performed between the program processing unit 40 and the control application processing unit 30, whereby both parties share data with matching properties. In this way, the interpreter 31 updates the data shared with the program processing unit 40 every synchronization cycle (that is, the control application synchronization cycle) that is an integer multiple of the control cycle T, namely cycle 2T. Along with the update of the shared data, it is also possible to update the input data and output data obtained from the field side (data synchronization).
[0212] The priority of the system service task is lower than that of the secondary task, and it is executed during the idle time of the processor 102 in the control cycle T. The system service task includes the system service processing unit 185. Thus, the control device 100 can execute the system service task within the range of ensuring the execution cycles of the main task and the secondary task.
[0213] The scheduler 25 manages the execution timing of these tasks (each included program) according to the priority, thereby achieving the periodic control of the tasks. More specifically, the scheduler 25 allocates resources to the programs of each task at appropriate timings and periods, so that the processor 102 executes the programs of each task according to the priority.
[0214] In Figure 9 the case of, in each control cycle T, the database writing unit 43 called by the logical processing unit 41 is executed to perform data writing to the NBQ 158, and in each cycle 2T, the reading unit 183 of the system service processing unit 185 reads data from the NBQ 158. As a result, it is possible to avoid memory exhaustion.
[0215] On the other hand, according to the content of the control application program 1542, the execution time of the control application processing unit 30 becomes longer. If the execution time of the control application processing unit 30 becomes longer, there is a case where the timing of the above-mentioned pause coincides with the end of the cycle 2T. In this case, as Figure 10 shown, a phenomenon of no idle time 231 occurs within the control cycle T. In Figure 10 , since the phenomenon of no idle time 231 occurred in the previous cycle 2T, therefore, before the idle time in the subsequent cycle 2T, although the reading unit 183 does not perform data reading from the NBQ 158, the database writing unit 43 saves data to the NBQ 158. Therefore, the NBQ 158 stores the data of N control cycles T (N≥4) until the idle time in the subsequent cycle 2T, so there is a possibility of memory exhaustion before the idle time in the subsequent cycle 2T arrives.
[0216] (h1. An example of task switching)
[0217] In the embodiment, in order to ensure the execution time of the system service processing unit 185 in the control cycle T, that is, in order to be able to avoid memory exhaustion, the control device 100 switches tasks when detecting that a command code of a predetermined type of the control application program 1542 has been executed.
[0218] Specifically, referring to Figure 11, during the execution of the control application processing unit 30, the program analysis unit 34 that is called and executed detects whether the interpreter 31 has executed a command code of a predetermined type in the control application program 1542. If the program analysis unit 34 detects that a command code of a predetermined type has been executed, it sets the flag F to True. When the switching unit 26 of the scheduler 25 detects that the flag F has changed from False to True, it switches the tasks (switching 45). Specifically, the switching unit 26 interrupts the execution of the control application processing unit 30 (interrupt 232) of the processor 102 and starts executing the system service processing unit 185. The process by which the program analysis unit 34 detects the execution of a command code of a predetermined type will be described later.
[0219] According to Figure 11 the task switching shown, the control device 100 ensures an idle time 233 through the interruption 232 of the execution of the control application processing unit 30 in the control cycle T. In the ensured idle time 233, the reading processing unit 183 of the system service processing unit 185 performs data reading from the NBQ 158. Thus, it is possible to avoid memory exhaustion of the NBQ 158.
[0220] (h2. Another example of task switching)
[0221] In the embodiment, in order to be able to avoid memory exhaustion, the control device 100 performs task switching based on the value of the variable MR indicating the memory margin of the NBQ 158 detected by the margin monitoring unit 44, as Figure 12 shown.
[0222] Referring to Figure 12 , the main tasks include the I / O processing unit 50, the logic processing unit 41, and the motion processing unit 42. The logic processing unit 41 includes, in addition to the DB writing unit 43, the margin monitoring unit 44 and the control application processing unit 301. The margin monitoring unit 44 is implemented by executing the margin monitoring program 1544 called during the execution of the IEC program 1541. The control application processing unit 301 is implemented by executing a predetermined command code described in the IEC program 1541. The predetermined command code for implementing the control application processing unit 301 will be described later. In addition, the margin monitoring program 1544 may be configured to include the command code for margin monitoring described in the IEC program 1541.
[0223] The margin monitoring unit 44 detects the memory margin of the NBQ 158 (the unit is, for example, a percentage), compares the detected memory margin with a threshold value, and sets the value based on the comparison result as the variable MR.
[0224] In an embodiment, the threshold includes a warning threshold and a monitoring threshold representing a value larger than the warning threshold. When the above comparison result indicates (memory margin > monitoring threshold), the margin monitoring unit 44 sets "Normal" for the variable MR in a manner indicating that there is sufficient margin in the memory. When the above comparison result indicates (monitoring threshold ≥ memory margin > warning threshold), it sets "Monitoring" for the variable MR in a manner indicating the possibility of memory exhaustion. When the above comparison result indicates (memory margin ≤ warning threshold), it sets "Warning" for the variable MR in a manner indicating memory exhaustion.
[0225] For example, when the variable MR represents "Normal" or "Monitoring" in the control cycle T, the switching unit 26 does not perform the task switching 45. However, when it represents "Warning", it performs the switching 45. Specifically, the switching unit 26 causes the processor 102 to interrupt the execution of the control application processing unit 30 that is being executed in the control cycle T, and performs the switching 45 to start executing the system service processing unit 185. Thus, the control device 100 can execute the system service processing unit 185 during the idle time 233 generated by the interruption 232 in this control cycle T and read data from the NBQ 158. Thereby, the control device 100 can eliminate the memory exhaustion of the NBQ 158.
[0226] Typically, the margin monitoring unit 44 detects the memory margin of the NBQ 158 at the start of the execution of the IEC program 1541 in the control cycle T. Thus, in each control cycle T, the variable MR is set to a value based on the latest memory margin. Therefore, the switching unit 26 can determine whether to perform the switching 45 based on the most recently detected memory margin.
[0227] <I. Specific Example of Task Switching>
[0228] Specific implementation examples are described for the above (h1. An Example of Task Switching) and (h2. Another Example of Task Switching) respectively.
[0229] (i1. A Specific Example of Task Switching)
[0230] Refer to Figures 13 - 16 to describe the specific processing of the above (h1. An Example of Task Switching). Figure 13 is a flowchart schematically showing the processing of the control application processing unit 30 of the embodiment. Figure 14 is a flowchart showing the processing of the program analysis unit 34 of the embodiment. Figure 15 is a table showing the correspondence between the types of command codes and the command codes of the embodiment. Figure 16 is a flowchart schematically showing the processing of the scheduler 25 of the embodiment.
[0231] Refer to Figure 13 and the control application processing unit 30 performs variable synchronization processing (step S1). The variable synchronization processing is included in the processing of the above data synchronization 230. In addition, in step S1, the control application processing unit 30 sets False as the initial value for the flag F.
[0232] When the processing of the control application processing unit 30 starts, the program analysis unit 34 of the interpreter 31 performs program analysis on the control application program 1542 (step S3). The detailed content of the program analysis processing is described in Figure 14 .
[0233] The control application processing unit 30 outputs the execution result of the control application program 1542 (step S5). For example, the control application processing unit 30 stores the intermediate code 33 as the execution result in the buffer 32.
[0234] When the control application processing unit 30 finishes the execution of the control application program 1542, it outputs an end notification (step S7).
[0235] Figure 14 The processing of the program analysis unit 34 in Figure 15 is implemented with reference to the table in Figure 15 . The table in Figure 15 is stored in the memory, for example. Refer to
[0236] In Figure 15 , the conditional wait command codes include wait command codes described using wait conditions and codes for determining whether the wait conditions are satisfied. Specifically, the conditional wait command codes are command codes that instruct not to execute the next line of the program until the wait condition is met, that is, until it is determined that the wait condition is satisfied. Such command codes include, for example, command codes such as IF statements or WHILE statements described using wait conditions, and command codes such as WAIT, TIMER, and SLEEP described using the elapse of a specified time as the wait condition.
[0237] As conditional wait command codes, for example, command codes for specifying the input wait state of a signal for a specified number input, timer processing, and in-position check wait state on the control application program 1542 are included.
[0238] In addition, the action system command codes are command codes that generate the intermediate code 33 when executed, and include, for example, MOVE, MOVEC, MOVES, etc. as command codes related to trajectory generation.
[0239] The intermediate code 33 generated by executing the action system command code can perform the operation of the instruction value over multiple control cycles T. For example, when specifying an instruction value during a period of multiple consecutive control cycles T in the intermediate code 33 output by executing a certain action system command code, the motion processing unit 42 reads the intermediate code 33 from the buffer 32 and periodically operates the instruction value during the period of multiple control cycles T. In addition, for each command code of the action system command code, the number of consecutive control cycles T specified by the instruction value that can be generated from one intermediate code 33 can be made different.
[0240] Therefore, if the generation process of generating the intermediate code 33 from the control application program 1542 of the control application processing unit 30 is executed sufficiently in advance compared to the operation process of the instruction value performed by the motion processing unit 42 of the program processing unit 40, even if the execution of the control application processing unit 30 is interrupted by the task switch 45, the motion processing unit 42 can use the intermediate code 33 in the buffer 32 to calculate the instruction value during the subsequent period of multiple consecutive control cycles T.
[0241] Refer to Figure 14 , the interpreter 31 reads one line of the program from the start line of the control application program 1542 each time (step S31), and the program analysis unit 34 refers to Figure 15 's table to determine the type of the command code of the read program (step S33).
[0242] The program analysis unit 34 analyzes the command code. If it is determined based on the analysis result that it is an action system command code ("action system command" in step S33), the program analysis unit 34 performs the operation according to the command code and calculates the intermediate code 33 as the operation result (step S37).
[0243] The program analysis unit 34 determines whether the operation has ended (step S39). When it is determined that the operation has not ended ("no" in step S39), it transfers to step S31, and the interpreter 31 reads the next line of the program. When it is determined that the operation has ended ("yes" in step S39), it transfers to step S40.
[0244] The program analysis unit 34 analyzes the command code. If it is determined based on the analysis result that it is a conditional wait command code ("conditional wait command" in step S33), the program analysis unit 34 performs the operation according to the command code and determines whether the condition is satisfied (meets the condition) based on the operation result (step S35). If the program analysis unit 34 determines that the condition is met ("yes" in step S35), it transfers to step S31, and the interpreter 31 reads the next line of the program. When the program analysis unit 34 determines that the condition is not met ("no" in step S35), that is, when it determines that the control application processing unit 30 is in a waiting state before meeting the condition, it transfers to step S40.
[0245] In step S40, the program analysis unit 34 sets the flag F to True.
[0246] Refer to Figure 16 , the scheduler 25 determines whether it has received a notification from the program analysis unit 34 that the flag F has changed from False to True (step S41). When the scheduler 25 determines that it has not received the notification ("no" in step S41), it performs the normal scheduling process (step S47). That is, the scheduler 25 causes the processor 102 to execute tasks in order of priority.
[0247] On the other hand, when the scheduler 25 determines that it has received the notification ("yes" in step S41), the switching unit 26 switches tasks. That is, the switching unit 26 causes the processor 102 to interrupt the execution of the control application processing unit 30 and start the execution of the system service processing unit 185 (step S43).
[0248] When performing task switching, the scheduler 25 determines whether the next control cycle T has arrived (step S45). While the scheduler 25 determines that the next control cycle T has not arrived (in step S45, "no"), it repeatedly performs the process of step S45. However, when it determines that the next control cycle T has arrived (in step S45, "yes"), it performs the process of step S47 and determines whether the scheduling process has ended (step S49).
[0249] When the scheduler 25 determines that the task scheduling process has not ended ("no" in step S49), it returns to step S41. However, when it determines that the task scheduling process has ended ("yes" in step S49), it ends a series of processes.
[0250] According to Figure 16 the processing of the scheduler 25, when the flag F changes from False to True, the switching unit 26 causes the processor 102 to interrupt the execution of the control application processing unit 30 and start the execution of the system service processing unit 185, thereby enabling the data reading from NBQ158 to be implemented and avoiding memory exhaustion.
[0251] In addition, since the intermediate code 33 capable of calculating instruction values over multiple control cycles T can be stored in the buffer 32, even if the execution of the control application processing unit 30 is interrupted, this interruption will not affect the calculation of instruction values by the motion processing unit 42.
[0252] (Another specific example of task switching)
[0253] Refer to Figure 17 and Figure 18 to describe the specific processing of the above (h2. Another example of task switching). Figure 17 is a diagram schematically showing a part of the control application program 1542 of the embodiment. Figure 18 is a flowchart schematically showing the processing of the switching unit 26 of the embodiment. Figure 19 is a diagram schematically showing an example of a command code executed by the control application processing unit 301 of the embodiment.
[0254] Figure 19 The command code executed by the control application processing unit 301 shown in includes the command code executed when the execution of the control application processing unit 30 (i.e., the control application program 1542) is interrupted by switching 45 in the IEC program 1541. This command code is a command code for performing processing related to the real-time control of the control object. Typically, it is a code equivalent to the command code of the control application program 1542 and includes a command code for generating intermediate code.
[0255] Refer to Figure 17 , the control application program 1542 includes a command code 1600. The command code 1600 represents a wait command during the period when the condition "Sign(X) = True" is satisfied. This wait command indicates not to analyze and execute the next line of command code in the program. Sign(X) represents the condition that "the variable MR represents 'Warning'". Therefore, during the period when the variable MR represents "Warning", the next command code of the control application program 1542 is in a waiting state where it is not executed. This waiting state includes waiting until the variable MR changes to "Normal" or "Monitoring". Specifically, the waiting state includes waiting until the memory exhaustion of the NBQ 158 is eliminated, that is, waiting until enough free space can be formed by reading data from the NBQ 158 by the read processing unit 183.
[0256] In this way, during the period when the NBQ 158 is in a state of memory exhaustion, the switching unit 26 interrupts the execution of the control application processing unit 30 by the processor 102 and starts executing the system service processing unit 185, thereby being able to eliminate the memory exhaustion. In addition, this command code 1600 corresponds to Figure 15 the type of command code for the wait condition shown.
[0257] When the command code 1600 waiting for a command changes the variable MR from "Warning" to "Normal" or "Monitoring" by reading the data of the system service processing unit 185 from the NBQ 158, the waiting ends. That is, when the variable MR changes from "Warning" to "Normal" or "Monitoring", the condition "Sign(X)=True" of the command code 1600 is no longer satisfied. In the control application program 1542, the command code on the next line of the command code 1600 is read and analyzed and executed.
[0258] Refer to Figure 18 , the margin monitoring unit 44 detects the memory margin (step S61), compares the detected memory margin with the warning threshold and the monitoring threshold (step S63, step S67), and thereby sets a value for the variable MR based on the comparison result.
[0259] When the value of the variable MR indicates "Warning" (yes in step S63), the switching unit 26 performs the warning process (step S65). When the value of the variable MR indicates "Monitoring" (no in step S63, yes in step S67), the switching unit 26 performs the monitoring process (step S69). When the value of the variable MR indicates neither "Warning" nor "Monitoring" (no in step S67), that is, when the variable MR indicates "Normal", the process ends.
[0260] Refer to Figure 19 , an example of the warning process (step S65) and the monitoring process (step S69) will be described. The program of the control application processing unit 301 is described, for example, as a ladder program in the IEC program 1541. In Figure 19 , the FBs (function blocks) 1546 and 1548 correspond to a part of the command codes of the control application program 1542. In the monitoring process (step S69), the switching unit 26 outputs the signal X1 to the program processing unit 40. When the IEC program 1541 executed by the program processing unit 40 is input with the signal X1, the block 1545 is opened and the FB 1546 is executed. In addition, in the warning process (step S65), when the condition block 1547 of the IF statement "the variable MR indicates 'Warning'" is opened, that is, when the condition of the IF statement is satisfied, the FB 1548 is executed.
[0261] Figure 19When FB 1546 is executed, for example, it outputs intermediate code 33 over consecutive N control cycles T. Additionally, when FB 1548 is executed, for example, it outputs intermediate code 33 over consecutive M (where M ≥ N) control cycles T.
[0262] Thus, during a period when the value of the memory margin is less than the monitoring threshold or the warning threshold, even if the execution of the control application processing unit 30 is interrupted in control cycle T to cope with memory exhaustion, the intermediate code 33 for calculating instruction values over multiple control cycles T can be calculated by executing the control application processing unit 301, which is the main task, in this control cycle T. Therefore, it is possible to ensure that the intermediate code required for calculating the instruction values is calculated before the execution of the motion processing unit 42 in the main task of each control cycle T.
[0263] In addition, Figure 19 The program of the control application processing unit 301 shown can also be executed in the main task when switching 45 is implemented according to flag F.
[0264] <J. Application Example>
[0265] Next, an application example of the time series data generated and output by the control device 100 of the embodiment will be described.
[0266] Figure 20 FIG. is an example for explaining the application of the time series data stored in the time series database 180 of the control device 100 of the embodiment.
[0267] In Figure 20 In the example shown, the manufacturing execution system 400 uses the time series data stored in the time series database 180 of the control device 100 to achieve quality traceability and the like. Specifically, based on the manufacturing data included in the time series data stored in the time series database 180, it is determined which workpiece (manufactured product) the time series data corresponds to. By arranging the time series data of each determined workpiece in the order of generation time, the state of each workpiece during manufacturing can be grasped. For example, in Figure 20 an example is shown in which multiple time series data are stored corresponding to the workpiece with "Product Number 001", and multiple time series data are stored corresponding to the workpiece with "Product Number 002".
[0268] In this way, the manufacturing execution system 400 can also generate information related to quality traceability based on the time series data stored in the time series database 180 of the control device 100.
[0269] When generating information related to quality traceability, by associating the information of the time and the counter to process the observed values in the time series data, it is possible to generate more detailed information in terms of time.
[0270] In addition, in Figure 20 the example shown, the IoT service 450 implements so-called big data analysis. The IoT service 450 outputs not only the time series data from the control device 100 that controls the manufacturing device / equipment 11, but also the time series data from other manufacturing devices / equipment 11. The IoT service 450 performs various analyses on the time series data from one or more manufacturing devices / equipment. As an example of such an analysis, a time series analysis 460 is shown.
[0271] One or more processors constituting the system that provides the IoT service 450 execute the time series analysis 460. In the time series analysis 460, one or more processors execute preprocessing 462 for the time series data. In the preprocessing 462, one or more processors execute processing such as extracting feature quantities from the time series data stored in the memory to reduce the dimension, and processing for excluding outliers / deviated values. Further, one or more processors execute analysis processing 464 on the time series data that has undergone the preprocessing 462.
[0272] One or more processors perform modeling 466 based on the result of the analysis processing 464, thereby generating a model of the manufacturing device / equipment to be controlled. One or more processors store the generated model (a set of functions or parameters) in the memory. Further, one or more processors perform prediction processing 468 such as the occurrence of anomalies and the progress of deterioration based on the generated model. Finally, one or more processors may also visually output the result of the prediction processing 468 to a display or the like (visualization processing 470) using a chart or a table or the like.
[0273] As described above, the IoT service 450 performs data analysis based on the time series data stored in the time series database 180 of the control device 100. Such an IoT service 450 is typically conceivable to be implemented in an environment with sufficient computing resources on the cloud. Therefore, a large amount of time series data can be used to discover hidden characteristics and the like.
[0274] When performing such data analysis, establishing the correspondence between the time and the information of the counter can more precisely determine the temporal relationship between the observed values in the time series data, and thus enable a more accurate and meaningful analysis. For example, when generating a model, it is important to search for the hidden causal relationships between the observed values, but there are cases where such causal relationships cannot be found due to temporal deviations. In the system of the present embodiment, during preprocessing, the temporal relationship between the observed values can be determined more accurately, and thus a more accurate model can be generated.
[0275] In addition, it is more beneficial in cases where it is necessary to refer to the time when certain abnormalities occurred to confirm the device data at that time of occurrence.
[0276] In addition, in Figure 20 In the example shown, an example of implementing AI (Artificial Intelligence) processing 196 inside the control device 100 is shown. In the AI processing 196, for example, supervised machine learning can also be performed to detect in advance abnormalities and deterioration trends occurring in the manufacturing device or equipment to be controlled.
[0277] Specifically, the AI processing 196 generates feature quantities based on one or more observed values included in the time series data stored in the time series database 180 of the control device 100, performs statistical processing on the generated feature quantities, and stores them as learning data. Then, when certain new observed values are input, the AI processing 196 calculates the degree to which the input observed values deviate from the learning data, and based on the calculated deviation degree, determines the presence or absence of abnormalities and deterioration trends.
[0278] By installing such AI processing 196 inside the control device 100, it is possible to substantially detect in real time abnormalities and deterioration trends occurring in the manufacturing device and equipment to be controlled.
[0279] <K. Supplementary Note>
[0280] The present embodiment as described above includes the following technical ideas.
[0281] [Structure 1]
[0282] A control device (100) that controls a control object (8), wherein the control device (100) includes:
[0283] A processor (102);
[0284] A storage unit (108) that stores a plurality of programs; and
[0285] A scheduler (25) that manages a program for causing the processor to execute according to priorities within a predetermined period.
[0286] The multiple programs in the storage unit include:
[0287] A first program (1541), which is the program with the highest execution priority to be executed by the processor during the period and is used for real-time control processing of the control object;
[0288] A second program (1542), which is a program with an execution priority lower than that of the first program and is used for associated processing related to the real-time control; and
[0289] A third program (190, 191) of the system service, which has an execution priority lower than that of the second program and is executed when there is idle time of the processor during the period.
[0290] The scheduler includes a switching unit (26). When the execution of the second program is started during the period and a command code of a predetermined type is executed in the second program, the switching unit (26) interrupts the execution of the second program by the processor and starts to execute the third program.
[0291] [Structure 2]
[0292] In the control device described in Structure 1,
[0293] The real-time control processing includes the following processing: generating an instruction value for the control object based on intermediate code generated through the associated processing.
[0294] The command code of the predetermined type includes a command code that generates the intermediate code over multiple periods when executed.
[0295] [Structure 3]
[0296] In the control device described in Structure 1 or 2,
[0297] The command code of the predetermined type includes a wait command code, and the wait command code is described using a wait condition and a code for determining whether the wait condition is satisfied.
[0298] [Structure 4]
[0299] In the control device described in any one of Structures 1 to 3,
[0300] The second program includes a program described in an interpreter language.
[0301] [Structure 5]
[0302] In the control device according to any one of Structures 1 to 4,
[0303] The system service includes processing of a time series database (180) that stores records in time series, and the records include data related to the control target.
[0304] [Structure 6]
[0305] In the control device according to Structure 5,
[0306] The control device further has:
[0307] A data generation unit (43) that generates data for constituting a record to be stored in the time series database for each of the cycles; and
[0308] A non-blocking queue (158) formed on a volatile main storage device that sequentially stores the data generated by the data generation unit,
[0309] The system service includes the following processing (183): reading the data from the non-blocking queue and storing it in the time series database.
[0310] [Structure 7]
[0311] In the control device according to Structure 6,
[0312] The control device has the time series database.
[0313] [Structure 8]
[0314] In the control device according to Structure 6 or 7,
[0315] The control device also
[0316] has a margin monitoring unit (44) that monitors the memory margin of the non-blocking queue,
[0317] The switching unit
[0318] Based on the comparison result between the memory margin and a threshold value, interrupts the execution of the second program being executed by the processor and starts the execution of the third program.
[0319] [Structure 9]
[0320] In the control device according to any one of Structures 1 to 8,
[0321] The first program includes a command code (301) of the associated processing that is executed when the execution of the second program is interrupted.
[0322] [Structure 10]
[0323] A program is executed by a control device (100) having a processor (102) for controlling a control object (8). The program includes:
[0324] A scheduler program (170) that manages programs to be executed by the processor in a predetermined cycle according to priorities;
[0325] A first program (1541) that is the program with the highest execution priority executed by the processor in the cycle and is used for real-time control processing of the control object;
[0326] A second program (1542) that has a lower execution priority than the first program and is used for associated processing related to the real-time control; and
[0327] A third program (190, 191) of system services that has a lower execution priority than the second program and is executed when there is idle time of the processor in the cycle,
[0328] The scheduler program includes a switching program (171). In the cycle, when the execution of the second program is started and then a command code of a predetermined type is executed in the second program, the switching program (171) interrupts the execution of the second program by the processor and starts to execute the third program.
[0329] [Structure 11]
[0330] A control method for controlling a control device (100) having a processor (102) for controlling a control object (8), where
[0331] The control device has:
[0332] A first program (1541) that is the program with the highest execution priority executed by the processor in a predetermined cycle and is used for real-time control processing of the control object;
[0333] A second program (1542) that has a lower execution priority than the first program and is used for associated processing related to the real-time control; and
[0334] A third program (190, 191) of system services that has a lower execution priority than the second program and is executed when there is idle time of the processor in the cycle,
[0335] The control method includes a step of managing programs to be executed by the processor in the cycle according to priorities,
[0336] The steps of performing the management include the following steps within the period:
[0337] Step (S33) of determining whether to start executing the second program and then executing a command code of a predetermined type in the second program; and
[0338] Step (S43) of, when the determination is affirmative, causing the processor to interrupt the execution of the second program and start executing the third program.
[0339] The embodiments disclosed herein should be considered illustrative in all respects and not restrictive. The scope of the present invention is represented by the claims, not by the above description, and is intended to include meanings equivalent to the claims and all modifications within the scope.
[0340] Reference Signs Explanation
[0341] 1: Control system; 25: Scheduler; 26: Switching unit; 30, 301: Control application processing unit; 31: Interpreter; 32: Buffer; 33: Intermediate code; 34: Program analysis unit; 40: Program processing unit; 41: Logic processing unit; 42: Motion processing unit; 43: Database writing unit; 44: Margin monitoring unit; 45: Switching; 50: I / O processing unit; 100: Control device; 102: Processor; 106: Main storage device; 108: Secondary storage device; 151: Interpreter program; 152: Control program; 156: Database writing program; 159: Shared memory; 160: Variable management program; 170: Scheduler program; 171: Switching program; 172: Input program; 174: Output program; 180: Time series database; 182: Database manager; 183: Reading processing unit; 184: Writing buffer; 185: System service processing unit; 186: Database file; 190: Database program; 191: Database reading program; 195: System service program; 1541: IEC program; 1542: Control application program; 1544: Margin monitoring program; F: Flag; MR: Variable; T: Control cycle.
Claims
1. A control device that controls a controlled object, wherein, The control device includes: a processor; a storage unit that stores a plurality of programs; and a scheduler that manages programs to be executed by the processor according to priorities within a predetermined period, The plurality of programs in the storage unit include: a first program, which is the program with the highest execution priority to be executed by the processor in the period and is used for real-time control processing of the control object; a second program, which is a program with an execution priority lower than that of the first program and is used for associated processing related to the real-time control; and a third program of system services, which has an execution priority lower than that of the second program and is executed when there is idle time of the processor in the period, The scheduler includes a switching unit. When the execution of the second program is started within the period and then a command code of a predetermined type is executed in the second program, the switching unit interrupts the execution of the second program by the processor and starts to execute the third program, The real-time control processing includes the following processing: generating an instruction value for the control object based on intermediate code generated by the associated processing, The command code of the predetermined type includes a command code such that when the command code is executed, intermediate code spanning multiple periods is generated.
2. The control device according to claim 1, wherein the command code of the predetermined type includes a wait command code, and the wait command code is described using a wait condition and a code for determining whether the wait condition is satisfied.
3. The control device according to claim 1, wherein the second program includes a program described in an interpreter language.
4. The control device according to claim 1, wherein the system service includes processing of a time-series database that stores records in time series, and the records include data related to the control object.
5. The control device according to claim 4, wherein the control device further has: a data generation unit that generates data for constituting records to be stored in the time-series database for each period; and a non-blocking queue formed on a volatile main storage device that sequentially stores the data generated by the data generation unit, the system service includes the following processing: reading the data from the non-blocking queue and storing it in the time-series database.
6. The control device according to claim 5, wherein the control device has the time-series database.
7. The control device according to claim 5 or 6, wherein the control device further has a margin monitoring unit that monitors the memory margin of the non-blocking queue, and the switching unit interrupts the execution of the second program being executed by the processor and starts the execution of the third program based on the comparison result between the memory margin and a threshold.
8. The control device according to claim 1, wherein the first program includes command codes of the associated processing to be executed when the execution of the second program is interrupted.
9. A recording medium that records a program, the program being executed by a control device having a processor for controlling a control target, wherein, This program has: A scheduler program that manages a program for causing the processor to execute according to priorities within a predetermined period; A first program that is the program with the highest execution priority executed by the processor within the period and is used for real-time control processing of the control object; A second program that is a program with an execution priority lower than that of the first program and is used for associated processing related to the real-time control; And A third program of system services that has an execution priority lower than that of the second program and is executed when there is idle time of the processor within the period, The scheduler program includes a switching program. When the execution of the second program is started within the period and then a command code of a predetermined type is executed in the second program, the switching program causes the processor to interrupt the execution of the second program and start executing the third program, The real-time control processing includes the following processing: generating an instruction value for the control object based on intermediate code generated through the associated processing, The command code of the predetermined type includes a command code that generates the intermediate code over a plurality of periods when it is executed.
10. A control method for controlling a control device having a processor for controlling a control object, wherein, The control device has: A first program that is the program with the highest execution priority executed by the processor within a predetermined period and is used for real-time control processing of the control object; A second program that is a program with an execution priority lower than that of the first program and is used for associated processing related to the real-time control; And A third program of system services that has an execution priority lower than that of the second program and is executed when there is idle time of the processor within the period, The control method has a step of managing a program for causing the processor to execute according to priorities within the period, The step of performing the management includes the following steps within the period: Judging whether to start executing the second program and then execute a command code of a predetermined type in the second program; And When the judgment is an affirmative judgment, causing the processor to interrupt the execution of the second program and start executing the third program, The real-time control processing includes the following processing: generating an instruction value for the control object based on intermediate code generated through the associated processing, The command code of the predetermined type includes a command code that generates the intermediate code over a plurality of periods when it is executed.
Citation Information
Patent Citations
Control device
JP2019036043A
Dispatching method and device of satellite borne software
CN103984596A
Control device
CN108459937A
Control apparatus, storage medium, and control method
CN110231781A