How Can I create a DataPoint and add it to the current project using API?

Find and share HowTos to various installations / configurations!
6 posts • Page 1 of 1
mohi65
Posts:3
Joined: Fri Oct 18, 2013 11:21 am

How Can I create a DataPoint and add it to the current project using API?

Post by mohi65 »

Hello everyone,

I'm a total WinCCOA newB.
I'm working on a custom manager using the C++ API. as a part of this application I should create a number of datapoints and add them to the current project.
Does anyone have an experience regarding this issue?
So if this is and old topic would please send me the thread's link? :S

Cheers,
Mohsen

mohi65
Posts:3
Joined: Fri Oct 18, 2013 11:21 am

Re: How Can I create a DataPoint and add it to the current project using API?

Post by mohi65 »

I managed to create the datapoint using Manager class! :cheer:
Still I need to figure out how to run another manager from my custom manager? :/

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: How Can I create a DataPoint and add it to the current project using API?

Post by leoknipp »

Hello,

it is very uncommon to start another WinCC OA process from an API process. Normally all necessary managers are started using the process monitor.
Which WinCC OA task do you want to start?

Best Regards
Leopold Knipp
Senior Support Specialist

mohi65
Posts:3
Joined: Fri Oct 18, 2013 11:21 am

Re: How Can I create a DataPoint and add it to the current project using API?

Post by mohi65 »

Hi,

Thank you for the reply!
I need to start a Control Manager from my custom API manager and feed it with an script.
So far the only way I could achieve it was through calling "WCCOActrl.exe" with proper arguments as a system command.
Actually I need to debug an script using the API manager and that's why I have to load it into a CTRL Manager.
Do you think there is a better alternative?

mpoint
Posts:49
Joined: Thu Oct 28, 2010 11:28 am

Re: How Can I create a DataPoint and add it to the current project using API?

Post by mpoint »

Actually I need to debug an script using the API manager and that's why I have to load it into a CTRL Manager.
I don't think I understand this. What do you mean with "debug a script"? I think usually you would use the Ctrl Debugger in the GEDI for that.

Anyway, if you really want to start one manager from another, it should work like this (with slight changes depending on the Version):

Code: Select all

CharString manName = ComponentNames::getName(ComponentNames::CTRL_COMPONENT);
CharString manager = PVSSFileSys::fileExists(Resources::getProjBinDir, manName + ".exe");
manager += " -proj " + Resources::getProjectName();
// TODO: add other arguments, like the script name

Process proc;
proc.exec(manager);
Disclaimer: I didn't try this out, and obviously I left out the error handling and includes.

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: How Can I create a DataPoint and add it to the current project using API?

Post by mkoller »

I don't know what you want to solve, but you might think about other possibilities:
1.) do not implement an API manager at all but implement your special functionality as a CTRL extension (a C++ coded plug in for CTRL)
2.) If you really need an API manager but still want to execute scripts, you can also integrate the CTRL interpreter into your API manager

6 posts • Page 1 of 1