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.
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());
}