Patent Description:
Generally, an OPC UA system includes OPC UA clients and OPC UA servers. The OPC UA server executes an OPC UA server application program based on a request message from the OPC UA client. In conventional OPC UA systems, the OPC UA server application program is provided by vendors and written in compiled programming languages such as C++. The compiled programming languages use a compiler, which is a program that converts source code into machine code. When a compilation process by the compiler is finished, the converted program can be executed without need of the original source code. If a change is made to the OPC UA server program, all the source code must be edited and the compilation process must be re-run to create new machine code.

Programs written in the compiled programming languages are unable to be modified without access to all the source code and the ability to re-compile the program. However, the user of the OPC UA server may not own all the source code of the OPC UA server program. Furthermore, a highly specialized skillset is required to make any changes to the source code. Accordingly, even if the user wishes to make changes or add new functionality to the OPC UA server program, the user may not be able to easily modify the OPC UA server program, which may require the user to request a professional programmer or vendor to get a new server compiled and built. As a result, the user may expend considerable time and money to modify the OPC UA server program.

<CIT> describes a method and a system for efficiently executing computer programs that require invocation of an interpreter. A name of a program to be interpreted or executed is received, with zero or more arguments, at an interface client element which is implemented as a compact software element invoked using a command-line command. The interface client passes the program name and arguments to a continuously running server process including a continuously running or persistent interpreter. Alternatively, the server process and interpreter are integral. The server process provides the name and arguments to the interpreter, which interprets the program. One or more result values based on results of interpretation of the computer program by the interpreter are received and passed back to the interface client.

An OPC UA server according to one or more embodiments comprises: a storage configured to store a configuration file defining a server application program, the server application program being written in a compiled programming language and embedding an interpreter; a transceiver configured to receive, from an OPC UA client, an execution request to execute a calculation defined in the server application program; and a processor configured to execute the calculation using the interpreter. The calculation is defined and executed using the interpreter without modifying the compiled server application program.

A system according to one or more embodiments operates using OPC UA. The system comprises: an OPC UA server as defined above or according to any of the embodiments described herein; and an OPC UA client configured to send the OPC UA server an execution request to execute a calculation defined in the server application program. The OPC UA server is configured to execute the calculation using the interpreter upon receiving the execution request.

A method of executing an Open Platform Communications (OPC) Unified Architecture (UA) system according to one or more embodiments comprises: storing, with an OPC UA server, a configuration file defining a server application program, the server application program being written in a compiled programming language and embedding an interpreter; sending, from an OPC UA client to the OPC UA server, an execution request to execute a calculation defined in the OPC UA server application program; receiving, with the OPC UA server, the execution request; and executing, with the OPC UA server, the calculation using the interpreter upon receiving the execution request. The calculation is defined and executed using the interpreter without modifying the compiled server application program.

Embodiments of the OPC UA server and the method are defined in the dependent claims.

One or more embodiments makes it possible to modify a configuration file written in a compiled programming language used in the OPC UA system more easily and execute the OPC UA program without compiling the configuration file.

Embodiments of the present invention will be described in detail below with reference to the drawings. Like elements in the various figures are denoted by like reference numerals for consistency.

In the following description of embodiments of the invention, numerous specific details are set forth in order to provide a more thorough understanding of the invention. In other instances, well-known features have not been described in detail to avoid obscuring the invention.

<FIG> shows an OPC UA system <NUM> according to one or more embodiments. The OPC UA system <NUM> includes an OPC UA client <NUM> and an OPC UA server <NUM>. The OPC UA client <NUM> is connected to the OPC UA server <NUM> via an OPC UA network. The OPC UA system <NUM> may include a plurality of OPC UA clients <NUM> and OPC UA servers <NUM>.

The OPC UA client <NUM> is a client computer in the OPC UA system <NUM>. The OPC UA client <NUM> includes a software application that sends messages to the OPC UA server <NUM>. The messages may be data units conveyed between the OPC UA client <NUM> and the OPC UA server <NUM> that represent a predetermined service request or response. The OPC UA client <NUM> is used to define one or more calculations executed by the OPC UA server <NUM>. Each calculation defined by the user has a name.

