Exemplo n.º 1
0
        void loaddata()
        {
            if (UCDNV863.EDISTNET == UCDNV863.EDistnet.亦庄16)
            {
                #region ----- gis16数据模拟或载入 -----
                //逐项填写运行数据
                //载入潮流
                List <PowerBasicObject> objs = root.distnet.dbdesc["基础数据"].DictSQLS["导线段"].batchLoadRunData(root.distnet, false);
                foreach (var item in objs)
                {
                    DNLineSeg obj = item as DNLineSeg;
                    obj.isInverse           = obj.thisRunData.activePower < 0; //校验方向
                    obj.tooltipMoveTemplate = "PlanningLineTemplate";
                    obj.tooltipMoveContent  = obj.busiRunData;
                }
                //载入变电站
                objs = root.distnet.dbdesc["基础数据"].DictSQLS["变电站"].batchLoadRunData(root.distnet, false);
                foreach (var obj in objs)
                {
                    obj.tooltipMoveTemplate = "PlanningSubstationTemplate";
                    obj.tooltipMoveContent  = obj.busiRunData;
                }
                //载入主变压器
                objs = root.distnet.dbdesc["基础数据"].DictSQLS["主变压器"].batchLoadRunData(root.distnet, false);
                foreach (var obj in objs)
                {
                    obj.tooltipMoveTemplate = "PlanningSubstationTemplate";
                    obj.tooltipMoveContent  = obj.busiRunData;
                }

                #endregion
            }
            else if (UCDNV863.EDISTNET == UCDNV863.EDistnet.亦庄new)
            {
                DataProvider.PlanningRunDataRead(root.distnet, _Global.curInstanceID);

                #region ----- 新亦庄数据模拟或载入 -----
                ////逐项填写运行数据
                ////载入潮流
                //List<PowerBasicObject> objs = root.distnet.dbdesc["基础数据"].DictSQLS["线路"].batchLoadRunData(root.distnet, false);
                //foreach (var item in objs)
                //{
                //    DNACLine obj = item as DNACLine;
                //    obj.isInverse = obj.thisRunData.activePower < 0; //校验方向
                //    obj.tooltipMoveTemplate = "PlanningLineTemplate";
                //    obj.tooltipMoveContent = obj.busiRunData;
                //}
                ////载入变电站
                //objs = root.distnet.dbdesc["基础数据"].DictSQLS["变电站"].batchLoadRunData(root.distnet, false);
                //foreach (var obj in objs)
                //{
                //    obj.tooltipMoveTemplate = "PlanningSubstationTemplate";
                //    obj.tooltipMoveContent = obj.busiRunData;
                //}
                ////载入主变压器
                //objs = root.distnet.dbdesc["基础数据"].DictSQLS["主变2卷"].batchLoadRunData(root.distnet, false);
                //foreach (var obj in objs)
                //{
                //    obj.tooltipMoveTemplate = "PlanningSubstationTemplate";
                //    obj.tooltipMoveContent = obj.busiRunData;
                //}

                #endregion
            }
            else
            {
                #region ------ gis15数据模拟域载入 ------

                //逐项填写运行数据
                //载入潮流
                string    id; PowerBasicObject obj;
                DataTable dt = DataLayer.DataProvider.getDataTableFromSQL("select f_id id,f_mch name,f_begyg yg,f_begwg wg,f_begyg/1000 fzl from MCR_ACFLOW_BRANCH union select f_id id,f_mch name,F_SHDYG yg,F_SHDWG wg,f_fzl fzl from HCR_ACFLOW_BRANCH");
                Dictionary <string, PowerBasicObject> objs;
                if (root.earth.objManager.zLayers.ContainsKey(EObjectCategory.导线类.ToString()))
                {
                    //objs = root.earth.objManager.zLayers[EObjectCategory.导线类.ToString()].pModels;
                    objs = root.distnet.getAllObjDictByCategory(EObjectCategory.导线类);
                    foreach (DataRow dr in dt.Rows)
                    {
                        id = dr["id"].ToString();
                        if (objs.TryGetValue(id, out obj))
                        {
                            if (obj.busiRunData == null)
                            {
                                obj.createRunData();
                            }
                            RunDataACLineBase rdata = obj.busiRunData as RunDataACLineBase;
                            //rdata.rateOfLoad = dr.getDouble("fzl");
                            rdata.activePower             = dr.getDouble("yg");
                            rdata.reactivePower           = dr.getDouble("wg");
                            (obj as pPowerLine).isInverse = rdata.activePower < 0; //校验方向

                            obj.tooltipMoveTemplate = "PlanningLineTemplate";
                            obj.tooltipMoveContent  = obj.busiRunData;
                        }
                    }
                }

                //载入变电站
                dt   = DataLayer.DataProvider.getDataTableFromSQL("select f_id id, f_mch name,f_ygfh yg,f_wgfh wg, f_fzl fzl, f_cos fcos, null ryd from MCR_ACFLOW_SS union select f_id id,F_MCH name, F_YGFH yg, F_WGFH wg,f_fzl fzl,f_cos fcos,f_ryd ryd from HCR_ACFLOW_SSLR");
                objs = root.earth.objManager.zLayers[EObjectCategory.变电设施类.ToString()].pModels; // root.earth.objManager.getAllObjDictBelongtoCategory("变电站");
                foreach (DataRow dr in dt.Rows)
                {
                    id = dr["id"].ToString();
                    if (objs.TryGetValue(id, out obj))
                    {
                        if (obj.busiRunData == null)
                        {
                            obj.createRunData();
                        }
                        RunDataSubstation rdata = obj.busiRunData as RunDataSubstation;
                        rdata.activePower   = dr.getDouble("yg");
                        rdata.reactivePower = dr.getDouble("wg");
                        //rdata.rateOfLoad = dr.getDouble("fzl") / 100;
                        //rdata.powerFactor = dr.getDouble("fcos");
                        rdata.redundancy = dr.getDouble("ryd");
                        rdata.HVL        = 90 + rd.Next(40); //zh 注模拟
                        //rdata.HVoltPUV = rdata.HVL / 110;

                        obj.tooltipMoveTemplate = "PlanningSubstationTemplate";
                        obj.tooltipMoveContent  = obj.busiRunData;
                    }
                }
                //zh注,强制模拟配电室
                foreach (var item in root.distnet.getAllObjListByObjType(EObjectType.配电室))
                {
                    if (item.busiRunData == null)
                    {
                        item.createRunData();
                    }
                    RunDataTransformFacilityBase rdata = item.busiRunData as RunDataTransformFacilityBase;
                    //rdata.rateOfLoad = (30.0 + rd.Next(60)) / 100;
                    rdata.HVL = 8 + rd.Next(4);
                    //rdata.HVoltPUV = rdata.HVL / 10;
                }

                //载入变压器
                string sql = @"
                select f_id id, f_mch name, f_fh yg,f_wgfh wg,f_fzl fzl,f_glysh fcos,f_gycyxdy hvl,f_zsh allloss,f_shzgl ap,f_tgs closs,f_ts iloss,f_bs tloss,f_bsl tlr from HCR_ACFLOW_MTTV
                union 
                select f_id id, f_mch name, f_fh yg,f_wgfh wg,f_fzl fzl,f_glysh fcos,f_gycyxdy hvl,f_zsh allloss,f_shzgl ap,f_tgs closs,f_ts iloss,f_bs tloss,f_bsl tlr from HCR_ACFLOW_MTTHV
                union 
                select f_id id, f_mch name, f_ygfh yg,f_wgfh wg,f_fzl fzl,f_cos fcos,0 hvl,f_zws allloss,sqrt(f_ygfh*f_ygfh+f_wgfh*f_wgfh) ap,f_pbcus closs,f_pbfes iloss,f_pbsh tloss,f_pbsl tlr from MCR_ACFLOW_MT
                ";
                dt = DataLayer.DataProvider.getDataTableFromSQL(sql);
                if (root.earth.objManager.zLayers.ContainsKey(EObjectCategory.变压器类.ToString()))
                {
                    objs = root.earth.objManager.zLayers[EObjectCategory.变压器类.ToString()].pModels;// root.earth.objManager.getAllObjDictBelongtoCategory("变压器");
                    foreach (DataRow dr in dt.Rows)
                    {
                        id = dr["id"].ToString();
                        if (objs.TryGetValue(id, out obj))
                        {
                            RunDataTransformerBase rundata = new RunDataTransformerBase(obj)
                            {
                                activePower   = double.Parse(dr["yg"].ToString()),
                                reactivePower = double.Parse(dr["wg"].ToString()),
                                //rateOfLoad = double.Parse(dr["fzl"].ToString()) / 100,
                                //powerFactor = double.Parse(dr["fcos"].ToString()),
                                HVL     = double.Parse(dr["hvl"].ToString()),
                                allLoss = double.Parse(dr["allloss"].ToString()),
                                //apparentPower = double.Parse(dr["ap"].ToString()),
                                copperLoss        = double.Parse(dr["closs"].ToString()),
                                ironLoss          = double.Parse(dr["iloss"].ToString()),
                                transformLoss     = double.Parse(dr["tloss"].ToString()),
                                transformLossRate = double.Parse(dr["tlr"].ToString()),
                            };

                            obj.busiRunData         = rundata;
                            obj.tooltipMoveTemplate = "PlanningTransformerTemplate";
                            obj.tooltipMoveContent  = obj.busiRunData;
                        }
                    }
                }


                //======= 载入节点数据
                dt = DataLayer.DataProvider.getDataTableFromSQL("select * from MCR_ACFLOW_node");
                //objs = root.earth.objManager.getAllObjDictBelongtoCategory("节点");
                objs = root.distnet.getAllObjDictByObjType(EObjectType.节点);
                foreach (DataRow dr in dt.Rows)
                {
                    id = dr["f_id"].ToString();
                    if (objs.TryGetValue(id, out obj))
                    {
                        RunDataNode rundata = new RunDataNode(obj)
                        {
                            activePower   = dr.getDouble("f_yg"),
                            reactivePower = dr.getDouble("f_wg"),
                            volt          = dr.getDouble("f_dy"),
                            //voltPUV = dr.getDouble("f_dy_by"),
                        };
                        obj.busiRunData = rundata;
                    }
                }



                ////载入3卷变压器
                //dt = DataLayer.DataProvider.getDataTableFromSQL("select * from HCR_ACFLOW_MTTHV");
                //objs = root.earth.objManager.getAllObjDictBelongtoCategory("3卷变压器");
                //foreach (DataRow dr in dt.Rows)
                //{
                //    id = dr["f_id"].ToString();
                //    if (objs.TryGetValue(id, out obj))
                //    {
                //        RunDataTransformer3P rundata = new RunDataTransformer3P()
                //        {
                //            name = dr["F_MCH"].ToString(),
                //            activePower = double.Parse(dr["F_FH"].ToString()),
                //            reactivePower = double.Parse(dr["F_WGFH"].ToString()),
                //            rateOfLoad = double.Parse(dr["F_FZL"].ToString()) / 100,
                //            powerFactor = double.Parse(dr["F_GLYSH"].ToString()),
                //            HVL = double.Parse(dr["F_gycyxdy"].ToString()),
                //            allLoss = double.Parse(dr["F_zsh"].ToString()),
                //            apparentPower = double.Parse(dr["F_shzgl"].ToString()),
                //            copperLoss = double.Parse(dr["F_tgs"].ToString()),
                //            ironLoss = double.Parse(dr["F_ts"].ToString()),
                //            transformLoss = double.Parse(dr["F_bs"].ToString()),
                //            transformLossRate = double.Parse(dr["F_bsl"].ToString()),
                //        };

                //        obj.busiRunData = rundata;
                //        obj.tooltipMoveTemplate = "PlanningTransformer3Template";
                //        obj.tooltipMoveContent = obj.busiRunData;
                //    }
                //}

                #endregion
            }
        }
