NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Load more than one sequence file with c#

Hi,

 

it runs :).

 

if (po.GetSubPropertyIndex("Result", 0, "Measurement") != -1)    // Ist ein Multiple Numeric Test
{
      Console.WriteLine("Name: " + po.Name);
      var array = po.GetValVariant("NumericArray", 0);
                    
      for (Int32 i = 0; i < array.Length; i++)
      {
         Console.WriteLine("Measurement: " + po.GetValNumber("Result.Measurement[" + i + "].Data", 0));
         Console.WriteLine("low.limit: " + po.GetValNumber("Result.Measurement[" + i + "].Limits.Low", 0));
         Console.WriteLine("high.limit: " + po.GetValNumber("Result.Measurement[" + i + "].Limits.High", 0));
      }
}

In the next Step i had to change the active UUTs. If found the variable in

 

RunState.Caller.Parameters.ModelData.TestSockets[].Disabled

 

Is this the right place?

 

How i can get access to this variable before i run the testplan?

 

regards,

 

René

0 Kudos
Message 21 of 25
(1,981 Views)

Hi,

 

i test something.

else if ((int)e.uiMsg.Event == 10103) // RunState.Caller
{
	Console.WriteLine("\nUIMessageEvent: " + e.uiMsg.Event.ToString());
	Console.WriteLine("PreUUT: " + e.uiMsg.NumericData);

	SequenceContext seqcont = e.uiMsg.ActiveXData as SequenceContext;
	var par = seqcont.Parameters.GetValVariant("ModelData.TestSockets", 0);
	for (Int32 i = 0; i < par.Length; i++)
	{
		Console.WriteLine("UUT disabled(" + i + "): " + seqcont.Parameters.GetValBoolean("ModelData.TestSockets[" + i + "].Disabled", 0));
		if (i == 1)
			seqcont.Parameters.SetValBoolean("ModelData.TestSockets[" + i + "].Disabled", 0, true);
	}
}

If i run this code the test stops after this call.

 

UIMessageEvent: 10103
PreUUT: 3
'TestStandMultiDUT.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestStandMultiDUT.vshost.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
UUT disabled(0): False
UUT disabled(1): False
UUT disabled(2): False

UIMessageEvent: 10103
PreUUT: 3
UUT disabled(0): False
UUT disabled(1): True
UUT disabled(2): False

UIMessageEvent: 10103
PreUUT: 3
UUT disabled(0): False
UUT disabled(1): True
UUT disabled(2): False
The thread '<No Name>' (0x264) has exited with code 0 (0x0).
The thread 'vshost.RunParkingWindow' (0xe14) has exited with code 0 (0x0).
The thread '<No Name>' (0x4a4) has exited with code 0 (0x0).
The program '[2928] TestStandMultiDUT.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0)

If i commend out the red lines the test is running.

UIMessageEvent: 10103
PreUUT: 3
'TestStandMultiDUT.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestStandMultiDUT.vshost.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
UUT disabled(0): False
UUT disabled(1): False
UUT disabled(2): False

UIMessageEvent: 10103
PreUUT: 3
UUT disabled(0): False
UUT disabled(1): False
UUT disabled(2): False

UIMessageEvent: 10103
PreUUT: 3
UUT disabled(0): False
UUT disabled(1): False
UUT disabled(2): False

UIMessageEvent: 10101
Testsocket: 0
seq.Name: MainSequence
Result: 5,123456789
LowLimit: 0,1234
HighLimit: 10,5678
Operator: GELE

UIMessageEvent: 10101
Testsocket: 1
seq.Name: MainSequence
Result: 5,123456789
LowLimit: 0,1234
HighLimit: 10,5678
Operator: GELE

UIMessageEvent: 10101
Testsocket: 2
seq.Name: MainSequence
Result: 5,123456789
LowLimit: 0,1234
HighLimit: 10,5678
Operator: GELE

 

I call the uimsg in the preuut callback

 

preuut_error.png

 

What is going wrong in ths state?

 

regards,

 

René

0 Kudos
Message 22 of 25
(1,967 Views)

Hello Rene,

 

i get it to work. I sent the UImessage in the PreBatch Callback

PreBatch.PNG

 

 

On the UI side i write then the values in the local variables, but it should possible to write it direct to the

Parameters.ModelData.TestSockets[x].Disabled. This is the reason why i used an expression after the callback to set the values.

 

Parameters.ModelData.TestSockets[0].Disabled = Locals.Socket0,
Parameters.ModelData.TestSockets[1].Disabled = Locals.Socket1,
Parameters.ModelData.TestSockets[2].Disabled = Locals.Socket2

 

On UI side in LabVIEW it look like

 

Callback.PNG

 

I hope it helps

best regards
Alexander
0 Kudos
Message 23 of 25
(1,949 Views)

Hi,

 

with Callback in PreBatch it is running :). Now i had to implement it in the finale Application.

 

regards,

 

René

0 Kudos
Message 24 of 25
(1,945 Views)

Hi,

 

the part with collecting Result ist running :).

Now i am at the end of the Test. Each UUT is calling the EndExecution Event. And same other Callback also.

 

private void _appMgr_EndExecution(object sender, _ApplicationMgrEvents_EndExecutionEvent e)
{
      Console.WriteLine("EndExecution: " + e.exec.ResultStatus);
      Console.WriteLine("Sequence: " + e.exec.DisplayName);
}

How i can filter the Events? I only need the overall Results of the UUTs.

The overall Result is saved in  e.exec.ResultStatus.

My question: Where i find the Testsocketnumber? I need it to save the overall result into the uut results.

 

regards,

 

René

0 Kudos
Message 25 of 25
(1,934 Views)