///<summary>初始化运行数据类</summary> public static void initRunData(DistNet dn, bool isForce = false) { if (!isRunDataInit || isForce) { //变电设施类 foreach (DNTransformFacilityBase item in dn.getAllObjListByCategory(EObjectCategory.变电设施类)) { item.createRunData(); item.tooltipMoveTemplate = "RunDataSubsationTemplate"; item.tooltipMoveContent = item.busiRunData; } //变压器类 foreach (DNTransformerBase item in dn.getAllObjListByCategory(EObjectCategory.变压器类)) { item.createRunData(); item.tooltipMoveTemplate = "RunDataTransformerTemplate"; item.tooltipMoveContent = item.busiRunData; } //导线类 foreach (DNACLineBase item in dn.getAllObjListByCategory(EObjectCategory.导线类)) { item.createRunData(); if (item is DNACLine) //仅输电线路tooltip { item.tooltipMoveTemplate = "RunDataACLineTemplate"; item.tooltipMoveContent = item.busiRunData; } } //开关类 foreach (PowerBasicObject item in dn.getAllObjListByCategory(EObjectCategory.开关类)) { item.createRunData(); } //节点 foreach (DNNode item in dn.getAllObjListByObjType(EObjectType.节点)) { item.createRunData(); } //电厂 foreach (DNPlantBase item in dn.getAllObjListByCategory(EObjectCategory.电厂设施类)) { item.createRunData(); } } tmr.Tag = dn; isRunDataInit = true; }
///<summary>产生线路数据</summary> static void genline(DistNet dn) { foreach (DNACLineBase item in dn.getAllObjListByObjType(EObjectType.输电线路)) { RunDataACLineBase rundata = item.busiRunData as RunDataACLineBase; AcntACLineBase acnt = item.busiAccount as AcntACLineBase; if (acnt.cap == 0) { acnt.cap = rd.Next(50); } 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; if (rd.NextDouble() < 0.01) { if (events.Count > 50) { events.Remove(events.Last()); } events.Insert(0, new EventData() { eObjID = item.id, startTime = DateTime.Now, eType = (EventData.EEventType)rd.Next(2), eTitle = item.name + "事件.", eContent = DateTime.Now.ToShortDateString() + item.name + "事件描述......" }); } if (item is DNACLine) { 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(); } } }
///<summary>初始化规划模拟运行数据类并设置相应tooltipmove模板</summary> static void initPlanningRunData(DistNet dn) { //变电设施类 foreach (DNTransformFacilityBase item in dn.getAllObjListByCategory(EObjectCategory.变电设施类)) { item.createRunData(); item.tooltipMoveTemplate = "PlanningSubstationTemplate"; item.tooltipMoveContent = item.busiRunData; } //变压器类 foreach (DNTransformerBase item in dn.getAllObjListByCategory(EObjectCategory.变压器类)) { item.createRunData(); item.tooltipMoveTemplate = "PlanningSubstationTemplate"; item.tooltipMoveContent = item.busiRunData; } //导线类 foreach (DNACLineBase item in dn.getAllObjListByCategory(EObjectCategory.导线类)) { item.createRunData(); if (item is DNACLine) //仅输电线路tooltip { item.tooltipMoveTemplate = "PlanningLineTemplate"; item.tooltipMoveContent = item.busiRunData; } } //开关类 foreach (PowerBasicObject item in dn.getAllObjListByCategory(EObjectCategory.开关类)) { item.createRunData(); } //节点 foreach (DNNode item in dn.getAllObjListByObjType(EObjectType.节点)) { item.createRunData(); } //电厂 foreach (DNPlantBase item in dn.getAllObjListByCategory(EObjectCategory.电厂设施类)) { item.createRunData(); } }
///<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; } }