Method of logging process data in a PLC controlled equipment

11086782 · 2021-08-10

Assignee

Inventors

Cpc classification

International classification

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) FIG. 1 is a schematic diagram illustrating a method and apparatus configured to log process data in a PLC controlled equipment running PLC application code according to examples of the disclosure;

(3) FIG. 2 is a schematic diagram illustrating determining hash codes of process tags and a related data table according to examples of the disclosure;

(4) FIG. 3 is a schematic diagram illustrating applying push or pull operators to a stack of process data according to examples of the disclosure;

(5) FIG. 4a is a flowchart of a method of logging process data in a PLC controlled equipment running PLC application code according to examples of the disclosure;

(6) FIG. 4b is a schematic illustration of an apparatus configured to log process data in a PLC controlled equipment running PLC application code and an associated method according to examples of the disclosure; and

(7) FIG. 5 is a schematic illustration of an apparatus configured to log process data in a PLC controlled equipment running PLC application code and an associated method according to examples of the disclosure.

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) FIG. 4a illustrates a flow chart of a method 100 of logging process data in a PLC controlled equipment running PLC application code. The order in which the steps of the method 100 are described and illustrated should not be construed as limiting and it is conceivable that the steps can be performed in varying order. The method 100 is further illustrated in conjunction with the schematic diagram of FIG. 1 described in greater detail below.

(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. FIG. 1 illustrates an example where the first and second tasks T.sub.1, T.sub.2, are assigned to threads TRD.sub.1, TRD.sub.2, respectively as the processing module 201 establish connection with a PLC controlled equipment. Each “call back” of the processing module 201 to the PLC indicates that new process data has been received from the PLC, and that the process data is assigned to a thread. It is conceivable that the number of tasks and threads vary in any plurality.

(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. FIG. 2 shows one example of a data table DT.sub.n where the tag values TG.sub.n and associated process values are arranged in the data table DT.sub.n according to the respective hash codes HC.sub.m determined by the hash function HF. In this example, tag values TG.sub.1 to TG.sub.5 and associated examples of hash codes HC.sub.m are shown. The data table structure further allows for a particularly advantageous application of logical operators, e.g. in an applied search condition to the process data, since such operators can be applied to a stack of data in the data table.

(12) FIG. 4b illustrates a further flow chart of a method 100 of logging process data in a PLC controlled equipment running PLC application code. The order in which the steps of the method 100 are described and illustrated should not be construed as limiting and it is conceivable that the steps can be performed in varying order. The method 100 may comprise determining 106 a logging event for the process data in dependence of a log condition L.sub.1, L.sub.2. The log condition L.sub.1, L.sub.2, comprises at least one logical operator or threshold of one or more process values V.sub.n being received from the PLC application code. The process values V.sub.n are effectively obtained from the tags stored in the data table DT.sub.1, DT.sub.2. The method 100 comprises receiving 107, for a logging event, at least part of the process data from the data table DT.sub.1, DT.sub.2. Thus, once the log condition is fulfilled, a logging event occurs, and process data, such as tag- and process values can be stored, for example on a dedicated log memory 203 schematically illustrated in FIG. 1. Determining 106 a logging event for the process data in dependence of a log condition L.sub.1, L.sub.2, provides for an efficient condition based logging, by being able to fully configure logging triggers (when to log data). When a log condition L.sub.1, L.sub.2, is not fulfilled the process data in the data table DT.sub.1, DT.sub.2, will not be saved to the memory 203 during the callback of the processing or communication module 201. The associated thread TRD.sub.1, TRD.sub.2, will remain active and connected through the communication module 201 the PLC until a new callback will arrive and inserts new process data to the DT.sub.1, DT.sub.2, for validation by the log condition L.sub.1, L.sub.2. For each data entry received from the PLC application code, the method 100 may comprise comparing 108 the received process values V.sub.n of the respective tags, associated with the data entry, with the log condition L.sub.1, L.sub.2, to determine 109 if the data entry is to be received for a logging event, i.e. stored in memory 203.

(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 FIG. 2 provides for an efficient evaluation of the determined log conditions L.sub.1, L.sub.2. For example, when searching amongst tag values TG.sub.n positioned under the same hash code HC.sub.m, all other tags stored in the other hash code positions will be excluded from the search. This allows the condition based logging to operate in real-time at high speeds such as with logging of process data in the range of every 1-10 ms, and in parallel for all of the tasks T.sub.1, T.sub.2 and associated data tables DT.sub.1, DT.sub.2. A faster and more stable logging of process data in a PLC systems is thus provided. FIG. 3 illustrates an example where a log condition L is evaluated with logical operators in a stacked register structure, described further below, which is particularly beneficial when having arranged the tag values and the associated process values in the respective data tables according to mentioned hash code HC.sub.m.

(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 FIG. 1, where log condition L.sub.1 is associated with the first thread TRD.sub.1 and the respective data table DT.sub.1, and vice versa for log condition L.sub.2.

(16) Turning again to the schematic illustration of FIG. 3, the method 100 may comprise applying 111 push and/or pull operators to a stack of process data received from the PLC application code for evaluating the log condition L.sub.1, L.sub.2. In the example shown, the log condition L is evaluated with logical operators and threshold values of process values V.sub.n given as “x”, “y”, and “z”. The data stack is evaluated from left to right, where the tag values, e.g. TG.sub.1, and process values, e.g. “x”, are input, followed by the logical operator, e.g. “==”, to arrive at an evaluated condition, e.g. “C1”. The following tag-, process values, and operators are applied subsequently to the stack, arriving at final evaluated condition (“C5” in this example). Executing logical operations of the log condition L.sub.1, L.sub.2, by applying such operators to the stack of process data provides for reducing the complexity in carrying out the evaluation of the conditions, which speeds up the evaluation step. Conditional logging of process data can thus be carried out at the desired rate at which the PLC equipment communicates the data.

(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. FIG. 3 illustrates an example where tag values TG.sub.2 and TG.sub.4 are assigned to the same hash code HC.sub.2. Both tag values are stored in the same “bucket” in the array to avoid collision. The hash collision is resolved by chaining with a head record in this bucket.

(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 FIGS. 1-5.

(24) As schematically illustrated in FIG. 4b, in conjunction with FIG. 1, an apparatus 200 configured to log process data in a PLC controlled equipment running PLC application code is also provided. As mentioned, sections of the PLC application code comprise tasks T.sub.1, T.sub.2, configured to execute program functions at specific execution rates, wherein a first task T.sub.1 has 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 comprise program functions having dedicated memory areas assigned as tags. Each data entry of the process data comprises a tag value TG.sub.1, . . . TG.sub.n, and an associated process value V.sub.1, . . . V.sub.n, assigned from the PLC application code. The apparatus 200 comprises a first processing module 201 configured to receive 101 process data from the PLC application code. The apparatus 200 further comprises a second processing module 202 configured to assign 102 process values associated with the first T.sub.1 task to threads TRD.sub.1, TRD.sub.2, of a thread pool in parallel with the respective assigning of process values associated with said second task to threads TRD.sub.1, TRD.sub.2, of the thread pool. The second processing module 202 is configured to receive 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 received process data. The second processing module 202 is further configured to determine 104 a hash code HC.sub.1, HC.sub.m, for each of the tag values TG.sub.n according to a hash function HF of the respective data table DT.sub.1, DT.sub.2, to arrange 105 the tag values TG.sub.n and the associated process values V.sub.n in the respective data table according to said hash code HC.sub.m. The apparatus 200 thus provides for the advantageous benefits as described above in relation to the method 100 and FIGS. 1-5.

(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.