@Test public void testStep () { }
@Override public void step () { Shift newShift = shiftSchedule[indexOfShift(getNowInstant())]; if (newShift != currentShift) { log.info(getName() + " start of shift"); double totalEnergy = getEnergyCharging() + getEnergyInUse(); setEnergyCharging(getEnergyCharging() + getEnergyInUse()); setCapacityInUse(0.0); setEnergyInUse(0.0); if (null != newShift) { setCapacityInUse(newShift.getTrucks() * batteryCapacity); setEnergyInUse(Math.min(getCapacityInUse(), totalEnergy)); setEnergyCharging(totalEnergy - getEnergyInUse()); } log.info(getName() + ": new shift cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); currentShift = newShift; } if (null != currentShift) { double usage = Math.max(0.0, normal.sample() * truckStd + truckKW * currentShift.getTrucks()); double deficit = usage - getEnergyInUse(); log.debug(getName() + ": trucks use " + usage + " kWh"); if (deficit > 0.0) { log.warn(getName() + ": trucks use more energy than available by " + deficit + " kWh"); addEnergyInUse(deficit); addEnergyCharging(-deficit); } addEnergyInUse(-usage); } double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation); getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); }
LiftTruck extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { Shift newShift = shiftSchedule[indexOfShift(getNowInstant())]; if (newShift != currentShift) { log.info(getName() + " start of shift"); double totalEnergy = getEnergyCharging() + getEnergyInUse(); setEnergyCharging(getEnergyCharging() + getEnergyInUse()); setCapacityInUse(0.0); setEnergyInUse(0.0); if (null != newShift) { setCapacityInUse(newShift.getTrucks() * batteryCapacity); setEnergyInUse(Math.min(getCapacityInUse(), totalEnergy)); setEnergyCharging(totalEnergy - getEnergyInUse()); } log.info(getName() + ": new shift cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); currentShift = newShift; } if (null != currentShift) { double usage = Math.max(0.0, normal.sample() * truckStd + truckKW * currentShift.getTrucks()); double deficit = usage - getEnergyInUse(); log.debug(getName() + ": trucks use " + usage + " kWh"); if (deficit > 0.0) { log.warn(getName() + ": trucks use more energy than available by " + deficit + " kWh"); addEnergyInUse(deficit); addEnergyCharging(-deficit); } addEnergyInUse(-usage); } double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation); getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); } }
LiftTruck extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { Shift newShift = shiftSchedule[indexOfShift(getNowInstant())]; if (newShift != currentShift) { log.info(getName() + " start of shift"); double totalEnergy = getEnergyCharging() + getEnergyInUse(); setEnergyCharging(getEnergyCharging() + getEnergyInUse()); setCapacityInUse(0.0); setEnergyInUse(0.0); if (null != newShift) { setCapacityInUse(newShift.getTrucks() * batteryCapacity); setEnergyInUse(Math.min(getCapacityInUse(), totalEnergy)); setEnergyCharging(totalEnergy - getEnergyInUse()); } log.info(getName() + ": new shift cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); currentShift = newShift; } if (null != currentShift) { double usage = Math.max(0.0, normal.sample() * truckStd + truckKW * currentShift.getTrucks()); double deficit = usage - getEnergyInUse(); log.debug(getName() + ": trucks use " + usage + " kWh"); if (deficit > 0.0) { log.warn(getName() + ": trucks use more energy than available by " + deficit + " kWh"); addEnergyInUse(deficit); addEnergyCharging(-deficit); } addEnergyInUse(-usage); } double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation); getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); } LiftTruck();  LiftTruck(String name); }
LiftTruck extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { Shift newShift = shiftSchedule[indexOfShift(getNowInstant())]; if (newShift != currentShift) { log.info(getName() + " start of shift"); double totalEnergy = getEnergyCharging() + getEnergyInUse(); setEnergyCharging(getEnergyCharging() + getEnergyInUse()); setCapacityInUse(0.0); setEnergyInUse(0.0); if (null != newShift) { setCapacityInUse(newShift.getTrucks() * batteryCapacity); setEnergyInUse(Math.min(getCapacityInUse(), totalEnergy)); setEnergyCharging(totalEnergy - getEnergyInUse()); } log.info(getName() + ": new shift cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); currentShift = newShift; } if (null != currentShift) { double usage = Math.max(0.0, normal.sample() * truckStd + truckKW * currentShift.getTrucks()); double deficit = usage - getEnergyInUse(); log.debug(getName() + ": trucks use " + usage + " kWh"); if (deficit > 0.0) { log.warn(getName() + ": trucks use more energy than available by " + deficit + " kWh"); addEnergyInUse(deficit); addEnergyCharging(-deficit); } addEnergyInUse(-usage); } double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation); getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); } LiftTruck();  LiftTruck(String name); @Override void initialize(); @Override CustomerInfo getCustomerInfo(); @Override void step(); @Override String getName(); @Override void setName(String name); @ConfigurableValue(valueType = "Double", dump = false, description = "mean power usage when truck is in use") @StateChange void setTruckKW(double value); double getTruckKW(); @ConfigurableValue(valueType = "Double", dump = false, description = "Std dev of truck power usage") @StateChange void setTruckStd(double stdDev); double getTruckStd(); @ConfigurableValue(valueType = "List", dump = false, description = "shift spec [block, shift, ..., block, shift, ...]") void setShiftData(List<String> data); List<String> getShiftData(); @ConfigurableValue(valueType = "Double", dump = false, description = "size of battery pack in kWh") @StateChange void setBatteryCapacity(double value); double getBatteryCapacity(); @ConfigurableValue(valueType = "Integer", dump = false, description = "total number of battery packs") @StateChange void setNBatteries(int value); int getNBatteries(); @ConfigurableValue(valueType = "Integer", dump = false, description = "number of battery chargers") @StateChange void setNChargers(int value); int getNChargers(); @ConfigurableValue(valueType = "Double", dump = false, description = "maximum charge rate of one truck's battery pack") @StateChange void setMaxChargeKW(double value); double getMaxChargeKW(); @ConfigurableValue(valueType = "Double", dump = false, description = "ratio of charge energy to battery energy") @StateChange void setChargeEfficiency(double value); double getChargeEfficiency(); @ConfigurableValue(valueType = "Integer", dump = false, description = "planning horizon in timeslots - should be at least 48") @StateChange void setPlanningHorizon(int horizon); int getPlanningHorizon(); @ConfigurableValue(valueType = "Integer", dump = false, description = "minimum useful horizon of existing plan") @StateChange void setMinPlanningHorizon(int horizon); int getMinPlanningHorizon(); @StateChange void setEnergyCharging(double kwh); double getEnergyCharging(); void addEnergyCharging(double kwh); @StateChange void setEnergyInUse(double kwh); double getEnergyInUse(); void addEnergyInUse(double kwh); @StateChange void setCapacityInUse(double kwh); double getCapacityInUse(); @Override CapacityProfile getCapacityProfile(Tariff tariff); @Override double getBrokerSwitchFactor(boolean isSuperseding); @Override double getTariffChoiceSample(); @Override double getInertiaSample(); @Override void evaluateTariffs(List<Tariff> tariffs); @Override double getShiftingInconvenienceFactor(Tariff tariff); }
LiftTruck extends AbstractCustomer implements CustomerModelAccessor { @Override public void step () { Shift newShift = shiftSchedule[indexOfShift(getNowInstant())]; if (newShift != currentShift) { log.info(getName() + " start of shift"); double totalEnergy = getEnergyCharging() + getEnergyInUse(); setEnergyCharging(getEnergyCharging() + getEnergyInUse()); setCapacityInUse(0.0); setEnergyInUse(0.0); if (null != newShift) { setCapacityInUse(newShift.getTrucks() * batteryCapacity); setEnergyInUse(Math.min(getCapacityInUse(), totalEnergy)); setEnergyCharging(totalEnergy - getEnergyInUse()); } log.info(getName() + ": new shift cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); currentShift = newShift; } if (null != currentShift) { double usage = Math.max(0.0, normal.sample() * truckStd + truckKW * currentShift.getTrucks()); double deficit = usage - getEnergyInUse(); log.debug(getName() + ": trucks use " + usage + " kWh"); if (deficit > 0.0) { log.warn(getName() + ": trucks use more energy than available by " + deficit + " kWh"); addEnergyInUse(deficit); addEnergyCharging(-deficit); } addEnergyInUse(-usage); } double regulation = getSubscription().getRegulation(); log.info(getName() + ": regulation " + regulation); double energyUsed = useEnergy(regulation); getSubscription().usePower(energyUsed); log.info(getName() + " cInUse " + capacityInUse + ", eInUse " + energyInUse + ", eCharging " + energyCharging); } LiftTruck();  LiftTruck(String name); @Override void initialize(); @Override CustomerInfo getCustomerInfo(); @Override void step(); @Override String getName(); @Override void setName(String name); @ConfigurableValue(valueType = "Double", dump = false, description = "mean power usage when truck is in use") @StateChange void setTruckKW(double value); double getTruckKW(); @ConfigurableValue(valueType = "Double", dump = false, description = "Std dev of truck power usage") @StateChange void setTruckStd(double stdDev); double getTruckStd(); @ConfigurableValue(valueType = "List", dump = false, description = "shift spec [block, shift, ..., block, shift, ...]") void setShiftData(List<String> data); List<String> getShiftData(); @ConfigurableValue(valueType = "Double", dump = false, description = "size of battery pack in kWh") @StateChange void setBatteryCapacity(double value); double getBatteryCapacity(); @ConfigurableValue(valueType = "Integer", dump = false, description = "total number of battery packs") @StateChange void setNBatteries(int value); int getNBatteries(); @ConfigurableValue(valueType = "Integer", dump = false, description = "number of battery chargers") @StateChange void setNChargers(int value); int getNChargers(); @ConfigurableValue(valueType = "Double", dump = false, description = "maximum charge rate of one truck's battery pack") @StateChange void setMaxChargeKW(double value); double getMaxChargeKW(); @ConfigurableValue(valueType = "Double", dump = false, description = "ratio of charge energy to battery energy") @StateChange void setChargeEfficiency(double value); double getChargeEfficiency(); @ConfigurableValue(valueType = "Integer", dump = false, description = "planning horizon in timeslots - should be at least 48") @StateChange void setPlanningHorizon(int horizon); int getPlanningHorizon(); @ConfigurableValue(valueType = "Integer", dump = false, description = "minimum useful horizon of existing plan") @StateChange void setMinPlanningHorizon(int horizon); int getMinPlanningHorizon(); @StateChange void setEnergyCharging(double kwh); double getEnergyCharging(); void addEnergyCharging(double kwh); @StateChange void setEnergyInUse(double kwh); double getEnergyInUse(); void addEnergyInUse(double kwh); @StateChange void setCapacityInUse(double kwh); double getCapacityInUse(); @Override CapacityProfile getCapacityProfile(Tariff tariff); @Override double getBrokerSwitchFactor(boolean isSuperseding); @Override double getTariffChoiceSample(); @Override double getInertiaSample(); @Override void evaluateTariffs(List<Tariff> tariffs); @Override double getShiftingInconvenienceFactor(Tariff tariff);  }