Amazing technological breakthrough possible @S-Logix

Office Address

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

Social List

How to add modules to the fog devices in iFogSim?


Adding modules to the fog devices without implementing the module placement. Cloud mode is set to FALSE, all the modules will be placed on fog nodes and all the computational operations will be performed at fog nodes. In case if cloud mode is set to TRUE, then all the modules will be placed on cloud server and all the computations will be performed on cloud server.

Source Code

public class IntelligentSurveillance {

static List fogDevices = new ArrayList();

static List sensors = new ArrayList();

static List actuators = new ArrayList();

static int numOfAreas = 1;

static int numOfCamerasPerArea = 4;

private static boolean CLOUD = false;

public static void main(String[] args) {

Log.printLine("Starting Intelligent Surveillance...");

try {


int num_user = 1; // number of cloud users

Calendar calendar = Calendar.getInstance();

boolean trace_flag = false; // mean trace events

CloudSim.init(num_user, calendar, trace_flag);

String appId = "Intelligent Surveillance"; // identifier of the application

FogBroker broker = new FogBroker("broker");

Application application = createApplication(appId, broker.getId());


createFogDevices(broker.getId(), appId);

Controller controller = null;

ModuleMapping moduleMapping = ModuleMapping.createModuleMapping();

moduleMapping.addModuleToDevice("user_interface", "cloud");

if (CLOUD) {

moduleMapping.addModuleToDevice("object_detector", "cloud"); moduleMapping.addModuleToDevice("object_tracker", "cloud");

moduleMapping.addModuleToDevice("motion_detector", "cloud");


controller = new Controller("master-controller", fogDevices, sensors,



(CLOUD)?(new ModulePlacementMapping(fogDevices, application, moduleMapping))

:(new ModulePlacementEdgewards(fogDevices, sensors, actuators, application, moduleMapping)));




Log.printLine("Intelligent Surveillance finished!");

} catch (Exception e) {


Log.printLine("Unwanted errors happen");



Cloud mode is “FALSE”,Cloud mode is “TRUE”
To add modules to the fog devices
Cloud mode is “FALSE”,Cloud mode is “TRUE”