06-09-2010 04:36 AM
06-09-2010 07:31 AM
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.
06-09-2010 07:40 AM - edited 06-09-2010 07:41 AM
I simplified your code to this: (I didn't look at the other posted code, yet. Maybe -hopefully - they are the same)
06-09-2010 08:05 AM
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)
06-09-2010 08:23 AM
thanks a lot for your simplifications.
I don't really now why I did not combine the 2 sequence frames
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 !
06-09-2010 12:08 PM
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:
Select Case:
What a difference!!!!!
06-10-2010 12:08 PM
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.
06-11-2010 02:51 AM
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
06-11-2010 03:05 AM
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.
06-14-2010 04:48 AM
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 !