private void exerciseControls (ChargeInfo broker, SortedSet<BOWrapper> candidates, double settlementValue) { for (BOWrapper candidate: candidates) { if (candidate.info == broker && 0.0 != candidate.exercisedCapacity) { // add up the exercised capacity first broker.addCurtailment(candidate.exercisedCapacity); } } for (BOWrapper candidate: candidates) { if (candidate.info == broker && 0.0 != candidate.exercisedCapacity) { // pro-rate settlement value over balancing orders double boValue = settlementValue * candidate.exercisedCapacity / broker.getCurtailment(); capacityControlService .exerciseBalancingControl(candidate.balancingOrder, candidate.exercisedCapacity, boValue); } } }
for (BOWrapper bo: possibles) { RegulationAccumulator cap = capacityControlService.getRegulationCapacity(bo.balancingOrder); log.info("tariff " + bo.balancingOrder.getTariffId() + ": up=" + cap.getUpRegulationCapacity()
/** * Processes an incoming ControlEvent from a broker */ public synchronized void handleMessage (EconomicControlEvent msg) { ValidationResult result = validateUpdate(msg); if (result.tariff == null) { send(result.message); return; } int currentTimeslot = timeslotRepo.currentTimeslot().getSerialNumber(); if (currentTimeslot > msg.getTimeslotIndex()) { // this is in the past log.warn("Curtailment requested in ts " + currentTimeslot + " for past timeslot " + msg.getTimeslotIndex()); // send error? send(new TariffStatus(msg.getBroker(), msg.getTariffId(), msg.getId(), TariffStatus.Status.invalidUpdate) .withMessage("control: specified timeslot in the past")); return; } capacityControlService.postEconomicControl(msg); }