Apparatus for program management of programmable logic controller
10579036 ยท 2020-03-03
Assignee
Inventors
Cpc classification
International classification
Abstract
An execution code of a user program applicable to a PLC is fitted and arranged to an adequate block among memory blocks of variable sizes, and execution order and position information of each execution code are downloaded to the PLC along with recorded execution table. A CPU module of PLC sequentially executes each execution code randomly arranged on a memory with reference to the execution table. Because an execution code is loaded on a memory block having respectively different sizes such as N, 2N and 4N, utilization of non-use space can be improved over a conventional allocation method of fixed size. An execution table is utilized to discontinuously configure a program execution area, whereby a user program can be easily modified or added during PLC operation.
Claims
1. An apparatus having a processor, for program management of a PLC (Programmable Logic Controller) in order to provide a plurality of execution codes of a plurality of user programs using a CPU module managing the PLC by executing a main operation program of the PLC, the apparatus for program management of the PLC performing steps of: generating the plurality of execution codes of the plurality of user programs by compiling a plurality of source codes; allocating a memory block adequate to a size of each of the plurality of execution codes based on memory configuration information as to what memory blocks a memory is formed with; arranging each of the plurality of execution codes at a position of the memory block allocated; generating an execution table recorded with execution order and position information of each of the plurality of execution codes; and downloading the plurality of execution codes and the execution table to the CPU module of the PLC, wherein the execution table includes an area stored with the execution order of each of the plurality of execution codes and the position information of each of the plurality of execution codes, wherein the execution table further includes a preservation area to a non-used memory, and wherein when a new user program is added during an execution of the plurality of user programs, the new user program is added to the preservation area to regenerate a modified execution table, and wherein the size of the memory block is formed with an integer of preset basic size (N), where the apparatus searches an effective memory block, starting from a first size obtained by: calculating CELL (modified size of execution codeN), which outputs a first value, and multiplying the first value with N, which outputs the first size, wherein CEIL (modified size of execution codeN) is a function representing a minimum integer number larger than a second value obtained dividing the modified size of the execution code by N, and wherein responsive to determining that the effective memory block is not available at the first size, the effective memory block is increased by the preset basic size (N) until the size of the effective memory block becomes greater than a regulated maximum block size.
2. The apparatus of claim 1, wherein the the apparatus further allocates the memory block as it is or a new memory block in response to the size of a modified execution code of the modified user program and the size of a memory block allocated to the modified execution code prior to the modification.
3. The apparatus of claim 2, wherein the apparatus further reallocates the memory block relative to each of the plurality of execution codes based on the memory configuration information, when no new memory block can be found.
4. The apparatus of claim 1, further comprising the CPU module of the PLC receiving the downloaded plurality of execution codes and the execution table and sequentially executes the plurality of execution codes with reference to the execution table.
Description
DESCRIPTION OF DRAWINGS
(1)
(2)
(3)
(4)
(5)
BEST MODE
(6) Hereinafter, an apparatus for user program management of PLC according to exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
(7) Referring to
(8) The apparatus (10) in the present disclosure defines a device configured to manage a program applicable by a user to a PLC (20) regardless of its nomenclature, and a user program may be downloaded the PLC (20). The apparatus (10) can perform various roles for operating and managing the PLC (20) as long as the apparatus can perform a function related to a program management hereinafter explained.
(9) The apparatus (10) may be installed with an application tool configured to perform such functions as preparation of ladder program by a user, and enablement of downloading to the PLC (20) by compiling the prepared program.
(10) The apparatus (10) may be configured by a computer device such as a desk top computer or a notebook computer. The apparatus (10) may be installed with application tools configured to perform functions such as preparation of ladder program by a user, and enablement of downloading to the PLC (20) by compiling the prepared program.
(11) The PLC (20) may include various types of modules such as a CPU module (21), a power module (22) and an I/O (Input/Output) module.
(12) The CPU module (21) performs a function of a basic unit of PLC (20), and may include an operation processor such as a CPU (Central Processing Unit (21-1) and a memory (21-2) recorded with execution code of a user program. The CPU module (21) defines a main control module configured to manage the PLC (20) by executing a main operation program of the PLC (20) regardless of its nomenclature.
(13) Referring to
(14) The apparatus (10) according to the present disclosure may include a compile means (11), a block allocation means (12), a link means (13), an execution table generation means (14) and a download means (15).
(15) The compile means (11) may function to generate an execution code (10-2) by compiling the source code (10-1) of a user program, where the execution code defines a type of code processible by an operation processor of PLC (20).
(16) The block allocation means (12) may function to allocate a memory block on an execution code with reference to memory configuration information (10-3). That is, the block allocation means (12) may search a memory block adequate to size of execution code compiled by the compile means (11), and allocate the searched memory block to a relevant execution code.
(17) The memory configuration information may define information indicating what memory blocks a memory is to be configured with. Each memory block may have various sizes instead of having a same size. To be more specific, the size of memory block may be configured with an integer of preset basic size (N).
(18)
(19) The memory configuration information may be variably configured in any manner according as what structure a memory is configured by block unit.
(20) The link means (13) may function to arrange an execution code to a position of a memory block allocated through the block allocation means (12). That is, an execution code of each user program may be so arranged as to be positioned at a memory address actually positioned through the link means (13). For example, when the memory block (35) of first 2N size of
(21) The execution table generation means (14) may generate an execution table (10-4) containing execution order and position information of each execution code. Although each execution code is arranged at a memory block allocated by the block allocation means (12), the position of the memory block allocated by the block allocation means (12) may be arbitrarily determined by size of execution code and current memory use state, and therefore there is no guarantee that the execution code of each user program is arranged in the execution order thereof. However, the execution code must be executed in an order desired by a user when actually executed by the PLC (20), and therefore, information on program execution order and execution position of each program is required, the role of which is performed by the execution table.
(22) Now, referring to
(23) A user program in the execution table is formed with a program 1, a program 21, a program 3 and a program 4, and the block allocation means (12) allocates the program 1, the program 21, the program 3 and the program 4 to a memory block 5, a memory block 7, a memory block 1 and a memory block 2 respectively.
(24) Then, there is no chance of the programs 14 of being executed in order, because the link means (13) arranges the program 3 to the memory block 1, the program 2 to the memory block 7, the program 3 to the memory block 1 and the program 4 to the memory block 2 respectively.
(25) To this end, the execution table (10-4) is recorded with program position information for execution of the program execution order and related order, where each program can be sequentially executed according to desire of a user by using the information. The execution table (10-4) may include various pieces of information necessary for designating the program execution order and position. For example, the execution table (10-4) may include start position of the memory block and information on size of execution code arranged on relevant memory block as well. The download means (15) may download the execution code processed by the link means (13) and the execution table generated by the execution table generation means (14) to the PLC (20).
(26) Meanwhile, when the user program already allocated with the memory blocks is modified, the block allocation means (12) may compare the size of the modified execution code with the size of memory block allocated to the execution code prior to modification, may allocate the memory block as it is, or may allocate a new memory block.
(27) Referring to
(28) The block allocation means (12) determines if there is a sufficient space to load a modified execution code on a memory block allocated to a relevant user program (S112), when the modified execution code is changed to an execution code through the compile means (11) to be block-allocated (S111).
(29) As a result of the determination at S112, when there is a sufficient space to a current memory block, the current memory block is allocated as it is (S113), and when there is no sufficient space to the current memory block, a process of searching for a new memory block is progressed (S114).
(30) As a result of performing the process of searching for new memory block, when a new memory block is searched (S115), the new memory block is allocated (S116), and a memory block is re-arranged when the new memory block cannot be searched (S117). The rearrangement of memory block means that memory blocks are all re-allocated on each execution code.
(31)
(32) First, the block allocation means (12) seeks a size of search block according to CEIL (modified size of execution codeN)N, where, CEIL (x) (i.e., CEILING (x)) is a ceiling function representing a minimum integer number larger than x (S114-1).
(33) Furthermore, determination is made as to whether an effective memory block (memory block of useable state) in search block size remains (S114-2). When it is determined that an effective memory block in the search block size currently remains, then, the step of S116 of
(34) When the effective block memory cannot be searched, it leads to failure to memory block allocation, and the step of S117 of
(35) When a certain user program is modified, rearrangement is realized by the link means (13), the rearranged execution code and an execution table modified thereby are generated again and downloaded to the PLC (20) through the download means (15).
(36) Meantime, the CPU module (21) may include a program executor (21-3) that sequentially and repetitively executes execution codes of several user programs recorded in the memory (21-2), and the CPU module (21) may maintain an execution table (21-4) downloaded from the apparatus (10). Furthermore, the CPU module (21) may load the execution code of the user program downloaded from the apparatus (10) on its own memory (21-2). Thereafter, the program executor (21-3) may sequentially execute the execution code of the memory (21-2) with reference to the execution table (21-4).
(37) As explained through the example of
(38) In view of the example of
(39) That is, the program executor (21-3) can always execute programs in a correct order, because the memory position recorded with programs to be executed by the execution table is designated in accordance with the order. Furthermore, the execution table may include a preservation area to non-used memory blocks, and therefore, the PLC (20) can easily add a new user program in the midst of operation when using the preservation area.
(40) For example, the program executor (21-3) may execute a newly added program 5 after execution of program 4, when, for example, the new added program 5 is downloaded from the apparatus (10), as in the example of
(41) The previous illustrative description of the present disclosure is provided to enable any person skilled in the art to make or use the invention. Various modifications to the invention will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the invention. Thus, the invention is not intended to limit the examples described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
INDUSTRIAL APPLICABILITY
(42) The exemplary embodiments of the present disclosure have industrial applicability in that a memory space can be efficiently used by allocating a memory block adequate to size of user program, and to modify/add an executing user program without stopping an operating PLC.