WinCC OA JavaScript Manager for Node.js

The WinCC OA JavaScript Manager for Node.js is a manager that allows for the integration of the TypeScript/JavaScript runtime environment Node.js® into WinCC OA.

With CONTROL, WinCC OA already offers a high-performance scripting language. Nevertheless, open alternatives based on well-known programming languages are in high demand. WinCC OA therefore provides a TypeScript/JavaScript manager based on Node.js®, which enables the use of libraries from the Node.js® environment.

Figure 1. Node.js®

Advantages

  • TypeScript/JavaScript (referred to as TS/JS in the following documentation) are among the most widely used programming languages. Integration in WinCC OA makes it much easier for you to find suitable developers.
  • The use of new technologies offers several advantages. For example, you can use the npm package manager to access the entire Node.js® ecosystem with around 2 million existing libraries
  • The wide range of use cases, such as creating business logic on WinCC OA side, the ability to read data from WinCC OA to visualize metrics via open source tools such as Prometheus or Grafana, importing data from third-party web-based sources, and much more.

Architecture

Figure 2. WinCC OA JavaScript Manager for Node.js as interface

Node.js®

Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more. Node.js runs on the V8 JavaScript engine, and executes JavaScript code outside a web browser. Source: Node.js (Wikipedia)

npm

npm is the default package manager for the JavaScript runtime environment Node.js and is included as a recommended feature in the Node.js installer. Source: npm (Wikipedia)

Node.js® Add-on

A dynamically linked library that connects to Node.js® as well as the WinCC OA libraries. The WinCC OA JavaScript Manager for Node.js loads these libraries and acts as the interface between them. The add-on is started within the Node.js® runtime environment and connects to EVENT and DATA like any other WinCC OA manager.

Startup procedure of the WinCC OA JavaScript Manager for Node.js

  1. Node.exe is started via the WinCC OA console
  2. The bootstrap script is loaded and initialized
  3. The bootstrap script loads the Node.js® add-on
  4. The Node.js® add-on initializes the manager environment and connects to EVENT and DATA
  5. The bootstrap script loads the customer code

Getting started with Node.js®

To get your first Node.js® project going, first read and execute the steps in the chapters Requirements and Installation of Node.js®. Then start your development project following the steps of Node.js® TypeScript Module Example Implementation or Node.js® JavaScript Module Example Implementation (depending on whether you want to use TypeScript or JavaScript). Finally take a look at the chapter Basic Configuration of the Node.js® Interface.

Important: Most code examples in the following documentation chapters are not complete, but only snippets that show how to use a method or type. Note that the methods described in this documentation must be called from code inside a method or function to prevent unexpected or undefined behavior.

Range of functions

A certain range of functions is available. A complete overview can be found in the winccoa-manager chapter. It is planned to extend this scope with future updates or version releases.