예제 #1
0
파일: Console.cs 프로젝트: ApexWeed/NetML
        private void AwaitSimulation()
        {
            while (true)
            {
                if (Closing)
                {
                    return;
                }
                if (RichTextBoxGetText(rtbOutput).Contains("Simulation complete."))
                {
                    lock (OutputQueue)
                    {
                        OutputQueue.Enqueue($"\n{(char)27}[36mAveraging data...\n{(char)27}[0m", DateTime.Now.ToBinary());
                    }
                    DataManipulator.AverageData(Parameters);

                    lock (OutputQueue)
                    {
                        OutputQueue.Enqueue($"{(char)27}[36mScaling data...\n{(char)27}[0m", DateTime.Now.ToBinary());
                    }
                    DataManipulator.ScaleData(Parameters);

                    lock (OutputQueue)
                    {
                        OutputQueue.Enqueue($"{(char)27}[36mGenerating plots...\n{(char)27}[0m", DateTime.Now.ToBinary());
                    }
                    SourceGenerator.GeneratePlots(Parameters);
                    BS.SendInput("cd build/scratch/out");
                    Thread.Sleep(50);
                    foreach (var plot in Parameters.Plots)
                    {
                        BS.SendInput($"gnuplot {plot.EscapedName}.gpl");
                        Thread.Sleep(500);
                    }

                    lock (OutputQueue)
                    {
                        OutputQueue.Enqueue($"{(char)27}[36mMoving files to local directory...\n{(char)27}[0m", DateTime.Now.ToBinary());
                        Thread.Sleep(50);
                    }
                    foreach (var file in Directory.GetFiles(Path.Combine(Properties.Settings.Default.NS3Dir, "build/scratch/out")))
                    {
                        File.Copy(file, Path.Combine($"{Parameters.EscapedName}/output", Path.GetFileName(file)));
                    }

                    lock (OutputQueue)
                    {
                        OutputQueue.Enqueue($"\n{(char)27}[36mJob complete.\n{(char)27}[0m", DateTime.Now.ToBinary());
                    }
                    return;
                }
                Thread.Sleep(100);
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: ApexWeed/NetML
 private void runSimulationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SourceGenerator.GenerateSource(Path.Combine(Properties.Settings.Default.NS3Dir, "scratch", $"{NetworkParameters.EscapedName}.cc"), NetworkParameters, Nodes, Links, Streams, Domains);
     if (Console == null)
     {
         Console = new Console(this, NetworkParameters);
         Console.Show();
     }
     else
     {
         Console.LoadParameters(NetworkParameters);
         Console.BringToFront();
     }
 }