LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an acceleration ramp

Solved!
Go to solution

Chris9823Alb_0-1703698692415.png

Hello Folks I'm trying make a code to adquire the wave from past to analize the delta t and delta s for create a acceleration ramp in output do you know a way the get the data from past signal?

0 Kudos
Message 1 of 10
(3,227 Views)

You could store the data by building an array and then access the past by indexing the desired section of the array out of it.

 

For simple uses, just add a shift register to pass data from one iteration of your loop to the next.  If you drag down the shift register icon on the left side it will expand providing access to values from past iterations.

 

Using Shift Registers in LabVIEW - NI

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 10
(3,224 Views)

thanks for the tip but how ll know the amount of delay times between values?

0 Kudos
Message 3 of 10
(3,220 Views)

You have nothing to time your loop, so it will run as fast as your CPU can go.  If you are using a DAQ card, then it will depend on the card.

 

For now, just put a delay in the loop to do a simple software-based timing system.  Wait(ms).vi and Time Delay.vi (in the Timing palette) are the easiest to start with.

 

In the future, you can use a waveform (Waveform palette) which is a cluster of start time, delta (time between points) and an array of Y values.  It is very useful since there is a whole set of VIs supporting the Waveform datatype.  Of course, you can always come up with your own way of storing the data too.  Depends on your needs.

 

EDIT:  You DO have a delay in there already.  If you turn on the boolean, so the delay runs, you should get 1 second timing.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 10
(3,182 Views)

It is pointless to show us a code picture with overlapping elements and a case structure where we cannot see what's in the other case or what the mechanical action of the Boolean is. You can only easily get speed(t) and speed(t-0.1s) if the loop time is 100ms. A feedback node would be easiest. No case structure needed.

 

 

0 Kudos
Message 5 of 10
(3,168 Views)

I would like an example of code which read a value and store this value with a controled time than I can compare the delayed waves

0 Kudos
Message 6 of 10
(3,163 Views)

You are assuming we know what you're trying to do.  What signal are you trying to read?  You have a scalar variable called speed.  Where does it come from???  How does it change?  

 

I work with motion control.  I usually read a position signal first, which I can store in an array and integrate take the derivative to turn it into a speed signal, and then integrate "derivatize" that speed array into acceleration if I need it.  What are you reading?  What do you want to do with that data?  What are you trying to accomplish?

 

EDIT: Mixed up some calc terms. 🙄

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 10
(3,149 Views)
Solution
Accepted by topic author Chris9823Alb

In case you didn't read the link on shift registers, here is a quick example of how they can be used to read values from the past.  I just bundled the signals into a chart, but you can add indicators if you want to play with the values.

 

NIquist_0-1703706492925.png

NIquist_1-1703706553235.png

Play with the speed slider while it's running and you'll get the speed and three history signals.

 

EDIT: BTW, the feedback node Altenbach mentioned is a shortcut way to use shift registers.  I find it confusing to use, but many coders love it.  Nice tutorial PDF here:  HowtoUsetheFeedbackNodeTutorial.pdf (berkeley.edu)

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 8 of 10
(3,142 Views)

Thank you a lot , now I`m understanded the code and could apply on my aceleration ramp and works , I`m very new on LabView , just used c++ for microcontrollers and ladder for Plcs , I just begining on it in few days ago , and have a Happy new year !

0 Kudos
Message 9 of 10
(3,035 Views)

Glad you got it working!  Keep in mind the use of shift registers is a simple convenience to grab one or two values from past loop iterations.  The most general way to do this is to build an array of your data.  Then, you can pass the array around, and index sections of it out for post-processing, or showing a time-slice of past data.

 

Waveforms are also a good way to efficiently store time-based data.  Especially useful if you're using DAQ hardware to collect your data.

 

Good Luck in 2024! 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 10 of 10
(3,019 Views)