Beispiel #1
0
        public static TestingWorkerSender FromDatabaseRows(int testID)
        {
            TestingWorkerSender sender = new TestingWorkerSender();
            var rows = WorkingSets.local.TestResults.Select("testid = '" + testID.ToString() + "'");

            if (rows.Length > 0)
            {
                sender.Transformer = WorkingSets.local.getTransformer((int)rows[0]["transformerid"]);
                sender.job         = WorkingSets.local.getJob((int)rows[0]["mj_id"]);
                List <MeasurementItemStruct> mlist = new List <MeasurementItemStruct>();
                MeasurementItemStruct        m;
                foreach (var row in rows)
                {
                    m = new MeasurementItemStruct((MeasurementFunction)((int)row["function"]))
                    {
                        Winding = new WindingType((int)row["windingtype"]),
                        Terimal = WindingTerimal.FromList((List <int>)
                                                              (new SCEEC.Converter.GenericListTypeConverter <int>().ConvertFrom((string)row["terimal"]))),
                        WindingConfig = (TransformerWindingConfigName)(int)row["windingconfig"],
                        TapLabel      = ((string)row["taplabel"]).Split(';'),
                        Text          = (string)row["text"],
                        failed        = (bool)row["failed"],
                        completed     = (bool)row["completed"]
                    };
                    List <SCEEC.Numerics.PhysicalVariable> pvList = new List <Numerics.PhysicalVariable>();
                    for (int i = 0; i < 9; i++)
                    {
                        string pvstr = (string)row["result_pv" + (i + 1).ToString()];
                        if (pvstr.Length > 0)
                        {
                            pvList.Add(SCEEC.Numerics.NumericsConverter.Text2Value(pvstr));
                        }
                        else
                        {
                            i = 9;
                        }
                    }
                    m.Result = new MeasurementResult(
                        m.Function,
                        pvList.ToArray(),
                        MeasurementItemStruct.Bytes2Shorts(Convert.FromBase64String((string)row["waves"])),
                        readyToTrigger: false, processing: false);
                    mlist.Add(m);
                }
                sender.MeasurementItems = mlist.ToArray();
            }
            return(sender);
        }
Beispiel #2
0
        public static MeasurementItemStruct CreateDCResistanceMeasurementItem(WindingType winding, WindingTerimal terimal1, WindingTerimal terimal2)
        {
            MeasurementItemStruct mi = new MeasurementItemStruct(MeasurementFunction.DCResistance);

            mi.Winding = winding;
            mi.Terimal = new WindingTerimal[2] {
                terimal1, terimal2
            };
            return(mi);
        }
Beispiel #3
0
        public static MeasurementItemStruct CreateBushingCapacitanceMeasurementItem(WindingType winding, WindingTerimal terimal)
        {
            MeasurementItemStruct mi = new MeasurementItemStruct(MeasurementFunction.BushingCapacitance);

            mi.Winding = winding;
            mi.Terimal = new WindingTerimal[] { terimal };
            return(mi);
        }
Beispiel #4
0
        public static MeasurementItemStruct CreateBushingDCInsulationMeasurementItem(WindingType winding, WindingTerimal terimal)
        {
            MeasurementItemStruct mi = new MeasurementItemStruct(MeasurementFunction.BushingDCInsulation);

            mi.Winding = winding;
            mi.Terimal = new WindingTerimal[1] {
                terimal
            };
            return(mi);
        }
Beispiel #5
0
        public static MeasurementItemStruct CreateDCResistanceMeasurementItem(WindingType winding, WindingTerimal terimal1, WindingTerimal terimal2, string ChangerLabel)
        {
            MeasurementItemStruct mi = new MeasurementItemStruct(MeasurementFunction.DCResistance);

            mi.Winding = winding;
            mi.Terimal = new WindingTerimal[2] {
                terimal1, terimal2
            };
            mi.TapLabel = new string[1] {
                ChangerLabel
            };;
            return(mi);
        }
