|
@@ -864,7 +864,7 @@ public class MenuBarNetworkExamples extends JMenu{
|
|
|
/*
|
|
|
* Add Heater (every second update)
|
|
|
*/
|
|
|
- SmartTemperatureProducer heaterDevice = new SmartTemperatureProducer(roomName + " Heater", room, 1000, heatSensor);
|
|
|
+ SmartTemperatureProducer heaterDevice = new SmartTemperatureProducer(roomName + " Heater", room, 500, heatSensor);
|
|
|
heaterDevice.setFSinfoName("home/" + roomName + "/heaterTemp");
|
|
|
networkController.addLinkToDevice(zigbee, heaterDevice);
|
|
|
networkController.moveSmartDevice(heaterDevice, 300, 500, 50);
|
|
@@ -883,7 +883,7 @@ public class MenuBarNetworkExamples extends JMenu{
|
|
|
/*
|
|
|
* Add light Sensor
|
|
|
*/
|
|
|
- SmartLightSensor lightSensor = new SmartLightSensor(roomName + " LightSensor", room, 10000);
|
|
|
+ SmartLightSensor lightSensor = new SmartLightSensor(roomName + " LightSensor", room, 1000);
|
|
|
lightSensor.setBSinfoName("home/" + roomName + "/light");
|
|
|
networkController.addLinkToDevice(zigbee, lightSensor);
|
|
|
networkController.moveSmartDevice(lightSensor, 500, 300, 50);
|
|
@@ -1001,20 +1001,20 @@ public class MenuBarNetworkExamples extends JMenu{
|
|
|
*/
|
|
|
NormalDistribution tempDist = new NormalDistribution(2*hour, hour/2);
|
|
|
eventTime = 0;
|
|
|
- while(eventTime < endTime + 1 * hour) {
|
|
|
+ while(eventTime < 27 * hour) {
|
|
|
/**
|
|
|
* At least 1 second between events
|
|
|
*/
|
|
|
- eventTime+=Math.max(1000, Math.round(tempDist.sample()));
|
|
|
SimulationManager.scheduleEvent(new AbstractEvent(eventTime) {
|
|
|
|
|
|
@Override
|
|
|
public void simulateEvent(long time) {
|
|
|
- float newTemp = (float)(heaterDevice.getFSmax() + Math.random() * (heaterDevice.getFSmax()-heaterDevice.getFSmin()));
|
|
|
- heaterDevice.setFSval(newTemp);
|
|
|
+ float newTemp = (float)(heaterDevice.getFSmin() + Math.random() * (heaterDevice.getFSmax()-heaterDevice.getFSmin()));
|
|
|
heaterDevice.setFSval(newTemp);
|
|
|
+ heaterDevice.setTrueTemperature(newTemp);
|
|
|
}
|
|
|
});
|
|
|
+ eventTime+=Math.max(1000, Math.round(tempDist.sample()));
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1041,7 +1041,7 @@ public class MenuBarNetworkExamples extends JMenu{
|
|
|
|
|
|
|
|
|
/*
|
|
|
- * Simulate/Test 1 hour without anomalies
|
|
|
+ * Simulate/Test 2 hour without anomalies
|
|
|
*/
|
|
|
snifferKNN.setCurrentScenario("NoAnomalies");
|
|
|
System.out.println("Test w/0 anomalies:");//TODO
|
|
@@ -1059,11 +1059,12 @@ public class MenuBarNetworkExamples extends JMenu{
|
|
|
*/
|
|
|
snifferKNN.setCurrentScenario("LightAnomalies");
|
|
|
System.out.println("Light Anomaly:");
|
|
|
- smartLight.setTrueStatus(smartLight.getBSval());
|
|
|
+ smartLight.setTrueStatus(!smartLight.getBSval());
|
|
|
smartLight.setLabel((short)-1);
|
|
|
for(int i=26; i<27; i++)
|
|
|
sim.getSimulationManager().simulateTimeIntervall(hour*i, hour);
|
|
|
smartLight.setLabel((short)0);
|
|
|
+ smartLight.setBSval(smartLight.isTrueStatus());
|
|
|
|
|
|
new_time = System.currentTimeMillis();
|
|
|
elapsed_time = new_time-currentTime;
|