06-17-2016 11:30 AM
Hello,
I am completely new to labview and I am having trouble building a labview code for my experiment.
I guess I'll have to briefly explain about my experiment first. So, the basic idea is when you apply a certain pressure, the weight of a sample starts to increase and gradually reaches at steady state. When the steady state has reached, I increase the pressure and wait for the weight to reach steady state again. I do this several times until the maximum pressure. When the maximum pressure has reached I do the same thing exempt this time I decrease pressure.
My first try was to just add certain value to the pressure after a certain criterion has met (for example, steady state), but after the "increment phase" of the experiment I just can't get it to go to the "decrement phase".
My second try was to use an array instead. For example, I put all the pressure values in a column of array and ask labview to input pressure values from the array step by step. But, I failed to get it to work..
Could anyone please help me on this issue.
Any help would be really appreciated.
Thank you
06-17-2016
11:37 AM
- last edited on
12-13-2024
11:49 AM
by
Content Cleaner
If the array method will work for your desired end result, that sounds like the simplest method once you get it to work. Can you share the code for what you've tried so far?
Aside from that, you should look in to a State Machine architecture if you are planning on scaling this application in the future.
The Simple State Machine template that ships with LabVIEW is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-17-2016 11:54 AM - edited 06-17-2016 12:00 PM
In general terms you want to use a shift register to pass that value from iteration to iteration of the loop incrementing or decrementing as needed.
How you do that comes down to your step size.
If your steps are equal to 1 then you can use the Increment and Decrement primitive in the Numeric pallet.
If your steps are not equal to 1, but are always the same size you can simply Add or Subtract the step size constant each iteration
If your steps are not equal to 1 and are different sizes then an Array of your steps is the way to go.
Use a For Loop with a Conditional Terminal (right click on the For Loop and select conditional terminal from the pop up menu) to auto index the array.
Test for conditions after each step.
If the condition is met trigger the conditional terminal to stop the For Loop
06-17-2016 12:08 PM
James.Morris,
I've attached my labview code. I am sorry about the messy code. I haven't devoted my time on organizing my code yet.
Anyway, the array method was just my idea and I've tried few things but I really had no idea how to make it work since I only used labview for like 3 days now.
So, the basic idea of the array method is to scan the pressure value (column 1) step by step and input the steady weight value on the right column...
but, i just have no idea.. I'm sorry...
06-17-2016
12:27 PM
- last edited on
12-13-2024
11:49 AM
by
Content Cleaner
What you have there is a whole bunch of race conditions.
LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.
You don't need any of those local variables as they can all be replaced by the use of shift registers.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-17-2016 12:42 PM
Here's a simple VI that increments back and forth between a high and low value. Very simple. You could adapt this similar code to match what you want to do with your instrument communication code.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-15-2021 06:10 PM
Thank a lot....I was looking for long time