NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write to step property during run time

Hi All,

I am creating a custom step in which i want to write a "data" to the step property. I am able to write and read it in edit time (using edit substep), but not during run time (pre substep). In pre substep, say, i write 5 to "data" and read back using TS API. I am getting the data as 5 (i can see it using a probe in LV). But once the execution is complete i donot see the value 5 in the "data" of my step property. How do i write to the step property and retain the value even after execution?

I am passing the sequence context to write to the step property. I think i should pass a different reference during run time. Thanks for any help.

0 Kudos
Message 1 of 7
(3,598 Views)

Hi.

When you are executing you work in a context which is different from the edit time context. Any changes done to step properties at runtime will only exist within the execution context in which they were changed. As soon as you return to edit mode, you only see the default data for the step, which was saved with the sequence file.

I need some more information on what it is you are trying to achieve from changing a step property at runtime to a value that must be available at edit time in order to help you.

Cheers

Jens Christian.

Best regards
Jens Christian Andersen.
CLA, CTA, CPI
0 Kudos
Message 2 of 7
(3,098 Views)

Thanks Jens Christian.

I want to store the data (which i get in run time) in step's property, so that i run the sequence next time, i should get that value and use it. i.e., i will use the value from previous execution in my current execution.

I can understand that the context is different from that of edit time context. But is there a way to get the edit time context and write to it's step property during execution?

-Madhu

0 Kudos
Message 3 of 7
(3,098 Views)

Generally each instance of a sequence at runtime has its own copy of variables. This is in order to support recursion and to make threadsafety easier to maintain. They all start with the original edit time value in their separate copy, but they have a separate copy. You can change this behavior by setting the SharedAtRuntime flag on the property in your steptype's type definition. That will cause all runtime sequences to actually share the original property at runtime rather than duplicate it. I would caution against doing this though as that value will be shared even when you have multiple execution running the same sequence in parallel which could result in race conditions. Thus by sharing that property you are making it harder to correctly run your test sequence to test DUTs in parallel. Also the property will be shared even when you recursively call the sequence. To better support testing DUTs in parallel it's best not to modify shared variables at runtime (which is effectively what you are doing if you make the property shared). Also making the property shared means your modifications at runtime are actually modifications of the test sequence as well and will be saved to disk when the sequence file is saved.

Hope this helps,

-Doug

0 Kudos
Message 4 of 7
(3,098 Views)

Hi Madhu.

I think you are going down the wrong path here. Saving data from a test step in the step itself for a later executions is not a good idea. You should try to store it somewhere else in a well-defined location. What that well-defined location should be depends on you system setup and also on what kind of data we are talking about. It matters if we are talking about a single numeric value or an large array of some kind.

You introduce a whole lot of extra problems for you self by going with the solution you are describing.

Cheers

Jens Christian.

Best regards
Jens Christian Andersen.
CLA, CTA, CPI
Message 5 of 7
(3,098 Views)

I'll weigh in here and side with Jens.  I think this is a bad idea.  The other problem is that if you run this in a production area you need a Development License to save the data values back to the file.  You cannot do this with a deployment license.  This can increase the cost of your benches by around $3000 dollars. 

My 2 Cents,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 7
(3,098 Views)

One more thought.  If it were me and I needed to use data from run to run like this I would write it out to a Property Object file and read it in during the next run.

You can use the API to do this so you can write and read in any Expression.  This way you could still keep the write and read confined to that step.

Regards,

jigg

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 7 of 7
(3,098 Views)