NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set properties in other threads

I use a modified batch model to test UUTs in parallel. In the PreBatch I load some parameters from a database and copy these parameters in the fileglobals and stepproperties of the Runstate.Processmodelclient. But when the Mainsequence in the threads is executed, the fileglobals and stepproperties have not the expected values. How can I directly access fileglobals and stepproperties of the "Test Socket Enty Point" -threads from the "Test UUTs"-threads .
0 Kudos
Message 1 of 4
(3,410 Views)
LVFan,

You should be able to change the values of any client sequence variables or properties from the process model by modifying the properties under "RunState.ProcessModelClient.Data".

For example, if I want to change the value of a local variable in the MainSequence, I can insert a statement step with the following line:
"RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.LocalNumericVariable = 2"

If I want to change the value of a Sequence File Global, I would use the expression:
"RunState.ProcessModelClient.Data.FileGlobalDefaults.FileGlobalNumeric = 88"

Those statements will change each instance of the client sequence to have the variable values that you assign from the process model.

If you have other questions, just let us know.

Reg
ards,
Shannon R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,410 Views)
I have already tried this out. This is only working if there are testsequence-threads created not yet (running the test the first time). If there are alredy testsockets created, changes in "Runstate.Processmodelclient.Data" where ignored.
I could terminate and unload the testsockets after every test, checking the version of the UUT and reloading the testsequence in the PreBatch. But this consumes a lot of time (nearly a minute) and is not acceptabel.
PS.:In the model every testsocket runs in a own execution, not as a thread in the same execution as the model. That's why I should better say "testsequence-execution" instead of "testsequence-thread".
0 Kudos
Message 3 of 4
(3,410 Views)
LVFan,

> I have already tried this out. This is only working if there are
> testsequence-threads created not yet (running the test the first
> time). If there are alredy testsockets created, changes in
> "Runstate.Processmodelclient.Data" where ignored.

I had a similar problem. As far as I can tell,
'RunState.ProcessModelClient' returns a reference to a copy of the sequence
file that is NOT the run-time version, but some static in-memory copy.
Changes were not reflected in running executions.

I did find 'Execution.GetFileGlobals' returns a Property Object that points
to the FileGlobals in the RUN-TIME copy of the sequence file you specify in
the call. This will allow you to modify run-time copies of the FileGlobals
in the process model or sequenc
e file, depending on which sequence file you
specify. I tried this on both the process model and running client sequence
file and it works (I can twiddle FileGlobals in either case from the
Operator Interface). I have not yet found a way to modify any other
variables in the run-time instances other than the FileGlobals (such as
MainSequence Locals or whatever).

HTH,

---
Joe
0 Kudos
Message 4 of 4
(3,410 Views)