06-08-2010 07:28 AM
1. You can create a cluster to minimize the number of wires. I've seen (and wrote) many VI's that had up to 10 wires at the top of a While Loop. Put labels on the wires, it will help you track which wire is which. You can even create a template of a state machine with the Shift Registers running a bunch of uninitialized wires through the one state of the state machine, then duplicate that state and you don't have to run the wires over & over again.
2. You could use a state machine in your consumer loop. OR you could have a state machine in a single While Loop with an Event Structure that checks for user events at regular intervals. This second approach is tricky and not usually recommended for novice programmers. The producer / consumer approach would be easier by having the produceer loop contain the Event Structure and the Consumer Loop containing the State Machine, which would have the contents of your stacked Sequence Structure. You could run a sequence of states that would match each frame of the Stacked Sequence. OR you could create a sub-vi for each of the frame and have them all nicely in a single state within the state machine.
3. This would help you with item 2 above.
4. 😄
06-08-2010 07:29 AM
Hi J.D
Now i see what you are trying to do. I have a solution for your problem.
What you need to do is to 'Edit Events Handled by this Case' on every case you have for the controls and untick the box that says
'Lock Front Panel Until this Event Case Completes'. You will find that box at the bottom left corner of the event case editing window.
That will result in not locking the front panel when you click the button.
But i agree with tbob you should use a state machine. Esspecially your design is a classical state machine. It will make your design so much better.
Have in mind you are not supposed to put all your code within your event case. Use the event case just to detect the event and then you can use a case loop to handle it.
I have modified your VI so i can test it and deleted all the things that don't run. In that way also you keep your code to yourself and give us only the part that has the problem.
Anyway we are not here to teach you how to do your code but just to help you. Untick that box and you will be allright - but if i was you i would spend the extra time to make the state machine.
Good luck
06-08-2010 07:31 AM
Totally agree with TCPlomp.
By the way i love that Orange color of your front panel
06-08-2010 08:59 AM
Thanks to all of you, you're really helpfull !
I don't know if this is really worthy for my program to change the architecture like you suggest me, because it works well now that I used property node to disable/enable buttons.
I will read about state machine and producer/consummer structure and see what I can do, but the real question is : how will it improve my program ? I see only 1 thing : errors will be managed, and it is not managed by the stacked structure sequence.
If I understand well, you think I should put a while loop containing the event structure (with 3 more events : "fichier antenne", "fichier gabarit" and "fin config") and another while loop with case structure (a state machine architecture in fact) linked to the event structure.
Of course, my stacked sequence will have 8 states in the state machine, which will execute continuously without be altered by the event structure?
One more question : how to put label on a wire please? don't find it.
Thanks again for your quick and complete responses.
06-08-2010 10:35 AM
Hi J.D,
Let's start from the easy one. To add a label on a wire you can double-click the white background on your block diagram and type a free-text label.
I am very supprised you tell me that the Enable/Disable property node works because that is the first thing i tried on your VI and it definetly didn't work. That's why i have suggested you to un-tick the box that 'Locks the Front-panel until the Event Case is Handled'. Have you tried that?
What i think you should do is have an event structure one for every control and connect to a case that will have all your code. The selector to the case can be the 'new value' of your control True/False in your case. You need to have a look on the examples and if you stuck we can always help.
Kind Regards
06-08-2010 10:47 AM
It propably be ok if you gray the controls (write a 1 to the disabled Property Node) because if you write a 0 you still get the problem. But it's much better if you untick that box i think. Use less Property Nodes makes your code more efficient.
06-08-2010 10:52 AM
Ok I will try this tomorrow, going back home now it's 6pm in France 🙂
thanks again Dimitrios.
06-08-2010 11:56 AM
JDlabview: J'ai juste ouvert votre vi et ca fait blesse a mes yeux !!!!
Seriously, you really need to convert to a state machine. Each sequence frame can be a state, so you will have much more than 2 states. It would be easier to read and maintain if you did convert to a state machine. As mentioned by "mon cousin du nord" Ray R., a cluster can be used to hold all your variables, and a shift register can pass them around from one state to another. Look at the attached state machine example.
06-09-2010 03:16 AM - edited 06-09-2010 03:19 AM
Thank you for your example and your advices tbob. I will convert it to a state machine with the event structure to control the states (producer/consumer), I am currently reading examples about this.
but I've got one question for you guys : have you got "tips" to control XY graph plots ?
I explain : in my VI, user can choose to analyse spectrum on 1 to 8 frequency bands.
Each band return 3 plots : Signal, Failures & Limit (Failures = points where Signal > Limit).
These plots are yellow (signal), red (failures) & green (limit).
So I made a sub-vi "graph config" which configure plots 0-3-6-9-12-15-18-21 to be yellow, 1-4-7-... to be red, and the overs to be green, using property nodes of xy graph.
The problem is that I added a function : add plot, to add a saved plot (or should I say, datas) on the graph.
So this plot can be plot 0 (if I add it before making the measure), 4, 7, ... depending how many frequency bands I chose.
So it complicates a lot my sub-vi graph config, and the over sub vi Add plot.
It also complicates the sub vi to save the datas (which only save the measured datas, not the added plots' data).
Here are the sub-vis for only ONE added plot. I can't even imagine how to do to manage 2 or 3 added plots.
Je suis sur que vos yeux vont être blessés de nouveau tbob 🙂
Please help me 🙂
Thanks
EDIT : hum, maybe should I create a new post for this ?
06-09-2010 04:19 AM
Not a good way of doing things. What about that approach? It is a lot neater and you can add the rest easily.
Do you have LabView 2009 or you want me to downgrade it?