Ejemplo n.º 1
0
        private static TransformerWindingConfigName GetWindConfig(MeasurementItemStruct mi, Transformer transformer)
        {
            if (mi.Winding == WindingType.HV)
            {
                mi.WindingConfig = transformer.WindingConfig.HV;
            }
            else if (mi.Winding == WindingType.MV)
            {
                mi.WindingConfig = transformer.WindingConfig.MV;
            }
            else
            {
                if (transformer.PhaseNum == 2)
                {
                    mi.WindingConfig = transformer.WindingConfig.MV;
                }
                else
                {
                    mi.WindingConfig = transformer.WindingConfig.LV;
                }
            }

            return(mi.WindingConfig);
        }
Ejemplo n.º 2
0
 public static void Losscurrent(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
 {
 }
Ejemplo n.º 3
0
 public static void Shortvolate(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
 {
 }
Ejemplo n.º 4
0
 public static void DCCharge(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
 {
 }
Ejemplo n.º 5
0
 public static void Coredci(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
 {
 }
Ejemplo n.º 6
0
        public static void OLTCSwitchingCharacter(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
        {
            Parameter.YzfjStation yzfjStation;
            if (mi.Winding == WindingType.HV)
            {
                yzfjStation = Parameter.YzfjStation.高压侧;
            }
            else
            {
                yzfjStation = Parameter.YzfjStation.中压侧;
            }
            switch (mi.state)
            {
            case 0:
                byte[] TestKindData = TZ3310.SetPraYzfj(Parameter.YzfjWindingKind.Yn型, yzfjStation, ChangeValueToNeed.GetOLtcNum(mi), Parameter.YzfjCurrent._1_A, 5, 5, 0);
                //byte[] TestKindData = TZ3310.SetPraYzfj(Parameter.YzfjWindingKind.Yn型, yzfjStation, ChangeValueToNeed.GetOLtcNum(mi), Parameter.YzfjCurrent._3_A, 5, 5, 0);
                Thread.Sleep(100);
                WorkingSets.local.OlTcLable = mi.TapLabel[0] + mi.TapLabel[1];
                TZ3310.StartTest(TestKindData);
                mi.stateText = "正在测试" + mi.Winding + "有载分接中...";
                mi.state++;
                Thread.Sleep(4000);
                break;

            case 1:
                string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.载分接);
                Thread.Sleep(150);

                if (Recbuffer != null)
                {
                    bool ReadforT;
                    if (Recbuffer[0] == "1")
                    {
                        ReadforT = true;
                    }
                    else
                    {
                        ReadforT = false;
                    }
                    if (Recbuffer.Length == 7)
                    {
                        PhysicalVariable[] Voltage   = { NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[3]), NumericsConverter.Text2Value(Recbuffer[5]) };  //135
                        PhysicalVariable[] current   = { NumericsConverter.Text2Value(Recbuffer[2]), NumericsConverter.Text2Value(Recbuffer[4]), NumericsConverter.Text2Value(Recbuffer[6]) };  //246
                        PhysicalVariable[] Resistans = new PhysicalVariable[3];
                        Resistans[0] = NumericsConverter.Text2Value("0.005");
                        Resistans[1] = NumericsConverter.Text2Value("0.005");
                        Resistans[2] = NumericsConverter.Text2Value("0.005");
                        mi.Result    = MeasurementResult.NewOLTCSwitchingCharacterResult(mi, Voltage, current, Resistans, null, ReadforT, false);
                        mi.stateText = "读取" + mi.Winding + "有载分接充电中...";
                        if (ReadforT)    //可以触发
                        {
                            mi.stateText = mi.Winding + "有载分接等待触发。。。";
                            Thread.Sleep(500);
                            mi.state++;
                        }
                    }
                    else
                    {
                        mi.failed    = false;
                        mi.completed = true;
                        mi.stateText = "充电时错误:" + Recbuffer[0].ToString();
                    }
                }
                break;

            case 2:
                string[] Recbuffer1 = TZ3310.ReadTestData(Parameter.TestKind.载分接);
                Thread.Sleep(150);

                if (Recbuffer1 != null)
                {
                    bool ReadforR;
                    if (Recbuffer1[0] == "2")
                    {
                        ReadforR = true;
                    }
                    else
                    {
                        ReadforR = false;
                    }
                    if (Recbuffer1.Length == 7)
                    {
                        PhysicalVariable[] Voltage = { NumericsConverter.Text2Value(Recbuffer1[1]), NumericsConverter.Text2Value(Recbuffer1[3]), NumericsConverter.Text2Value(Recbuffer1[5]) }; //135
                        PhysicalVariable[] current = { NumericsConverter.Text2Value(Recbuffer1[2]), NumericsConverter.Text2Value(Recbuffer1[4]), NumericsConverter.Text2Value(Recbuffer1[6]) }; //246
                        if (ReadforR)                                                                                                                                                           //触发成功
                        {
                            mi.Result    = MeasurementResult.NewOLTCSwitchingCharacterResult(mi, Voltage, current, new PhysicalVariable[3], null, ReadforR, true);
                            mi.stateText = "读取" + mi.Winding + "触发成功";
                            mi.state++;
                        }
                    }
                    if (Recbuffer1.Length == 1)
                    {
                        mi.failed    = false;
                        mi.completed = true;
                        mi.stateText = mi.Winding + "错误类型:" + Recbuffer1[0].ToString();
                    }
                }
                break;

            case 3:
                mi.stateText = "正在读取波形中。。。";
                Thread.Sleep(8000);
                mi.state++;
                break;

            case 4:
                short[] Waveform = TZ3310.GetWaveFormData();    //5s
                if (Waveform != null)
                {
                    WorkingSets.local.Testwave  = false;
                    WorkingSets.local.IsVisible = true;
                    mi.Result = MeasurementResult.NewOLTCSwitchingCharacterResult(mi, new PhysicalVariable[3], new PhysicalVariable[3],
                                                                                  new PhysicalVariable[3], Waveform, false, true);
                    mi.state++;
                    mi.stateText = "波形读取成功";
                }
                else
                {
                    mi.failed    = false;
                    mi.completed = true;
                    mi.stateText = mi.Winding + "未读取到波形";
                }
                break;

            case 5:
                mi.stateText = "等待确认波形...";

                if (WorkingSets.local.IsCompeleteSaveWave)
                {
                    mi.completed = true;
                    WorkingSets.local.IsCompeleteSaveWave = false;
                }
                break;
            }
        }
Ejemplo n.º 7
0
 public static void Information(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
 {
     mi.Result    = MeasurementResult.NewInformation(mi, ConvertData(Job.Information.ToString()), true);
     mi.completed = true;
 }
Ejemplo n.º 8
0
        public static void BushingCapacitance(ref MeasurementItemStruct mi, Transformer transformer, JobList Job)
        {
            Parameter.JSstation Jsposition = Parameter.JSstation.高压套管0;
            Thread.Sleep(150);
            if (mi.Winding == WindingType.HV)
            {
                if (mi.Terimal[0] == WindingTerimal.O)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.高压套管0;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合高套管0;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.A)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.高压套管A;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合高套管A;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.B)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.高压套管B;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合高套管B;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.C)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.高压套管C;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合高套管C;
                    }
                }
            }
            else
            {
                if (mi.Terimal[0] == WindingTerimal.O)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.中压套管0;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合中套管0;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.A)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.中压套管A;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合中套管A;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.B)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.中压套管B;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合中套管B;
                    }
                }
                if (mi.Terimal[0] == WindingTerimal.C)
                {
                    if (!transformer.Coupling)
                    {
                        Jsposition = Parameter.JSstation.中压套管C;
                    }
                    else
                    {
                        Jsposition = Parameter.JSstation.耦合中套管C;
                    }
                }
            }
            switch (mi.state)
            {
            case 0:
                byte[] TestKindData = TZ3310.SetPraJs(Jsposition, Parameter.JSstyle.内接正接, GetParameter.GetPraBushingCapacitanceVoltage(Job), Parameter.JSFrequency._45To_55HZ, 0);
                Thread.Sleep(100);
                TZ3310.StartTest(TestKindData);
                mi.stateText = "正在测试" + mi.Winding + "末屏中...";
                mi.state++;
                Thread.Sleep(4000);
                break;

            case 1:
                string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.介质损耗);
                Thread.Sleep(150);

                if (Recbuffer != null)
                {
                    if (Recbuffer[Recbuffer.Length - 1] == "0")
                    {
                        mi.Result = MeasurementResult.NewBushingCapacitanceResult(mi, NumericsConverter.Text2Value(Recbuffer[1]), null, null
                                                                                  , NumericsConverter.Text2Value(Recbuffer[2]), NumericsConverter.Text2Value(Recbuffer[3]), false);
                    }
                    else if (Recbuffer[Recbuffer.Length - 1] == "1")
                    {
                        mi.Result = MeasurementResult.NewBushingCapacitanceResult(mi, NumericsConverter.Text2Value(Recbuffer[0]),
                                                                                  NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[2])
                                                                                  , NumericsConverter.Text2Value(GetParameter.GetFreQuency(Parameter.JSFrequency._45To_55HZ)), NumericsConverter.Text2Value(Recbuffer[3]), true);
                        mi.completed = true;
                        mi.stateText = "读取" + mi.Winding + "末屏测试完成";
                    }
                    else
                    {
                        mi.failed    = true;
                        mi.completed = true;
                        mi.stateText = mi.Winding + "错误类型:" + Recbuffer[0].ToString();
                    }
                }
                break;
            }
        }
