08-08-2012 02:50 PM
I’m new to LabVIEW and just went through the core 1 and core 2 classes, but I’m stumped on getting started on my program.
I need to control two pieces of equipment; a Druck DPI515 Calibrator and an Agilent 34401 Multimeter as follows:
The program will use the Druck to set different pressures based upon user input. The test will set pressures in 20% increments from 0-100-0. While the pressure is set, I want to have the Agilent measure the output of a pressure sensor that is attached to it and save the data. From there I want to output the deviation of what the output should be and what it actually is.
The way I was planning on doing it was by using the producer/consumer loop with queues. However, I’m not sure if this would be the best design. If it is, I’m not sure what to put in the producer or consumer loop.
Thanks for any help. I know it’s a newbie question.
Take care.
Solved! Go to Solution.
08-08-2012 07:56 PM
I'm doing the same thing. You're calibrating a pressure transducer, aren't you? Well I haven't gotten started on my program yet but for sure I will try to keep it simple. I haven't decided yet but I may use a State Machine since it's easy to implement and applies to many problems. Also, the quickest way to do it is using a While Loop with config stuff outside of it, DAQ and processing inside the loop, and the rest such as closing instruments and such outside the loop. I'm leaning towards the latter implemetation.
08-08-2012 08:04 PM
Hey Otman,
You are correct. I was thinking about using a State Machine also with a type def. enum. with items such as Initialize, Set Pressure at 0, Set pressure at 20%, 40%, 60%, 80%, 100%, Vent, etc. Is this what you were thinking?
I was given the suggestion to use the producer/consumer loop to involve queues, but I feel like that may not be the best idea. It's hard getting started when you're new at this! At least for me it is
08-08-2012 10:52 PM
Hi,
If there are no timing requirements, and if you are not taking 'huge' data sets you might find a state machine to fit the bill.
As you said, have an init phase ( instruments, file references, front panel controls and indicators), and then set up the logic to do the pressure, then the Agilent, then analyze/save states, repeat till complete and run a shut down state.
Does the user set the values once,then run? If so a straight forward state machine would do well. If not you could read the indicators in the main loop, it is polling but it might suffice. Also, if the process repeats from the start you would want a finished/wait state, but again you would have to poll the "run" button.
I would suggest using shift registers for the instrument and file references, register the shift registers in the first state (init).
08-09-2012 06:32 AM
Hey Mark,
Thanks for the reply. For timing requirements, I may want to hold pressure for a few seconds before I take data, but that's not 100% yet. I'll have to see how accurate the data is before I make that decision. Also, the user sets the values only once, the rest is automated.
If I later need timing requirements, would this be a simple fix by just adding a Wait function?
Thanks again
08-09-2012 06:40 AM - edited 08-09-2012 06:41 AM
Hi buickgn,
Probably NOT, but not sure.For timing requirements just to put a wait function won't helps.
08-09-2012 06:43 AM
Hey Danil,
Thanks for the response. If I need timing requirements what would my option be if a State Machine isn't ideal?
Thanks again
08-09-2012 07:00 AM - edited 08-09-2012 07:01 AM
Hi buickgn,
create an Idle state and keep a timer inside and feed the pause timing value depending on the time you take data.So once the 100ms(any delay) wait time has to be executed,go into the idle case and wait until that time.once that is done go to the next state.Don't confuse just try.
08-09-2012 07:22 AM
Danil,
After further discussion with a project manager, we will need some timing requirements. Before the test runs, we would want to test for leaks. To do this we would set Full Scale pressure (highest pressure the test calls for) and hold it for 10 seconds. While it's holding, we would want to see if it's leaking. Depending on how much leak there is we would continue the test or stop the test there.
Any ideas?
08-09-2012 07:22 AM
I'll jump in on a few recommendation for a newbie. It always helps to hear from someone who has been through the growing pains.
I'd stick with the state machine to get started with. It will handle what you need for this project. If after that you want to challenge yourself a bit and grow your knowledge, expand it into the produce/consumer style. Plus managers tend to like seeing lights blinking/pressures set/measurements read sooner rather than later.
Google "34401 LabVIEW driver" and it should point you right to the NI download for that. Check it out and there are examples included in there to do (probably) everything you need to do on the measurement side. I don't know about the Druck, but there might be one on NI, or maybe Druck's website. Worth taking a look. If it is out there, 2/3 of your work is done in a matter of minutes.
Now the last 1/3 is just building your program to function the way you want it to. Most of that is up to you. Some of it is trial and error, and a lot of it is getting in the mind set of what can LV do to make this program do more on its own to make your life easier. That sort of thing may take a while for a newbie. One example of that is if you are always taking measurements in 20% increments, have the user input the full scale of the transducer and figure out your setpoints programatically. This will save your user from having to input more info that necessary. This is just one simple example, but there many more.
Lastly, when dealing with pressure (and assuming a state machine) make sure you have a state that puts all pressure back to zero at the end of your test. High pressure have a real ability to cause bodily harm and that needs to be taken into account in your program, and through your debugging and validation. DON'T us the abort button to stop your program!