Programmable controller
11281180 · 2022-03-22
Assignee
Inventors
Cpc classification
Y02P90/02
GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
International classification
G05B19/05
PHYSICS
Abstract
A programmable controller allocates times obtained by dividing executable time in one operation cycle to a plurality of paths, executes sequence programs of the paths in the respective allocated times, and accumulates remaining time as extra time when execution of each of the sequence programs ends before the end of the allocation time. When it is determined that surplus time occurs on the basis of the accumulated extra time, the programmable controller determines whether each of the sequence programs is executed after being divided, and executes a remainder of a divided sequence program in the surplus time in accordance with a result of the determination.
Claims
1. A programmable controller that allocates, to a plurality of paths, allocation times obtained by dividing executable time in one operation cycle at a predetermined ratio, and executes sequence programs of the paths in the respective allocation times, the programmable controller comprising: an extra time accumulation unit that accumulates extra time; a sequence execution unit that executes the sequence programs within the respective allocation times and accumulates remaining time in the extra time accumulation unit as extra time when execution of each of the sequence programs ends before an end of a corresponding allocation time of the allocation times; a surplus time determination unit that determines whether or not surplus time occurs on basis of the extra time accumulated in the extra time accumulation unit; and a divided sequence determination unit that determines whether each of the sequence programs is executed after being divided by the sequence execution unit when the surplus time determination unit determines that the surplus time occurs, and instructs the sequence execution unit to execute a remainder of a divided sequence program in the surplus time in accordance with a result of the determination.
2. The programmable controller according to claim 1, further comprising an allocation table in which a ratio at which the executable time is allocated to the plurality of paths is defined, wherein a ratio at which the surplus time is distributed to the plurality of paths is settable in the allocation table; and the divided sequence determination unit instructs the sequence execution unit to execute the divided sequence program by distributing the surplus time in accordance with the ratio which is set in the allocation table and at which the surplus time is distributed to the plurality of paths, when the sequence programs in two or more paths are executed after being divided.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
(11)
(12) A programmable controller 1 includes a CPU 10 that executes sequence control. A ROM 11, a RAM 12, a nonvolatile memory 13, an input/output circuit 14, and an interface 15 are connected to the CPU 10 via a bus 19. An external apparatus 2 for performing reading and writing of a CompactFlash memory (CF memory) is connected to the interface 15. The CPU 10 can acquire a sequence program of an execution format object from the external apparatus 2 to which the CF memory and the like are attached via the interface 15 and can record the sequence program in the nonvolatile memory 13. The bus 19 is connectable to a control apparatus such as a computer numerical control via a bus interface 18. Various actuators, sensors, and the like of machines to be controlled such as peripheral apparatuses and machining tools are connected to the input/output circuit 14 via an I/O unit 20.
(13) A system program to be executed by the CPU 10 of the programmable controller 1 is stored in the ROM 11. The CPU 10 controls the operation of each unit of the programmable controller 1 by executing the system program. In the nonvolatile memory 13, sequence programs to be executed by the programmable controller 1 are stored. At the time of the execution of the sequence programs, the CPU 10 reads out the sequence programs from the nonvolatile memory 13, stores the readout sequence programs in a storage region for the sequence programs for execution of the RAM 12, and sequentially executes the sequence programs for execution stored in the RAM 12.
(14) In the RAM 12, a memory region for signals for execution that stores various signals therein when the programmable controller 1 executes the sequence programs is provided, and a region that stores therein the state of an internal relay in the sequence programs, output signals, input signals, and the like that are necessary when the sequence programs are executed is provided in the memory region for signals for execution.
(15) A timer 16 is formed by a real time clock (RTC), for example, and is used for counting the processing time and the like.
(16)
(17) The functions included in the programmable controller 1 according to this embodiment are implemented by controlling the operation of the respective units of the programmable controller 1 by executing the system program by the CPU 10 included in the programmable controller 1 illustrated in
(18) The programmable controller 1 of this embodiment includes a sequence control unit 110. In the RAM 12 or the nonvolatile memory 13 of the programmable controller 1, a program storage unit 210 that is a region that stores therein the sequence programs executed by the programmable controller 1, an allocation table storage unit 220 that stores therein an allocation table in which information on the allocation of the executable time with respect to the sequence programs is set, and an extra time accumulation unit 230 that accumulates extra time are provided.
(19) The functions of the sequence control unit 110 are implemented by mainly performing arithmetic processing using the RAM 12 and the nonvolatile memory 13 by the CPU 10 included in the programmable controller 1 illustrated in
(20) In the allocation table storage unit 220 referred to by the sequence control unit 110, an allocation table in which the information on the allocation of the executable time with respect to the sequence programs is set is stored. The sequence control unit 110 divides the executable time in accordance with the information on the allocation of the executable time set in the allocation table stored in the allocation table storage unit 220 and allocates the divided executable time as the allocation time necessary for the execution of the sequence programs read out from the program storage unit 210.
(21) The sequence execution unit 112 executes at least one sequence program prestored in the program storage unit 210 within each allocation time allocated by the sequence control unit 110. When the entire execution of the sequence program does not end within the allocation time, the sequence execution unit 112 divides the sequence program within a range in which the execution is possible within the allocation time and executes the divided sequence program. When the execution of the sequence program ends within the allocation time, the sequence execution unit 112 measures the difference between the allocation time allocated to the path and the time actually taken for the execution of the sequence program as the extra time, and accumulates (adds) the measured extra time to the extra time accumulation unit 230. Then, the sequence execution unit 112 proceeds to the execution of the sequence program of the next path without waiting for the allocation time to end.
(22)
(23)
(24) In the program storage unit 210, a sequence program for a first level and a sequence program for a second level of the first path, a sequence program for a first level and a sequence program for a second level of the second path, and a sequence program for a first level and a sequence program for a second level of the third path are stored. At this time, the programmable controller:
(25) (i) allocates T.sub.p×0.5 that is 50% of an executable time T.sub.p to the execution of the sequence program for the first level and the sequence program for the second level of the first path as the allocation time;
(26) (ii) allocates T.sub.p×0.3 that is 30% of the executable time T.sub.p to the execution of the sequence program for the first level and the sequence program for the second level of the second path as the allocation time; and
(27) (iii) allocates T.sub.p×0.2 that is the remaining 20% of the executable time T.sub.p to the execution of the sequence program for the first level and the sequence program for the second level of the third path as the allocation time.
(28) The sequence programs are executed in accordance with the allocated allocation time. In the example in
(29)
(30) In the program storage unit 210, the sequence program for the first level and the sequence program for the second level of the first path, the sequence program for the first level and the sequence program for the second level of the second path, the sequence program for the first level and the sequence program for the second level of the third path are stored. At this time, when the execution of the sequence program for the first level and the sequence program for the second level in each path end, the sequence execution unit 112 proceeds to the execution of the sequence program of the next path without waiting for the allocation time to end. Therefore, when the execution of the sequence program in each path ends earlier than the allocation time, surplus time that is the total of the time that has been considered to be extra time in the related-art technology remains at the end of the executable time. As with the case of
(31) When the sequence execution unit 112 finishes the execution of the sequence programs of each path, the surplus time determination unit 114 determines whether or not the surplus time that is the total of the extra time occurs with reference to the extra time accumulation unit 230. When the surplus time determination unit 114 determines that surplus time occurs, the surplus time determination unit 114 notifies the divided sequence determination unit 116 of the surplus time. At this time, a predetermined threshold value may be preset, and it may be determined that surplus time occurs when the total extra time accumulated in the extra time accumulation unit 230 is equal to or more than the set threshold value. By doing so, the divided sequence determination unit 116 can be prevented from performing wasteful processing when extra time in which the sequence program can be executed is not accumulated.
(32) The divided sequence determination unit 116 determines whether or not the sequence execution unit 112 has executed the sequence program by dividing the sequence program. When the sequence execution unit 112 has executed the sequence program by dividing the sequence program and the surplus time determination unit 114 determines that surplus time occurs, the divided sequence determination unit 116 instructs the sequence execution unit 112 to execute the divided sequence program in the surplus time. When the execution of the sequence program in the surplus time by the sequence execution unit 112 ends, the sequence control unit 110 initializes the extra time accumulation unit 230 to 0.
(33)
(34) As described above, when extra time occurs in the execution of the sequence programs of each path in each operation cycle, the programmable controller 1 according to this embodiment collects the extra time to a place after the operation cycles as surplus time, and executes the sequence program of which execution is not finished within the allocation time in the surplus time. In the related-art technology, the extra time becomes a waste of time, and the sequence program of which execution is not finished within the allocation time is executed in the next operation cycle. In the programmable controller 1 according to this embodiment, the divided sequence programs can be executed more efficiently by effectively using the surplus time obtained by accumulating the extra times.
(35) As described above, the programmable controller 1 according to this embodiment including the abovementioned configuration can perform efficient sequence control by allocating the surplus time that has been wasted to the execution of the sequence programs. The actual execution time can be efficiently used while maintaining the independence of the programmable controller that executes a plurality of sequence programs in a sequentially repeating manner at a predetermined time ratio within one operation cycle.
(36) As one modified example of the programmable controller 1 according to this embodiment, the ratio at which the surplus time is distributed to the paths may be able to be set in the allocation table.
(37)
(38) The sequence control unit 110 included in the programmable controller 1 reads the settings of the allocation table stored in the allocation table storage unit 220 in each operation cycle (Step SA01) and allocates executable time to each path. Then, the sequence control unit 110 repeatedly executes Step SA03 to Step SA08 for each path (Step SA02). In each path, the sequence execution unit 112 performs sequence control processing by executing a sequence program (Step SA04) while measuring the processing time by the timer 16 (Step SA03, Step SA05). At this time, when the execution time of the sequence program is shorter than the allocation time, it is determined that extra time occurs (Step SA06), the extra time is accumulated in the extra time accumulation unit 230 (Step SA07), and the operation proceeds to the operation of the next path. When the sequence program is divided without the generation of the extra time, the divided position is recorded (Step SA08).
(39) When the execution of the sequence program in all the paths is completed, the surplus time determination unit 114 determines whether surplus time occurs (Step SA09). When surplus time occurs, the divided sequence determination unit 116 further determines whether or not there is a sequence program that is executed after being divided (Step SA10). When surplus time occurs and there is a sequence program that is executed after being divided, the remainder of the sequence executed after being divided is executed in the surplus time (Step SA11). Lastly, the surplus time is initialized (Step SA12), and the processing ends in the current operation cycle.
(40) One embodiment of the present invention has been described above, but the present invention is not limited to the example of the embodiment described above and can be carried out in various modes by making modifications, as appropriate.