From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert SubSequence Call Step using TS API

We are creating a LabVIEW application that generates TestStand Test Sequences, using the TS API.  I am attempting to write a SubVI that creates a TestStand Sub Sequence Call step.  The problem I am having is that although I can create the SubSequence call without problem I cannot seem to find a way of specifying the arguments for the parameters to pass to the sub sequence that is called by the SubSequence call step.
 
We are using TS 3.1 and LV 7.1
 
Has anyone got any ideas?
 
Regards
 
Steve
There are 10 types of people in the world that understand binary, those that do and those that don't.
0 Kudos
Message 1 of 7
(5,866 Views)

Hi Steve,

I have done this with C# take a look to this code

static bool DoSequenceCallStep( XmlNode nodeStep, Step step, SequenceFile seqFile, Engine engine)
{
XmlAttributeCollection attrColl;
attrColl = nodeStep.Attributes;

XmlAttribute attrID = (XmlAttribute)attrColl.GetNamedItem("ID");
XmlAttribute attrName = (XmlAttribute)attrColl.GetNamedItem("Name");
XmlAttribute attrMin = (XmlAttribute)attrColl.GetNamedItem("Min");
XmlAttribute attrSoll = (XmlAttribute)attrColl.GetNamedItem("Soll");
XmlAttribute attrMax = (XmlAttribute)attrColl.GetNamedItem("Max");
XmlAttribute attrDoReport = (XmlAttribute)attrColl.GetNamedItem("DoReport");
XmlAttribute attrSeqName = (XmlAttribute)attrColl.GetNamedItem("SeqName");

String strSeqName = attrSeqName.Value;

Sequence sequence;
// sequenz neu erstellen falls sie noch nicht existiert
if (!seqFile.SequenceNameExists(strSeqName))
{
sequence = engine.NewSequence();
sequence.Name = attrSeqName.Value;
PropertyObject pObj = sequence.Parameters;
pObj.NewSubProperty("dblMin", PropertyValueTypes.PropValType_Number, false, "", 0);
pObj.NewSubProperty(
"dblSoll", PropertyValueTypes.PropValType_Number, false, "", 0);
pObj.NewSubProperty("dblMax", PropertyValueTypes.PropValType_Number, false, "", 0);
seqFile.InsertSequence(sequence);
}
else
{
sequence = seqFile.GetSequenceByName(strSeqName);
}

SequenceCallModule objModule = (SequenceCallModule)step.Module;
objModule.UseCurrentFile =
true;
objModule.SequenceName = strSeqName;
objModule.UseSequenceParameterPrototype =
false;
objModule.LoadParametersFromSequence(sequence);

SequenceCallParameters Parameters = objModule.Parameters;
SequenceCallParameter Parameter;
String strValueExpr;

Parameter = Parameters[0];

if (attrMin.Value.Length == 0)
Parameter.UseDefaultValue =
true;
else
{
strValueExpr = attrMin.Value.Replace(
",", ".");
Parameter.ValueExpr = strValueExpr;
}

Parameter = Parameters[1];

if (attrSoll.Value.Length == 0)
Parameter.UseDefaultValue =
true;
else
{
strValueExpr = attrSoll.Value.Replace(
",", ".");
Parameter.ValueExpr = strValueExpr;
}

Parameter = Parameters[2];

if (attrMax.Value.Length == 0)
Parameter.UseDefaultValue =
true;
else
{
strValueExpr = attrMax.Value.Replace(",", ".");
Parameter.ValueExpr = strValueExpr;
}
// Do Report
bool bDoReport = true;
if (attrDoReport.Value.Length != 0)
{
String strHelp = attrDoReport.Value;
if(strHelp.CompareTo("0") == 0)
{
bDoReport =
false;
}
else
{
bDoReport =
true;
}
}
step.RecordResult = bDoReport;

// SeqName
step.Name = attrName.Value;
return true;
}

Do not care about the XML stuff from the i get the values !
I think this code snipped could be useful your you because the procedure in LV is the same

Greetings from the lake of Constance, Germany

Juergen

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 2 of 7
(5,843 Views)
Cheers Juergen
 
Exactly what I needed.
 
Regards
 
Steve
 
 
There are 10 types of people in the world that understand binary, those that do and those that don't.
0 Kudos
Message 3 of 7
(5,838 Views)
Hi Juergen,

What is the namespace that I need to include for the code in C# for calling the TS APIs to add new sequences in TestStand 4.0 dynamically?

Saranya.
0 Kudos
Message 4 of 7
(5,800 Views)

Hi Saranya,

Good question, you have to implement a second component the AdapterApi.

1. Component: (In German Called: Verweis)
NationalInstruments.TestStand.Interop.API
Location: C:\WINDOWS\assembly\GAC_MSIL\NationalInstruments.TestStand.Interop.API\4.0.0.326__ad9244eb3b825cd8\NationalInstruments.TestStand.Interop.API.dll

2. Component:
NationalInstruments.TestStand.Interop.AdapterAPI
Location: C:\WINDOWS\assembly\GAC_MSIL\NationalInstruments.TestStand.Interop.AdapterAPI\4.0.0.326__ad9244eb3b825cd8\NationalInstruments.TestStand.Interop.AdapterAPI.dll

Greetings from the lake of Constance, Germany

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 5 of 7
(5,797 Views)

Hi, is there a way to do that  using C++ language?

 

Thank you for  your help

0 Kudos
Message 6 of 7
(4,188 Views)

Hello,

How to do this using Labview.

I have inserted parameter into the TS.SData.ActualArgs.

 

But I am getting error in the module tab.

17500 

Error Occured while trying to refresh edit panel SeqEdit.o

operation Failed.

(Continuous error pop up.have to close editor)

But I can see that parameter inserted in the TS.SData.ActualArgs.

 

Regards,

Bharath

 

 

 

 

Thanks & Regards,
Bharath Kumar
GCentral
0 Kudos
Message 7 of 7
(3,124 Views)