@Test public void testWeeklyPriceProfile () { init(); DateTime now = new DateTime(2015, 2, 12, 12, 0, 0, DateTimeZone.UTC); when(mockTimeslotRepo.currentTimeslot()) .thenReturn(new Timeslot(0, now.toInstant())); TariffSpecification weeklySpec = new TariffSpecification(broker, PowerType.THERMAL_STORAGE_CONSUMPTION); Rate r1 = new Rate() .withWeeklyBegin(1).withWeeklyEnd(5) .withDailyBegin(7).withDailyEnd(19).withValue(.18); weeklySpec.addRate(r1); Rate r2 = new Rate() .withWeeklyBegin(1).withWeeklyEnd(5) .withDailyBegin(20).withDailyEnd(6).withValue(.08); weeklySpec.addRate(r2); Rate r3 = new Rate() .withWeeklyBegin(6).withWeeklyEnd(7) .withDailyBegin(7).withDailyEnd(20).withValue(.15); weeklySpec.addRate(r3); Rate r4 = new Rate() .withWeeklyBegin(6).withWeeklyEnd(7) .withDailyBegin(21).withDailyEnd(6).withValue(.05); weeklySpec.addRate(r4); Tariff weeklyTariff = new Tariff(weeklySpec); ReflectionTestUtils.setField(weeklyTariff, "timeService", timeService); ReflectionTestUtils.setField(weeklyTariff, "tariffRepo", tariffRepo); weeklyTariff.init(); assertTrue(weeklyTariff.isCovered(), "good tariff"); ColdStorage.TariffInfo info = uut.makeTariffInfo(weeklyTariff); double[] result = info.getPrices(); assertEquals(168, result.length, "length"); assertEquals(.18, result[0], 1e-6, "Th 12"); assertEquals(.18, result[7], 1e-6, "Th 19"); assertEquals(.08, result[8], 1e-6, "Th 20"); assertEquals(.08, result[18], 1e-6, "Fr 6"); assertEquals(.18, result[19], 1e-6, "Fr 7"); assertEquals(.18, result[31], 1e-6, "Fr 19"); assertEquals(.08, result[32], 1e-6, "Fr 20"); assertEquals(.08, result[35], 1e-6, "Fr 23"); assertEquals(.05, result[36], 1e-6, "Sa 0"); assertEquals(.05, result[42], 1e-6, "Sa 6"); assertEquals(.15, result[43], 1e-6, "Sa 7"); assertEquals(.15, result[56], 1e-6, "Sa 20"); assertEquals(.05, result[57], 1e-6, "Sa 21"); }
TariffInfo makeTariffInfo (Tariff tariff) { return new TariffInfo(tariff); }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { TariffInfo makeTariffInfo (Tariff tariff) { return new TariffInfo(tariff); } }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { TariffInfo makeTariffInfo (Tariff tariff) { return new TariffInfo(tariff); } ColdStorage();  ColdStorage(String name); }
ColdStorage extends AbstractCustomer implements CustomerModelAccessor { TariffInfo makeTariffInfo (Tariff tariff) { return new TariffInfo(tariff); } 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 { TariffInfo makeTariffInfo (Tariff tariff) { return new TariffInfo(tariff); } 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);  }