Method of logging process data in a PLC controlled equipment
11086782 · 2021-08-10
Assignee
Inventors
Cpc classification
G06F9/3836
PHYSICS
G06F12/0864
PHYSICS
International classification
G06F17/00
PHYSICS
G05B19/05
PHYSICS
G06F12/0864
PHYSICS
G06F9/38
PHYSICS
G06F9/30
PHYSICS
Abstract
A method of logging process data in a PLC controlled equipment is disclosed. Sections of a PLC application code comprise tasks configured to execute program functions at specific execution rates. Each of the tasks comprise program functions having dedicated memory areas assigned as tags, and each data entry of the process data comprises a tag value and an associated process value. The method comprises receiving process data from the PLC application code, assigning process values to threads of a thread pool, and receiving, for each of the threads, in a respective data table associated with each of the threads, the tag- and process values of the received process data, and determining a hash code for each of the tags according to a hash function of the respective data table for arranging the tag values and the associated process values in the respective data table according to said hash code.
Claims
1. A method of logging process data in a programmable logic controller (PLC) controlled equipment running PLC application code, wherein sections of the PLC application code comprise tasks configured to execute program functions at specific execution rates, wherein a first task has an associated execution rate different from a second execution rate of a second task in the PLC application code, whereby each of said tasks comprises program functions having dedicated memory areas assigned as tags, wherein each data entry of said process data comprises a tag value and an associated process value assigned from the PLC application code, the method comprising: receiving process data from the PLC application code, whereby process values associated with said first task are assigned to threads of a thread pool in parallel with the respective assigning of process values associated with said second task to threads of the thread pool, receiving, for each of the threads, in a respective data table associated with each of the threads, the tag and process values of the received process data, determining a hash code for each of the tags according to a hash function of the respective data table, and arranging tag values and the associated process values in the respective data table according to said hash code.
2. The method according to claim 1, further comprising determining a logging event for the process data in dependence of a log condition comprising at least one logical operator or threshold of one or more process values being received from the PLC application code, and receiving, for a logging event, at least part of the process data from the data table.
3. The method according to claim 2, further comprising: for each data entry received from the PLC application code, comparing the received process values of the respective tags, associated with the data entry, with the log condition to determine if the data entry is to be received for a logging event.
4. The method according to claim 2, further comprising: determining the logging event for the process data in dependence of a log condition for each of said threads.
5. The method according to claim 2, further comprising: applying push and/or pull operators to a stack of process data received from the PLC application code for evaluating the log condition.
6. The method of according to claim 5, further comprising applying the tags, process values and the at least one logical operator sequentially to the stack of process data for evaluating the log condition.
7. The method according to claim 1, further comprising: determining the hash function for the data table based on the tag and process values.
8. The method according to claim 7, further comprising: determining the hash function for the data table based on a data type of the tag and process values.
9. The method according to claim 1, further comprising: determining the hash function for the data table based on the number of tags.
10. The method according to claim 1, further comprising: applying a method of chaining to the hash function for a multiple of tags assigned to the same hash code.
11. The method according to claim 1, wherein the first task is associated with a communication protocol different from that of the second task, the method further comprising: encapsulating protocol specific attributes of respective communication protocols of the first and second task so that process data received therefrom is received in parallel independent of the protocol specific attributes.
12. The method according to claim 1, wherein the first task has an execution rate in the range of 1 to 10 ms, and the second task has an execution rate in the range of 100 to 1000 ms.
13. A computer program product comprising instructions which, when executed by a computer, cause the computer to carry out the method according to claim 1.
14. The method of according to claim 1, further comprising searching tag values positioned under a hash code while excluding all other tags stored under the other hash codes.
15. An apparatus configured to log process data in a programmable logic controller (PLC) controlled equipment running PLC application code, wherein sections of the PLC application code comprise tasks configured to execute program functions at specific execution rates, wherein a first task has an associated execution rate different from a second execution rate of a second task in the PLC application code, whereby each of said tasks comprise program functions having dedicated memory areas assigned as tags, wherein each data entry of said process data comprises a tag value and an associated process value assigned from the PLC application code, wherein the apparatus comprises one or more processors configured to: receive process data from the PLC application code, assign process values associated with said first task to threads of a thread pool in parallel with the respective assigning of process values associated with said second task to threads of the thread pool, receive, for each of the threads, in a respective data table associated with each of the threads, the tag and process values of the received process data, determine a hash code for each of tag values according to a hash function of the respective data table, and arrange the tag values and the associated process values in the respective data table according to said hash code.
16. The apparatus according to claim 15, wherein the one or more processors are configured to determine a logging event for the process data in dependence of a log condition comprising at least one logical operator or threshold of one or more process values being received from the PLC application code, and receive, for a logging event, at least part of the process data from the data table.
17. The apparatus according to claim 16, wherein the one or more processors are further configured to: apply push and/or pull operators to a stack of process data received from the PLC application code for evaluating the log condition, and apply the tags, process values and at least one logical operator sequentially to the stack of process data for evaluating the log condition.
18. The apparatus according to claim 15, wherein the first task is associated with a communication protocol different from that of the second task, and wherein the one or more processors are further configured to: encapsulate protocol specific attributes of respective communication protocols of the first and second task so that process data received therefrom is received in parallel independent of the protocol specific attributes.
19. The apparatus according to claim 15, wherein the one or more processors comprise: a first processor configured to receive the process data from the PLC application code, and a second processor configured to assign the process values, receive, for each of the threads, in the respective data table associated with each of the threads, the tag and process values and determine the hash code for each of the tag values.
20. The apparatus according to claim 15, wherein the one or more processors are further configured to search tag values positioned under a hash code while excluding all other tags stored under the other hash codes.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) These and other aspects, features and advantages of which examples of the invention are capable of will be apparent and elucidated from the following description of examples of the present invention, reference being made to the accompanying drawings, in which;
(2)
(3)
(4)
(5)
(6)
(7)
DETAILED DESCRIPTION
(8) Specific examples of the invention will now be described with reference to the accompanying drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these examples are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art. The terminology used in the detailed description of the examples illustrated in the accompanying drawings is not intended to be limiting of the invention. In the drawings, like numbers refer to like elements.
(9)
(10) A method 100 of logging process data in a PLC controlled equipment running PLC application code is thus provided. The PLC controlled equipment could be equipment of a system for filling and sealing packaging containers, and various machines related thereto. The PLC application code may be downloaded into the persistent memory of the equipment to perform the desired package equipment functionality. Sections of the PLC application code comprise tasks T.sub.1, T.sub.2, configured to execute program functions at specific execution rates. The PLC application may be divided into different task depending on which kind functionality is required. For example, some functionalities may be executed on a shorter time scale such as servo drives, hydraulics etc, than other functions less critical functions such as temperature control etc. A first task T.sub.1 may thus have an associated execution rate different from a second execution rate of a second task T.sub.2 in the PLC application code. Each of the tasks T.sub.1, T.sub.2, comprise program functions having dedicated memory areas assigned as “tags”. Each data entry of the process data to be received from the PLC controlled equipment comprises a tag, i.e. a tag value TG.sub.1, . . . TG.sub.n, corresponding to a given name of the data type, and an associated process value V.sub.1, . . . V.sub.n, (could be various data types) being assigned from the PLC application code. The process value V.sub.1, . . . V.sub.n, could originate from a sensor or other internal function etc. A machine such as a filling machine for packaging containers may for example require operate with thousands of tags. The method 100 comprises receiving 101 process data from the PLC application code. As described further below with respect to apparatus 100 configured to log process data in a PLC controlled equipment running PLC application code, the process data is retrieved by establishing connections with the PLC controlled equipment via a processing module 201 such as a communication module communicating with the PLC controlled equipment. The method 100 comprises assigning 102 process values associated with the first task T.sub.1 to threads TRD.sub.1 of a thread pool in parallel with the respective assigning of process values associated with said second task T.sub.2 to threads TRD.sub.1 of the thread pool. The method 100 and associated processing module 201 thus provide for the assigning of tasks T.sub.1, T.sub.2, configured to execute program functions at different execution rates, to the threads TRD.sub.1, TRD.sub.2, in parallel or simultaneously, independent of the different execution rates. Accordingly, it is possible to accommodate the various logging speed requirements for the different tasks.
(11) The method 100 comprises receiving 103, for each of the threads TRD.sub.1, TRD.sub.2, in a respective data table DT.sub.1, DT.sub.2, associated with each of the threads TRD.sub.1, TRD.sub.2, the tag- and process values TG.sub.n, V.sub.n, of the process data received from the PLC controlled equipment. The method 100 further comprises determining 104 a hash code HC.sub.m, for each of the tags (i.e. for tag values TG.sub.n thereof) according to a hash function HF of the respective data table DT.sub.1, DT.sub.2, for arranging 105 the tag values TG.sub.n and the associated process values V.sub.n in the respective data table DT.sub.1, DT.sub.2 according to the mentioned hash code HC.sub.m. This provides for an increased speed of receiving and arranging the process data in a manner so that logging of a multitude, e.g. thousands, of tags in various time domains including real-time can be realized in a PLC controlled equipment. Determining a hash code HC.sub.m for each of the tags according to a hash function HF of the respective data table DT.sub.1, DT.sub.2, allows for optimizing the structuring of the process data in the data tables DT.sub.1, DT.sub.2. Subsequent operations in the data tables DT.sub.1, DT.sub.2, such as search operations, can be executed at higher speed, allowing for example real-time condition-based logging as described further below. At the same time, versatility is increased without added complexity of the logging system since the data table allows for handling all generic types of process data. The hash function HF can be determined depending on the process data (e.g. the characteristics of the tags) communicated from the processing module 201 to the associated threads TRD.sub.1, TRD.sub.2, as described further below.
(12)
(13) Having arranged the tag values and the associated process values in the respective data tables according to the hash code, as described above and exemplified in
(14) The second processing unit 202 of the apparatus 100 may thus be configured to determine 106 a logging event for the process data in dependence of a log condition L.sub.1, L.sub.2, comprising at least one logical operator or threshold of one or more process values being received from the PLC application code, and configured to receive 107, for a logging event, at least part of the process data from the data table DT.sub.1, DT.sub.2.
(15) The method 100 may comprise determining 110 the logging event for the process data in dependence of a log condition L.sub.1, L.sub.2, for each of the threads TRD.sub.1, TRD.sub.2. This is schematically illustrated in
(16) Turning again to the schematic illustration of
(17) The method 100 may comprise determining 104 the hash function HF for the data table DT.sub.1, DT.sub.2, based on the tag- and process values TG.sub.n, V.sub.n. The mentioned values may thus be arranged in the respective data table DT.sub.1, DT.sub.2, according to an optimized hash function HF taking into account the characteristics of the tags such as the tag- and process values TG.sub.n, V.sub.n. The hash function HF may thus be optimized or selected based on the information about the tag- and process values TG.sub.n, V.sub.n, communicated from the processing module 201 when establishing connection with the PLC equipment for communication the process values. Optimized choice of hash function HF provides for reducing the look-up time and increasing the speed by which a condition based logging can be executed.
(18) The method 100 may comprise determining 104 the hash function HF for the data table DT.sub.1, DT.sub.2, based on a data type of the tag- and process values TG.sub.n, V.sub.n, e.g. Boolean, Integer, Real number etc. This provides for further optimization and selection of the hash function HF, so that the tags and the associated hash codes HC.sub.m are arranged in the respective data tables DT.sub.1, DT.sub.2, optimized to the data type.
(19) Also, the method 100 may comprise determining 104 the hash function HF for the data table DT.sub.1, DT.sub.2, based on the number of tags TG.sub.n. This may advantageously avoid the need for subsequent re-sizing of the data structure, since the amount of tags is known already from the initial call back connection of the processing module 201 to the PLC equipment. Faster and more stable logging can thus be achieved.
(20) The method 100 may comprise applying 112 a method of chaining to the hash function HF for a multiple of tags TG.sub.n assigned to the same hash code HC.sub.m.
(21) The first task T.sub.1 may be associated with a communication protocol different from that of the second task T.sub.2. The method 100 may comprise encapsulating 101′ protocol specific attributes of respective communication protocols of the first and second task T.sub.1, T.sub.2, so that process data received therefrom is received in parallel independent of the protocol specific attributes. Thus, the first processing unit 201 may be configured to encapsulate 101′ protocol specific attributes of respective communication protocols of the first and second task so that process data received therefrom is received in parallel independent of the protocol specific attributes. This provides for logging the process data without being hindered by different protocol communication standards, and thereby facilitating the logging at desired speed.
(22) The first task T.sub.1 may have an execution rate in the range of 1-10 ms, and the second task T.sub.2 may have an execution rate in the range of 100-1000 ms. The method provides for simultaneous logging of the first and second tasks T.sub.1, T.sub.2, and a varying number of different tasks, having different execution rates, may further be logged.
(23) A computer program product is provided comprising instructions which, when the program is executed by a computer, cause the computer to carry out the steps of the method 100 as described above in relation to
(24) As schematically illustrated in
(25) The present invention has been described above with reference to specific examples. However, other examples than the above described are equally possible within the scope of the invention. The different features and steps of the invention may be combined in other combinations than those described. The scope of the invention is only limited by the appended patent claims.
(26) More generally, those skilled in the art will readily appreciate that all parameters, dimensions, materials, and configurations described herein are meant to be exemplary and that the actual parameters, dimensions, materials, and/or configurations will depend upon the specific application or applications for which the teachings of the present invention is/are used.