public PSData CalcNegative(Polar a, Polar b, Polar c) { PSData data = new PSData(); try { Polar sum = a + b.Rotate(240) + c.Rotate(120); data.Amplitude = sum.Modul / 3d; data.Phase = sum.Angle; data.Result = 1; } catch (Exception ex) { data.Result = -1; data.Message = ex.Message; } return(data); }
public PSData CalcZero(Polar a, Polar b, Polar c) { PSData data = new PSData(); try { Polar sum = a + b + c; data.Amplitude = sum.Modul / 3d; data.Phase = sum.Angle; data.Result = 1; } catch (Exception ex) { data.Result = -1; data.Message = ex.Message; } return(data); }
private void Btn_CalcSequenceComponent_Click(object sender, EventArgs e) { double.TryParse(txt_scUa.Text, out double Ua); double.TryParse(txt_scPhiUa.Text, out double PhiUa); double.TryParse(txt_scUb.Text, out double Ub); double.TryParse(txt_scPhiUb.Text, out double PhiUb); double.TryParse(txt_scUc.Text, out double Uc); double.TryParse(txt_scPhiUc.Text, out double PhiUc); double.TryParse(txt_scIa.Text, out double Ia); double.TryParse(txt_scPhiIa.Text, out double PhiIa); double.TryParse(txt_scIb.Text, out double Ib); double.TryParse(txt_scPhiIb.Text, out double PhiIb); double.TryParse(txt_scIc.Text, out double Ic); double.TryParse(txt_scPhiIc.Text, out double PhiIc); PMS.Platform.Utility.VectorHelper vector = new PMS.Platform.Utility.VectorHelper() { UL1Angle = (float)PhiUa, UL2Angle = (float)PhiUb, UL3Angle = (float)PhiUc, IL1Angle = (float)PhiIa, IL2Angle = (float)PhiIb, IL3Angle = (float)PhiIc, }; if (vector.DrawVector()) { pic_phase.Image = PicHelper.GetBitmap(vector.VectorFullPath); } else { pic_phase.Image = null; } string format = "F3"; PhaseSequence sequence = new PhaseSequence(); { Polar vUa = new Polar(Ua, PhiUa); Polar vUb = new Polar(Ub, PhiUb); Polar vUc = new Polar(Uc, PhiUc); PSData vPositiveU = sequence.CalcPositive(vUa, vUb, vUc); txt_scPositiveU.Text = vPositiveU.Amplitude.ToString(format); txt_scPositivePhiU.Text = vPositiveU.Phase.ToString(format); PSData vNegativeU = sequence.CalcNegative(vUa, vUb, vUc); txt_scNegativeU.Text = vNegativeU.Amplitude.ToString(format); txt_scNegativePhiU.Text = vNegativeU.Phase.ToString(format); PSData vZeroU = sequence.CalcZero(vUa, vUb, vUc); txt_scZeroU.Text = vZeroU.Amplitude.ToString(format); txt_scZeroPhiU.Text = vZeroU.Phase.ToString(format); } { Polar vIa = new Polar(Ia, PhiIa); Polar vIb = new Polar(Ib, PhiIb); Polar vIc = new Polar(Ic, PhiIc); PSData vPositiveI = sequence.CalcPositive(vIa, vIb, vIc); txt_scPositiveI.Text = vPositiveI.Amplitude.ToString(format); txt_scPositivePhiI.Text = vPositiveI.Phase.ToString(format); PSData vNegativeI = sequence.CalcNegative(vIa, vIb, vIc); txt_scNegativeI.Text = vNegativeI.Amplitude.ToString(format); txt_scNegativePhiI.Text = vNegativeI.Phase.ToString(format); PSData vZeroI = sequence.CalcZero(vIa, vIb, vIc); txt_scZeroI.Text = vZeroI.Amplitude.ToString(format); txt_scZeroPhiI.Text = vZeroI.Phase.ToString(format); } }