The invention relates to a method and an apparatus for controlling the sequence of program parts. It in particular relates to methods and apparatus for controlling the sequence of control programs, preferably on programmable logic controllers and in accordance with the IEC 61499 standard. The method or the apparatus can be in an industrial context, for instance as a control computer of a manufacturing plant or of a logistics facility or the like.
In contrast to what has been described so far, the different arithmetic logic units can, however, also be virtual arithmetic logic units on a single piece of hardware. However, it should be noted in any case that the arithmetic logic units efficiently compete with one another to a certain extent. Virtual arithmetic logic units are allocated computing time of the real hardware that together cannot be more than 100% of the available time. And the arithmetic logic units can access common peripheral resources. In this respect, the representation in
The arithmetic logic units RW1 and RW2 can communicate with one another and to external. The communication among one another is only indicated very schematically by an arrow 104. Depending on how the arithmetic logic units are implemented, this communication can use different technologies, for instance communication on the operating system level, bus communication, network communication and the like. If arithmetic logic units communicate with one another, the communication will usually take place digitally. Incoming communication from external and outgoing communication to external are symbolized by the arrows 105 and 106. This can also be digital communication, for instance from other digital components. Or they can be analog signals, such as those coming from sensors or output to actuators. Accordingly, converters not shown, for instance A/D converters or vice versa D/A converters and possibly necessary drivers, can also be present.
The structure shown in
In addition to what is shown, it is possible for a function block 110 to generate, at its event output 112, a plurality of events that can result in the quasi-simultaneous triggering of a plurality of different function blocks. Also, a function block 110 can receive a plurality of events from different sources at its event input 111 and can thus be triggered by different events.
A control program, such as can run on the hardware schematically shown in
If a plurality of function blocks 110 are executed in parallel on a plurality of arithmetic logic units RW in one or possibly also in a plurality of simultaneously running control programs, access conflicts can occur in various constellations.
Priorities can be assigned to events or to the program parts or function blocks 110 initiated by them. Priorities have relative importance among one another in that, in the competition already mentioned for resources, such as the computing time on a real CPU or allocations of real arithmetic logic units, higher priority events are preferably processed over lower priority events. When many events are to be expected in a short time, queues are formed. Events of different priorities are found in these queues according to certain structural criteria. The priority can then have the result that the highest priority event in the queue is immediately used for execution, while lower priority events have to wait.
However, even in the case of
It is the object of the invention to disclose a method and an apparatus for controlling the sequence of program parts that enable an improved priority-based control of the sequence of program parts.
This object is satisfied by the features of the independent claims.
A method of controlling the sequence of program parts has the steps: initiated by the occurrence of a first event, executing a first program part on a first arithmetic logic unit, wherein the first event and/or the first program part is/are assigned a first priority, and initiated by the occurrence of a second event, interrupting the execution of the first program part on the first arithmetic logic unit and then executing a second program part on the first arithmetic logic unit, wherein the second event and/or the second program part is/are assigned a second priority, wherein the second priority has a predetermined and in particular a user-defined relationship with the first priority, wherein the second priority can be higher than the first priority, wherein the first and/or the second program part is/are a function block in the sense of IEC 61499 or a part thereof or a data transmission initiated thereby, and/or wherein the first program part is a program that runs on the first arithmetic logic unit when the second event occurs.
With the presented method, it is possible in a priority-controlled manner to interrupt a running program part to be able to execute another program part. The devices are in particular such that a higher priority program part can interrupt a lower priority program part. In this way, it is avoided that a high priority program part or a high priority event is prevented from being executed or is severely slowed down for a long time by low priority program parts that were triggered beforehand. These interruptions are also performed, implemented and managed by the operating control 107. The same applies to a later continuation of the previously interrupted program part.
Where reference is made in this description to designs in accordance with IEC 61499 and compliance is, for example, demonstrated, this is to be understood as extending as far as is necessary for the function of the invention or as far as is not modified by the described features of the invention.
As already shown, the program parts can be parts of a device control program or plant control program. Said control program can communicate with many external components, including analog and digital components. In very general terms, the sequence control is at least partly event-controlled and priority-controlled. This means that program parts or function blocks are called up in an event-controlled manner and prioritized among one another. If computing power or arithmetic logic units are available, the program parts can be executed immediately. Otherwise, they or the events that trigger them are placed in one or more event lists, also called queues, that are processed in accordance with certain criteria.
An important feature of the invention is that the events and/or program parts are assigned priorities. The priorities can in this respect indicate execution urgencies of the respective program part or of the event triggering a program part. As an example, it is sometimes assumed in this description that four priorities exist. They are numbered 1, 2, 3 and 4. For example, each event can be associated with one of these priorities. In this respect, it is assumed that priority 1 is the highest priority, i.e. it indicates the highest execution urgency, and then the priorities 2, 3 and 4 each indicate lower execution urgencies in descending order. Events or program parts within a considered control program can have been assigned priorities during the programming. Events arriving from external can be assigned priorities in accordance with the interface used or similar.
The assigned priorities lead to unambiguous results in the operating control if events or program parts of different priorities compete with one another in the sense that the higher prioritized event or program part is executed before the lower prioritized one. If events or program parts with the same priorities compete, further strategies can solve the conflict, for instance “Round Robin”, FIFO (“First In, First Out”), LIFO (“Last In, First Out”) or similar.
The system therefore keeps queues for events or program parts that cannot be executed immediately. In this respect, for a plurality of priorities, respective separate event lists can be kept in the sense of queues that each store events of the respective associated priority that have occurred and that designate program parts still to be processed. The above-mentioned second event is then entered in the event list corresponding to its priority and then, if there is no entry in any event list for a higher priority, is possibly used for the interruption of the execution of the first program part on the first arithmetic logic unit in accordance with the processing rules for the entries in the event list of its own priority, for instance round robin, FIFO, LIFO.
For running program parts, their priorities or the priorities of the events calling them up are suitably stored that they can be included in the priority-based comparison. Thus, the event lists can be processed away from the top, i.e. from the highest priority, and in relation to the priorities of any running program parts. These priorities can e.g. be tabulated together, which would then be updated and continued in each case and would then, if required, be retrieved, or an acquisition routine for these priorities can be provided that acquires the various priorities from distributed sources, e.g. the definitions of the running tasks, when they are needed.
A plurality of tasks can be used for the method that were created in advance as respective execution environments. The creation of a task as an execution environment can comprise a configuration of the priority with which the task is to be executed in a matching relation to the priorities of the events or function blocks and the priorities of the event queues, and can furthermore comprise a link or association with the event list of the corresponding priority. An execution environment is thus defined by a parameter set that is defined in advance, that is stored, and that can be called up at the time of execution. The parameter set forms settings of the arithmetic logic unit that are used during the execution of a program part.
They are then defined and organized in advance and thus do not require a higher-ranking administrative activity at the time of execution so that they are quickly available. The association and the control in this respect is performed by the operating control 107. The arithmetic logic units are also predefined or defined and organized in advance and thus do not require a higher-ranking administrative activity at the time of execution so that they are quickly available.
If, for example, four priorities are defined, one or more tasks can be created for each of these priorities and associated with them for execution. The association and the control in this respect are performed by the operating control 107.
However, tasks can also be used that are created in real time as a respective execution environment, preferably in response to an event that occurs, and that are removed in real time, preferably at the end of the processing of a program part, wherein the arithmetic logic units are activated in accordance with the priorities of the events that trigger them.
This variant is advantageous if rather few, longer lasting program parts are pending for execution. There will then be no administration effort for the management of arithmetic logic units that are not required. However, it becomes disadvantageous when there many events pending for execution, because even if many tasks are created, this does not increase the actually available resources so that possibly futile administrative efforts are made to create tasks.
The second event that leads to the interruption of the first program part on the first arithmetic logic unit is usually generated by another program part running on another arithmetic logic unit. However, it is also conceivable that a program part generates an event that interrupts the generating program part itself.
To decide whether the interruption of a running program part is necessary or not, monitoring results can be generated or obtained. They can be monitoring results with respect to the activity of the individual arithmetic logic units. These monitoring results can be generated by the described methods themselves, e.g. by the operating control 107, or they can be obtained from other system components, for instance the operating system, e.g. by the operating control 107. If it is evident from the monitoring results that arithmetic logic units are running empty or can be used in view of the available computing time, the interruption of a program part for the execution of a higher priority program part is not necessary. Instead, the higher priority program part can then e.g. be assigned to an empty running task or a new task can be created for this purpose.
Via the assignment of the execution of program parts, in particular the second program part, to one of the monitored arithmetic logic units, a decision can also be made in accordance with properties of the monitored arithmetic logic units. This takes into account the fact that not all the arithmetic logic units have to be the same, but can differ, for example, in terms of computing power, data connection and the like. Also with regard to such criteria, assignments of program parts to be executed to arithmetic logic units can take place and can then possibly lead to the interruptions described.
A program part can itself consist of distinguishable subparts. The possibly necessary interruption of the execution of the first program part can take place after the processing of such a subpart included in the first program part and before the start of the processing of a further such subpart in the first program part. If necessary, the interruption can, however, also occur at any desired point of the program part or of a subpart thereof.
Program parts can also be called up and processed in accordance with an execution control planning in accordance with IEC 61499, the so-called “execution control chart”, wherein the calling up of a program part from the execution control planning can be the first event effecting the execution of the first program part and/or the second event effecting the execution of the second program part, to which event a priority can be assigned or is already assigned. The priority-controlled processing of these events can overwrite or modify the otherwise following determinations of the execution control planning. In this way, an operational link to the known approach under IEC 61499 of using the “execution control chart”—“ECC”—can be established. The procedure of IEC 61499 is thus partly used and partly overwritten.
The interruption of the execution of the first program part can comprise the backup storage of the currently relevant device state, in particular the storage of the values of an arithmetic logic unit, registers, data memories, a program memory, a program pointer, files. The continuation of the previously interrupted program part can then comprise the loading of the device state that was backup-stored during the interruption for the arithmetic logic unit taking over the continuation. In this way, it is brought about that an interrupted program part can continue the processing at the logical point, where the processing was completed beforehand.
It is possible to designate program parts as uninterruptible or as program parts that cannot be executed multiple times in parallel so that, also on request by a higher priority event, they cannot be interrupted or cannot be executed a further time in parallel by a called-up task of a higher priority. This can, for example, be useful if it is a program part whose states cannot be buffered since, for example, they are external or voluminous or similar. Even if an interruption or a parallel execution of a program part would then therefore be performed in accordance with the method described so far, it is omitted if a check has shown that the program part intended for interruption is marked as uninterruptible or as not executable multiple times in parallel.
A subject of the invention is also an apparatus in accordance with IEC 61499 for performing the method described that can be a device control or a plant control and/or a programmable logic controller and that can have at least one sensor or data input and at least one actuator or data output.
A subject of the invention is also an execution apparatus for IEC 61499-compliant programs. It comprises at least two arithmetic logic units for the parallel execution of program parts that are triggered by events marked with priorities. An execution control controls the execution of program parts on the arithmetic logic units based on the priorities that are associated with the events triggering the program parts. The execution control is adapted to interrupt the execution of a first program part on an arithmetic logic unit under certain circumstances and to initiate the execution of a second program part on this arithmetic logic unit if the event triggering the execution of the second program part has a higher priority than the event triggering the execution of the first program part.
Once again, it is pointed out here that a reference to IEC 61499 does not mean that it has been fully implemented. Rather, it can be modified in accordance with the information in this description.
A subject of the invention is also a programming method in which an IEC 61499-compliant programming interface is provided that is adapted or suitable for programming the method described above. In particular, it is suitable for entering the possibly necessary interruptions, for entering the data backups possibly required for this purpose and data backups, possibly for entering the marking of a program part as uninterruptible or as not executable multiple times, and similar. The programming interface can in this respect be or comprise a graphical user interface that is adapted for entering the steps mentioned. In this respect, a programming apparatus that implements the programming method just described is then also a subject of the invention.
Embodiments of the invention will be described in the following with reference to the drawings; there are shown
In
Assuming that for systemic reasons it is not possible to assign the second program part P2 associated with the second event E2 to an arithmetic logic unit other than the arithmetic logic unit RW1 shown, the second event E214 causes the first program part P111a to be interrupted shortly after the point in time t2 so that the second program part P212, which is triggered by the second event E214, is executed on the first arithmetic logic unit RW1.
It is further assumed that the processing of the second program part P212 is completed at a later point in time t4. This is the reason to then continue the processing of the interrupted first program part 11a at a point in time t5, which is indicated by reference number 11b.
It has already been pointed out that program parts can be marked as uninterruptible. If this were the case for the program part P111 in the example of
The program part 24 triggered by the event 23 can then be executed on the arithmetic logic unit RW0 which has become free due to the completion of the program part P0, while the program part P2 then cannot be executed there. Accordingly, it is assigned to another arithmetic logic unit, the arithmetic logic unit RW1, for which it is assumed that the processing of the first program part P111a is still running at the point in time t2. The processing of the first program part P111a is then interrupted on this arithmetic logic unit RW1 since the program part P212 was called up with a higher priority and the already shown processing of the second program part P212 then takes place there that is assumed to be completed at the point in time t4.
At this point in time t4, the second program part P212 can itself generate one or more events that correspond to its regular programming and that are indicated in
A further event 15′ can also be defined or generated, for instance by the operating control 107, namely an event for triggering the processing of the interrupted program part, immediately on a program part interruption shown in
To avoid misunderstandings, it is pointed out that event lists change dynamically by adding new events, in particular the most recently generated events, and deleting previously entered events, in particular processed events, due to operational reasons. Specific representations are then snapshots in each case.
As already mentioned, the program parts triggered by events can be function blocks in the sense of IEC 61499. Accordingly, in the embodiment of
In the sequence control procedure described, the system control can now process the pending events starting with the first event list 31. In the example of
The event list design in accordance with
So far, the event-controlled and priority-controlled execution and, if necessary, interruption of program parts has been described. In the same way, this can apply to the event-controlled and priority-controlled execution and, if necessary, interruption of data transmissions that can in this respect also be understood as program parts.
In this description, an execution environment can be an arithmetic logic unit configured in a certain way by parameters. A task can be a program part running or executable in an execution environment. An arithmetic logic unit can be a processor with associated hardware or, generally, an allocated physical resource, for instance a computing time portion of multi-tasking-capable hardware. They can also be virtual computing resources or logically organized computing resources on a single piece of hardware that each execute a task per se at a point in time. A program part can be a function block in the sense of IEC 61499. An arithmetic logic unit can be a core in the sense of IEC 61499.
With 41, input events are defined that trigger the control program and that are not initiated by the program itself. As a rule, they are external events, for example the arrival of sensor data that lead to certain processing processes and possibly resulting device controls. In
In
As already mentioned, the incoming external events 41 can also be assigned priorities by appropriate steps or can be assumed as default. This can take place in the operating control 107.
In this way, it is ensured that high priority program parts can be reliably executed and are not accidentally blocked by possibly long-lasting low priority processes.
Number | Date | Country | Kind |
---|---|---|---|
22305874.4 | Jun 2022 | EP | regional |