DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Channel Custom Properties via the ActiveX interface from CVI

Solved!
Go to solution

Hi,

I'm trying to read some custom properties from a series of channels, using the iTOCommand and iTODataSheet activeX interfaces from a CVI program...

 

Basically, I have data files for processing, that contain approx. 100 channels, each with approx. 120,000 values.

What I want to do is to sequentally process each channel, and use the built in statistical analysis tools within Diadem, obtain a series of SPC and other statistical values from each channel.

(As a side note, I've already had this working using the internal VBS script engine, but would prefer to have the flexibility of controlling each step from the external CVI based supervisory application...)

 

So, programatically, I can start DIAdem, delete any pre-existing channel data, load a data file, and separately load a set of limits for the channels.

Then using the built in analysis script commands (again, controlled from the ActiveX interface) run commands like

SPCProcessCapab, which generates most of the data I require *and saves the results of the command in the custom properties of the channel that it was run on * 

and a few other script commands, such as ChnGaussFitXYWeighted, for generating graphical data for a report *which saves its resultant data in a new channel *

 

In it's simplest form, the requirement is to capture some key statistical metrics for each channel of each file, such as mean, minimum, maximum, Cp, Cpk etc.

Now, I can use the CCh command with the channel name, and 0,1,2 respectively to pull the mean, min and max values from the 'characteristic properties' of the channels, but how do I access the other custom properties created by the SPCProcessCapab command, for example the ResultsSPCCpk value?

 

As the resultant values from other commands create new channels, these can be accessed using the ChnGetVal method, but I'm struggling to find a ChnGetPropertyVal ??, or some such method, to allow access to the values I want, via ActiveX... Perhaps I'm missing something?

 

This is DIAdem 2014 if that is significant...

 

Many Thanks

0 Kudos
Message 1 of 5
(2,904 Views)

Hi,

You can use the DIAdem Connectivity Library for CVI (Library --> Customize --> activate DIAdem Connectivity).

Open this example which shows how to open connection to DIAdem:

C:\Users\Public\Documents\National Instruments\CVI2015\samples\DIAdem\automation.prj

Add this code snipped somewhere after DIAdem connection was opened:

VARIANT	MyVar;
int MyInt;
long MyLong;
// ... open DIAdem connection
CA_VariantSetInt(&MyVar,0); // initialize variant variable      
DIAdem_ITOCommandIntegerVarGet(gDIAdemCommandObj,0,"SPCCpk",&MyVar,&MyLong); // get variant from DIAdem
CA_VariantGetInt(&MyVar,&MyInt); // get integer from variant
// MyInt variable contains SPCCpk value

Regards

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 5
(2,865 Views)

Hi Christian,

 Thanks for your reply...

 

I've already been using that library, which is how I'm able to send commands, and set and get the 'global parameters'

Are you suggesting that the custom channel properties can be accessed simply as variables? What would be the 'path' of the properties? <channelName>.Properties("<property name>").value ? ( I think I already tried this...)

 

Also, why, if the properties are addressable via the get var methods, is there separate methods specifically to access specific things, like the channel name / number and the characteristic values of a channel... that method only gets one value at a time, so why have a separate method for that, if it could be achieved with the get var methods? (save for the fact of indexing through the values in a for loop I guess, but it seems odd to provide specific methods purely to simplify a programming task... )

 

Thanks..

John

0 Kudos
Message 3 of 5
(2,856 Views)
Solution
Accepted by topic author *J_B*

Hi John,

Sorry. My mistake. I thought that you want to read a global variable.

But you can also use my example to read channel properties by adding the ChnPropGet command like this:

 

DIAdem_ITOCommandDoubleVarGet(gDIAdemCommandObj,0,"ChnPropGet(\"[1]/ChnName\",\"ResultSPCCpk\")",&MyVar,&MyLong);

ChnPropGet, GroupPropGet and RootPropGet should work like this.

 

 

In the DIAdem Connectivity Library there is also the DDC_GetChannelProperty function.

As far as I know, you have to save the data portal as TDM file first, open it with DDC_OpenFile and then use DDC_GetChannelProperty function.

 

Regarding your question: Are you suggesting to read one property for multiple channels in data portal with one command line?

--> I'm not sure if there is a command like this or another workaround.

 

Regards

 

Christian
CLA, CTA, CLED
0 Kudos
Message 4 of 5
(2,846 Views)

That worked 🙂

 

Thanks for your help

0 Kudos
Message 5 of 5
(2,839 Views)