LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Falling In Air Vi

Hey all.  I have this assignment where I need to build a Vi to show a speed vs time graph of objects falling.  I have the front panel built like the text book, but I am having trouble with the block diagram.  I assume using the matlab script would be the easiest/best way, but I am having trouble coding this with the given equation.  Any help would be much appreciated!

Screenshot (814).png

0 Kudos
Message 1 of 13
(3,906 Views)

No need for Matlab. All you need is a FOR loop and a shift register. I assume the initial velocity is zero, so initialize the shift register accordingly.

0 Kudos
Message 2 of 13
(3,885 Views)

As altenbach hinted, you only have a single variable here (at least, once the application is running).

 

Your v value will change over time (i.e. each iteration of a loop) and your time will change over time (i.e. each iteration it will increase by dt) but g and alpha are known before the start (unless alpha can be changed during the "falling" process - I'm assuming not).

 

Given you know the number of samples ("N"), you can use a For loop and the single Shift Register already mentioned to hold the value you're updating, and calculate "t" via the "i" terminal and a constant dt value of 0.001.

 

Plotting a Waveform Graph can be done with an array of Y values and a constant dt quite easily. If you only want to plot after the VI finishes the calculation (seems likely here) then you can have an indexing tunnel output for "v" and wire that to the Y input of Build Waveform (Analog Waveform) Function. The other values can be set as required (you might not care about t0).


GCentral
0 Kudos
Message 3 of 13
(3,836 Views)

@cbutcher wrote: and calculate "t" via the "i" terminal and a constant dt value of 0.001.

We don't even care about "t" unless we are not building a waveform data type (which would be silly not to use).

 

But, yes, a simple FOR loop with the numeric functions to do the math and a shift register to hold the velocity is all that is needed.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 13
(3,822 Views)

Ok, so this is what I have so far...

Screenshot (815).png

 

Is this what y'all are talking about? If so, how do I write the equation since Vn-1 is not known?

0 Kudos
Message 5 of 13
(3,811 Views)

V_n-1 is just V from the previous iteration. All you need is an initial condition.

 

In the image you post, you've connected your dt to the shift register. Probably this isn't what you want - since that's fixed you can just use a normal tunnel or place the constant directly inside the loop.

 

The shift register is there for your changing value (I.e. V).

 

As an aside - crossrulz is quite right about the t value - for some reason I thought you needed it during execution for the calculation, but it isn't necessary for the calculation and for a waveform you do not need time values. 


GCentral
0 Kudos
Message 6 of 13
(3,808 Views)

So how do I connect an empty variable to the shift register?

0 Kudos
Message 7 of 13
(3,805 Views)

Decide what the first value of v you want to start with is.

More concretely - how fast is your object moving before the simulation/calculation starts?


GCentral
0 Kudos
Message 8 of 13
(3,802 Views)

The object is dropped so initial velo would be 0. So I should connect 0 to the shift register?

0 Kudos
Message 9 of 13
(3,798 Views)

This is what I have now.

Screenshot (816).png

0 Kudos
Message 10 of 13
(3,794 Views)