Blog

WinCC OA Object Oriented Programming with Ctrl++

WinCC OA Object Oriented Programming with Ctrl++

As demonstrated in the blog Siemens WinCC OA - The Open Architecture SCADA Package, I’m a huge fan of the WinCC OA (OA) package from Siemens and the platform continues to evolve with usability improvements.

One of those improvements is the inclusion of Object Oriented programming constructs such as properties, enumerators, and classes into the CTRL language as of version 3.15. These new extensions are called CTRL++.

When these extensions were first released, some DMC engineers and I created the alpha release of the WinCC OA Open Library and released it for people to build off of. It’s a companion component to the Open PLC Library.

This code will undergo significant revisions and be released as a more full-featured package in the coming months. In the meantime, it’s a fantastic starting place to get your feet wet in CTRL++.

Creating highly configurable and reusable objects with OA is the bread and butter of the platform. CTRL++ extends the capability to do this rather significantly.

Any programmer is familiar with properties. Things like size, shape, font, etc.

Types of properties for WinCC OA

CTRL++ gives us the ability to create properties. Properties like the typeOfbutton property listed here which allows dropping a button object on the screen and telling it how it will set the logic on button press.

Property editor typeOfButton

The code to create these properties are placed in the “scopelib” (object scope global variables/methods) and are simple to create.

Properties listing ScopeLib

Code for scopelib

The type of the property shown here is “buttonType” which, as most programmers will know is not a standard primitive data type. That’s because it’s an enumerator! Here is the definition

The final key piece of this new CTRL++ functionality is the creation of classes. Here is a simplified piece of a class I’m currently working on.

Just instantiate the class in the scopelib of the object you want to use it with.

Then call a function.

Our thinking on best practice to implement CTRL++ has evolved a bit over the last year (mostly to encapsulate even more into the class structure), but go check out the OA Open Library code for examples on how to utilize this exciting new functionality.

Check out DMC's WinCC Open Architecture Development.

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above: