From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How can I make step variables persistant?

I have a step that has a variable, "voltage" and I can read and write to the step by refering to "Step.Voltage" (assuming I'm in the step). But if I write to the step, it's only persistant to the rest of the sequence. Once the sequence is over, the data reverts. I understand that this is because calls to runtime copy of "step.voltage".  I've tried playing with options such as editing the property flags to enable "shared" or "shared at runtime" and that worked great except that it edited all instances of the step. I've also considered trying to edit:
 
RunState.SequenceFile.Data.Seq["MainSequence"].Main["VOLTAGE STEP"].Voltage
 
but I want the reference to be relative, not absolute so that any copies "Voltage Step", no matter what they are named, how many instances there are of the step, what sequence the step is, it always refers to the edit-time copy of itself.
CLED (2016)
0 Kudos
Message 1 of 3
(2,789 Views)
InfiniteNothing,
 
You can use an expression similar to the following:
 

RunState.StepGroup == "Setup" ? (RunState.SequenceFile.Data.Seq[NameOf(RunState.Sequence)].Setup[NameOf(RunState.Step)].Voltage = 41) : (RunState.StepGroup == "Main" ? (RunState.SequenceFile.Data.Seq[NameOf(RunState.Sequence)].Main[NameOf(RunState.Step)].Voltage = 41) : (RunState.SequenceFile.Data.Seq[NameOf(RunState.Sequence)].Cleanup[NameOf(RunState.Step)].Voltage = 41))

In this expression I am setting the Voltage property of the current step to 41.
Notice that in order to obtain the current sequence name I use NameOf(RunState.Sequence), also notice that in order to obtain the step name I use NameOf(RunState.Step).
I had to use conditional operator to select the expression to evaluate based on the current Step Group.

Hope it helps

Antonio Lie.

 

 

Message 2 of 3
(2,775 Views)
Wow. Thanks man. That looks like it'll work. I was thinking along those lines but thought I'd ask before I dove in.
CLED (2016)
0 Kudos
Message 3 of 3
(2,763 Views)