Exemplo n.º 2
0
        ///<summary>产生变电数据</summary>
        static void gentranform(DistNet dn)
        {
            foreach (DNTransformFacilityBase item in dn.getAllObjListByCategory(EObjectCategory.变电设施类))
            {
                RunDataTransformFacilityBase rundata = item.busiRunData as RunDataTransformFacilityBase;
                AcntTransformFacilityBase    acnt    = item.busiAccount as AcntTransformFacilityBase;
                rundata.activePower = acnt.cap * (0.4 + 0.5 * rd.NextDouble());
                //rundata.powerFactor = 0.8 + 0.2 * rd.NextDouble();
                //rundata.apparentPower = rundata.activePower / rundata.powerFactor;
                rundata.reactivePower = Math.Sqrt(Math.Pow(rundata.apparentPower, 2) - Math.Pow(rundata.activePower, 2));
                //rundata.rateOfLoad = rundata.apparentPower / acnt.cap;
                //rundata.HVoltPUV = 0.85 + 0.3 * rd.NextDouble();
                rundata.HVL = acnt.hnvl * rundata.HVoltPUV;

                if (rundata.lstApparentPower.Count == 0) //初始模拟50条
                {
                    for (int i = 50; i > 0; i--)
                    {
                        rundata.lstApparentPower.Add(new MyClassLibrary.DevShare.ChartDataPoint()
                        {
                            argudate = DateTime.Now.AddMinutes(i), value = acnt.cap * (0.4 + 0.5 * rd.NextDouble())
                        });
                    }
                }
                //rundata.addApparentPower(rundata.apparentPower);
                rundata.refresh();
            }

            foreach (DNTransformerBase item in dn.getAllObjListByCategory(EObjectCategory.变压器类))
            {
                RunDataTransformerBase rundata = item.busiRunData as RunDataTransformerBase;
                AcntTransformBase      acnt    = item.busiAccount as AcntTransformBase;
                rundata.activePower = acnt.cap * (0.4 + 0.5 * rd.NextDouble());
                //rundata.powerFactor = 0.8 + 0.2 * rd.NextDouble();
                //rundata.apparentPower = rundata.activePower / rundata.powerFactor;
                rundata.reactivePower = Math.Sqrt(Math.Pow(rundata.apparentPower, 2) - Math.Pow(rundata.activePower, 2));
                //rundata.rateOfLoad = rundata.apparentPower / acnt.cap;
                //rundata.HVoltPUV = 0.85 + 0.3 * rd.NextDouble();
                rundata.HVL = acnt.hnvl * rundata.HVoltPUV;

                if (rundata.lstApparentPower.Count == 0) //初始模拟50条
                {
                    for (int i = 50; i > 0; i--)
                    {
                        rundata.lstApparentPower.Add(new MyClassLibrary.DevShare.ChartDataPoint()
                        {
                            argudate = DateTime.Now.AddMinutes(i), value = acnt.cap * (0.4 + 0.5 * rd.NextDouble())
                        });
                    }
                }
                //rundata.addApparentPower(rundata.apparentPower);
                rundata.refresh();
            }

            foreach (var item in dn.getAllObjListByObjType(EObjectType.节点))
            {
                RunDataNode rundata = item.busiRunData as RunDataNode;
                rundata.vl = 110;
                //rundata.voltPUV = 0.9 + 0.2 * rd.NextDouble();
                rundata.volt = rundata.voltPUV * rundata.vl;
            }
        }
