This example shows how the smart home framework can be used to develop a model of a smart home. We also show how this model can be optimised (in this case, to obtain the maximum utility) using the Optimisation toolkit. Finally, we show the use of the Visualisation toolkit to plot optimisation results.
- Building a smart home model
- Initialise appliances:
WashingMachine washingMachine = new WashingMachine(); DishWasher dishWasher = new DishWasher(1kWh);
- Add Generation:
agent.addGenerator(new SolarPanel("SolarPanel", 2.5)); agent.addGenerator(new WindTurbine("Wind Turbine", 2)); Grid grid = new Grid(new Tariff(20, 0.1, 0.05)); agent.addGenerator(grid);
- Add Storage:
HomeBattery battery = new HomeBattery("HomeBattery", maxCapacity, maxChargeRate, maxDischargeRate, batteryEfficiecy); agent.addStorage(battery);
- Add Load Events:
agent.addEvent(new DeferrableLoadEvent(washingMachine, "weekendWashing", preferredStartTime, preferredEndTime, duration, isInterruptableLoad, isCriticalLoad)); agent.addEvent(new NonDeferrableLoadEvent(tv, "The Simpsons", startTime, duration, isCriticalLoad));
- Add an Electric Vehicle:
MobileBattery evBattery = new MobileBattery("EVBattery", maxCapacity, maxChargeRate, maxDischargeRate, batteryEfficiecy); ElectricVehicle ev = new ElectricVehicle("EV", evBattery); ev.addJounery(new Journey(new DepartureEvent(time, preferredEnergyInEVBattery), new ArrivalEvent(time, estimatedEnergyInEVBattery))); agent.addElectricVehical(ev);
- Add an Electric Heating:
HVACSystem hvacSystem = new HVACSystem(); ElectricHeater[] heater = hvacSystem.getElectricHeaterIntances(); for (int i = 0; i < heater.length; i++) agent.addEvent(new NonDeferrableLoadEvent(heater[i], ""+i, heater[i].getMaxPower(), i, 1, false));
- Initialise appliances:
- Optimisation:
MaxUtilOptModel optModel = new MaxUtilOptModel("OptimisationID", agent); OptResult optResult = optModel.optimise();
- Visualisation:
if(optResult.isSolved()) new OptInfoDesktopHandler(optResult); //See Figure 1 below.
Figure 1 demonstrates the use of visualisation toolkit to show the results of utility maximisation in a smart home.