Пример #1
0
        //Function like FindAgents above but specifically for pulling out the area data for SIT calculation and the sensor data...

        public void FindSITAgents(NetworkData NDin, ref SITbridge SITin)
        {
            XmlNodeList JunctionsData = NetworkStruct.GetElementsByTagName("Junction");

            foreach (XmlNode Jcn in JunctionsData)
            {
                string SignalNode = Jcn.SelectSingleNode("SignalNode").FirstChild.Value;
                int    NumStages  = Convert.ToInt32(Jcn.SelectSingleNode("Stages").FirstChild.Value);

                //JunctionAgent TempJA = new JunctionAgent(NDin, Strat, SignalNode, NumStages);

                XmlNodeList StageData = Jcn.SelectNodes("Stage");
                foreach (XmlNode Stg in StageData)
                {
                    //StageAgent TempSA = new StageAgent(NDin, Strat);

                    XmlNodeList AgentData = Stg.SelectNodes("Agent");
                    foreach (XmlNode Agt in AgentData)
                    {
                        LaneAgent TempLA = new LaneAgent(NDin, Strat);
                        TempLA.Duplicate = Convert.ToBoolean(Agt.SelectSingleNode("Duplicate").FirstChild.Value);
                        if (!TempLA.Duplicate)
                        {
                            TempLA.Name = Agt.SelectSingleNode("name").FirstChild.Value;
                            if (Agt.SelectSingleNode("UpstreamAgents").HasChildNodes)
                            {
                                TempLA.UpstreamAgents = Agt.SelectSingleNode("UpstreamAgents").FirstChild.Value;
                            }
                            if (Agt.SelectSingleNode("FeedPercentage").HasChildNodes)
                            {
                                TempLA.feedPercentages = Agt.SelectSingleNode("FeedPercentage").FirstChild.Value;
                            }
                            XmlNodeList RoadData = Agt.SelectNodes("RoadSec");
                            foreach (XmlNode Rsec in RoadData)
                            {
                                string Snode, Enode;
                                int    Lane, OLanes;
                                double Oset, Tlen;

                                Snode  = Rsec.SelectSingleNode("StartNode").FirstChild.Value;
                                Enode  = Rsec.SelectSingleNode("EndNode").FirstChild.Value;
                                Lane   = Convert.ToInt32(Rsec.SelectSingleNode("Lane").FirstChild.Value);
                                OLanes = Convert.ToInt32(Rsec.SelectSingleNode("OfLanes").FirstChild.Value);
                                Oset   = Convert.ToDouble(Rsec.SelectSingleNode("Offset").FirstChild.Value);
                                Tlen   = Convert.ToDouble(Rsec.SelectSingleNode("TotalLength").FirstChild.Value);

                                LaneAgent.BitOfRoad br = new LaneAgent.BitOfRoad(Snode, Enode, Lane, OLanes, Oset);
                                br.TotalLength = Tlen;
                                TempLA.RoadSegments.Add(br);
                            }
                            SITin.AddArea(new SITarea(TempLA));
                        }
                    }
                }
            }
        }
Пример #2
0
        //Function to read get the agent data from the XML file
        protected void FindAgents(NetworkData NDin, ref ZoneAgent ZAin)
        {
            XmlNodeList JunctionsData = NetworkStruct.GetElementsByTagName("Junction");

            foreach (XmlNode Jcn in JunctionsData)
            {
                string SignalNode = Jcn.SelectSingleNode("SignalNode").FirstChild.Value;
                int    NumStages  = Convert.ToInt32(Jcn.SelectSingleNode("Stages").FirstChild.Value);

                JunctionAgent TempJA = new JunctionAgent(NDin, Strat, SignalNode, NumStages);

                XmlNodeList StageData = Jcn.SelectNodes("Stage");
                foreach (XmlNode Stg in StageData)
                {
                    StageAgent TempSA = new StageAgent(NDin, Strat);

                    XmlNodeList AgentData = Stg.SelectNodes("Agent");
                    foreach (XmlNode Agt in AgentData)
                    {
                        LaneAgent TempLA = new LaneAgent(NDin, Strat);
                        TempLA.Duplicate = Convert.ToBoolean(Agt.SelectSingleNode("Duplicate").FirstChild.Value);
                        TempLA.Name      = Agt.SelectSingleNode("name").FirstChild.Value;
                        //TempLA.UpstreamAgents = Agt.SelectSingleNode("UpstreamAgents").FirstChild.Value;
                        XmlNodeList RoadData = Agt.SelectNodes("RoadSec");
                        foreach (XmlNode Rsec in RoadData)
                        {
                            string Snode, Enode;
                            int    Lane, OLanes;
                            double Oset;

                            Snode  = Rsec.SelectSingleNode("StartNode").FirstChild.Value;
                            Enode  = Rsec.SelectSingleNode("EndNode").FirstChild.Value;
                            Lane   = Convert.ToInt32(Rsec.SelectSingleNode("Lane").FirstChild.Value);
                            OLanes = Convert.ToInt32(Rsec.SelectSingleNode("OfLanes").FirstChild.Value);
                            Oset   = Convert.ToDouble(Rsec.SelectSingleNode("Offset").FirstChild.Value);

                            TempLA.RoadSegments.Add(new LaneAgent.BitOfRoad(Snode, Enode, Lane, OLanes, Oset));
                        }
                        TempSA.Lanes.Add(TempLA);
                    }
                    TempSA.NeutralWeight();
                    TempJA.Stages.Add(TempSA);
                }
                ZAin.Junctions.Add(TempJA);
            }
        }
Пример #3
0
        public override void ProcessLane(LaneAgent SA)
        {
            Bid B = new Bid();

            for (int i = 0; i < 3; i++)
            {
                if (SA.CountTurns[i] != 0)
                {
                    B.TurningBids[i] = SA.TurningMovements[i] * (1 - 0.01 * SA.AvSpeedTurns[i] - 0.001 * SA.AvDistTurns[i]);
                    //B.TurningBids[i] = SA.TurningMovements[i] * (3 - 0.05 * SA.AvSpeedTurns[i] - 0.001 * SA.AvDistTurns[i]);   //AH Testing different numbers
                }
                else
                {
                    B.TurningBids[i] = 0.0;
                }
            }

            SA.LaneBid = B;
        }
Пример #4
0
 //*class constructor
 public SITarea(LaneAgent LA)
 {
     Agent = LA;
     Area  = new SingleInstanceOfTruth.area(LA.GetHashCode(), LA.Name, null, LA.geometricLength(), LA.AreaLength(), 0, 0);
     if (Agent.UpstreamAgents != null)
     {
         UpstreamNames = Agent.UpstreamAgents.Split(',');
         UpstreamIndex = UpstreamNames.Length;
         EdgeArea      = false;
         if (Agent.feedPercentages != null)
         {
             string[] feedStrings = Agent.feedPercentages.Split(',');
             if (feedStrings.Length != UpstreamIndex)
             {
                 Console.WriteLine("Error the number of feed percentages supplied does not match the number of upstream areas");
             }
             feedPercentage = new double[UpstreamIndex];
             for (int i = 0; i < UpstreamIndex; i++)
             {
                 feedPercentage[i] = Convert.ToDouble(feedStrings[i]);
             }
         }
         else
         {
             feedPercentage = new double[UpstreamIndex];
             for (int i = 0; i < UpstreamIndex; i++)
             {
                 feedPercentage[i] = 1;
             }
         }
     }
     else
     {
         EdgeArea = true;
     }
 }
Пример #5
0
 public override void ProcessLane(LaneAgent LA)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #6
0
 public abstract void ProcessLane(LaneAgent LA);