04-13-2018 07:48 AM
Hi labview-community,
first of all thank you for this great forum it helped me really a lot. My project is about a equi-biaxial test for rubber/elastomer. To bring in the biaxial tension state in the material, I want to inflate a membran with air pressure so it will strech in the shape of a balloon. For this experimental test set-up, there should be some different test modes availible for the user, such as a single-mode test or a long-term test (creep test). Futhermore it should be possible for the user to decide whether the test has to be pressure controlled or strain controlled. So the programm should look like this: Choose the test mode by clicking on the button (single-test/long-term test), then choose the control parameter (pressure/strain) also by clicking on a button and at the end the user should type in the desired parameters for the test (mainly it's just a ramp function) Then press start. My problem now is, that when I run the VI and choose for example the single mode, it is not possible to type in parameters in the front panel, because the VI is already running to that time. Thats why I captioned it a basic problem concerning a user interface. I think this has to be made so easy, but I just dont find help through google. Maybe I'm just searching for the wrong terms because of my lack of vocabulary. My own solution would be either some case structures or some event structures, but then the programm would stop after choosing the right case via button-click and not wait for me inputting the parameters and a pressing play. Is there something like a wait-for-the-user's-decision-function? Or sth. like demand-an-input-of-the-user-fct? Or maybe you can just give me the right keywords to google it
If you open my file, you can run it and then press Einzelversuch (single test mode), after this it stops. Then you can type in the parameters but have to press "Run" once again 😞 if you have problems with the two DAQs pls delete them.
I'm using Labview 2016 64-bit
other translations:
Langzeitversuch - long term test
aktueller Sollwert - current set-point value
Vorkonditionierung - pre conditioning
Zeit- time
Druck- pressure
Kind regards,
Tobias
Solved! Go to Solution.
04-13-2018 07:59 AM - edited 04-13-2018 07:59 AM
Hey Tobias,
If I understand your problem, you need to wait for the user to push the START button before starting your process. And you want the user to be able to fill in some controls befores it starts ?
Seems to me like an event driven state machine would be a good start. Have you looked at that example : http://www.ni.com/white-paper/2926/en/ ?
More info on using events : http://www.ni.com/white-paper/3331/en/
04-13-2018 08:00 AM
Simple solution is to use a producer consumer architecture - there are templates for this in LabVIEW. (Create Project > Queued Message Handler). Your event handling loop captures user input and sends it to the consumer loop. Once the consumer loop has all the data required from the user (or user presses start) it kicks off the test process.
In your code the problem is that the event structure will only execute once - if you want to handle multiple events, put the event structure inside a while loop.
04-13-2018 08:01 AM - edited 04-13-2018 08:03 AM
Not sure what you expect to happen. I think you need to study a bit on architecture ((queued) state machines, producer\consumer, message handlers, and such). Maybe even the free online courses, although you seem to get the basics.
The event structure will simply wait for an event, and then it's done. If you want it to do this continuously, you need a while loop around it.
What you have is inside out. You can't simply put everything in an event (and expect it to work). This is often done with a (event driven) producer consumer construction. The producer catches the user events, and sends tasks to be performed to the consumer. All DAQ should be in the producer loop.
What you're missing is hard to google, or to learn online. General advice on how to build a program is hard to find (for any language). We'll (try to) help you out, but it won't be easy.
EDIT: 3 overlapping pieces of advice! Crossed messages...
04-13-2018 08:03 AM - edited 04-13-2018 08:05 AM
Hi otr,
So the programm should look like this: Choose the test mode by clicking on the button (single-test/long-term test), then choose the control parameter (pressure/strain) also by clicking on a button and at the end the user should type in the desired parameters for the test (mainly it's just a ramp function) Then press start.
Then why don't you program your VI in this very way?
My problem now is, that when I run the VI and choose for example the single mode, it is not possible to type in parameters in the front panel, because the VI is already running to that time.
Because you made the VI just the way it is now…
Then you can type in the parameters but have to press "Run" once again
When you want to repeat some code in your VI you should use a loop. That's very basic programming stuff, not even related to LabVIEW!
Please start by creating a scheme, what your program should do (and in which order those steps should be done). Use paper and pencil to do so…
Learn about programming schemes like state machines, producer-consumer-scheme or message handlers. LabVIEW comes with examples for all this!
Also rethink your UI handling: hiding UI elements usually makes a bad UX…
04-13-2018 08:57 AM
So here is my desired scheme. You're right, if I but a while loop around the event structure it prohibits the programm from closing itself after oping an event. But then it never stops running and I have to stop the programm by hand, type in the parameters and press 'run' once again by hand. But anyway thanks for the quick response and all the keywords to investigate.
Gerd, after you've seen the scheme what would you advice me to look for precisley?
Kind regards
Tobias
04-13-2018 09:29 AM
That doesnt really change the advice given - use a producer consumer, and put your event structure in a while loop.
What do you mean you have to manually stop the program? Even with the event structure in a while loop, you can programmatically stop it if that is the behavior you are looking for. Use user events - in your consumer loop, once the test process is complete, fire a user event that the event structure is registered to listen to. When the event structure receives that event, stop the loop. If you check out the producer consumer template, this is all there for you.
04-13-2018 09:51 AM
@paul.rWhat do you mean you have to manually stop the program? Even with the event structure in a while loop, you can programmatically stop it if that is the behavior you are looking for.
if a while loop is around the event structure, I have to stop or at least pause the programm for typing in the parameters and then press start again for the ramp pattern to be generated. But anyway I now will follow your advice even though it sounds a little complex.
I assume you advice me it, because of the sequential scheme not because of the syncronizing in timing, right?
Kind regards.
04-16-2018 08:31 AM
wiebe@CARYA
The producer catches the user events, and sends tasks to be performed to the consumer. All DAQ should be in the producer loop.
Hi I'm a little confused. So I generate data in the producer loop via the controls of the front panel and with a click on enqueue element I will release my data to the consumer loop. So all DAQs should be in the consumer loop?!
sorry I dont want to smartass but I'm really confused now.
King regards,
Tobi
04-16-2018 08:42 AM
I believe that is a typo - your DAQ code should be in the consumer loop. (At least that is the way I would code it.) Your producer (event handling loop) just captures user input and passes it to the consumer loop for handling.