Beispiel #1
0
 /// <summary>
 /// Creates A data container for the field
 /// </summary>
 /// <param name="field">The field with the data</param>
 public DataContainer(Field field)
 {
     this.field = field;
     Data = new double[this.field.Width][];
     random = new Random();
     for (int i = 0; i < Data.Length; i++)
     {
         Data[i] = new double[this.field.Height];
     }
     Init();
 }
Beispiel #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()));
     }
     field.Init();
     //field.print(true, false);
     simulate();
     //System.Console.WriteLine(getMSG());
 }
Beispiel #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()));
     }
     mainThread = Thread.CurrentThread;
     field.Init();
     field.com.EmptyQueueEvent += Proceed;
     simulate();
     try
     {
         Thread.Sleep(Timeout.Infinite);
     }
     catch (ThreadInterruptedException) { }
     Console.WriteLine("MSG: " + getMSG());
 }
Beispiel #4
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();
 }