/** * Removes customerCount customers (at most) from this subscription, * posts early-withdrawal fees if appropriate. */ public void unsubscribe (int customerCount) { getTariffMarket().subscribeToTariff(getTariff(), getCustomer(), -customerCount); pendingUnsubscribeCount += customerCount; }
/** * Removes all subscriptions for the given tariff. Presumably this is done * when the tariff has been revoked and all revocation processing is complete. */ public void removeSubscriptionsForTariff (Tariff tariff) { List<TariffSubscription> subs = tariffMap.get(tariff); if (null == subs) return; // first, remove the subscriptions from the customer map and broker map for (TariffSubscription sub : subs) { customerMap.get(sub.getCustomer()).remove(sub); } for (TariffSubscription sub : subs) { brokerMap.get(sub.getTariff().getBroker()).remove(sub); } // then clear out the tariff entry tariffMap.remove(tariff); }
/** Unsubscribing a certain population amount from a certain subscription */ void unsubscribe (TariffSubscription subscription, int customerCount) { subscription.unsubscribe(customerCount); log.info(this.toString() + " " + subscription.getTariff().getPowerType().toString() + ": " + customerCount + " were unsubscribed from tariff " + subscription.getTariff().getId()); } }
/** Adds an existing subscription to the repo. */ public TariffSubscription add (TariffSubscription subscription) { storeSubscription(subscription, subscription.getCustomer(), subscription.getTariff()); return subscription; }
private void addSupersedingTariffs (HashSet<Tariff> newTariffs) { List<TariffSubscription> revokedSubscriptions = getTariffSubscriptionRepo().getRevokedSubscriptionList(customerInfo); for (TariffSubscription sub : revokedSubscriptions) { Tariff supTariff = sub.getTariff().getIsSupersededBy(); if (null != supTariff && supTariff.isSubscribable()) newTariffs.add(supTariff); } }
@Override public CapacityAccumulator useCapacity (TariffSubscription subscription) { int timeslot = timeslotRepo.currentSerialNumber(); // we don't re-adjust for current weather here; // would not be accurate for wind/solar production // // Daniel: try to get per sub first, if doesn't work get the // old, averaged one double forecastCapacity = getForecastCapacityPerSub(timeslot, subscription); double adjustedCapacity = forecastCapacity; adjustedCapacity = adjustCapacityForSubscription( timeslot, adjustedCapacity, subscription); if (Double.isNaN(adjustedCapacity)) { throw new Error("Adjusted capacity is NaN for forecast capacity = " + forecastCapacity); } CapacityAccumulator result = addRegCapacityMaybe(subscription, timeslot, adjustedCapacity); actualCapacities.put(timeslot, result.getCapacity()); log.info(logIdentifier + ": Adjusted capacity for tariff " + subscription.getTariff().getId() + " = " + result.getCapacity()); return result; }
+ getControllableConsumptions(dayTemp, type).toString()); double[] newControllableLoad = dailyShifting(sub.getTariff(), nonDominantUsage, dayTemp, type, nextStartOfDay());
+ getControllableConsumptions(dayTemp, type).toString()); double[] newControllableLoad = dailyShifting(sub.getTariff(), nonDominantUsage, dayTemp, type);
/** * Communicates the ability of the customer model to handle regulation * requests. Quantities are per-member. * * NOTE: This method must be called once/timeslot for any customer that * offers regulation capacity, because otherwise the capacity will be * carried over from the previous timeslot. */ //@StateChange public void setRegulationCapacity (RegulationCapacity capacity) { double upRegulation = capacity.getUpRegulationCapacity(); double downRegulation = getTariff().overpricedDownRegulationRatio() * capacity.getDownRegulationCapacity(); regulationAccumulator = new RegulationAccumulator(upRegulation, downRegulation); }
@Override public CapacityAccumulator useCapacity (TariffSubscription subscription) { int timeslot = timeslotRepo.currentSerialNumber(); double baseCapacity = getBaseCapacity(timeslot); if (Double.isNaN(baseCapacity)) { throw new Error("Base capacity is NaN!"); } //else if (parentBundle.getPowerType().isProduction()) { // // correct sign before going further // baseCapacity *= -1.0; //} logCapacityDetails(logIdentifier + ": Base capacity for timeslot " + timeslot + " = " + baseCapacity); // total adjusted capacity double adjustedCapacity = baseCapacity; adjustedCapacity = adjustCapacityForPeriodicSkew(adjustedCapacity, timeService.getCurrentDateTime(), true); adjustedCapacity = adjustCapacityForCurrentWeather(adjustedCapacity, true); // moved up one level //adjustedCapacity = // adjustCapacityForSubscription(timeslot, adjustedCapacity, subscription); CapacityAccumulator result = addRegCapacityMaybe(subscription, timeslot, adjustedCapacity); actualCapacities.put(timeslot, result.getCapacity()); log.info(logIdentifier + ": Adjusted capacity for tariff " + subscription.getTariff().getId() + " = " + result.getCapacity()); return result; }
if (0 == pendingUnsubscribeCount) { log.info("regulation capacity for " + getCustomer().getName() + ":" + this.getTariff().getId() + " (" + up + ", " + down + ")"); return new RegulationAccumulator(up, down); / customersCommitted; log.info("remaining regulation capacity for " + getCustomer().getName() + ":" + this.getTariff().getId() + " reduced by " + ratio + " to (" + up * ratio + ", " + down * ratio + ")");
tariff2inconv.put(sub.getTariff(), inconvenienceFactor);
private double adjustCapacityForTariffRates ( int timeslot, double baseCapacity, TariffSubscription subscription) { if ((baseCapacity - 0.0) < 0.01) { return baseCapacity; } double chargeForBase = subscription.getTariff().getUsageCharge( timeslotRepo.getTimeForIndex(timeslot), baseCapacity, subscription.getTotalUsage()); double rateForBase = chargeForBase / baseCapacity; double benchmarkRate = capacityStructure.getBenchmarkRate(timeService.getHourOfDay()); double rateRatio = rateForBase / benchmarkRate; double tariffRatesFactor = determineTariffRatesFactor(rateRatio); logCapacityDetails(logIdentifier + ": tariff rates factor = " + tariffRatesFactor); return baseCapacity * tariffRatesFactor; }
private double computeProfileUsageChargePerSub (CapacityProfile profile, TariffSubscription subscription, CapacityOriginator capacityOriginator) { int timeslot = getTimeslotRepo().currentSerialNumber(); double totalCharge = 0.0; for (int i = 0; i < CapacityProfile.NUM_TIMESLOTS; ++i) { double totalTimeslotUsage = profile.getCapacity(i); double timeslotCharge = 0.0; double subTimeslotUsage = capacityOriginator.adjustCapacityForSubscription(timeslot, totalTimeslotUsage, subscription); timeslotCharge += subscription.getTariff().getUsageCharge(getTimeslotRepo().getTimeForIndex(timeslot), subTimeslotUsage, 0.0); // TODO: why cumulative usage is 0? totalCharge += timeslotCharge; timeslot += 1; } return totalCharge; }
: getTariffSubscriptionRepo(). findActiveSubscriptionsForCustomer(customerInfo)) { Tariff subTariff = subscription.getTariff();
private ProfileRecommendation getProfileRecommendationPerSub (CapacityOriginator capacityOriginator, CapacityBundle bundle, ForecastRecord forecastRecord, Map<CapacityOriginator, Map<TariffSubscription, List<CapacityProfile>>> permsPerSub, TariffSubscription sub) { logRecommendationDetails("getProfileRecommendationPerSub(" + sub.getCustomer().getName() + ", " + sub.getTariff().getId() + ") Forecast " + forecastRecord.capacityProfile + " usage charge = " + forecastRecord.usageCharge); ProfileRecommendation rec = new ProfileRecommendation(); for (CapacityProfile perm : permsPerSub.get(capacityOriginator).get(sub)) { double usageCharge = computeProfileUsageChargePerSub(perm, sub, capacityOriginator); if (isPermutationAcceptable(capacityOriginator, bundle.getOptimizerStructure(), usageCharge, forecastRecord.usageCharge)) { Opinion opinion = rec.new Opinion(); // avoid duplication opinion.usageCharge = usageCharge; opinion.profileChange = forecastRecord.capacityProfile.distanceTo(perm); rec.setOpinion(perm, opinion); } } if (!rec.isEmpty()) { computeDerivedValues(rec, bundle.getOptimizerStructure()); } return rec; }
if (getTariff().hasRegulationRate()) { if (pendingRegulationRatio < 0.0) {
double useEnergy (double regulation) Tariff tariff = subscription.getTariff(); ensureCapacityPlan(tariff);
if (Config.getInstance().isUsageChargesLogging()) { double charge = subscription.getTariff().getUsageCharge(currCapacity, subscription .getTotalUsage(),