void removeRevokedTariffs () { if (null == revokedTariffs) return; for (Tariff tariff : revokedTariffs) { // remove all subscriptions tariffSubscriptionRepo.removeSubscriptionsForTariff(tariff); // then remove the tariff and the tariffSpec tariffRepo.removeTariff(tariff); } revokedTariffs = null; }
/** Adds a list of objects to the repo. */ public void add (List<Object> items) { for (Object item: items) { add(item); } }
@Override public List<Tariff> getActiveTariffList(PowerType type) { return tariffRepo.findActiveTariffs(type); }
private int getTimeslotIndex () { return timeslotRepo.currentSerialNumber(); }
/** * Returns the spot market price per kWh - * This is the most recent valid clearing price for the current timeslot. */ double getSpotPrice () { Double result = defaultSpotPrice; // most recent trade is determined by Competition parameters // orderbooks have timeslot and execution time Orderbook ob = orderbookRepo.findSpotByTimeslot(timeslotRepo.currentTimeslot()); if (ob != null) { result = ob.getClearingPrice(); } else { log.info("null Orderbook"); } return result / 1000.0; // convert to kwh }
/** * Initializes the instance. Called after configuration, and after * a call to setServices(). * TODO -- do we really want this here? */ public void initialize () { rs1 = service.getRandomSeedRepo().getRandomSeed(name, 0, "TariffChooser"); }
private int getTimeIndex (DateTime dateTime) { // Used for testing if (simulationBaseTime == null) { simulationBaseTime = timeslotRepo.currentTimeslot().getStartTime(); } long diff = dateTime.getMillis() - simulationBaseTime.getMillis(); return (int) (diff / (1000 * 3600)); }
@Override public void handleNewObject (Object thing) { CustomerInfo customer = (CustomerInfo)thing; customerRepo.add(customer); } }
@Override public void handleNewObject (Object thing) { Broker broker = (Broker)thing; log.info("add broker " + broker.getUsername()); brokerRepo.add(broker); } }
private List<TariffSubscription> getBundleSubscriptions (CapacityBundle bundle) { return getTariffSubscriptionRepo() .findSubscriptionsForCustomer(bundle.getCustomerInfo()); }
CustomerRecord (CustomerInfo customer, int population) { super(); this.customer = customer; this.subscribedPopulation = population; base = timeslotRepo.findBySerialNumber(0).getStartInstant(); }
/** * Returns the subscription, if any, for the specified tariff and customer. * Does not create a subscription in case it cannot be found in the repo. */ public TariffSubscription findSubscriptionForTariffAndCustomer (Tariff tariff, CustomerInfo customer) { List<TariffSubscription> subs = findSubscriptionsForTariff(tariff); if (subs == null) return null; for (TariffSubscription sub : subs) { if (sub.getCustomer() == customer) return sub; } return null; }
@Override public void handleNewObject (Object thing) { Timeslot timeslot = (Timeslot)thing; timeslotRepo.add(timeslot); }
@Override public boolean setDefaultTariff (TariffSpecification newSpec) { tariffRepo.setDefaultTariff(newSpec); return true; }
/** * Returns the default tariff */ @Override public Tariff getDefaultTariff (PowerType type) { return tariffRepo.getDefaultTariff(type); }
/** Adds an existing subscription to the repo. */ public TariffSubscription add (TariffSubscription subscription) { storeSubscription(subscription, subscription.getCustomer(), subscription.getTariff()); return subscription; }
@Override public CapacityProfile getCurrentForecast () { int timeslot = timeslotRepo.currentSerialNumber(); return getForecastForTimeslot(timeslot); }
@Override public void run () { cc.setAuthorizedBrokerList(brokers); cc.setInputQueueName(inputQueueName); Document document = getDocument(bootUrl); if (document != null) { if (preGame(document)) { bootstrapDataRepo.add(processBootDataset(document)); cc.runOnce(false); nextGameId(); } } } };
@Override public CapacityProfile getForecastForNextTimeslot () { int timeslot = timeslotRepo.currentSerialNumber(); return getForecastForTimeslot(timeslot + 1); }
@Override public CapacityProfile getCurrentForecastPerSub (TariffSubscription sub) { int timeslot = timeslotRepo.currentSerialNumber(); return getForecastPerSubStartingAt(timeslot, sub); }