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: 

Get all used step types of a sequence

Solved!
Go to solution

Hello everybody,

is it possible to get all the step types used by a sequence already in the PreUUTLoop?

Thanks for your help.

0 Kudos
Message 1 of 8
(1,487 Views)

Pointing on your client sequence you should be able to get the Sequence file path.

Then you can open the file and iterate through all steps in the sequence. For each step you can get their type.

If you find a sequence, you'll have to dive into it or open the file it points to.

A recursive algorithm can make this process generic.

However if a sequence call is evaluated at runtime using variables you'll be screwed.

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 2 of 8
(1,425 Views)

So if my sequence files grow a bit larger, it will take a while to go through all the steps.

Maybe i could save the result in a file global, so i don´t have to do it twice. Additional i could check if the file version have changed til the last go throug, so i could update the result if necessary.

Ok thanks for your advice. I hoped that there is something already implemented, but OK. 🙂

0 Kudos
Message 3 of 8
(1,416 Views)

If there is something implemented already, I don't know it. But it doesn't mean that it doesn't exist ! 🙂

 

Be careful with file globals, they are not persistent when modified at run time. You must specifically write them into your sequence file and then save this one ! This is a little bit tricky.

 

But I wonder why you need to know the step types at run time. Could you share more insights about your needs?

 

On the other end, thinking more about it, every type is stored within the sequence file (you can see that in the Types view). But I don't know how the Editor lists them. There might be, maybe, an entry somewhere in the sequence file that summarizes them all. Otherwise it means that the Editor does the exploration as I wrote it in my previous post. In any case, I would search from the sequence file object.

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
Message 4 of 8
(1,411 Views)

Ah thats a good hint about the file globals.

I tried to specifie which hardware is needed to run this sequence file. So on the different step types i could differentitate the needed hardware.

In the TestSTand API is the GetTypes method, but i don´t get it to work for the loaded sequence. I always get all types and not only the used ones.

0 Kudos
Message 5 of 8
(1,405 Views)
Solution
Accepted by topic author MOBA-User

If you can get a reference to the file, .AsPropertyObjectFile.TypeUsageList should give you all of the types in the file.

 

As for the fileglobals topic, PropertyObject Attributes like a sequence file attribute would be another place you could store this kind of data: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsref/infotopics/db_edit_param_attributes/

Hope this helps!

Trent

https://www.linkedin.com/in/trentweaver
Message 6 of 8
(1,399 Views)

Ok, the TypeUsagList seems to work. To get the name of the type i have to go throug the list with TypeUsageList.GetTypeDefinition(i).Name or is there a better way?

I created the attributes in edit -> Sequence File Proberties -> Advanced -> Attributes. But how could i edit them during runtime in the DoPreUUT? And is it possible to create them during runtime?

 

Thanks for your help.

0 Kudos
Message 7 of 8
(1,382 Views)

Ok, i found a way to set the attributes during runtime in the DoPreUUT:

RunState.ProcessModelClient.AsPropertyObjectFile.AsSequenceFile.Data.Attributes.SetValBoolean(LookUpString,1,True)

 

and with Option = 1 you are able to create them.

Thank you all for your help.

Message 8 of 8
(1,370 Views)