The OPC UA server <NUM> is a server endpoint of client/server interactions. The OPC UA server <NUM> includes a software application that implements and exposes predetermined services. The OPC UA server <NUM> includes one or more calculations to be executed based on a request from the OPC UA client <NUM>.

The OPC UA client <NUM> may have functions of the OPC UA server <NUM> and vice versa.

Next, hardware configurations of the OPC UA client <NUM> and the OPC UA server <NUM> will be described.

<FIG> shows a hardware diagram of the OPC UA client <NUM> according to one or more embodiments. As shown in <FIG>, the OPC UA client <NUM> includes at least one processor (e.g., a central processing unit (CPU)) <NUM>, a memory <NUM> that communicates with the processor <NUM>, a storage <NUM>, a network interface <NUM>, and a display <NUM>. The processor <NUM> executes programs stored in the memory <NUM>. The storage <NUM> is a non-transitory computer readable storage medium. The storage <NUM> may be a hard disk drive (HDD) or a solid-state drive (SSD). The network interface <NUM> transmits and receives messages (data, signals) and may be at least one of a Local Area Network (LAN) interface, a wireless LAN interface, or a cellular network interface such as Long Term Evolution (LTE) or New Radio (NR) (<NUM>). The display <NUM> displays information based on instructions from the processor <NUM>.

<FIG> shows a hardware diagram of the OPC UA server <NUM> according to one or more embodiments. As shown in <FIG>, the OPC UA server <NUM> includes at least one processor <NUM> (e.g., a CPU), a memory <NUM>, a storage <NUM>, and a network interface <NUM>. The processor <NUM> executes programs stored in the memory <NUM>. The storage <NUM> is a non-transitory computer readable storage medium and may be referred to as a disk. The network interface <NUM> transmits and receives messages and may be at least one of a LAN interface, a wireless LAN interface, or a cellular network interface such as LTE or NR (<NUM>). Each of the OPC UA server <NUM> may include a display <NUM>. The network interface <NUM> may be referred to as a transceiver. In one or more embodiments, information stored in the memory <NUM> may be stored in the storage <NUM> and vice versa.

Next, an architecture of the OPC UA server <NUM> will be described. <FIG> shows a diagram of the OPC UA server architecture according to one or more embodiments.

As shown in <FIG>, the memory <NUM> stores a server application program <NUM> in which an interpreter <NUM> is embedded, and a server Application Programming Interface (API) <NUM>.

The server application program <NUM> is a code that implements the function of the OPC UA server <NUM>. The server application program <NUM> uses the server API to send and receive OPC UA messages to/from the OPC UA client <NUM>. The server API is an internal interface that isolates the server application program <NUM> from an OPC UA communication stack <NUM> included in the network interface <NUM>. The server application program <NUM> is defined by a configuration file to be executed based on a request from the OPC UA client <NUM>. The server application program <NUM> may be an OPC UA application program.

The OPC UA communication stack <NUM> receives a request message and publication message from the OPC UA client <NUM>. The OPC UA communication stack <NUM> sends a response message and a notification message to the OPC UA client <NUM>.

The server application program <NUM> is written in a compiled programming language such as a C++, Fortran, and COBOL, which uses a compiler that converts source code into machine code. The compiled programming language is not limited to the above examples and may be a predetermined programming language. The server application program <NUM> may be referred to as a control strategy.

The interpreter <NUM> may be a Lua scripting engine. Lua is a embeddable scripting language. The interpreter <NUM> converts source code of the server application program <NUM> line by line into a machine code on-the-fly during run time. The interpreter <NUM> may be referred to as a Lua interpreter <NUM>. As another example, the interpreter <NUM> may be a program written in JavaScript. The interpreter <NUM> is not limited to the above examples and may be a predetermined interpreter <NUM>.

By embedding an interpreter <NUM> into the OPC UA server <NUM>, the end user can define and run calculations using the interpreter <NUM>, such that the compiled OPC UA server <NUM> in which the interpreter <NUM> is hosted need not be modified.

One or more embodiments of the invention make it possible to flexibly modify the server application program <NUM> and add the function to the server application program <NUM> using the embedded interpreter <NUM> without changing all of the source code of the server application program <NUM>.

