LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Full Feature operator interface

I am using CVI full feature OI. In CVI code it creates station globals.

1. If I run the deployed exe the station globals do not get created and a error -17306 variable not found is retuned.

2. If I run the code in debug mode and step through then the station globals are created. Moreover once the station globals are created (by running the code in debug mode) and then I run the exe it always creates the station globals (even if I delete the station globals from INI file)

 

Is there anything the CVI code does to registry? Attach is snippet of code where the station global is created.

 

TIA.

 

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 11
(3,408 Views)

Hello lvrat,

I don't believe that the CVI code would make any changes to the registry; not sure how that would affect how these station global are created.

Could you reproduce a small sample program on your end that we can try to replicate over here at National Instruments? The version of both TestStand and LabWindows/CVI would be important to know as well as the OS.

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 2 of 11
(3,379 Views)

You are correct, it has nothing to do with registry which I thought initially.
I am creating numeric, string and array globals from CVI. Numeric and strings get created but when the control reaches array variable it creates one array and stops.
In other words if I have 5 arrays to be created as globals I need to relaunch operator interface 5 times for all five array globals to be created.
Is this a bug with TS_PropertyNewSubProperty function? Using CVI 8.5.

 

Here is the code to create arrays:

 

//Check if the Station Global variable Temp[] already exists
tsErrChk(TS_PropertyExists(TS_Globals, &errorInfo, "Temp", 0, &propertyExists));
if (!propertyExists)
{
//Create the Station Global
tsErrChk(TS_PropertyNewSubProperty (TS_Globals, NULL, "Temp", TS_PropValType_Number, VTRUE, "", 0));
// Set the default value
tsErrChk(TS_PropertySetValNumber(TS_Globals, &errorInfo, "Temp", 0, 0));
}

*************************************************
CLD
*************************************************
0 Kudos
Message 3 of 11
(3,365 Views)

It could be a bug, I will need to try and replicate it. Can you provide the TestStand version as well?

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 4 of 11
(3,360 Views)

TestStand version is 4.1.

*************************************************
CLD
*************************************************
0 Kudos
Message 5 of 11
(3,357 Views)

Thanks, I'm looking into it. I'll post here once I find something.

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 6 of 11
(3,343 Views)

Hello Jacob,

 

Any findings on the post? Is there a workaround such that all globals are created at first launch of operator interface?

 

thanks!!

*************************************************
CLD
*************************************************
0 Kudos
Message 7 of 11
(3,317 Views)

Hello lvrat,

Sorry, however I'm still working on it. I'll post back soon.

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 8 of 11
(3,296 Views)

Hello lvrat,

Sorry for the delay. I have tested multiple different configurations and have not been able to replicate the error. In fact the code that you provided to create arrays does not run on my TestStand. It provides an error at TS_PropertySetValNumber, since you are trying to set a numeric value to a numeric array.

 

Here is the code that I used to create station global arrays and populate them; it worked in both an exe and the development enviroment.

 

 

//accessing TS StationGlobals
tsErrChk(TS_EngineGetGlobals (gMainWindow.engine, &errorInfo, &TS_Globals));

//Check if the Station Global variable MonitorStarted already exists
tsErrChk(TS_PropertyExists(TS_Globals, &errorInfo, "globalname", 0, &propertyExists));
 if (!propertyExists)
{
//Create the Station Global
tsErrChk(TS_PropertyNewSubProperty (TS_Globals, NULL, "globalname", TS_PropValType_Number, VTRUE, "", 0));
// get a property object reference to the new global that was created
tsErrChk(TS_PropertyGetPropertyObject (TS_Globals, NULL, "globalname", 0, &MyGlobal));
// Set the size of the array
tsErrChk(TS_PropertySetNumElements (MyGlobal, NULL, 5, 0));
 // set a value
tsErrChk(TS_PropertySetValNumber(TS_Globals, &errorInfo, "globalname[0]", 0, 2));

}

CA_DiscardObjHandle(MyGlobal);

CA_DiscardObjHandle(TS_Globals);

 

 

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 9 of 11
(3,272 Views)

Hello Jacob,

 

In CVI I need to create a empty array, initialize the array to 0 but not define the size of array. Size of array gets populated in TestStand.

 

Therefore after TS_PropertyNewSubProperty function I used TS_PropertySetValNumber to intialize to zero.

 

So that gets rid of the two statements below as you provided in the code:

// get a property object reference to the new global that was created
tsErrChk(TS_PropertyGetPropertyObject (TS_Globals, NULL, "globalname", 0, &MyGlobal));
// Set the size of the array
tsErrChk(TS_PropertySetNumElements (MyGlobal, NULL, 5, 0));

 

Which brings it back to the code I have (replaced with your code) and it does not complete the creation of variables found after the array.

 

//Create the Station Global 
tsErrChk(TS_PropertyNewSubProperty (TS_Globals, NULL, "globalname", TS_PropValType_Number, VTRUE, "", 0));
 // set a default  value
tsErrChk(TS_PropertySetValNumber(TS_Globals, &errorInfo, "globalname", 0, 0));

 

Is it that the arrays do not need to be initialized?

 

Thanks.


*************************************************
CLD
*************************************************
0 Kudos
Message 10 of 11
(3,248 Views)