/** * This function is utilized in order to check the weather at each time tick * of the competition clock and reschedule the appliances that are weather * sensitive to work. */ void weatherCheck (int day, int hour, Instant now) { int dayTemp = day % (VillageConstants.DAYS_OF_BOOTSTRAP + VillageConstants.DAYS_OF_COMPETITION); WeatherReport wr = null; wr = service.getWeatherReportRepo().currentWeatherReport(); if (wr != null) { double temperature = wr.getTemperature(); // log.debug("Temperature: " + temperature); Vector<Household> houses = getHouses(); for (Household house: houses) { house.weatherCheck(dayTemp, hour, now, temperature); } for (String type: numberOfHouses.keySet()) { updateAggDailyWeatherSensitiveLoad(type, day); if (dayTemp + 1 < VillageConstants.DAYS_OF_COMPETITION) { updateAggDailyWeatherSensitiveLoad(type, dayTemp + 1); } } } }
/** * This function is utilized in order to check the weather at each time tick * of the competition clock and reschedule the appliances that are weather * sensitive to work. */ void weatherCheck (int day, int hour, Instant now) { int dayTemp = day % (OfficeComplexConstants.DAYS_OF_BOOTSTRAP + OfficeComplexConstants.DAYS_OF_COMPETITION); WeatherReport wr = service.getWeatherReportRepo().currentWeatherReport(); if (wr != null) { double temperature = wr.getTemperature(); // log.debug("Temperature: " + temperature); Vector<Office> offices = getOffices(); for (Office office: offices) { office.weatherCheck(dayTemp, hour, now, temperature); } for (String type: numberOfOffices.keySet()) { updateAggDailyWeatherSensitiveLoad(type, day); if (dayTemp + 1 < OfficeComplexConstants.DAYS_OF_COMPETITION) { updateAggDailyWeatherSensitiveLoad(type, dayTemp + 1); } } } }
service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature();