private void handleRegulation (int day, int hour, TariffSubscription sub) { if (null == sub) return; // check for non-zero regulation request double actualRegulation = sub.getRegulation() * customerInfo.getPopulation(); if (Math.abs(actualRegulation) < capacityEpsilon) { return; } // compute the regulation factor and do the regulation log.info("{} regulate: {}", name, actualRegulation); double startCapacity = currentCapacity; try { if (actualRegulation > capacityEpsilon) { discharge(actualRegulation); } else if (actualRegulation < -capacityEpsilon) { charge(-1 * actualRegulation); } } catch (ChargeException ce) { log.error(name +" : "+ ce); } if (Math.abs(startCapacity - currentCapacity) > capacityEpsilon) { log.info(String.format("%s regulated from %.1f to %.1f", name, startCapacity, currentCapacity)); } }
double regulation = subscription.getRegulation(); log.info(getName() + ": regulation " + regulation); if (regulation > 0) {
(long) (subs.get(0).getRegulation()
double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation);
double regulation = getSubscription().getRegulation(); if (regulation != 0.0) {