Exemplo n.º 3
0
        public void readData()
        {
            //配网生产
            curLoad = (int)(500 + rd.Next(1000));
            RaisePropertyChanged(() => curLoad);
            dayElectricity += (int)rd.Next(20);
            RaisePropertyChanged(() => dayElectricity);
            loadrates.Clear(); //负载率

            List <MyClassLibrary.DevShare.VListItem> lst = new List <MyClassLibrary.DevShare.VListItem>();

            foreach (var item in root.distnet.getAllObjListByCategory(EObjectCategory.变压器类).OrderByDescending(p => (p.busiRunData as RunDataTransformerBase).rateOfLoad).Take(10))
            {
                RunDataTransformerBase            rundata = item.busiRunData as RunDataTransformerBase;
                MyClassLibrary.DevShare.VListItem vi      = new MyClassLibrary.DevShare.VListItem()
                {
                    id = item.id, name = item.name, value = rundata.rateOfLoad, format = "{0:p0}", brush = rundata.rateOfLoadBrush,
                };
                lst.Add(vi);
            }
            foreach (var item in root.distnet.getAllObjListByObjType(EObjectType.输电线路).OrderByDescending(p => (p.busiRunData as RunDataACLine).rateOfLoad).Take(10))
            {
                RunDataACLine rundata = item.busiRunData as RunDataACLine;
                MyClassLibrary.DevShare.VListItem vi = new MyClassLibrary.DevShare.VListItem()
                {
                    id = item.id, name = item.name, value = rundata.rateOfLoad, format = "{0:p0}", brush = rundata.rateOfLoadBrush
                };
                lst.Add(vi);
            }
            foreach (var item in lst.OrderByDescending(p => p.value))
            {
                loadrates.Add(item);
            }
            RaisePropertyChanged(() => loadrates);

            volts.Clear();
            foreach (var item in root.distnet.getAllObjListByObjType(EObjectType.节点).OrderByDescending(p => Math.Abs((p.busiRunData as RunDataNode).voltPUV - 1)).Take(10))
            {
                RunDataNode rundata = item.busiRunData as RunDataNode;
                MyClassLibrary.DevShare.VListItem vi = new MyClassLibrary.DevShare.VListItem()
                {
                    id = item.id, name = item.name, value = rundata.voltPUV, format = "{0:f2}", brush = rundata.voltPUVBrush
                };
                vi.value2 = 1 + 2 * (vi.value - 1);
                volts.Add(vi);
            }
            RaisePropertyChanged(() => volts);

            //清洁能源
            greenPower = 0;
            greenpowers.Clear();
            foreach (var item in root.distnet.getAllObjListByCategory(EObjectCategory.电厂设施类))
            {
                RunDataPlantBase rundata = item.busiRunData as RunDataPlantBase;
                greenPower += rundata.power;
                MyClassLibrary.DevShare.VListItem vi = new MyClassLibrary.DevShare.VListItem()
                {
                    id = item.id, name = item.name, value = rundata.rateOfLoad, format = "{0:p0}", brush = rundata.rateOfLoadBrush
                };
                greenpowers.Add(vi);
            }
            greenPower = ((int)(greenPower * 10)) / 10;
            RaisePropertyChanged(() => greenPower);
            RaisePropertyChanged(() => greenpowers);
            greenscales.Clear();
            greenscales.Add(new MyClassLibrary.DevShare.ChartDataPoint()
            {
                argu = "清洁能源", value = greenPower / curLoad
            });
            greenscales.Add(new MyClassLibrary.DevShare.ChartDataPoint()
            {
                argu = " ", value = (curLoad - greenPower) / curLoad
            });
            RaisePropertyChanged(() => greenscales);


            //电动汽车
            carLoad = (int)(40 + rd.Next(80));
            RaisePropertyChanged(() => carLoad);
            //大客户
            customLoad = (int)(200 + rd.Next(300));
            RaisePropertyChanged(() => customLoad);
            //停电
            cutLoad = (int)(10 + rd.Next(20));
            RaisePropertyChanged(() => cutLoad);
            //事件
            lstEvent = DataGenerator.events;
            RaisePropertyChanged(() => lstEvent);
        }