I am working on Java in real time to implement a sensor network simulation. My simulation works, but the problem is that I want to do a sensitivity analysis, so I need to run the simulation several times one by one. After the first iteration, I canโt get any results due to the suspension, and activating or reloading them was a bit problematic. So here is the code:
class Response_Time extends SimulationProcess{
public static void main(String[] args){
for(int i=0;i<5; i++)
{
Response_Time exp = new Response_Time();
exp.await();
}
}
public void run(){
System.out.println("Creating components...");
Mesh2DSensorNetwork sn = new Mesh2DSensorNetwork(7,7);
Task_Generator tg = new Task_Generator(sn);
emiission ee = new emiission(sn);
DataCollection dc = new DataCollection(sn, tg);
try {
tg.Activate();
ee.Activate();
dc.Activate();
sn.Activate();
Scheduler.startSimulation();
System.out.println("Simulation started... "+CurrentTime());
Hold(576000);
System.out.println("Simulation stopped... "+CurrentTime());
Scheduler.stopSimulation();
tg.terminate();
ee.terminate();
dc.terminate();
sn.terminate();
SimulationProcess.mainResume();
} catch (Exception e) {
e.printStackTrace();
}
}
public void await ()
{
this.Resume();
}
}
source
share