WinCC OA Python API

The Python API for WinCC OA provides access to the WinCC OA runtime system from Python scripts. It enables reading and writing datapoints, subscribing to value changes, executing queries, and integrating with the WinCC OA logging system.

Note The Python Manager is currently available as a Beta release. Additional functionality is planned for future releases. To submit feedback, create a Siebel request and include the keyword Python.

Python and CTRL

With CTRL, WinCC OA already offers a scripting language for automation and business logic. The Python Manager adds Python as an alternative. Python and CTRL can be used side by side in the same project. Existing CTRL logic does not have to be migrated.

Note Each call of the Python API has an additional overhead compared to CTRL and JavaScript, because the API can be used safely by several threads at the same time. For calls that access the Event Manager, the Data Manager or the archive, this overhead is only a small part of the total time. It becomes noticeable when a script performs many short calls in a row, for example when it reads datapoint elements one by one. In such cases, read or write several datapoint elements with one call instead of one call per element.

Architecture

The Python Manager is a standard WinCC OA manager. Like any other manager, it connects to the Event Manager and the Data Manager and takes part in the standard manager life cycle (startup, operation, shutdown).

The manager runs Python scripts with a standard CPython interpreter. A native extension library provides the WinCC OA API to the scripts. The runtime packages and the native extensions are part of the WinCC OA installation. The interpreter is not part of the installation and must be installed separately, see Installation.

Range of Functions

  • Datapoint access: Read and write datapoint values, synchronously or in fire-and-forget mode.
  • Subscriptions: Observe value changes on datapoint elements with callback-based notifications.
  • Queries: Execute WinCC OA queries and process the result sets in Python.
  • Logging: Use the Python logging module together with the WinCC OA log system (PVSS_II.log).
  • Life cycle management: Start up, handle signals and shut down through a context manager.
  • Type mapping: Convert automatically between Python types and WinCC OA datapoint types.
  • Manager Service API: Provide services and call services of other managers (vRPC).

Use Cases