Browse Source

Adds Bedroom to Toy Example

Andreas T. Meyer-Berg 4 years ago
parent
commit
838f24e108

+ 73 - 1
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/MenuBarNetworkExamples.java

@@ -26,6 +26,7 @@ import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices.BoolCollectorDevice;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices.BoolSensorDevice;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices.FloatCollectorDevice;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.devices.FloatSensorDevice;
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.distributionHandler.NormalDistributionHandler;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.protocols.MQTT_protocol;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.simpleImplementation.CountingMetric;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.simpleImplementation.Manipulation_RandomMove;
@@ -446,7 +447,25 @@ public class MenuBarNetworkExamples extends JMenu{
 		/*
 		 * ZigbeeRouter -> Broker ? 
 		 */
-		//TODO: router->Broker
+		Connection homeAutomationInternetAccess = new ConnectionPrecision();
+		homeAutomationInternetAccess.setName("Home Automation Webinterface");
+		networkController.addConnectionToLink(homeAutomationInternetAccess, zigbee);
+		homeAutomationInternetAccess.setProtocol(new SimpleProtocol());
+		Port pBrokerWebInterface = new Port(broker, (short)80);
+		pBrokerWebInterface.setTriggerHandler(new NormalDistributionHandler(2000, 500));
+		pBrokerWebInterface.setStatus(Port.SENDING);
+		pBrokerWebInterface.setResponseTime((short)2);
+		pBrokerWebInterface.setLastTrigger(-284L);
+		networkController.addDeviceToConnectionAndProtocol(pBrokerWebInterface, homeAutomationInternetAccess, 0);
+		networkController.addConnection(homeAutomationInternetAccess);
+		Port pRouterWebInterface = new Port(zigBeeRouter, (short)80);
+		pRouterWebInterface.setTriggerHandler(new NormalDistributionHandler(5000, 3000));
+		pRouterWebInterface.setStatus(Port.SENDING);
+		pRouterWebInterface.setResponseTime((short)2);
+		pRouterWebInterface.setLastTrigger(-142L);
+		networkController.addDeviceToConnectionAndProtocol(pRouterWebInterface, homeAutomationInternetAccess, 1);
+		networkController.addConnection(homeAutomationInternetAccess);
+		
 		
 		/*
 		 * Create MQTT Connection
@@ -464,6 +483,10 @@ public class MenuBarNetworkExamples extends JMenu{
 		/*
 		 * Add some MQTT Devices
 		 */
+		
+		/**
+		 * Kitchen Thermostat
+		 */
 		FloatSensorDevice floatSensor = new FloatSensorDevice("Kitchen Thermostat");
 		floatSensor.setFSinfoName("home/kitchen/temperature");
 		networkController.addLinkToDevice(zigbee, floatSensor);
@@ -472,6 +495,7 @@ public class MenuBarNetworkExamples extends JMenu{
 		floatSensor.setFSmax(32.0f);
 		networkController.addSmartDevice(floatSensor);
 		Port pFloatSensor = new Port(floatSensor, (short)1883, 15000);
+		pFloatSensor.setTriggerHandler(new NormalDistributionHandler(15000, 500));
 		pFloatSensor.setStatus(Port.SENDING);
 		pFloatSensor.setLastTrigger(-357L);
 		networkController.addDeviceToConnectionAndProtocol(pFloatSensor, mqtt,1);
@@ -488,6 +512,7 @@ public class MenuBarNetworkExamples extends JMenu{
 		networkController.addSmartDevice(kitchenFridge);
 		Port pKitchenFridge = new Port(kitchenFridge, (short)1883, 15000);
 		pKitchenFridge.setStatus(Port.SENDING);
+		pKitchenFridge.setTriggerHandler(new NormalDistributionHandler(15000, 500));
 		pKitchenFridge.setLastTrigger(-1231L);
 		networkController.addDeviceToConnectionAndProtocol(pKitchenFridge, mqtt,1);
 		
@@ -501,11 +526,58 @@ public class MenuBarNetworkExamples extends JMenu{
 		networkController.moveSmartDevice(kitchenLight, 250, 400, 50);
 		networkController.addSmartDevice(kitchenLight);
 		Port pKitchenLight = new Port(kitchenLight, (short)1883, 15000);
+		pKitchenLight.setTriggerHandler(new NormalDistributionHandler(15000, 500));
 		pKitchenLight.setStatus(Port.SENDING);
 		pKitchenLight.setLastTrigger(-1207L);
 		networkController.addDeviceToConnectionAndProtocol(pKitchenLight, mqtt,1);
 		
 		//TODO Further devices & Connections
+		
+		/*
+		 * Bedroom
+		 */
+		BoolSensorDevice sleepingRoomLight = new BoolSensorDevice("Bedroom Light");
+		sleepingRoomLight.setBSinfoName("home/bedroom/light");
+		networkController.addLinkToDevice(zigbee, sleepingRoomLight);
+		networkController.moveSmartDevice(sleepingRoomLight, 750, 400, 50);
+		networkController.addSmartDevice(sleepingRoomLight);
+		Port pBedroomLight = new Port(sleepingRoomLight, (short)1883, 15000);
+		pBedroomLight.setTriggerHandler(new NormalDistributionHandler(15000, 500));
+		pBedroomLight.setStatus(Port.SENDING);
+		pBedroomLight.setLastTrigger(-1337L);
+		networkController.addDeviceToConnectionAndProtocol(pBedroomLight, mqtt,1);
+		
+		/*
+		 * Bedroom Thermostat
+		 */
+		FloatSensorDevice bedroomThermostat = new FloatSensorDevice("Bedroom Thermostat");
+		bedroomThermostat.setFSinfoName("home/bedroom/temperature");
+		networkController.addLinkToDevice(zigbee, bedroomThermostat);
+		networkController.moveSmartDevice(bedroomThermostat, 700, 500, 50);
+		bedroomThermostat.setFSmin(15.0f);
+		bedroomThermostat.setFSmax(32.0f);
+		networkController.addSmartDevice(bedroomThermostat);
+		Port pBedroomThermostat = new Port(bedroomThermostat, (short)1883, 15000);
+		pBedroomThermostat.setTriggerHandler(new NormalDistributionHandler(15000, 500));
+		pBedroomThermostat.setStatus(Port.SENDING);
+		pBedroomThermostat.setLastTrigger(-820L);
+		networkController.addDeviceToConnectionAndProtocol(pBedroomThermostat, mqtt,1);
+		
+		
+		/*
+		 * Bedroom Info Screen
+		 */
+		FloatCollectorDevice bedroomInfoScreen = new FloatCollectorDevice("Information Panel");
+		bedroomInfoScreen.setFCinfoName("home/kitchen/fridgeTemp");
+		networkController.addLinkToDevice(zigbee, bedroomInfoScreen);
+		networkController.moveSmartDevice(bedroomInfoScreen, 900, 600, 50);
+		networkController.addSmartDevice(bedroomInfoScreen);
+		Port pBedroomInfo = new Port(bedroomInfoScreen, (short)1883, 15000);
+		pBedroomInfo.setStatus(Port.SENDING);
+		pBedroomInfo.setTriggerHandler(new NormalDistributionHandler(15000, 500));
+		pBedroomInfo.setLastTrigger(-666L);
+		networkController.addDeviceToConnectionAndProtocol(pBedroomInfo, mqtt,1);
+		
 		/* 
 		 * Update visualization 
 		 */