LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure following While loop

Hello, I've got a problem with my VI.

 

The user has to set a number of parameters before running the measure.

So I put the parameters in a while loop (with waiting) to let him modify everything.

 

Next to that, he click on "End of param" boolean (latch when release).

 

And right after that, he can do a lot of things like Launching a scan, open existing plot, save JPEG, save datas... with all of these actions in an event structure following the while loop.

 

The problem is, when the user forget to click on "End of param" and click on an Event of the structure, the VI crash (doesn't respond anymore) and he has to shut down the program.

 

I tried to put every Event of the structure in Local variable with Or boolean function to stop the while loop, but Labview doesn't allow Latch when release boolean to stop a while loop.

 

So I wonder, is there a way to block the Event structure, or a part of the front panel, until the while loop is done ?

 

Thanks in advance.

 

J.D


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

Can you post your VI, i am totally confused by reading your description.

 

 

0 Kudos
Message 2 of 52
(5,665 Views)

Hi JD,

 

please read the extensive help of the event structure, it's seems you haven't done so before.

 

Bugs:

- the events of the "next action" buttons block the UI, so the VI seems to be "crashed" - it's just blocked

- no, there is no way of "blocking" the event structure - it will (and has to) react on each configured event...

- to avoid this you should make some user guidance, maybe by disabling controls when the user is in the settings phase of the VI

- there are surely better methods than the one above to avoid your described behaviour of the VI, but for better help you should upload that VI !

Message Edited by GerdW on 06-07-2010 05:42 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 52
(5,664 Views)

Thank you GerdW. I promise I will read the help (tomorrow, going back home now, it's 6pm).

 

First of all I'm not allowed to upload my VI, sorry 😞 and secondly sorry for my english, I'm french, that's why it may be disappointing for u dimitrios.

 

I think the good solution would be to disable controls until the while loop is done, but I don't have any idea of how to do this !

Please can you explain in a few words, or give me a page where it's explain.

 

Thank you again! Coming back tomorrow for kudos and, maybe, questions 😄

 

JD.


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

I do appreciate that you are not allowed to post the actual VI but you can always make a new one with only the bit that you have the problem or change it in such a way that has no confidential information in it.

 

Anyway what you can to to disable the controls is right-click the control you want to disable in the block diagram and then 'Create---->Property Node---->Disabled.

 

If you write a 0 or 1 (if you want to be gray) on that Property node then the control will be disabled. Later on in your program you can set the same Property Node to 2 and the control is enabled again.

 

Hope that helps

 

Message 5 of 52
(5,638 Views)

You should use a state machine architecture.  That way, the state that contains the event structure will not ever be executed until the user finishes the parameter loop.  If you don't want to re-write your vi into a state machine, you will have to not run the event structure until the parameter loop is finished.  You can add a wire from the loop to the event loop so that the event does not execute until the parameter loop finishes.  Without seeing your vi, it is hard to recommend what to do.  Maybe you can create a dummy vi that shows your architecture without revealing any proprietary information.

 

Si vous voulez, vous pouvez poser votre question en Francais.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 52
(5,625 Views)

Thanks to both of you. I will try your solution dimitrios, as I don't want to create a state machine architecture for only 2 states (I would have prefer more states as it would be easier to program, but the user wants to be able to add saved plots to the XY graph before or after measuring new graph.) So the hardest part is to configure plots colors (:D) and data saving which should only save new graph's datas.

 

Anyway I did read the developper zone about states machines and I'm sure it we help me in my development if I have to use labview again.

 

Tbob : There IS a wire between the while loop and the event structure, and the event structure does not execute, it's just that the mouse is blocked and I can't click anywhere..

 

here is the VI. (you can't execute this as it is designed to drive a spectrum analyser and there is a lot of sub VI)

 

 


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

Four general comments about the code.  Note that there are many missing vi's (sub-vi's), so I did not investigate the code for functionality.

 

1.  Avoid the use of Local Variables.  The variable is the wire in LabVIEW.  Since you have a While Loop at your disposal, use Shift Registers to hold values.

 

2.  Get rid of the Stacked Sequence Structure.  You are not wiring out the error out and the VISA Reference.  You may loose track of where the error(s) occur.

 

3.  If you use an Event Structure, try to use it as a Producer in a Producer/Consumer implementation.  You can use a queue to select (or affect) the state of the consumer loop.  There aremany examples of such implementation.

 

4.  You must like the orange color.  It's a nice color.  Beautiful inside a home with dark cherry trims and furniture.  Not necessarily nice for front panels.  😉

Message 8 of 52
(5,569 Views)

Thank you for your comments Ray R.

 

1. Ok I will try, but I'm afraid I will need a lot of shift registers, and a lot of wiring through my vi.

 

2. What can I use instead of a stacked sequence structure ? This is just what I need as I'm working with 8 clusters in 8 frequency bands, my program has to be sequencial..

 

3. I will read about this, seems interesting. Thank you

 

4. Haha nice one 😉 as you said this is a nice color and I use this to work nicely 🙂 I will of course change the color at the end of my project.


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

There is no need for the tab control selecting the case structure.

 

If you clicked the 'Lancer la mesure' at any time the whole front panel will be locked until the event structure has handled and finished the appropriate event case.

 

If I were you I would place the first while loop in the event structure as well (3 events: Fichier Antenne, fichier gabarit and Fin Config.

 

If I look at the 'Lancer la mesure' event you have 8 times the same code, this is very hard to maintain (changes need to be done 8 times, bugs are hard to track).

 

I would place the config (above the horizontal line) on a seperate tab-page, this will let you easily block the access to the 'lancer la mesure' and the graphs.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 10 of 52
(5,550 Views)