private void consumePower (double[] loads, TariffSubscription sub) { sub.usePower(loads[0] + loads[1]); try { charge(loads[0] + loads[1]); } catch (ChargeException ce) { log.error(ce.getMessage()); } }
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); } } }
subscriptions.get(0).usePower(load);
subscription.setRegulationCapacity(new RegulationCapacity(subscription, up, down)); subscription.usePower(0.0);
getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging);
totalUsageCharge += charge; subscription.usePower(currCapacity); subscription.setRegulationCapacity(new RegulationCapacity(subscription, ca.getUpRegulationCapacity(),
getSubscription().usePower(totalEnergyUsed);