Пример #1
0
        ///<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();
                }
            }
        }