Exemple #1
0
 /// <summary>
 /// Set up environment and start simulation
 /// </summary>
 /// <param name="args"></param>
 public void Run()
 {
     field = new Field();
     //Create the Representatives
     Reps = new List<Representative>();
     Reps.Add(new Representative(10 * SimLib.Properties.Simulation.Default.Nodes, new Point(10, 10)));
     Reps.Add(new Representative(10 * SimLib.Properties.Simulation.Default.Nodes + 1, new Point(20, 20)));
     //Add the representatives
     foreach (var Rep in Reps)
     {
         field.Add(Rep);
     }
     //Add the nodes
     for (int ID = 0; ID < SimLib.Properties.Simulation.Default.Nodes; ID++)
     {
         field.Add(new WSNode(ID, field.getEmptyRandomCoordinates()));
     }
     //Start!!!
     field.Init();
     simulate();
 }
Exemple #2
0
 /// <summary>
 /// Set up environment and start simulation
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 {
     Program.field = new Field();
     for (int ID = 0; ID < SimLib.Properties.Simulation.Default.Nodes; ID++)
     {
         field.Add(new WSNode(ID, field.getEmptyRandomCoordinates()));
     }
     mainThread = Thread.CurrentThread;
     field.Init();
     field.com.EmptyQueueEvent += Proceed;
     simulate();
     try
     {
         Thread.Sleep(Timeout.Infinite);
     }
     catch (ThreadInterruptedException) { }
     Console.WriteLine("MSG: " + getMSG());
 }
Exemple #3
0
 /// <summary>
 /// Set up environment and start simulation
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 {
     Program.field = new Field();
     for (int ID = 0; ID < SimLib.Properties.Simulation.Default.Nodes; ID++)
     {
         field.Add(new WSNode(ID, field.getEmptyRandomCoordinates()));
     }
     field.Init();
     //field.print(true, false);
     simulate();
     //System.Console.WriteLine(getMSG());
 }