public void DealPacket_AppTraQos(object pack) { if (this.state.isSceneSetUp == false)//因为确定是主线程才会调用此函数所以不用锁 { return; } //this.RdXml.packetNum2[7]++; //for test RD_QosPerfomance rd = (RD_QosPerfomance)pack; Chart chart; int index = this.chartView.m_chartParam.mIx_TraQos.FindIndex(str => str == rd.TrafficName_SD); int bit2Ratio = 1000; //bit单位转换的比率 //kb/s if (index == -1) //未添加过该条业务流,新建chart { TreeNode node = new TreeNode(rd.TrafficName_SD); int index2 = this.chartView.AddNodeOn2(node, "业务流Qos性能"); if (index2 == -1) //node添加失败 { return; } chart = ChartParam.CreateChart(this.chartView.m_chartTemplate, 4, 4); chart.Name = "chart" + (this.chartView.m_chartParam.chartCount++).ToString(); //所有chart名称不一样 chart.Series[0].Name = "发送量(kb/s)"; //如果修改转换比率要修改上面的bit2Ratio chart.Series[1].Name = "接收量(kb/s)"; chart.Series[2].Name = "时延(ms)"; //"时延(ms)";//20150928修改 chart.Series[3].Name = "时延抖动(ms)"; //"时延抖动(ms)"; this.chartView.Controls.Add(chart); this.chartView.m_chartParam.mIx_TraQos.Add(rd.TrafficName_SD); this.chartView.m_chartParam.mCs_TraQos.Add(chart); TreeNodeTag nodeTag = new TreeNodeTag(2, chart, index2);//index2为添加的节点在其父节点的子节点的索引 node.Tag = nodeTag; } else { chart = this.chartView.m_chartParam.mCs_TraQos[index]; } chart.Series[0].Points.AddXY(rd.simTime, rd.AppTrafficSend / bit2Ratio); chart.Series[1].Points.AddXY(rd.simTime, rd.AppTrafficRcvd / bit2Ratio); if (rd.DelayTime != -1) { chart.Series[2].Points.AddXY(rd.simTime, rd.DelayTime * 1000); //单位ms 20150928修改 } if (rd.DelayVar != -1) { chart.Series[3].Points.AddXY(rd.simTime, rd.DelayVar * 1000); //单位ms 20150928修改 } }
public override void FdAmb_InteractionReceivedHandler(object sender, RACoN.RTILayer.CHlaInteractionEventArgs data) { // Call the base class handler base.FdAmb_InteractionReceivedHandler(sender, data); if (this.simManager.view.state.workMode != CState.WorkMode.SimMode) //不是仿真模式,注意这里用"!="以便扩展工作模式 { return; } if (data.InteractionClassHandle == this.Som.StartOpnetIC.ClassHandle)//处理开始仿真这个特殊的包(一次仿真只有一个),目前是处理完成后立即return { if (data.GetParameterValue <int>(this.Som.StartOpnetIC.qualnet_ready) == 1) { if (this.simManager.view.root.CurrentScenario == null) { MessageBox.Show("场景未建立好不能仿真"); return; } //AGI.STKUtil.AgExecCmdResult stkresult; //stkresult = (AGI.STKUtil.AgExecCmdResult)this.simManager.view.root.ExecuteCommand("AllInstanceNames /"); //if (stkresult.Count == 0) //{ // MessageBox.Show("未正确建立STK场景"); // return; //} simManager.view.RdXml.sw.Stop(); RePlayData rpd2 = new RePlayData("StartOpnetIC", simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_Op rd2 = new RD_Op(); //处理方法 this.simManager.view.DealPacket("StartOpnetIC", rd2); rpd2.packet = rd2; this.simManager.view.RdXml.allPackets.Add(rpd2); try { file32.CloseMainWindow(); file32.Close(); file32 = null; } catch { } } return; } if (this.simManager.view.state.isSceneSetUp == true) //场景已建立起来才能处理的包 { #region InteractionPackets //待修改 if (data.InteractionClassHandle == this.Som.OpSimTimeIC.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); //暂停时钟运行以记录从开始仿真到当前时刻,windows系统过了多长时间,用于写到回放数据XML中的time属性 RePlayData rpd = new RePlayData("OpSimTime", this.simManager.view.RdXml.sw.ElapsedMilliseconds); //"OpSimTime"表明这种包的类型 this.simManager.view.RdXml.sw.Start(); //恢复时钟运行 RD_SimTime rd = new RD_SimTime(); //只要需要保存到xml,都这样处理,处理什么类型的交互类这里就新建什么类型的class,这个class将定义在ReplayData.cs中,其功能主要是保存交互类的各参数值到xml中 //获取需要获取的交互类参数值,可以不读取不需要的值 rd.simeTime = data.GetParameterValue <double>(this.Som.OpSimTimeIC.SimTime); this.simManager.view.DealPacket_OpSimTime(rd); //调用处理这种包的函数去完成刷新控件显示的功能,有时代码较短可以直接进行刷新但推荐统一用处理函数的方式 rpd.packet = rd; //所有的处理包都封装到一个外层类RePlayData中,方便统一写入xml this.simManager.view.RdXml.allPackets.Add(rpd); //添加到集合中,在收到finish包时遍历集合并写入xml } // //处理固定节点的交互类 else if (data.InteractionClassHandle == this.Som.StkXGYHCoordinate.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("XGYHCoordinate", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_XGY rd = new RD_XGY(); rd.XGYHName = data.GetParameterValue <string>(this.Som.StkXGYHCoordinate.XGYHName); rd.XGYHLatitude = data.GetParameterValue <string>(this.Som.StkXGYHCoordinate.XGYHLatitude); rd.XGYHLongitude = data.GetParameterValue <string>(this.Som.StkXGYHCoordinate.XGYHLongitude); rd.XGYHType = data.GetParameterValue <string>(this.Som.StkXGYHCoordinate.XGYHType); this.simManager.view.DealPacket_XGY(rd); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } // //处理satuser的交互类 else if (data.InteractionClassHandle == this.Som.SatUserParameter.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("SatUserParameter", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_SatUser rd = new RD_SatUser(); rd.SatUserName = data.GetParameterValue <string>(this.Som.SatUserParameter.SatUserName); rd.SatUserAltitude = data.GetParameterValue <double>(this.Som.SatUserParameter.SatUserAltitude); rd.SatUserOrbitalInclination = data.GetParameterValue <double>(this.Som.SatUserParameter.SatUserOrbitalInclination); rd.SatUserRightAscensionOfAscendingNode = data.GetParameterValue <double>(this.Som.SatUserParameter.SatUserRightAscensionOfAscendingNode); this.simManager.view.DealPacket_SatUser(rd); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } //各星对地链路传输能力 else if (data.InteractionClassHandle == this.Som.OpS2gLinkTrafficAbility.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("S2GLinkAbility", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_S2GLinkAbility rd = new RD_S2GLinkAbility(); rd.simTime = data.GetParameterValue <double>(this.Som.OpS2gLinkTrafficAbility.SimTime); rd.simTime = Math.Round(rd.simTime, 2); rd.SatName = data.GetParameterValue <String>(this.Som.OpS2gLinkTrafficAbility.SatName); rd.SatbeamID = data.GetParameterValue <int>(this.Som.OpS2gLinkTrafficAbility.SatbeamID); rd.UplinkTrafficBps = data.GetParameterValue <double>(this.Som.OpS2gLinkTrafficAbility.UplinkTrafficBps); //UplinkUtilizationRadio = data.GetParameterValue<double>(this.Som.OpS2gLinkTrafficAbility.UplinkUtilizationRadio)); rd.DownlinkTrafficBps = data.GetParameterValue <double>(this.Som.OpS2gLinkTrafficAbility.DownlinkTrafficBps); //DownlinkUtilizationRadio = data.GetParameterValue<double>(this.Som.OpS2gLinkTrafficAbility.DownlinkUtilizationRadio)); //LinkPkLossRadio = data.GetParameterValue<double>(this.Som.OpS2gLinkTrafficAbility.LinkPkLossRadio)); this.simManager.view.DealPacket_S2gLinkTraffic(rd);//处理这种包,如果是第一次收到,要检查是否已添加顶层树节点20160225 rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } //星间链路传输能力 //移动的通信节点 else if (data.InteractionClassHandle == this.Som.mobilenodeparameter.ClassHandle) { return; this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("Mobility", simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_Mobility rd = new RD_Mobility(); rd.MobileNodeName = data.GetParameterValue <string>(Som.mobilenodeparameter.MobileNodeName); rd.StartLatitude = data.GetParameterValue <string>(Som.mobilenodeparameter.StartLatitude); rd.StartLongitude = data.GetParameterValue <string>(Som.mobilenodeparameter.StartLongitude); rd.MobileStartTime = data.GetParameterValue <string>(Som.mobilenodeparameter.MobileStartTime); rd.MobileSpeed = data.GetParameterValue <string>(Som.mobilenodeparameter.MobileSpeed); //对数据就进行第一次处理 simManager.view.DealPacket_vehinfo(rd); rpd.packet = rd; simManager.view.RdXml.allPackets.Add(rpd); } //网络吞吐量 字节单位 else if (data.InteractionClassHandle == this.Som.OpAppTrafficInfoAll.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("NetTraffic", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_NetTraffic rd = new RD_NetTraffic(); rd.simTime = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoAll.SimTime); rd.AppTrafficRcvd = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoAll.AppTrafficRcvd); this.simManager.view.chartView.m_chartParam.mC_NetTra.Series[0].Points.AddXY(rd.simTime, rd.AppTrafficRcvd / 1000); //Bps->kb/s rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } //各星资源占用率 //指定业务流的QOS性能 字节单位 else if (data.InteractionClassHandle == this.Som.OpAppTrafficInfoSingle.ClassHandle) { String SubnetName_1 = " "; String ScrName = " "; String SubnetName_2 = " "; String DestName = " "; this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("QosPerfomance", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_QosPerfomance rd = new RD_QosPerfomance(); rd.simTime = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoSingle.SimTime); rd.simTime = Math.Round(rd.simTime, 2); SubnetName_1 = data.GetParameterValue <String>(this.Som.OpAppTrafficInfoSingle.SubnetName_1); ScrName = data.GetParameterValue <String>(this.Som.OpAppTrafficInfoSingle.ScrName); SubnetName_2 = data.GetParameterValue <String>(this.Som.OpAppTrafficInfoSingle.SubnetName_2); DestName = data.GetParameterValue <String>(this.Som.OpAppTrafficInfoSingle.DestName); rd.AppTrafficSend = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoSingle.AppTrafficSend); rd.AppTrafficRcvd = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoSingle.AppTrafficRcvd); rd.DelayTime = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoSingle.DelayTime); rd.DelayVar = data.GetParameterValue <double>(this.Som.OpAppTrafficInfoSingle.DelayVar); rd.TrafficName_SD = SubnetName_1 + "." + ScrName + "-" + SubnetName_2 + "." + DestName; this.simManager.view.DealPacket_AppTraQos(rd); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } //用户总数 else if (data.InteractionClassHandle == this.Som.OpUserNumIC.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("UserAllNum", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_UserAllNum rd = new RD_UserAllNum(); rd.UserAllNum = data.GetParameterValue <int>(this.Som.OpUserNumIC.UserNumValue); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); this.simManager.view.chartView.m_listItem_yonghu.SubItems[0].Text = rd.UserAllNum.ToString(); } //在线用户数目 else if (data.InteractionClassHandle == this.Som.OpUserOnlineIC.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("UserOnline", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_UserOnline rd = new RD_UserOnline(); int OnlineFlag = 0; int UserNum = 0; //UserId = data.GetParameterValue<int>(this.Som.OpUserOnlineIC.UserId)); OnlineFlag = data.GetParameterValue <int>(this.Som.OpUserOnlineIC.OnlineFlag); rd.simTime = data.GetParameterValue <double>(this.Som.OpUserOnlineIC.SimTime); rd.simTime = Math.Round(rd.simTime, 2); if (OnlineFlag == 0) { UserNum = int.Parse(this.simManager.view.chartView.m_listItem_yonghu.SubItems[1].Text); this.simManager.view.chartView.m_listItem_yonghu.SubItems[1].Text = (UserNum - 1).ToString(); rd.UserOnlineNum = UserNum - 1; } else if (1 == OnlineFlag) { UserNum = int.Parse(this.simManager.view.chartView.m_listItem_yonghu.SubItems[1].Text); this.simManager.view.chartView.m_listItem_yonghu.SubItems[1].Text = (UserNum + 1).ToString(); rd.UserOnlineNum = UserNum + 1; } rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } //接入能力(用户的全局接入成功率) else if (data.InteractionClassHandle == this.Som.OpAccessAbility.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("AccessAbility", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_AccessAbility rd = new RD_AccessAbility(); rd.AccessSignalingCost = data.GetParameterValue <int>(this.Som.OpAccessAbility.AccessSignalingCost); rd.AccessTimeAverage = data.GetParameterValue <double>(this.Som.OpAccessAbility.AccessTimeAverage); rd.AccessSuccessRate = data.GetParameterValue <double>(this.Som.OpAccessAbility.AccessSuccessRate); rd.ChannelApplyAverage = data.GetParameterValue <double>(this.Som.OpAccessAbility.ChannelApplyAverage); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); this.simManager.view.chartView.m_listItem_jieru.SubItems[0].Text = (Math.Round(rd.AccessSuccessRate, 4) * 100).ToString(); this.simManager.view.chartView.m_listItem_jieru.SubItems[1].Text = Math.Round(rd.AccessTimeAverage, 2).ToString() + "s"; this.simManager.view.chartView.m_listItem_jieru.SubItems[2].Text = Math.Round(rd.ChannelApplyAverage, 2).ToString() + "s"; this.simManager.view.chartView.m_listItem_jieru.SubItems[3].Text = (rd.AccessSignalingCost / 8).ToString() + "Byte"; //Math.Round((AccessSignalingCost / 8.0), 1).ToString() + "Byte"; } //链路传输能力设计指标 else if (data.InteractionClassHandle == this.Som.OpLinkAbilityDesigned.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("LinkTraDesign", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_LinkTraDesign rd = new RD_LinkTraDesign(); rd.StogDownstrmDatarate = data.GetParameterValue <double>(this.Som.OpLinkAbilityDesigned.StogDownstrmDatarate); rd.StogUpstrmDatarate = data.GetParameterValue <double>(this.Som.OpLinkAbilityDesigned.StogUpstrmDatarate); rd.StosDatarate = data.GetParameterValue <double>(this.Som.OpLinkAbilityDesigned.StosDatarate); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); this.simManager.view.chartView.m_listItem_zhibiao.SubItems[0].Text = (rd.StogDownstrmDatarate / 1000000).ToString() + "Mbps"; this.simManager.view.chartView.m_listItem_zhibiao.SubItems[1].Text = (rd.StogUpstrmDatarate / 1000000).ToString() + "Mbps"; this.simManager.view.chartView.m_listItem_zhibiao.SubItems[2].Text = (rd.StosDatarate / 1000000).ToString() + "Mbps"; } else if (data.InteractionClassHandle == this.Som.PlanComplete.ClassHandle) { try { //启动接收文件的进程 file32 = Process.Start("tftpd32.exe"); simManager.view.display("场景已生成,文件接收已打开"); } catch { } } else if (data.InteractionClassHandle == this.Som.OpFinish.ClassHandle) { this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("Finish", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Reset();//计时结束 RD_Finish rd = new RD_Finish(); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); simManager.view.DealPacket_Finish(rd); } #endregion } if (data.InteractionClassHandle == this.Som.StkScenarioIC.ClassHandle) //根据控制台发来的场景名建立STK场景 { //////////////////////////// //gez2017/2/24新版方案 //////////////////////////// if (file32 != null) { try { file32.Kill(); file32.Close(); } catch {} } this.simManager.view.RdXml.sw.Stop(); RePlayData rpd = new RePlayData("StkScenarioIC", this.simManager.view.RdXml.sw.ElapsedMilliseconds); this.simManager.view.RdXml.sw.Start(); RD_Scenset rd = new RD_Scenset(); rd.ScenarioName = data.GetParameterValue <String>(this.Som.StkScenarioIC.ScenarioName); rd.StartTime = data.GetParameterValue <String>(this.Som.StkScenarioIC.StartTime); rd.StopTime = data.GetParameterValue <String>(this.Som.StkScenarioIC.StopTime); rd.StepTime = data.GetParameterValue <double>(this.Som.StkScenarioIC.StepTime); rd.InPlaneSatelliteNumber = data.GetParameterValue <int>(this.Som.StkScenarioIC.InPlaneSatelliteNumber); rd.OrbitalInclination = data.GetParameterValue <double>(this.Som.StkScenarioIC.OrbitalInclination); rd.OrbitalNumber = data.GetParameterValue <int>(this.Som.StkScenarioIC.OrbitalNumber); rd.PhaseParameters = data.GetParameterValue <double>(this.Som.StkScenarioIC.PhaseParameters); rd.RightAscensionOfAscendingNode = data.GetParameterValue <double>(this.Som.StkScenarioIC.RightAscensionOfAscendingNode); rd.SatelliteAltitude = data.GetParameterValue <double>(this.Som.StkScenarioIC.SatelliteAltitude); rd.raanspread = data.GetParameterValue <double>(this.Som.StkScenarioIC.RAANSpread); this.simManager.view.DealPacket("StkScenarioIC", rd); rpd.packet = rd; this.simManager.view.RdXml.allPackets.Add(rpd); } }
private double fastertimes; //内部使用 public void ReadXml() { XmlReaderSettings mySettings = new XmlReaderSettings(); mySettings.IgnoreComments = true; mySettings.IgnoreWhitespace = true; using (XmlReader reader = XmlReader.Create(m_path + "\\回放数据xml\\" + replayXmlName + ".xml", mySettings)) { lock (this.stopRead) { isStopRead = false; isPauseRead = false; } isStop = false; int preTime = 0; int nextTime = 0; int spanTime = 0; object pack = null; string type = null; while (reader.Read()) { lock (this.stopRead) { if (isStopRead == true)//在主线程中修改使子线程自然退出 { isStopRead = false; break; } else if (isPauseRead == true) { isPauseRead = false; isStop = true; } fastertimes = fasterTimes;//主线程中若修改fasterTimes将影响读包速度,不过太快时误差增大因此要限速 } if (isStop == true) { isStop = false; try { Thread.Sleep(-1); } catch (Exception) { } } if (reader.Name.Equals("Packet")) { type = reader.GetAttribute("Type"); nextTime = Convert.ToInt32(reader.GetAttribute("Time")); spanTime = nextTime - preTime; if (spanTime <= 0) { spanTime = 2; } spanTime = (int)(spanTime / fastertimes);//加快读取进度 try { Thread.Sleep(spanTime); } catch (Exception)//(System.Threading.ThreadInterruptedException e) { } preTime = nextTime; switch (type) { case "StkScenarioIC": RD_Scenset pasen = new RD_Scenset(); pasen.ScenarioName = reader.GetAttribute("ScenarioName"); pasen.StartTime = reader.GetAttribute("StartTime"); pasen.StopTime = reader.GetAttribute("StopTime"); pasen.StepTime = Convert.ToDouble(reader.GetAttribute("StepTime")); pasen.InPlaneSatelliteNumber = Convert.ToInt32(reader.GetAttribute("InPlaneSatelliteNumber")); pasen.OrbitalInclination = Convert.ToDouble(reader.GetAttribute("OrbitalInclination")); pasen.RightAscensionOfAscendingNode = Convert.ToDouble(reader.GetAttribute("RightAscensionOfAscendingNode")); pasen.SatelliteAltitude = Convert.ToDouble(reader.GetAttribute("SatelliteAltitude")); pasen.OrbitalNumber = Convert.ToInt32(reader.GetAttribute("OrbitalNumber")); pasen.PhaseParameters = Convert.ToDouble(reader.GetAttribute("PhaseParameters")); pasen.raanspread = Convert.ToDouble(reader.GetAttribute("raanspread")); pack = pasen; break; case "ChainInfo": RD_ChainInfo pacinfo = new RD_ChainInfo(); pacinfo.id = reader.GetAttribute("id"); pacinfo.StartOrEnd = reader.GetAttribute("StartOrEnd"); pacinfo.usetime = Convert.ToDouble(reader.GetAttribute("usetime")); string[] temp; temp = reader.GetAttribute("PathNodes").Split('-'); foreach (var o in temp) { pacinfo.PathNodes.Add(o); } pack = pacinfo; break; case "StartOpnetIC": RD_Op pacop = new RD_Op(); pack = pacop; break; case "XGYHCoordinate": RD_XGY pacxy = new RD_XGY(); pacxy.XGYHLongitude = reader.GetAttribute("XGYHLongitude"); pacxy.XGYHLatitude = reader.GetAttribute("XGYHLatitude"); pacxy.XGYHName = reader.GetAttribute("XGYHName"); pacxy.XGYHType = reader.GetAttribute("XGYHType"); pack = pacxy; break; case "OpSimTime": RD_SimTime pac = new RD_SimTime(); pac.simeTime = Convert.ToInt64(reader.GetAttribute("SimTime")); pack = pac; break; case "RouteTraffic": RD_RouteTraffic pacRouteTraffic = new RD_RouteTraffic(); pacRouteTraffic.SatRouteCostSent = Convert.ToDouble(reader.GetAttribute("SatRouteCostSent")); pacRouteTraffic.SatRouteCostRcvd = Convert.ToDouble(reader.GetAttribute("SatRouteCostRcvd")); pacRouteTraffic.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacRouteTraffic; break; case "S2GLinkAbility": RD_S2GLinkAbility pacS2GLinkAbility = new RD_S2GLinkAbility(); pacS2GLinkAbility.SatName = reader.GetAttribute("SatName"); pacS2GLinkAbility.SatbeamID = Convert.ToInt32(reader.GetAttribute("SatbeamID")); pacS2GLinkAbility.UplinkTrafficBps = Convert.ToDouble(reader.GetAttribute("UpTraBps")); pacS2GLinkAbility.DownlinkTrafficBps = Convert.ToDouble(reader.GetAttribute("DwTraBps")); pacS2GLinkAbility.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacS2GLinkAbility; break; case "SatUserParameter": RD_SatUser pacSatUser = new RD_SatUser(); pacSatUser.SatUserName = reader.GetAttribute("SatUserName"); pacSatUser.SatUserAltitude = Convert.ToDouble(reader.GetAttribute("SatUserAltitude")); pacSatUser.SatUserOrbitalInclination = Convert.ToDouble(reader.GetAttribute("SatUserOrbitalInclination")); pacSatUser.SatUserRightAscensionOfAscendingNode = Convert.ToDouble(reader.GetAttribute("SatUserRightAscensionOfAscendingNode")); pack = pacSatUser; break; case "S2SLinkAbility": RD_S2SLinkAbility pacS2SLinkAbility = new RD_S2SLinkAbility(); pacS2SLinkAbility.SatName1_2 = reader.GetAttribute("SatName1_2"); pacS2SLinkAbility.UplinkTrafficBps = Convert.ToDouble(reader.GetAttribute("UpTraBps")); pacS2SLinkAbility.DownlinkTrafficBps = Convert.ToDouble(reader.GetAttribute("DwTraBps")); pacS2SLinkAbility.UplinkUtilizationRadio = Convert.ToDouble(reader.GetAttribute("UpUseRadio")); pacS2SLinkAbility.DownlinkUtilizationRadio = Convert.ToDouble(reader.GetAttribute("DwUseRadio")); pacS2SLinkAbility.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacS2SLinkAbility; break; case "NetTraffic": RD_NetTraffic pacNetTraffic = new RD_NetTraffic(); pacNetTraffic.AppTrafficRcvd = Convert.ToDouble(reader.GetAttribute("AppTrafficRcvd")); pacNetTraffic.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacNetTraffic; break; case "ResOccupancy": RD_ResOccupancy pacResOccupancy = new RD_ResOccupancy(); pacResOccupancy.SatName1_5 = reader.GetAttribute("SatName1_5"); pacResOccupancy.ResourceOccupancyRate1_5 = reader.GetAttribute("ResourceOccupancyRate1_5"); pacResOccupancy.Type1 = reader.GetAttribute("Type1"); pacResOccupancy.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacResOccupancy; break; case "QosPerfomance": RD_QosPerfomance pacQosPerfomance = new RD_QosPerfomance(); pacQosPerfomance.TrafficName_SD = reader.GetAttribute("TrafficName_SD"); pacQosPerfomance.AppTrafficSend = Convert.ToDouble(reader.GetAttribute("AppTrafficSend")); pacQosPerfomance.AppTrafficRcvd = Convert.ToDouble(reader.GetAttribute("AppTrafficRcvd")); pacQosPerfomance.DelayTime = Convert.ToDouble(reader.GetAttribute("DelayTime")); pacQosPerfomance.DelayVar = Convert.ToDouble(reader.GetAttribute("DelayVar")); pacQosPerfomance.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacQosPerfomance; break; case "AccessAbility": RD_AccessAbility pacAccessAbility = new RD_AccessAbility(); pacAccessAbility.AccessSignalingCost = Convert.ToInt32(reader.GetAttribute("SignalingCost")); pacAccessAbility.AccessTimeAverage = Convert.ToDouble(reader.GetAttribute("TimeAverage")); pacAccessAbility.AccessSuccessRate = Convert.ToDouble(reader.GetAttribute("SuccessRate")); pacAccessAbility.ChannelApplyAverage = Convert.ToDouble(reader.GetAttribute("ChannelApply")); pack = pacAccessAbility; break; case "UserAllNum": RD_UserAllNum pacUserAllNum = new RD_UserAllNum(); pacUserAllNum.UserAllNum = Convert.ToInt32(reader.GetAttribute("UserAllNum")); pack = pacUserAllNum; break; case "UserOnline": RD_UserOnline pacUserOnline = new RD_UserOnline(); pacUserOnline.UserOnlineNum = Convert.ToInt32(reader.GetAttribute("UserOnlineNum")); pacUserOnline.simTime = Convert.ToDouble(reader.GetAttribute("SimTime")); pack = pacUserOnline; break; case "PKLossRate": RD_PKLossRate pacPKLossRate = new RD_PKLossRate(); pacPKLossRate.PkLossRatioValue = Convert.ToDouble(reader.GetAttribute("PkLossRatio")); pack = pacPKLossRate; break; case "Mobility": RD_Mobility pacMobility = new RD_Mobility(); pacMobility.MobileNodeName = reader.GetAttribute("MobileNodeName"); pacMobility.MobileStartTime = reader.GetAttribute("MobileStartTime"); pacMobility.EndLatitude = reader.GetAttribute("EndLatitude"); pacMobility.EndLongitude = reader.GetAttribute("EndLongitude"); pacMobility.StartLatitude = reader.GetAttribute("StartLatitude"); pacMobility.StartLongitude = reader.GetAttribute("StartLongitude"); pacMobility.MobileSpeed = reader.GetAttribute("MobileSpeed"); pack = pacMobility; break; case "LinkTraDesign": RD_LinkTraDesign pacLinkTraDesign = new RD_LinkTraDesign(); pacLinkTraDesign.StogDownstrmDatarate = Convert.ToDouble(reader.GetAttribute("StogDwDataRate")); pacLinkTraDesign.StogUpstrmDatarate = Convert.ToDouble(reader.GetAttribute("StogUpDataRate")); pacLinkTraDesign.StosDatarate = Convert.ToDouble(reader.GetAttribute("StosDataRate")); pack = pacLinkTraDesign; break; case "Finish": RD_Finish pacFinish = new RD_Finish(); pack = pacFinish; break; case "InterSatellitePath": RD_InterSatellitePath pacInterSatellitePath = new RD_InterSatellitePath(); pacInterSatellitePath.ISLPath = reader.GetAttribute("ISLPath"); pacInterSatellitePath.ISLid = Convert.ToInt16(reader.GetAttribute("ISLid")); pack = pacInterSatellitePath; break; default: continue; } if (DealPacketCallback != null) { try { DealPacketCallback(type, pack); } catch (Exception e) //(System.Threading.ThreadInterruptedException e) { //这里还是不要提示比较好了 //MessageBox.Show(e.ToString(),"唤起函数出错"); } } } } lock (this.stopRead) { isStopRead = false; } } }