
I want to add a calculate measurement in the graphs which its the phase angle difference using the angle from 2 different PMUs .Please help me in configuring the same.


Coordinator
Jun 29, 2012 at 9:15 PM
Edited Jun 29, 2012 at 9:15 PM

You can do this by writing an adapter to perform this difference calculation (see
here). Be mindful of the fact that you will need to unwrap the angles to get a good difference calculation however, for example this function takes an average of unwrapped angles, then rewraps them to be in the 180 to +180 range:
/// <summary>
/// Calculates an average of the specified sequence of <see cref="IMeasurement"/> phase angle values.
/// </summary>
/// <param name="source">Sequence of <see cref="IMeasurement"/> values over which to run calculation.</param>
/// <returns>Average of the specified sequence of <see cref="IMeasurement"/> phase angle values.</returns>
/// <remarks>
/// Phase angles wrap, so this algorithm takes the wrapping into account when calculating the average.
/// </remarks>
public static double AverageAngleValueFilter(IEnumerable<IMeasurement> source)
{
double average = 0.0D;
double[] sourceAngles = source.Select(m => m.Value).ToArray();
if (sourceAngles.Length > 0)
{
double offset = 0.0D, dis0, dis1, dis2;
double[] unwrappedAngles = new double[sourceAngles.Length];
unwrappedAngles[0] = sourceAngles[0];
// Unwrap all source angles
for (int i = 1; i < sourceAngles.Length; i++)
{
dis0 = Math.Abs(sourceAngles[i] + offset  unwrappedAngles[i  1]);
dis1 = Math.Abs(sourceAngles[i] + offset  unwrappedAngles[i  1] + 360.0D);
dis2 = Math.Abs(sourceAngles[i] + offset  unwrappedAngles[i  1]  360.0D);
if (dis1 < dis0 && dis1 < dis2)
offset = offset + 360.0D;
else if (dis2 < dis0 && dis2 < dis1)
offset = offset  360.0D;
unwrappedAngles[i] = sourceAngles[i] + offset;
}
// Apply average to unwrapped angles
average = unwrappedAngles.Average();
// Rewrap average angle
while (!(average <= 180.0D && average > 180.0D))
{
if (average > 180.0D)
average = 360.0D;
if (average <= 180.0D)
average += 360.0D;
}
}
return average;
}
Thanks!
Ritchie


Jul 12, 2012 at 5:08 PM
Edited Jul 18, 2012 at 2:11 PM

After writing my adapter, how can I add it into openPDC Manager and how can I see the outputs of it?
I mean, what are the procedure? Add a Calculated Measurement and then...??
I tried adding a Calculated Measurement but which parameters should I enter in
Parameter Connection, Configuration Section, Input Measurements and
Output Measurements fields?
An example using AverageFrequency adapter would be helpful!



Hi Ritchie,
What does unwrap and rewraps angles means? And Why is that necesary?
Itan

