Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to create a cloud datacenter in iFogSim?

Description

In iFogsim, a datacenter is created by FogDevice class which is extended from PowerDatacenter class.

Sample Code

public class IotFogApplication
{ .
.
.
Public IotFogApplication()
{
. . . . . .
}
public static void main(String[] args) {

try {
Log.disable();
int num_user = 1;
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false;
CloudSim.init(num_user, calendar, trace_flag);
String appId = “iotFogApps”;
FogBroker broker = new FogBroker(“broker”);
Application application = createApplication(appId, broker.getId());
application.setUserId(broker.getId());

FogDevice cloud= createFogDevice(“cloud”, 44800,40000, 100,10000, 0, 0.01, 16 * 103,16*83.25);

cloud.setParentId(-1);
.
.
.
} catch (Exception e)
{
e.printStackTrace();
Log.printLine(“Unwanted errors happen “+e.getMessage());
}
}

private static FogDevice createFogDevice(String nodeName, long mips, int ram, long upBw, long downBw, int level, double ratePerMips, double busyPower, double idlePower)

{
List peList = new ArrayList();

peList.add(new Pe(0, new PeProvisionerOverbooking(mips)));

int hostId = FogUtils.generateEntityId();
long storage = 1000000;
int bw = 10000;

PowerHost host = new PowerHost(hostId,
new RamProvisionerSimple(ram),
new BwProvisionerOverbooking(bw),
storage, peList, new StreamOperatorScheduler(peList),
new FogLinearPowerModel(busyPower, idlePower));

List hostList = new ArrayList();
hostList.add(host);

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 storageList = new LinkedList();
FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics( arch, os,
vmm, host, time_zone, cost, costPerMem, costPerStorage, costPerBw);

FogDevice fogdevice = null;

try {
fogdevice = new FogDevice(nodeName, characteristics,
new AppModuleAllocationPolicy(hostList), storageList,10, upBw, downBw, 0,
ratePerMips);

} catch (Exception e)
{
e.printStackTrace();
}

fogdevice.setLevel(level);
return fogdevice;
}
}