06-14-2010 01:32 AM
Hi there
Any one could confirm that , could we use CycleRmsAverage on measurements class (On Enterprise library) to calculateVoltageCycleAverage, VoltageCycleRms. As by definition we should need period and dt which is a timing related value. But this method take array of double as an input data instead of AnalogWaveForm instant's class which would includes both Vertical axis data (array of Double) and horizontal axis ( array of DateTime or PrecisionDataTime structure). Hence , how this method could get the timing information to determine Period and dt . The array of double wouldn't tell any thing about horizontal space . If the sampling rate is unknown how could we know how far the 2 adjacent points are located a part thus dt is unknown . With the same logic Period is also unknown. Thus I have a big question , how robust this method is to calculate the above mentioned values.
Please tell me if any one know.
Regards
06-15-2010 02:53 PM
Hi Khammonh,
You'll notice that one of the arguments of the CycleRMSAverage function is waveform size. Since this function is for only one period time does not factor in as long as the size of the waveform is known.
I hope this helps out!
Regards,
06-15-2010 10:00 PM
Hi Dustin
Thank for reply but I didn't see the overload of CycleRmsAverage that take waveform as argument , there are only two overload versions and both take an array .
Anyway I create a function to find Period base on waveform data which could be shown bellow in VB.Net and it is easy to convert it into C# :
Private Function GetPeriod(ByVal Data As AnalogWaveform(Of Double), ByVal Mid As Double) As Double
Dim Ret As Double
Dim DateData() As PrecisionDateTime = Data.GetPrecisionTimeStampsDim V() As Double = Data.GetRawData
If V.Count = 0 Then Return 0Dim I As Integer
Dim IsRising As Boolean = False
Dim IsCross As Boolean = False
Dim Cross As Short = 0Dim T1, T3 As PrecisionDateTime
Dim Delta1, Delta2, Delta3 As Double
For I = 0 To V.Count - 1Delta1 = V(I + 1) - V(I) 'for Edge detection
Delta2 = Mid - V(I) 'for crossing detection
Delta3 = Mid - V(I + 1) ' for crossing detection
IsRising = IIf(Delta1 > 0, True, False) 'Positive Delta1 when is rising edge and negative when falling
If IsRising Then
IsCross = IIf(Delta2 > 0 And Delta3 < 0, True, False)Cross += 1
Else
IsCross = IIf(Delta2 < 0 And Delta3 > 0, True, False)Cross += 1
End If
If IsCross Then
If Cross = 1 Then ' find 1st cross time
T1 = DateData(I) + (DateData(I + 1) - DateData(I)) / 2
End If
If Cross = 3 Then 'find 3rd cross time
T3 = DateData(I) + (DateData(I + 1) - DateData(I)) / 2
End If
End If
Next
Ret = T3.Subtract(T1).TotalSeconds
Return RetEnd Function
So when we get period we can calculate VoltageCycleAverage and VoltageCycleRMS by the formula giving in the definition.
Regards
06-17-2010 01:11 PM
Khammonh,
CycleRMSAverage does not take a waveform as an argument, it takes a double array, but it also takes the size of that double array. That's all that is needed to calculate VoltageCycleRMS and VoltageCycleAverage for a single cycle of the periodic signal.
Regards,