Ejemplo n.º 1
0
 private void pF_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int a = System.Text.RegularExpressions.Regex.Matches(ResultTextBox.Text, @"V").Count;
         if (a == 0)
         {
             ResultTextBox.Text += "V";
         }
         PhysicalVariable tpd = NumericsConverter.Text2Value(ResultTextBox.Text);
         if (Flag == 1)
         {
             OutCnData(NumericsConverter.Value2Text((double)tpd.value, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Voltage));
         }
         if (Flag == 2)
         {
             OutVolateData(NumericsConverter.Value2Text((double)tpd.value, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Voltage));
         }
         if (Flag == 3)
         {
             OutDYData(NumericsConverter.Value2Text((double)tpd.value, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Voltage));
         }
         if (Flag == 4)
         {
             OutProjectVolate(NumericsConverter.Value2Text((double)tpd.value, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Voltage));
         }
         this.Close();
     }
     catch
     {
         ShowHide("输出数据格式出错");
     }
 }
Ejemplo n.º 2
0
        private void Confire_click(object sender, RoutedEventArgs e)
        {
            PhysicalVariable tpd = NumericsConverter.Text2Value(ResultTextBox.Text);

            //  NumericsConverter.Value2Text(tpd,4,percentage:true);
            OutCnTanData(NumericsConverter.Value2Text(tpd, percentage: true));
            this.Close();
        }
Ejemplo n.º 3
0
        private string calcDF(PhysicalVariable AGx)
        {
            double tan = Math.Tan(pnv(AGx.value) - pnv(AGn.value));

            if (Math.Abs(tan) < 0.0000005)
            {
                return("0.000%");
            }
            if ((tan < 1e24) && (tan > -1e24))
            {
                return(NumericsConverter.Value2Text(tan, 4, -5, "", SCEEC.Numerics.Quantities.QuantityName.None, percentage: true).Trim());
            }
            else
            {
                return("NaN");
            }
        }
Ejemplo n.º 4
0
 private void nF_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int a = System.Text.RegularExpressions.Regex.Matches(ResultTextBox.Text, @"F").Count;
         if (a == 0)
         {
             ResultTextBox.Text += "nF";
         }
         PhysicalVariable tpd = NumericsConverter.Text2Value(ResultTextBox.Text);
         OutCnData(NumericsConverter.Value2Text((double)tpd.value, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Capacitance));
         this.Close();
     }
     catch
     {
         throw new Exception("结果值出错");
     }
 }
Ejemplo n.º 5
0
        private PhysicalVariable calcCap(PhysicalVariable Ix, PhysicalVariable AGx)
        {
            double angle = pnv(AGx.value);
            double ratio = pnv(Ix.value) / pnv(In.value);
            double zn    = pnv(Cn.value) / Math.Cos(pnv(AGn.value));
            double z     = zn * ratio;
            double cp    = z * Math.Cos(angle);
            double rp    = z * Math.Sin(angle);
            double tan   = Math.Tan(pnv(AGx.value) - pnv(AGn.value));
            double cs    = cp * (1 + tan * tan);

            if ((cs < 1e24) && (cs > -1e24))
            {
                return(NumericsConverter.Value2Text(cs, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Capacitance));
            }
            else
            {
                return("NaN");
            }
        }