Examples of methods of configuring a calculation, modifying a configuration file, and running the calculation will be described below.

<FIG> shows a flowchart of configuring a calculation in the OPC UA server <NUM> according to one or more embodiments.

At step S101 of <FIG>, the OPC UA server <NUM> receives a configuration request including a configuration file from the OPC UA client <NUM> via a network. The configuration request may be formatted in any format.

The configuration file contains source code indicating a configuration of a calculation. The configuration file may include a name for the calculation, the number of inputs for the calculation and a data type for each input, the number of outputs of the calculation and a data type for each output, and the algorithm of the calculation written in plaintext code for an interpreter <NUM>. <FIG> is an example of the source code contained in the configuration request. In <FIG>, the name for the calculation is "MyCalc," the data type for each of inputs "A" and "B" is "INT," the data type for output "SUM" is "INT," and the algorithm is "SUM=A+B.

At step S102 of <FIG>, when the OPC UA server <NUM> receives the configuration request, the processor <NUM> of the OPC UA server <NUM> determines if a configuration file exists on the storage <NUM>.

If the determination at step S102 is yes, the OPC UA server <NUM> deletes an OPC UA object node and child nodes from the memory <NUM> and deletes existing configuration file from the storage <NUM> at step S103.

If the determination is at step S <NUM> is no, an operation of step S <NUM> is performed.

At step S104, the processor <NUM> reads the configuration file in the configuration request and creates an OPC UA node and child nodes in the memory <NUM> using "Name," "ArgsIn," and "ArgsOut" components of configuration file.

At step S <NUM>, the processor <NUM> writes the "Algorithm" component of the configuration file to the storage <NUM>.

For example, when the OPC UA server <NUM> reads the configuration file of <FIG>, the OPC UA server <NUM> performs the following steps:.

As a result, the OPC UA nodes of <FIG> are created in the address space in the memory <NUM>. In the tree structure of <FIG>, the OPC UA object node named "MyCalc" is created. The OPC UA child nodes named "Inputs," "Outputs," and "runCalc" are on the same hierarchical level under the OPC UA object node named "MyCalc.

Thus, according to one or more embodiments, the configuration file can be configured in the OPC UA server <NUM> without compiling the configuration file because the interpreter <NUM> runs the configuration file line-by-line.

Next, the method of modifying the configuration file will be described below.

When the OPC UA server <NUM> receives the configuration file of <FIG> following the configuration file of <FIG>, the OPC UA nodes as shown in <FIG> are created in the address space in the memory <NUM>. In the OPC UA nodes of <FIG>, the OPC UA object node named "Average3" is created in addition to the OPC UA object node named "MyCalc. " The OPC UA child nodes named "Inputs," "Outputs," and "runCalc" are on the same hierarchical level under the OPC UA object node named "Averages. " As shown in <FIG>, in the "Algorithm" component, is set.

According to one or more embodiments, when part of the components in the configuration file, which has been already configured in the OPC UA server <NUM>, is modified, the OPC UA client <NUM> sends the OPC UA server <NUM> a configuration file where part of components is modified.

For example, when the "Algorithm" component "AVERAGE = (Va11+Va12+Va13) / <NUM>" in the configuration file of <FIG> is modified, the OPC UA client <NUM> sends the OPC UA server <NUM> a configuration file of <FIG> where "AVERAGE = (Va11+Va12+Va13) / <NUM>" is written in the "Algorithm" component. The remaining components other than the "Algorithm" component are the same between the configuration files of <FIG> and <FIG>.

When the configuration file is modified, the OPC UA server <NUM> operates following the procedures indicated in <FIG>.

When the OPC UA server <NUM> receives the configuration file of <FIG> named "Average3" (S101 of <FIG>), the OPC UA server <NUM> determines if the configuration file named "Average3" already exists on the storage <NUM> (S102).

Because the configuration file named "Average3" already exists on the storage <NUM> (yes at S102), the OPC UA server <NUM> deletes the existing OPC UA object node named "Average3" and child nodes of the OPC UA object node named "Average3" from the memory <NUM> (S103). The OPC UA server <NUM> deletes the existing configuration file named "Average3. txt" from the storage <NUM> (S103).

