Jump to content

Which structures for simple test vi?


Recommended Posts

Hi. I have a newbie programming question. I need to build a test vi. The vi reads in two variables via USB DAQ card. The variables are strain and position. The test needs to function as follows: Set strain to 50 lbs then hold for 30s. Increase strain to 290 lbs then hold for 60s. The strains are set manually with a car jack so this is not a feedback control system. I only need to programatically check the that strain on the loadcell is within range and plot vs. time.

My question is, should I just build this thing in a single while loop? If so how should I keep track of the times at each strain?

Eric Nelson

Link to comment
Hi. I have a newbie programming question. I need to build a test vi. The vi reads in two variables via USB DAQ card. The variables are strain and position. The test needs to function as follows: Set strain to 50 lbs then hold for 30s. Increase strain to 290 lbs then hold for 60s. The strains are set manually with a car jack so this is not a feedback control system. I only need to programatically check the that strain on the loadcell is within range and plot vs. time.

My question is, should I just build this thing in a single while loop? If so how should I keep track of the times at each strain?

Eric Nelson

You could put a sequence structure inside you while if there is a set order to your test program. If you want to use the stacked sequence structure, you can right click on the border and select 'add sequence local' to carry values from one sequence to another.

Nate

Link to comment
Hi. I have a newbie programming question. I need to build a test vi. The vi reads in two variables via USB DAQ card. The variables are strain and position. The test needs to function as follows: Set strain to 50 lbs then hold for 30s. Increase strain to 290 lbs then hold for 60s. The strains are set manually with a car jack so this is not a feedback control system. I only need to programatically check the that strain on the loadcell is within range and plot vs. time.

My question is, should I just build this thing in a single while loop? If so how should I keep track of the times at each strain?

Eric Nelson

Strain has units of length as does location. Perhaps you are measuring stress or force, not strain? If you are measuring strain then I do not understand where location comes in. You could certainly calculate location from strain...

At any rate assuming you are taking "strain" with respect to time, and "location" with respect to time. If you have two different transducers, then it is normal procedure to monitor multiple channels channels simultaneously. You just make the proper input to tell the VI to read 2 channels.

If you desire to plot "strain" vs"location," then you simply pull those paired data out of the resulting array of readings and plot tem using an XY graph.

Most analog acquisitions are taken as a timed series which are clocked by the on board clock of the DAQ board (as opposed to a series of one shot readings). The clock is more accurate than timing repeated loops of a one shot routine. Look at buffered acquisitions. You specify the rate of acquisition and how many points to take. The possible disadvantage is that you have to guess how long to run the test, where as you can use a stop button with looped one shots.

Link to comment
You could put a sequence structure inside you while if there is a set order to your test program. If you want to use the stacked sequence structure, you can right click on the border and select 'add sequence local' to carry values from one sequence to another.

Nate

I would suggest you at least use a state machine. You will quickly find that your program will be more difficult to manage as time goes on. State machine architecture helps as you add more and more functionality over time. This is always the case with LabVIEW code. Here is the FAQ link on them:

What is a State Machine?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.