Ejemplo n.º 9
0
        public static void DCResistance(ref MeasurementItemStruct mi, Transformer transformer, JobList Job, TestingWorkerSender sender)
        {
            //string p = (1.1 + i / 10) + " kV";
            //string q = tempp.ToString("f1") + " A";
            //tempp += 0.1;

            //string w = (3.3 + i) + " Ω";
            //var p1 = new PhysicalVariable[] { p, q, w };
            //var p2 = new PhysicalVariable[] { p, q, w };
            //var p3 = new PhysicalVariable[] { p, q, w };
            //mi.Result = MeasurementResult.NewDCResistanceResult(mi, p1, p2, p3, false);
            //i++;
            //if (i > 100)
            //{
            //    mi.completed = true;
            //    mi.failed = true;
            //    mi.stateText = "测量人为中断";
            //    i = 0;
            //}
            //Thread.Sleep(200);

            if (mi.Terimal != null)
            {
                Parameter.ZldzStation Dcposition;
                if (mi.Winding == WindingType.HV)
                {
                    Dcposition = Parameter.ZldzStation.高压全部 + (((int)mi.Terimal[0]) % 4);//1

                    //   mi.WindingConfig = GetWindConfig(sender.MeasurementItems[sender.CurrentItemIndex + 1], transformer);
                }
                else if (mi.Winding == WindingType.MV)
                {
                    Dcposition = Parameter.ZldzStation.中压全部 + (((int)mi.Terimal[0]) % 4);//5
                }
                else
                {
                    if (!Job.DCResistance.ZcEnable)
                    {
                        Dcposition = Parameter.ZldzStation.低压全部 + (((int)mi.Terimal[0]) % 4);//9
                    }
                    else
                    {
                        Dcposition = Parameter.ZldzStation.注磁抵押 + (((int)mi.Terimal[0]) % 4);//9
                    }
                }
                switch (mi.state)
                {
                case 0:
                    if (mi.Winding == WindingType.HV)
                    {
                        mi.WindingConfig = transformer.WindingConfig.HV;
                    }
                    else if (mi.Winding == WindingType.MV)
                    {
                        mi.WindingConfig = transformer.WindingConfig.MV;
                    }
                    else
                    {
                        if (transformer.WindingNum == 2)
                        {
                            mi.WindingConfig = transformer.WindingConfig.MV;
                        }
                        else
                        {
                            mi.WindingConfig = transformer.WindingConfig.LV;
                        }
                    }
                    Thread.Sleep(2000);
                    byte[] TestKindData = TZ3310.SetPraZldz((Parameter.ZldzWindingKind)mi.WindingConfig, Dcposition, GetParameter.GetPraDCResistanceCurrentSpa(mi, Job), 0);
                    Thread.Sleep(100);
                    TZ3310.StartTest(TestKindData);
                    WorkingSets.local.TestDCI        = false;
                    WorkingSets.local.IsEnablestable = true;
                    mi.stateText = "正在开始" + mi.Winding + "直流电阻中...";
                    Thread.Sleep(4000);
                    mi.state++;
                    break;

                case 1:
                    string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    Thread.Sleep(150);
                    if (Recbuffer != null)
                    {
                        if (Recbuffer[Recbuffer.Length - 1] == "0")
                        {
                            PhysicalVariable[] Voltage    = { NumericsConverter.Text2Value(Recbuffer[0]), NumericsConverter.Text2Value(Recbuffer[3]), NumericsConverter.Text2Value(Recbuffer[6]) };
                            PhysicalVariable[] Current    = { NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[4]), NumericsConverter.Text2Value(Recbuffer[7]) };
                            PhysicalVariable[] Resistance = { NumericsConverter.Text2Value(Recbuffer[2]), NumericsConverter.Text2Value(Recbuffer[5]), NumericsConverter.Text2Value(Recbuffer[8]) };
                            mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, false);
                            mi.state++;                                        //测量结束数据需要确定
                            mi.stateText = "等待确认" + mi.Winding + "直流电阻稳定中..."; //临时
                            WorkingSets.local.IsVisible  = true;
                            WorkingSets.local.IsVisible1 = true;
                        }
                        else if (Recbuffer[Recbuffer.Length - 1] == "1")
                        {
                            mi.state++;
                        }
                        else
                        {
                            mi.failed    = true;
                            mi.completed = true;
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer[0].ToString();
                        }
                    }
                    break;

                case 2:
                    string[] Recbuffer1 = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    Thread.Sleep(150);
                    if (Recbuffer1 != null)
                    {
                        if (Recbuffer1[Recbuffer1.Length - 1] == "0")
                        {
                            PhysicalVariable[] Voltage    = { NumericsConverter.Text2Value(Recbuffer1[0]), NumericsConverter.Text2Value(Recbuffer1[3]), NumericsConverter.Text2Value(Recbuffer1[6]) };
                            PhysicalVariable[] Current    = { NumericsConverter.Text2Value(Recbuffer1[1]), NumericsConverter.Text2Value(Recbuffer1[4]), NumericsConverter.Text2Value(Recbuffer1[7]) };
                            PhysicalVariable[] Resistance = { NumericsConverter.Text2Value(Recbuffer1[2]), NumericsConverter.Text2Value(Recbuffer1[5]), NumericsConverter.Text2Value(Recbuffer1[8]) };
                            mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, false);
                            if (WorkingSets.local.IsStable == true)
                            {
                                WorkingSets.local.IsStable = false;
                                mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, true);
                                TZ3310.InterRuptMe(Parameter.CommanTest.判断直流电阻稳定状态);
                                mi.stateText = "确定" + mi.Winding + "直流电阻稳定成功";
                                mi.state++;
                            }
                        }
                        else if (Recbuffer1[Recbuffer1.Length - 1] == "1")
                        {
                            mi.state++;
                        }
                        else
                        {
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer1[0].ToString();
                            mi.failed    = true;
                            mi.completed = true;
                        }
                    }
                    break;

                case 3:
                    string[] Recbuffer2 = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    if (Recbuffer2 != null)
                    {
                        if (Recbuffer2[Recbuffer2.Length - 1] == "1")
                        {
                            if (sender.MeasurementItems.Length != (sender.CurrentItemIndex + 1))
                            {
                                var miNext = sender.MeasurementItems[sender.CurrentItemIndex + 1];
                                if (miNext.Terimal != null && mi.Function == miNext.Function &&
                                    mi.Terimal[0] == miNext.Terimal[0] &&
                                    mi.Terimal[1] == miNext.Terimal[1] &&
                                    mi.Winding == miNext.Winding &&
                                    mi.WindingConfig == GetWindConfig(miNext, transformer))
                                {
                                    //不需要放电
                                    mi.stateText = "直流电阻" + mi.Winding + ":" + mi.Terimal[0] + "-" + mi.Terimal[1] + "测试完成";
                                    mi.completed = true;
                                }
                                else
                                {
                                    //需要放电的
                                    TZ3310.ShutDownOutCurrent(0);

                                    mi.state++;
                                }
                            }
                            else
                            {
                                //为最后一项
                                mi.stateText = mi.Winding + "直流电阻正在放电...";
                                TZ3310.ShutDownOutCurrent(0);
                                mi.state++;
                            }
                        }
                        else
                        {
                            mi.failed    = true;
                            mi.completed = true;
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer2[0].ToString();    //临时
                        }
                    }
                    break;

                case 4:
                    string[] readdata = TZ3310.ReadTestData(Parameter.TestKind.读取放电数据);
                    if (readdata[0] == "2")
                    {
                        mi.stateText = mi.Winding + "直流电阻放电完成";
                        mi.completed = true;
                    }
                    break;
                }
            }
            else
            {
                switch (mi.state)
                {
                case 0:
                    if (mi.Winding == WindingType.HV)
                    {
                        mi.WindingConfig = transformer.WindingConfig.HV;
                    }
                    else if (mi.Winding == WindingType.MV)
                    {
                        mi.WindingConfig = transformer.WindingConfig.MV;
                    }
                    else
                    {
                        if (transformer.PhaseNum == 2)
                        {
                            mi.WindingConfig = transformer.WindingConfig.MV;
                        }
                        else
                        {
                            mi.WindingConfig = transformer.WindingConfig.LV;
                        }
                    }
                    WorkingSets.local.TestDCI        = false;
                    WorkingSets.local.IsEnablestable = true;
                    byte[] TestKindData = TZ3310.SetPraZldz((Parameter.ZldzWindingKind)mi.WindingConfig, mi.Winding.TozldzStation(Job), GetParameter.GetPraDCResistanceCurrentSpa(mi, Job), 0);
                    Thread.Sleep(100);

                    if (TZ3310.StartTest(TestKindData))
                    {
                        mi.stateText = "正在测试" + mi.Winding.TozldzStation(Job) + "直流电阻中...";
                        mi.state++;
                    }
                    Thread.Sleep(4000);
                    break;

                case 1:
                    string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    Thread.Sleep(150);
                    if (Recbuffer != null)
                    {
                        if (Recbuffer[Recbuffer.Length - 1] == "0")
                        {
                            PhysicalVariable[] Voltage    = { Recbuffer[0], Recbuffer[3], Recbuffer[6] };
                            PhysicalVariable[] Current    = { Recbuffer[1], Recbuffer[4], Recbuffer[7] };
                            PhysicalVariable[] Resistance = { Recbuffer[2], Recbuffer[5], Recbuffer[8] };
                            mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, false);
                            mi.state++;
                            mi.stateText = "等待确定" + mi.Winding + "直流电阻稳定中...";
                            WorkingSets.local.IsVisible  = true;
                            WorkingSets.local.IsVisible1 = true;
                        }
                        else if (Recbuffer[Recbuffer.Length - 1] == "1")
                        {
                            mi.state++;
                        }
                        else
                        {
                            mi.failed    = true;
                            mi.completed = true;
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer[0].ToString();
                        }
                    }
                    break;

                case 2:
                    string[] Recbuffer1 = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    if (Recbuffer1 != null)
                    {
                        if (Recbuffer1[Recbuffer1.Length - 1] == "0")
                        {
                            PhysicalVariable[] Voltage    = { Recbuffer1[0], Recbuffer1[3], Recbuffer1[6] };
                            PhysicalVariable[] Current    = { Recbuffer1[1], Recbuffer1[4], Recbuffer1[7] };
                            PhysicalVariable[] Resistance = { Recbuffer1[2], Recbuffer1[5], Recbuffer1[8] };
                            mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, false);
                            if (WorkingSets.local.IsStable == true)
                            {
                                WorkingSets.local.IsStable = false;
                                mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, true);
                                TZ3310.InterRuptMe(Parameter.CommanTest.判断直流电阻稳定状态);
                                mi.stateText = "确定" + mi.Winding + "直流电阻稳定成功";
                                mi.state++;
                            }
                        }
                        else if (Recbuffer1[Recbuffer1.Length - 1] == "1")
                        {
                            mi.state++;
                        }
                        else
                        {
                            mi.failed    = true;
                            mi.completed = true;
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer1[0].ToString();
                        }
                    }
                    break;

                case 3:
                    string[] Recbuffer2 = TZ3310.ReadTestData(Parameter.TestKind.直流电阻);
                    if (Recbuffer2 != null)
                    {
                        if (Recbuffer2[Recbuffer2.Length - 1] == "1")
                        {
                            if (sender.MeasurementItems.Length != (sender.CurrentItemIndex + 1))
                            {
                                var miNext = sender.MeasurementItems[sender.CurrentItemIndex + 1];
                                if (mi.Function == miNext.Function &&
                                    mi.Winding == miNext.Winding &&
                                    mi.WindingConfig == GetWindConfig(miNext, transformer))
                                {
                                    //不需要放电
                                    mi.stateText = "直流电阻" + mi.Winding + "测试完成";
                                    mi.completed = true;
                                }
                                else
                                {
                                    //需要放电的
                                    TZ3310.ShutDownOutCurrent(0);
                                    mi.state++;
                                }
                            }
                            else
                            {
                                //为最后一项
                                mi.stateText = mi.Winding + "直流电阻测试完成";
                                TZ3310.ShutDownOutCurrent(0);
                                mi.state++;
                            }
                        }
                        else
                        {
                            mi.failed    = true;
                            mi.completed = true;
                            mi.stateText = mi.Winding + "错误类型:" + Recbuffer2[0].ToString();    //临时
                        }
                    }
                    Thread.Sleep(1000);
                    break;

                case 4:
                    string[] readdata = TZ3310.ReadTestData(Parameter.TestKind.读取放电数据);
                    if (readdata[0] == "2")
                    {
                        mi.stateText = mi.Winding + "直流电阻放电完成";
                        mi.completed = true;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 10
0
        public static void AddTransformer(Transformer trs)
        {
            DataRow[] rows = WorkingSets.local.Transformers.Select("serialno = '" + trs.SerialNo.Trim() + "'");
            DataRow   r    = WorkingSets.local.Transformers.NewRow();

            if (rows.Length > 0)
            {
                r = rows[0];
            }
            else
            {
                r = WorkingSets.local.Transformers.NewRow();
            }
            bool previewSave = WorkingSets.local.saveTransformer();

            r["serialno"]               = trs.SerialNo;
            r["location"]               = trs.Location;
            r["apparatusid"]            = trs.ApparatusID;
            r["manufacturer"]           = trs.Manufacturer;
            r["productionyear"]         = trs.ProductionYear;
            r["assetsystemcode"]        = trs.AssetSystemCode;
            r["phases"]                 = trs.PhaseNum;
            r["windings"]               = trs.WindingNum;
            r["ratedfrequency"]         = trs.RatingFrequency;
            r["windingconfig_hv"]       = (int)trs.WindingConfig.HV;
            r["windingconfig_mv"]       = (int)trs.WindingConfig.MV;
            r["windingconfig_mv_label"] = (int)trs.WindingConfig.MVLabel;
            r["windingconfig_lv"]       = (int)trs.WindingConfig.LV;
            r["windingconfig_lv_label"] = (int)trs.WindingConfig.LVLabel;
            r["voltageratinghv"]        = (int)trs.VoltageRating.HV;
            r["voltageratingmv"]        = (int)trs.VoltageRating.MV;
            r["voltageratinglv"]        = (int)trs.VoltageRating.LV;
            r["powerratinghv"]          = (int)trs.PowerRating.HV;
            r["powerratingmv"]          = (int)trs.PowerRating.MV;
            r["powerratinglv"]          = (int)trs.PowerRating.LV;
            r["bushing_hv_enabled"]     = trs.Bushing.HVContained;
            r["bushing_mv_enabled"]     = trs.Bushing.MVContained;
            r["coupling"]               = trs.Coupling;
            if (trs.OLTC.Contained)
            {
                r["oltc_winding"]       = (int)trs.OLTC.WindingPosition;
                r["oltc_tapmainnum"]    = trs.OLTC.TapMainNum;
                r["oltc_tapnum"]        = trs.OLTC.TapNum;
                r["oltc_step"]          = getstep(trs.OLTC.Step);
                r["oltc_serialno"]      = trs.OLTC.SerialNo;
                r["oltc_modeltype"]     = trs.OLTC.ModelType;
                r["oltc_manufacturer"]  = trs.OLTC.Manufacturer;
                r["oltcproductionyear"] = trs.OLTC.ProductionYear;
            }
            else
            {
                r["oltc_winding"]       = 0;
                r["oltc_tapmainnum"]    = 0;
                r["oltc_tapnum"]        = -1;
                r["oltc_serialno"]      = string.Empty;
                r["oltc_modeltype"]     = string.Empty;
                r["oltc_manufacturer"]  = string.Empty;
                r["oltcproductionyear"] = string.Empty;
            }
            r["id"] = 1;
            if (rows.Length > 0)
            {
                r.EndEdit();
            }
            else
            {
                WorkingSets.local.Transformers.Rows.Add(r);
            }
            WorkingSets.local.saveTransformer();
        }
Ejemplo n.º 11
0
        public static Errorsymbol TransformerCheck(ref Transformer trs, Errorsymbol err = Errorsymbol.True)
        {
            if (trs.SerialNo == null)
            {
                return(Errorsymbol.TransformerSerialNoNull);
            }
            if (trs.Location == null)
            {
                return(Errorsymbol.TransformerLocationNull);
            }
            else
            {
                if (WorkingSets.local.getLocation(trs.Location).name != trs.Location)
                {
                    return(Errorsymbol.TransformerLocationNull);
                }
            }
            if (trs.ApparatusID == null)
            {
                return(Errorsymbol.TransformerApparatusIDNull);
            }
            if (trs.Manufacturer == null)
            {
                return(Errorsymbol.TransformerManufacturerNull);
            }
            if (trs.ProductionYear == null)
            {
                return(Errorsymbol.TransformerProductionYearNull);
            }
            if (trs.AssetSystemCode == null)
            {
                return(Errorsymbol.TransformerAssetSystemCodeNull);
            }
            if (trs.WindingNum == 3)
            {
                if (trs.VoltageRating.HV == 0 || trs.VoltageRating.MV == 0 || trs.VoltageRating.LV == 0)
                {
                    return(Errorsymbol.TransformerVoltageRatingNull);
                }
                if (trs.PowerRating.HV == 0 || trs.PowerRating.MV == 0 || trs.PowerRating.LV == 0)
                {
                    return(Errorsymbol.TransformerPowerRatingNull);
                }
            }
            else if (trs.WindingNum == 2)
            {
                if (trs.VoltageRating.HV == 0 || trs.VoltageRating.MV == 0)
                {
                    return(Errorsymbol.TransformerVoltageRatingNull);
                }
                if (trs.PowerRating.HV == 0 || trs.PowerRating.MV == 0)
                {
                    return(Errorsymbol.TransformerPowerRatingNull);
                }
            }
            else
            {
                return(Errorsymbol.TransformerWindingNumFalse);
            }
            if (trs.RatingFrequency != 50 && trs.RatingFrequency != 60)
            {
                return(Errorsymbol.TransformerRatingFrequencyNull);
            }
            if (trs.PhaseNum == 3)
            {
                if (trs.WindingConfig.HV != TransformerWindingConfigName.Y &&
                    trs.WindingConfig.HV != TransformerWindingConfigName.D &&
                    trs.WindingConfig.HV != TransformerWindingConfigName.Yn &&
                    trs.WindingConfig.HV != TransformerWindingConfigName.Zn &&
                    trs.WindingConfig.MV != TransformerWindingConfigName.Y &&
                    trs.WindingConfig.MV != TransformerWindingConfigName.D &&
                    trs.WindingConfig.MV != TransformerWindingConfigName.Yn &&
                    trs.WindingConfig.MV != TransformerWindingConfigName.Zn &&
                    trs.WindingConfig.LV != TransformerWindingConfigName.Y &&
                    trs.WindingConfig.LV != TransformerWindingConfigName.D &&
                    trs.WindingConfig.LV != TransformerWindingConfigName.Yn &&
                    trs.WindingConfig.LV != TransformerWindingConfigName.Zn &&
                    trs.WindingConfig.MVLabel < 0 && trs.WindingConfig.MVLabel > 11 &&
                    trs.WindingConfig.LVLabel < 0 && trs.WindingConfig.LVLabel > 11)
                {
                    return(Errorsymbol.TransformerWindingConfigFalse);
                }
            }
            else if (trs.PhaseNum == 1)
            {
            }
            else
            {
                return(Errorsymbol.TransformerPhaseNumFalse);
            }
            if (trs.Bushing.HVContained != true && trs.Bushing.HVContained != false &&
                trs.Bushing.MVContained != true && trs.Bushing.MVContained != false)
            {
                return(Errorsymbol.TransformerBushingFalse);
            }
            if (trs.OLTC.Contained)
            {
                if (trs.OLTC.WindingPositions == 0)
                {
                    trs.OLTC.WindingPosition = WindingType.HV;
                }
                else if (trs.OLTC.WindingPositions == 1)
                {
                    trs.OLTC.WindingPosition = WindingType.MV;
                }
                else if (trs.OLTC.WindingPositions == 2)
                {
                    trs.OLTC.WindingPosition = WindingType.LV;
                }
                else
                {
                    return(Errorsymbol.TransformerOLTCWindingPositionsFalse);
                }
                if (trs.OLTC.SerialNo == null)
                {
                    return(Errorsymbol.TransformerOLTCSerialNoNull);
                }
                if (trs.OLTC.ModelType == null)
                {
                    return(Errorsymbol.TransformerOLTCModelTypeNull);
                }
                if (trs.OLTC.Manufacturer == null)
                {
                    return(Errorsymbol.TransformerOLTCManufacturerNull);
                }
                if (trs.OLTC.ProductionYear == null)
                {
                    return(Errorsymbol.TransformerOLTCProductionYearNull);
                }
                if (trs.OLTC.Step != 0.005 && trs.OLTC.Step != 0.01 && trs.OLTC.Step != 0.0125 &&
                    trs.OLTC.Step != 0.02 && trs.OLTC.Step != 0.025 && trs.OLTC.Step != 0.05 && trs.OLTC.Step != 0.1)
                {
                    return(Errorsymbol.TransformerOLTCStepNull);
                }
                if (trs.OLTC.TapMainNum != 1 && trs.OLTC.TapMainNum != 3)
                {
                    return(Errorsymbol.TransformerOLTCTapMainNumNull);
                }
                if (trs.OLTC.TapNum != -1 && trs.OLTC.TapNum != 1 && trs.OLTC.TapNum != 2 &&
                    trs.OLTC.TapNum != 3 && trs.OLTC.TapNum != 4 && trs.OLTC.TapNum != 5 && trs.OLTC.TapNum != 0)
                {
                    return(Errorsymbol.TransformerOLTCTapNumNull);
                }
            }
            else
            {
                trs.OLTC.TapMainNum       = 0;
                trs.OLTC.WindingPositions = 0;
                trs.OLTC.TapNum           = 0;
                trs.OLTC.SerialNo         = null;
                trs.OLTC.ModelType        = null;
                trs.OLTC.Manufacturer     = null;
                trs.OLTC.ProductionYear   = null;
                trs.OLTC.Step             = 0;
            }
            // trs.OLTC.WindingPosition = WindingType.HV;


            return(Errorsymbol.True);
        }
Ejemplo n.º 12
0
        public static string Getjsonstr(byte[] jsons, ref int Flag)
        {
            string jsondata = Encoding.Default.GetString(jsons);

            if (jsondata.StartsWith("Location"))
            {
                Flag = -1;
                Location lc = new Location();
                try
                {
                    lc = JsonConvert.DeserializeObject <Location>(jsondata.Remove(0, 8));
                    if (LocationCheck(ref lc))
                    {
                        AddLocation(lc);
                        Flag = (int)Errorsymbol.AddLocationOk;
                        return(jsondata.Remove(0, 8));
                    }
                    else
                    {
                        Flag = (int)Errorsymbol.AddLocationFalse;
                        return(null);
                        //AddLocation(lc);
                    }
                }
                catch
                {
                    Flag = (int)Errorsymbol.AddLocationFalse;
                    return(null);
                }
            }
            if (jsondata.StartsWith("Transformer"))
            {
                Flag = -1;
                Transformer lc = new Transformer();
                try
                {
                    lc = JsonConvert.DeserializeObject <Transformer>(jsondata.Remove(0, 11));
                    if (Errorsymbol.True == TransformerCheck(ref lc))
                    {
                        AddTransformer(lc);
                        Flag = (int)Errorsymbol.AddTransformerOk;
                        return(jsondata.Remove(0, 11));
                    }
                    else
                    {
                        Flag = (int)Errorsymbol.AddTransformerFalse;
                        //AddTransformer(lc);
                        return(null);
                    }
                }
                catch
                {
                    Flag = (int)Errorsymbol.AddTransformerFalse;
                    return(null);
                }
            }
            if (jsondata.StartsWith("JobList"))
            {
                Flag = -1;
                JobList job = new JobList();
                try
                {
                    job = JsonConvert.DeserializeObject <JobList>(jsondata.Remove(0, 7));
                    if (Errorsymbol.True == JoblistCheck(ref job))
                    {
                        saveJob(job);
                        Flag = (int)Errorsymbol.AddJobListOk;
                        return(jsondata.Remove(0, 7));
                    }
                    else
                    {
                        Flag = (int)Errorsymbol.AddJobListFalse;
                        return(null);
                    }
                }
                catch
                {
                    Flag = Flag = (int)Errorsymbol.AddJobListFalse;
                    return(null);
                }
            }
            if (jsondata.StartsWith("JobTest"))
            {
                Flag = -1;
                return(Encoding.Default.GetString(jsons));
            }
            return(null);
        }