11-23-2021 12:31 PM
I feel like I got to be really really close here. But for some reason my calculation is varying a lot, and I'm pretty sure it should be mostly constant. Both waveforms are 60Hz, and one waveform is at a constant 90 degree phase. What I'm seeing is the time difference increases for a short amount of time and then get "reset" back to a lower value. Which leads me to think there's something stupid I'm doing in my logic with my timers.
Attached VI is LV2020 32bit
True cases
False cases
11-24-2021 04:09 AM
I'd imagine you have noise on your inputs, have you set a hysteresis on your trigger?
11-24-2021 10:18 AM
@Intaris wrote:
I'd imagine you have noise on your inputs, have you set a hysteresis on your trigger?
I have not, I'm guessing you're talking about the hysteresis in that VI I'm using to detect zero crossing? I'll try that out.
I was thinking I was doing something wrong with my timer logic but I guess not? And I didn't think I would be getting much noise, I'm just measuring 120VAC from the wall in my room and then I'm simulating a sine wave with a USB6001 daq device (-500mV to +500mV)
11-24-2021 11:10 AM
Without having any actual data as to what's present at your inputs or how your hardware is set up, it's hard to tell what's wrong.
Do you have an oscilloscope to check the signals actually present at your inputs?
11-24-2021 02:26 PM
Right before you replied, I decided to check my inputs with an o-scope to verify lol. Turns out, my USB6001 DAQ device was outputting a sine wave with a frequency of ~40Hz 😁
After I fixed that so it was at 60Hz, things are MUCH more stable. It still isn't perfect, but I think that's because it's hard to match my DAQ device's output frequency exactly to my wall's 120VAC frequency. I noticed my wall's voltage frequency can vary, and I was watching the two sine waves slowly merge away from each other. I'm guessing that's why my zero crossing time difference doesn't stay consistent.
11-24-2021 02:51 PM - edited 11-24-2021 02:57 PM
Ok so this is interesting. I just tried this code out at my place of work, where my voltage waveform signals are 480VAC 60Hz and the current waveform signals are the 480VAC line currents coming from rogowski coils. I have an integrator on the rogowski coils so that the current waveforms are put back in the correct phase.
The time difference I'm getting is 16mS for L1. Which awfully close to the amount of time it takes for one full sine wave to complete at 60Hz, ~16.6mS. It's almost as if I'm measuring the time from one of the waveform's rising edge to its next rising edge, if that makes sense.
Is it my settings in the Analog Period Measurement VI maybe? There's two of these VI's, one for voltage and one for current, and both have the same settings.