/** * Adds kwh to the regulation exercised in the current timeslot. * Intended to be called during exercise of economic or balancing controls. * The kwh argument is a per-member value; positive for up-regulation, * negative for down-regulation. */ void addRegulation (double kwh) { setRegulation(regulation + kwh); }
/** * Returns the regulation quantity exercised per member * in the previous timeslot. For non-storage devices, * only up-regulation through curtailment is supported, * and the result will be a non-negative value. * For storage devices, it may be positive (up-regulation) or negative * (down-regulation). * Intended to be called by customer models. * * NOTE: This method is not idempotent, * because the regulation quantity is reset to zero after it's accessed. */ public synchronized double getRegulation () { double result = regulation; setRegulation(0.0); return result; }
/** * Returns the regulation in kwh, aggregated across the subscribed population, * for the previous timeslot. * Intended to be called by Customer models only. Value is non-negative for * consumption power types, non-positive for production types. For storage * types it may be positive or negative. * * NOTE: this method is not idempotent; if you call it twice * in the same timeslot, the second time returns zero. */ public synchronized double getCurtailment () { double sgn = 1.0; if (tariff.getPowerType().isProduction()) sgn = -1.0; double result = sgn * Math.max(sgn * regulation, 0.0) * customersCommitted; setRegulation(0.0); return result; }
setRegulation(0.0); double result = 0.0; if (getTariff().hasRegulationRate()) {