Thursday, July 25, 2013

WinCC OA 3.11 C++ Extensions (Part 1)

Intro

Quite some time ago, I made a short tutorial for creating PVSS C++ extensions. As PVSS itself made a change in name, and several changes in its version number, it's about time for an update.
The initial tutorial was split in several parts:
- Part 1
- Part 2
- Part 3
I will try to keep the same format this time around as well, while refining the process itself.


Purpose

Why would you need to use a C++ extension in the first place? As WinCC-OA already allows you to do (via scripting) almost anything you will need for most projects, this question does seem justified. The answer is simple: because with increasingly complex projects, there will come a point where the existing scripting options will not suffice. Maybe you will need to support a new database. Maybe you will need to provide a nice 3D interface of a plant to its operators. You'll know it when you need it.

The tools

Let's get started with the tools to use. I'll use the following versions:
- Microsoft Visual Studio 2010 Express (with SP1)
- WinCC OA 3.11 (32bit) - with the API installed.
- Windows 7, 64bit (with SP1)

Preparing the environment

First of all, make sure that you have the API package installed. When you installed WinCC-OA, you should have selected the special function API:

If you don't remember whether you installed the API or not, just browse through the installation folder of WinCC-OA. You should find a folder named [api] directly under the folder depicting the version number. E.g. in my case this is [d:\ETM\PVSS\3.11\api], as I'm still using the old-school folder names for WinCC-OA :-)

If you can't locate the folder, restart you WinCC-OA installer and modify the existing installation in order to add the new function.

If or once you have the API installed, the next thing to verify is whether you have the API_ROOT environment variable defined. Open the environment variables window.
If the API_ROOT is not defined, just add it and make it point to the installation folder.

A useful thing to do would be to check the API documentation. It should be available in html format on disk. See [%API_ROOT%\docu\index.html].

Ok, that's it for now. Next up: Creating the Visual Studio project.

1 comment: