NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Evaluating variable in the ProcessModelPostStep callback

Solved!
Go to solution

Hello everyone !

 

I'm working on a log file for my system, containing among others the input and output parameters of each LabVIEW step executed. For that, I am using the ProcessModelPostStep callback, allowing me to write a new line in the log file at the end of each step. To extract all parameters, I am using : Parameters.Step.TS.SData.ViCall.Parms[Locals.i].ArgVal, placed in a loop where Locals.i allows to go through all of them. By doing that, I am of course obtaining the name of the input variable when it is not a constant. For exemple : 

Parameters.Step.TS.SData.ViCall.Parms[1].ArgVal gives me : Parameters.Channel, which is a parameter defined in my sequence.

I wanted to display the value of this variable in the log file and not the variable name. So I tried to use the function Evaluate(). However, as Parameters.Channel is defined in the sequence and not in the Process Model, it returns the error : Unknown variable or property name 'Parameters.Channel'. 

How can I obtain this value, knowing that I am working in a callback and therefore this variable is not defined in it ?

 

Thanks a lot in advance for your help !

0 Kudos
Message 1 of 8
(154 Views)

@alTLS wrote:

Hello everyone !

 

I'm working on a log file for my system, containing among others the input and output parameters of each LabVIEW step executed. For that, I am using the ProcessModelPostStep callback, allowing me to write a new line in the log file at the end of each step. To extract all parameters, I am using : Parameters.Step.TS.SData.ViCall.Parms[Locals.i].ArgVal, placed in a loop where Locals.i allows to go through all of them. By doing that, I am of course obtaining the name of the input variable when it is not a constant. For exemple : 

Parameters.Step.TS.SData.ViCall.Parms[1].ArgVal gives me : Parameters.Channel, which is a parameter defined in my sequence.

I wanted to display the value of this variable in the log file and not the variable name. So I tried to use the function Evaluate(). However, as Parameters.Channel is defined in the sequence and not in the Process Model, it returns the error : Unknown variable or property name 'Parameters.Channel'. 

How can I obtain this value, knowing that I am working in a callback and therefore this variable is not defined in it ?

 

Thanks a lot in advance for your help !


Hello!

To log all parameters in your system's log file from each LabVIEW step executed, you're using the ProcessModelPostStep callback. By looping through Parameters.Step.TS.SData.ViCall.Parms[Locals.i].ArgVal, you obtain the parameter names but not their values. To display the actual values, you can pass the parameter value from the sequence to the callback by storing it in a local variable within the sequence and then accessing this local variable in the callback. For instance, store the parameter value in Locals.ParameterValue in your sequence and then use Locals.ParameterValue in the ProcessModelPostStep callback to log the value instead of the variable name. This allows you to capture the actual parameter values in the log file effectively.

0 Kudos
Message 2 of 8
(83 Views)

You might wanna try https://www.ni.com/docs/de-DE/bundle/teststand-api-reference/page/tsfundamentals/evaluate-function.h...

 

But I am wondering why you are not just building you own ProcessModel PlugIn for (what you are doing actually)  Custom Report Generation?

I guess all those callbacks will slow down your perfomance as well

0 Kudos
Message 3 of 8
(138 Views)

First of all, thanks a lot for your answer. 

Using the function Evaluate() was what I was thinking about as well. However as the variable is defined in my sequence and not in my callback, the Evaluate function does not know this variable… 

 

Concerning creating a ProcessModel plug in, I didn’t thought that using ProcessModelPostStep for writing in a file was going to slow down the performance. I really wanted to write it during the test and not at the end, so is it possible to create a plug in, which is called at each end of step ? 

Thanks a lot !

0 Kudos
Message 4 of 8
(123 Views)

Let me clarify (guess I was posting that first answer too quickly)

 

You pla is to modify the ProcessModel in order to log the Step Data for the steps in your CleintSequenceFiles, right?

 


@alTLS wrote:

 

Concerning creating a ProcessModel plug in, I didn’t thought that using ProcessModelPostStep for writing in a file was going to slow down the performance. I really wanted to write it during the test and not at the end, so is it possible to create a plug in, which is called at each end of step ? 

Thanks a lot !


Standard reporting can be set to "on-the-fly" in order to create the report while the Client Sequence is run, so yes. Yet implementation is not exactly trivial.

Repeated small file write operation will take more performance than a large one, especially since this operation is nor run in a seperate thread

0 Kudos
Message 5 of 8
(101 Views)
Solution
Accepted by alTLS

@alTLS wrote:

...Using the function Evaluate() was what I was thinking about as well. However as the variable is defined in my sequence and not in my callback, the Evaluate function does not know this variable… 

 


You can add any custom properties(variables) to the Step container, so that they are available during the callbacks.  Please see my comment located here:  Use expressions/variables for units in numeric limit tests - NI Community and this answer: Re: Pass parameters with Step-Post Actions-'Call Sequence' option - NI Community

0 Kudos
Message 6 of 8
(56 Views)

Dear Oli_Wachno, 

 

Thanks a lot for your explanations. I realised later that I didn't really need to write the results during the test ans that it could wait until the end. But what I really needed was to do a completely new log file format corresponding to the customer needs, differing from the ones offered by TestStand. And this log file will be generated only when needed, not at each execution. Moreover, as I will only use the Sequential Model, I implemented the functionality directly in the Process Model. I have created a log module with LabVIEW that write all the data in the log file at the end of the sequence. And all the data are collected in an array instead of written in the file at each call of the callback ProcessModelPostStep, avoiding the lack of performance.

 

I am not sure that it is the best way to do it, so if you have any suggestions don't hesitate.

 

Thanks a lot again !

0 Kudos
Message 7 of 8
(44 Views)

Thanks for the sharing, this solution works !

0 Kudos
Message 8 of 8
(43 Views)