Programmable logic controller, control method, and recording medium
By employing a dual-memory structure and control method in the PLC, the execution of the program before the rewrite is not stopped during program updates, thus solving the execution stagnation problem caused by program updates and improving the debugging efficiency and stability of the PLC.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MITSUBISHI ELECTRIC CORP
- Filing Date
- 2023-03-14
- Publication Date
- 2026-07-10
AI Technical Summary
During the development of programmable logic controller (PLC) programs, program updates can cause excessively long pauses in program execution, affecting debugging efficiency.
It adopts a dual memory structure, including a first and a second program storage memory and a first and a second program execution memory. Through program write control and undo control, the updated program can switch to the second program execution memory without stopping the execution of the program before the rewrite.
It shortens the execution stop time during program updates, avoids control timing deviations and malfunctions, and improves the stability and debugging efficiency of the PLC.
Smart Images

Figure CN120457401B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to programmable logic controllers, control methods, and recording media storing programs. Background Technology
[0002] Traditionally, program development involves debugging—a process of detecting and correcting errors and malfunctions in the created program. In the development of Programmable Logic Controller (PLC) programs, programmers simultaneously run the PLC using the created program, verifying its actions. If any issues arise, the program is corrected and written back to the PLC. This process of verifying actions, correcting the program, and writing back continues until the PLC functions correctly. Therefore, if the PLC is stopped each time a corrected program is written, the debugging time increases. This necessitates a technique that allows the corrected program to be written while maintaining continuous PLC operation as much as possible.
[0003] Patent Document 1 discloses a PLC instrument capable of rewriting a saved program during operation. In Patent Document 1, the PLC instrument includes: a first memory consisting of non-volatile flash memory for storing the program; a second memory consisting of non-volatile flash memory for backing up the first memory; and a third memory consisting of volatile RAM (Random Access Memory) used during program execution. Furthermore, in Patent Document 1, the PLC instrument writes the program rewritten during operation to the second memory. If the write is successful, the written program is copied to the first memory, and then the program is further expanded in the third memory and started.
[0004] Patent Document 1: Japanese Patent Application Publication No. 2004-272629 Summary of the Invention
[0005] In the PLC apparatus described in Patent Document 1, the previously executed program in the third memory is overwritten with the rewritten program before startup. Therefore, in the PLC apparatus described in Patent Document 1, if the rewritten program begins to be expanded, the execution of the previously executed program stops, resulting in the following problem: during the period from the start of the expansion of the rewritten program to the start of startup, the execution of the program is stopped.
[0006] This invention is proposed in view of the above-mentioned actual situation, and its purpose is to shorten the time when the program execution stops when rewriting the program.
[0007] To achieve the above objectives, the programmable logic controller of the present invention includes: a program storage memory capable of storing a program; a program execution memory used when executing the program; a program unpacking control unit that controls the unpacking of the program stored in the program storage memory to the program execution memory; a program execution unit that executes the program unpacked to the program execution memory; and a program writing control unit that controls the writing of an update program (i.e., an update program) that is updated while the program is being executed to the program storage memory. Furthermore, the program storage memory includes a first program storage memory and a second program storage memory different from the first program storage memory, and the program execution memory includes a first program execution memory and a second program execution memory different from the first program execution memory. Additionally, when the program writing control unit sets the program storage memory used for unpacking the currently executing program as the first program storage memory, it stores the update program in the second program storage memory. When the program unpacking control unit sets the program execution memory that has unpacked the currently executing program as the first program execution memory, and the update program is successfully stored in the second program storage memory, it unpacks the update program from the second program storage memory to the second program execution memory. Furthermore, the programmable logic controller also has an update program switching control unit, which performs switching control to enable the program execution unit to execute an update program that has been expanded to the second program execution memory when the program execution unit is executing a program that has been expanded to the first program execution memory.
[0008] The effects of the invention
[0009] According to the present invention, the programmable logic controller expands the update program to a second program execution memory that is not currently used for program execution. Therefore, the programmable logic controller of the present invention can continue executing the original program even after the update program expansion begins. Furthermore, according to the present invention, after the update program expansion is completed, the programmable logic controller switches the program execution memory used for program execution from the first program execution memory to the second program execution memory. Therefore, compared to a programmable logic controller that does not switch the program execution memory from the first program execution memory to the second program execution memory, the programmable logic controller of the present invention can quickly switch from executing the original program to executing the updated program. As a result of these methods, the programmable logic controller of the present invention can shorten the time that program execution is interrupted during program rewriting. Attached Figure Description
[0010] Figure 1 This is a block diagram illustrating the structure of the program development support system involved in Implementation Method 1.
[0011] Figure 2It is a block diagram representing the functional structure of a program development support system.
[0012] Figure 3 It is a block diagram representing the hardware structure of the PLC and engineering design tools.
[0013] Figure 4 This is a diagram illustrating an example of the process from the receiving program to storing the management table.
[0014] Figure 5 This is a diagram illustrating an example of the processing from receiving the updater's data to storage.
[0015] Figure 6 This is a diagram illustrating an example of the process from launching the update procedure to storing the management table.
[0016] Figure 7 This is a flowchart illustrating the process of switching control procedures during the update process.
[0017] Figure 8 This is a diagram illustrating an example of the process from synchronizing the program's execution memory to launching the second update procedure.
[0018] Figure 9 This is a diagram illustrating an example of the process from launching the second update program without synchronizing the program's execution memory to launching the unupdated program. Detailed Implementation
[0019] Hereinafter, the programmable logic controller, control method, and program according to embodiments of the present invention will be described in detail with reference to the accompanying drawings. Furthermore, the same or corresponding parts in the drawings will be labeled with the same reference numerals. Additionally, "programmable logic controller" will be referred to as "PLC" below.
[0020] (Regarding the program development support system 1)
[0021] The program development assistance system 1 according to the embodiments of the present invention is a system that assists in program development by performing debugging operations. For example... Figure 1 As shown, the program development support system 1 includes: a PLC 100, which executes programs; and an engineering design tool 200, which generates and updates programs. The PLC 100 and the engineering design tool 200 are connected via a network capable of sending and receiving information.
[0022] In the program development assistance system 1, the engineering design tool 200 sends the program generated by the programmer (user) to the PLC 100. The PLC 100 stores, expands, and executes the received program. Additionally, the user verifies the actions of the PLC 100 executing the program. If any issues are found, the program is corrected or updated. The engineering design tool 200 then sends the updated program (the updated program) to the PLC 100, which stores, expands, and executes it. Furthermore, the program development assistance system 1 repeatedly performs the user-verified actions, program corrections and updates, sending the updated program from the engineering design tool 200, and receiving, storing, expanding, and executing the program from the PLC 100, until the PLC 100 operates correctly. In this way, the program development assistance system 1 assists with program debugging and development.
[0023] (About PLC 100)
[0024] like Figure 2 As shown, the PLC 100 includes a program receiving unit 110 for receiving programs. Additionally, the PLC 100 includes a program storage memory 120 for storing programs, a program execution memory 130 for use during program execution, and a management information storage unit 140 for storing management information, i.e., management information, for managing program execution. The program storage memory 120 includes a first program storage memory 121 and a second program storage memory 122. The program execution memory 130 includes a first program execution memory 131 and a second program execution memory 132. The management information storage unit 140 includes a first management information storage unit 141 and a second management information storage unit 142.
[0025] Furthermore, the PLC 100 includes a program storage management unit 151 that manages the program storage memory 120, a program execution management unit 152 that manages the program execution memory 130, and a management information storage management unit 153 that manages the management information storage unit 140. Additionally, the PLC 100 includes a program write control unit 154 that controls program writing, a program expansion control unit 155 that controls program expansion, and a management information generation unit 156 that generates management information. Furthermore, the PLC 100 includes a program execution unit 157 that executes programs, and an update program switching control unit 158 that controls switching to the updated program.
[0026] (Regarding Engineering Design Tools 200)
[0027] like Figure 2As shown, the engineering design tool 200 includes a program generation unit 210 for generating programs, a program storage unit 220 for storing programs, and a program sending unit 230 for sending programs. The program generation unit 210 includes a compiler execution unit 211 for compiling programs.
[0028] (Regarding the hardware structure of PLC 100)
[0029] like Figure 3 As shown, the PLC 100 has a control unit 51 that executes processing according to the control program 59. The control unit 51 has a CPU (Central Processing Unit). The control unit 51, according to the control program 59, acts as... Figure 2 The program storage management unit 151, program execution management unit 152, management information storage management unit 153, program writing control unit 154, program expansion control unit 155, management information generation unit 156, program execution unit 157, and program update switching control unit 158 shown are in operation.
[0030] return Figure 3 The PLC 100 has a main storage unit 52 used as the operating area of the control unit 51 for loading control programs 59. The main storage unit 52 has volatile memory such as RAM. The main storage unit 52 serves as... Figure 2 The program execution memory 130, the first program execution memory 131, the second program execution memory 132, the management information storage unit 140, the first management information storage unit 141, and the second management information storage unit 142 shown are functional.
[0031] return Figure 3 The PLC 100 has an external storage unit 53 for pre-storing the control program 59. The external storage unit 53, according to the instructions of the control unit 51, supplies the information stored in the program to the control unit 51 and stores the data supplied from the control unit 51. The external storage unit 53 may be a non-volatile memory such as flash memory, HDD (Hard Disk Drive), or SSD (Solid State Drive). The external storage unit 53 serves as... Figure 2 The program storage memory 120, the first program storage memory 121, and the second program storage memory 122 shown are functional.
[0032] return Figure 3 The PLC 100 has an operation unit 54 operated by the user. Input information is supplied to the control unit 51 via the operation unit 54. The operation unit 54 has information input components such as a keyboard, mouse, and touch panel.
[0033] In addition, the PLC 100 has a display unit 55 that displays information input via the operation unit 54 and information output via the control unit 51. The display unit 55 may be a display device such as an LCD (Liquid Crystal Display) or an organic EL (Electro-Luminescence) display.
[0034] In addition, the PLC 100 has a transceiver unit 56 for transmitting and receiving information. The transceiver unit 56 includes information communication components such as a communication network terminal device and a wireless communication device that are connected to a network. The transceiver unit 56 serves as... Figure 2 The program receiving unit 110 shown is in operation.
[0035] return Figure 3 In PLC 100, the main storage unit 52, external storage unit 53, operation unit 54, display unit 55 and transceiver unit 56 are all connected to the control unit 51 via internal bus 50.
[0036] The PLC 100 utilizes the main storage unit 52, external storage unit 53, operation unit 54, display unit 55, and transceiver unit 56 as resources through the control unit 51, thereby achieving... Figure 2 The functions of the above-described parts 110, 120-122, 130-132, 140-142, and 151-158 are as follows. For example, the PLC 100 executes a program receiving step performed by the program receiving unit 110 and a program storage management step, which is an example of a program storage determination step performed by the program storage management unit 151.
[0037] Additionally, for example, PLC 100 executes a program execution management step, as an example of a program execution determination step, performed by program execution management unit 152, and a management information storage management step, as an example of a management information storage determination step, performed by management information storage management unit 153. Additionally, for example, PLC 100 executes a program writing control step performed by program writing control unit 154, a program expansion control step performed by program expansion control unit 155, and a management information generation step performed by management information generation unit 156. Additionally, for example, PLC 100 executes a program execution step performed by program execution unit 157 and an update program switching control step performed by update program switching control unit 158.
[0038] (Regarding the hardware structure of Engineering Design Tool 200)
[0039] In addition, such as Figure 3 As shown, the engineering design tool 200, like the PLC 100, has a control unit 51, a main storage unit 52, an external storage unit 53, an operation unit 54, a display unit 55, and a transceiver unit 56. The control unit 51 operates according to the control program 59. Figure 2 The program generation unit 210 and the compilation and execution unit 211 shown in the diagram are functioning, the external storage unit 53 functions as the program storage unit 220, and the transceiver unit 56 functions as the program sending unit 230. (Return) Figure 3 The engineering design tool 200 utilizes the main storage unit 52, external storage unit 53, operation unit 54, display unit 55, and transceiver unit 56 as resources through the control unit 51, thereby achieving... Figure 2 The functions of the aforementioned parts 210, 211, 220, and 230 are as follows. For example, the engineering design tool 200 performs the program generation step by the program generation unit 210, the compilation and execution step by the compilation and execution unit 211, and the program sending step by the program sending unit 230.
[0040] (Details regarding the functional structure of Engineering Design Tool 200)
[0041] return Figure 2 When the user performs a program description operation using the operation unit 54, the program generation unit 210 describes the program. Here, the program description format includes not only character data but also graphical data. For example, regarding the program description format, if it is ST language, it is source code; if it is ladder logic language, it is a ladder diagram. Furthermore, when the user performs a program compilation operation using the operation unit 54, the program generation unit 210 causes the compilation execution unit 211 to compile the program. Additionally, the program generation unit 210 causes the program storage unit 220 to store the source file of the generated program and the executable file of the compiled program.
[0042] The program sending unit 230 sends the executable file of the program stored in the program storage unit 220 to the PLC 100. Furthermore, when the PLC 100 executes the executable file of the program received from the engineering design tool 200, the user sometimes determines that there is a problem with the operation of the PLC 100 and corrects or updates the program. In this case, the program generation unit 210 generates an updated program, namely the source file and executable file of the updated program, and stores it in the program storage unit 220. Then, the program sending unit 230 sends the executable file of the updated program stored in the program storage unit 220 to the PLC 100.
[0043] (Details about the functional structure of PLC 100)
[0044] The program receiving unit 110 receives the program's executable file from the engineering design tool 200. Additionally, if the user modifies or updates the program during its execution, the program receiving unit 110 receives an updated program's executable file from the engineering design tool 200. Hereinafter, the program's executable file will be referred to simply as "the program," and the updated program's executable file will be referred to simply as "the updated program."
[0045] In this embodiment, the first program execution memory 131 is composed of a first volatile memory, and the second program execution memory 132 is composed of a second volatile memory separate from the first volatile memory. Furthermore, the first program storage memory 121 is composed of a first non-volatile memory, and the second program storage memory 122 is composed of a second non-volatile memory separate from the first non-volatile memory. Additionally, the first management information storage unit 141 is composed of a specific area in the first volatile memory where the program is not deployed, and the second management information storage unit 142 is composed of a specific area in the second volatile memory.
[0046] The program write control unit 154 performs write control, which causes the program storage memory 120 to store the executable file of the program received by the program receiving unit 110. Even without executing a program, the program write control unit 154 synchronizes the program information stored in the first program storage memory 121 and the second program storage memory 122, and then causes the first program storage memory 121 to store the received program.
[0047] For example, consider as Figure 4 As shown, this is the case where the programs received from the engineering design tool 200 are program 1 PRG1, program 2 PRG2, and program 3 PRG3. Furthermore, as... Figure 4 As shown, the first program storage memory 121 and the second program storage memory 122 are in a state where there is no information about the stored program, and synchronization has been achieved. In this case, the program write control unit 154 stores the received programs PRG1 to PRG3 in the free area of the first program storage memory 121.
[0048] return Figure 2 If the program is successfully stored in the program storage memory 120, the program expansion control unit 155 controls the expansion of the program stored in the program storage memory 120 to the program execution memory 130. If no program is executed, the program expansion control unit 155 expands the program stored in the first program storage memory 121 to the first program execution memory 131.
[0049] For example, such as Figure 4As shown, when the first program storage memory 121 successfully stores each program PRG1 to PRG3, firstly, the program expansion control unit 155 expands the first program PRG1 stored in the first program storage memory 121 to the first program execution memory 131 at addresses 0000H to 0100H. Secondly, the program expansion control unit 155 expands the second program PRG2 stored in the first program storage memory 121 to the first program execution memory 131 at addresses 0100H to 0200H. Thirdly, the program expansion control unit 155 expands the third program PRG3 stored in the first program storage memory 121 to the first program execution memory 131 at addresses 0200H to 0300H. That is, the program expansion control unit 155 expands each program PRG1 to PRG3 in a continuous manner to the first program execution memory 131 at addresses 0000H to 0300H.
[0050] return Figure 2 Before executing a program, the management information generation unit 156 generates a management table as an example of management information, and stores the generated management table in the management information storage unit 140. Here, the management table refers to a table that represents the configuration address of the program expanded in the program execution memory 130. Even without executing a program, the management information generation unit 156 generates a management table representing the configuration address of the program expanded in the first program execution memory 131, and stores the generated management table in the first management information storage unit 141.
[0051] For example, such as Figure 4 As shown, after each program PRG1 to PRG3 is expanded into the first program execution memory 131, the management information generation unit 156 generates a table as a management table, which indicates that the starting configuration address of the first program PRG1 is the first address 0000H, the starting configuration address of the second program PRG2 is the second address 0100H, and the starting configuration address of the third program PRG3 is the third address 0200H. The first management information storage unit 141 stores the generated management table.
[0052] return Figure 2 The program execution unit 157 uses the management table stored in the management information storage unit 140 to execute the program expanded in the program execution memory 130. When no program is executed, the program execution unit 157 uses the management table stored in the first management information storage unit 141 to execute the program expanded in the first program execution memory 131.
[0053] For example, such as Figure 4As shown, the program execution unit 157 determines the starting configuration addresses of each program PRG1 to PRG3 as addresses 0000H, 0100H, and 0200H respectively based on the management table stored in the first management information storage unit 141, and executes each program PRG1 to PRG3 whose storage target location is determined in the first program execution memory 131.
[0054] return Figure 2 As an example of a program storage determination unit, the program storage management unit 151, when receiving an updated program from the program receiving unit 110 during program execution, determines whether the program storage memory 120 used for expanding the currently executing program is the first program storage memory 121 or the second program storage memory 122. For example, if the program storage management unit 151 determines that the program storage memory 120 used for expanding the currently executing program is the first program storage memory 121 when the value of the program storage memory (not shown) indicated by a flag is "1", the program storage management unit 151 determines that the program storage memory 120 used for expanding the currently executing program is the second program storage memory 122 when the value of the program storage memory indicated by a flag is "2".
[0055] Furthermore, upon receiving an update program, if the program storage management unit 151 determines that the first program storage memory 121 is selected, the program write control unit 154 synchronizes the information stored in the second program storage memory 122 with the information stored in the first program storage memory 121. Then, the program write control unit 154 stores the received update program in the second program storage memory 122. Conversely, if the program storage management unit 151 determines that the second program storage memory 122 is selected, the program write control unit 154 synchronizes the information stored in the first program storage memory 121 with the information stored in the second program storage memory 122. Then, the program write control unit 154 stores the received update program in the first program storage memory 121.
[0056] For example, consider as Figure 5As shown, starting from the state where each program PRG1 to PRG3 is being executed, the programs received from the engineering design tool 200 are the first updated program PRG11 after the first program PRG1 has been updated, and the third updated program PRG13 after the third program PRG3 has been updated. In this case, the program storage management unit 151 determines that the program storage memory 120 storing the currently executing program is the first program storage memory 121. Next, the program write control unit 154 synchronizes the information of each program PRG1 to PRG3 by also storing each program PRG1 to PRG3 stored in the first program storage memory 121 in the second program storage memory 122. Furthermore, the program write control unit 154 stores the received updated programs PRG11 and PRG13 in the free area of the second program storage memory 122.
[0057] return Figure 2 As an example of a program execution determination unit, the program execution management unit 152 determines whether the program execution memory 130 containing the currently executing program is the first program execution memory 131 or the second program execution memory 132 when the program write control unit 154 successfully writes an update program while the program is being executed. For example, if the program execution management unit 152 determines that the program execution memory 130 containing the currently executing program is the first program execution memory 131 when the value of the program execution memory (not shown) indicated by a flag is "1". On the other hand, if the program execution management unit 152 determines that the program execution memory 130 containing the currently executing program is the second program execution memory 132 when the value of the program execution memory (not shown) indicated by a flag is "2".
[0058] Furthermore, if the update program is successfully stored, and the program execution management unit 152 determines that the first program execution memory 131 is selected, the program expansion control unit 155 expands the update program stored in the second program storage memory 122 to the second program execution memory 132. Additionally, the program expansion control unit 155 expands any currently executing program that has not been updated and is currently running in the first program execution memory 131 to the second program execution memory 132. Conversely, if the program execution management unit 152 determines that the second program execution memory 132 is selected, the program expansion control unit 155 expands the update program stored in the first program storage memory 121 to the first program execution memory 131. Additionally, the program expansion control unit 155 expands any currently executing program that has not been updated and is currently running in the second program execution memory 132 to the first program execution memory 131.
[0059] For example, such as Figure 6As shown, after successfully storing each update program PRG11 and PRG13 in the second program storage memory 122, the program expansion control unit 155 expands the first update program PRG11 stored in the second program storage memory 122 to addresses 0000H to 0110H in the second program execution memory 132, which is an example of the first storage area. Furthermore, the program expansion control unit 155 expands the third update program PRG13 stored in the second program storage memory 122 to addresses 0110H to 0220H in the second program execution memory 132, which is an example of the first storage area. Additionally, the program expansion control unit 155 expands the second program PRG2 stored in the first program execution memory 131 to addresses 0220H to 0320H in the second program execution memory 132, which is an example of the second storage area. That is, the program expansion control unit 155 expands each program PRG11, PRG13, and PRG2 in a continuous state to the first address 0000H to the fourth address 0320H of the second program execution memory 132.
[0060] return Figure 2 As an example of a management information storage determination unit, the management information storage management unit 153 determines whether the management information storage unit 140 storing the management tables used by the currently executing program is the first management information storage unit 141 or the second management information storage unit 142 when the program expansion control unit 155 controls the expansion and update of the program while the program is being executed. For example, if the value of the management information storage flag (not shown) is "1", the management information storage management unit 153 determines that the management information storage unit 140 storing the management tables used by the currently executing program is the first management information storage unit 141. On the other hand, if the value of the management information storage flag is "2", the management information storage management unit 153 determines that the management information storage unit 140 storing the management tables used by the currently executing program is the second management information storage unit 142.
[0061] In this case, if the determination result of the management information storage management unit 153 is the first management information storage unit 141, then the management information generation unit 156 generates a management table indicating the configuration address of the update program unfolded in the second program execution memory 132, and stores the generated management table in the second management information storage unit 142. On the other hand, in this case, if the determination result of the management information storage management unit 153 is the second management information storage unit 142, then the management information generation unit 156 generates a management table indicating the configuration address of the update program unfolded in the first program execution memory 131, and stores the generated management table in the first management information storage unit 141.
[0062] Specifically, such as Figure 6 As shown, the management information generation unit 156 generates a table as a management table, which represents the starting configuration address of the first update program PRG11 as address 0000H, the starting configuration address of the second program PRG2 as address 0220H, and the starting configuration address of the third update program PRG13 as address 0110H, and stores the generated management table in the second management information storage unit 142.
[0063] return Figure 2 When the program execution unit 157 executes a program expanded to the first program execution memory 131 using the management table stored in the first management information storage unit 141, the update program switching control unit 158 causes the program execution unit 157 to execute an update program expanded to the second program execution memory 132 using the management table stored in the second management information storage unit 142. Furthermore, when the program execution unit 157 executes a program expanded to the second program execution memory 132 using the management table stored in the second management information storage unit 142, the update program switching control unit 158 causes the program execution unit 157 to execute an update program expanded to the first program execution memory 131 using the management table stored in the first management information storage unit 141.
[0064] For example, such as Figure 6 As shown, the program execution memory 130 and the management information storage unit 140 referenced by the program execution unit 157 are switched. Specifically, the program switching control unit 158 changes the volatile memory used by the program execution unit 157 from the first volatile memory to the second volatile memory. As a result, the program execution unit 157 determines the starting configuration addresses of each program PRG11, PRG2, and PRG13 as addresses 0000H, 0220H, and 0110H respectively, based on the management table stored in the second management information storage unit 142, stops the execution of programs PRG1 to PRG3, and executes each program PRG11, PRG2, and PRG13 whose storage target location in the second program execution memory 132 has been determined. Furthermore, after executing each program PRG11, PRG2, and PRG13, the program switching control unit 158 updates the values of the program storage memory flag, the program execution memory flag, and the management information storage flag from "1" to "2".
[0065] (Flowchart regarding the update program switching control process)
[0066] Next, a flowchart will be used to illustrate how the program development assistance system 1 assists in program development. Here, the process of the engineering design tool 200 sending the generated or updated program to the PLC 100 is as follows: after the program generation unit 210 generates or updates the program based on user operations and stores it in the program storage unit 220, the program sending unit 230 sends the generated or updated program to the PLC 100.
[0067] In addition, the processing of the PLC 100 execution program is as follows: after the program receiving unit 110 receives the program execution file from the engineering design tool 200, the program writing control unit 154 stores the program in the first program storage memory 121, the program expansion control unit 155 expands the program to the first program execution memory 131, the management information generation unit 156 generates a management table and stores it in the first management information storage unit 141, the program execution unit 157 uses the management table to execute the program.
[0068] Therefore, to avoid lengthy explanations, illustrations and detailed descriptions of the above processes are omitted. The following explanation only covers the control of PLC 100 switching the currently executing program to an updated program. If program execution unit 157 starts program execution, then PLC 100 begins... Figure 7 The update procedure shown switches the execution of control processing.
[0069] First, the program receiving unit 110 receives the update program (step S101). For example, if the user determines that there is a problem with the operation of PLC 100 while each program PRG1 to PRG3 is being executed, and corrects or updates each program PRG1 and PRG3, then the program receiving unit 110 receives the first update program PRG11 and the third update program PRG13 from the engineering design tool 200.
[0070] Next, the program storage management unit 151 determines whether the program storage memory 120 used for expanding the currently executing program is the first program storage memory 121 or the second program storage memory 122 (step S102). For example, if the program storage memory is marked with a value of "1", the program storage management unit 151 determines that the first program storage memory 121 is used for expanding the currently executing programs PRG1 to PRG3.
[0071] Next, the program write control unit 154 synchronizes the stored contents of the program storage memory 120 based on the determination result of the program storage management unit 151 (step S103). For example, the program write control unit 154 also stores each program PRG1 to PRG3 stored in the first program storage memory 121 to the second program storage memory 122.
[0072] Next, the program writing control unit 154 stores the update program in the program storage memory 120 based on the determination result of the program storage management unit 151 (step S104). For example, the program writing control unit 154 stores each update program PRG11, PRG13 in the second program storage memory 122.
[0073] Next, the program execution management unit 152 determines whether the program execution memory 130 containing the currently executing program is the first program execution memory 131 or the second program execution memory 132 (step S105). For example, if the value indicated by the program execution memory flag is "1", the program execution management unit 152 determines that each of the currently executing programs PRG1 to PRG3 is contained in the first program execution memory 131.
[0074] Next, based on the determination result of the program execution management unit 152, the program expansion control unit 155 expands the update program stored in the program storage memory 120 to the program execution memory 130 (step S106). For example, the program expansion control unit 155 expands each update program PRG11, PRG13 from the second program storage memory 122 to the first address 0000H to the third address 0220H of the second program execution memory 132 in a continuous state.
[0075] Next, based on the determination result of the program execution management unit 152, the program expansion control unit 155 expands the expanded but not updated program to the program execution memory 130 (step S107). For example, the program expansion control unit 155 expands the second program PRG2 from the first program execution memory 131 to the third address 0220H to the fourth address 0320H of the second program execution memory 132 in a state that is continuous with each updated program PRG11, PRG13.
[0076] Next, the management information storage management unit 153 determines whether the management information storage unit 140 that stores the management table used by the currently executing program is the first management information storage unit 141 or the second management information storage unit 142 (step S108). For example, if the value shown by the management information storage flag is "1", the management information storage management unit 153 determines that the first management information storage unit 141 stores the management table used by the currently executing program.
[0077] Next, based on the determination result of the management information storage management unit 153, the management information generation unit 156 generates a management table indicating the configuration addresses of the update programs unfolded in the program execution memory 130, and stores it in the management information storage unit 140 (step S109). For example, the management information generation unit 156 generates a table indicating that the starting configuration address of the first update program PRG11 is the first address 0000H, the starting configuration address of the second program PRG2 is the second address 0220H, and the starting configuration address of the third update program PRG13 is the third address 0110H, and stores it as a management table in the second management information storage unit 142.
[0078] Next, the update program switching control unit 158 switches the program execution memory 130 and the management information storage unit 140 used by the program execution unit 157 (step S110). For example, the update program switching control unit 158 changes the volatile memory used by the program execution unit 157 from the first volatile memory to the second volatile memory.
[0079] In addition, the program execution unit 157 executes the update program and the unupdated program that has not been updated (step S111). For example, the program execution unit 157 determines the starting configuration addresses of each program PRG11, PRG2, and PRG13 as addresses 0000H, 0220H, and 0110H respectively based on the management table stored in the second management information storage unit 142, stops the execution of programs PRG1 to PRG3, and executes each program PRG11, PRG2, and PRG13 whose storage target location has been determined in the second program execution memory 132.
[0080] Next, the update program switching control unit 158 updates the values of the program storage memory flag, the program execution memory flag, and the management information storage flag (step S112), and returns to step S101. For example, the update program switching control unit 158 updates the values of the program storage memory flag, the program execution memory flag, and the management information storage flag from "1" to "2".
[0081] As explained above, in the program development support system 1 according to this embodiment, in the PLC 100, the program expansion control unit 155 controls the expansion of the program stored in the program storage memory 120 to the program execution memory 130. Furthermore, the program execution unit 157 executes the program expanded in the program execution memory 130. Additionally, the program write control unit 154 controls the write of updated programs to the program storage memory 120 while the program is being executed.
[0082] Here, the program storage memory 120 is composed of non-volatile memory, including a first program storage memory 121 composed of first non-volatile memory and a second program storage memory 122 composed of second non-volatile memory. On the other hand, the program execution memory 130 is composed of volatile memory, including a first program execution memory 131 composed of first volatile memory and a second program execution memory 132 composed of second volatile memory.
[0083] Furthermore, when the program writing control unit 154 sets the program storage memory 120 used for expanding the currently executing program as the first program storage memory 121, it stores the update program in the second program storage memory 122. Additionally, when the program expansion control unit 155 sets the program execution memory 130, which contains the expanded currently executing program, as the first program execution memory 131, it expands the update program from the second program storage memory 122 to the second program execution memory 132 upon successful storage of the update program in the second program storage memory 122.
[0084] In this way, the PLC 100 of this embodiment stores the received update program in the program storage memory 120, which is composed of non-volatile memory. Therefore, even if a power outage occurs, the received update program can be saved to the program storage memory 120. As a result, the PLC 100 of this embodiment does not require a countermeasure such as a program execution memory 130 composed of volatile memory to save information during a power outage.
[0085] Furthermore, according to the program development assistance system 1 of this embodiment, when the program execution unit 157 is executing the program expanded in the first program execution memory 131, the update program switching control unit 158 performs switching control to make the program execution unit 157 execute the update program expanded in the second program execution memory 132.
[0086] Here, as described above, in the PLC instrument described in Patent Document 1, the update program is executed after the currently executing program expanded in the third memory is updated to an update program. If the update of the update program begins, the execution of the currently executing program stops. Therefore, the PLC instrument described in Patent Document 1 has the following problem: the execution of the program stops during the period from the start of updating the update program until the start of its execution.
[0087] In particular, the PLC instrument described in Patent Document 1 has the following problem: in order to expand the update program from the first memory, which is composed of non-volatile flash memory, to the third memory, which is composed of volatile RAM, the period during which program execution stops becomes longer. Therefore, the PLC instrument described in Patent Document 1 has the following problem: the longer period during which program execution stops, the more likely the timing of the FA instrument's control will deviate, resulting in a warning sound from the FA instrument, or, depending on the situation, a malfunction of the FA instrument.
[0088] To address this, the PLC 100 of this embodiment expands the update program to a second program execution memory 132 that is not currently used for program execution. In this way, the PLC 100 of this embodiment can continue executing the original program even after the update program expansion begins. Furthermore, after the update program expansion and the generation and storage of the management table are completed, the PLC 100 of this embodiment switches the program execution memory 130 used for program execution from the first program execution memory 131 to the second program execution memory 132, thus minimizing the processing time for the switching control. In this way, compared to a PLC that does not switch the program execution memory from the first program execution memory to the second program execution memory, the PLC 100 of this embodiment can quickly switch from executing the original program to executing the updated program.
[0089] As a result of these practices, the PLC 100 of this embodiment can shorten the time when program execution is stopped during program rewriting. Therefore, for the PLC 100 of this embodiment, the timing of the control of the FA instrument controlled by the updated program is less prone to deviation, and events such as warning sounds from the FA instrument and FA instrument malfunctions can be reduced.
[0090] Furthermore, in the PLC instrument described in Patent Document 1, the received update program is stored in a second memory composed of non-volatile flash memory. Then, the update program stored in the second memory is copied to a first memory composed of non-volatile flash memory, and then the update program copied to the first memory is expanded to a third memory. Therefore, the PLC instrument described in Patent Document 1 has the following problem: the period from receiving the update program to expanding it to the third memory becomes longer.
[0091] In this embodiment, the PLC 100 stores the received update program in the second program storage memory 122, which is not used during program execution, and then expands the update program to the second program execution memory 132. In this way, compared to a PLC that needs to copy the update program to non-volatile memory during the period from storing the received update program in the program storage memory to expanding the update program to the program execution memory, the PLC 100 of this embodiment can shorten the period from receiving the update program to expanding it to the program execution memory.
[0092] Furthermore, in recent years, structured programming has become the mainstream method for PLC programming. In structured programming, traditional device variables are not used in the program; instead, global and local variables are used. Specifically, global variables are common variables used in multiple programs. Therefore, when a programmer modifies or updates a global variable, all programs using that global variable need to be modified and updated. Consequently, in recent PLC programming, there has been a trend towards a greater number of programs that need to be modified and updated at once.
[0093] As a result, the PLC instrument described in Patent Document 1 has the following problems: with the increase in the number of programs that are modified and updated at one time, the period of program execution stoppage becomes longer, and the period from receiving the updated program to expanding the updated program into the program execution memory becomes longer.
[0094] In this respect, compared with the PLC instrument described in Patent Document 1, the PLC 100 according to this embodiment can shorten these periods when the number of updated programs increases.
[0095] Furthermore, according to the program development assistance system 1 of this embodiment, the management information generation unit 156 generates a management table, which is information for managing the execution of the program, and stores it in the management information storage unit 140. The program execution unit 157 uses the management table stored in the management information storage unit 140 to execute the program expanded in the program execution memory 130. Additionally, the management information generation unit 156 generates a management table for managing the execution of the update program, and when the management information storage unit 140, which stores the management table used by the currently executing program, is designated as the first management information storage unit 141, the generated management table is stored in the second management information storage unit 142. Furthermore, the update program switching control unit 158 performs switching control to make the program execution unit 157 use the management table stored in the first management information storage unit 141 to execute the update program expanded in the second program execution memory 132.
[0096] In this way, the PLC 100 of this embodiment stores the newly generated management table in the second management information storage unit 142, which is not used during program execution. Therefore, even if the generation of the management table begins, the execution of the program before rewriting can be continued. Furthermore, after the generation and storage of the management table are completed, the PLC 100 of this embodiment switches the management information storage unit 140 used for program execution from the first management information storage unit 141 to the second management information storage unit 142, thus minimizing the processing time for switching control. In this way, compared to a PLC that does not switch the management information storage unit from the first to the second management information storage unit, the PLC 100 of this embodiment can shorten the time required for generating and storing the management table, and can further shorten the time required to switch from the execution of the program before rewriting to the execution of the updated program after rewriting.
[0097] Furthermore, according to the program development assistance system 1 of this embodiment, the program includes a first program PRG1 and a third program PRG3, and the update program includes a first update program PRG11 after the first program PRG1 is updated and a third update program PRG13 after the third program PRG3 is updated. Additionally, when the first program storage memory 121 is used for expanding each of the currently executing programs PRG1 to PRG3, the program writing control unit 154 stores the first update program PRG11 and the third update program PRG13 in the second program storage memory 122.
[0098] Furthermore, when the currently executing programs PRG1 to PRG3 are expanded to the first program execution memory 131, and the first update program PRG11 and the third update program PRG13 are successfully stored in the second program storage memory 122, the program expansion control unit 155 expands the first update program PRG11 and the third update program PRG13 from the second program storage memory 122 to the second program execution memory 132. Additionally, the management information generation unit 156 generates a management table to manage the execution of the first update program PRG11 and the third update program PRG13, and if the management table used by the currently executing programs PRG1 to PRG3 is stored in the first management information storage unit 141, it stores the generated management table in the second management information storage unit 142.
[0099] Furthermore, when the program execution unit 157 executes the first program PRG1 and the third program PRG3 expanded in the first program execution memory 131 using the management table stored in the first management information storage unit 141, the update program switching control unit 158 causes the program execution unit 157 to execute the first update program PRG11 and the third update program PRG13 expanded in the second program execution memory 132 using the management table stored in the second management information storage unit 142.
[0100] In this way, even when multiple updated programs are received, the PLC 100 of this embodiment can switch from the execution of the original program to the execution of the updated program with a single switching control. As a result, compared with PLCs that cannot switch from the execution of the original program to the execution of the updated program with a single switching control when multiple updated programs are received, the PLC 100 of this embodiment can shorten the time when program execution is stopped during program rewriting, and can further shorten the time when the number of updated programs increases.
[0101] Furthermore, according to the program development assistance system 1 of this embodiment, the program also includes a second program PRG2. In addition, when the first program storage memory 121 is used to expand each of the currently executing programs PRG1 to PRG3, the program writing control unit 154 stores each of the updated programs PRG11 and PRG13 into the second program storage memory 122.
[0102] Furthermore, when the currently executing programs PRG1 to PRG3 are expanded to the first program execution memory 131, and the second program storage memory 122 successfully stores the update programs PRG11 and PRG13, the program expansion control unit 155 expands the update programs PRG11 and PRG13 from the second program storage memory 122 to the second program execution memory 132, and expands the second program PRG2 from the first program execution memory 131 to the second program execution memory 132.
[0103] Furthermore, the management information generation unit 156 generates a management table to manage the execution of each update program PRG11, PRG13, and the second program PRG2. When the management table used by each of the currently executing programs PRG1 to PRG3 is stored in the first management information storage unit 141, the generated management table is stored in the second management information storage unit 142. Moreover, when the program execution unit 157 executes each of the programs PRG1 to PRG3 expanded in the first program execution memory 131 using the management table stored in the first management information storage unit 141, the update program switching control unit 158 causes the program execution unit 157 to use the management table stored in the second management information storage unit 142 to execute each of the update programs PRG11, PRG13, and the second program PRG2 expanded in the second program execution memory 132.
[0104] In this way, the PLC 100 according to this embodiment can expand from the first program execution memory 131 used by the execution of the unupdated second program PRG2 to the second program execution memory 132 unused by the execution of the second program PRG2, even when not all updated programs have been received for the currently executing program. As a result, compared to a PLC that expands the unupdated program from the first program storage memory or the second program storage memory, which is composed of non-volatile memory, to the second program execution memory, the PLC 100 according to this embodiment can shorten the time for expanding the updated program.
[0105] Specifically, according to the program development assistance system 1 of this embodiment, the program expansion control unit 155 expands each update program PRG11 and PRG13 in a continuous state to the first storage area of the second program execution memory 132, i.e., from the first address 0000H to the third address 0220H. Furthermore, the program expansion control unit 155 expands the second program PRG2 to the second storage area of the second program execution memory 132, which follows the first storage area, i.e., from the third address 0220H to the fourth address 0320H.
[0106] In this way, the PLC 100 of this embodiment can unfold each update program PRG11, PRG13 and the unupdated second program PRG2 in a continuous state from the first storage area to the second storage area. As a result, the PLC 100 of this embodiment can prevent fragmentation of the program execution memory 130 even if the update program is repeatedly received.
[0107] Here, we consider a PLC that synchronizes not only the program storage memory 120 before writing the program, but also the program execution memory 130 before controlling the program unpacking. Furthermore, this PLC receives a second updated program PRG12 after the second program PRG2 has been updated, while each program PRG1 to PRG3 is being executed. The file size of the second updated program PRG12 is larger than that of the second program PRG2. In this case, if... Figure 8 As shown, in this PLC, when the second update program PRG12 is expanded to the second program execution memory 132, the storage area of the second program execution memory 132 that originally stored the second program PRG2 becomes a free area. Therefore, this PLC has the following problem: even if the second update program PRG12 is expanded in a state consecutive to the third program PRG3, memory fragmentation occurs due to the free area that previously stored the second program PRG2.
[0108] Therefore, in this embodiment, the PLC 100 does not synchronize the program execution memory 130 before controlling the unfolding program. Thus, as... Figure 9 As shown, the PLC 100 of this embodiment avoids memory fragmentation by unfolding the unupdated programs PRG1 and PRG3 in a continuous state with the second update program PRG12 after unfolding the second update program PRG12. As a result, compared with a PLC that synchronizes the program execution memory 130 before controlling the unfolding program, the PLC 100 of this embodiment can reduce the situation where the usable storage area is insufficient due to memory fragmentation.
[0109] Furthermore, according to the program development assistance system 1 of this embodiment, the program storage management unit 151 determines whether the program storage memory 120 used for expanding the currently executing program is the first program storage memory 121 or the second program storage memory 122. Additionally, the program execution management unit 152 determines whether the program execution memory 130 that expands the currently executing program is the first program execution memory 131 or the second program execution memory 132. Moreover, the management information storage management unit 153 determines whether the management information storage unit 140 that stores the management tables used by the currently executing program is the first management information storage unit 141 or the second management information storage unit 142.
[0110] In this way, the PLC 100 of this embodiment can identify and manage the valid program storage memory 120, program execution memory 130 and management information storage unit 140 used for program execution, as well as the invalid program storage memory 120, program execution memory 130 and management information storage unit 140 not used for program execution, when the program is being executed.
[0111] (Example of amendment)
[0112] Furthermore, in the above embodiment, after the program receiving unit 110 receives the updated program, the program writing control unit 154 synchronizes the program information stored in the first program storage memory 121 and the second program storage memory 122, but the timing of synchronizing the program information is not limited to this. For example, the program writing control unit 154 may also synchronize the program information stored in the first program storage memory 121 and the second program storage memory 122 after the program execution unit 157 executes the program and updates the program.
[0113] Furthermore, as described in the above embodiment, the program expansion control unit 155 preferably expands the update program based on the condition that the program write control unit 154 has successfully stored all update programs, but it is not limited to this. For example, if the program write control unit 154 has successfully stored at least one of the received update programs, the program expansion control unit 155 may expand the successfully stored update program.
[0114] Furthermore, as shown in the above embodiment, the program expansion control unit 155 preferably expands the unupdated second program PRG2 from the volatile memory, i.e., the first program execution memory 131, to the second program execution memory 132, but is not limited thereto. For example, the program expansion control unit 155 may also expand the unupdated second program PRG2 from the non-volatile memory, i.e., the first program storage memory 121 or the second program storage memory 122, to the second program execution memory 132.
[0115] Furthermore, in the above embodiment, the update program switching control unit 158 updates the values of the program storage memory flag, the program execution memory flag, and the management information storage flag between "1" and "2," but the number of flags is not limited to this. For example, since the program execution memory 130 and the management information storage unit 140 are composed of the same volatile memory, the update program switching control unit 158 can also update the value of the volatile memory flag, which combines the program execution memory flag and the management information storage flag, between "1" and "2." In this case, the program execution management unit 152 and the management information storage management unit 153 need to manage the program execution memory 130 and the management information storage unit 140 based on the value of the volatile memory flag updated by the update program switching control unit 158. Alternatively, for example, the update program switching control unit 158 can also update the value of the switching flag, which combines all the program storage memory flag, the program execution memory flag, and the management information storage flag, between "1" and "2." In this case, the program storage management unit 151, the program execution management unit 152, and the management information storage management unit 153 need to manage the program storage memory 120, the program execution memory 130, and the management information storage unit 140 based on the value shown by the switching flag updated by the program switching control unit 158.
[0116] Furthermore, in the above embodiments, the update program switching control unit 158 updates the flags for program storage memory, program execution memory, and management information storage, but it is not limited to updating these flags by the update program switching control unit 158. For example, the program write control unit 154 or the program storage management unit 151 may also update the flags for program storage memory after the program write control unit 154 performs write control to program storage memory 120. Additionally, for example, the program expansion control unit 155 or the program execution management unit 152 may also update the flags for program execution memory after the program expansion control unit 155 controls the expansion of the update program to program execution memory 130. Furthermore, for example, the management information generation unit 156 or the management information storage management unit 153 may update the flags for management information storage after the management information generation unit 156 generates a management table and stores it in management information storage unit 140.
[0117] Furthermore, in the above embodiment, the program receiving unit 110 receives the first update program PRG11 after the first program PRG1 is updated and the third update program PRG13 after the third program PRG3 is updated as update programs, but the update programs are not limited to these. For example, the program receiving unit 110 may also receive the second update program PRG12 after the second program PRG2 is updated as an update program. Furthermore, when the program receiving unit 110 receives the first update program PRG11 and the second update program PRG12 as update programs, for the control of the PLC 100, simply replace "the third update program PRG13" with "the second update program PRG12". Therefore, to reduce lengthy explanations, illustrations and detailed descriptions are omitted for the case where the program receiving unit 110 receives the first update program PRG11 and the second update program PRG12 as update programs.
[0118] Furthermore, in the above embodiment, the program storage memory 120 consists of two memories: a first program storage memory 121 and a second program storage memory 122. However, it is not limited to these two memories and may also consist of three or more memories. In this case, the program storage management unit 151 needs to manage the three or more memories that serve as the program storage memory 120, the program write control unit 154 can perform write control on the three or more memories that serve as the program storage memory 120, and the update program switching control unit 158 needs to control the switching of the three or more memories that serve as the program storage memory 120.
[0119] Furthermore, in the above embodiment, the program execution memory 130 is two memories: a first program execution memory 131 and a second program execution memory 132. However, it is not limited to these two memories and may also be three or more memories. In this case, the program execution management unit 152 needs to manage the three or more memories that serve as the program execution memory 130, the program expansion control unit 155 needs to be able to control the expansion among the three or more memories that serve as the program execution memory 130, and the program update switching control unit 158 needs to control the switching among the three or more memories that serve as the program execution memory 130.
[0120] Furthermore, in the above embodiment, the management information storage unit 140 consists of two storage units: a first management information storage unit 141 and a second management information storage unit 142. However, it is not limited to these two units and may also consist of three or more storage units. In this case, the management information storage management unit 153 needs to manage the three or more storage units that serve as the management information storage unit 140, the management information generation unit 156 needs to be able to store the generated management table in the three or more storage units that serve as the management information storage unit 140, and the update program switching control unit 158 needs to control the switching of the three or more storage units that serve as the management information storage unit 140.
[0121] Furthermore, in the above embodiment, the first management information storage unit 141 is composed of a specific area in the first volatile memory constituting the first program execution memory 131, and the second management information storage unit 142 is composed of a specific area in the second volatile memory constituting the second program execution memory 132. However, the structure of each management information storage unit 141 and 142 is not limited to this. For example, the first management information storage unit 141 and the second management information storage unit 142 may also be composed of a first specific area and a second specific area in the third volatile memory.
[0122] Furthermore, regarding the central part that performs processing in the PLC 100, which includes a control unit 51, a main storage unit 52, an external storage unit 53, an operation unit 54, a transceiver unit 56, and an internal bus 50, for example, the PLC 100 can be configured to perform the aforementioned processing by storing the program for performing the aforementioned actions in a recording medium such as flash memory that can be read by the PLC 100, installing the program, and thus configuring the PLC 100 to perform the aforementioned processing. Alternatively, the program can be pre-stored in the storage device of a server device on a communication network such as a LAN (Local Area Network) or the Internet, and downloaded by the PLC 100, thereby configuring a computer.
[0123] In addition, when the functions of PLC 100 are implemented through the sharing of OS (operating system) and application program, or through the coordinated operation of OS and application program, only the application program part may be stored on the recording medium or storage device.
[0124] Alternatively, the program can be overlaid on a carrier wave and provided via a communication network. For example, the program can be published on a bulletin board system (BBS) on a communication network and provided via the network. Furthermore, the aforementioned processing can be performed by launching the program and executing it under the control of the OS, just like other applications.
[0125] This invention can be implemented and modified in various ways without departing from its broad spirit and scope. Furthermore, the above-described embodiments are illustrative of the invention and not intended to limit its scope. That is, the scope of the invention is defined not by the embodiments, but by the claims. Moreover, various modifications implemented within the scope of the claims and their equivalents are considered to fall within the scope of this invention.
[0126] Explanation of the label
[0127] 1…Program Development Auxiliary System, 50…Internal Bus, 51…Control Unit, 52…Main Storage Unit, 53…External Storage Unit, 54…Operation Unit, 55…Display Unit, 56…Transmitter / Receiver Unit, 59…Control Program, 100…PLC, 110…Program Receiving Unit, 120…Program Storage Memory, 121…First Program Storage Memory, 122…Second Program Storage Memory, 130…Program Execution Memory, 131…First Program Execution Memory, 132…Second Program Execution Memory, 140…Management Information Storage Storage Department, 141… First Management Information Storage Department, 142… Second Management Information Storage Department, 151… Program Storage Management Department, 152… Program Execution Management Department, 153… Management Information Storage Management Department, 154… Program Writing Control Department, 155… Program Deployment Control Department, 156… Management Information Generation Department, 157… Program Execution Department, 158… Update Program Switching Control Department, 200… Engineering Design Tool, 210… Program Generation Department, 211… Compilation and Execution Department, 220… Program Storage Department, 230… Program Sending Department.
Claims
1. A programmable logic controller, comprising: Program storage memory, which is capable of storing programs; The program execution memory used when executing the program; The program expansion control unit controls the expansion of the program stored in the program storage memory to the program execution memory; The program execution unit executes the program expanded to the program execution memory; as well as The program write control unit performs write control to store the updated program (i.e., the updated program) that has been updated while the program is being executed, into the program storage memory. The program storage memory includes a first program storage memory and a second program storage memory that is different from the first program storage memory. The program execution memory includes a first program execution memory and a second program execution memory that is different from the first program execution memory. When the program writing control unit sets the program storage memory used for expanding the currently executing program as the first program storage memory, it stores the updated program in the second program storage memory. When the program expansion control unit designates the program execution memory containing the expanded currently executing program as the first program execution memory, and the updated program is successfully stored in the second program storage memory, it expands the updated program from the second program storage memory to the second program execution memory. The programmable logic controller also includes an update program switching control unit, which, when the program execution unit is executing the program expanded to the first program execution memory, performs switching control to enable the program execution unit to execute the update program expanded to the second program execution memory. In the switching control, the update program switching control unit controls the change of the program execution memory used by the program execution unit from the first program execution memory to the second program execution memory after the update program has been deployed to the second program execution memory. As a result of the program execution unit changing the program execution memory based on the switching control, the execution of the program currently being executed in the first program execution memory ends, and the execution of the update program unfolding in the second program execution memory begins.
2. The programmable logic controller according to claim 1, wherein, The programmable logic controller also has: The management information generation department generates management information, which manages the execution of the program. as well as The management information storage unit stores the management information. The program execution unit uses the management information stored in the management information storage unit to execute the program expanded to the program execution memory. The management information storage unit includes a first management information storage unit and a second management information storage unit that is different from the first management information storage unit. The management information generation unit generates management information for managing the execution of the update program, and when the management information storage unit storing the management information used by the currently executing program is designated as the first management information storage unit, the generated management information for managing the execution of the update program is stored in the second management information storage unit. When the program execution unit is executing a program expanded to the first program execution memory using the management information stored in the first management information storage unit, the update program switching control unit performs the switching control to make the program execution unit execute the update program expanded to the second program execution memory using the management information stored in the second management information storage unit.
3. The programmable logic controller according to claim 1, wherein, The programmable logic controller also has: The program storage determination unit determines whether the program storage memory used for expanding the currently executing program is the first program storage memory or the second program storage memory; as well as The program execution determination unit determines whether the program execution memory of the currently executing program is the first program execution memory or the second program execution memory.
4. The programmable logic controller according to claim 1, wherein, The program includes a first program and a second program that is different from the first program. The update procedure includes the first procedure that has been updated, i.e., the first update procedure, and the second procedure that has been updated, i.e., the second update procedure. When the program writing control unit sets the program storage memory used for expanding the currently executing first program and the second program as the first program storage memory, it stores the first update program and the second update program in the second program storage memory. When the program expansion control unit sets the program execution memory containing the expanded, currently executing first program and second program as the first program execution memory, and the first update program and the second update program are successfully stored in the second program storage memory, the program expansion control unit expands the first update program and the second update program from the second program storage memory to the second program execution memory. When the program execution unit is executing the first program and the second program that have been expanded to the first program execution memory, the update program switching control unit causes the program execution unit to execute the first update program and the second update program that have been expanded to the second program execution memory.
5. The programmable logic controller according to claim 1, wherein, The program includes a first program and a second program that is different from the first program. The update program is the first program that has been updated, i.e., the first update program. When the program writing control unit sets the program storage memory used for expanding the currently executing first program and the second program as the first program storage memory, it stores the first update program into the second program storage memory. When the program expansion control unit sets the program execution memory containing the expanded first program and the second program as the first program execution memory, and the first update program is successfully stored in the second program storage memory, the first update program is expanded from the second program storage memory to the second program execution memory, and the second program is expanded from the first program execution memory to the second program execution memory. When the program execution unit is executing the first program and the second program expanded to the first program execution memory, the update program switching control unit causes the program execution unit to execute the first update program and the second program expanded to the second program execution memory.
6. The programmable logic controller according to claim 5, wherein, After expanding the first update program to the first storage area of the second program execution memory, the program expansion control unit expands the second program to the second storage area of the second program execution memory that follows the first storage area.
7. A control method for a programmable logic controller, comprising the following steps: In the program expansion control step, the programmable logic controller controls the expansion of the program stored in the program storage memory to the program execution memory used when executing the program. The program execution steps include the programmable logic controller executing the program expanded to the program execution memory; and In the program write control step, the programmable logic controller performs write control to store the updated program (i.e., the updated program) that has been updated while the program is being executed, into the program storage memory. The program storage memory includes a first program storage memory and a second program storage memory that is different from the first program storage memory. The program execution memory includes a first program execution memory and a second program execution memory that is different from the first program execution memory. In the program writing control step, if the program storage memory used for expanding the currently executing program is set as the first program storage memory, the updated program is stored in the second program storage memory. In the program expansion control step, when the program execution memory containing the expanded currently executing program is designated as the first program execution memory, the update program is expanded from the second program storage memory to the second program execution memory. The control method further includes an update program switching control step, in which the programmable logic controller, while executing the program expanded to the first program execution memory, performs switching control to execute the update program expanded to the second program execution memory. In the switching control performed through the update program switching control step, after the update program has been deployed to the second program execution memory, the programmable logic controller controls the change of the program execution memory used in the program execution step from the first program execution memory to the second program execution memory. In the program execution step, the programmable logic controller, by changing the program execution memory based on the switching control, as a result, terminates the execution of the currently executing program unfolded in the first program execution memory and begins the execution of the updated program unfolded in the second program execution memory.
8. A recording medium storing a program that causes a programmable logic controller to function as: The program expansion control unit controls the expansion of the program stored in the program storage memory, which is capable of storing programs, into the program execution memory used when executing the program. The program execution unit executes the program expanded to the program execution memory; The program write control unit controls the writing of the updated program (i.e., the updated program) to the program storage memory while the program is being executed. The program storage memory includes a first program storage memory and a second program storage memory that is different from the first program storage memory. The program execution memory includes a first program execution memory and a second program execution memory that is different from the first program execution memory. When the program writing control unit sets the program storage memory used for expanding the currently executing program as the first program storage memory, it stores the updated program in the second program storage memory. When the program expansion control unit designates the program execution memory containing the expanded currently executing program as the first program execution memory, and the updated program is successfully stored in the second program storage memory, it expands the updated program from the second program storage memory to the second program execution memory. The program also causes the programmable logic controller to function as an update program switching control unit. This update program switching control unit, when the program execution unit is executing the program expanded to the first program execution memory, performs switching control to cause the program execution unit to execute the update program expanded to the second program execution memory. In the switching control, the update program switching control unit controls the change of the program execution memory used by the program execution unit from the first program execution memory to the second program execution memory after the update program has been deployed to the second program execution memory. As a result of the program execution unit changing the program execution memory based on the switching control, the execution of the program currently being executed in the first program execution memory ends, and the execution of the update program unfolding in the second program execution memory begins.