public static void BushingDCInsulation(ref MeasurementItemStruct mi, Transformer transformer, JobList Job) { Parameter.JYDZstation position; if (mi.Winding == WindingType.HV) { position = Parameter.JYDZstation.高压套管A + (((int)mi.Terimal[0] + 3) % 4); } else { position = Parameter.JYDZstation.中压套管A + (((int)mi.Terimal[0] + 3) % 4); } switch (mi.state) { case 0: byte[] TestKindData = TZ3310.SetPraJydz(position, GetParameter.GetPraBushingDCInsulationVoltage(Job), 50, GetParameter.GetPraDCInsulationResistance(Job), GetParameter.GetPraDCInsulationAbsorptionRatio(Job), 0); Thread.Sleep(100); TZ3310.StartTest(TestKindData); mi.stateText = "正在测试" + position.ToString() + "末屏中..."; mi.state++; Thread.Sleep(4000); break; case 1: string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.绝缘电阻); Thread.Sleep(150); if (Recbuffer != null) { PhysicalVariable[] Volate = new PhysicalVariable[1]; if (Recbuffer[Recbuffer.Length - 1] == "0") { mi.Result = MeasurementResult.NewBushingDCInsulationResult(mi, NumericsConverter.Text2Value(Recbuffer[0]), NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[2]), null, false); } else if (Recbuffer[Recbuffer.Length - 1] == "1") { mi.Result = MeasurementResult.NewBushingDCInsulationResult(mi, Volate[0], NumericsConverter.Text2Value(Recbuffer[0]), NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[2]), true); mi.state++; mi.completed = true; mi.stateText = position.ToString() + "末屏测试完成"; } else { mi.failed = true; mi.completed = true; mi.stateText = mi.Winding + "错误类型:" + Recbuffer[0]; } } break; } }
public static void Capacitance(ref MeasurementItemStruct mi, Transformer transformer, JobList Job) { switch (mi.state) { case 0: byte[] TestKindData; if (!transformer.Coupling || mi.Winding == WindingType.LV) { TestKindData = TZ3310.SetPraJs(mi.Winding.ToJSstation(), Parameter.JSstyle.内接反接, GetParameter.GetPraCapacitanceVoltage(Job), Parameter.JSFrequency._45To_55HZ, 0); } else { TestKindData = TZ3310.SetPraJs(Parameter.JSstation.高中绕组, Parameter.JSstyle.内接反接, GetParameter.GetPraCapacitanceVoltage(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.NewCapacitanceResult(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.NewCapacitanceResult(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; } }
public static void DoDCInsulation(ref MeasurementItemStruct mi, Transformer transformer, JobList Job) { switch (mi.state) { case 0: byte[] TestKindData; if (!transformer.Coupling || mi.Winding == WindingType.LV) { TestKindData = TZ3310.SetPraJydz(mi.Winding.ToJYDZstation(), GetParameter.GetPraDCInsulationVoltage(Job), 50, GetParameter.GetPraDCInsulationResistance(Job), GetParameter.GetPraDCInsulationAbsorptionRatio(Job), 0); } else { TestKindData = TZ3310.SetPraJydz(Parameter.JYDZstation.高中绕组, GetParameter.GetPraDCInsulationVoltage(Job), 50, GetParameter.GetPraDCInsulationResistance(Job), GetParameter.GetPraDCInsulationAbsorptionRatio(Job), 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.绝缘电阻); if (Recbuffer != null) { PhysicalVariable[] Volate = new PhysicalVariable[1]; if (Recbuffer[Recbuffer.Length - 1] == "0") { mi.Result = MeasurementResult.NewDCInsulationResult(mi, NumericsConverter.Text2Value(Recbuffer[0]), NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[2]), null, false); Volate[0] = NumericsConverter.Text2Value(Recbuffer[0]); } else if (Recbuffer[Recbuffer.Length - 1] == "1") { mi.Result = MeasurementResult.NewDCInsulationResult(mi, Volate[0], NumericsConverter.Text2Value(Recbuffer[0]), NumericsConverter.Text2Value(Recbuffer[1]), NumericsConverter.Text2Value(Recbuffer[2]), true); mi.completed = true; mi.stateText = "读取" + mi.Winding + "绝缘电阻结果成功"; } else { mi.failed = true; mi.completed = true; mi.stateText = mi.Winding + "错误类型:" + Recbuffer[0]; } } break; } }
private string CreateOLTcPra(MeasurementItemStruct mi, JobList job, int oltcnum) { string Position = GetTapLabel(mi).ToString("X2"); if (mi.Winding == WindingType.HV) { Position = "00"; } else { Position = "01"; } rc.OltcNum++; rc.OltcNumEnable = true; return(GetCurrent(GetParameter.GetPraDCResistanceCurrentUpanSpa(mi, job)) + Position + NumCorrection.KeepNum(oltcnum.ToString(), 2, HeadOrTail.Head) + "05" + "20"); }
//介损供体 private string CreateCapacitancePra(MeasurementItemStruct mi, JobList job) { if (mi.Terimal == null) { string CapacitanceVoltage = "00"; CapacitanceVoltage = GetParameter.GetPraCapacitanceVoltageNum(job); string Fre = "01"; string Wt = "01"; rc.CaPaNum++; rc.CaPaNumEnable = true; return(CapacitanceVoltage + Fre + Wt + NumCorrection.KeepNum(((int)mi.Winding.ToJSstation()).ToString(), 2, HeadOrTail.Head)); } else { Parameter.JSstation Jsposition; string Windingkind = null; if (mi.Winding == WindingType.HV) { Jsposition = Parameter.JSstation.高压套管A + (((int)mi.Terimal[0] + 3) % 4); } else { Jsposition = Parameter.JSstation.中压套管A + (((int)mi.Terimal[0] + 3) % 4); } switch (Jsposition) { case Parameter.JSstation.高压套管A: Windingkind = "03"; break; case Parameter.JSstation.高压套管B: Windingkind = "04"; break; case Parameter.JSstation.高压套管C: Windingkind = "05"; break; case Parameter.JSstation.高压套管0: Windingkind = "06"; break; case Parameter.JSstation.中压套管A: Windingkind = "07"; break; case Parameter.JSstation.中压套管B: Windingkind = "08"; break; case Parameter.JSstation.中压套管C: Windingkind = "09"; break; case Parameter.JSstation.中压套管0: Windingkind = "0A"; break; default: Windingkind = "03"; break; } string CapacitanceVoltage = GetParameter.GetPraCapacitanceVoltageNum(job); string Fre = "01"; string Wt = "00"; rc.CaPaNum++; rc.CaPaNumEnable = true; return(CapacitanceVoltage + Fre + Wt + Windingkind); } }
private string CreateDCInsulationPra(MeasurementItemStruct mi, JobList job) { //if (mi.Winding.ToJYDZstation() == Parameter.JYDZstation.高压绕组 || // mi.Winding.ToJYDZstation() == Parameter.JYDZstation.中压绕组 || // mi.Winding.ToJYDZstation() == Parameter.JYDZstation.低压绕组) if (mi.Terimal == null) { string DCInsulationVoltage = GetParameter.GetPraDCInsulationVoltageNum(job); string Windingkind = "00";//默认00 if (mi.Winding == WindingType.HV) { Windingkind = "00"; } if (mi.Winding == WindingType.MV) { Windingkind = "01"; } if (mi.Winding == WindingType.LV) { Windingkind = "02"; } rc.DcInNUm++; rc.DcInNUmEnable = true; return(DCInsulationVoltage + Windingkind + "02" + "64" + "64"); } else { Parameter.JYDZstation position; string DCInsulationVoltage = GetParameter.GetPraDCInsulationVoltageNum(job); string Windingkind = null; if (mi.Winding == WindingType.HV) { position = Parameter.JYDZstation.高压套管A + (((int)mi.Terimal[0] + 3) % 4); } else { position = Parameter.JYDZstation.中压套管A + (((int)mi.Terimal[0] + 3) % 4); } switch (position) { case Parameter.JYDZstation.高压套管A: Windingkind = "03"; break; case Parameter.JYDZstation.高压套管B: Windingkind = "04"; break; case Parameter.JYDZstation.高压套管C: Windingkind = "05"; break; case Parameter.JYDZstation.高压套管0: Windingkind = "06"; break; case Parameter.JYDZstation.中压套管A: Windingkind = "07"; break; case Parameter.JYDZstation.中压套管B: Windingkind = "08"; break; case Parameter.JYDZstation.中压套管C: Windingkind = "09"; break; case Parameter.JYDZstation.中压套管0: Windingkind = "0A"; break; default: Windingkind = "03"; break; } rc.DcInNUm++; rc.DcInNUmEnable = true; return(DCInsulationVoltage + Windingkind + "02" + "64" + "64"); } }
private string CreateDcResistancePra(MeasurementItemStruct mi, JobList job) { if (mi.Terimal != null) { Parameter.ZldzStation Dcposition; string WindingConfig = "00"; string Windingkind = "00"; string DcResistanceCurrent = GetCurrent(GetParameter.GetPraDCResistanceCurrentSpa(mi, job)); if (mi.Winding == WindingType.HV) { Dcposition = Parameter.ZldzStation.高压全部 + (((int)mi.Terimal[0]) % 4);//1 } else if (mi.Winding == WindingType.MV) { Dcposition = Parameter.ZldzStation.中压全部 + (((int)mi.Terimal[0]) % 4);//5 } else { Dcposition = Parameter.ZldzStation.低压全部 + (((int)mi.Terimal[0]) % 4);//9 } if ((int)mi.WindingConfig == 0) { WindingConfig = "00"; } if ((int)mi.WindingConfig == 1) { WindingConfig = "01"; } if ((int)mi.WindingConfig == 2) { WindingConfig = "02"; } if ((int)mi.WindingConfig == 3) { WindingConfig = "03"; } if (GetParameter.GetPraDCResistanceUpanCurrent(job) == Parameter.ZldzCurrent._1A) { DcResistanceCurrent = "00"; } if (GetParameter.GetPraDCResistanceUpanCurrent(job) == Parameter.ZldzCurrent._3A) { DcResistanceCurrent = "01"; } if (GetParameter.GetPraDCResistanceUpanCurrent(job) == Parameter.ZldzCurrent._10A) { DcResistanceCurrent = "02"; } switch (Dcposition) { case Parameter.ZldzStation.高压AB_A: Windingkind = "01"; break; case Parameter.ZldzStation.高压BC_B: Windingkind = "02"; break; case Parameter.ZldzStation.高压CA_C: Windingkind = "03"; break; case Parameter.ZldzStation.中压AB_A: Windingkind = "05"; break; case Parameter.ZldzStation.中压BC_B: Windingkind = "06"; break; case Parameter.ZldzStation.中压CA_C: Windingkind = "07"; break; case Parameter.ZldzStation.低压AB_A: Windingkind = "09"; break; case Parameter.ZldzStation.低压BC_B: Windingkind = "0A"; break; case Parameter.ZldzStation.低压CA_C: Windingkind = "0B"; break; default: Windingkind = "01"; break; } rc.DcReNumEnable = true; rc.DcReNum++; return(DcResistanceCurrent + Windingkind + WindingConfig); } else { string WindingConfig = "00"; string Windingkind = "00"; string DcResistanceCurrent = "00"; if ((int)mi.WindingConfig == 0) { WindingConfig = "00"; } if ((int)mi.WindingConfig == 1) { WindingConfig = "01"; } if ((int)mi.WindingConfig == 2) { WindingConfig = "02"; } if ((int)mi.WindingConfig == 3) { WindingConfig = "03"; } if (mi.Winding == WindingType.HV) { Windingkind = "00"; } if (mi.Winding == WindingType.MV) { Windingkind = "01"; } if (mi.Winding == WindingType.LV) { Windingkind = "02"; } if (GetParameter.GetPraDCResistanceCurrentSpa(mi, job) == Parameter.ZldzCurrent._1A) { DcResistanceCurrent = "00"; } if (GetParameter.GetPraDCResistanceCurrentSpa(mi, job) == Parameter.ZldzCurrent._3A) { DcResistanceCurrent = "01"; } if (GetParameter.GetPraDCResistanceCurrentSpa(mi, job) == Parameter.ZldzCurrent._10A) { DcResistanceCurrent = "02"; } rc.DcReNum++; rc.DcReNumEnable = true; return(DcResistanceCurrent + Windingkind + WindingConfig); } }
public static void DCResistance(ref MeasurementItemStruct mi, Transformer transformer, JobList Job) { if (mi.Terimal != null) { Parameter.ZldzStation Dcposition; if (mi.Winding == WindingType.HV) { Dcposition = (Parameter.ZldzStation)(Parameter.ZldzStation.高压全部 + (((int)mi.Terimal[0]) % 4));//1 } else if (mi.Winding == WindingType.MV) { Dcposition = (Parameter.ZldzStation)(Parameter.ZldzStation.中压全部 + (((int)mi.Terimal[0]) % 4));//5 } else { Dcposition = (Parameter.ZldzStation)(Parameter.ZldzStation.低压全部 + (((int)mi.Terimal[0]) % 4));//9 } switch (mi.state) { case 0: byte[] TestKindData = TZ3310.SetPraZldz((Parameter.ZldzWindingKind)mi.WindingConfig, Dcposition, GetParameter.GetPraDCResistanceCurrent(Job), 0); Thread.Sleep(100); TZ3310.StartTest(TestKindData); WorkingSets.local.IsEnablestable = true; mi.stateText = "正在测试" + mi.Winding + "直流电阻中..."; mi.state++; Thread.Sleep(4000); break; case 1: string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.直流电阻); 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 + "直流电阻数据中..."; //临时 Thread.Sleep(500); } 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 = { 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) { mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, true); TZ3310.InterRuptMe(Parameter.CommanTest.判断直流电阻稳定状态); Thread.Sleep(500); WorkingSets.local.IsStable = false; mi.stateText = "确定" + mi.Winding + "直流电阻稳定成功"; //临时 Thread.Sleep(500); mi.stateText = "读取" + mi.Winding + "直流电阻数据成功"; //临时 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") { mi.stateText = mi.Winding + "直流电阻测试完成:"; mi.completed = true; } else { // mi.failed = true; mi.completed = true; mi.stateText = mi.Winding + "错误类型:" + Recbuffer2[0].ToString(); //临时 } } break; } } else { switch (mi.state) { case 0: byte[] TestKindData = TZ3310.SetPraZldz((Parameter.ZldzWindingKind)mi.WindingConfig, mi.Winding.TozldzStation(), GetParameter.GetPraDCResistanceCurrent(Job), 0); Thread.Sleep(100); TZ3310.StartTest(TestKindData); WorkingSets.local.IsEnablestable = true; mi.stateText = "正在测试" + mi.Winding.TozldzStation() + "直流电阻中..."; mi.state++; Thread.Sleep(4000); break; case 1: string[] Recbuffer = TZ3310.ReadTestData(Parameter.TestKind.直流电阻); 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 + "直流电阻稳定中..."; } 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 = { 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) { mi.Result = MeasurementResult.NewDCResistanceResult(mi, Voltage, Current, Resistance, true); TZ3310.InterRuptMe(Parameter.CommanTest.判断直流电阻稳定状态); WorkingSets.local.IsStable = false; mi.stateText = "确定" + mi.Winding + "直流电阻稳定成功"; Thread.Sleep(500); mi.stateText = "读取" + mi.Winding + "直流电阻数据成功"; mi.completed = true; } } } break; } } }
public static void BushingCapacitance(ref MeasurementItemStruct mi, Transformer transformer, JobList Job) { Parameter.JSstation Jsposition; if (mi.Winding == WindingType.HV) { Jsposition = Parameter.JSstation.高压套管A + (((int)mi.Terimal[0] + 3) % 4); } else { Jsposition = Parameter.JSstation.中压套管A + (((int)mi.Terimal[0] + 3) % 4); } switch (mi.state) { case 0: byte[] TestKindData = TZ3310.SetPraJs(Jsposition, Parameter.JSstyle.内接正接, GetParameter.GetPraCapacitanceVoltage(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.介质损耗); 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; } }
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; } } }