From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Integration of waveform signal within a consumer loop using current data element and previous data element

Hello,

 

I'm using 6 accelerometers connected to a cDAQ-9174 with NI 9215 modules to calculate angular accelerations of a rigid body in accordance with algorithms in literature.

 

I require angular velocities therefore wish to integrate the angular acceleration waveform signals iteratively within my consumer loop. I need the integral to use the current data element and the previous data element of the acceleration waveform.

 

I'm currently using the integral block with the initial condition set to zero and the data component of the angular acceleration waveform connected to the X. Would this be functioning the way I want it to as stated above?

 

Please find my code attached below. The integral is located within my consumer loop with wz as its output.

 

Thank you 🙂

0 Kudos
Message 1 of 7
(3,163 Views)

Hi Rach_17,

 

Are you talking about the Integral x(t) VI found here? This would be a good approach for the first integral, but to continue integrating the current and previous data element the initial condition would have to be updated. A way to do this could be to use shift registers to pass the value of the current loop iteration to the previous data of the next iteration.

 

Thanks,

 

ShaneK

Applications Engineering

0 Kudos
Message 2 of 7
(3,099 Views)

Hi ShaneK,

 

Thank you for your response.

That is the integral VI i'm referring to.

 

Using the shift registers I connected the data from the previous iteration to the initial condition, and the data in the current loop iteration to the X. I found with each iteration, arrays of dimensions 1x2000 were entering the VI as the final and initial conditions rather than individual, subsequent elements. As a result the block provided no outputs. Would it be necessary to record the data first and perform the integral in post-processing, or is there a way of making this work within my consumer loop?

 

Thanks,

 

Rach_17

0 Kudos
Message 3 of 7
(3,087 Views)

Hi Rach_17,

 

How are you initializing these shift registers? This function should work fine in a consumer loop generally. Would you be able to provide a screenshot of how you have things currently set up?

 

Thanks,

 

ShaneK

National Instruments

0 Kudos
Message 4 of 7
(3,073 Views)

Hi Shanek,

 

Thanks for your previous response.

 

I've altered my code significantly since and I'm now using the Integral x(t) PtbyPt.vi. The data is still dequeuing into my consumer loop as a 1D array rather than individual elements. My samples per channel is set to 1000 and consequently the arrays produced for each iteration of my consumer loop are of size 1x1000.

 

To iterate through the array I've used a for-loop with an auto-indexing tunnel that then passes each element into the Integral PtbyPt vi.

 

My initial condition is set to zero however I only want this to occur for the first array of data. Will this reset to zero for each iteration of my consumer loop?

 

I've attached my code and some screenshots below.

 

Thanks,

Rach_17

 

Download All
0 Kudos
Message 5 of 7
(3,051 Views)

Also would the integral x(t) PtbyPt.vi be using trapezoidal integration?

 

Thanks,

Rach_17

0 Kudos
Message 6 of 7
(3,047 Views)

Hi Rach_17,

 

The way you have your code set up currently it will always have the initial condition set to zero. A way around this would be to feed the the past value you want as your next initial condition into a shift register that can then be used on the next iteration. 

 

I'm not sure if this function uses trapezoidal integration, does your application require a trapezoidal integration?

0 Kudos
Message 7 of 7
(3,026 Views)