NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Load more than one sequence file with c#

Hi,

 

this is my Trace Event Function. For Single UUT i have a solution. Then i test it with the Batchmodel. For each Teststep in the sequence there comes only one Event. So all the results have to be included in the "ExecutionViewMgrEvents_TraceEvent e" Variable.

With which method of the api i can get the result out of the ExecutionViewMgrEvents_TraceEvent variable?

 

 

private void _exeMgr_Trace(object sender, _ExecutionViewMgrEvents_TraceEvent e)
        {
            Int32 frameId;
            SequenceContext contextOfTraceMsg = e.thrd.GetSequenceContext(0, out frameId);
            if (contextOfTraceMsg.PreviousStepIndex >= 0) // -1 means no previous step
            {
                Console.WriteLine("testname: " + contextOfTraceMsg.PreviousStep.Name);
            }
        }

 

The report option generates one xml file with all uuts in it.

 

Is there a diagram of the hole ExecutionViewMgrEvents_TraceEvent structure anywhere?

 

regards,

 

René

 

 

0 Kudos
Message 11 of 25
(2,364 Views)

Hello Rene,

 

normaly if i want to read out the results from a sequence i go to

Loacals.ResultList

Why you decide to use the batch instead the parallel model?

 

best regards
Alexander
0 Kudos
Message 12 of 25
(2,341 Views)

Hi,

 

i had to test three UUTs but not for all tests are three measurement devices in the testsystem. so i had to share the measurement devices. in the batch model i can say which teststep run sequential and which run parallel.

0 Kudos
Message 13 of 25
(2,338 Views)

Hello Rene,

 

for getting the result back you can use the SequenceFilePostStep call back and in this a UIMessage can be used to send the Step Result to the UI.

best regards
Alexander
0 Kudos
Message 14 of 25
(2,323 Views)

Hi,

 

i test this solution.

 

private void _appMgr_UIMessageEvent(object sender, _ApplicationMgrEvents_UIMessageEventEvent e)
        {
            
            if ((int) e.uiMsg.Event == 10100)
            {
                // Direkte Parameter von UIMessage
                Console.WriteLine("\nUIMessageEvent: " + e.uiMsg.Event.ToString());
                Console.WriteLine("Testsocket(NumericData): " + e.uiMsg.NumericData);

                // ActiveXData in Step umwandeln
                Step teststep = e.uiMsg.ActiveXData as Step;
                Console.WriteLine("Teststepname: " + teststep.Name);

                PropertyObject po = teststep as PropertyObject;
                if (po.GetSubPropertyIndex("Result", 0, "Numeric") != -1)   // Ist ein Numeric Limit Test
                {
                    Console.WriteLine("Result: " + po.GetValNumber("Result.Numeric", 0));
                    Console.WriteLine("LowLimit: " + po.GetValNumber("Limits.Low", 0));
                    Console.WriteLine("HighLimit: " + po.GetValNumber("Limits.High", 0));
                    Console.WriteLine("Operator: " + po.GetValString("Comp", 0));
                }

                if (po.GetSubPropertyIndex("Result", 0, "String") != -1)    // Ist ein String Limit Test
                {
                    Console.WriteLine("Result:" + po.GetValString("Result.String", 0));
                    Console.WriteLine("Limit: " + po.GetValString("Limits.STring", 0));
                    Console.WriteLine("Operator: " + po.GetValString("Comp", 0));
                }

            }
        }

I send a uimsg wth id 10100 an send the RunState.CallingStep. I can read out all Result with Limits. No Problem.

There is only one variable i miss: the sequencename (MainSequence, Subsequence1, Subsequence2,...)

Is the sequencename in the RunState.CallingStep? Or had i send an other object from Teststand.

 

regard,

 

René

0 Kudos
Message 15 of 25
(2,307 Views)

Hello Rene,

 

i think the easiest way is to use another UImessage and sent the RunState.Caller.Sequence object to get the name.

 

Hope it helps if not please let me know.

best regards
Alexander
0 Kudos
Message 16 of 25
(2,302 Views)

Hi,