Ejemplo n.º 6
0
        private void WorkTest_OutTestResult(byte[] result)
        {
            OutTestResult(result);
            ViewSources vs = new ViewSources(result);

            this.TestFre  = vs.TestFre;
            this.In       = NumericsConverter.Value2Text(vs.TestIn, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Capacitance);
            this.Ix1      = NumericsConverter.Value2Text(vs.TestIx1, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
            this.AG1      = vs.TestPh1.ToString("F6"); //NumericsConverter.Value2Text(vs.TestPh1, 4, -6, "", SCEEC.Numerics.Quantities.QuantityName.None);
            this.Ix2      = NumericsConverter.Value2Text(vs.TestIx2, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
            this.AG2      = vs.TestPh2.ToString("F6"); //NumericsConverter.Value2Text(vs.TestPh2, 4, -6, "", SCEEC.Numerics.Quantities.QuantityName.None);
            this.Ix3      = NumericsConverter.Value2Text(vs.TestIx3, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
            this.AG3      = vs.TestPh3.ToString("F6"); //NumericsConverter.Value2Text(vs.TestPh3, 4, -6, "", SCEEC.Numerics.Quantities.QuantityName.None);
            this.Ix4      = NumericsConverter.Value2Text(vs.TestIx4, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
            this.AG4      = vs.TestPh4.ToString("F6"); //NumericsConverter.Value2Text(vs.TestPh4, 4, -6, "", SCEEC.Numerics.Quantities.QuantityName.None);
            this.OneStata = NumericsConverter.Value2Text(vs.OneVolate, 4, -13, "", SCEEC.Numerics.Quantities.QuantityName.Voltage);
            this.Alarm    = vs.AlarmStata.ToString();

            StandardCapacitance = Cn.ToString();
            StandardCapacitanceDissipationFactor = NumericsConverter.Value2Text(Math.Tan(pnv(AGn.value)), 4, -5, "", SCEEC.Numerics.Quantities.QuantityName.None, percentage: true).Trim();
            HVFrequency        = NumericsConverter.Value2Text(vs.TestFre, 4, -3, "", SCEEC.Numerics.Quantities.QuantityName.Frequency);
            HVVoltage          = calcVolt(HVFrequency, Cn, In);
            Capacitance1       = calcCap(Ix1, AG1).ToString();
            Capacitance2       = calcCap(Ix2, AG2).ToString();
            Capacitance3       = calcCap(Ix3, AG3).ToString();
            Capacitance4       = calcCap(Ix4, AG4).ToString();
            Current1           = Ix1.ToString();
            Current2           = Ix2.ToString();
            Current3           = Ix3.ToString();
            Current4           = Ix4.ToString();
            DissipationFactor1 = calcDF(AG1);
            DissipationFactor2 = calcDF(AG2);
            DissipationFactor3 = calcDF(AG3);
            DissipationFactor4 = calcDF(AG4);
            Power1             = calcPower(Ix1, AG1);
            Power2             = calcPower(Ix2, AG2);
            Power3             = calcPower(Ix3, AG3);
            Power4             = calcPower(Ix4, AG4);
        }
Ejemplo n.º 7
0
        private string calcVolt(PhysicalVariable Freq, PhysicalVariable C, PhysicalVariable I)
        {
            double freq = pnv(Freq.value);
            double c    = pnv(C.value);
            double i    = pnv(I.value);

            if (freq < 1.0)
            {
                return("0 V");
            }
            if (c < 1e-13)
            {
                return("NaN");
            }
            if (i < 1e-9)
            {
                return("0 V");
            }
            double v = i / (2 * Math.PI * freq * c);

            return(NumericsConverter.Value2Text(v, 4, -1, "", SCEEC.Numerics.Quantities.QuantityName.Voltage));
        }
Ejemplo n.º 8
0
        private string calcPower(PhysicalVariable Ix, PhysicalVariable AGx)
        {
            double angle = pnv(AGx.value);
            double ratio = pnv(Ix.value) / pnv(In.value);
            double zn    = pnv(Cn.value) / Math.Cos(pnv(AGn.value));
            double z     = zn * ratio;
            double cp    = z * Math.Cos(angle);
            double rp    = z * Math.Sin(angle);
            double tan   = Math.Tan(pnv(AGx.value) - pnv(AGn.value));
            double rs    = cp * (tan * tan) / (1 + tan * tan);
            double i     = pnv(Ix.value);
            double p     = i * i * rs;

            if ((p < 1e24) && (p > -1e24))
            {
                return(NumericsConverter.Value2Text(p, 4, -3, "", SCEEC.Numerics.Quantities.QuantityName.Power));
            }
            else
            {
                return("NaN");
            }
        }
Ejemplo n.º 9
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     t1.Text = NumericsConverter.Value2Text(1e-10, 2, -23, " ", "V", false, false);
 }
Ejemplo n.º 10
0
        private void MainWindow_OutTestResult(byte[] data)
        {
            ViewSources vs = new ViewSources(data);

            this.Dispatcher.BeginInvoke((Action) delegate()
            {
                if (Com1.SelectedIndex == 0)
                {
                    DL.Text     = NumericsConverter.Value2Text(vs.TestIn, 6, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
                    XW.Text     = vs.TestPh1.ToString("F6");
                    float[] tpd = GetTwoNum(Com1.SelectedIndex, Com2.SelectedIndex, (int)vs.TestRn);
                    if (tpd != null)
                    {
                        if ((((int)vs.TestRn).ToString() != LC.Text) && CurrentTextBox.Text.Length < 1)
                        {
                            CurrentTextBox.Text = tpd[0].ToString();
                            Tant.Text           = tpd[1].ToString();
                        }
                    }
                    LC.Text = vs.TestRn.ToString();
                }
                if (Com1.SelectedIndex == 3)
                {
                    DL.Text     = NumericsConverter.Value2Text(vs.TestIx1, 6, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
                    XW.Text     = vs.TestPh2.ToString("F6");
                    float[] tpd = GetTwoNum(Com1.SelectedIndex, Com2.SelectedIndex, (int)vs.TestRx1);
                    if (tpd != null)
                    {
                        if ((((int)vs.TestRx1).ToString() != LC.Text) && CurrentTextBox.Text.Length < 1)
                        {
                            CurrentTextBox.Text = tpd[0].ToString();
                            Tant.Text           = tpd[1].ToString();
                        }
                    }
                    LC.Text = vs.TestRx1.ToString();
                }
                if (Com1.SelectedIndex == 4)
                {
                    DL.Text     = NumericsConverter.Value2Text(vs.TestIx2, 6, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
                    XW.Text     = vs.TestPh3.ToString("F6");
                    float[] tpd = GetTwoNum(Com1.SelectedIndex, Com2.SelectedIndex, (int)vs.TestRx2);
                    if (tpd != null)
                    {
                        if ((((int)vs.TestRx2).ToString() != LC.Text) && CurrentTextBox.Text.Length < 1)
                        {
                            CurrentTextBox.Text = tpd[0].ToString();
                            Tant.Text           = tpd[1].ToString();
                        }
                    }
                    LC.Text = vs.TestRx2.ToString();
                }
                if (Com1.SelectedIndex == 5)
                {
                    DL.Text     = NumericsConverter.Value2Text(vs.TestIx3, 6, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
                    XW.Text     = vs.TestPh4.ToString("F6");
                    float[] tpd = GetTwoNum(Com1.SelectedIndex, Com2.SelectedIndex, (int)vs.TestRx3);
                    if (tpd != null)
                    {
                        if ((((int)vs.TestRx3).ToString() != LC.Text) && CurrentTextBox.Text.Length < 1)
                        {
                            CurrentTextBox.Text = tpd[0].ToString();
                            Tant.Text           = tpd[1].ToString();
                        }
                    }
                    LC.Text = vs.TestRx3.ToString();
                }
                if (Com1.SelectedIndex == 6)
                {
                    DL.Text     = NumericsConverter.Value2Text(vs.TestIx4, 6, -13, "", SCEEC.Numerics.Quantities.QuantityName.Current);
                    XW.Text     = vs.TestPh4.ToString("F6");
                    float[] tpd = GetTwoNum(Com1.SelectedIndex, Com2.SelectedIndex, (int)vs.TestRx4);
                    if (tpd != null)
                    {
                        if ((((int)vs.TestRx4).ToString() != LC.Text) && CurrentTextBox.Text.Length < 1)
                        {
                            CurrentTextBox.Text = tpd[0].ToString();
                            Tant.Text           = tpd[1].ToString();
                        }
                    }
                    LC.Text = vs.TestRx4.ToString();
                }
                if (Com1.SelectedIndex == 1 || Com1.SelectedIndex == 2 || Com1.SelectedIndex == 7)
                {
                    LC.Text             = "";
                    DL.Text             = "";
                    XW.Text             = "";
                    CurrentTextBox.Text = "";
                    Tant.Text           = "";
                }
            });
        }