NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

access the properties (locals, step properties) of a sequence wich is called by a sequence adapter

Is there a way to access the properties (locals, step properties) of a sequence wich is called by a sequence adapter before this step is executed.

For example, I want to set locals and step properties of the mainsequence of a client sequence file from within the process model (before the mainsequence callback).
By the way, I use a modified Batchmodel (Teststand 2.0.1) with multiple testsockets and separate fileglobals for every testsocket.

A possible solution is to manipulate "RunState.ProcessModelClient.Data" before the mainsequence callback is executed. But this does only work for the first execution (at least for step properties and fileglobals).
Another disadvantage is that if I terminate the execution, the sequence editor shows me that the variables were changed (but no "file modified"- marker appears).
Another way would be to dynamical create a client sequence specific parameterlist for the mainsequence callback and hand over parameters instead of locals. But on this way I cannot set stepproperties.

What I want to do is:
1. Load some Data (client sequence file specific) into a dynamical created property-container in the sequence context of the process model. For this, I analyze "RunState.ProcessModelClient.Data" to get the structure of the mainsequence.
2. Befor the mainsequence callback is executed, I want to set step properties and locals of the called mainsequence from within the test socket entry point.

My problem is to access the runtime copie of the mainsequence callback stepmodule. Is there a way to get an ActiveX-Reference to the loaded stepmodule.
Obviously, it does'nt work to access the sequence file and modify it at runtime, I really need the run time copy.

I supplied an sequence file to explain my problem to you.
Use it with the batch model. You have to replace the PreBatch in the model with the PreBatch in the file (overloading the callback does'nt work).
The mainsequence shows a message box to show some variables. These variables (step propertie, local, fileglobal) were set in the PreBatch.
0 Kudos
Message 1 of 5
(3,589 Views)
Hi LVFan,

Unfortunately, what you are trying to do does not fit with the TestStand architecture. The file globals are loaded and owned by the execution. In the batch model, the executions are created and their threads added to a batch much before the PreBatch callback is called. There is no way to force a reload of the global values during the execution. The locals on the other hand are loaded each time the sequence is invoked. That is why they are changing. We can't really get access to the run-time copy of the client since it does not start executing until the MainSequence callback is called (which I think you figured out). So there are a couple of options:

1) Switch to a Station global value. Since you did not mention anything about Seperate File G
lobals for each execution, I am assuming that all executions are reading and/or writing to same memory space. The station global should work for this. This will also allow you to achieve persistance which is what I think you are after.

2) Create a file global in your model and then read that value from within the client file. A bit more complicated.

As for the sequence file not being marked as changed, you need to instruct the sequence editor that file has changed by calling PropertyObjectFile.IncChangeCount. This will cause the seqeunce file to be marked as modifed in the sequence editor. You can also call Save if you wish to retain those values.

Hope this helps! Let me know if you have any futher questions.

Bob
0 Kudos
Message 2 of 5
(3,589 Views)
Hi LVFan,

I have attached your batch.seq.
I have added a modified Initialize TestSocket sequence which needs to be copied to your BatchModel sequencefile. Also I have skipped your additional step in the PreBatch sequence.

In the Initialize TestSocket sequence I use the Execution reference to obtain a reference to the runtime copy of the FileGlobals of your sequencefile. Then I set the FileGlobals.x value.
You can ignore the extra steps. I was trying the same thing with the Locals but this not a runtime copy.

Hope this helps
Ragards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 3 of 5
(3,589 Views)
Hi Bob,

Thank you for your fast response.
1) I use separate fileglobals for each execution (as you can see in batch.seq). In this mode it is possible to set fileglobal(default)values before mainsequence callback, but changes were ignored after the first execution of mainsequence callback.
However, I think I will convert all fileglobals to locals, wich can be set over "Runstate.Processmodelclient.Data".

2) This would be really complicating test development, because you cannot test your sequence file without the model.

However, what really gives me head injury is how to set step properties. For example, I want to set Limits so I have to access "Step.Limits.String" of a String Limit Test Step in the loaded mainsequence. It does not work to programmatical mo
dify the sequence file before it's executed because (maybe) I have to change limits between executions.

My main goal is to create a model which handles all loading from database and files and configure the sequence file. If I could realize this, I don't have to use the property loader or any else loading step in my mainsequence anymore. (We have already modified the batchmodel for this approach and it runs on several teststations, but sometimes it seems there are some bugs. Thatswhy I want to test another (more direct) solution then to access "Runstate.Processmodelclient.Data").

Conclusion: Maybe I find another way to replace the fileglobals,
BUT HOW TO SET STEPPROPERTIES in the loaded mainsequence from within the test socket entry point?
I would be grateful for some suggestion.

LVFan
0 Kudos
Message 4 of 5
(3,589 Views)
Hi Ray,

Also thank you for your fast response.
A similar solution was made on my request "how to set properties in other threads".
The problem is,that this will only work on the first execution of the testsequence similar to set "Runstate.Processmodelclient.data"
However, I first of all need a solution how to set stepproperties. Please see my comment on Bob's answer.

LVFan
0 Kudos
Message 5 of 5
(3,589 Views)