diff --git a/bin/org/fog/placement/ModulePlacementEdgewards$1.class b/bin/org/fog/placement/ModulePlacementEdgewards$1.class index 7544fe6..d24753a 100644 Binary files a/bin/org/fog/placement/ModulePlacementEdgewards$1.class and b/bin/org/fog/placement/ModulePlacementEdgewards$1.class differ diff --git a/bin/org/fog/placement/ModulePlacementEdgewards$2.class b/bin/org/fog/placement/ModulePlacementEdgewards$2.class index 6ceb60f..3f54e34 100644 Binary files a/bin/org/fog/placement/ModulePlacementEdgewards$2.class and b/bin/org/fog/placement/ModulePlacementEdgewards$2.class differ diff --git a/bin/org/fog/placement/ModulePlacementEdgewards.class b/bin/org/fog/placement/ModulePlacementEdgewards.class index 5ee74ff..509a048 100644 Binary files a/bin/org/fog/placement/ModulePlacementEdgewards.class and b/bin/org/fog/placement/ModulePlacementEdgewards.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes$1.class b/bin/org/fog/test/perfeval/Birbnetes$1.class index 863fc78..fcee6e4 100644 Binary files a/bin/org/fog/test/perfeval/Birbnetes$1.class and b/bin/org/fog/test/perfeval/Birbnetes$1.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes$2.class b/bin/org/fog/test/perfeval/Birbnetes$2.class index bbc7e9b..e2efde8 100644 Binary files a/bin/org/fog/test/perfeval/Birbnetes$2.class and b/bin/org/fog/test/perfeval/Birbnetes$2.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes$3.class b/bin/org/fog/test/perfeval/Birbnetes$3.class new file mode 100644 index 0000000..2f4c9c2 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes$3.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes$4.class b/bin/org/fog/test/perfeval/Birbnetes$4.class new file mode 100644 index 0000000..839eded Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes$4.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes$5.class b/bin/org/fog/test/perfeval/Birbnetes$5.class new file mode 100644 index 0000000..cf524f9 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes$5.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes.class b/bin/org/fog/test/perfeval/Birbnetes.class index 9592208..5035841 100644 Binary files a/bin/org/fog/test/perfeval/Birbnetes.class and b/bin/org/fog/test/perfeval/Birbnetes.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$1.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$1.class new file mode 100644 index 0000000..e4bf98b Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$1.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$2.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$2.class new file mode 100644 index 0000000..48d0648 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$2.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$3.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$3.class new file mode 100644 index 0000000..d2a3115 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$3.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$4.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$4.class new file mode 100644 index 0000000..d785fea Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$4.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$5.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$5.class new file mode 100644 index 0000000..f80fdcd Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$5.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$6.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$6.class new file mode 100644 index 0000000..699a6e5 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$6.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$7.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$7.class new file mode 100644 index 0000000..59f5653 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$7.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$8.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$8.class new file mode 100644 index 0000000..f4e2497 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog$8.class differ diff --git a/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.class b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.class new file mode 100644 index 0000000..86da636 Binary files /dev/null and b/bin/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.class differ diff --git a/bin/org/fog/test/perfeval/DCNSFog.class b/bin/org/fog/test/perfeval/DCNSFog.class index 1ba3f1b..7853824 100644 Binary files a/bin/org/fog/test/perfeval/DCNSFog.class and b/bin/org/fog/test/perfeval/DCNSFog.class differ diff --git a/src/org/fog/placement/ModulePlacementEdgewards.java b/src/org/fog/placement/ModulePlacementEdgewards.java index d90d2f5..16941fa 100644 --- a/src/org/fog/placement/ModulePlacementEdgewards.java +++ b/src/org/fog/placement/ModulePlacementEdgewards.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.math3.util.Pair; +import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.core.CloudSim; import org.fog.application.AppEdge; import org.fog.application.AppModule; @@ -220,6 +221,8 @@ public class ModulePlacementEdgewards extends ModulePlacement{ // FINDING OUT WHETHER PLACEMENT OF OPERATOR ON DEVICE IS POSSIBLE for(AppEdge edge : getApplication().getEdges()){ // take all incoming edges if(edge.getDestination().equals(moduleName)){ + Log.printLine(moduleName); + Log.printLine(edge.getDestination()); double rate = appEdgeToRate.get(edge); totalCpuLoad += rate*edge.getTupleCpuLength(); } diff --git a/src/org/fog/test/perfeval/Birbnetes.java b/src/org/fog/test/perfeval/Birbnetes.java index 062ab95..4ff3374 100644 --- a/src/org/fog/test/perfeval/Birbnetes.java +++ b/src/org/fog/test/perfeval/Birbnetes.java @@ -74,15 +74,15 @@ public class Birbnetes { application.addAppModule("MainModule", 120); application.addAppModule("StorageModule", 120); - application.addAppEdge("Sensor", "ClientModule", 50, 8800, + application.addAppEdge("Sensor", "ClientModule", 4500, 8800, "Sensor", Tuple.UP, AppEdge.SENSOR); - application.addAppEdge("ClientModule", "MainModule", 100, + application.addAppEdge("ClientModule", "MainModule", 3000, 1000, "PreProcessedData", Tuple.UP, AppEdge.MODULE); - application.addAppEdge("ClientModule", "StorageModule", 10, + application.addAppEdge("ClientModule", "StorageModule", 2500, 8800, "StoreData", Tuple.UP, AppEdge.MODULE); - application.addAppEdge("MainModule", "ClientModule", 200, + application.addAppEdge("MainModule", "ClientModule", 2000, 1000, "ProcessedData", Tuple.DOWN, AppEdge.MODULE); - application.addAppEdge("ClientModule", "Actuators", 50, 1000, + application.addAppEdge("ClientModule", "Actuators", 6000, 1000, "OutputData", Tuple.DOWN, AppEdge.ACTUATOR); application.addTupleMapping("ClientModule", "Sensor", "PreProcessedData", new FractionalSelectivity(1.0)); @@ -93,15 +93,27 @@ public class Birbnetes { "OutputData", new FractionalSelectivity(1.0)); final AppLoop loop1 = new AppLoop(new ArrayList<>() {{ - add("Sensor"); add("ClientModule"); add("StorageModule"); + }}); + final AppLoop loop2 = new AppLoop(new ArrayList<>() {{ + add("ClientModule"); + add("MainModule"); + add("ClientModule"); + }}); + final AppLoop loop3 = new AppLoop(new ArrayList<>() {{ + add("ClientModule"); + add("MainModule"); + }}); + final AppLoop loop4 = new AppLoop(new ArrayList<>() {{ add("MainModule"); add("ClientModule"); - add("Actuator"); }}); List loops = new ArrayList<>() {{ add(loop1); + add(loop2); + add(loop3); + add(loop4); }}; application.setLoops(loops); return application; @@ -114,7 +126,7 @@ public class Birbnetes { Sensor sensor = new Sensor("s-" + id, "Sensor", brokerId, appId, new DeterministicDistribution(getValue(5.00))); sensors.add(sensor); Actuator actuator = new Actuator("a-" + id, brokerId, appId, - "OutputData"); + "Actuators"); actuators.add(actuator); sensor.setGatewayDeviceId(lowLevelFogDevice.getId()); sensor.setLatency(10.0); diff --git a/src/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.java b/src/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.java index 28be0ad..0a2f20b 100644 --- a/src/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.java +++ b/src/org/fog/test/perfeval/Birbnetes_copyofdcnsfog.java @@ -36,27 +36,25 @@ import java.util.List; * */ public class Birbnetes_copyofdcnsfog { - static List fogDevices = new ArrayList(); - static List sensors = new ArrayList(); - static List actuators = new ArrayList(); + 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; - + static int numOfClientsPerArea = 4; + public static void main(String[] args) { - Log.printLine("Starting DCNS..."); + Log.printLine("Starting birbnetes..."); try { - Log.disable(); + //Log.disable(); 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 = "dcns"; // identifier of the application + String appId = "birbnetes"; // identifier of the application FogBroker broker = new FogBroker("broker"); @@ -65,19 +63,20 @@ public class Birbnetes_copyofdcnsfog { createFogDevices(broker.getId(), appId); - Controller controller = null; + Controller controller; ModuleMapping moduleMapping = ModuleMapping.createModuleMapping(); // initializing a module mapping for(FogDevice device : fogDevices){ if(device.getName().startsWith("m")){ // names of all Smart Cameras start with 'm' - moduleMapping.addModuleToDevice("motion_detector", device.getName()); // fixing 1 instance of the Motion Detector module to each Smart Camera + moduleMapping.addModuleToDevice("input_svc", device.getName()); // fixing 1 instance of the Motion Detector module to each Smart Camera } } - moduleMapping.addModuleToDevice("user_interface", "cloud"); // fixing instances of User Interface module in the Cloud + moduleMapping.addModuleToDevice("alert_svc", "cloud"); // fixing instances of User Interface module in the Cloud + boolean CLOUD = false; if(CLOUD){ // if the mode of deployment is cloud-based - moduleMapping.addModuleToDevice("object_detector", "cloud"); // placing all instances of Object Detector module in the Cloud - moduleMapping.addModuleToDevice("object_tracker", "cloud"); // placing all instances of Object Tracker module in the Cloud + moduleMapping.addModuleToDevice("detector_svc", "cloud"); // placing all instances of Object Detector module in the Cloud + moduleMapping.addModuleToDevice("storage_svc", "cloud"); // placing all instances of Object Tracker module in the Cloud } controller = new Controller("master-controller", fogDevices, sensors, @@ -93,7 +92,7 @@ public class Birbnetes_copyofdcnsfog { CloudSim.stopSimulation(); - Log.printLine("VRGame finished!"); + Log.printLine("birbnetes finished!"); } catch (Exception e) { e.printStackTrace(); Log.printLine("Unwanted errors happen"); @@ -102,8 +101,8 @@ public class Birbnetes_copyofdcnsfog { /** * Creates the fog devices in the physical topology of the simulation. - * @param userId - * @param appId + * @param userId id of user/broker + * @param appId id of app */ private static void createFogDevices(int userId, String appId) { FogDevice cloud = createFogDevice("cloud", 44800, 40000, 100, 10000, 0, 0.01, 16*103, 16*83.25); @@ -118,26 +117,25 @@ public class Birbnetes_copyofdcnsfog { } } - private static FogDevice addArea(String id, int userId, String appId, int parentId){ + private static void addArea(String id, int userId, String appId, int parentId){ FogDevice router = createFogDevice("d-"+id, 2800, 4000, 10000, 10000, 1, 0.0, 107.339, 83.4333); fogDevices.add(router); router.setUplinkLatency(2); // latency of connection between router and proxy server is 2 ms - for(int i=0;i peList = new ArrayList(); + List peList = new ArrayList<>(); // 3. Create PEs and add these into a list. peList.add(new Pe(0, new PeProvisionerOverbooking(mips))); // need to store Pe id and MIPS Rating @@ -181,7 +179,7 @@ public class Birbnetes_copyofdcnsfog { new FogLinearPowerModel(busyPower, idlePower) ); - List hostList = new ArrayList(); + List hostList = new ArrayList<>(); hostList.add(host); String arch = "x86"; // system architecture @@ -193,7 +191,7 @@ public class Birbnetes_copyofdcnsfog { double costPerStorage = 0.001; // the cost of using storage in this // resource double costPerBw = 0.0; // the cost of using bw in this resource - LinkedList storageList = new LinkedList(); // we are not adding SAN + LinkedList storageList = new LinkedList<>(); // we are not adding SAN // devices by now FogDeviceCharacteristics characteristics = new FogDeviceCharacteristics( @@ -207,7 +205,8 @@ public class Birbnetes_copyofdcnsfog { } catch (Exception e) { e.printStackTrace(); } - + + assert fogdevice != null; fogdevice.setLevel(level); return fogdevice; } @@ -216,43 +215,48 @@ public class Birbnetes_copyofdcnsfog { * Function to create the Intelligent Surveillance application in the DDF model. * @param appId unique identifier of the application * @param userId identifier of the user of the application - * @return + * @return application */ - @SuppressWarnings({"serial" }) private static Application createApplication(String appId, int userId){ Application application = Application.createApplication(appId, userId); /* * Adding modules (vertices) to the application model (directed graph) */ - application.addAppModule("object_detector", 10); - application.addAppModule("motion_detector", 10); - application.addAppModule("object_tracker", 10); - application.addAppModule("user_interface", 10); + application.addAppModule("input_svc", 10); + application.addAppModule("detector_svc", 10); + application.addAppModule("storage_svc", 10); + application.addAppModule("alert_svc", 10); /* * Connecting the application modules (vertices) in the application model (directed graph) with edges */ - application.addAppEdge("CAMERA", "motion_detector", 1000, 20000, "CAMERA", Tuple.UP, AppEdge.SENSOR); // adding edge from CAMERA (sensor) to Motion Detector module carrying tuples of type CAMERA - application.addAppEdge("motion_detector", "object_detector", 2000, 2000, "MOTION_VIDEO_STREAM", Tuple.UP, AppEdge.MODULE); // adding edge from Motion Detector to Object Detector module carrying tuples of type MOTION_VIDEO_STREAM - application.addAppEdge("object_detector", "user_interface", 500, 2000, "DETECTED_OBJECT", Tuple.UP, AppEdge.MODULE); // adding edge from Object Detector to User Interface module carrying tuples of type DETECTED_OBJECT - application.addAppEdge("object_detector", "object_tracker", 1000, 100, "OBJECT_LOCATION", Tuple.UP, AppEdge.MODULE); // adding edge from Object Detector to Object Tracker module carrying tuples of type OBJECT_LOCATION - application.addAppEdge("object_tracker", "PTZ_CONTROL", 100, 28, 100, "PTZ_PARAMS", Tuple.DOWN, AppEdge.ACTUATOR); // adding edge from Object Tracker to PTZ CONTROL (actuator) carrying tuples of type PTZ_PARAMS + application.addAppEdge("SOUND", "input_svc", 1000, 20000, "SOUND", Tuple.UP, AppEdge.SENSOR); // adding edge from CAMERA (sensor) to Motion Detector module carrying tuples of type CAMERA + application.addAppEdge("input_svc", "detector_svc", 2000, 2000, "DATA", Tuple.UP, AppEdge.MODULE); // adding edge from Motion Detector to Object Detector module carrying tuples of type MOTION_VIDEO_STREAM + application.addAppEdge("detector_svc", "storage_svc", 500, 2000, "STORAGE_DATA", Tuple.UP, AppEdge.MODULE); // adding edge from Object Detector to User Interface module carrying tuples of type DETECTED_OBJECT + application.addAppEdge("detector_svc", "alert_svc", 1000, 100, "SMALL_DATA", Tuple.UP, AppEdge.MODULE); // adding edge from Object Detector to Object Tracker module carrying tuples of type OBJECT_LOCATION + application.addAppEdge("alert_svc", "MQTT_CONTROL", 100, 28, 100, "MQTT_DATA", Tuple.DOWN, AppEdge.ACTUATOR); // adding edge from Object Tracker to PTZ CONTROL (actuator) carrying tuples of type PTZ_PARAMS /* * Defining the input-output relationships (represented by selectivity) of the application modules. */ - application.addTupleMapping("motion_detector", "CAMERA", "MOTION_VIDEO_STREAM", new FractionalSelectivity(1.0)); // 1.0 tuples of type MOTION_VIDEO_STREAM are emitted by Motion Detector module per incoming tuple of type CAMERA - application.addTupleMapping("object_detector", "MOTION_VIDEO_STREAM", "OBJECT_LOCATION", new FractionalSelectivity(1.0)); // 1.0 tuples of type OBJECT_LOCATION are emitted by Object Detector module per incoming tuple of type MOTION_VIDEO_STREAM - application.addTupleMapping("object_detector", "MOTION_VIDEO_STREAM", "DETECTED_OBJECT", new FractionalSelectivity(0.05)); // 0.05 tuples of type MOTION_VIDEO_STREAM are emitted by Object Detector module per incoming tuple of type MOTION_VIDEO_STREAM - + application.addTupleMapping("input_svc", "SOUND", "DATA", new FractionalSelectivity(1.0)); // 1.0 tuples of type MOTION_VIDEO_STREAM are emitted by Motion Detector module per incoming tuple of type CAMERA + application.addTupleMapping("detector_svc", "DATA", "SMALL_DATA", new FractionalSelectivity(1.0)); // 1.0 tuples of type OBJECT_LOCATION are emitted by Object Detector module per incoming tuple of type MOTION_VIDEO_STREAM + application.addTupleMapping("detector_svc", "DATA", "STORAGE_DATA", new FractionalSelectivity(1.0)); // 1.0 tuples of type OBJECT_LOCATION are emitted by Object Detector module per incoming tuple of type MOTION_VIDEO_STREAM + application.addTupleMapping("alert_svc", "SMALL_DATA", "MQTT_DATA", new FractionalSelectivity(1.0)); + /* * Defining application loops (maybe incomplete loops) to monitor the latency of. * Here, we add two loops for monitoring : Motion Detector -> Object Detector -> Object Tracker and Object Tracker -> PTZ Control */ - final AppLoop loop1 = new AppLoop(new ArrayList(){{add("motion_detector");add("object_detector");add("object_tracker");}}); - final AppLoop loop2 = new AppLoop(new ArrayList(){{add("object_tracker");add("PTZ_CONTROL");}}); - List loops = new ArrayList(){{add(loop1);add(loop2);}}; + final AppLoop loop1 = new AppLoop(new ArrayList<>(){{add("input_svc");add("detector_svc");add("alert_svc");}}); + final AppLoop loop2 = new AppLoop(new ArrayList<>(){{add("input_svc");add("detector_svc");add("storage_svc");}}); + final AppLoop loop3 = new AppLoop(new ArrayList<>(){{add("alert_svc");add("MQTT_CONTROL");}}); + final AppLoop loop4 = new AppLoop(new ArrayList<>(){{add("SOUND");add("input_svc");}}); + final AppLoop loop5 = new AppLoop(new ArrayList<>(){{add("input_svc");add("detector_svc");}}); + final AppLoop loop6 = new AppLoop(new ArrayList<>(){{add("detector_svc");add("storage_svc");}}); + final AppLoop loop7 = new AppLoop(new ArrayList<>(){{add("detector_svc");add("alert_svc");}}); + List loops = new ArrayList<>(){{add(loop1);add(loop2);add(loop3);add(loop4);add(loop5);add(loop6);add(loop7);}}; application.setLoops(loops); return application;