예제 #1
0
        static void Main(string[] args)
        {
            string IP   = "152.78.241.226";
            int    port = 2525;

            HighBidTurn ST1 = new HighBidTurn();

            Coordinate TestC;
            //coordinateSIT TestC;

            //This is to create a directory which records the MySQL results in a time and date folder
            String Todaysdate       = DateTime.Now.ToString("dd-MM-yyyy-HH.mm");
            string ResultsDirectory = @"C:\Documents and Settings\Siemens\Desktop\Andrew's Work\Paramics Models\Poole Junction\Paramics 2010.1 Version\Cabot Lane Poole V3\Results\" + Todaysdate;

            if (!Directory.Exists(ResultsDirectory))
            {
                Directory.CreateDirectory(ResultsDirectory);
            }

            string ResultsDir = ResultsDirectory;

            ResultsDir = ResultsDirectory.Replace("'", "''");        //This is because MySQL uses an apostrophe (') as it's delimiter
            ResultsDir = ResultsDir.Replace("\\", "//");


            //How many times would you like the program to run
            int NumberOfRuns = 5;
            int Counter      = 0;

            while (Counter < NumberOfRuns)
            {
                if (args.Length == 0)
                {
                    //string[] fnames = new string[] { "TrainedTriJ1H7.csv", "TrainedTriJ2H7.csv", "TrainedTriJ3H7.csv" };
                    //string[] sigNs = new string[] { "1", "0", "2" };

                    //TestC = new coordinateSIT("JunctionDesignTriC.XML", ST1, IP, port); // <--- Simon used this one 05/11/12
                    //TestC = new Coordinate("JunctionDesignMillbrook.XML", ST1, IP, port); //<--- Simon used this one 20/11/12
                    //TestC = new Coordinate("JunctionDesignSimpleCrossroads.XML", ST1, IP, port); //Andrew's attempt on Simple Crossroads 20/11/12

                    //TestC = new Coordinate("JunctionDesignSimpleCrossroads3Lane.XML", ST1, IP, port); //Andrew's Simple Crossroads - 3 lane 02/09/13
                    //TestC = new Coordinate("JunctionDesignPooleJunction.XML", ST1, IP, port); //Stages are same as existing stages - 4 stage solution
                    //TestC = new Coordinate("JunctionDesignPooleJunction - WithTurningIntention.XML", ST1, IP, port); //Stages are adapted to 8 stage solution
                    TestC = new Coordinate("JunctionDesignSopersLane.XML", ST1, IP, port); //Stages are adapted to 8 stage solution

                    //TestC = new coordinateSIT("JunctionDesignSimpleCrossroads3Lane.XML", ST1, IP, port); //Andrew's Simple Crossroads - 3 lane 04/12/13
                    //TestC = new Coordinate("JunctionDesignSimpleCrossroads2LaneStraightBoth.XML", ST1, IP, port); //Andrew's Simple Crossroads - 2 lane - Both Straight Ahead 04/12/13
                    //TestC = new Coordinate("JunctionDesignSimpleCrossroads2LaneStraightLeft.XML", ST1, IP, port); //Andrew's Simple Crossroads - 2 lane - Straight and Left Lane Together, Dedicated Right 04/12/13
                    //TestC = new Coordinate("JunctionDesignSimpleCrossroads2LaneStraightRight.XML", ST1, IP, port); //Andrew's Simple Crossroads - 2 lane - Straight and Right Lane Together, Dedicated Left 04/12/13

                    ParamicsPuppetMaster.EditConfig ECG = new ParamicsPuppetMaster.EditConfig(TestC.ParamicsPath);
                    ECG.SetDemandRate(100);
                    //ECG.SetStartTime(07);

                    //ParamicsPuppetMaster.EditDemands EDM = new ParamicsPuppetMaster.EditDemands(TestC.ParamicsPath, A.Demands);
                }
                else
                {
                    TestC = new Coordinate("JunctionDesignOrigV2flat.xml", ST1, IP, port);
                }

                try
                {
                    ParaESVstarter StartParamicsModel = new ParaESVstarter(TestC.ParamicsPath);
                    //ParaBSMstarter StartParamicsModel = new ParaBSMstarter(TestC.ParamicsPath);
                    StartParamicsModel.LauncParamics();


                    TestC.ConnectToParamics();
                    Thread.Sleep(2000);
                    Runner Run = new Runner(TestC);

                    Run.SynchRun(4200);

                    //AH added this function to save the biddata and linkturningmovements tables after a run

                    TestC.SaveTables(Counter, ResultsDir);
                }
                catch (Exception e)
                {
                    StreamWriter SW;
                    SW = File.AppendText(@"C:\Documents and Settings\Siemens\Desktop\Andrew's Work\C# Code\ParamicsSNMPcontrolV3\BigRunLog.txt");
                    SW.WriteLine("G = {0:G}", DateTime.Now);
                    foreach (string s in args)
                    {
                        SW.WriteLine(s);
                    }
                    SW.WriteLine(e.Message);
                    SW.WriteLine("*******************************");
                    SW.WriteLine("");
                    SW.WriteLine("");
                    SW.Close();
                }

                Counter++;
            }
        }
예제 #2
0
        public void StartRunningESV()
        {
            ParaESVstarter StartParamicsModel = new ParaESVstarter(TestC.ParamicsPath);

            StartRunning(StartParamicsModel);
        }