Method and industrial controller for synchronously calling function modules in a control program with OPC UA
By copying and processing the parameters passed by the OPC-UA client within the control tasks of the industrial controller, the inconsistency problem during function module calls is solved, efficient parameter transmission and execution is achieved, and the use of additional system functions is avoided.
Patent Information
- Application Number
- CN202080061070.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-08-30
- Filing Date
- 2020-08-28
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2040-08-28
AI Technical Summary
In the prior art, when calling the functional module of the control program of an industrial controller, it may lead to inconsistencies in returning parameters or processing data, and additional system functions are required to transmit parameters, affecting execution efficiency.
Send call requests to the OPC-UA server through the OPC-UA client, and copy IN parameters to the corresponding location of the functional module within the control task of the industrial controller to ensure that the functional module is executed in the thread environment of the control program, avoiding inconsistencies, and Copy the OUT parameters to the OPC-UA server after execution.
It realizes the consistent execution of functional modules in the thread environment of the control program, ensures the accuracy and efficiency of parameter transfer, avoids the use of additional system functions, and improves the execution speed.
Smart Images

Figure CN114303107B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for calling a function module of a control program of an industrial controller, wherein the industrial controller has an OPC-UA server and communicates with an OPC-UA client by means of an OPC-UA communication protocol, and wherein the function module of the control program is requested by the OPC-UA client by calling the method of the OPC-UA server. The present invention also relates to an industrial controller with corresponding settings for executing the method. Background Art
[0002] Conventionally, programmed controllers execute control codes contained in control programs, ie executable program blocks in tasks, ie application-specific tasks, which are called cyclically by "threads", ie execution paths or execution sequences, of the controller.
[0003] Furthermore, in an SPS program ("SPS" = programmable storage controller), known methods, functions and function modules can be used. Methods and functions are usually state-independent or have no internal state information, i.e. all parameters are passed at the time of each call and are not stored. In contrast, function modules are program organization units that are usually stateful and therefore retain parameters as part of their state. Thus, the parameters of a function module can be read and / or written at a different time than when the function module is called.
[0004] The OPC-UA server (OPC-UA: Open Platform Communications Unified Architecture) can in turn provide the methods requested by the OPC-UA client. The method call is then usually carried out in the context of the OPC-UA thread that received the request from the OPC-UA client. In this case, all input parameters are uniformly passed to the method and after execution, all output parameters are uniformly returned.
[0005] However, if the OPC-UA server also calls the control code of the control program directly after calling the method, it may happen that the control program is also executed in parallel, which in turn may lead to inconsistencies in the returned parameters or the data processed in the control program.
[0006] Solutions known in the prior art allow calling OPC-UA methods in SPS programs. However, OPC-UA methods are usually mapped to SPS methods or SPS functions, which require parameters in the calling environment. The disadvantage of this method is that the call must be automatically performed before or after the task code to avoid inconsistencies, but this requires the user to take over the control of the execution time point or must call additional system functions to transmit parameters. The latter is known, for example, from EP 3 182 235 B1, which relates to a method related thereto and an industrial controller for calling the function of a control program by means of OPC-UA calls. Here, in a first step, an OPC-UA call for a function call is sent by an OPC-UA client to an OPC-UA server of an industrial controller. In a second step, the OPC-UA call is stored by the system program of the industrial controller, and in a third step, the system function of the control program is called at a defined position of the industrial control program, the system function checks whether the OPC-UA call is stored, so that in a fourth step, if such an OPC-UA call exists, the function of the control program associated with the call is called, otherwise, the industrial control program continues to execute without branching to the function.
[0007] Although it is therefore possible to call a defined function or a defined function module at a predetermined location in a control program by means of an OPC UA call in the manner described in EP 3 182 235 B1, for this, as mentioned above, it is necessary to call at least one additional system function, which therefore must first be additionally configured accordingly to verify the existence of the OPC UA call. Summary of the invention
[0008] The object of the present invention is to specify a method for calling up a function module in a control program for execution from an OPC UA client via a method of an OPC UA server without requiring such an additional system function.
[0009] This object is achieved in particular by a method according to the appended claim 1 , wherein advantageous embodiments and developments are the subject matter of the dependent claims. Furthermore, this object is achieved by an industrial controller according to the appended claim 7 .
[0010] According to the invention, in particular, a method for calling a function module of a control program of an industrial controller is provided, wherein the industrial controller has an OPC-UA server and communicates with an OPC-UA client by means of the OPC-UA communication protocol, wherein the function module is requested by an OPC-UA call of the OPC-UA client, i.e., requested to execute, in particular, a method call by the OPC-UA server from the OPC-UA client. According to the invention, it is provided that in a first step of requesting the function module, a call for the request, i.e., in particular, a call for a method of the OPC-UA server, is sent by the OPC-UA client to the OPC-UA server, and in a second step, the OPC-UA call is stored by the OPC-UA server of the industrial controller. Then, in a third step, the IN parameters transmitted with the OPC-UA call, i.e., the IN parameters transmitted by the OPC-UA client to the OPC-UA server, are copied to the corresponding IN parameters of the function module of the control program, and in a fourth step, the function module of the control program is called at a predefined position within the control task of the industrial controller and the IN parameters of the function module are executed.
[0011] An important advantage is therefore that the function module itself is executed within the thread context of the control program and thus inconsistencies are avoided, and that the IN parameters passed by the OPC-UA client to the call to the OPC-UA server are first passed consistently to the control program before the function module is executed.
[0012] The object is also achieved by an industrial controller for synchronously calling function modules in a control program. For this purpose, the invention provides in particular an industrial controller with an OPC-UA server, wherein the industrial controller is provided for the operation of the control program and for communication with an OPC-UA client, in particular by means of the OPC-UA communication protocol, and also for calling function modules of the control program, which can be requested by an OPC-UA call of the OPC-UA client.
[0013] According to the invention, the OPC-UA server is further configured to receive an OPC-UA call for a request from an OPC-UA client and to store the OPC-UA call. The industrial controller is further configured to copy the IN parameters transmitted with the OPC-UA call to the corresponding IN parameters of the function module of the control program and to call the function module of the control program at a predefined position within the control task of the industrial controller.
[0014] The advantages already discussed with respect to the method are also achieved by means of such an industrial controller.
[0015] In an advantageous development of the invention, the method and preferably also the industrial controller are designed so that OUT parameters of the function modules obtained by executing the control task and when executing the function modules of the control program are copied to the OPC-UA server after the control task has been executed.
[0016] The invention therefore ensures that OUT parameters requested by the OPC-UA client for the OPC-UA server based on the transferred IN parameters are also transmitted consistently from the control program to the OPC-UA server.
[0017] Furthermore, it is advantageously provided that the OUT parameters of the function module include parameters for signaling execution states and / or errors when the function module is executed based on an OPC UA call.
[0018] Furthermore, in a practical implementation it is preferably provided that the OUT parameters copied to the OPC UA server are returned by the OPC UA server to the OPC UA client.
[0019] In an advantageous development it is furthermore provided that the IN parameters of the function module include parameters for signaling the presence of an OPC-UA call.
[0020] In this context, further additional developments of the invention advantageously provide that, for example, at the end of the execution of a control task at least the IN parameters copied to the function module of the control program for signaling the presence of an OPC-UA call are reset to default values. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Further advantages and features of the present invention are further described in the following description of preferred embodiments with reference to the accompanying drawings, in which:
[0022] Figure 1 The schematic diagram of the important functional blocks of an industrial controller and of a client accessing the industrial controller is shown in a greatly simplified illustration. DETAILED DESCRIPTION
[0023] Figure 1 An industrial controller 200 , which is preferably a programmable storage controller, and some advantageous software components of the client 100 are schematically shown.
[0024] Specifically, in an advantageous specific embodiment, a control task 220 to be executed during a control thread 222 is shown in the industrial controller 200 , which control task is in turn provided for executing a control program 221 .
[0025] In addition, the industrial controller 200 may include other control tasks, which may be called within the control thread 222 or other control threads, in particular cyclically to execute other control programs. As is well known to those skilled in the art, control programs (also referred to as application programs) are usually used to control or monitor applications, such as applications in industrial processes or industrial manufacturing. Within the scope of these applications, corresponding function modules, such as the function module 225, may be called, which are set up to execute specific applications or functions as determined by the application.
[0026] exist Figure 1 The control program 221 schematically shown in FIG. 2 includes a function module 225, which is accordingly configured to process IN parameters 226 to OUT parameters 227. In general, a function module thus includes a defined function for executing certain input parameters in a practical implementation, wherein after executing the function module, output parameters are obtained based on the input parameters and the function, which can be passed as output parameters of the function module for further processing and / or written to a memory area provided for this purpose on the industrial controller, but not shown in detail.
[0027] In particular, in order to avoid inconsistencies between IN parameters 226 and OUT parameters 227 , the industrial controller 200 is also advantageously configured such that the execution of the function module 225 always takes place during the control thread 222 at a predefined position within the control task 220 , in particular cyclically.
[0028] Furthermore, the industrial controller 200 also includes an OPC-UA server 210 for communication, in particular as part of or expansion of an operating system not shown in detail, i.e., in particular for data exchange between the industrial controller and a client 100 arranged outside the industrial controller, wherein an OPC-UA client 110 is provided on the client 100 for the communication in this regard. Thus, the communication or data exchange between the industrial controller 200 and the client 100 takes place via the OPC-UA server 210 and the OPC-UA client 110, advantageously by means of the OPC-UA communication protocol known per se to a person skilled in the art.
[0029] A method 215 is also defined on the OPC UA server 210 , which method is preferably directed to a request A215 for a function corresponding to a function module 225 of the control program and can be called by a call A110 of the OPC UA client 110 .
[0030] In particular, within the scope of such a call A110 it is provided that the IN parameters 216 determined together with the call A110 are first transmitted from the OPC-UA client 110 to the OPC UA server 210 and then Figure 12 is indicated by an arrow indicated by a dashed line and labeled “IN1-par” between OPC-UA client 110 and OPC UA server 210, so that these IN parameters 216 are processed according to specific rules, that is, in particular according to the functions corresponding to function module 225, and the OUT parameters 217 obtained therefrom are then advantageously returned from OPC UA server 210 to OPC-UA client 110, in Figure 1 This is indicated in FIG. 2 by an arrow shown in dashed form and labeled “OUT2-par” between OPC-UA client 110 and OPC UA server 210 . The specific processing rules are stored in function module 225 of control program 221 , so that in other words, method 215 is expressed by function module 225 in control program 221 .
[0031] Thus, in particular from the industrial process or industrial production location and thus from outside the industrial controller, a request can be made to the function module 225 spontaneously or at any point in time, ie a request for execution from a specific IN parameter to an OUT parameter.
[0032] Preferably, provision is made for the method 215 called by the call A110 to be executed by the OPC UA server 210 within the corresponding UA thread 212. In this case, the call A110 is then received by the OPC UA client 110 (if present), and the IN parameters 216 received from the OPC UA client by means of the call of the method are advantageously stored on the one hand in the OPC UA server 210 and on the other hand copied to the IN parameters 226 of the function module 225 of the control program 221, in order to be executed by the OPC UA server 210. Figure 1 In the example, the arrow indicated by dashed line and labeled "IN2-par" is used between OPC-UA server 210 and function module 225. In addition, within this thread 212 or alternatively in a subsequent thread, the OUT parameter 227 of the function module obtained by the control program 221 from the processing of the IN parameter 226 is copied to the OPC UA server 215 as OUT parameter 217. Figure 1 This is indicated in FIG. 1 by an arrow indicated by a dashed line and labeled “OUT1-par” between OPC-UA server 210 and function module 225. Accordingly, in this thread or in a subsequent thread, OPC UA server 210 returns OUT parameter 217 to OPC UA client 110 (see “OUT2-par”).
[0033] exist Figure 1 The arrows shown in dashed lines between the components in FIG. 1 show a data flow or a parameter flow, and in FIG. Figure 1The arrows shown in solid lines between the components in FIG. 1 show the control flow. Accordingly, a preferred method for requesting a function module (225) provides that the OPC UA client 110 calls the method 215 of the OPC UA server 210 and transmits the corresponding IN parameters to the OPC UA server (see "IN1-par"). The call is stored by the OPC UA server 210 together with the IN parameters 216. The IN parameters 216 of the method 215 are then copied to the IN parameters 226 of the function module 225 of the control program 221 (see "IN2-par"). If the control task 220 is preferably called cyclically by the control thread 222 and then the next time for implementation, the control program 221 calls the function module 225 again within the control task 220, processes the last copied IN parameters 226 and writes the OUT parameters 227 of the function module 225 currently obtained here. After the control task 220 is implemented, the OUT parameters 227 are copied to the OPC UA server 210 for the method 215 (see "OUT1-par"). The OPC UA server may then return it to the OPC UA client 110 in thread 212 (see “OUT2-par”).
[0034] Advantageously, the IN parameters 226 additionally contain parameters for signaling the presence of an OPC-UA call. Thus, if such IN parameters are copied to the corresponding parameter input of the function module 225, the IN parameter signals the function module that a call from the OPC UA server is present. The IN parameters that signal the presence of a call can preferably be reset by the control program 221 or also by the OPC UA server 210, for example, at the end of the execution of a control task, i.e., in particular reset to a default value. With the aid of such a default value, it is also advantageously signaled that there is no new OPC-UA call, i.e., no re-execution of the function module occurs. Alternatively, the reset can also be performed before the next execution of the control task begins.
[0035] In an alternative or supplementary preferred embodiment, the OUT parameter 227 of the function module 225 also obtains at least one other parameter after processing the IN parameter 226, and the other one or more parameter signals inform the execution status and / or errors in the execution of the function module based on the OPC-UA call.
[0036] In particular, the function module can be informed by this signal that a method call A215 has been completely executed for calling the function module and / or an error code associated with the execution is displayed, which error code can advantageously be returned to the OPC UA client 110 in the event of an error.
[0037] The main advantage of the method according to the invention is that when a function module in a control program is called by an OPC UA client via a method of an OPC UA server, the function module can be executed in the thread context of the control program, the In parameter of the method can be consistently passed to the control program, the user of the control program always retains full control over the point in time at which the function module is executed, since the function module 225 is executed at a predefined position within the control task 220, and the Out parameter of the method can be consistently passed from the control program to the OPC UA server in an advantageous manner. Therefore, no additional system functions are required, in particular a check as to whether an OPC-UA call is stored, similar to the method described in EP 3 182 235 B1, which further speeds up the execution overall.
[0038] In actual implementation, Figure 1 The industrial controller 200 shown with the OPC-UA server 210 is thus provided for the operation of a control program 221 and for communication with an OPC-UA client 110, in particular by means of the OPC-UA communication protocol, and for calling a control module 225 of the control program 221, which can be requested by an OPC-UA call from the OPC-UA client 110, wherein the OPC-UA server 210 is provided for receiving the OPC-UA call for the request from the OPC-UA client 110 and for storing the OPC-UA call. As described above in the preferred embodiment, the industrial controller 200 is thus also advantageously provided for copying the IN parameters 216 transmitted with the OPC-UA call to the corresponding IN parameters 226 of the function module 225 of the control program 221 and for calling the function module 225 of the control program 221 at a predefined position within the control task of the industrial controller 200 to execute the IN parameters 216 of the function module 225.
[0039] Description of Reference Numerals
[0040] 100 clients
[0041] 110 OPC UA Client
[0042] A110 OPC-UA Client Call
[0043] 200 Industrial Controllers
[0044] 210 OPC-UA Server
[0045] 212 UA Thread
[0046] 215 Methods
[0047] A215 Method Call
[0048] 216 Input parameter or IN parameter
[0049] 217 Output parameter or OUT parameter
[0050] 220 Control Task
[0051] 221 Control Program
[0052] 222 Control Thread
[0053] 225 Functional modules
[0054] 226 Input parameter or IN parameter of function module
[0055] 227 Output parameter or OUT parameter of the function module
[0056] In1-par IN parameter transfer from OPC-UA client to OPC-UA server
[0057] IN2-par Copy of the passed IN parameter to the IN parameter of the function module
[0058] OUT1-par Copy the OUT parameters of the function module to the OPC UA server
[0059] OUT2-par Passing of copied OUT parameters to the OPC-UA client
Claims
1. A method for calling a function module (225) of a control program (221) of an industrial controller (200), wherein - the industrial controller (200) has an OPC UA server (210), - the industrial controller (200) communicates with the OPC UA client (110) by means of the OPC UA communication protocol, and - the function module (225) is requested by an OPC UA call of the OPC UA client (110), When requesting the functional module (225) - In the first step The OPC UA client (110) sends an OPC UA call (A110) for the request to the OPC UA server (210) of the industrial controller (200), - In the second step The OPC UA call (A110) is stored by an OPC UA server of the industrial controller (200), - In the third step copying the IN parameters (216) transmitted with the OPC UA call to corresponding IN parameters (226) of the function module (225) of the control program (221), and - In the fourth step The function module (225) of the control program (221) is called at a predefined position within a control task (220) of the industrial controller (200), and an IN parameter of the function module (225) is executed.
2. The method according to claim 1, wherein: The OUT parameters (227) of the function module (225) obtained when executing the IN parameters (226) of the function module (225) of the control program (221) by executing the control task (220) are copied to the OPC UA server after the control task (220) is executed.
3. The method according to claim 2, wherein: The OUT parameters (227) additionally include at least one parameter for signaling an execution status and / or an error when executing the function module based on an OPC UA call.
4. The method according to claim 1, 2 or 3, wherein: The OUT parameters (217) copied to the OPC UA server are returned by the OPC UA server to the OPC UA client.
5. The method according to claim 1, wherein: The IN parameters (226) include parameters used to signal the presence of an OPC UA call.
6. The method according to claim 5, wherein: At the end of the execution of the control task or before the next execution begins, at least the IN parameters copied to the function modules of the control program (221) for signaling the presence of an OPC UA call are reset to default values.
7. An industrial controller (200) having an OPC UA server (210), wherein: The industrial controller is configured to operate a control program (221), wherein the industrial controller (200) is configured to communicate with an OPC UA client (110) by means of an OPC UA communication protocol and to call a function module (225) of the control program (221), which call can be requested by an OPC UA call of the OPC UA client (110), wherein the OPC UA server (210) is configured to receive an OPC UA call for the request from the OPC UA client (110) and to store the OPC UA call, The industrial controller (200) is further configured to copy the IN parameters (216) transmitted together with the OPC UA call to the corresponding IN parameters (226) of the functional module (225) of the control program (221), and to call the functional module (225) of the control program (221) at a predefined position within the control task of the industrial controller (200) to execute the IN parameters of the functional module (225).
