X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=blobdiff_plain;f=benchmarks%2FJava%2FIrrigationController%2FLawnState.java;h=35583546a5ab5d3ecf1c8a9ac08c8c6bc382e9dc;hp=10ac4f0dc5a432fdb0a36ddcded3e1efdf391888;hb=02f34d5ef81b2605f3ee42fe62f0f62a7e292aaf;hpb=7a119d4b8c8f39801afb6a2de46682715cedf289 diff --git a/benchmarks/Java/IrrigationController/LawnState.java b/benchmarks/Java/IrrigationController/LawnState.java index 10ac4f0..3558354 100644 --- a/benchmarks/Java/IrrigationController/LawnState.java +++ b/benchmarks/Java/IrrigationController/LawnState.java @@ -204,8 +204,7 @@ public class LawnState extends UnicastRemoteObject implements MotionDetectionCal public boolean needsWateringUrgently(Date _currentDate) { // get difference between now and last time watered - // TODO: Remove this to uncommented!!! This is only for testing!!! -/* long timeElapsed = (_currentDate.getTime() - lastTimeWatered.getTime()) / 1000; + long timeElapsed = (_currentDate.getTime() - lastTimeWatered.getTime()) / 1000; // needs watering now urgently if (timeElapsed >= MAX_TIME_BETWEEN_WATERING_SESSIONS) { @@ -215,7 +214,7 @@ public class LawnState extends UnicastRemoteObject implements MotionDetectionCal // calculate the average moisture readings of all the // sensors in this lawn double averageMoistureValue = getAverageMoistureReading(); - + System.out.println("DEBUG: Average moisture value: " + averageMoistureValue); // is a valid average if (averageMoistureValue != -1) { // moisture is very low so we need to water now! @@ -228,11 +227,6 @@ public class LawnState extends UnicastRemoteObject implements MotionDetectionCal } return false; -*/ - double averageMoistureValue = getAverageMoistureReading(); -// System.out.println("DEBUG: Average moisture value: " + averageMoistureValue); - - return true; } @@ -502,12 +496,12 @@ public class LawnState extends UnicastRemoteObject implements MotionDetectionCal System.out.println("DEBUG: Current time stamp: " + currentTime.getTime()); System.out.println("Time elapsed: " + (currentTime.getTime() - readingTimestamp.getTime()) / 1000); - //long timeElapsedSinceLastWatering = (currentTime.getTime() - readingTimestamp.getTime()) / 1000; + long timeElapsedSinceLastWatering = (currentTime.getTime() - readingTimestamp.getTime()) / 1000; // if reading is old then dont use it since it is noise - //if (timeElapsedSinceLastWatering > TWO_HOURS) { - // continue; - //} + if (timeElapsedSinceLastWatering > TWO_HOURS) { + continue; + } // Do averaging numberOfReadings++;