01-05-2021 07:14 AM
@paul_cardinale wrote:
Have a terminal on connector pane set to "Required". Set the default value of the corresponding control to something that will never* be sent from a caller. When the VI runs, check if the value is the default.
Not absolutely foolproof, but you should be able to make it work.
* For example, use a NaN for a floating point number, or maybe \FF\FF\FF\FF\FF\FF for a string.
I feel like this is the best option.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
01-05-2021 07:41 AM
@FireFist-Redhawk wrote:
@paul_cardinale wrote:
Have a terminal on connector pane set to "Required". Set the default value of the corresponding control to something that will never* be sent from a caller. When the VI runs, check if the value is the default.
Not absolutely foolproof, but you should be able to make it work.
* For example, use a NaN for a floating point number, or maybe \FF\FF\FF\FF\FF\FF for a string.
I feel like this is the best option.
Might as well add a Boolean control...
01-05-2021 08:32 AM
I think that I understand more about what you are doing now.
And, you might want to consider using the UTF! In fact, I would highly recommend getting some Unit Tests around each of your modules in order to define and reproduce your system States you are manually setting up for testing.
If you think it through, you will realize that you have not thought about long term code maintenance. Get those test scenarios outside your own head and into long term storage space! The UTF is a great way to create (and DOCUMENT) those test conditions.
01-05-2021 11:29 AM - edited 01-05-2021 11:30 AM
Yes, in the grand scheme Unit Test Framework would be another approach and better for the long term.
Thanks for all your feedback.
Solution: There is apparently no method to distinguish between a VI started by the user vs started dynamically.
Possible work-arounds:
1. Use VI's ExecutionState property, which will return "Run top level" if run by the user or started dynamically.
2. The Call Chain function will return an array size = 1 if run by the user or started dynamically
3. Add a "Test Standalone" Boolean control to the front panel.
01-05-2021 05:15 PM
To simply restate.
What you wanted to do is not easy to do because there are some other means of getting that cat skinned.
Go UTF. You will feel better!
@TeraTech wrote:
Yes, in the grand scheme Unit Test Framework would be another approach and better for the long term.
Thanks for all your feedback.Solution: There is apparently no method to distinguish between a VI started by the user vs started dynamically.
Possible work-arounds:
1. Use VI's ExecutionState property, which will return "Run top level" if run by the user or started dynamically.
2. The Call Chain function will return an array size = 1 if run by the user or started dynamically
3. Add a "Test Standalone" Boolean control to the front panel.
01-06-2021 02:44 AM
@TeraTech wrote:Possible work-arounds:
1. Use VI's ExecutionState property, which will return "Run top level" if run by the user or started dynamically.
2. The Call Chain function will return an array size = 1 if run by the user or started dynamically
3. Add a "Test Standalone" Boolean control to the front panel.
4. Remove all initialization from the sub VI, and run it before starting the sub VI.
01-06-2021 12:00 PM
wiebe@CARYA wrote:
@paul_cardinale wrote:
@TeraTech wrote:
I've always been confused by how the LV documentation uses the term "target" since, at least from my perspective, a PC can also be a deployment target. Thanks for chiming in on that.
Why would I want to know this?
Sorry, I forgot to mention my need... First, I know that I can distinguish a vi running in an exe from development with the Application:Kind property. That is not what I was searching for.
I basically need it for standalone testing of a vi. I have a very "modular" application with many "sub systems". After writing a new vi or modifying an existing vi, I often want to test it without launching my entire application then have to run it trough its paces just to get to a test scenario in place for that vi. In the edit mode I am able to run (run button) various top-level module vis (subset of all the modules in the application) to produce data, then run (run button) the vi I want to test to consume the data for testing and debugging.
@Paul- The Execution:State is a good idea and cleaner that using Call Chain and the checking array size, but it seems to suffer the the same issue - not being able to distinquish running standalone (run button) vs being loaded and run dynamically.
I realize I can throw together a quick and dirty test project with only the modules I need, but being able to just run the modules, then run my vi-under-test is much simpler and quicker. It's also more convenient to leave my supporting modules running start and stop the vi I am working on.
I could also simply add a front panel Boolean called Test Standalone and check it in the code vs calling Call Chain... but then I have to remember to un-click it when I finally do run my entire system.... which I have done numerous times and have to shut down my app and restart.
As mentioned the Call Chain function work great (as would the Execution:State property), unless the vi under test is loaded dynamically. So perhaps another way to state the question, is there a way tell if a vi was dynamically loaded?
Did you try "True Run State"?
VI don't need to show the toolbar while running.
It also doesn't distinguish between starting the VI manually, and starting it dynamically, which is the point.
01-06-2021 02:09 PM
@paul_cardinale wrote:
wiebe@CARYA wrote:
@paul_cardinale wrote:
@TeraTech wrote:
I've always been confused by how the LV documentation uses the term "target" since, at least from my perspective, a PC can also be a deployment target. Thanks for chiming in on that.
Why would I want to know this?
Sorry, I forgot to mention my need... First, I know that I can distinguish a vi running in an exe from development with the Application:Kind property. That is not what I was searching for.
I basically need it for standalone testing of a vi. I have a very "modular" application with many "sub systems". After writing a new vi or modifying an existing vi, I often want to test it without launching my entire application then have to run it trough its paces just to get to a test scenario in place for that vi. In the edit mode I am able to run (run button) various top-level module vis (subset of all the modules in the application) to produce data, then run (run button) the vi I want to test to consume the data for testing and debugging.
@Paul- The Execution:State is a good idea and cleaner that using Call Chain and the checking array size, but it seems to suffer the the same issue - not being able to distinquish running standalone (run button) vs being loaded and run dynamically.
I realize I can throw together a quick and dirty test project with only the modules I need, but being able to just run the modules, then run my vi-under-test is much simpler and quicker. It's also more convenient to leave my supporting modules running start and stop the vi I am working on.
I could also simply add a front panel Boolean called Test Standalone and check it in the code vs calling Call Chain... but then I have to remember to un-click it when I finally do run my entire system.... which I have done numerous times and have to shut down my app and restart.
As mentioned the Call Chain function work great (as would the Execution:State property), unless the vi under test is loaded dynamically. So perhaps another way to state the question, is there a way tell if a vi was dynamically loaded?
Did you try "True Run State"?
VI don't need to show the toolbar while running.
It also doesn't distinguish between starting the VI manually, and starting it dynamically, which is the point.
- It puts the toolbar visibility back to its original state.
- It does distinguish between starting the VI manually.
It doesn't distinguish those nasty dynamic dispatch programs. You might want to try unit test yourself ...yeah it keeps some nasty memory..bitch at ni about that!
01-07-2021 02:41 AM
@paul_cardinale wrote:
wiebe@CARYA wrote:
@paul_cardinale wrote:
@TeraTech wrote:
I've always been confused by how the LV documentation uses the term "target" since, at least from my perspective, a PC can also be a deployment target. Thanks for chiming in on that.
Why would I want to know this?
Sorry, I forgot to mention my need... First, I know that I can distinguish a vi running in an exe from development with the Application:Kind property. That is not what I was searching for.
I basically need it for standalone testing of a vi. I have a very "modular" application with many "sub systems". After writing a new vi or modifying an existing vi, I often want to test it without launching my entire application then have to run it trough its paces just to get to a test scenario in place for that vi. In the edit mode I am able to run (run button) various top-level module vis (subset of all the modules in the application) to produce data, then run (run button) the vi I want to test to consume the data for testing and debugging.
@Paul- The Execution:State is a good idea and cleaner that using Call Chain and the checking array size, but it seems to suffer the the same issue - not being able to distinquish running standalone (run button) vs being loaded and run dynamically.
I realize I can throw together a quick and dirty test project with only the modules I need, but being able to just run the modules, then run my vi-under-test is much simpler and quicker. It's also more convenient to leave my supporting modules running start and stop the vi I am working on.
I could also simply add a front panel Boolean called Test Standalone and check it in the code vs calling Call Chain... but then I have to remember to un-click it when I finally do run my entire system.... which I have done numerous times and have to shut down my app and restart.
As mentioned the Call Chain function work great (as would the Execution:State property), unless the vi under test is loaded dynamically. So perhaps another way to state the question, is there a way tell if a vi was dynamically loaded?
Did you try "True Run State"?
VI don't need to show the toolbar while running.
It also doesn't distinguish between starting the VI manually, and starting it dynamically, which is the point.
- It puts the toolbar visibility back to its original state.
- It does distinguish between starting the VI manually.
Not for me. When I start a VI dynamically, it reports running top level, when I run it, it reports running top level. Except when it fails, apparently when the toolbar isn't initialized.
Why would it be able to detect the difference? The icon that you're using looks exactly the same for a VI started manually and one started dynamically.
Here's two VIs that simply run infinitely, one started manually, the other dyncamically:
01-07-2021 01:25 PM
wiebe@CARYA wrote:
@paul_cardinale wrote:
wiebe@CARYA wrote:
@paul_cardinale wrote:
@TeraTech wrote:
I've always been confused by how the LV documentation uses the term "target" since, at least from my perspective, a PC can also be a deployment target. Thanks for chiming in on that.
Why would I want to know this?
Sorry, I forgot to mention my need... First, I know that I can distinguish a vi running in an exe from development with the Application:Kind property. That is not what I was searching for.
I basically need it for standalone testing of a vi. I have a very "modular" application with many "sub systems". After writing a new vi or modifying an existing vi, I often want to test it without launching my entire application then have to run it trough its paces just to get to a test scenario in place for that vi. In the edit mode I am able to run (run button) various top-level module vis (subset of all the modules in the application) to produce data, then run (run button) the vi I want to test to consume the data for testing and debugging.
@Paul- The Execution:State is a good idea and cleaner that using Call Chain and the checking array size, but it seems to suffer the the same issue - not being able to distinquish running standalone (run button) vs being loaded and run dynamically.
I realize I can throw together a quick and dirty test project with only the modules I need, but being able to just run the modules, then run my vi-under-test is much simpler and quicker. It's also more convenient to leave my supporting modules running start and stop the vi I am working on.
I could also simply add a front panel Boolean called Test Standalone and check it in the code vs calling Call Chain... but then I have to remember to un-click it when I finally do run my entire system.... which I have done numerous times and have to shut down my app and restart.
As mentioned the Call Chain function work great (as would the Execution:State property), unless the vi under test is loaded dynamically. So perhaps another way to state the question, is there a way tell if a vi was dynamically loaded?
Did you try "True Run State"?
VI don't need to show the toolbar while running.
It also doesn't distinguish between starting the VI manually, and starting it dynamically, which is the point.
- It puts the toolbar visibility back to its original state.
- It does distinguish between starting the VI manually.
Not for me. When I start a VI dynamically, it reports running top level, when I run it, it reports running top level. Except when it fails, apparently when the toolbar isn't initialized.
Why would it be able to detect the difference? The icon that you're using looks exactly the same for a VI started manually and one started dynamically.
Here's two VIs that simply run infinitely, one started manually, the other dyncamically:
OK. I was using "Call By Reference". It works with that.