From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-15-2018 09:12 AM
Hi Folks,
I need a little assistance to fix a bug in my project. I have a main VI which is supposed to automatically start my subVIs. My subVIs include a relay triggering program, an analogue read program, a voltage indicator program and a logging program. When I press start on the main VI window the subVIs start but the logging subVI only does 1 loop then stops. I have to go into the subVI and start it manually then it work OK.
Can anyone see what might be going wrong with the subVI execution??
I've attached the full project for clarity.
10-15-2018 09:21 AM
10-15-2018 09:23 AM
Yer doin' it wrong...
Why are you treating and calling your subvi's as separate threads or whatever and using Global variables to pass data to your Main vi?
Race condition much?
10-15-2018 09:37 AM
Do a search for Queued Message Handler. You should not be using a Global Variable to stop such loops. You should be sending commands to tell the loop to stop. And let the QMH manage the queue (ie release it when it is done). This will avoid a lot of issues.
10-15-2018 10:02 AM
The OP needs to go back and do some of the tutorials as there are several very basic things that are done totally wrong here. Well not "totally wrong" because they sort of work but they show a very large lack of understanding the basics.
For instance there is this:
Why check to see of X = 21 by dividing X by 21 and checking if the remainder is 0?
When you can do this:
10-15-2018 10:26 AM - edited 10-15-2018 10:28 AM
@GerdW wrote:
Hi Catriona,
Can anyone see what might be going wrong with the subVI execution??
1. Too many global variables.
2. Race conditions because of global variables…
What about using a proper producer-consumer scheme?
From what I have read the global variables should be OK of you are only writing to it in one place. I only have variables that are written to in one location and read from in the other callouts. Was the information I was given wrong?
I am not a computer programmer and I have only literally just started using LabVIEW and have been only given 3 weeks to write this test procedure so I haven't had a lot of time to learn and I have never heard of producer-consumer schemes. Can you give me more detail on what I would need to change to allow me to do this?
10-15-2018 10:34 AM
@RTSLVU wrote:
The OP needs to go back and do some of the tutorials as there are several very basic things that are done totally wrong here. Well not "totally wrong" because they sort of work but they show a very large lack of understanding the basics.
For instance there is this:
Why check to see of X = 21 by dividing X by 21 and checking if the remainder is 0?
When you can do this:
Yikes. You have just made me look at this section again and neither what I have, not what you have suggested will work the way I need it to!
I need a test sequence that basically does the following:
turn on relay 1, apply load 1, turn off relay 1
turn on relay 2, apply load 1, turn off relay 2
.
.
.
turn on relay 10, apply load 1, turn off relay 10
*Repeat sequence more time*
turn on relay 1, apply load 2, turn off relay 1
.
.
turn on relay 10, apply load 2, turn off relay 10
*go back to the start.*
As you can see I have embedded sequences and I'm really struggling to figure out how to properly control them. Any suggestions?
10-15-2018 10:50 AM
@Catriona wrote:
As you can see I have embedded sequences and I'm really struggling to figure out how to properly control them. Any suggestions?
Look up State Machine in the LabVIEW example finder (Help->Find Examples).
10-15-2018 10:51 AM
@Catriona
I am not a computer programmer and I have only literally just started using LabVIEW and have been only given 3 weeks to write this test procedure so I haven't had a lot of time to learn and I have never heard of producer-consumer schemes. Can you give me more detail on what I would need to change to allow me to do this?
Why would anyone expect you to be able to accomplish this in 3 weeks? You are not a programmer and you don't know LabVIEW. Shouldn't whoever is assigning this task allow you sometime to actually learn what you are expected to do?
10-15-2018 10:56 AM - edited 10-15-2018 10:57 AM
I don't know the specifics of your test but I have done my share of battery tests over the years and find a State Machine architecture works most of the time
Take a step back and break your test down into steps from beginning to end and try to think of each step as a "state" in a state machine. Remember that you can always "reuse" a state, so if you need several different time delays you can have one "dealy state" that has a different time delays.