@Test public void testStepBelow () { when(seed.nextDouble()).thenReturn(10.0/25.0); weather = new WeatherReport(0, 30, 0, 0, 0); when(mockWeatherRepo.currentWeatherReport()).thenReturn(weather); init(); when(subscription.getRegulation()).thenReturn(0.0); uut.step(); ArgumentCaptor<Double> pwr = ArgumentCaptor.forClass(Double.class); verify(subscription).usePower(pwr.capture()); assertEquals(14.4, pwr.getValue(), 1e-4, "correct usage"); ArgumentCaptor<RegulationCapacity> rcap = ArgumentCaptor.forClass(RegulationCapacity.class); verify(subscription).setRegulationCapacity(rcap.capture()); RegulationCapacity rc = rcap.getValue(); assertEquals(0.0, rc.getUpRegulationCapacity(), 1e-4, "correct up-regulation"); assertEquals(-93.44, rc.getDownRegulationCapacity(), 1e-4, "correct down-regulationCapacity"); }
@Override public void step () { totalEnergyUsed = 0.0; double regulation = getSubscription().getRegulation(); if (regulation != 0.0) { double tempChange = regulation * cop / currentStock / CP_ICE; log.info(getName() + ": regulation = " + regulation + ", tempChange = " + tempChange); setCurrentTemp(currentTemp + tempChange); } setCurrentTemp(currentTemp + turnoverRise()); updateNcUsage(); useEnergy(currentNcUsage); WeatherReport weather = service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature(); EnergyInfo info = computeCoolingEnergy(getCurrentTemp(), getNominalTemp(), outsideTemp); setCurrentTemp(currentTemp + info.getDeltaTemp()); double availableUp = info.getEnergy() / cop; if (currentTemp >= maxTemp) availableUp = 0.0; double availableDown = -(getMaxCooling() - info.getEnergy()) / cop; if (currentTemp <= minTemp) availableDown = 0.0; RegulationCapacity capacity = new RegulationCapacity(getSubscription(), availableUp, availableDown); getSubscription().setRegulationCapacity(capacity); log.info(getName() + ": regulation capacity (" + capacity.getUpRegulationCapacity() + ", " + capacity.getDownRegulationCapacity() + ")"); useEnergy(info.getEnergy() / cop); log.debug("total energy = " + totalEnergyUsed); getSubscription().usePower(totalEnergyUsed); }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { totalEnergyUsed = 0.0; double regulation = getSubscription().getRegulation(); if (regulation != 0.0) { double tempChange = regulation * cop / currentStock / CP_ICE; log.info(getName() + ": regulation = " + regulation + ", tempChange = " + tempChange); setCurrentTemp(currentTemp + tempChange); } setCurrentTemp(currentTemp + turnoverRise()); updateNcUsage(); useEnergy(currentNcUsage); WeatherReport weather = service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature(); EnergyInfo info = computeCoolingEnergy(getCurrentTemp(), getNominalTemp(), outsideTemp); setCurrentTemp(currentTemp + info.getDeltaTemp()); double availableUp = info.getEnergy() / cop; if (currentTemp >= maxTemp) availableUp = 0.0; double availableDown = -(getMaxCooling() - info.getEnergy()) / cop; if (currentTemp <= minTemp) availableDown = 0.0; RegulationCapacity capacity = new RegulationCapacity(getSubscription(), availableUp, availableDown); getSubscription().setRegulationCapacity(capacity); log.info(getName() + ": regulation capacity (" + capacity.getUpRegulationCapacity() + ", " + capacity.getDownRegulationCapacity() + ")"); useEnergy(info.getEnergy() / cop); log.debug("total energy = " + totalEnergyUsed); getSubscription().usePower(totalEnergyUsed); } }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { totalEnergyUsed = 0.0; double regulation = getSubscription().getRegulation(); if (regulation != 0.0) { double tempChange = regulation * cop / currentStock / CP_ICE; log.info(getName() + ": regulation = " + regulation + ", tempChange = " + tempChange); setCurrentTemp(currentTemp + tempChange); } setCurrentTemp(currentTemp + turnoverRise()); updateNcUsage(); useEnergy(currentNcUsage); WeatherReport weather = service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature(); EnergyInfo info = computeCoolingEnergy(getCurrentTemp(), getNominalTemp(), outsideTemp); setCurrentTemp(currentTemp + info.getDeltaTemp()); double availableUp = info.getEnergy() / cop; if (currentTemp >= maxTemp) availableUp = 0.0; double availableDown = -(getMaxCooling() - info.getEnergy()) / cop; if (currentTemp <= minTemp) availableDown = 0.0; RegulationCapacity capacity = new RegulationCapacity(getSubscription(), availableUp, availableDown); getSubscription().setRegulationCapacity(capacity); log.info(getName() + ": regulation capacity (" + capacity.getUpRegulationCapacity() + ", " + capacity.getDownRegulationCapacity() + ")"); useEnergy(info.getEnergy() / cop); log.debug("total energy = " + totalEnergyUsed); getSubscription().usePower(totalEnergyUsed); } ColdStorage();  ColdStorage(String name); }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { totalEnergyUsed = 0.0; double regulation = getSubscription().getRegulation(); if (regulation != 0.0) { double tempChange = regulation * cop / currentStock / CP_ICE; log.info(getName() + ": regulation = " + regulation + ", tempChange = " + tempChange); setCurrentTemp(currentTemp + tempChange); } setCurrentTemp(currentTemp + turnoverRise()); updateNcUsage(); useEnergy(currentNcUsage); WeatherReport weather = service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature(); EnergyInfo info = computeCoolingEnergy(getCurrentTemp(), getNominalTemp(), outsideTemp); setCurrentTemp(currentTemp + info.getDeltaTemp()); double availableUp = info.getEnergy() / cop; if (currentTemp >= maxTemp) availableUp = 0.0; double availableDown = -(getMaxCooling() - info.getEnergy()) / cop; if (currentTemp <= minTemp) availableDown = 0.0; RegulationCapacity capacity = new RegulationCapacity(getSubscription(), availableUp, availableDown); getSubscription().setRegulationCapacity(capacity); log.info(getName() + ": regulation capacity (" + capacity.getUpRegulationCapacity() + ", " + capacity.getDownRegulationCapacity() + ")"); useEnergy(info.getEnergy() / cop); log.debug("total energy = " + totalEnergyUsed); getSubscription().usePower(totalEnergyUsed); } ColdStorage();  ColdStorage(String name); @Override void initialize(); @Override CustomerInfo getCustomerInfo(); @Override void step(); @Override void evaluateTariffs(List<Tariff> tariffs); @Override CapacityProfile getCapacityProfile(Tariff tariff); @Override double getBrokerSwitchFactor(boolean isSuperseding); @Override double getTariffChoiceSample(); @Override double getInertiaSample(); double getCurrentTemp(); @StateChange void setCurrentTemp(double temp); double getMinTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "minimum allowable temperature") @StateChange ColdStorage withMinTemp(double temp); double getMaxTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "maximum allowable temperature") @StateChange ColdStorage withMaxTemp(double temp); double getNominalTemp(); @ConfigurableValue(valueType = "Double", description = "allowable temperature change to save money on TOU tariffs") @StateChange void setShiftSag(double deltaT); double getShiftSag(); @ConfigurableValue(valueType = "Double", dump = false, description = "assumed outdoor temp for tariff evaluation") @StateChange void setEvalEnvTemp(double temp); double getEvalEnvTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "nominal internal temperature") @StateChange ColdStorage withNominalTemp(double temp); double getNewStockTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "Temperature of incoming stock") @StateChange ColdStorage withNewStockTemp(double temp); double getStockCapacity(); @ConfigurableValue(valueType = "Double", dump = false, description = "Typical inventory in tonnes of H2O") @StateChange ColdStorage withStockCapacity(double value); double getTurnoverRatio(); @ConfigurableValue(valueType = "Double", description = "Ratio of stock that gets replaced daily") @StateChange ColdStorage withTurnoverRatio(double ratio); double getRoofArea(); @ConfigurableValue(valueType = "Double", dump = false, description = "Area of roof") @StateChange ColdStorage withRoofArea(double area); double getRoofRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of roof insulation") @StateChange ColdStorage withRoofRValue(double value); double getWallArea(); @ConfigurableValue(valueType = "Double", dump = false, description = "Total area of outside walls") @StateChange ColdStorage withWallArea(double area); double getWallRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of wall insulation") @StateChange ColdStorage withWallRValue(double value); double getFloorRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of floor insulation") @StateChange ColdStorage withFloorRValue(double value); double getInfiltrationRatio(); @ConfigurableValue(valueType = "Double", dump = false, description = "Infiltration loss as proportion of wall + roof loss") @StateChange ColdStorage withInfiltrationRatio(double value); double getUnitSize(); @ConfigurableValue(valueType = "Double", dump = false, description = "Thermal capacity in tons of cooling plant") @StateChange ColdStorage withUnitSize(double cap); double getCop(); @ConfigurableValue(valueType = "Double", dump = false, description = "Coefficient of Performance of refrigeration unit") @StateChange ColdStorage withCop(double value); double getHysteresis(); @ConfigurableValue(valueType = "Double", dump = false, description = "Control range for refrigeration unit") @StateChange ColdStorage withHysteresis(double value); double getNonCoolingUsage(); @ConfigurableValue(valueType = "Double", dump = false, description = "Mean hourly energy usage for non-cooling purposes") @StateChange ColdStorage withNonCoolingUsage(double value); @Override double getShiftingInconvenienceFactor(Tariff tariff); }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { totalEnergyUsed = 0.0; double regulation = getSubscription().getRegulation(); if (regulation != 0.0) { double tempChange = regulation * cop / currentStock / CP_ICE; log.info(getName() + ": regulation = " + regulation + ", tempChange = " + tempChange); setCurrentTemp(currentTemp + tempChange); } setCurrentTemp(currentTemp + turnoverRise()); updateNcUsage(); useEnergy(currentNcUsage); WeatherReport weather = service.getWeatherReportRepo().currentWeatherReport(); double outsideTemp = weather.getTemperature(); EnergyInfo info = computeCoolingEnergy(getCurrentTemp(), getNominalTemp(), outsideTemp); setCurrentTemp(currentTemp + info.getDeltaTemp()); double availableUp = info.getEnergy() / cop; if (currentTemp >= maxTemp) availableUp = 0.0; double availableDown = -(getMaxCooling() - info.getEnergy()) / cop; if (currentTemp <= minTemp) availableDown = 0.0; RegulationCapacity capacity = new RegulationCapacity(getSubscription(), availableUp, availableDown); getSubscription().setRegulationCapacity(capacity); log.info(getName() + ": regulation capacity (" + capacity.getUpRegulationCapacity() + ", " + capacity.getDownRegulationCapacity() + ")"); useEnergy(info.getEnergy() / cop); log.debug("total energy = " + totalEnergyUsed); getSubscription().usePower(totalEnergyUsed); } ColdStorage();  ColdStorage(String name); @Override void initialize(); @Override CustomerInfo getCustomerInfo(); @Override void step(); @Override void evaluateTariffs(List<Tariff> tariffs); @Override CapacityProfile getCapacityProfile(Tariff tariff); @Override double getBrokerSwitchFactor(boolean isSuperseding); @Override double getTariffChoiceSample(); @Override double getInertiaSample(); double getCurrentTemp(); @StateChange void setCurrentTemp(double temp); double getMinTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "minimum allowable temperature") @StateChange ColdStorage withMinTemp(double temp); double getMaxTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "maximum allowable temperature") @StateChange ColdStorage withMaxTemp(double temp); double getNominalTemp(); @ConfigurableValue(valueType = "Double", description = "allowable temperature change to save money on TOU tariffs") @StateChange void setShiftSag(double deltaT); double getShiftSag(); @ConfigurableValue(valueType = "Double", dump = false, description = "assumed outdoor temp for tariff evaluation") @StateChange void setEvalEnvTemp(double temp); double getEvalEnvTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "nominal internal temperature") @StateChange ColdStorage withNominalTemp(double temp); double getNewStockTemp(); @ConfigurableValue(valueType = "Double", dump = false, description = "Temperature of incoming stock") @StateChange ColdStorage withNewStockTemp(double temp); double getStockCapacity(); @ConfigurableValue(valueType = "Double", dump = false, description = "Typical inventory in tonnes of H2O") @StateChange ColdStorage withStockCapacity(double value); double getTurnoverRatio(); @ConfigurableValue(valueType = "Double", description = "Ratio of stock that gets replaced daily") @StateChange ColdStorage withTurnoverRatio(double ratio); double getRoofArea(); @ConfigurableValue(valueType = "Double", dump = false, description = "Area of roof") @StateChange ColdStorage withRoofArea(double area); double getRoofRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of roof insulation") @StateChange ColdStorage withRoofRValue(double value); double getWallArea(); @ConfigurableValue(valueType = "Double", dump = false, description = "Total area of outside walls") @StateChange ColdStorage withWallArea(double area); double getWallRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of wall insulation") @StateChange ColdStorage withWallRValue(double value); double getFloorRValue(); @ConfigurableValue(valueType = "Double", description = "R-value of floor insulation") @StateChange ColdStorage withFloorRValue(double value); double getInfiltrationRatio(); @ConfigurableValue(valueType = "Double", dump = false, description = "Infiltration loss as proportion of wall + roof loss") @StateChange ColdStorage withInfiltrationRatio(double value); double getUnitSize(); @ConfigurableValue(valueType = "Double", dump = false, description = "Thermal capacity in tons of cooling plant") @StateChange ColdStorage withUnitSize(double cap); double getCop(); @ConfigurableValue(valueType = "Double", dump = false, description = "Coefficient of Performance of refrigeration unit") @StateChange ColdStorage withCop(double value); double getHysteresis(); @ConfigurableValue(valueType = "Double", dump = false, description = "Control range for refrigeration unit") @StateChange ColdStorage withHysteresis(double value); double getNonCoolingUsage(); @ConfigurableValue(valueType = "Double", dump = false, description = "Mean hourly energy usage for non-cooling purposes") @StateChange ColdStorage withNonCoolingUsage(double value); @Override double getShiftingInconvenienceFactor(Tariff tariff);  }