Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Phase difference
10-31-2015, 09:27 AM
Post: #1
Phase difference
Hi guys

I have been using signalab to filter 2 signals from channels 1 & 2. Works well enough. However I can't figure out how to calculate the phase difference between the 2 signals? Even a time difference would help but again can't get this to work.

Any suggestions?

Thanks

Fanman
Find all posts by this user
Quote this message in a reply
11-03-2015, 08:57 AM
Post: #2
RE: Phase difference
OK not much feedback so I'm hoping to stimulate discussion. I have tried to determine the time difference between ch1 and ch2 by using SLDetectLevels component to identify when the signals cross the time axis (i.e. when level is >0). I then tried to send this trigger to the TLStopWatch component to measure time difference. Unfortunately nothing worked. Maybe it is my understanding of how these components work. Would appreciate if anyone has experience with this.
Find all posts by this user
Quote this message in a reply
11-04-2015, 09:52 PM
Post: #3
RE: Phase difference
Hi! If you would post some (partial) code we might get an idea what's (not) going on. Compiler and Lab-version as well.

Regards,
Dave
Quote this message in a reply
11-05-2015, 07:12 PM (This post was last modified: 11-05-2015 07:28 PM by fanman.)
Post: #4
RE: Phase difference
Hi Dave,

I have attached the project file. I'm using MS Visual Basic 2010 and have a registered version of SignalLab Ver 6.

Looking forward to finding a solution to this. Have been working on this for a long time now Smile

regards

Mark
Here is the basic code......

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

' OK really struggling to understand how components are mean't to operate
' Identify when levels > 0 i.e. cross time axis
' and measure time difference with stopwatch

If Val(DetectLevels1.OutputPins.GetPin(0).ToString) = 1 Then
StopWatch1.Start()
ElseIf Val(DetectLevels2.OutputPins.GetPin(0).ToString) = 1 Then
StopWatch1.Stop()
SegmentGauge1.Value = Val(StopWatch1.OutputPin.ToString)
End If

End Sub


Attached File(s)
.zip  Time_difference.zip (Size: 110.16 KB / Downloads: 2)
Find all posts by this user
Quote this message in a reply
11-08-2015, 03:28 PM (This post was last modified: 11-10-2015 05:27 AM by fanman.)
Post: #5
RE: Phase difference
Does anyone have any feedback? I find this forum to be a one way street. Questions get asked but never answered.
Find all posts by this user
Quote this message in a reply
11-10-2015, 05:30 AM
Post: #6
RE: Phase difference
I've been fooling around with extracting raw data from the buffer and detecting when the values Cross time axis. Seems OK so far. When o try to trigger the stopwatch to start the application crashes. Can't figure out why?
Find all posts by this user
Quote this message in a reply
11-11-2015, 09:34 PM
Post: #7
RE: Phase difference
There's only that much time in a day, sry for the delay.

If you want to detect if a value crosses an axis you should compare it to the previous value, not just for a value of >0 which may occur 100 times in a row. Maybe that's where the stopwatch gets confused as well.

Regards,
Dave
Quote this message in a reply
11-24-2015, 12:47 PM
Post: #8
RE: Phase difference
Well I think I have it sorted now. Its been tough understanding how the libraries work but this is how to do it.

Use 2 x GenricReal components to extract data from the sample buffers
Use an "if" statement to find when the samples cross the horizontal axis. You will get at which sample ID this happens for both Ch1 & Ch2. Exit the loop when the first cross over is detected.
Subtract the sample ID's to get the difference and divide by number of samples for one period of the signal.
Multiply by 360 and you'll get the phase difference.

There needs to be more info in the wiki online to help developers.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)