Esempio n. 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));
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        //*Class Constructor
        public JunctionAgent(NetworkData A, Strategies B, string SN, int NoS)
            : base(A, B)
        {
            SignalNode = SN;
            NoOfStages = NoS;

            int[] TempDummy = new int[2];       //Note that this is the initial stage and stage length assumption
            TempDummy[0] = 1;
            TempDummy[1] = 10;
            NextStage.Add(TempDummy);
        }
Esempio n. 3
0
        //* function to pull specifically the sensor data from the config file...

        private void FindSensors(NetworkData NDin, ref SITbridge SitIn)
        {
            XmlNode SensorData = NetworkStruct.GetElementsByTagName("SensorModel")[0];

            XmlNode CensusData = SensorData.SelectSingleNode("Census");
            XmlNode ProbeData  = SensorData.SelectSingleNode("Probe");

            //get loop data
            XmlNodeList Loops = CensusData.SelectNodes("Loop");

            foreach (XmlNode loop in Loops)
            {
                string Name     = loop.SelectSingleNode("Name").FirstChild.Value;
                string AreaNme  = loop.SelectSingleNode("Area").FirstChild.Value;
                double Position = Convert.ToDouble(loop.SelectSingleNode("Position").FirstChild.Value);
                int    Lanes    = Convert.ToInt32(loop.SelectSingleNode("LanesCovered").FirstChild.Value);
                double CountSD  = Convert.ToDouble(loop.SelectSingleNode("CountSD").FirstChild.Value);
                bool   HasSpeed = Convert.ToBoolean(loop.SelectSingleNode("HasSpeed").FirstChild.Value);
                double SpeedSD  = 0;
                if (HasSpeed)
                {
                    SpeedSD = Convert.ToDouble(loop.SelectSingleNode("SpeedSD").FirstChild.Value);
                }

                SingleInstanceOfTruth.censusSensor TheSensor;

                if (HasSpeed)
                {
                    TheSensor = new SingleInstanceOfTruth.loopPair(Name, Lanes, Position, CountSD, SpeedSD);
                }
                else
                {
                    TheSensor = new SingleInstanceOfTruth.inductiveLoop(Name, CountSD, Lanes, Position);
                }

                SitIn.AddCensus(TheSensor, AreaNme);
            }

            //*get probe data
            XmlNodeList WiFis = ProbeData.SelectNodes("WiFiType");

            foreach (XmlNode wifi in WiFis)
            {
                string Name    = wifi.SelectSingleNode("Name").FirstChild.Value;
                double CountSD = Convert.ToDouble(wifi.SelectSingleNode("CountSD").FirstChild.Value);
                double SpeedSD = Convert.ToDouble(wifi.SelectSingleNode("SpeedSD").FirstChild.Value);
                double PenRate = Convert.ToDouble(wifi.SelectSingleNode("PenetrationRate").FirstChild.Value);
                double PenSD   = Convert.ToDouble(wifi.SelectSingleNode("PenetrationSD").FirstChild.Value);

                SitIn.AddProbe(new SingleInstanceOfTruth.WiFi(Name, CountSD, SpeedSD, PenRate, PenSD));
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        public virtual void ConnectToParamics()
        {
            //Find out the number of agents and junctions
            int AgentNum    = NetworkStruct.GetElementsByTagName("Agent").Count * 3; //AH added times 3 to include all 12 phase bids
            int JunctionNum = NetworkStruct.GetElementsByTagName("Junction").Count;

            NetDat = new NetworkData(ParamicsPath, IP, Port, AgentNum, JunctionNum);
            NetDat.PDB.ClearTableContents();

            MainZone = new ZoneAgent(NetDat, Strat);

            FindAgents(NetDat, ref MainZone);


            List <string> NodeNames = new List <string>();

            foreach (JunctionAgent JA in MainZone.Junctions)
            {
                NodeNames.Add(JA.SignalNode);
            }

            SigSet = new SignalsSet(NetDat, NodeNames);
        }
Esempio n. 6
0
 //*Constructor
 public LaneAgent(NetworkData A, Strategies B) : base(A, B)
 {
 }
Esempio n. 7
0
 //*class construnctor
 public Agents(NetworkData A, Strategies B)
 {
     NetDat = A; Strat = B;
 }