04-05-2017 05:54 AM
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
Solved! Go to Solution.
04-05-2017 10:51 AM - edited 04-05-2017 10:53 AM
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
04-06-2017 03:41 AM
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
04-06-2017 05:58 AM - edited 04-06-2017 05:59 AM
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
04-06-2017 07:05 AM
That worked 🙂
Thanks for your help