NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling / Disabling tracing into a sequence (SeqCall) only in execution

Hi,

 

Building a LV custom interface for a customer, I'm facing a problem : I would like to enable / disable tracing into sequences according to certain conditions only in execution.

To detect these conditions, i'm using the ProcessModel_PreStep Callback. This way I can get the sequence context of my customer file before the first step executes.

 

I found a way to do this using getting all seqcall in the sequence, getting the module of each of these steps, casting it into a seqcall_module and modifying the TraceSetting (see attached file).

However it modifies the sequence file (trace settings appears changed in the seq file)... I would like to be valid only in the current execution. Is it possible ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 1 of 14
(5,876 Views)

Please be more specific about what, at a high-level, you are trying to do. There might be another way.

 

-Doug

0 Kudos
Message 2 of 14
(5,868 Views)

Hi Doug,

 

The purpose of disabling the trace setting is quite simple : some of the users are allowed to see what's going on in the sequence, some others not...

 

With the interface I am building, my customer can play any sequences he creates. By default they are built as described in the pic attached (first level setps are only seq calls and the tracing is disabled).

 

However, a special kind of user can see what's going on inside the customer file (mainly for debugging purpose). So what I'm trying to do is enabling the sequences to be traced for some users... without modifying the sequence file (versionning purpose) !

 

Is it a litte bit more clear ?

 

PS : Users are managed through my custom interface. For the moment (this can be changed) there is no link with TS user management.

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 3 of 14
(5,861 Views)

A couple of ideas come to mind:

 

1) You could use file locking to enforce this by putting the hidden sequences in their own file and locking that file for viewing. It would have the added benefit that the users who weren't allowed to see the tracing also can't see the steps when they open the file in the UI. The downside is that the permission isn't based on the user login, but is instead based on whether or not the user has opened and unlocked the files. Though you could maybe write your own custom code to unlock the files programmatically if the correct user logs on.

 

2) Another idea is to default to not tracing (like I think you are already doing), and then just have extra code in your subsequences that turns on tracing if the right user is the one currently logged in. You can turn on tracing in your subsequences by simply setting RunState.Tracing to true, perhaps in a setup step in those sequences.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 14
(5,857 Views)

I already tried the RunState.Tracing. But there are 2 problems :

  1. I can't modify the customer file. It as to played as it is given to me
  2. RunState.Tracing option doesn't trace at all ! You don't even see the arrow in front of the current seqcall being played. Even if I don't wont to trace what's inside a subsequence, I want to keep trace of the global execution (first level steps as described in the pic of my previous message).

The method I'm using (described in my first) shows that the tracing option is evaluated at the step execution. But (and I don't understand why ?!) it saves the settings in the seq file (I don't do any IncChangeCount nor WriteFile)...

 

I'm using an equivalent technique to programmatically skip some steps, and this skipping is only persistent in the current execution, it doesn't write the file...

 

I have the intuition that what I want to do is not currently possible through the TS API...

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 5 of 14
(5,855 Views)

The trace setting of a sequence call is a shared setting on the step, so you cannot just change it at runtime without affecting the original step. Since you are writing a UI you can always handle the UIMessageEvent and cancel the handling of any trace messages you don't want the UI controls to display. It's not very efficient, but it should work. You will need to look at the sequence context of the uimessage to determine what sequence you are in for determining whether or not you should cancel the processing of that message. I'm assuming you're using an ApplicationMgr control in which case the UIMessageEvent has a cancel parameter that you can change to true if you don't want the UI controls to handle the trace event.

 

-Doug

0 Kudos
Message 6 of 14
(5,847 Views)

Thank you Doug for the time spent to answer my messages.

I'm embedding the ExecutionView ctl in my UI, so I'm not dealing with UIMessages to display current execution status.

 

Nevertheless, I've noticed something very weired : using my current technique, the seq file is changed when dealing with 'Tracing into sequence' option. However, my subversion manager (TortoiseSVN) is not seeing the file as modified...

Hoping this is not a bug, I guess I'll save the original settings of the sequence and restore them at the end of the execution...

 

In your last message you said : "The trace setting of a sequence call is a shared setting on the step, so you cannot just change it at runtime without affecting the original step."

Can you tell me more about it ? Could you detail a little bit more how 'trace setting' for sequence call is stored/read by TS ? Isn't it stored/applied the same way as 'RunTime mode' ?

 

Thanks !

 

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 7 of 14
(5,839 Views)

All of the TestStand UI controls (including the executionviewmgr) are relying on trace events to update when tracing is enabled. My instructions to you describe how to override their handling of the uimessage. If you add a UIMessageEvent handler and cancel trace messages like I explained, it should do what you are asking.

 

You are probably not saving the file, that is why svn is not seeing it as modified. The file will not get marked as modified in teststand unless you increment the file's change count, thus it will not get saved unless you explicitly choose to do so.

 

RunMode is different than the trace setting in that it is really two separate settings, an edit time setting that's shared, and a runtime version that is per execution. Runmode can be changed in an execution by the user. That is why it is implemented this way.

 

-Doug

0 Kudos
Message 8 of 14
(5,830 Views)

Hi Doug,

 

I can't find anywhere a definition of what is send through UIMsg_Trace... But it seems that there is no SequenceContext sent through the ActiveX parameter (null ref behind the casting).

Am I wrong ? if not, any idea to determine from the Execution (only ref available in the UIMessage callback) if the step currently played is a SeqCall or not ?

 

Thank you for your help.

 

- Cyril

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 9 of 14
(5,801 Views)

You can get the sequence context for the UIMessage as follows:

 

int frameId_notUsed;

uiMessage.Thread.GetSequenceContext(0, frameId_notUsed);

 

I'm not sure why you are looking for sequence call steps though. I thought you would instead look to see if the current sequence that was running was one for which tracing was allowed (by your requirements), and if not, cancel the ApplicationMgr's processing of the UIMessage.

 

Hope this helps,

-Doug

0 Kudos
Message 10 of 14
(5,795 Views)