@Override public void step () { for (EvCustomer customer : evCustomers) { customer.step(service.getTimeslotRepo().currentTimeslot()); } }
private Instant getNowInstant () { return service.getTimeslotRepo().currentTimeslot().getStartInstant(); }
@Override public CapacityProfile getCapacityProfile (Tariff tariff) { Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); double drain = capacityKWh * (1.0 - chargeEfficiency) / 2.0; double[] profile = new double[24]; Arrays.fill(profile, drain); return new CapacityProfile (profile, start); } }
/** * This is the basic evaluation function, taking into consideration the * minimum cost without shifting the appliances' load but the tariff chosen * is * picked up randomly by using a possibility pattern. The better tariffs * have * more chances to be chosen. */ @Override public void evaluateTariffs (List<Tariff> newTariffs) { for (CustomerInfo customer: getCustomerInfos()) { log.info("Customer " + customer.toString() + " is evaluating tariffs for timeslot " + service.getTimeslotRepo().currentSerialNumber()); TariffEvaluator evaluator = tariffEvaluators.get(customer); evaluator.evaluateTariffs(); } }
/** * This is the basic evaluation function, taking into consideration the * minimum cost without shifting the appliances' load but the tariff chosen * is * picked up randomly by using a possibility pattern. The better tariffs * have * more chances to be chosen. */ @Override public void evaluateTariffs (List<Tariff> tariffs) { for (CustomerInfo customer: getCustomerInfos()) { log.info("Customer " + customer.toString() + " evaluating tariffs for timeslot " + service.getTimeslotRepo().currentTimeslot().getId()); TariffEvaluator evaluator = tariffEvaluators.get(customer); evaluator.evaluateTariffs(); } }
public void consumePower () { Timeslot ts = service.getTimeslotRepo().currentTimeslot(); int serial; for (CustomerInfo customer: getCustomerInfos()) { List<TariffSubscription> subscriptions = service.getTariffSubscriptionRepo() .findActiveSubscriptionsForCustomer(customer); String temp = officeMapping.get(customer); String type = temp.substring(0, 2); boolean controllable = temp.contains("Controllable"); if (ts == null) { log.error("Current timeslot is null"); serial = 0; } else { log.debug("Timeslot Serial: " + ts.getSerialNumber()); serial = ts.getSerialNumber(); } double load = getConsumptionByTimeslot(serial, type, controllable); log.debug("Consumption Load for Customer " + customer.toString() + ": " + load + " for subscriptions " + subscriptions.toString()); if (subscriptions != null && subscriptions.size() != 0) { subscriptions.get(0).usePower(load); } } }
@Override public void step () { int serial = service.getTimeslotRepo().currentSerialNumber(); Timeslot ts = service.getTimeslotRepo().currentTimeslot(); // TODO - this code assumes that games start at midnight. Bad assumption. int day = (int) (serial / VillageConstants.HOURS_OF_DAY); int hour = ts.getStartTime().getHourOfDay(); Instant now = ts.getStartInstant(); weatherCheck(day, hour, now); checkCurtailment(serial, day, hour); consumePower(); // for (Household house: getHouses()) // house.test(); if (hour == 23) { for (String type: numberOfHouses.keySet()) { if (!(type.equals("NS"))) { log.info("Rescheduling " + type); rescheduleNextDay(type); } } } }
public void consumePower () Timeslot ts = service.getTimeslotRepo().currentTimeslot(); int serial;
int serial = service.getTimeslotRepo().currentSerialNumber(); int day = (int) (serial / VillageConstants.HOURS_OF_DAY) + 1;
@Override public void step () { int serial = service.getTimeslotRepo().currentSerialNumber(); Timeslot ts = service.getTimeslotRepo().currentTimeslot(); // TODO - this code assumes that games start at midnight. Bad assumption. int day = (int) (serial / OfficeComplexConstants.HOURS_OF_DAY); int hour = ts.getStartTime().getHourOfDay(); Instant now = ts.getStartInstant(); weatherCheck(day, hour, now); // checkRevokedSubscriptions(); checkCurtailment(serial, day, hour); consumePower(); // for (Office office: getOffices()) // office.test(); if (hour == 23) { for (String type: numberOfOffices.keySet()) { if (!(type.equals("NS"))) { log.info("Rescheduling " + type); rescheduleNextDay(type); } } } }
int serial = service.getTimeslotRepo().currentSerialNumber(); int day = (int) (serial / OfficeComplexConstants.HOURS_OF_DAY) + 1;
service.getTimeslotRepo().currentSerialNumber() + 1; int nextDay = (int) (nextSerial / OfficeComplexConstants.HOURS_OF_DAY); int nextHour = (int) (nextSerial % OfficeComplexConstants.HOURS_OF_DAY);
protected Instant startOfDay () { Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); return start.toDateTime(DateTimeZone.UTC).withHourOfDay(0).toInstant(); }
int nextSerial = service.getTimeslotRepo().currentSerialNumber() + 1;
protected Instant nextStartOfDay () { Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); return start.toDateTime(DateTimeZone.UTC) .withHourOfDay(0).toInstant().plus(TimeService.DAY); }
protected Instant lastSunday () { Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); return start.toDateTime(DateTimeZone.UTC) .withDayOfWeek(1).withHourOfDay(0).toInstant(); }
double[] getPrices () { if (null != this.prices) return prices; double nhc = getNominalHourlyConsumption(); prices = new double[profileSize]; double cumulativeUsage = 0.0; Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); for (int i = 0; i < profileSize; i++) { Instant when = start.plus(i * TimeService.HOUR); if (when.get(DateTimeFieldType.hourOfDay()) == 0) { cumulativeUsage = 0.0; } prices[i] = tariff.getUsageCharge(when, nhc, cumulativeUsage) / nhc; cumulativeUsage += nhc; } return prices; }
/** * TODO: this does not appear to be a reasonable profile */ @Override public CapacityProfile getCapacityProfile (Tariff tariff) { double[] result = new double[config.getProfileLength()]; for (int i = 0; i < result.length; i++) { result[i] = getDominantLoad() / hrsPerDay; } // Assume profile starts at midnight Instant start = service.getTimeslotRepo().currentTimeslot().getStartInstant(); return new CapacityProfile(result, start.toDateTime(DateTimeZone.UTC) .withHourOfDay(0).toInstant() .plus(TimeService.DAY)); }