Programmable logic controller, support device, and logging method

The programmable logic controller and support device facilitate updating logging settings in PLCs without stopping the logging process, ensuring continuous data collection and management of variables in factory automation.

JP2026003159AActive Publication Date: 2026-01-13FUJI ELECTRIC CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
JP2024100950
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2026-01-13
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

Existing methods for updating logging settings in programmable logic controllers (PLCs) require stopping the logging process, which is undesirable in factory automation scenarios.

Method used

A programmable logic controller and support device that allow updating logging settings without stopping the logging process by using multiple memory banks and synchronized switching of logging settings with control program updates, along with an assistance device for analyzing and configuring logging settings.

Benefits of technology

Enables continuous logging without interrupting the PLC's operation, ensuring uninterrupted data collection and management of variables used in control programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026003159000001_ABST
    Figure 2026003159000001_ABST
Patent Text Reader

Abstract

To update logging setting without stopping logging processing of a PLC.SOLUTION: A programmable logic controller (PLC) for controlling an external device repeatedly executes a control processing cycle including logging processing. The PLC includes a plurality of memory banks for storing the logging configuration and a data buffer for temporarily storing data collected in the logging process. When the first logging configuration is stored in the first memory bank and the reference destination of the logging processing is the first memory bank, the second logging configuration is written in the second memory bank. When a switching instruction of logging setting is received, before collecting data by the next logging processing, a reference destination of the logging processing is switched from the first memory bank to the second memory bank in synchronization with update of the control program, and the data stored in the data buffer is stored in the storage device.SELECTED DRAWING: Figure 11
Need to check novelty before this filing date? Find Prior Art

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, etc., by executing application programs such as ladder programs. There is a demand for recording logs related to the control of various devices or equipment and being able to refer to them as needed. To address this demand, a technology has been proposed that enables logging without affecting the control of various devices or equipment (see, 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 is sometimes 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 prior art has not proposed a method for updating the logging settings without stopping the PLC's logging process.

[0005] An object of one aspect of the present invention is to provide an apparatus and method that can update 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 that executes a control program, an output process that outputs the execution results of the control program to control an external device, a logging process that refers to a logging setting and collects data representing values ​​of variables used in the control program, and a system process that manages the operation of the programmable logic controller, a plurality of program memory banks that store the control program, a plurality of setting data memory banks that store logging settings that represent the operation of the logging process, and a data buffer that temporarily stores data collected in the logging process. The process execution unit writes a second control program to 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 the logging process references the first setting data memory bank. In response to receiving an instruction to switch the logging settings, the processing execution unit switches the reference destination 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 value of a variable 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] According to one aspect of the present invention, an assistance device assists the 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 from the programmable logic controller indicating that the second logging setting has been received, the assistance device transmits a switching instruction to the programmable logic controller. [Effects of the Invention]

[0008] According to the above-described aspect, it is possible to update the logging settings without stopping the logging process of the PLC. [Brief explanation of the drawings]

[0009] [Figure 1] FIG. 1 is a diagram illustrating an example of the configuration of a PLC system. [Figure 2] FIG. 10 illustrates an example of a control process executed by a PLC. [Figure 3] FIG. 1 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. [Figure 5] FIG. 2 illustrates an example of a functional configuration of the support device. [Figure 6] FIG. 10 illustrates an example of a method for creating a logging configuration. [Figure 7] FIG. 10 is a diagram illustrating an example of a UI screen used in the collection target setting process. [Figure 8] FIG. 10 is a diagram illustrating an example of logging setting data. [Figure 9] FIG. 10 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. 10 illustrates an example of a logging process executed by a PLC. [Figure 12] 10 is a flowchart illustrating an example of a logging process and a saving process. [Figure 13] FIG. 2 is a diagram illustrating an example of a data structure of logging collection data. [Figure 14] FIG. 2 is a diagram illustrating an example of a data structure of collected data. [Figure 15] 10 is a flowchart illustrating an example of a collection process. [Figure 16] FIG. 10 is a sequence diagram illustrating an example of a procedure for updating a user program and logging settings. [Figure 17] FIG. 10 is a diagram illustrating an outline of a method for updating logging settings in a PLC. [Figure 18] FIG. 10 is a diagram illustrating an example of logging setting data written to a PLC. [Figure 19] FIG. 10 is a diagram illustrating an update of logging settings. [Figure 20] FIG. 10 is a diagram illustrating an example of updating logging setting data. [Figure 21] FIG. 10 is a diagram illustrating an example of updating logging settings and saving collected data. DETAILED DESCRIPTION OF THE INVENTION

