LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure following While loop

Of course your approach is better, thank you. (yes i have LV2009)

J.D.
French Labview beginner
N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers
0 Kudos
Message 21 of 52
(1,834 Views)

tbob va maintenant dire " mes pauvres, pauvres petits yieux "

 

En anglais maintenant afin que tous puissent comprendre...

 

 

Why did you not use a state machine?  That has to go into the Rube Goldberg code examples..

 

A single state machine which selects which value to go to..  OR better yet.  

 

Remove the Stacked Sequence and use a very simple Case Statement.  Instead of using the boolean (True / False), use a numeric value to select the case.  Voila.  No need for a state machine, just a Case Statement.

 

AND  why did you not combine the first 2 sequence frames?  Not that I recommend doing so (or using a Stacked Sequence... au contraire).  Just curious.

 

Upon further investigation of your code, you don't appear to need a case structure at all.  Just wire N directly to ActivePlot.

 

 

 

0 Kudos
Message 22 of 52
(1,813 Views)

I simplified your code to this:  (I didn't look at the other posted code, yet.  Maybe -hopefully - they are the same)

 

 

Message Edited by Ray.R on 06-09-2010 08:41 AM
Message 23 of 52
(1,809 Views)

Even better Ray.R you made it look so easy. He will need to add some case statement for the different colours he needs to add for N=1,4...

But again he won't need 24 case statements, he need only 3 one for each color since he can combine 0,3,6,9,12,15,18,21 and 24 in the same case statement.

The state machine we have suggested is for his main VI not for that one (first VI he posted)

 

Message 24 of 52
(1,789 Views)

thanks a lot for your simplifications.

I don't really now why I did not combine the 2 sequence frames Smiley Tongue

 

Dimitrios you get a little confused : this sub VI is for a plot I add to the graph as a reference, not for the 3 plots measured. But your example helps me to configure the graph so it's not big deal 🙂 thank you !


J.D.
French Labview beginner
N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers
0 Kudos
Message 25 of 52
(1,779 Views)

JDlabview, you are thinking in text based coding.  Graphical coding with data flow is quite different.  Here is a comparison of text (loose syntax) vs graphical:

 

Text versions: 

 

If-Else:                               Select Case:

If N==1                              Select N

  action1                                Case 1

else if N==2                              action1

  action2                                Case 2

else if N==3                               action2

  action3                                Case 3

 |                                               action3

 |                                           |

 |                                           |

 |                                           |

else                                        Case else

  action9                                      action9

end if                                      End Select

 

Don't they look very similar?

 

Graphical versions:

 

If Else:

 

IfElse.png

 

Select Case:

 

SelectCase.png

 

What a difference!!!!!  Smiley Surprised

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 26 of 52
(1,750 Views)

Dimitrios wrote:

Even better Ray.R you made it look so easy. He will need to add some case statement for the different colours he needs to add for N=1,4...

But again he won't need 24 case statements, he need only 3 one for each color since he can combine 0,3,6,9,12,15,18,21 and 24 in the same case statement.

The state machine we have suggested is for his main VI not for that one (first VI he posted)

 


Oops.. Did I miss that?  I had not noticed different colors for N=1 & 4..  I'll have to go back.  If that was the case, then there is another almost as easy solution.  Maybe if I have time I will re-visit and post a corrected simplified solution.

 

Thanks for pointing that out.

0 Kudos
Message 27 of 52
(1,714 Views)

Thanks Ray.R for your consideration for my problems, but don't waste your time I'm allright now with my graph : now I merge plots from each frequency band and it make the things so muck easy.

 

I have a question about state machine : can I easily have state changing with event from the event structure, BUT when the event "lancer la mesure" is selected, my state machine has to perform each band (8 states) before going to something else ?

 

Thanks


J.D.
French Labview beginner
N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers
0 Kudos
Message 28 of 52
(1,701 Views)

Hi J.D

 

You need to use only 1 state for the event handled by "lancer la mesure". In that state you have to find a way to do the 8 sub-states (maybe a while loop with a shift register that increases every time you do 1 of your sub-states). As usual if you send what you have done so far we will be able to suggest what to do or improve it.

 

0 Kudos
Message 29 of 52
(1,693 Views)

Hi, I'm working on a producer/consumer structure with an event structure as producer and a state machine as consumer, and I don't know how I can manage the initialisation of my program, I mean before any button is clicked, and so when the queue is still empty.

 

What I want to do there is just to put 2 var at 0, init the graph and disable some controls on the front panel.

 

Here is the VI

thanks !


J.D.
French Labview beginner
N'oubliez pas de complimenter les bonnes réponses - Don't forget Kudos for good answers
0 Kudos
Message 30 of 52
(1,659 Views)