LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting and correcting offset in a sine wave

So I am having a little trouble with this one and was wondering if someone might be able to point me in the right direction. I think I'm close, but it's starting to get messy and too big in my opinion. Basically, in my system I'm reading a 60Hz sine wave, but DC offset is causing the positive and negative peaks to be offset from each other. The positive peak might be at 350 but the negative peak will be at 280, for example. So I need a way to compensate and bring it back into the middle. Below is a screenshot of my test code

 

lv sc.png

0 Kudos
Message 1 of 5
(1,146 Views)

Unfortunately, we could not run or debug a picture, please attach the original VI.

 

In addition, please provide more information about your goal and application to understand better.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 5
(1,143 Views)

There ya go! Labview 2020

0 Kudos
Message 3 of 5
(1,132 Views)

Hi David,

 

why don't you cleanup the code?

It really would help to understand it better/easier!

 

Like this:

(You also might use the InRangeAndCoerce function…)

 

What's the problem with upper/lower peak value?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(1,116 Views)
  1. Always save the VI for the previous version, probably LV2016 covers a wider audience
  2. Always name the VI appropriately, it is difficult to find the VI when one might already have a bunch of untitled VI from other forum posts.
  3. Size the FP to only to cover the controls/indicators you've - not everyone's monitor may be as large as yours

Please explain the goal of your VI.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 5 of 5
(1,113 Views)