LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking Case Structures

I can see no reason that you double the amount of your code to do the same exact thing twice.  Why don't you just connect the 'engineer' indicators to the wires in the lower loop and remove the top loop?

 

If you must do this for some reason you can just wire the queue reference into the upper loop and use the 'Preview Queue Element VI' as has already been mentioned.  In this simple case you coud even just write the queue element to a local variable in the bottom loop and read it in the top but I would recommend wiring the queue.

 

EDIT:  You know there are great solutions to this sample test problem available to look at right?  If you're testing yourself then don't look at them yet of course.  Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 11 of 20
(967 Views)

When I see a folder named 'assignment' I become a bit wary...

 

 

0 Kudos
Message 12 of 20
(962 Views)

I saw that too but this is a classic CLD test sample that NI offers as a study guide.  There are three or four of them (car wash, traffic light, security system).  Since they come complete with solutions there's no one to cheat but yourself when you take them.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 13 of 20
(955 Views)

The reason I tried doing it in a seperate loop was to run them on seperate cores, as if the engineers office was in a seperate part of town. Im doing this to learn labview in my spare time after I saw the CLD examples on the NI website. I've been struggling with this for about a week now, hence why I've decided to turn to the forum for help. Ill give your recommendations a go. Thanks.

0 Kudos
Message 14 of 20
(934 Views)

Thanks for clarifying, it is a delicate balance between helping and doing someones homework.  Of course you could be a filthy liar, but I'll pretend not.  Smiley Wink

 

There are many ways to tackle your problem, I would suggest that you break it down into its simplest form and solve that one a few different ways.  For example, just have a single button which triggers the event for the separate(?) while loops.

 

You can try:

Single loop with multiple indicators, easiest way to go.

Single queue and multiple queues.

Notifiers (I usually start jiggering with lossy queues and synchronization and wind up reinventing this wheel).

 

Once you've nailed the architecture you are comfortable with, whatever you drop in the case structures will be a piece of cake.

0 Kudos
Message 15 of 20
(927 Views)

If you just need to provide status of a VI to others in the world there are all kinds of ways to do that too.  You'll be surprised how easy it is to publish data (including a live VI front panel) on the web so it can be monitored (and even actively controlled) from anywhere there is an internet connection, or a cell phone for that matter.

 

This is something best left for the future after you get some basics down but just be aware that these tools exist and you don't have to create them from scratch unless you want to.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 16 of 20
(920 Views)

I haven't done homework for 20years now :). I spent 15 years as an electrician and am now trying to learn engineering. Thanks for your help, ill give those a go tomorrow and hopefully get it working.

0 Kudos
Message 17 of 20
(906 Views)

I tried your method linking the queue out from in the first loop to a preview queue function into the second, which uses the element to select the case, however it still does not change the second case, the first works as expected. If I can not work it from here I will just do it within one loop. thanks.

0 Kudos
Message 18 of 20
(883 Views)

As I said in my message, don't use Preview Queue.  There is no guarantee that the preview queue gets to read the message before the dequeue function reads it and takes it out of the queue.

 

Think of it as a letter in a mailbox.  Person A comes and gets it, reads it, and throws it away.  Person B is just a nosy person who reads it but leaves it in the mail slot.  If person B gets to the message first, they see it and know what's going on.  If person A wises up and gets there ahead of person B, then person B never gets a chance to read it.  So if you want both people to read the message, then you need to make sure you put a copy of the message in each person's mail slot.

0 Kudos
Message 19 of 20
(869 Views)

Another method can be to let the first loop generate a event (e.g. User event) with which case to perform, in addition to the normal operation. The 2nd loop can then perform through a normal event structure.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 20
(856 Views)