LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking Case Structures

Hi, I have a case structure within a while loop which displays various outputs, I then have an identical case structure in a different while loop that needs to replicate what the first case structure is doing. I tried using semaphores but with no luck. Any help on how to get the second case to copy the first would be greatful.

 

Thanks

0 Kudos
Message 1 of 20
(3,119 Views)

One way would be to use queues to signal between the two, see the producer consumer examples in LabVIEW

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 20
(3,112 Views)

I currently use queues to select which case to run in the first structure, however when I link this queue to the second it fails to run.

0 Kudos
Message 3 of 20
(3,106 Views)

You should be 'Previewing' the queue in one of the cases, otherwise it is a race to see which one pulls the element off first.

0 Kudos
Message 4 of 20
(3,100 Views)

Hi, I've attached a rough example of the VI. Even when I use the preview the second case structure does not do anything. At what point would I attach link the preview queue function from, also within the first case structure there are operations which decide which queue to go next. Thanks

 

 

(In the example, the thick blue line is the queue and the thin blue is the element going into the case selector. The queue is fed from an enum of states into the obtain queue function at the start)

0 Kudos
Message 5 of 20
(3,083 Views)

We need to see both loops and both case structures to identify your problem.  Please post the actual IV or a simplified version of it.

 

In general queues are best used to send information to only one place.  An Action Engine might be a better choice if the same data is to be delivered to multiple locations.

 

I am having a hard time visualizing a need to replicate a case structure and loop.  Can you tell us more about what you want to do (rather than how you are trying to do it)? Perhaps someone can offer a better architecture.

 

Lynn

0 Kudos
Message 6 of 20
(3,066 Views)

If you dequeue an element in one while loop before the other while loop gets a chance to preview it, then the 2nd loop will never see it.

 

You should be using two queues.  One for each while loop.  When you enqueue your duplicate data, put one copy in each queue.

0 Kudos
Message 7 of 20
(3,062 Views)

Hi Lynn, I want to create a lighting system for a building. The different cases set different lights as on or off based on sensors. The second case is for a control panel to show which lights are currently on or off. I used the case it could select various options (only some lights can be on at the same time) and assumed the second case could simply be a replica of the first. I put them in a seperate while loops so they can run on different cores of the cpu.

 

Ravens Fan - I shall give that a go now, thanks!

0 Kudos
Message 8 of 20
(3,045 Views)

I suspect that you only need one loop.  Just put indicators for the display at the output of the single case structure.

 

Lynn

0 Kudos
Message 9 of 20
(3,025 Views)

Attached is my project to make my question easier to understand. The top case structure simply should replicate what the case structure in the bottom while loop is doing. thanks.

 

0 Kudos
Message 10 of 20
(3,021 Views)