From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-05-2017 05:06 AM
HI,
I'm using a CVI Adaptor as a multiple limits test step type. The module called sets the no of tests, limits and data source and that all works as expected. The next step would be to add the limits (set in Step.Results.Measurement[measNo].Limits.Hi etc) and change the name associated with each Measurement in the Measurement container. I'm having trouble figuring out how to access the flags of these values to ensure they are set AsLimit and IncludeInReport. I've seen some LV examples but can't find a CVI example.
Any pointers?
Many Thanks,
Steve
Solved! Go to Solution.
10-05-2017 03:56 PM - edited 10-05-2017 04:08 PM
Hi Steve,
You should be able to access the limits like normal through the Result.Measurement[x].Limits container, but you'll have to get at the underlying PropertyObject to set the name of the Measurement.
Something like this in CVI:
int InsertTest(CAObjHandle *Step, const char *name, long limitLow, long limitHigh) { CAObjHandle mMeasurements; CAObjHandle mMeasurement; tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "Result.Measurement", 0, &mMeasurements)); tsErrChk(TS_PropertyInsertElements (mMeasurements, &errorInfo, 0, 1, 0)); //Set the name of the underlying PropertyObject of the measurement tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "Result.Measurement[0]", 0, &mMeasurement)); tsErrChk(TS_PropertySetProperty (mMeasurement, &errorInfo, TS_PropertyName, CAVT_CSTRING, name)); //Set Comparison mode tsErrChk(TS_PropertySetValString (*Step, &errorInfo, "Result.Measurement[0].Comp", 0, "GELE")); //Set Limits tsErrChk(TS_PropertySetValNumber (*Step, &errorInfo, "Result.Measurement[0].Limits.High", 0, limitHigh )); tsErrChk(TS_PropertySetValNumber (*Step, &errorInfo, "Result.Measurement[0].Limits.Low", 0, limitLow )); Error: CA_DiscardObjHandle (mMeasurement);
CA_DiscardObjHandle (mMeasurements); return error; }
Edit:you'll have to use the TS_PropertySetFlags function to set the appropriate flags
Hope this helps!
Trent
10-09-2017 02:22 AM
Trent,
Thanks for that, it worked as far as getting the measurement name in the report but I still can't get the upper and lower limits and the measurement type into the report. I've assumed it's the Flag settings so I use TS_PropertySetFlags on the Step object with the search string as "Result.Measurement[0].Limits.High". This doesn't work, however. Here is a snippet (it's in a loop):
sprintf (cMeasLookUpString,"Step.Result.Measurement[%i].Limits.Low",iInsMeasLoop);
TS_PropertySetValNumber (sequenceContext, &errInfo, cMeasLookUpString, 0,dLowerLimit[iInsMeasLoop]);
TS_PropertyGetPropertyObject (sequenceContext, &errInfo,cMeasLookUpString, 0,&hMeasObject);
TS_PropertySetFlags(hMeasObject,&errInfo,"",0,0x3000);
Any further help would be awesome! Thanks,
Steve
10-09-2017 10:23 AM
Try setting the flag on just the "Limits" container - it should apply recursively. Also, are you trying to set a combination of flags? If not, you should only need to set 0x1000 for the Limits container. Here's an updated version of my snippet that creates a test with limits visible in the report:
int InsertTest(CAObjHandle *Step, const char *name, long limitLow, long limitHigh) { double mNumMeas = 0; CAObjHandle mMeasurements = 0; CAObjHandle mMeasurement = 0; CAObjHandle mNumericArray = 0; CAObjHandle mDataSourceArray = 0; tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "Result.Measurement", 0, &mMeasurements)); tsErrChk(TS_PropertyInsertElements (mMeasurements, &errorInfo, 0, 1, 0)); //Set the name of the underlying PropertyObject of the measurement tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "Result.Measurement[0]", 0, &mMeasurement)); tsErrChk(TS_PropertySetProperty (mMeasurement, &errorInfo, TS_PropertyName, CAVT_CSTRING, name)); //Set Comparison mode tsErrChk(TS_PropertySetValString (*Step, &errorInfo, "Result.Measurement[0].Comp", 0, "GELE")); //Set Limits & isLimit flag tsErrChk(TS_PropertySetFlags(*Step, &errorInfo,"Result.Measurement[0].Limits",0,0x1000)); tsErrChk(TS_PropertySetValNumber (*Step, &errorInfo, "Result.Measurement[0].Limits.High", 0, limitHigh )); tsErrChk(TS_PropertySetValNumber (*Step, &errorInfo, "Result.Measurement[0].Limits.Low", 0, limitLow )); //Add to NumericArray and DataSourceArray tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "NumericArray", 0, &mNumericArray)); tsErrChk(TS_PropertyGetPropertyObject (*Step, &errorInfo, "DataSourceArray", 0, &mDataSourceArray)); tsErrChk(TS_PropertyInsertElements (mNumericArray, &errorInfo, 0, 1, 0)); tsErrChk(TS_PropertyInsertElements (mDataSourceArray, &errorInfo, 0, 1, 0)); //Add to ExpectedNumMeas tsErrChk(TS_PropertyGetValNumber (*Step, &errorInfo, "ExpectedNumMeas", 0, &mNumMeas)); tsErrChk(TS_PropertySetValNumber (*Step, &errorInfo, "ExpectedNumMeas", 0, mNumMeas+1)); Error: CA_DiscardObjHandle (mMeasurements); CA_DiscardObjHandle (mMeasurement); CA_DiscardObjHandle (mNumericArray); CA_DiscardObjHandle (mDataSourceArray); return error; }
Hope this helps!
Trent
10-13-2017 01:51 AM
Hi Trent,
That looks like what I need! I've been busy elsewhere but I'll try that later today.....
Thanks for your help,
Regards,
Steve
10-14-2017 01:17 AM
Trent,
That worked like a charm,
many thanks,
Steve