public void PushDataTo(CycleDataSet cycleDataSet) { CycleData cycleData; Cycle[] cycles; CycleDataGroup[] cycleDataGroups; cycleDataGroups = new CycleDataGroup[] { VA, VB, VC, IA, IB, IC }; cycles = new Cycle[cycleDataGroups.Length]; for (int i = 0; i < VA.ToDataGroup().Samples; i++) { cycleData = new CycleData(); cycles[0] = cycleData.AN.V; cycles[1] = cycleData.BN.V; cycles[2] = cycleData.CN.V; cycles[3] = cycleData.AN.I; cycles[4] = cycleData.BN.I; cycles[5] = cycleData.CN.I; for (int j = 0; j < cycles.Length; j++) { cycles[j].RMS = cycleDataGroups[j].RMS[i].Value; cycles[j].Phase = cycleDataGroups[j].Phase[i].Value; cycles[j].Peak = cycleDataGroups[j].Peak[i].Value; cycles[j].Error = cycleDataGroups[j].Error[i].Value; } cycleDataSet[i] = cycleData; } }
/// <summary> /// Calculates the positive, negative, and zero sequence components /// and returns them in an array with indexes 1, 2, and 0 respectively. /// </summary> /// <param name="anCycle">The cycle of A-to-neutral data to be used.</param> /// <param name="bnCycle">The cycle of B-to-neutral data to be used.</param> /// <param name="cnCycle">The cycle of C-to-neutral data to be used.</param> /// <returns>An array of size 3 containing the zero sequence, positive sequence, and negative sequence components in that order.</returns> public static ComplexNumber[] CalculateSequenceComponents(Cycle anCycle, Cycle bnCycle, Cycle cnCycle) { ComplexNumber an = anCycle.Complex; ComplexNumber bn = bnCycle.Complex; ComplexNumber cn = cnCycle.Complex; ComplexNumber[] sequenceComponents = new ComplexNumber[3]; sequenceComponents[0] = (an + bn + cn) / 3.0D; sequenceComponents[1] = (an + a * bn + aSq * cn) / 3.0D; sequenceComponents[2] = (an + aSq * bn + a * cn) / 3.0D; return(sequenceComponents); }
// Converts the cycle to CSV data. private static string ToCSV(Cycle cycle) { return(string.Format("{0},{1},{2}", cycle.RMS, cycle.Phase.ToDegrees(), cycle.Peak)); }
/// <summary> /// Calculates the positive, negative, and zero sequence components /// and returns them in an array with indexes 1, 2, and 0 respectively. /// </summary> /// <param name="anCycle">The cycle of A-to-neutral data to be used.</param> /// <param name="bnCycle">The cycle of B-to-neutral data to be used.</param> /// <param name="cnCycle">The cycle of C-to-neutral data to be used.</param> /// <returns>An array of size 3 containing the zero sequence, positive sequence, and negative sequence components in that order.</returns> public static ComplexNumber[] CalculateSequenceComponents(Cycle anCycle, Cycle bnCycle, Cycle cnCycle) { ComplexNumber an = anCycle.Complex; ComplexNumber bn = bnCycle.Complex; ComplexNumber cn = cnCycle.Complex; ComplexNumber[] sequenceComponents = new ComplexNumber[3]; sequenceComponents[0] = (an + bn + cn) / 3.0D; sequenceComponents[1] = (an + a * bn + aSq * cn) / 3.0D; sequenceComponents[2] = (an + aSq * bn + a * cn) / 3.0D; return sequenceComponents; }