LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get number value from TestStand Station globals

Hello,

 

I want to get the value of few variables (type number) fro the Station Globals of TestStand. 

I have CVI 2013 / WIN7

 

I did this :

 

TSerrChk(TS_SeqContextGetStationGlobals (rSequenceContext, NULL, &rStationGlobalsLocalsObject));    

//Chech if C1_CTR_LSR_POW_A is liseted on TestStand
		TSerrChk(TS_PropertyExists (rStationGlobalsLocalsObject, &errorInfo, "C1_CTR_LSR_POW_A", 0, &iExists));
		if(iExists == -1)
		{
			TSerrChk(TS_PropertyGetValNumber (rStationGlobalsLocalsObject, &errorInfo, "C1_CTR_LSR_POW_A", 0, &gPowA));
		}
		else  //Variable doesn't exist
		{
			sprintf(&pcReportTxt[strlen(pcReportTxt)], "Var not found : %s\n", "C1_CTR_LSR_POW_A");
			*piStepResult = FAIL;
			error = -1;
			goto Error;
		}

The problem is that I get always Zero in my variable gPowA.

 

Any idea please ? 

 

 

0 Kudos
Message 1 of 7
(3,631 Views)

Hi Houssam_AZ,

 

I found another forum post that might be helpful. Basically it says that you can access Station Globals using the Engine API commands (EngineGetGlobals or SeqContextGetStationGlobals). I've included the link below

 

http://forums.ni.com/ni/board/crawl_message?board.id=330&message.id=14008 

 

This is an Example VI draft about using these functions as well that might give some more context:

 

http://forums.ni.com/t5/Example-Program-Drafts/Accessing-TestStand-StationGlobals-in-LabVIEW-and-Lab...

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 2 of 7
(3,604 Views)

Hi,

 

You can use the get val variant call

 

tsErrChk (TS_PropertyGetValVariant(sequence, &errorInfo, "StationGlobals.StationInfo.TestStationSerialNumber", 0, &stationNum));
			CA_VariantConvertToType(&stationNum, CAVT_CSTRING,&strTmp);
			sprintf(szStationNum, "%s",strTmp);CA_FreeMemory(strTmp);

Hope this helps,

 

 

Curt

0 Kudos
Message 3 of 7
(3,589 Views)

Hello,

@Jorr-El, Thank you but both links are dead. 

 

0 Kudos
Message 4 of 7
(3,569 Views)

Hello Curt_C,

 

Thank you. I'm using exclusively string properties, to get value the faster way possible. 

I will try this any way, Variant are much more powerfull. 

0 Kudos
Message 5 of 7
(3,568 Views)

Hi Houssam_AZ

 

Hopefully this link will still work after I've posted my reply. This is an example program demonstrating how to access TestStand Station Globals in CVI.

 

This link is a related forum post regarding accessing StationGlobals, which may be helpful to look through as well. 

 

This is the example from the first link if the link doesn't work again for some reason.

#include "tsadpcvi.h" 

TSObj_PropertyObject TS_Globals; 
char*  LastUserName;
//accessing TS StationGlobals
tsErrChk(TS_EngineGetGlobals (gMainWindow.engine, &errorInfo, &TS_Globals));
tsErrChk(TS_PropertyGetValString (TS_Globals, &errorInfo, "TS.LastUserName", 0, &LastUserName));
Note that the handle to the engine has already been created in the example TestExec.c source file
tsErrChk( TSUI_ApplicationMgrGetEngine(gMainWindow.applicationMgr,  &errorInfo, &gMainWindow.engine));  

 

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 6 of 7
(3,551 Views)

Hello Jorr-El,

 

Thank you for your reply. 

New links works good. I'm gonna try that and make a feedback.  

0 Kudos
Message 7 of 7
(3,527 Views)