Ejemplo n.º 1
0
 private byte GetTapLabel(MeasurementItemStruct mi)
 {
     return((byte)ChangeValueToNeed.GetOLtcNum(mi));
 }
Ejemplo n.º 2
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;
            }
        }