private String getName() { return customerInfo.getName(); }
HashMap<String, Integer> getCustomerCounts() { HashMap<String, Integer> result = new HashMap<String, Integer>(); for (TariffSpecification spec : customerSubscriptions.keySet()) { HashMap<CustomerInfo, CustomerRecord> customerMap = customerSubscriptions.get(spec); for (CustomerRecord record : customerMap.values()) { result.put(record.customer.getName() + spec.getPowerType(), record.subscribedPopulation); } } return result; }
void produceConsume (double kwh, int rawIndex) { fillBootstrapUsage(kwh, rawIndex); int index = getIndex(rawIndex); double kwhPerCustomer = kwh / (double)subscribedPopulation; double oldUsage = usage[index]; if (oldUsage == 0.0) { // assume this is the first time usage[index] = kwhPerCustomer; } else { // exponential smoothing usage[index] = alpha * kwhPerCustomer + (1.0 - alpha) * oldUsage; } log.debug("consume " + kwh + " at " + index + ", customer " + customer.getName()); }
private void updateSubscriptions () { int check = 0; for (Tariff tariff : allocations.keySet()) { int count = allocations.get(tariff); check += count; if (count < 0) { //unsubscribe TariffSubscription sub = getTariffSubscriptionRepo().findSubscriptionForTariffAndCustomer (tariff, customerInfo); sub.unsubscribe(-count); log.info("customer " + customerInfo.getName() + " unsubscribes " + -count + " from tariff " + tariff.getId()); } else if (count > 0) { // subscribe getTariffMarket().subscribeToTariff(tariff, customerInfo, count); log.info("customer " + customerInfo.getName() + " subscribes " + count + " to tariff " + tariff.getId()); } } // sanity check if (check != 0) { log.error("Subscription updates do not add up for " + customerInfo.getName() + ": " + check); } }
public void subscribeDefault (TariffMarket tariffMarketService) { for (CustomerInfo customer: getCustomerInfos()) { Tariff candidate = tariffMarketService.getDefaultTariff(customer.getPowerType()); if (null == candidate) { log.error("No default tariff for " + customer.getPowerType().toString()); } else { log.info("Subscribe " + customer.getName() + " to " + candidate.getPowerType().toString()); } tariffMarketService.subscribeToTariff(candidate, customer, customer.getPopulation()); } }
private double forecastCost (Tariff tariff) { CapacityProfile profile = accessor.getCapacityProfile(tariff); if (0 == profile.getProfile().length) { log.error("Zero-length profile for " + customerInfo.getName()); return 0.0; } setProfileLength(profile.getProfile().length); // NOTE: must call the next function after the previous, // since the previous writes inconv. factors. // Always 0 except for AdaptiveCapacityOriginator double inconv = accessor.getShiftingInconvenienceFactor(tariff); double profileCost = helper.estimateCost(tariff, profile.getProfile(), profile.getStart()); if (Double.isNaN(profileCost)) { log.error(getName() + ": profile cost NaN for tariff " + tariff.getId()); } //double scale = preferredDuration * 24.0 / profile.length; double scale = stdDuration * 24.0 / getProfileLength(); if (Double.isNaN(scale)) { log.error(getName() + ": scale NaN for tariff " + tariff.getId()); } log.debug("tariff {}: profileCost={}, inconv={}, scaled-charge={}, scaled (cost+inconv)={}", tariff.getId(), profileCost, inconv, profileCost * scale, (profileCost + inconv) * scale, (profileCost + inconv) * scale / (profileCost * scale)); return (profileCost + inconv) * scale; }
regulationAccumulator.getDownRegulationCapacity() * customersCommitted; if (0 == pendingUnsubscribeCount) { log.info("regulation capacity for " + getCustomer().getName() + ":" + this.getTariff().getId() + " (" + up + ", " + down + ")"); / customersCommitted; log.info("remaining regulation capacity for " + getCustomer().getName() + ":" + this.getTariff().getId() + " reduced by " + ratio + " to (" + up * ratio + ", " + down * ratio + ")");
log.error("Short boot record {} for customer {} -- filling with zeros", cbd.getNetUsage().length, customer.getName());
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; }
" customer " + customer.getName() + ": attempt to unsubscribe " + customerCount + " from subscription of " + customersCommitted);
", customer=" + customer.getName());
customer.getName(), result);