Programmable Logic Controller
By accumulating and utilizing remainder time in the programmable controller, the problem of waste of remainder time when multiple timing programs are executed in parallel is solved, and the efficiency of timing control and the independence of action are improved.
Patent Information
- Application Number
- CN202011186815.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-10-30
- Filing Date
- 2020-10-30
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2040-10-30
AI Technical Summary
In a programmable controller, when multiple timing programs are executed in parallel, the pre-determined time ratio allocation leads to the generation of remainder time, resulting in low operational efficiency.
By introducing a remainder time accumulation unit and a split timing determination unit in the programmable controller, the generated remainder time is accumulated, and the accumulated remainder time is used to execute the unfinished timing program in the next operation cycle, so as to avoid the remainder time becoming useless time.
The remainder time is effectively utilized, the efficiency of timing control is improved, and the actual execution time is efficiently used while keeping the time ratio consistent.
Smart Images

Figure CN112748696B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a programmable controller. Background Art
[0002] In a programmable controller (programmable logic controller, PLC) used in a CNC (numerical control device) or the like, a sequence program of a control target such as a main body of a machine that performs machining, a tool management mechanism unit that manages tools used in machining, and a peripheral device unit such as a loader is operated.
[0003] The programmable controller repeats sequence control in each operation cycle. The programmable controller scans (executes) a sequence program during a predetermined executable time period from the start timing of each operation cycle. In the programmable controller, there is a programmable controller that prepares multiple program levels in the manner of a first level, a second level, etc. (for example, Japanese Patent Laid-Open No. 63-317834).
[0004] As Figure 9 illustrated, a programmable controller that prepares multiple program levels must scan (execute) the sequence program for the first level once within the executable time. In addition, for the sequence program for the second level, after the scanning (execution) of the sequence program for the first level ends within the executable time, the amount that can be scanned (executed) is divided by the remaining time of the executable time, and the scanning (execution) is interrupted and performed.
[0005] In this Figure 9 example, the executable time is 16 ms, the scanning of the first level ends in about 4 ms, and the remaining 12 ms is used for the scanning of the second level. In addition, when the scanning time of the sequence program is sufficiently small with respect to one executable time, the programmable controller sometimes performs multiple scans of the sequence program. For example, when the executable time is 16 ms and the scanning time for scanning the sequence program is 8 ms, the sequence program is scanned twice within the executable time.
[0006] In addition, the time taken for the scanning of the sequence program varies depending on the execution conditions of the function block and the rungs passed through. Therefore, as seen in the operation cycle starting from 32 ms in Figure 10 , when the scanning time of the sequence program scanned within the executable time is not clearly short, the scanning of the sequence program for the second time cannot be performed with the remaining time. In such a case, the remaining "remainder time" of the executable time becomes useless time in the operation of the programmable controller.
[0007] In a programmable controller, when multiple timing programs of multiple systems are executed in parallel, the executable time is divided into the scan times of the timing programs of each system and allocated. At this time, when the executable time is allocated at a predetermined ratio and multiple timing programs are scanned in parallel, if the scan times of the respective timing programs vary according to the status of peripheral devices and processing conditions as described above, a remainder time often occurs. As a result, the operation of the programmable controller may become inefficient. Summary of the Invention
[0008] Therefore, a structure is desired that can effectively utilize the remainder time while ensuring the allocation of the executable time for multiple timing programs.
[0009] In the present invention, in a programmable controller that divides the executable time in each operation cycle into allocation times at a predetermined time ratio and allocates them to multiple timing programs and sequentially repeats the execution of the timing programs, when a remainder time occurs, the remainder time is accumulated by executing the timing program within the allocation time. After the accumulated remainder time is accumulated, in the remaining time obtained, the timing program of a predetermined system is executed, thereby solving the above problem.
[0010] The programmable controller 1 of the present invention allocates the allocation time obtained by dividing the executable time in one operation cycle at a predetermined ratio to multiple systems, and executes the timing programs of each system within this allocation time. It includes: a remainder time accumulation unit that accumulates the remainder time; a timing execution unit that executes the timing program within the above allocation time, and when the execution of the timing program ends earlier than the above allocation time, accumulates the remaining time as the remainder time in the above remainder time accumulation unit; a remaining time determination unit that determines whether a remaining time has occurred based on the remainder time accumulated in the above remainder time accumulation unit; and a divided timing determination unit that, when it is determined by the above remaining time determination unit that a remaining time has occurred, determines whether the timing program is divided and executed by the above timing execution unit, and based on the determination result, instructs the above timing execution unit to execute the remaining part of the divided timing program in the above remaining time.
[0011] The above programmable controller may further include an allocation table that defines the ratio of the allocation of the above executable time to the above multiple systems. In this case, the ratio of the allocation of the above remaining time to the above multiple systems can be set in the above allocation table. When the divided timing determination unit divides and executes the timing program among multiple systems, it allocates the above remaining time according to the ratio of the above multiple systems allocated to the above remaining time set in the above allocation table and instructs the timing execution unit to execute the divided timing program.
[0012] Since the present invention has the above structure, the useless remaining time is allocated to the execution of the timing program, thereby enabling efficient timing control. In addition, it is possible to efficiently use the actual execution time while maintaining the independence of the programmable controller that repeatedly executes multiple timing programs in a predetermined time ratio within one execution cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a schematic hardware structure diagram of a programmable controller according to an embodiment.
[0014] Figure 2 It is a block diagram showing the schematic functions of a programmable controller according to an embodiment.
[0015] Figure 3 It shows an example of an allocation table.
[0016] Figure 4 It shows an example of running the timing programs of multiple systems according to the allocation table by the prior art.
[0017] Figure 5 It shows an example of running the timing programs of multiple systems according to the allocation table by the method of the present invention.
[0018] Figure 6 It shows an example of running the timing program in which the remaining time is divided.
[0019] Figure 7 It shows an example of setting the allocation ratio of the remaining time in the allocation table.
[0020] Figure 8 It is a flowchart showing the schematic operation of a programmable controller according to an embodiment.
[0021] Figure 9 Describe the operation of the programmable controller of the prior art.
[0022] Figure 10 Describe the problems of the programmable controller of the prior art. DETAILED DESCRIPTION OF THE INVENTION
[0023] Figure 1 It is a schematic hardware structure diagram of a programmable controller according to an embodiment of the present invention.
[0024] The programmable controller 1 has a CPU 10 that performs sequential control. The CPU 10 is connected via a bus 19 to a ROM 11, a RAM 12, a non-volatile memory 13, an input / output circuit 14, and an interface 15. An external device 2 such as a CompactFlash (CF) memory for reading and writing is connected to the interface 15. The CPU 10 can acquire a sequential program of an execution form object from the external device 2 equipped with a CF memory or the like via the interface 15 and record it in the non-volatile memory 13. In addition, the bus 19 can be connected to a control device such as a numerical control device via a bus interface 18. The input / output circuit 14 is connected via an I / O unit 20 to various actuators or sensors of a machine such as a machine tool and peripheral devices that are control objects.
[0025] A system program executed by the CPU 10 of the programmable controller 1 is stored in the ROM 11. The CPU 10 controls the operations of each part of the programmable controller 1 by executing this system program. In addition, a sequential program executed by the programmable controller 1 is stored in the non-volatile memory 13. When executing the sequential program, the CPU 10 reads the sequential program from the non-volatile memory 13, stores the read sequential program in the execution sequential program storage area of the RAM 12, and sequentially executes the execution sequential program stored in the RAM 12.
[0026] An execution signal memory area for storing various signals when the programmable controller 1 executes a sequential program is provided in the RAM 12. In this execution signal memory area, areas for storing input signals, output signals, the states of internal relays in the sequential program, etc. required for executing the sequential program are provided.
[0027] The timer 16 is composed of, for example, a Real Time Clock (RTC) or the like and is used to measure processing time and the like.
[0028] Figure 2 The functions of the programmable controller 1 according to an embodiment of the present invention are represented as a schematic block diagram.
[0029] Each function of the programmable controller 1 in this embodiment is achieved by Figure 1 the CPU 10 of the programmable controller 1 shown executing the system program and controlling the operations of each part of the programmable controller 1.
[0030] The programmable controller 1 of the present embodiment includes a timing control unit 110. In addition, in the RAM 12 or the non-volatile memory 13 of the programmable controller 1, there are provided a program storage unit 210 which is an area for storing the timing program executed by the programmable controller 1, an allocation table storage unit 220 which stores an allocation table having allocation information for setting the executable time for the timing program, and a remainder time accumulation unit 230 which accumulates the remainder time.
[0031] The Figure 1 The CPU 10 included in the programmable controller 1 shown executes the system program read from the ROM 11, mainly performs arithmetic processing using the RAM 12 and the non-volatile memory 13 by the CPU 10, timing processing by the timer 16, and input / output processing via the input / output circuit 14 and the bus interface 18, thereby realizing the functions of the timing control unit 110. The timing control unit 110 allocates the executable time for each operation cycle to the timing program stored in the program storage unit 210, and executes each timing program according to the allocated executable time. The timing control unit 110 includes a timing execution unit 112, a remaining time determination unit 114, and a divided timing determination unit 116.
[0032] In the allocation table storage unit 220 referred to by the timing control unit 110, there is stored an allocation table having allocation information for setting the executable time for the timing program. The timing control unit 110 divides the executable time according to the allocation information of the executable time set by the allocation table stored in the allocation table storage unit 220, and allocates the divided executable time as the allocation time required for the execution of each timing program read from the program storage unit 210.
[0033] The timing execution unit 112 executes at least one timing program stored in the program storage unit 210 in each allocation time allocated by the timing control unit 110. When the overall execution of the timing program has not ended within the allocation time, the timing execution unit 112 divides the timing program within the range that can be executed within the allocation time, and executes the divided timing program. In addition, when the execution of the timing program ends within the allocation time, the timing execution unit 112 measures the difference between the allocation time allocated to the system and the time actually spent on the execution of the timing program as the remainder time, and accumulates (adds) the measured remainder time to the remainder time accumulation unit 230. And the timing execution unit 112 transfers to the execution of the timing program of the next system without waiting for the end of the allocation time.
[0034] Figure 3 Shows an example of the allocation table.
[0035] The allocation table can be defined, for example, as a table that sets the ratio of the executable time allocated to the execution of the timing program for each system. In Figure 3In the shown allocation table, for example, when performing sequential control of a machine with three systems, namely the first system, the second system, and the third system, 50% of the executable time defined for the execution of the sequential program assigned to the first system is used as the allocation time, 30% of the executable time defined for the execution of the sequential program assigned to the second system is used as the allocation time, and 20% of the executable time defined for the execution of the sequential program assigned to the third system is used as the allocation time.
[0036] Figure 4 The programmable logic controller representing the prior art performs sequential control of a machine with three systems, namely the first system, the second system, and the third system, according to Figure 3 the example of the allocation table illustrated.
[0037] In the program storage unit 210, the first-level sequential program and the second-level sequential program for the first system, the first-level sequential program and the second-level sequential program for the second system, and the first-level sequential program and the second-level sequential program for the third system are respectively stored. At this time, the programmable logic controller
[0038] (i) allocates 50% of the executable time T p , that is, T p ×0.5, as the allocation time for the execution of the first-level sequential program and the second-level sequential program of the first system. Additionally,
[0039] (ii) allocates 30% of the executable time T p , that is, T p ×0.3, as the allocation time for the execution of the first-level sequential program and the second-level sequential program of the second system. Additionally,
[0040] (iii) allocates the remaining 20% of the executable time T p , that is, T p ×0.2, as the allocation time for the execution of the first-level sequential program and the second-level sequential program of the third system.
[0041] And, each sequential program is executed according to the allocated allocation time. In Figure 4 the example, a remainder time is generated in the allocation time allocated to the first system and the allocation time allocated to the third system. Additionally, in the second system, the second-level sequential program does not finish execution within the allocation time. At this time, the programmable logic controller divides the second-level sequential program within the range that ends within the allocation time, and executes the first half of the divided part in the current operation cycle. And, the remaining divided part is executed in the next operation cycle.
[0042] Figure 5 This shows that in the programmable logic controller 1 of the present embodiment, according to Figure 3The following is an example in which the timing execution unit 112 executes each timing program to perform the timing control of a machine having three systems, i.e., a first system, a second system, and a third system.
[0043] It is assumed that the program storage unit 210 stores therein a first-level timing program and a second-level timing program for the first system, a first-level timing program and a second-level timing program for the second system, and a first-level timing program and a second-level timing program for the third system. At this time, when the execution of the first-level timing program and the second-level timing program in each system by the timing execution unit 112 ends, the execution transfers to the timing program of the next system without waiting for the end of the allocation time. Therefore, when the execution of the timing program in each system ends earlier than the allocation time, at the end of the executable time, there remains a remaining time obtained by summing up the times that were the remainder times in the prior art. In Figure 5 the example of Figure 4 the second-level timing program is divided and executed in the second system in the same manner as
[0044] When the timing execution unit 112 finishes the execution of the timing programs of all systems, the remaining time determination unit 114 refers to the remainder time accumulation unit 230 to determine whether a remaining time, which is the sum of the remainder times, is generated. When the remaining time determination unit 114 determines that the remaining time is generated, it notifies the divided timing determination unit 116 of the remaining time. At this time, a predetermined threshold value may be set in advance, and it is determined that the remaining time is generated when the sum of the remainder times accumulated in the remainder time accumulation unit 230 is equal to or greater than the set threshold value. Thus, when there is not enough remainder time accumulated to execute the timing program, it is possible to prevent the divided timing determination unit 116 from performing useless processing.
[0045] The divided timing determination unit 116 determines whether the timing execution unit 112 has divided and executed the timing program. And even when the timing execution unit 112 has divided and executed the timing program, when the remaining time determination unit 114 determines that the remaining time is generated, the divided timing determination unit 116 instructs the timing execution unit 112 to execute the timing program divided by the remaining time. When the timing execution unit 112 finishes the execution of the timing program in the remaining time, the timing control unit 110 initializes the remainder time accumulation unit 230 to 0.
[0046] Figure 6 This is Figure 5 an example in which the timing execution unit 112 executes the remaining part of the timing program that was divided and executed in the second system in the remaining time.
[0047] Thus, when the programmable logic controller 1 of the present embodiment generates a remainder time during the execution of the sequence programs of each system in each operation cycle, the remainder time is concentrated after the operation cycle and set as the remaining time, and the sequence programs that have not been fully executed within the allocated time are executed during the remaining time. In the prior art, the remainder time becomes useless time, and the sequence programs that have not been fully executed within the allocated time are executed in the next operation cycle. In the programmable logic controller 1 of the present embodiment, by effectively using the remaining time accumulated with the remainder time, the divided sequence programs can be executed more efficiently.
[0048] Thus, the programmable logic controller 1 of the present embodiment having the above structure allocates the useless remaining time to the execution of the sequence programs, thereby enabling efficient sequence control. In addition, the actual execution time can be efficiently used while maintaining the independence of the programmable logic controller that sequentially repeats the execution of multiple sequence programs at a predetermined time ratio within one operation cycle.
[0049] As a modification example of the programmable logic controller 1 of the present embodiment, the ratio of allocating the remaining time to each system may be set in the allocation table. Figure 7 An example of the allocation table showing the ratio of allocating the remaining time to each system is shown. In Figure 7 the example, when performing sequence control of three systems, 50% of the executable time is allocated to the execution of the sequence program of the first system, 30% is allocated to the execution of the sequence program of the second system, and 20% is allocated to the execution of the sequence program of the third system, and the remaining time is set to be allocated to the first system, the second system, and the third system at a ratio of 5:4:1, respectively. At this time, if a remaining time is generated during the execution of the sequence program, and the sequence program is divided and executed in the second system and the third system, the divided sequence determination unit 116 (since there is no need to allocate the remaining time to the first system) allocates the remaining time to the second system and the third system at a ratio of 4:1 and instructs the sequence execution unit 112 to execute the sequence program. By being able to set the ratio of allocation of such remaining time, flexible utilization such as allocating more remaining time to the system that should be prioritized can be performed in the case of dividing and executing the sequence program with multiple systems.
[0050] Figure 8 The operation in one operation cycle of the above programmable logic controller 1 is shown in a schematic flowchart.
[0051] The timing control unit 110 included in the programmable controller 1 reads the settings of the allocation table stored in the allocation table storage unit 220 for each operation cycle (step SA01), and allocates executable time to each system. Then, steps SA03 to SA08 are repeatedly executed for each system (step SA02). In each system, while the processing time is measured by the timer 16 (steps SA03 and SA05), the timing execution unit 112 executes the timing program to perform timing control processing (step SA04). At this time, if the execution time of the timing program is shorter than the allocated time, it is determined that remaining time has been generated (step SA06), and the remaining time is accumulated in the remaining time accumulation unit 230 (step SA07), and the operation proceeds to the next system. In addition, when the timing program is divided without generating remaining time, the division position is recorded in advance (step SA08).
[0052] Moreover, if the execution of the timing program in all systems has completed one cycle, the remaining time determination unit 114 determines whether remaining time has been generated (step SA09). If remaining time has been generated, the divided timing determination unit 116 further determines whether there is a timing program to be executed in a divided manner (step SA10). If remaining time has been generated and there is a timing program to be executed in a divided manner, the remaining part of the timing executed in the remaining time is executed (step SA11). Finally, the remaining time is initialized (step SA12), and the processing in the current operation cycle is ended.
[0053] As described above, one embodiment of the present invention has been explained, but the present invention is not limited to the examples of the above-described embodiment, and can be implemented in various ways by making appropriate changes.
Claims
1. A programmable controller that allocates the allocated time obtained by dividing the executable time in one operation cycle at a predetermined ratio to multiple systems, and executes the sequential programs of each system during the allocated time. It is characterized in that the programmable controller includes: a remainder time accumulation unit that accumulates the remainder time; a sequential execution unit that executes the sequential program for each of the above systems within the allocated time. When the execution of the sequential program ends earlier than the allocated time, the difference between the allocated time and the time taken for the execution of the sequential program, that is, the remaining time, is accumulated as the remainder time in the remainder time accumulation unit, and the execution of the sequential program of the next system is transferred without waiting for the end of the allocated time; a remaining time determination unit that determines whether remaining time has occurred based on the remainder time accumulated by the remainder time accumulation unit; and a divided sequential determination unit that, when it is determined by the remaining time determination unit that remaining time has occurred, determines whether the sequential program has been divided and executed by the sequential execution unit. If there is the sequential program, it instructs the sequential execution unit to execute the remaining part of the divided sequential program with the remaining time.
2. The programmable controller according to claim 1, It is characterized in that the programmable controller further includes an allocation table that defines the ratio for allocating the executable time to the multiple systems, the ratio for allocating the remaining time to the multiple systems can be set in the allocation table, when the sequential program has been divided and executed among the multiple systems, the divided sequential determination unit allocates the remaining time according to the ratio for allocating the remaining time to the multiple systems set in the allocation table and instructs the sequential execution unit to execute the divided sequential program.
Citation Information
Patent Citations
Ladder program processing system
JP1988317834A
Programmable controller
CN1580997A
Distributed parallel data processor, recording medium recording distributed parallel data processing program and distributed parallel data processing system
JP2001101149A
Programmable controller for completing the execution of a block of user programs within a set time period
US5392444A