CloudSim Simulator Pause and Stop
This code is for simulator work for pause and start after simulationThe Cloudsim API having number of class and class having method
For pausing the simulator CloudSim.pauseSimulation() method for pause the simulation we have
to pass the integer number for pausing the cloudsim simulator
CloudSim.pauseSimulation(int)
The resumeSimulation() method is use for CloudSim simulation start after the pause
CloudSim.resumeSimulation();
Public void run(){
CloudSim.pauseSimulation(200);
While(true){
If(CloudSim.isPaused()){
Break;
}
try{
Thred.sleep(100);
}catch(InterruptedException e){
e.printStackTrace();
}
Log.printLine(“\n\n”+CloudSim.clock()+”:The Simulation is paused for 5 sec \n\n”);
try{
Thread.sleep(5000);
}catch(InterruptedException e){
e.printStackTrace();
}
//Add the cloudlet to the list and submit the list to the broker.
CloudSim.resumeSimulation();
};
new Thread(monitor).start();
Thread.sleep(1000);
Set the network topology in CloudSim
First we need to add the topology file in this example we add file topology.briie
here are content of topology.brite
We can store save this content topology.brite
Topology: ( 5 Nodes, 8 Edges )
Model (1 - RTWaxman): 5 5 5 1 2 0.15000000596046448 0.20000000298023224 1 1 10.0 1024.0
Nodes: ( 5 )0 1 3 3 3 -1 RT_NODE
1 0 3 3 3 -1 RT_NODE
2 4 3 3 3 -1 RT_NODE
3 3 1 3 3 -1 RT_NODE
4 3 3 4 4 -1 RT_NODE
Edges: ( 8 )
0 2 0 3.0 1.1 10.0 -1 -1 E_RT U
1 2 1 4.0 2.1 10.0 -1 -1 E_RT U
2 3 0 2.8 284271247461903 3.9 10.0 -1 -1 E_RT U
3 3 1 3.6 05551275463989 4.1 10.0 -1 -1 E_RT U
4 4 3 2.0 5.0 10.0 -1 -1 E_RT U
5 4 2 1.0 4.0 10.0 -1 -1 E_RT U
6 0 4 2.0 3.0 10.0 -1 -1 E_RT U
7 1 4 3.0 4.1 10.0 -1 -1 E_RT U
NetworkTopology.buildNetworkTopology(“topology.brite”);
//maps CloudSim entities to BRITE entities
//PowerDatacenter will correspond to BRITE node 0
Int briteNode=0;
NetworkTopology.mapNode(datacenter0.getId(),briteNode);
Comments
Post a Comment