The OPC UA server <NUM> creates the OPC UA object node named "Average3" and child nodes of the OPC UA object node named "Average3" in the memory <NUM> using the configuration file of <FIG> (S104).

The OPC UA server <NUM> writes the "Algorithm" component being "AVERAGE = (Va11+Va12+Va13) / <NUM>" of <FIG> to the storage <NUM> under the OPC UA filename "Average3. txt" (S105).

Thus, by modifying only a component to be fixed in the configuration file, it is possible to flexibly fix the configuration file using the interpreter <NUM>.

According to one or more embodiments, even if an error is found in the existing configuration file, the error can be fixed without compiling the configuration file because the interpreter <NUM> executes the configuration file. As a result, it is flexible to modify or fix the configuration file because the user does not need to know complicated rules such as syntax rules of the compiled programing language to modify the configuration file.

According to one or more embodiments, the OPC UA server <NUM> causes the interpreter <NUM> to execute the calculation based on a request from the OPC UA client <NUM>. <FIG> is a flowchart of running the calculation in the OPC UA server <NUM> according to one or more embodiments.

At step S201 of <FIG>, the OPC UA server <NUM> receives an execution request to execute the calculation defined in the configuration file from the OPC UA client <NUM> via a network. The execution request includes a name for the calculation and values input by the user via the OPC UA client <NUM>. In this example, the name for the calculation is "MyCalc" of <FIG> and the values "A" and "B" are "<NUM>" and "<NUM>", respectively. The processor <NUM> of the OPC UA server <NUM> writes the values of "<NUM>" and "<NUM>" to "A" and "B" in the memory <NUM>, respectively.

At step S202, the processor <NUM> reads the values of the OPC UA nodes located under "ArgsIn" of the address space from the memory <NUM> and passes values to the interpreter <NUM>. In this example, the processor <NUM> reads the values of "<NUM>" and "<NUM>" corresponding to "A" and "B", respectively, and passes the values of "<NUM>" and "<NUM>" to the interpreter <NUM>.

At step S203, the processor <NUM> loads instructions from the configuration file into memory <NUM> and passes the instructions to the interpreter <NUM>. For example, the processor <NUM> loads the instructions defined for "MyCalc" ("C=A+B") from "MyCalc. txt" in the storage <NUM>. Then, the processor <NUM> passes the instructions of "MyCalc. txt" to the interpreter <NUM>.

At step S204, the processor <NUM> executes the algorithm using the interpreter <NUM> without compiling the configuration file. For example, the interpreter <NUM> executes the calculation of "C=<NUM>+<NUM>.

At step S205, the processor <NUM> retrieves results from the interpreter <NUM> defined by "ArgsOut" and stores the results in the memory <NUM>. For example, the processor <NUM> stores the result of "<NUM>" obtained by the calculation in to the value named "C" in the memory <NUM>.

At step S206, the processor <NUM> writes the results from the interpreter <NUM> into ArgsOut nodes.

Thus, one or more embodiments provide a OPC UA system <NUM> including the OPC UA server <NUM> that is able to flexibly modify the configuration file used in the OPC UA system <NUM> and execute the calculation using the interpreter without compiling the configuration file.

In one or more embodiments, configuration files are not limited in the above examples indicated in <FIG>, <FIG>, and <FIG>. The configuration files may contain any source code that defines OPC UA application programs.

Claim 1:
An Open Platform Communications, OPC, Unified Architecture, UA, server (<NUM>) comprising:
a storage (<NUM>) configured to store a configuration file defining a server application program (<NUM>), the server application program (<NUM>) being written in a compiled programming language and embedding an interpreter (<NUM>);
a transceiver (<NUM>) configured to receive, from an OPC UA client (<NUM>), an execution request to execute a calculation defined in the server application program (<NUM>); and
a processor (<NUM>) configured to execute the calculation using the interpreter (<NUM>),
wherein the calculation is defined and executed using the interpreter (<NUM>) without modifying the compiled server application program (<NUM>).