i check out other variables of Teststand. Now i send RunState.Caller. I found the result an limits in it. And the SequnceName.

 

 

if ((int) e.uiMsg.Event == 10101) // RunState.Caller
{
	// Direkte Parameter von UIMessage
	Console.WriteLine("\nUIMessageEvent: " + e.uiMsg.Event.ToString());
	Console.WriteLine("Testsocket: " + e.uiMsg.NumericData);
	SequenceContext seq = e.uiMsg.ActiveXData as SequenceContext;
	Console.WriteLine("seq.Name: " + seq.Step.Sequence.Name);

	Step teststep = seq.Step as Step;
	PropertyObject po = teststep as PropertyObject;
	if (po.GetSubPropertyIndex("Result", 0, "Numeric") != -1) // Ist ein Numeric Limit Test
	{
		Console.WriteLine("Result: " + po.GetValNumber("Result.Numeric", 0));
		Console.WriteLine("LowLimit: " + po.GetValNumber("Limits.Low", 0));
		Console.WriteLine("HighLimit: " + po.GetValNumber("Limits.High", 0));
		Console.WriteLine("Operator: " + po.GetValString("Comp", 0));
	}
	else if (po.GetSubPropertyIndex("Result", 0, "String") != -1)    // Ist ein String Limit Test
	{
		Console.WriteLine("Result:" + po.GetValString("Result.String", 0));
		Console.WriteLine("Limit: " + po.GetValString("Limits.STring", 0));
		Console.WriteLine("Operator: " + po.GetValString("Comp", 0));
	}
	else if (po.GetSubPropertyIndex("Result", 0, "Measurement") != -1)    // Ist ein Multiple Numeric Test
	{
		Console.WriteLine("Name: " + po.Name);
		Double[] array = (Double[])po.GetValVariant("NumericArray", 0);
		for (Int32 i = 0; i < array.Length; i++)
		{
			Console.WriteLine("array: " + array[i].ToString());
		}
	}
	else
	{
		Console.WriteLine("Kein Limittest!");
	}
	
}

Now i have a problem with the Multiple Numeric Test. How i can access the Measurement Container with the Results and Limits?

 

regards,

 

René

 

0 Kudos
Message 17 of 25
(2,290 Views)

Hello Rene,

 

the array also came back as an variant, so you have to use the getvalvariant method and then typcast the variant to and array of double values. There is an example inside of Teststand for this you can find it under

C:\Users\Public\Documents\National Instruments\TestStand 2014 (32-bit)\Examples\TestStand API\Accessing Arrays Using API

 

Please let me know if it worked.

best regards
Alexander
0 Kudos
Message 18 of 25
(2,280 Views)

Hi,

i had the RunState.Caller Object. Numeric Limit Tests and String Limit Test are no Problem. Now i want to collect the results from a Multiple Numeric Test.

The Data i want to collect are here:

 

Step->Result->Measurement[i]->Limits->Low

Step->Result->Measurement[i]->Limits->High

Step->Result->Measurement[i]->Comp

Step->Result->Measurement[i]->Data

 

Step_Result.png

 

So it is not only a numberarray. It is a NI_LimitMeasurement Array. In it there are different other object. So if i convert it to double i become only "0" back.

Where i find the "NI_LimitMeasurement" Type to cast?

 

Until i do:

SequenceContext seq = e.uiMsg.ActiveXData as SequenceContext;

Step teststep = seq.Step as Step;

PropertyObject po = teststep as PropertyObject;

 

regards,

 

René

 

0 Kudos
Message 19 of 25
(2,250 Views)

Hello Rene,

 

i get it to run here my steps

 

  1. In TS a UIMessage with the RunState.Caller.Step object is sent to the UI
  2. Then the step object is used with the AsPropertyObejct method
  3. After this the GetValVariant method with the lookup string "NumericArray" reads out the results
  4. If the number of the results are know a lookup string like Result.Measurement[0].Low is used with the GetValNumeric method to get the low limit of the measurement. For the other properties i build the additional lookup strings in the same way.

In LV this part look like

 

Unbenannt.PNG

best regards
Alexander
0 Kudos
Message 20 of 25
(2,243 Views)