tariff.getUsageCharge(time, kwhPerTs, kwh) / kwhPerTs; if (null == currentBlock) { blockCost = cost;
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; }
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; }
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; }
getAccounting().addTariffTransaction(txType, tariff, customer, customersCommitted, -actualKwh, customersCommitted * -tariff.getUsageCharge(actualKwh / customersCommitted, totalUsage, true)); if (getTimeService().getHourOfDay() == 0) {
if (Config.getInstance().isUsageChargesLogging()) { double charge = subscription.getTariff().getUsageCharge(currCapacity, subscription .getTotalUsage(),