LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone please help me solve this data flow problem?

My block diagram has two loops. The mechanical action of the "start" button in Loop 1 is "Latch when released" and I want to keep it that way. 

 

Below is what I am trying to accomplish:

 

Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time. 

I've been having hard time accomplishing it. I have attached my code. 

I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops. 

Can someone please help?

I have attached my code. 

0 Kudos
Message 1 of 8
(1,983 Views)

@GRCK5000 wrote:

My block diagram has two loops. The mechanical action of the "start" button in Loop 1 is "Latch when released" and I want to keep it that way. 

 

Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time. 

I've been having hard time accomplishing it. I have attached my code. 

I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops. 

Can someone please help?

I have attached my code. 


Have you learned about Boolean Controls?  Do you understand what "Mechanical Action" means?  Go to LabVIEW Help and see what the latching Mechanical Action means and does.  You will have to "give up" either keeping the Start Button as "Latch when Released" or having the Start Button value "stay True".

 

Bob Schor

0 Kudos
Message 2 of 8
(1,966 Views)

First, I would recommend using an event structure in your first loop. Your method is very kludgy. Also, I would generally use some form of messaging to provide input to the second loop. If this was solely to delay the start of the second loop until some event happened I would consider using a notifier. Though the channel wire is basically acting in the same manner. Any way, here is a basic improvement using an event structure in the first loop.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 8
(1,966 Views)

I can't see your VI due to the fact that I am running LV2018, however what Mark says comes off as the most logical answer without seeing the code up close. Could you post a picture of the code as weel for those of us not able to run the newer LV?

Creig Mills
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 8
(1,953 Views)

While I proposed the solution below this would not be the manner that I would approach this problem myself. I see no compelling reason to separate these tasks and would probably combine them into a single state machine. Or, if the parallel task truly needed to be done separately I would have the main control task (state machine) dynamically start the task at the appropriate time.

 

Original code posted:

Data Flow Problem.png

 

My proposed changes:

Data Flow Problem-MAY.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(1,943 Views)

Can you give more information on what you are trying to accomplish at a higher level? 

 

Because what you have here does not make a lot of sense by itself. But it looks a lot like the beginning of a Channel Message Handler (CMH) architecture. If that is your intent I am big fan for CMH and can offer some advice that will make this work and scale a lot better.

 

For instance you are using Channel Wire to send one Boolean (Start Test) and a Local Variable to send another Boolean (Stop) to the same loop

 

If your Channel Wire was a different type you could send both Booleans or any other data type you need to send.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 8
(1,920 Views)

@GRCK5000 wrote:

I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops. 

.


As a first step, explain what "this" is. It is not clear at all. Can you show us the one loop solution so we maybe get an idea.

 

  • Why do you have a case structure where all cases are the same? That's the same as "no case structure"
  • Why does the LED terminal have no label? (All terminals should have unique labels to avoid confusion!)
  • What's the purpose of the hidden stop indicator? (...and why do you have two terminals with the same name!)
0 Kudos
Message 7 of 8
(1,832 Views)

@GRCK5000 wrote:

Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time. 


We need a full state diagram:

 

  1. At start of program: is the LED true or false? What is the active case of the case structure?
  2. After "start test" has been pressed, what should be the state of the LED? What should be the case of the case structure?
  3. What should happen if "start test" is pressed again?
  4. What should happen if stop is pressed? (at state 1 vs. state 2)

 

 

 

 

0 Kudos
Message 8 of 8
(1,827 Views)