C++ dpSet API

Find and share HowTos to various installations / configurations!
Search

Post Reply
6 posts • Page 1 of 1
User avatar
Nikolay
Posts: 26
Joined: Tue Aug 21, 2012 5:10 am

C++ dpSet API

Post by Nikolay » Mon Sep 09, 2019 10:35 am

Dear colleagues. There was a need to transfer the value from a program written in the C ++ programming language to the WinCC environment, namely to Para. Tell me, please, is there a simple solution when using the API functions? I found this design in the documentation:

dpSet (const DpIdentifier & dpId, const Variable & value, const ManagerIdentifier & target = eventId);

Maybe there is an example of using this function? Thank you in advance.

User avatar
leoknipp
Posts: 1891
Joined: Tue Aug 24, 2010 5:28 pm

Re: C++ dpSet API

Post by leoknipp » Tue Sep 10, 2019 6:56 am

If you want to write information which shall be accessible by other WinCC OA processes you have to make a dpSet() to a datapoint element.
When are using an own API manager based on the WinCC OA API toolkit you can use the function dpSet().

Best Regards
Leopold Knipp
Senior Support Specialist

User avatar
Nikolay
Posts: 26
Joined: Tue Aug 21, 2012 5:10 am

Re: C++ dpSet API

Post by Nikolay » Tue Sep 10, 2019 9:47 am

You understood me wrong. I am writing a program in pure c ++. What libraries do I need to connect and what parameters should I pass to the dpSet function to write to Para?

#include "stdio.h"
#include "wincc_lib" // ?????

int main () {
int a = 5;
dpSet("dataPoint", a); // ?????
return 0;
}

Please show an example. We already studied at an advanced course, but still did not understand how to do it.

User avatar
leoknipp
Posts: 1891
Joined: Tue Aug 24, 2010 5:28 pm

Re: C++ dpSet API

Post by leoknipp » Tue Sep 10, 2019 10:53 am

If you want to implement functionality in C++ you can write an own API manager or a C++ extension.
Both possibilities are based on the API toolkit.
For details please have a look at the WinCC OA Documentation, e.g. Special functions --> Control Extensions.

Best Regards
Leopold Knipp
Senior Support Specialist

User avatar
Nikolay
Posts: 26
Joined: Tue Aug 21, 2012 5:10 am

Re: C++ dpSet API

Post by Nikolay » Tue Sep 10, 2019 11:30 am

I don't need c ++ functionality inside wincc shell. Quite the contrary. I need to pass a value from a c ++ program (developed in visual studio or borland builder) to wincc.

gschijndel
Posts: 86
Joined: Tue Jan 15, 2019 2:12 pm

Re: C++ dpSet API

Post by gschijndel » Wed Sep 11, 2019 7:37 am

To write a value to WinCC OA you will need a WinCC OA manager, which has a connection to the data & event managers. This can be an existing manager like ascii, control, driver or your own special API manager (Documentation -> Add-ons -> API).

Depending on your requirements you can choose what is the best option for your situation.
If only a few values need to be written you could start the ascii manager for each value you want to write and use the direct set mode (-set option).
If a high performance is required an API manager or a northbound 'driver' (like OPC UA server) as interface would be the best choice. An API manager has to be recompiled for newer WinCC OA versions (3.17), which would not be needed when using a standard interface.

Post Reply
6 posts • Page 1 of 1