Beispiel #6
0
        //JobList2MeasurementItems  //getJobListMeasurementItems
        public static List <MeasurementItemStruct> JobList2MeasurementItems(JobList jobList)
        {
            List <MeasurementItemStruct> miList = new List <MeasurementItemStruct>();
            //miList.Add(MeasurementItemStruct.CreateInformation("添加使用用户信息模块"));//问题

            int TapNum      = (jobList.Transformer.OLTC.TapNum - 1) / 2;
            int mulTapNum   = (jobList.Transformer.OLTC.MulTapNum - 1) / 2;
            int TapLocation = mulTapNum + 1;
            int TapMainNum  = jobList.Transformer.OLTC.TapMainNum;



            if (jobList.OLTC.Enabled)
            {
                int lowest  = TapLocation - jobList.OLTC.MulRange;
                int highest = TapLocation + jobList.OLTC.Range;
                if (jobList.OLTC.SwitchingCharacter)
                {
                    miList.Add(MeasurementItemStruct.CreateText("将变压器有载分接开关位置切换到额定(分接" + lowest + ")位置;", lowest.ToString()));
                    for (int i = lowest; i < highest; i++)
                    {
                        getStartAndEndMessage(i, TapLocation, TapMainNum, jobList, miList);
                        if (i != TapLocation && i != TapLocation - 1 || TapMainNum <= 1)
                        {
                            if (jobList.Transformer.OLTC.WindingPosition == WindingType.HV)
                            {
                                miList.Add(MeasurementItemStruct.CreateOLTCSwitchingCharacterMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString(), (i + 1).ToString(), jobList.Transformer.WindingConfig.HV));
                            }
                            if (jobList.Transformer.OLTC.WindingPosition == WindingType.MV)
                            {
                                miList.Add(MeasurementItemStruct.CreateOLTCSwitchingCharacterMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString(), (i + 1).ToString(), jobList.Transformer.WindingConfig.MV));
                            }
                        }
                    }
                    for (int i = highest; i > lowest; i--)
                    {
                        getStartAndEndMessageReserver(i, TapLocation, TapMainNum, jobList, miList);
                        if (i != TapLocation && i != TapLocation + 1 || TapMainNum <= 1)
                        {
                            if (jobList.Transformer.OLTC.WindingPosition == WindingType.HV)
                            {
                                miList.Add(MeasurementItemStruct.CreateOLTCSwitchingCharacterMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString(), (i - 1).ToString(), jobList.Transformer.WindingConfig.HV));
                            }
                            if (jobList.Transformer.OLTC.WindingPosition == WindingType.MV)
                            {
                                miList.Add(MeasurementItemStruct.CreateOLTCSwitchingCharacterMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString(), (i - 1).ToString(), jobList.Transformer.WindingConfig.MV));
                            }
                        }
                    }
                }
                if (jobList.OLTC.DCResistance)
                {
                    miList.Add(MeasurementItemStruct.CreateText("分接位置直流电阻试验,请确认有载分接开关在(分接" + lowest + ")位置;", lowest.ToString()));
                    if (!OltcLocationIsDorYn(jobList))
                    {
                        for (int i = lowest; i <= highest; i++)
                        {
                            if (TapMainNum > 1 && i == TapLocation)
                            {
                                for (int j = 0; j < TapMainNum; j++)
                                {
                                    miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString() + ((char)('A' + j)).ToString()));
                                }
                            }
                            else
                            {
                                miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(jobList.Transformer.OLTC.WindingPosition, i.ToString()));
                            }
                        }
                    }
                    else
                    {
                        for (int p = 0; p < 3; p++)
                        {
                            for (int i = lowest; i <= highest; i++)
                            {
                                WindingTerimal firstTerminal  = WindingTerimal.A;
                                WindingTerimal SecondTerminal = WindingTerimal.B;
                                if (p == 0)
                                {
                                    firstTerminal  = WindingTerimal.A;
                                    SecondTerminal = WindingTerimal.B;
                                }
                                else if (p == 1)
                                {
                                    firstTerminal  = WindingTerimal.B;
                                    SecondTerminal = WindingTerimal.C;
                                }
                                else
                                {
                                    firstTerminal  = WindingTerimal.C;
                                    SecondTerminal = WindingTerimal.A;
                                }

                                if (TapMainNum > 1 && i == TapLocation)
                                {
                                    for (int j = 0; j < TapMainNum; j++)
                                    {
                                        miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(jobList.Transformer.OLTC.WindingPosition, firstTerminal, SecondTerminal, i.ToString() + ((char)('A' + j)).ToString()));
                                    }
                                }
                                else
                                {
                                    miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(jobList.Transformer.OLTC.WindingPosition, firstTerminal, SecondTerminal, i.ToString()));
                                }
                            }
                        }
                    }
                }
            }
            if (jobList.DCResistance.Enabled)
            {
                //miList.Add(MeasurementItemStruct.CreateText("使用直流电阻试验模块:"));
                if ((jobList.DCResistance.HVEnabled) && (!((jobList.OLTC.Enabled) && (jobList.Transformer.OLTC.WindingPosition == WindingType.HV) && (jobList.OLTC.DCResistance))))
                {
                    if ((jobList.Transformer.PhaseNum == 3))
                    {
                        if (jobList.Transformer.WindingConfig.HV == TransformerWindingConfigName.Yn)
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.HV));
                        }
                        else
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.HV, WindingTerimal.A, WindingTerimal.B));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.HV, WindingTerimal.B, WindingTerimal.C));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.HV, WindingTerimal.C, WindingTerimal.A));
                        }
                    }
                    else
                    {
                        miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.HV, WindingTerimal.A, WindingTerimal.O));
                    }
                }
                if ((jobList.DCResistance.MVEnabled) && (!((jobList.OLTC.Enabled) && (jobList.Transformer.OLTC.WindingPosition == WindingType.MV) && (jobList.OLTC.DCResistance))))
                {
                    if ((jobList.Transformer.PhaseNum == 3))
                    {
                        if (jobList.Transformer.WindingConfig.MV == TransformerWindingConfigName.Yn)
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.MV));
                        }
                        else
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.MV, WindingTerimal.A, WindingTerimal.B));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.MV, WindingTerimal.B, WindingTerimal.C));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.MV, WindingTerimal.C, WindingTerimal.A));
                        }
                    }
                    else
                    {
                        miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.MV, WindingTerimal.A, WindingTerimal.O));
                    }
                }
                if (jobList.DCResistance.LVEnabled)
                {
                    if ((jobList.Transformer.PhaseNum == 3))
                    {
                        if (jobList.Transformer.WindingConfig.LV == TransformerWindingConfigName.Yn)
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.LV));
                        }
                        else
                        {
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.LV, WindingTerimal.A, WindingTerimal.B));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.LV, WindingTerimal.B, WindingTerimal.C));
                            miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.LV, WindingTerimal.C, WindingTerimal.A));
                        }
                    }
                    else
                    {
                        miList.Add(MeasurementItemStruct.CreateDCResistanceMeasurementItem(WindingType.LV, WindingTerimal.A, WindingTerimal.O));
                    }
                }
            }


            if (jobList.DCInsulation.Enabled || jobList.Bushing.DCInsulation)
            {
                miList.Add(MeasurementItemStruct.CreateText("使用绝缘电阻试验模块:"));
                if (jobList.DCInsulation.HVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateDCInsulationMeasurementItem(WindingType.HV));
                }
                if ((jobList.Bushing.DCInsulation) && (jobList.Transformer.Bushing.HVContained))
                {
                    if (jobList.Transformer.WindingConfig.HV == TransformerWindingConfigName.Yn)
                    {
                        miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.HV, WindingTerimal.O));
                    }
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.HV, WindingTerimal.A));
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.HV, WindingTerimal.B));
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.HV, WindingTerimal.C));
                }
                if (jobList.DCInsulation.MVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateDCInsulationMeasurementItem(WindingType.MV));
                }
                if ((jobList.Bushing.DCInsulation) && (jobList.Transformer.Bushing.MVContained))
                {
                    if (jobList.Transformer.WindingConfig.MV == TransformerWindingConfigName.Yn)
                    {
                        miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.MV, WindingTerimal.O));
                    }
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.MV, WindingTerimal.A));
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.MV, WindingTerimal.B));
                    miList.Add(MeasurementItemStruct.CreateBushingDCInsulationMeasurementItem(WindingType.MV, WindingTerimal.C));
                }
                if (jobList.DCInsulation.LVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateDCInsulationMeasurementItem(WindingType.LV));
                }
            }

            if (jobList.Capacitance.Enabled || jobList.Bushing.Capacitance)
            {
                miList.Add(MeasurementItemStruct.CreateText("使用电容量及介质损耗试验模块:"));
                if (jobList.Capacitance.HVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateCapacitanceMeasurementItem(WindingType.HV));
                }
                if ((jobList.Bushing.Capacitance) && (jobList.Transformer.Bushing.HVContained))
                {
                    if (jobList.Transformer.WindingConfig.HV == TransformerWindingConfigName.Yn)
                    {
                        miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.HV, WindingTerimal.O));
                    }
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.HV, WindingTerimal.A));
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.HV, WindingTerimal.B));
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.HV, WindingTerimal.C));
                }
                if (jobList.Capacitance.MVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateCapacitanceMeasurementItem(WindingType.MV));
                }
                if ((jobList.Bushing.Capacitance) && (jobList.Transformer.Bushing.MVContained))
                {
                    if (jobList.Transformer.WindingConfig.MV == TransformerWindingConfigName.Yn)
                    {
                        miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.MV, WindingTerimal.O));
                    }
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.MV, WindingTerimal.A));
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.MV, WindingTerimal.B));
                    miList.Add(MeasurementItemStruct.CreateBushingCapacitanceMeasurementItem(WindingType.MV, WindingTerimal.C));
                }
                if (jobList.Capacitance.LVEnabled)
                {
                    miList.Add(MeasurementItemStruct.CreateCapacitanceMeasurementItem(WindingType.LV));
                }
            }


            if (jobList.LossDcresistance)
            {
                miList.Add(MeasurementItemStruct.CreateOtherMeasurementItem(1));
            }
            if (jobList.Shortcircuitimpedance)
            {
                miList.Add(MeasurementItemStruct.CreateOtherMeasurementItem(3));
            }
            if (jobList.CoreDCInsulation)
            {
                miList.Add(MeasurementItemStruct.CreateOtherMeasurementItem(0));
            }
            return(miList);
        }