05-14-2018 09:47 PM
Hello all, I'm trying to get a better handle on some behavior I'm seeing.
First, my goal (and lets ignore for the moment why I want to do this) is to be able to change the parameter values (or local variables) for the "MainSequence" that I am running through the API -- I kind of want it so that a sequence developer can define some defaults and then I can later override those defaults as needed when I actually run the sequence (as opposed to what I believe is the usual teststand model of the sequence reading parameters in from a file or database). As I understand it (http://www.ni.com/example/54602/en/), the process model will receive any parameters I pass in as the "sequenceArgsParam" on Engine.NewExecution and if I use method 2 from that article, I lose the benefits of running in a process model.
So, what I do is I use "breakAtFirstStep" which I had assumed/tested would break before executing anything. This allowed me to get the sequence parameters (RunState.ProcessModelClient....seq.parameters==client MainSequence parameters). Unfortunately, I tested further today and I'm seeing weird behavior. On some runs, it breaks within the process model as I expect. On others, it doesn't break until it reaches the mainsequence setup steps. So far as I know, I changed no settings between runs and yet clearly something changes.
=>Q1: Is there a sure-fire way to make "breakAtFirstStep" break at what I consider to be the first step -- the first step in the process model?
The other oddness this revealed is that the runtime copy of the client sequence seems to be different from what I mentioned above (RunState.ProcessModelClient....seq, which I'll call the "ready to run" version) -- when I manually inspect the IDs of the sequences, the running MainSequence has a different ID than the "ready to run" version and this is reflected in the behavior (changing the "ready to run" parameters permanently changes them until I force unload the sequence file, and setting the Root.RunState.ProcessModelClient... after MainSequence starts does not appear to change the parameters).
=>Q2: I'm still finding the run mode vs edit mode properties hard to distinguish -- is there a good document describing what belongs to what?
=>Q3: Is there a way to ensure that I can get a reference to the run-mode MainSequence, so that I can edit just the run-mode variables, before MainSequence begins to execute within the process model? I had assumed the "RunState.ProcessModelClient" would do this, but it does not appear to be what I'm looking for.
And more generally, if you have any advice on a better route to take, let me know. I'm thinking more and more about giving in and trying to this through a custom process model, but my issues with run/edit state make me think I'll just end up in the same spot.