コード例 #1
0
ファイル: Polar.cs プロジェクト: kaury/MyTools
 public Complex GetComplex(Polar polar)
 {
     return(new Complex(polar.Modul * Math.Cos(polar.Angle / 180 * Math.PI), polar.Modul * Math.Sin(polar.Angle / 180 * Math.PI)));
 }
コード例 #2
0
ファイル: Polar.cs プロジェクト: kaury/MyTools
        public Polar Add(Polar comp)
        {
            Complex cpx = GetComplex(this) + GetComplex(comp);

            return(new Polar(cpx.GetModul(), cpx.GetAngle() / Math.PI * 180));
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: kaury/MyTools
        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);
            }
        }