Guide to simulation workflow

Any Example provided in the ‘org.cloudbus.cloudsim.example’ Package under the example folder of the CloudSim project follows some standard steps to implement the specified configuration to start a simulation.

To understand the working of the CloudSim simulation framework, knowledge about these steps is a must. This article will help you to get an understanding of simulation workflow.

Before you start, It is essential that the cloudsim should already installed/setup on your local computer machine. In case you are yet to install it, you may follow the process of Cloudsim setup using Eclipse IDE

The main() method is the pointer from where the execution of this example starts

public static void main(String[] args)

There are eleven steps that are followed in each example with some variation in them, specified as follows:

  • Set the Number of users for the current simulation. This user count is directly proportional to a number of brokers in the current simulation.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; 
  • Initialize the simulation, provided with the current time, number of users and trace flag.
CloudSim.init(num_user, calendar, trace_flag);
  • Create a Datacenter.
Datacenter datacenter0 = createDatacenter("Datacenter_0");

where the createDatacenter() method itself initializes the various datacenter characteristics along with the host list. This is the most important entity without this there is no way the simulation of hosting the virtual machine is applicable.

private static Datacenter createDatacenter(String name) 
	List<Host> hostList = new ArrayList<Host>();
	List<Pe> peList = new ArrayList<Pe>();
	int mips = 1000;
	peList.add(new Pe(0, new PeProvisionerSimple(mips))); 
	int hostId = 0;
	int ram = 2048; // host memory (MB)
	long storage = 1000000; // host storage
	int bw = 10000;
		new Host(
			new RamProvisionerSimple(ram),
			new BwProvisionerSimple(bw),
			new VmSchedulerTimeShared(peList)
	String arch = "x86"; 
	String os = "Linux"; 
	String vmm = "Xen";
	double time_zone = 10.0; 
	double cost = 3.0; 
	double costPerMem = 0.05; 
	double costPerStorage = 0.001; 	
        double costPerBw = 0.0; 
	LinkedList<Storage> storageList = new LinkedList<Storage>();
	DatacenterCharacteristics characteristics = new 
                    DatacenterCharacteristics(arch, os, vmm, hostList, 
                                              time_zone, cost, costPerMem,
                 				costPerStorage, costPerBw);
	Datacenter datacenter = null;
	try {
		datacenter = new Datacenter(name, characteristics, new 
                                  storageList, 0);
	} catch (Exception e) {
	return datacenter;
  • Create a Datacenter broker.
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();

Where the createBroker() method initializes the entity object from DatacenterBroker class

private static DatacenterBroker createBroker() 
	DatacenterBroker broker = null;
	try {
		broker = new DatacenterBroker("Broker");
	} catch (Exception e) {
		return null;
	return broker;
  • Create a Virtual Machine(s).
vmlist = new ArrayList<Vm>();
int vmid = 0;
int mips = 1000;
long size = 10000;
int ram = 512;
long bw = 1000;
int pesNumber = 1;
String vmm = "Xen";

Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new 

  • Submit Virtual Machine to Datacenter broker.
  • Create Cloudlet(s) by specifying their characteristics.
cloudletList = new ArrayList<Cloudlet>();

int id = 0;
long length = 400000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();

Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, 
                     outputSize, utilizationModel, utilizationModel, 


  • Submit Cloudlets to Datacenter broker.
  • Send call to Start Simulation.
  • Once no more event to execute, send the call to Stop Simulation.
  • Finally, print the final status of the Simulation.
List<Cloudlet> newList = broker.getCloudletReceivedList();

Where printCloudletList() method formats the output to correctly display it on the console.

private static void printCloudletList(List<Cloudlet> list) 
	int size = list.size();
	Cloudlet cloudlet;
	String indent = "    ";
	Log.printLine("========== OUTPUT ==========");
	Log.printLine("Cloudlet ID" + indent + "STATUS" + indent
				+ "Data center ID" + indent + "VM ID" + 
                                   indent + "Time" + indent
				+ "Start Time" + indent + "Finish Time");

	DecimalFormat dft = new DecimalFormat("###.##");
	for (int i = 0; i < size; i++) 
        	cloudlet = list.get(i);
		Log.print(indent + cloudlet.getCloudletId() + indent + 
		if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS) 
			Log.printLine(indent + indent + 
				     + indent + indent + indent + 
				     + indent + indent + 
                                     + indent + indent + 
				     + indent + indent + 

Once you Run the example the output for will be displayed like: console output console output

Also, the following video tutorial contains a detailed about and helps you to understand simulation workflow

Learn More

Also, To quickly get started with the Cloudsim Simulation Toolkit, Feel free to join our learners community for an online self-paced course named “Essential Cloudsim Tutorials” I would be interested in interacting with you. for further discussion. 

Reference link to study material:


2 thoughts on “Guide to simulation workflow”

Leave a Comment