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 place the application in only cloud in iFogSim?

Description

The cloud-only placement strategy is based on the traditional cloud-based implementation of applications where all modules of an application run in only cloud datacenters.

Source Code

private void computeModuleInstanceCounts(){

FogDevice cloud = getDeviceById(CloudSim.getEntityId("cloud"));

getModuleInstanceCountMap().put(cloud.getId(), new HashMap());

for(Sensor sensor : getSensors()){

String sensorType = sensor.getSensorName();

if(!getModuleInstanceCountMap().get(cloud.getId()).containsKey( sensorType))

getModuleInstanceCountMap().get(cloud.getId()).put(sensorType, 0);

getModuleInstanceCountMap().get(cloud.getId()).put(sensorType, getModuleInstanceCountMap().get(cloud.getId()).get(sensorType) +1);

}

for(Actuator actuator : getActuators()){

String actuatorType = actuator.getActuatorType();

if(!getModuleInstanceCountMap().get(cloud.getId()).containsKey( actuatorType) )

getModuleInstanceCountMap().get(cloud.getId()).put(actuatorTyp e, 0);

getModuleInstanceCountMap().get(cloud.getId()).put(actuatorTyp e,getModuleInstanceCountMap().get(cloud.getId()).get(actuatorT yp e)+1);

}

while(!isModuleInstanceCalculationComplete()){

for(AppModule module : getApplication().getModules()){

int maxInstances = 0;

for(AppEdge edge : getApplication().getEdges()){

if(!getModuleInstanceCountMap().get(cloudId).containsKey(edge. getSource()))

continue;

if(edge.getDestination().equals(module.getName()) && edge.getDirection()==Tuple.UP){

maxInstances = Math.max(maxInstances, getModuleInstanceCountMap().get(cloudId).get(edge.getSource()) );

}

}

getModuleInstanceCountMap().get(cloudId).put(module.getName (), maxInstances);

}

}

System.out.println(getModuleInstanceCountMap());

}

Output

place the application in only cloud
The cloud-only placement strategy