NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the Number of test sockets by code

Hi All,

Is there a way to get the Number of test sockets when batchModel is configured by code before executing the batch?

 

 

 

0 Kudos
Message 1 of 11
(7,370 Views)

The number of sockets is configured by the model options and later stored in the variable RunState.TestSocket.Count for the execution.

If no execution is running, you have to dig into the process model. There, you will find a variable with (depending in which sequence you are) a lookup-string containing "ModelData.ModelOptions.NumTestSockets".

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 11
(7,365 Views)

Hi Norbert,

I'm having troubles to find ContextSequence object or process model object

Can someone help me to find????

 

 

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

Please describe in more detail exactly what you are trying to do and in what part of the code.

 

-Doug

0 Kudos
Message 4 of 11
(7,353 Views)

Hi Doug,

 

Well I'm looking for a way to get the number of sockets that had configured by the Model Option dialog box before executing the sequence.

I use BatchModel with 4 test sockets and I need to get the number of sockets if batchModel is configured programatically.

Tnx

0 Kudos
Message 5 of 11
(7,349 Views)
Hi, as Doug points out, it depends on the moment in time when you need that information. I.e. If you're running in the middle of your client sequence file you'll have access to the test socket count in the runstate object. If it's before you're running then you won't have set anything programatically but you need to run something to get the default set value such as creating a sequence to go in the tools menu.
One thing to bear in mind - the number of live test sockets is not the same as the test socket count. You need to see which of the test sockets are enabled or disabled after the serial number entry pop up (pre-UUT) has run.
Thanks
Sacha
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 6 of 11
(7,319 Views)

@NewSCRUser wrote:

Hi Doug,

 

Well I'm looking for a way to get the number of sockets that had configured by the Model Option dialog box before executing the sequence.

I use BatchModel with 4 test sockets and I need to get the number of sockets if batchModel is configured programatically.

Tnx


Where does the code (that you are writing) live that is doing this thing? From where is it called? What action initiates the code being called? Is it inside of an execution, an operator interface, a step code module? There are many possibilities and the answer to your question depends on the answer to these questions.

 

-Doug

0 Kudos
Message 7 of 11
(7,304 Views)

Hi All,

 

I'm using simple interface example in c#

I understand how to find the number of sockets before execution

but where can I find "ModelData.ModelOptions.NumTestSockets". on which object ????

 

axApplicationMgr 

axFileViewMgr

axExecutionViewMgr

0 Kudos
Message 8 of 11
(7,234 Views)

The number of sockets is persisted in TestStandModelModelOptions.ini.  The model entry point (such as Single Pass) calls Initialize Execution Entry Point in ModelSupport.seq. The Read Model Option Defaults step in that sequence calls ReadModelOptionDefaults in ModelSupport2.dll. The source for ReadModelOptionDefaults is in ModelOptions.c.

 

If you breakpoint after that step, you can expand and view: Parameters>ModelData>ModelOptions>NumTestSockets.

 

You could also make the same dll call from another piece of code, or write a similar function that returns only the number of sockets.

 

 

 

 

0 Kudos
Message 9 of 11
(7,201 Views)

@Norbert_B wrote:

The number of sockets is configured by the model options and later stored in the variable RunState.TestSocket.Count for the execution.

 


Just small remark, please - you have small mistype; variable name is RunState.TestSockets.Count, not RunState.TestSocket.Count. Small detail, but I've noticed it just from the third attempt of sequence running 😃
But anyway, kudo to your post, it was very helpfull for me now! Thanks a lot.

Message 10 of 11
(5,060 Views)