ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

function

How to implement the function ( integration function)" integral(Yn)= Yn-1 + Yn   *  dt  " Please suggest the vi and procedure to build this function

0 Kudos
Message 1 of 9
(3,885 Views)

Hi Vika,

 

start like this:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,874 Views)

hi...

    How do you get a sample time dt???

0 Kudos
Message 3 of 9
(3,871 Views)

Hi Vika,

 

I don't know: "dt" is part of your equation and you should know this input on your own…

 

Well, you might use a samplerate of your DAQ here. Or you need to calculate dt by subtracting timestamps.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(3,868 Views)

Hi,

        Can you tell me how to calculate delay by subtracting time stamps and how to use sample rate of DAQ.

 

Thanks in advance

0 Kudos
Message 5 of 9
(3,859 Views)

Hi Vika,

 

when you set a samplerate to your DAQ task you already know dt as dt= 1/samplerate.

 

To calc dt based on timestamps is quite easy:

check.png

 

This is all very basic LabVIEW stuff so I recommend to go through all those free online courses offered by NI and to study all the relevant example VIs coming with LabVIEW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,856 Views)

hii

I have implemented the same way as you told. But I am getting Zero as answer everytime . Even Current time is zero and time since 1st jan 1904 is zero

0 Kudos
Message 7 of 9
(3,851 Views)

Hi Vika,

 

I don't believe "Current time" is zero! The only use case when the snippet above will give zero is when you call it more often than 1000 times a second…

 

Please show your VI or block diagram!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(3,847 Views)

hii,

 It was a silly mistake. I got it. Thank you soo much

0 Kudos
Message 9 of 9
(3,842 Views)