[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 functions 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 external devices. In the following description, a user application program may be referred to as a "user program."

[0012] The user program is created using, for example, a ladder language that complies with IEC (International Electrotechnical Commission) 61131-3. Alternatively, the user program may be created using a graphical programming language such as a motion program in a flowchart format, such as a sequential function chart (SFC). Alternatively, the user program may be created using a high-level programming language, such as C.

[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 modules 3 and the communication modules 4 are preferably detachable from the PLC system 10. The input / output modules 3 and the communication modules 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 the function of converting signals from a servo amplifier, encoder, or 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 the data as history.

[0018] The system processing maintains the proper operation of the PLC 1 by managing the operation of the PLC 1. The system processing also includes the processing of writing user programs and logging setting data to the memory in the PLC 1.

[0019] PLC1 executes logging processing after output processing in each control cycle so as not to interfere with the execution of user programs. The control cycle is the sum of the execution periods of input processing, program execution processing, output processing, logging processing, and system processing. Therefore, when a control cycle is specified, the execution period of logging processing 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 logging processing may be adjustable by changing the proportions of the execution periods allocated to program execution processing, logging processing, and system processing.

[0020] In this way, the logging process is set without affecting the execution of processes related to the user program and device control (input process, program execution process, and output process). Therefore, the PLC 1 can collect the desired amount of variable values. That is, the PLC 1 can appropriately collect data representing the values ​​of variables used in device control.

[0021] Fig. 3 shows an example of the hardware configuration of PLC 1. As shown in Fig. 3, 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 also 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, and a logging execution program. 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 where 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 PC 2. As shown in Fig. 4, PC 2 includes a CPU 21, memory 22, input device 23, display device 24, auxiliary storage device 25, and communication I / F 26. All of these components are hardware, connected to an internal bus 27, and can transmit data between them.

[0025] The CPU 21 provides, for example, a function for editing a user program and a function for creating logging settings that indicate conditions for executing logging processing 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 PLC 1 is set by a support device. This support device is realized by PC 2 shown in Fig. 1 or 4 executing a predetermined setting tool program. In other words, the functions of this support device are provided by PC 2.

[0028] FIG. 5 shows an example of the functional configuration of the support device 30. The support device 30 sets the conditions for executing the logging process in PLC 1. That is, the support device 30 creates logging settings to be referenced by PLC 1 and provides them to 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. Note that the support device 30 may further include other functions not shown in FIG. 5. It is also assumed that a control period for causing PLC 1 to perform the control process 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 times the length of the control cycle (N is an integer equal to or greater than 2). The setting information output unit 34 outputs information representing multiple collection target variables and information representing the collection period as setting information. Note that in the following description, 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 logging processing based on the setting information output from the support device 30. At this time, the PLC 1 may distribute 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 that constitutes the collection cycle.

[0031] The calculation unit 35 determines the number of control periods for collecting values ​​of each of the plurality of target variables based on the collection period and the control period. Then, the calculation unit 35 calculates the amount of data of the variable values ​​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 the conditions for executing the logging process. That is, logging settings are stored in the setting storage unit 36. These settings are stored in the auxiliary storage device 25, for example.

[0033] The support device 30 having the above-described functions makes it possible to update the logging settings without stopping the logging process that collects the 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 devices.

[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, user programs executed by the PLC 1, and information related to function settings of the input / output module 3 and 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 by executing a predetermined project data editing program on the PC 2, for example, 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. 5.

[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. Furthermore, in the collection target setting process S110, target variables (i.e., variables to be collected by the logging process executed by 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. 4, the UI screen 100 is displayed by the display device 24.

[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 displayed 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 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. Note that when the user selects one or more names from the names of the target variables displayed in the target variable display section 103 and presses the cancel button 105, the selected variables are excluded from the selection results of the target variables.

[0044] When the user presses the batch registration button 106, all variables displayed in the extracted variable display area 102 are selected as target variables, and their names are displayed in the target variable display area 103. On the other hand, when the user presses the batch release button 107, all variables displayed in the target variable display area 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 logging processes are 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 processing, program execution processing, output processing, and system processing within one cycle of the control processing executed by PLC1 can be calculated from the project data 41. Furthermore, in the collection target setting process S110, the execution time of the logging processing when the logging processing is executed for the selected target variables 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 processing executed by PLC1. This sum is displayed in the estimated control period display section 109 on 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. This information sets in the PLC 1, for example, the timing for collecting the values ​​of the target variables that are the data to be collected, the period for collecting the data, the timing for saving the collected data in the external storage device 17, etc.

[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 control processing executed by PLC 1 are calculated based on the project data 41. The sum of these execution times is then subtracted from a preset control cycle. The time obtained by this subtraction is the time available for logging processing, 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. This maximum size is then compared with the total data volume calculated in S110 (the value displayed in the collected data size display section 108 on the UI screen 100).

[0050] If the total data volume exceeds the maximum size, it is determined that it is not possible to collect the values ​​of all target variables in one cycle of control processing (i.e., only the values ​​of some 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 specifying the target variable selected in S110 and the operation setting information for the logging process set in S120 are output as logging setting data 42. The logging setting data 42 is sent to PLC 1. PLC 1 executes the logging process based on the contents of the logging setting data 42. In the setting file input / output process S140, the setting tool 40 can also acquire 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 that identifies a user program to be executed by the PLC 1, and includes, for example, information such as the name given to the object code obtained by compiling the user program, the date and time of the compilation, etc. The project data information 51 may be 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 saves 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 saved.

[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 time of data collection. The collection target setting information 53 also includes information indicating the number of target variables for which data is to be 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 identifies 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 the 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 PLC 1. In the example shown in Fig. 10, PLC 1 includes a processing execution unit 61, a logging data buffer 62, and a storage unit 63. It is assumed that the control cycle for performing the above-mentioned control processing is set in advance by the user in 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 that stores collected data, which associates the data collection time by the logging process S250 with the value of the target variable collected at that data collection time, each time the value of the target variable is collected. In the hardware configuration example shown in Figure 3, the logging data buffer 62 is configured using a part of the storage area of ​​the memory 14.

[0063] The logging process S250 may include a process for determining whether 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 suspending collection of target variable values ​​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. In this case, the logging process S250 may include a process for discarding collected data, including the variable values ​​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. In this case, the processing execution unit 61 provided by the CPU 12 may control the storage device I / F 15 as part of the logging process S250.

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

[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 results are output by the output process S230 for controlling external devices. In the example hardware configuration shown in FIG. 3, the CPU 12 that executes 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 usage 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. It is assumed that the logging setting data 42, which includes information about the target variables and operation setting information for the logging process, has been created in the support device 30 (PC2) and provided to the PLC 1 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 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 indicated by the collection operation setting information 52 included in the logging setting data 42. Furthermore, in response to the detection of the arrival of the save timing, the save process S280 controls the storage device I / F 15 to read out the collected data stored in the logging data buffer 62. The save process S280 then saves the read collected data in the external storage device 17. The save destination is indicated by the collection operation setting information 52.

[0071] 12 is a flowchart showing an example of the logging process S250 and the saving 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. If the arrival of collection timing has been detected (S251: Yes), collection processing is performed in S252. The collection processing includes processing for collecting values ​​of each target variable and processing for saving the collected values ​​in the logging data buffer 62 as collected data 73, which will be described later. Details of this collection processing will be described later. On the other hand, if the arrival of collection timing has not been detected (S251: No), the processing shown in FIG. 12 ends.

[0073] In S281, the saving unit 63 determines whether the saving timing has arrived. The saving timing is represented by the collection operation setting information 52 included in the logging setting data 42. If the saving timing has arrived (S281: Yes), the processing of the saving unit 63 proceeds to S282. On the other hand, if the saving 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 collection data 70. The logging collection data 70 includes project data information 51, the number of collected data 71, the collected data size 72, and one or more collected data 73.

[0076] The project data information 51 is information that identifies a user program executed by 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 at which 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 times indicated by the timestamp information.

[0079] In this way, 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. The logging collection data 70 is then stored in the external storage device 17.

[0080] 12 is completed, the CPU 12 saves 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 timestamp, and then writes the acquired timestamp into the logging data buffer 62 as the data at the beginning of the collected data 73.

[0083] In S254, the processing execution unit 61 acquires the current value of each target variable, and then writes the acquired values ​​as variable data into the logging data buffer 62 in a predetermined order associated with each target variable.

[0084] The value of the target variable is held at a predetermined location in the program usage area 14a. This location is identified based on the information about the memory type, data type, memory address, and data size for the target variable contained 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 location 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 target variables have been collected (S255: Yes), the collection process ends. On the other hand, if there are 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 target variables have been acquired and saved to 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 PLC 1 may be updated. In this case, the values ​​of variables in the new user program are collected, so the settings for the logging process executed by PLC 1 must also be updated. Even if the user program executed by PLC 1 is not updated, updating the settings for the logging process may be required. However, it is preferable that the PLC 1, which controls manufacturing equipment, conveyance equipment, inspection equipment, etc. in factory automation, be able to continue logging processing. Therefore, the PLC system 10 according to an embodiment of the present invention has a function for updating the logging settings of PLC 1 without stopping the logging process by PLC 1.

[0087] 16 is a sequence diagram showing an example of a procedure for updating a user program and logging settings. The user program is installed in PLC 1 by the support device 30. PLC 1 also executes logging processing in accordance with the logging settings provided by the support device 30.

[0088] In S301, the support device 30 transmits a new user program to be executed by PLC1 to PLC1. That is, the support device 30 writes the new user program to PLC1. PLC1 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, PLC1 transmits a completion response indicating that the new user program has been received and saved to the support device 30. If PLC1 fails to write the new user program, 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 a failure response or a timeout, it does not execute any further processing.

[0090] Upon receiving the completion response in 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 then selects target variables from the extracted variables. The support device 30 then creates logging settings that include 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 a failure response or a timeout, it does not execute subsequent processing.

[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 settings in use to the new logging settings.

[0094] In S306, in response to the switching instruction, PLC 1 updates the running user program to the new user program and updates the logging settings in use to the new logging settings. The method for updating the logging settings will be described in detail later. Then, when updating of the user program and the logging settings is completed, PLC 1 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 middle.

[0095] When a user program is compiled by the support device 30, the instruction execution code used in the user program changes, which may change the addresses indicating variables. Furthermore, if the logging settings are updated after the user program is updated, addresses based on the logging setting data may be assigned to different variables before and after the user program update, which may result in failure to collect the intended logging targets. Therefore, in an 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 accordance with the switching instruction.

[0096] Fig. 17 is a diagram illustrating an outline of a method for updating logging settings in PLC 1. Memory 310 is a storage area for saving logging setting data, and is realized by memory 14 shown in Fig. 3. Memory 310 includes multiple 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] PLC 1 receives logging setting data from the support device 30. Then, in system processing S240, PLC 1 stores the received logging setting data in one of the memory banks 310a, 310b. Here, for example, if logging setting data has already been stored in memory bank 310a, new logging setting data is written to 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, which 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 that the collection process S312 should refer to when the collection timing arrives. At this time, the logging setting management process S311 may provide information indicating the memory banks 310a, 310b that should be referred to when the collection timing arrives to the collection process S312. Note that the information managed by the logging setting management process S311 includes the 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 in accordance with 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 usage area 14a shown in Fig. 11 in accordance with 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 where data collected in the logging process should be written. Here, the logging data buffer 62 includes multiple data buffers 62a to 62n. In this case, the buffer management process S313 manages the data buffers 62a to 62n where 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 has been 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 has not been stored in the data buffer, the storage unit 63 reads the collected data from the data buffer and stores it in the external storage device 17 when the logging settings are updated.

[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 to the PLC 1 from the support device 30 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 in accordance with the logging setting data saved in the memory bank 310a.

[0106] 16 is received from the support device 30, the PLC 1 updates the user program with a new user program and switches the memory bank to be referenced from memory bank 310a to memory bank 310b. The memory bank switching process is performed, for example, by logging setting management process S311. Furthermore, 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 target variables through logging processing for the first time after receiving the switching command. In collection process S312, the PLC 1 executes logging processing in accordance with the new logging setting data stored in memory bank 310b.

[0107] 19 is a diagram illustrating updating of logging settings. PLC1 includes a memory area for storing user programs. This memory area includes multiple program memory banks. In this embodiment, PLC1 includes memory banks 320a and 320b as program memory banks.

[0108] At time T1, user program A is added to memory bank 320a. At this time, no user program is stored in memory bank 320b. After time T1, the program execution process S220 controls an external device (not shown) by executing user program A stored in memory bank 320a. Also, at time T1, logging setting data (Config_Data) 42a is written to memory bank 310a. At this time, no logging setting data is stored in memory bank 310b. After time T1, the logging process S250 executes the logging process by referring to the logging setting data 42a stored in memory bank 310a.

[0109] At time T2, the support device 30 provides the PLC 1 with a new user program B and new logging setting data 42b. The logging setting data 42b includes information for collecting data representing the 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 to execute 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 to be sent 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 being executed to a state in which user program B is being executed) before the next data collection timing arrives, and switches the memory bank to be referenced by the logging process S250 from memory bank 310a to memory bank 310b. At this time, it is preferable that the updating of the user program and the updating 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 referenced by the logging process S250 is switched. Thereafter, the program execution process S220 controls the external device by executing user program B, and the logging process S250 collects the values ​​of variables in user program B based on the logging setting data 42b stored in memory bank 310b.

[0112] 20 shows an example of updating logging setting data. In this example, at time T11, logging setting data 42a is stored in memory bank 310a, but memory bank 310b is empty. Logging setting data 42a is composed of setting data 1a, 2a, and 3a. PLC 1 then executes logging processing in accordance with the logging setting data 42a stored in 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. Subsequently, at time T14, PLC 1 changes the reference destination of logging process S250 from memory bank 310a to 310b. Thereafter, PLC 1 executes logging process according to the logging setting data stored in memory bank 310b (i.e., setting data 1b, 2a, and 3a). Thereafter, 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 control cycle C1, PLC 1 executes user program A stored in memory bank 320a and performs logging processing based on the logging setting data stored in memory bank 310a. At this time, PLC 1 obtains the values ​​of target variables from program usage area 14a and writes them to data buffer 62a. In Figure 21, data D2 representing the values ​​of the variables obtained in control cycle C1 is written to data buffer 62a.

[0117] After that, 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 the switching instruction shown in FIG.

[0118] In this case, upon receiving the switching instruction, PLC 1 updates the user program and switches the memory bank to be referenced before collecting data in the logging process in the next control cycle. That is, before the time to execute the logging process in control cycle C3 arrives, user program A is updated to user program B, and the memory bank to be referenced is switched from memory bank 310a to memory bank 310b. In this way, the user program and logging setting data are updated before the time to execute the logging process in control cycle C3 arrives. However, in control cycle C2, PLC 1 executes the logging process based on the logging setting data stored in memory bank 310a. As a result, the value of the target variable acquired from the program usage 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 saved in the data buffer 62a in the external storage device 17. At this time, even if the number of pieces of data written in the data buffer 62a has not reached a predetermined number, the data saved 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 control period C3, PLC 1 executes user program B stored in memory bank 320b and performs logging processing based on the logging setting data stored in memory bank 310b. Data collected by the logging processing is written to data buffer 62b.

[0121] In this embodiment, the data collection cycle for the logging process is made up of N control cycles. That is, during normal operation, when N pieces of data (D1 to DN) are saved in the logging data buffer 62, the PLC 1 saves the data in the external storage device 17. However, when the logging setting data is updated, the data saved in the logging data buffer 62 is saved in the external storage device 17 even before N pieces of data are saved in the logging data buffer 62. Therefore, data collected based on different logging settings are not mixed in one data set, and the data collected by logging can be displayed in an easy-to-view format for the user.

[0122] In this way, when a new user program and new logging settings are provided in the PLC system 10, PLC 1 temporarily saves the new user program and new logging settings without immediately updating them. After that, upon receiving a switching instruction from PC 2, PLC 1 updates the user program and logging settings before collecting data in the logging process for the next control cycle. Since the new user program and new logging settings are stored in the memory of the PLC 1's own device, updating the user program and logging settings is completed simply by switching the reference destination, so the time required to update the user program and logging settings is short. Therefore, data representing the values ​​of target variables in the new user program can be reliably collected in the logging process for the next control cycle. Therefore, even when updating the user program, PLC 1 can update the logging settings without stopping the logging process.

[0123] As mentioned above, a technology has been proposed that enables logging without affecting the control of various devices or apparatuses. However, conventional technology (for example, Patent Document 1) does not propose a method for updating logging settings without stopping the PLC logging process. As a result, when changing logging settings with conventional technology, the logging process must be temporarily stopped, which can interrupt 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, which means that the logging process must be temporarily stopped, which can interrupt logs related to the control of various devices or apparatuses.

[0124] While the disclosed embodiments and their advantages have been described in detail above, those skilled in the art may make various modifications, additions, and omissions without departing from the scope of the invention as clearly set forth in the claims. [Explanation of symbols]

[0125] 1 PLC 2 PC 3 Input / Output Modules 4. Communication Module 6 Communication Cable 7 Communication Bus 10 PLC Systems 11, 26 Communication I / F 12, 21 CPUs 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 Unit 32 Selection section 33 Reception Department 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 buffers 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 processing execution unit that repeatedly executes a control processing cycle including a program execution process that executes a control program, an output process that outputs the execution result of the control program and controls the external device, a logging process that refers to a logging setting and collects data representing values ​​of variables used in the control program, and a system process that manages the operation of the programmable logic controller; a plurality of program memory banks for storing the control programs; a plurality of setting data memory banks for storing the logging settings representing the operation of the logging process; a data buffer that temporarily stores data collected in the logging process; The processing execution unit 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 to 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 the 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 the value of the variable by the logging process for the first time after receiving the switching instruction, the 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 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 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 setting 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 writing the second logging setting to the second setting data memory bank, the processing 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 switching instruction is received.

2. The programmable logic controller of claim 1.

5. 1. A support device for supporting a programmable logic controller, comprising: The programmable logic controller a processing execution unit that repeatedly executes a control processing cycle including a program execution process that executes a control program, an output process that outputs the execution result of the control program and controls an external device, a logging process that refers to a logging setting and collects data representing values ​​of variables used in the control program, and a system process that manages the operation of the programmable logic controller; a plurality of program memory banks for storing the control programs; a plurality of setting data memory banks for storing the logging settings representing the operation of the logging process; a data buffer that temporarily stores data collected in the logging process; The processing execution unit 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 to 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 the 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, switching the reference destination of 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, and saving the data saved in the data buffer 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 target variables for which data should be collected in the logging process from among the variables extracted by the program analysis unit; 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.

1. A support device comprising:

6. 1. A logging method used in a programmable logic controller that controls 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 results 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 logging settings 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 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 the value of the variable by the logging process for the first time after receiving the switching instruction, the 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 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

    JP7375977B1