Programmable logic controller, support device, and logging method
The programmable logic controller with dual-memory banks and a support device facilitates logging setting updates without stopping the logging process, ensuring uninterrupted data collection in factory automation.
Patent Information
- Application Number
- JP2024100950
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-24
AI Technical Summary
Existing methods fail to update logging settings in programmable logic controllers (PLCs) without stopping the logging process, which is crucial for continuous operation in factory automation.
A programmable logic controller with multiple memory banks and a support device that allows switching logging settings without interrupting the logging process by using a dual-memory system for logging settings and data buffering, enabling seamless updates.
Enables the update of logging settings in PLCs without stopping the logging process, ensuring continuous data collection and minimizing disruption in factory automation systems.
Smart Images

Figure 0007548464000001
Abstract
Description
[Technical field]
[0001] The present invention relates to a programmable logic controller, a support device for supporting the programmable logic controller, and a logging method in the programmable logic controller. [Background technology]
[0002] In factory automation, a programmable logic controller (PLC) controls manufacturing equipment, conveying equipment, inspection equipment, and the like by executing application programs such as ladder programs. Here, there is a demand for recording logs related to the control of various equipment or devices and for referencing them as necessary. Therefore, a technology has been proposed that enables logging without affecting the control of various equipment or devices (for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Patent No. 7188631 Summary of the Invention [Problem to be solved by the invention]
[0004] It may be necessary to update the logging settings that represent the logging process in a PLC. However, in factory automation, it is usually preferable to continue the logging process. However, the conventional technology does not propose a method for updating the logging settings without stopping the logging process of the PLC.
[0005] An object of one aspect of the present invention is to provide an apparatus and method capable of updating logging settings without stopping the logging process of a PLC. [Means for solving the problem]
[0006] A programmable logic controller according to one aspect of the present invention includes a process execution unit that repeatedly executes a control process cycle including a program execution process for executing a control program, an output process for outputting the execution result of the control program to control an external device, a logging process for collecting data representing values of variables used in the control program by referring to a logging setting, and a system process for managing the operation of the programmable logic controller, a plurality of program memory banks for storing the control program, a plurality of setting data memory banks for storing logging settings representing the operation of the logging process, and a data buffer for temporarily storing data collected in the logging process. The process execution unit writes a second control program to a second program memory bank of the plurality of program memory banks when a first control program is stored in a first program memory bank of the plurality of program memory banks and the first control program is executed to control an external device. The process execution unit writes a second logging setting to a second setting data memory bank of the plurality of setting data memory banks when a first logging setting is stored in a first setting data memory bank of the plurality of setting data memory banks and the reference destination of the logging process is the first setting data memory bank. In response to receiving an instruction to switch the logging settings, the processing execution unit switches the reference for the logging process from the first setting data memory bank to the second setting data memory bank in synchronization with updating the control program from the first control program to the second control program before collecting data representing the values of variables through the logging process for the first time after receiving the switching instruction, and saves the data stored in the data buffer in the storage device.
[0007] An assistance device according to one aspect of the present invention assists the above-mentioned programmable logic controller. The assistance device includes a program analysis unit that analyzes a control program and extracts variables used in the control program, a selection unit that selects target variables for which data should be collected in a logging process from among the variables extracted by the program analysis unit, and a setting information output unit that creates a second logging setting including information representing the target variables selected by the selection unit and transmits the second logging setting to the programmable logic controller. After receiving a completion response indicating that the second logging setting has been received from the programmable logic controller, the assistance device transmits a switching instruction to the programmable logic controller. Effect of the Invention
[0008] According to the above-described aspect, it becomes possible to update the logging settings without stopping the logging process of the PLC. [Brief description of the drawings]
[0009] [Figure 1] FIG. 1 is a diagram illustrating an example of the configuration of a PLC system. [Diagram 2] FIG. 2 illustrates an example of a control process executed by a PLC. [Diagram 3] FIG. 2 is a diagram illustrating an example of a hardware configuration of a PLC. [Figure 4] FIG. 2 is a diagram illustrating an example of a hardware configuration of a PC. [Diagram 5] FIG. 2 illustrates an example of a functional configuration of the support device. [Figure 6] FIG. 13 illustrates an example of a method for creating a logging setting. [Figure 7] FIG. 13 illustrates an example of a UI screen used in the collection target setting process. [Figure 8] FIG. 11 is a diagram illustrating an example of logging setting data. [Figure 9] FIG. 11 is a diagram illustrating an example of collection target setting information. [Figure 10] FIG. 2 is a diagram illustrating an example of a functional configuration of a PLC. [Figure 11] FIG. 11 illustrates an example of a logging process executed by a PLC. [Figure 12] 11 is a flowchart showing an example of a logging process and a storage process. [Figure 13] FIG. 4 is a diagram illustrating an example of a data structure of logging collection data. [Figure 14] FIG. 4 is a diagram illustrating an example of a data structure of collected data. [Figure 15] 13 is a flowchart illustrating an example of a collection process. [Figure 16] 11 is a sequence diagram illustrating an example of a procedure for updating a user program and a logging setting. FIG. [Figure 17] 1 is a diagram for explaining an overview of a method for updating logging settings in a PLC. [Figure 18] FIG. 13 is a diagram showing an example of logging setting data written to a PLC. [Figure 19] FIG. 13 is a diagram illustrating an example of updating logging settings. [Figure 20] FIG. 11 illustrates an example of updating logging setting data. [Figure 21] FIG. 13 illustrates an example of updating logging settings and saving collected data. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0010] Fig. 1 shows an example of the configuration of a PLC system 10. The PLC system 10 shown in Fig. 1 includes a PLC 1, a personal computer (PC) 2, an input / output module 3, and a communication module 4. The PLC 1 and the PC 2 are connected via a communication cable 6. The PLC 1 controls various devices or equipment installed in a factory in factory automation, for example.
[0011] PC2 provides a function as a support device that supports PLC1. PC2 also provides a function to set conditions for executing logging processing in PLC1. PC2 can edit user application programs used by PLC1. A user application program is an example of a control program that controls an external device. In the following description, a user application program may be referred to as a "user program."
[0012] The user program is created, for example, using a ladder language that complies with IEC (International Electrotechnical Commission) 61131-3. The user program may also be created using a graphical programming language such as a motion program in a flow chart format, such as a sequential function chart (SFC). Alternatively, the user program may be created using a high-level programming language, such as the C language.
[0013] The PLC 1 is connected to the input / output module 3 and the communication module 4 via a communication bus 7. A plurality of input / output modules 3 and / or a plurality of communication modules 4 may be connected to the communication bus 7. The input / output module 3 and the communication module 4 are preferably detachable from the PLC system 10. The input / output module 3 and the communication module 4 correspond to external devices.
[0014] The input / output module 3 inputs / outputs digital or analog signals. The input / output module 3 may also have a function of converting signals from a servo amplifier, an encoder, or a sensor into electrical signals. The communication module 4 provides a communication interface with other devices.
[0015] Fig. 2 shows an example of control processing executed by the PLC 1. As shown in Fig. 2, the PLC 1 repeatedly executes control processing including input processing, program execution processing, output processing, logging processing, and system processing for each control period.
[0016] The input process takes in input data received from the input / output module 3. The program execution process executes a user program created by a user. The input data taken in by the input process is used in the execution of the user program. The output process controls the input / output module 3 by outputting the execution results of the user program. In other words, the execution results of the user program are reflected in the output of the input / output module 3.
[0017] The logging process collects data representing the values of variables used in the user program to generate collected data. The logging process also records data representing the operating status of each component of the PLC system 10, including the PLC 1, and saves it as history.
[0018] The system processing maintains proper operation of the PLC 1 by managing the operation of the PLC 1. The system processing also includes a process of writing user programs and logging setting data to the memory in the PLC 1.
[0019] The PLC 1 executes the logging process after the output process in each control cycle so as not to interfere with the execution of the user program. The control cycle is the sum of the execution periods of the input process, the program execution process, the output process, the logging process, and the system process. Therefore, when the control cycle is specified, the execution period of the logging process is limited by the bandwidth allocated to the control cycle. The control cycle is specified, for example, by the user. Note that the bandwidth of the logging process may be adjustable by changing the ratio of the execution periods allocated to the program execution process, the logging process, and the system process.
[0020] In this way, the logging process is set without affecting the execution of processes related to the user program and the control of the device (input process, program execution process, and output process). Therefore, the PLC1 can collect the desired amount of variable values. In other words, the PLC1 can appropriately collect data representing the values of variables used in the control of the device.
[0021] Fig. 3 shows an example of the hardware configuration of the PLC 1. As shown in Fig. 3, the PLC 1 includes a communication I / F 11, a CPU (Central Processing Unit) 12, a bus controller 13, a memory 14, and a storage device I / F 15. All of these components are hardware, connected to an internal bus 16, and can transmit data to each other. "I / F" is an abbreviation for interface. The CPU is sometimes called a processor.
[0022] The communication I / F 11 is connected to the communication cable 6 and communicates with the PC 2. The CPU 12 executes various programs such as a user program, a system program for managing the operation of the PLC 1, a logging execution program, etc. The bus controller 13 is connected to the communication bus 7 and communicates with the input / output module 3 and the communication module 4.
[0023] The memory 14 is, for example, a semiconductor memory, and includes a RAM (Random Access Memory) area and a ROM (Read Only Memory) area. The RAM area is used as a storage area for temporarily storing various data when the CPU 12 executes various programs. The ROM area is an area in which various programs and / or data are saved, and is realized by, for example, a non-volatile memory. The storage device I / F 15 manages the writing and reading of various data to and from an external storage device 17 such as a memory card.
[0024] Fig. 4 shows an example of the hardware configuration of the PC 2. As shown in Fig. 4, the PC 2 includes a CPU 21, a memory 22, an input device 23, a display device 24, an auxiliary storage device 25, and a communication I / F 26. All of these components are hardware, connected to an internal bus 27, and can transmit data between each other.
[0025] The CPU 21 provides, for example, a function for editing a user program, a function for creating logging settings that indicate conditions for executing logging processing, and the like, by executing a program using the memory 22. The input device 23 is, for example, a keyboard and / or a pointing device, and is used for inputting instructions or information from the user. The display device 24, for example, queries the user, gives instructions to the user, and displays processing results.
[0026] The auxiliary storage device 25 is realized by, for example, a magnetic disk device, an optical disk device, a magneto-optical disk device, a hard disk drive, or a flash memory. The PC 2 can store programs and data in the auxiliary storage device 25 and use them by loading them into the memory 22. The communication I / F 26 is connected to the communication cable 6 and communicates with the PLC 1.
[0027] <Logging settings> Information related to the logging process in the PLC 1 is set by a support device. This support device is realized by the PC 2 shown in Fig. 1 or 4 executing a predetermined setting tool program. In other words, the function of this support device is provided by the PC 2.
[0028] 5 shows an example of a functional configuration of the support device 30. The support device 30 sets conditions for executing logging processing in the PLC 1. That is, the support device 30 creates logging settings to be referenced by the PLC 1 and provides the same to the PLC 1. As shown in FIG. 5, the support device 30 includes a program analysis unit 31, a selection unit 32, a reception unit 33, a setting information output unit 34, a calculation unit 35, and a setting storage unit 36. The support device 30 may further include other functions not shown in FIG. 5. It is also assumed that a control period for causing the PLC 1 to perform the control processing shown in FIG. 2 is set in advance in the support device 30 by a user.
[0029] The program analysis unit 31 analyzes a user program to be executed by the PLC 1, and extracts variables used in the user program. The selection unit 32 selects variables to be collected in the logging process by the PLC 1 (i.e., collection target variables) from among the variables extracted by the program analysis unit 31. The reception unit 33 receives a designation of a predetermined collection period longer than the control cycle. The length of the collection period is, for example, N (N is an integer equal to or greater than 2) times the length of the control cycle. The setting information output unit 34 outputs information representing a plurality of collection target variables and information representing the collection period as setting information. In the following description, the variables to be collected in the logging process (i.e., collection target variables) may be simply referred to as "target variables".
[0030] The PLC 1 executes the logging process based on the setting information output from the support device 30. At this time, the PLC 1 may distribute the multiple target variables to multiple control cycles and collect values of some of the multiple collection target variables in each of the multiple control cycles. Alternatively, the PLC 1 may collect values of the target variables in each control cycle constituting the collection cycle.
[0031] The calculation unit 35 determines the number of control periods for collecting the values of the plurality of target variables based on the collection period and the control period. The calculation unit 35 then calculates the amount of data of the values of the plurality of target variables collected in each of the plurality of control periods based on the total amount of data of the values of the plurality of target variables and the determined number of control periods.
[0032] The setting storage unit 36 stores settings related to conditions for executing the logging process. That is, logging settings are stored in the setting storage unit 36. The settings are stored in the auxiliary storage device 25, for example.
[0033] The support device 30 having the above-mentioned functions makes it possible to update the logging settings without stopping the logging process that collects a desired amount of variable values in the PLC 1. In other words, the PLC 1 can continuously collect the values of variables used in controlling the device.
[0034] 6 shows an example of a method for creating a logging setting, which corresponds to the support method used by the support device 30 shown in FIG.
[0035] The support device 30 includes a setting tool 40. In the PC 2, the function of the setting tool 40 is provided by causing the CPU 21 to execute a predetermined setting tool program.
[0036] Project data 41 is input to the setting tool 40. The project data 41 includes information related to the system configuration of the PLC system 10, a user program executed by the PLC 1, and information related to function settings of the input / output module 3 and the communication module 4, which are external devices provided in the PLC system 10. Here, it is assumed that the project data 41 is created by a user, for example, by executing a predetermined project data editing program in the PC 2, and is stored in the auxiliary storage device 25.
[0037] The setting tool 40 executes a collection target setting process S110 for the project data 41. At this time, the setting tool 40 determines variables to be logged from variables used in the user program. The setting tool 40 provides the functions of the program analysis unit 31 and the selection unit 32 in the support device 30 shown in FIG.
[0038] The collection target setting process S110 includes a program analysis process S111. The program analysis process S111 analyzes a user program included in the project data 41 and extracts variables used in the user program. In addition, in the collection target setting process S110, target variables (i.e., variables to be collected by the logging process executed by the PLC 1) are selected from the variables extracted by the program analysis process S111.
[0039] Here, the UI screen 100 used in the collection target setting process S110 will be described with reference to Fig. 7. "UI" is an abbreviation for user interface.
[0040] 7, the UI screen 100 includes a program selection section 101, an extracted variable display section 102, and a target variable display section 103. When the function of the support device 30 is provided by the PC 2 shown in FIG.
[0041] The program selection section 101 displays information indicating the user programs included in the project data 41. In this embodiment, it is assumed that a task is configured as a collection of multiple programs, and a user program is configured as a collection of multiple tasks. In the example screen shown in FIG. 7, "Application Name" is the name of the user program, "Task 1", "Task 2", and "Task 3" are the names of each task, and "Program" to "Program N" are the names of each program belonging to each task. In this example screen, the relationship between the user program, each task, and each program is represented in a tree format.
[0042] When the user selects one of the program names displayed in the program selection section 101, a program analysis process S111 is executed for the selected program, and variables used in the program are extracted. If a task name is selected instead of a program name, variables are extracted from each of the programs belonging to the selected task. At this time, the names of the extracted variables are displayed in the extracted variable display section 102.
[0043] When the user selects one or more names from among the names of the variables displayed in the extracted variable display section 102 and then presses the register button 104, the variables corresponding to the selected names are selected as target variables. At this time, the names of the selected target variables are displayed in the target variable display section 103. When the user selects one or more names from among the names of the target variables displayed in the target variable display section 103 and presses the release button 105, the selected variables are excluded from the selection results of the target variables.
[0044] When the user presses the Bulk Registration button 106, all the variables displayed in the Extracted Variable Display section 102 are selected as target variables, and their names are displayed in the Target Variable Display section 103. On the other hand, when the user presses the Bulk Cancel button 107, all the variables displayed in the Target Variable Display section 103 are excluded from the selection results of the target variables.
[0045] In the collection target setting process S110, the total amount of data to be collected when the logging process is executed for all of the target variables selected as described above is calculated based on the project data 41. The calculated total amount of data is displayed in the collected data size display section 108 on the UI screen 100.
[0046] The execution times of the input process, program execution process, output process, and system process within one cycle of the control process executed by PLC1 can be calculated from the project data 41. In addition, in the collection target setting process S110, the execution time of the logging process when the logging process is executed for the selected target variable is estimated. Then, the sum of these execution times is calculated. This total execution time is the time estimated to be required to execute one cycle of the control process executed by PLC1. This sum is displayed in the estimated control period display section 109 in the UI screen 100.
[0047] Returning to the explanation of Fig. 6, the setting tool 40 creates information for setting the operation of the logging process in the collection operation setting process S120. With this information, for example, the collection timing of the values of the target variables that are the data to be collected, the period during which the data is collected, the storage timing for the PLC 1 to store the collected data in the external storage device 17, etc. are set in the PLC 1.
[0048] Following S110 and S120, the setting tool 40 executes a setting content confirmation process S130. In the setting content confirmation process S130, it is determined whether the execution time of one cycle of the control process when the PLC 1 executes the logging process for all of the target variables selected in S110 falls within a preset control period.
[0049] Specifically, the execution times of input processing, program execution processing, output processing, and system processing in one cycle of the control processing executed by PLC1 are calculated based on the project data 41. Then, the sum of these execution times is subtracted from the preset control cycle. The time obtained by this subtraction is the time in which the logging processing can be executed, and this time will be referred to as the "maximum processing time." Next, the maximum size of data that can be collected within this maximum processing time is calculated. Then, this maximum size is compared with the total data amount calculated in S110 (the value displayed on the collected data size display section 108 on the UI screen 100).
[0050] If the total data amount exceeds the maximum size, it is determined that the values of all the target variables cannot be collected in one cycle of the control process (i.e., only the values of some of the target variables can be collected). In this case, the setting content confirmation process S130 outputs warning information. This warning information is displayed, for example, on the display device 24 shown in FIG. 4.
[0051] Following S130, the setting tool 40 executes a setting file input / output process S140. The setting file input / output process S140 corresponds to the function of the reception unit 33 in the support device 30 shown in FIG.
[0052] In the setting file input / output process S140, information identifying the target variable selected in S110 and operation setting information for the logging process set in S120 are output as logging setting data 42. The logging setting data 42 is transmitted to the PLC 1. The PLC 1 executes the logging process based on the contents of the logging setting data 42. Also, in the setting file input / output process S140, the setting tool 40 can obtain the logging setting data 42 stored in the auxiliary storage device 25 shown in FIG. 4.
[0053] 8 shows an example of the logging setting data 42. The logging setting data 42 includes project data information 51, collection operation setting information 52, and collection target setting information 53, as shown in FIG.
[0054] The project data information 51 is information for identifying a user program to be executed by the PLC 1, and includes, for example, information such as a name given to an object code obtained by compiling the user program, the date and time of the compilation, etc. The project data information 51 may be a part of the project data 41.
[0055] The collection operation setting information 52 is created by the collection operation setting process S120. The collection operation setting information 52 includes, for example, information indicating the timing of collecting data, information indicating the period for collecting data, information indicating the timing at which the PLC 1 stores the collected data in the external storage device 17, and information specifying the external storage device 17 in which the collected data is to be stored.
[0056] The collection target setting information 53 includes information related to the target variables selected by the collection target setting process S110. An example of the collection target setting information 53 is shown in FIG.
[0057] 9, the collection target setting information 53 includes information on the total size of collected data at the timing of data collection. The collection target setting information 53 also includes information indicating the number of target variables for which data is collected. Furthermore, the collection target setting information 53 includes information indicating the memory type, data type, memory address, and data size for each target variable. This information specifies the location and size in memory 14 of the storage area used to hold the values of the target variables when a user program is executed in PLC 1.
[0058] In this way, by using the setting tool 40, the support device 30 can set conditions related to the execution of the logging process in the PLC 1.
[0059] <Logging execution> A description will be given of the logging process executed by the PLC 1 in the PLC system 10 shown in Fig. 1. The PLC 1 executes the logging process in accordance with the logging setting data 42 created by the PC 2 operating as the support device 30.
[0060] Fig. 10 shows an example of the functional configuration of the PLC 1. In the example shown in Fig. 10, the PLC 1 includes a processing execution unit 61, a logging data buffer 62, and a storage unit 63. It is assumed that the control period for performing the above-mentioned control processing is set in advance by the user in the PLC 1.
[0061] The PLC 1 repeatedly executes a control process S200 including an input process S210, a program execution process S220, an output process S230, a system process S240, and a logging process S250. In the functional configuration example shown in Fig. 10, the process execution unit 61 repeatedly executes the control process S200. In the hardware configuration example shown in Fig. 3, this control process is executed by the CPU 12.
[0062] The logging data buffer 62 is a storage area for saving collected data, in which the data collection time by the logging process S250 is associated with the value of the target variable collected at the data collection time, every time the value of the target variable is collected. In the hardware configuration example shown in FIG. 3, the logging data buffer 62 is configured by a part of the storage area of the memory 14.
[0063] The logging process S250 may include a process for determining whether or not the execution time of one cycle of the control process S200 falls within a preset control period. Furthermore, the logging process S250 may include a process for interrupting collection of the values of the target variables in the logging process for that cycle when it is determined that the execution time of one cycle of the control process S200 does not fall within the control period. At this time, the logging process S250 may include a process for discarding collected data including the values of the variables collected in the logging process for that cycle from the logging data buffer 62.
[0064] The storage unit 63 sequentially reads out the collected data that has not been discarded and is stored in the logging data buffer 62, and stores the data in the external storage device 17. In the hardware configuration example shown in Fig. 3, the storage device I / F 15 may provide the function of the storage unit 63 under the control of the CPU 12. At this time, the process execution unit 61 provided by the CPU 12 may control the storage device I / F 15 as a part of the logging process S250.
[0065] Fig. 11 shows an example of the logging process executed by the PLC 1. The functional configuration of the PLC 1 is as described with reference to Fig. 10.
[0066] The program execution process S220 executes a user program using input data received in the input process S210 and sent from the input / output module 3 or the communication module 4. The execution result is output by the output process S230 for controlling an external device. In the hardware configuration example shown in Fig. 3, the CPU 12 executing the program execution process S220 uses a storage area of the memory 14 to execute the user program. The storage area used at this time is referred to as the "program use area 14a".
[0067] The logging process S250 collects the values of each target variable from among the variables used in the user program executed by the program execution process S220. Note that the logging setting data 42, which includes information on the target variables and operation setting information for the logging process, is assumed to have been created in the support device 30 (PC2) and provided to the PLC1 in advance.
[0068] The CPU 12 of the PLC 1 executes a time management process S260 and a collection timing detection process S270 in parallel with the control process S200. The time management process S260 measures the current time. The collection timing detection process S270 detects the arrival of the data collection timing indicated by the collection operation setting information 52 included in the logging setting data 42.
[0069] In the logging process S250, the values of each target variable are collected in response to the detection of the arrival of the collection timing by the collection timing detection process S270. Also, in the logging process S250, the collection time of each value is obtained from the time measurement result by the time management process S260, and the collected data in which the value and the collection time are associated with each other is stored in the logging data buffer 62.
[0070] The CPU 12 of the PLC 1 executes a save process S280. The save process S280 includes a process of detecting the arrival of a save timing represented by the collection operation setting information 52 included in the logging setting data 42. In addition, the save process S280 controls the storage device I / F 15 to read out collected data stored in the logging data buffer 62 in response to the detection of the arrival of the save timing. Then, the save process S280 saves the read collected data in the external storage device 17. The save destination is represented by the collection operation setting information 52.
[0071] 12 is a flowchart showing an example of the logging process S250 and the storage process S280. The process of this flowchart is executed when the timing to start the logging process arrives in each cycle of the control process S200.
[0072] In S251, the process execution unit 61 uses the collection timing detection process S270 to determine whether the arrival of collection timing has been detected. Then, when the arrival of collection timing has been detected (S251: Yes), collection processing is performed in S252. The collection processing includes a process of collecting the values of each target variable, and a process of saving the collected values in the logging data buffer 62 as collected data 73, which will be described later. On the other hand, when the arrival of collection timing has not been detected (S251: No), the processing shown in FIG. 12 ends.
[0073] In S281, the storage unit 63 determines whether or not the save timing has arrived. The save timing is represented by the collection operation setting information 52 included in the logging setting data 42. If the save timing has arrived (S281: Yes), the processing of the storage unit 63 proceeds to S282. On the other hand, if the save timing has not arrived (S281: No), the processing of S282 is not performed and the processing shown in FIG. 12 ends.
[0074] In S282, the storage unit 63 reads out the collected data stored in the logging data buffer 62 by the collection process S252 in the logging process. Then, the storage unit 63 stores the read collected data as logging collected data 70 in the external storage device 17, which is the storage destination indicated by the collection operation setting information 52.
[0075] 13 shows an example of the data structure of the logging collected data 70. The logging collected data 70 includes project data information 51, the number of collected data items 71, a collected data size 72, and one or more collected data items 73.
[0076] The project data information 51 is information for identifying a user program executed in the PLC 1, and includes, for example, a name given to an object code obtained by compiling the user program, and information on the date and time of the compilation. That is, the project data information 51 included in the logging collection data 70 is the same as the project data information 51 included in the logging setting data 42. Note that, in the collection process S252, the CPU 12 obtains the project data information 51 from the logging setting data 42 and writes it into the logging collection data 70.
[0077] The number of collected data 71 indicates the number of collected data 73 included in the logging collected data 70. The collected data size 72 indicates the total amount of collected data 73 included in the logging collected data 70. Each collected data 73 is data representing the value of a target variable collected in the logging process, and is written into the logging collected data 70 in the order in which it was collected.
[0078] 14 shows an example of the data structure of collected data 73. In this embodiment, collected data 73 includes timestamp information. The timestamp indicates the time when the values of the target variables were collected. Furthermore, "variable data 1", "variable data 2", ..., "variable data N" are the values of the target variables collected at the time indicated by the timestamp information.
[0079] In this manner, in S282, the storage unit 63 creates the logging collection data 70 having the data structure shown in Fig. 13 using the logging setting data 42 and the collection data stored in the logging data buffer 62. Then, the logging collection data 70 is stored in the external storage device 17.
[0080] 12 is completed, the CPU 12 stores the logging setting data 42 in the external storage device 17. The logging setting data 42 is used when the collected data 73 is displayed.
[0081] 15 is a flowchart showing an example of the collection process, which corresponds to S252 shown in FIG.
[0082] In S253, the process execution unit 61 acquires the current time measured by the time management process S260 as a time stamp. Then, the process execution unit 61 writes the acquired time stamp into the logging data buffer 62 as data at the beginning of the collected data 73.
[0083] In S254, the process execution unit 61 acquires the current value of each of the target variables. Then, the process execution unit 61 writes each acquired value as variable data in the logging data buffer 62 in a predetermined order associated with each of the target variables.
[0084] The value of the target variable is held at a predetermined position in the program usage area 14a. This position is specified based on the information on the memory type, data type, memory address, and data size for the target variable included in the collection target setting information 53 of the logging setting data 42. Therefore, in S254, the value of the target variable is obtained by reading the data held at this position and written to the logging data buffer 62.
[0085] In S255, the process execution unit 61 determines whether or not values have been collected for all of the target variables registered in the collection target setting information 53 of the logging setting data 42. If the values of all the target variables have been collected (S255: Yes), the collection process ends. On the other hand, if there are any target variables whose values have not been collected (S255: No), the process of the process execution unit 61 returns to S254. That is, the process execution unit 61 acquires the value of the next target variable. Then, when the values of all the target variables have been acquired and saved in the logging data buffer 62, the save process S280 is executed.
[0086] <Update logging settings> In the PLC system 10 shown in FIG. 1, the user program executed by the PLC1 may be updated. In this case, the values of variables in the new user program are collected, so the settings of the logging process executed by the PLC1 must also be updated. Even if the user program executed by the PLC1 is not updated, a request may be made to update the settings of the logging process. However, it is preferable that the PLC1, which controls manufacturing equipment, conveying equipment, inspection equipment, etc. in factory automation, be able to continue the logging process. Therefore, the PLC system 10 according to the embodiment of the present invention has a function of updating the logging settings of the PLC1 without stopping the logging process by the PLC1.
[0087] 16 is a sequence diagram showing an example of a procedure for updating a user program and logging settings. The user program is implemented in the PLC 1 by the support device 30. The PLC 1 executes logging processing according to the logging settings provided by the support device 30.
[0088] In S301, the support device 30 transmits to the PLC 1 a new user program to be executed by the PLC 1. That is, the support device 30 writes the new user program to the PLC 1. The PLC 1 saves the new user program in its own memory, but does not update the user program at this point. Note that the writing of the user program may be performed, for example, by the method described in Japanese Patent No. 5790128.
[0089] In S302, PLC 1 transmits a completion response indicating that the new user program has been received and saved to the support device 30. If PLC 1 fails to write the new user program, it transmits a failure response indicating the failure to the support device 30. Alternatively, PLC 1 does not respond to the support device 30. If the support device 30 detects a failure response or a timeout, it does not execute the subsequent processes.
[0090] Upon receiving the completion response of S302, the support device 30 transmits the new logging settings to PLC 1 in S303. That is, the support device 30 writes the new logging settings to PLC 1. PLC 1 saves the new logging settings in its own memory, but does not update the logging settings at this point.
[0091] The support device 30 analyzes the new user program transmitted to the PLC 1 in S301 and extracts variables used in the user program. The support device 30 also selects target variables from the extracted variables. The support device 30 then creates logging settings including information representing the selected target variables. The procedure for creating logging settings corresponding to the new user program may be performed before S301 or after receiving the completion response in S302.
[0092] In S304, PLC1 transmits a completion response indicating that the new logging settings have been received and saved to the support device 30. If PLC1 fails to write the new logging settings, it transmits a failure response indicating the failure to the support device 30. Alternatively, PLC1 does not respond to the support device 30. If the support device 30 detects the failure response or a timeout, it does not execute the subsequent processes.
[0093] Upon receiving the completion response in S304, in S305, the support device 30 transmits a switching instruction to the PLC 1. This switching instruction includes an instruction to update the running user program to the new user program, and an instruction to update the logging setting in use to the new logging setting.
[0094] In S306, in response to the switching instruction, PLC1 updates the running user program to a new user program and updates the logging setting being used to the new logging setting. A method for updating the logging setting will be described in detail later. Then, when updating of the user program and the logging setting is completed, PLC1 transmits a completion response to the support device 30. If the sequence shown in FIG. 16 fails midway, the support device 30 may re-execute the same sequence or may resume the sequence from the midway.
[0095] When the user program is compiled by the support device 30, the command execution code used in the user program changes, and therefore the addresses indicating the variables may change. Also, if the logging settings are updated after the user program is updated, the addresses based on the logging settings data may be assigned to different variables before and after the user program is updated, and the intended logging targets may not be collected. Therefore, in the embodiment of the present invention, as shown in FIG. 16, after a new user program and new logging settings are written to PLC1, a switching instruction is sent from the support device 30 to PLC1, and the user program and logging settings are updated in response to the switching instruction.
[0096] Fig. 17 is a diagram for explaining an outline of a method for updating logging settings in PLC 1. Note that memory 310 is a storage area for saving logging setting data, and is realized by memory 14 shown in Fig. 3. Memory 310 includes a plurality of memory banks for setting data. In the example shown in Fig. 17, memory 310 includes memory banks 310a and 310b as memory banks for setting data.
[0097] The PLC 1 receives the logging setting data from the support device 30. Then, in system processing S240, the PLC 1 stores the received logging setting data in one of the memory banks 310a, 310b. Here, for example, when logging setting data has already been stored in the memory bank 310a, new logging setting data is written to the memory bank 310b. The configuration of the logging setting data is as described with reference to FIG. 8.
[0098] The PLC 1 executes a logging process S250. The logging process S250 includes a logging setting management process S311, a collection process S312, and a buffer management process S313.
[0099] The logging setting management process S311 manages the memory banks 310a, 310b to be referred to by the collection process S312 when the collection timing arrives. At this time, the logging setting management process S311 may provide information indicating the memory banks 310a, 310b to be referred to when the collection timing arrives to the collection process S312. The information managed by the logging setting management process S311 includes an address where the logging setting data is saved.
[0100] The collection process S312 corresponds to S252 shown in Fig. 12 or S253 to S255 shown in Fig. 15, and executes logging processing according to the logging setting data stored in the memory banks 310a, 310b specified by the logging setting management process S311. For example, when the logging setting management process S311 specifies the memory bank 310a, the collection process S312 obtains the value of the target variable from the program use area 14a shown in Fig. 11 according to the logging setting data stored in the memory bank 310a, and writes it to the logging data buffer 62.
[0101] The buffer management process S313 manages an area to which the data collected in the logging process should be written. Here, the logging data buffer 62 includes a plurality of data buffers 62a to 62n. In this case, the buffer management process S313 manages the data buffers 62a to 62n to which the collected data should be written. Then, the collection process S312 writes the collected data to the corresponding data buffers 62a to 62n in accordance with the management by the buffer management process S313.
[0102] The collected data written to the logging data buffer 62 is read by the storage unit 63 shown in Fig. 10 and stored in the external storage device 17. At this time, for example, when one of the data buffers 62a to 62n becomes full, the storage unit 63 reads the collected data from that data buffer and stores it in the external storage device 17. Alternatively, when a predetermined number of collected data is written to a data buffer, the storage unit 63 reads the collected data from that data buffer and stores it in the external storage device 17. However, even when the predetermined number of collected data is not stored in the data buffer, when the logging setting is updated, the storage unit 63 reads the collected data from the data buffer and stores it in the external storage device 17.
[0103] 18 shows an example of logging setting data written to PLC 1. In this example, memory 310 for saving logging setting data includes memory banks 310a and 310b. Note that in the initial state of PLC 1, memory banks 310a and 310b are empty.
[0104] Here, it is assumed that the logging setting data provided from the support device 30 to the PLC 1 is stored in the memory bank 310a. The logging setting data stored in the memory bank 310a includes project data information 51a, collection operation setting information 52a, and collection target setting information 53a. The configuration of the logging setting data is as described with reference to Fig. 8. Then, the collection process S312 executes the logging process in accordance with this logging setting data.
[0105] Next, a new user program and new logging setting data are provided from the support device 30 to the PLC 1. This procedure corresponds to S301 and S303 shown in Fig. 16. The new logging setting data includes project data information 51b, collection operation setting information 52b, and collection target setting information 53b as information for collecting values of variables in the new user program, and is written to the memory bank 310b. However, at this point, the collection process S312 continues the logging process according to the logging setting data stored in the memory bank 310a.
[0106] 16 from the support device 30, the PLC 1 updates the user program to a new user program and switches the memory bank to be referenced from the memory bank 310a to the memory bank 310b. The memory bank switching process is performed, for example, by the logging setting management process S311. In response to receiving the switching command, the PLC 1 updates the user program and updates the memory bank to be referenced before collecting data representing the values of the target variables by the logging process for the first time after receiving the switching command. The collection process S312 executes the logging process according to the new logging setting data stored in the memory bank 310b.
[0107] 19 is a schematic diagram showing how logging settings are updated. The PLC 1 includes a memory area for storing user programs. This memory area includes a plurality of program memory banks. In this embodiment, the PLC 1 includes memory banks 320a and 320b as program memory banks.
[0108] At time T1, a user program A is added to the memory bank 320a. At this time, no user program is stored in the memory bank 320b. After time T1, the program execution process S220 executes the user program A stored in the memory bank 320a to control an external device (not shown). Also, at time T1, logging setting data (Config_Data) 42a is written to the memory bank 310a. At this time, no logging setting data is stored in the memory bank 310b. After time T1, the logging process S250 executes the logging process by referring to the logging setting data 42a stored in the memory bank 310a.
[0109] At time T2, a new user program B and new logging setting data 42b are provided from the support device 30 to the PLC 1. The logging setting data 42b includes information for collecting data representing values of variables used in the user program B. The user program B is then stored in the memory bank 320b. However, the program execution process S220 does not update the user program at this point. That is, the program execution process S220 continues the execution of the user program A. The logging setting data 42b is also stored in the memory bank 310b. However, the logging process S250 does not change the memory bank to be referenced. That is, the logging process S250 continues the logging process based on the logging setting data 42a stored in the memory bank 310a.
[0110] After the writing process of the logging setting data 42b is completed, the PLC 1 waits for a switching instruction transmitted from the support device 30. Then, upon receiving the switching instruction, the PLC 1 updates the user program (i.e., transitions from a state in which user program A is executed to a state in which user program B is executed) before the next data collection timing arrives, and switches the memory bank to be referred to by the logging process S250 from memory bank 310a to memory bank 310b. At this time, it is preferable that the update of the user program and the update of the logging setting are performed simultaneously or synchronously.
[0111] 19, at time T3, the user program executed by the program execution process S220 is switched from user program A to user program B. Also, the memory bank to be referred to by the logging process S250 is switched. Thereafter, the program execution process S220 controls the external device by executing the user program B, and the logging process S250 collects the values of variables in the user program B based on the logging setting data 42b stored in the memory bank 310b.
[0112] 20 shows an example of updating the logging setting data. In this embodiment, at time T11, the logging setting data 42a is stored in the memory bank 310a, but the memory bank 310b is empty. The logging setting data 42a is composed of setting data 1a, 2a, and 3a. Then, the PLC 1 executes the logging process according to the logging setting data 42a stored in the memory bank 310a.
[0113] Here, the user of PLC1 instructs the support device 30 to replace the setting data 1a with the setting data 1b. Then, at time T12, the support device 30 transmits the setting data 1b to PLC1, and the setting data 1b is written to the memory bank 310b. However, PLC1 continues the logging process by referring to the memory bank 310a.
[0114] At time T13, PLC 1 copies setting data 2a and 3a stored in memory bank 310a to memory bank 310b. Then, at time T14, PLC 1 changes the reference destination of logging process S250 from memory bank 310a to memory bank 310b. Thereafter, PLC 1 executes logging process according to the logging setting data (i.e., setting data 1b, 2a, 3a) stored in memory bank 310b. After that, at time T15, PLC 1 clears memory bank 310a.
[0115] Figure 21 shows an example of updating logging settings and saving collected data. In this example, PLC1 executes control cycles C1, C2, C3, etc. In each control cycle, PLC1 executes input processing (IN), program execution processing (APP), output processing (OUT), logging processing (LOG), and system processing (SYS) in that order.
[0116] In the control period C1, PLC1 executes user program A stored in memory bank 320a and executes logging processing based on the logging setting data stored in memory bank 310a. At this time, PLC1 acquires the value of the target variable from program use area 14a and writes it to data buffer 62a. In Fig. 21, data D2 representing the value of the variable acquired in control period C1 is written to data buffer 62a.
[0117] Thereafter, the new user program B is written to the memory bank 320b, and the new logging setting data is written to the memory bank 310b. Then, it is assumed that the PLC 1 receives a switching instruction shown in FIG.
[0118] In this case, in response to receiving the switching instruction, PLC1 updates the user program and switches the memory bank to be referenced before collecting data in the logging process in the next control period. That is, before the time to execute the logging process in the control period C3 arrives, the user program A is updated to the user program B, and the memory bank to be referenced is switched from the memory bank 310a to the memory bank 310b. In this way, the user program and the logging setting data are updated before the time to execute the logging process in the control period C3 arrives. However, in the control period C2, PLC1 executes the logging process based on the logging setting data stored in the memory bank 310a. As a result, the value of the target variable acquired from the program use area 14a is written to the data buffer 62a. In FIG. 21, data D3 is written to the data buffer 62a.
[0119] When the user program and logging setting data are updated as described above, the PLC 1 saves the data stored in the data buffer 62a in the external storage device 17. At this time, even if the amount of data written in the data buffer 62a has not reached a predetermined amount, the data stored in the data buffer 62a (D1 to D3 in FIG. 21) is saved in the external storage device 17. After this, the PLC 1 clears the data buffer 62a.
[0120] After the control period C3, the PLC 1 executes the user program B stored in the memory bank 320b, and executes the logging process based on the logging setting data stored in the memory bank 310b. The data collected by the logging process is written to the data buffer 62b.
[0121] In this embodiment, the data collection period related to the logging process is made up of N control periods. That is, during normal operation, when N pieces of data (D1 to DN) are stored in the logging data buffer 62, the PLC 1 stores the data in the external storage device 17. However, when the logging setting data is updated, the data stored in the logging data buffer 62 is stored in the external storage device 17 even before N pieces of data are stored in the logging data buffer 62. Therefore, data collected based on different logging settings are not mixed in one data set, and it is possible to display the data collected by logging in a way that is easy for the user to see.
[0122] In this way, when a new user program and a new logging setting are given in the PLC system 10, the PLC 1 temporarily stores the new user program and the new logging setting without immediately updating the user program and the logging setting. After that, when a switching instruction is received from the PC 2, the PLC 1 updates the user program and the logging setting before collecting data in the logging process of the next control cycle. At this time, the new user program and the new logging setting are stored in the memory of the own device, and the updating of the user program and the logging setting is completed simply by switching the reference destination, so the time required to update the user program and the logging setting is short. Therefore, data representing the values of the target variables in the new user program can be reliably collected in the logging process of the next control cycle. Therefore, the PLC 1 can update the logging setting without stopping the logging process even when updating the user program.
[0123] As described above, a technique has been proposed that enables logging without affecting the control of various devices or apparatuses. However, the conventional techniques (for example, Patent Document 1) do not propose a method for updating logging settings without stopping the logging process of a PLC. For this reason, in the conventional techniques, when changing the logging settings, the logging process must be temporarily stopped, which may interrupt the logs related to the control of various devices or apparatuses. In particular, when the control programs that control various devices or apparatuses are updated, the variables to be collected are also changed, so the logging process must be temporarily stopped, which may interrupt the logs related to the control of various devices or apparatuses.
[0124] Although the disclosed embodiments and their advantages have been described in detail above, it will be appreciated that those skilled in the art may make various modifications, additions, and omissions therein without departing from the scope of the present invention as clearly set forth in the claims. [Explanation of symbols]
[0125] 1 PLC 2 PC 3 Input / Output Module 4. Communication Module 6 Communication Cable 7 Communication Bus 10 PLC System 11, 26 Communication I / F 12, 21 CPU 13 Bus Controller 14, 22 Memory 14a Program Use Area 15 Storage device I / F 16, 27 Internal Bus 17 External storage device 23 Input Devices 24 Display device 25 Auxiliary storage 30 Support equipment 31 Program Analysis Section 32 Selection section 33 Reception 34 Setting information output section 35 Calculation section 36 Setting memory section 40 Configuration Tool 41 Project Data 42 Logging configuration data 51 Project Data Information 52 Collection operation setting information 53 Collection target setting information 61 Processing Execution Unit 62 Logging Data Buffer 62a~62n Data Buffer 63 Preservation Department 70 Logging collected data 310a, 310b memory banks 320a, 320b memory banks
Claims
1. A programmable logic controller for controlling an external device, a process execution unit that repeatedly executes a control process cycle including a program execution process for executing a control program, an output process for outputting a result of execution of the control program to control the external device, a logging process for collecting data representing values of variables used in the control program by referring to a logging setting, and a system process for managing the operation of the programmable logic controller; a plurality of program memory banks for storing said control programs; a plurality of setting data memory banks for storing the logging settings representing the operation of the logging process; a data buffer for temporarily storing data collected in the logging process; The processing execution unit is a first control program is stored in a first program memory bank among the plurality of program memory banks, and when the first control program is being executed to control the external device, a second control program is written into a second program memory bank among the plurality of program memory banks; when a first logging setting is stored in a first setting data memory bank among the plurality of setting data memory banks and a reference destination of the logging process is the first setting data memory bank, writing a second logging setting to a second setting data memory bank among the plurality of setting data memory banks; In response to receiving a switching instruction, before data representing the value of the variable is collected for the first time by the logging process after receiving the switching instruction, a reference destination of the logging process is switched from the first setting data memory bank to the second setting data memory bank in synchronization with updating of the control program from the first control program to the second control program, and the data stored in the data buffer is stored in a storage device.
1. A programmable logic controller comprising:
2. the first logging setting includes information for collecting data representing values of variables used in the first control program; The second logging configuration includes information for collecting data representing values of variables used in the second control program.
2. The programmable logic controller of claim 1.
3. After the reference destination of the logging process is switched from the first setting data memory bank to the second setting data memory bank, the process execution unit collects data representing the values of the variables in accordance with the second logging settings stored in the second setting data memory bank and stores the data in the data buffer.
2. The programmable logic controller of claim 1.
4. Even after the process execution unit writes the second logging setting to the second setting data memory bank, the process execution unit does not switch the reference destination of the logging process from the first setting data memory bank to the second setting data memory bank until the process execution unit receives the switching instruction.
2. The programmable logic controller of claim 1.
5. 1. A support device for supporting a programmable logic controller, comprising: The programmable logic controller includes: a process execution unit that repeatedly executes a control process cycle including a program execution process for executing a control program, an output process for outputting a result of execution of the control program to control an external device, a logging process for collecting data representing values of variables used in the control program by referring to a logging setting, and a system process for managing the operation of the programmable logic controller; a plurality of program memory banks for storing said control programs; a plurality of setting data memory banks for storing the logging settings representing the operation of the logging process; a data buffer for temporarily storing data collected in the logging process; The processing execution unit is a first control program is stored in a first program memory bank among the plurality of program memory banks, and when the first control program is being executed to control the external device, a second control program is written into a second program memory bank among the plurality of program memory banks; when a first logging setting is stored in a first setting data memory bank among the plurality of setting data memory banks and a reference destination of the logging process is the first setting data memory bank, writing a second logging setting to a second setting data memory bank among the plurality of setting data memory banks; in response to receiving a switching instruction, before collecting data representing values of the variables by the logging process for the first time after receiving the switching instruction, a reference destination of the logging process is switched from the first setting data memory bank to the second setting data memory bank in synchronization with updating of the control program from the first control program to the second control program, and the data stored in the data buffer is stored in a storage device; The support device includes: a program analysis unit that analyzes the control program and extracts variables used in the control program; a selection unit that selects, from among the variables extracted by the program analysis unit, target variables for which data should be collected in the logging process; a setting information output unit that creates the second logging setting including information representing the target variable selected by the selection unit and transmits the second logging setting to the programmable logic controller; After receiving a completion response indicating that the second logging setting has been received from the programmable logic controller, the switching instruction is sent to the programmable logic controller.
16. An assistance device comprising:
6. 1. A logging method for use in a programmable logic controller for controlling an external device, comprising: repeatedly executing a control processing cycle including a program execution process for executing a control program, an output process for outputting the execution result of the control program and controlling the external device, a logging process for collecting data representing the values of variables used in the control program by referring to a logging setting and writing the data to a data buffer, and a system process for managing the operation of the programmable logic controller; a first control program is stored in a first program memory bank among a plurality of program memory banks, and when the first control program is being executed to control the external device, a second control program is written into a second program memory bank among the plurality of program memory banks; when a first logging setting is stored in a first setting data memory bank among a plurality of setting data memory banks and the logging process refers to the first setting data memory bank, writing a second logging setting to a second setting data memory bank among the plurality of setting data memory banks; In response to receiving a switching instruction, before data representing the value of the variable is collected for the first time by the logging process after receiving the switching instruction, a reference destination of the logging process is switched from the first setting data memory bank to the second setting data memory bank in synchronization with updating of the control program from the first control program to the second control program, and the data stored in the data buffer is stored in a storage device. A logging method comprising:
Citation Information
Patent Citations
Program generation device, control method for program generation device, control program, and recording medium
JP2020057332A
Program and programmable logic controller
JP2023110263A
Programmable logic controller, support device, and display device, and, logging method, support method, and display method
JP2023167381A
Support device and support method
JP2023168185A
Programmable logic controller, support device, and display device, as well as logging method, support method, and display method
JP7188631B1
Cited By
Log data processing device, log data processing system, log data processing method and program
JP7796949B1
Logging device, logging system, logging method, and program
JP7906158B1
