package classes.holonControlUnit; import java.util.ArrayList; import java.util.HashMap; import classes.Holon; import classes.holonControlUnit.messages.StateMsg; /** * here we "try" to predict the future power usage inside the holon * as predicted values we use the real power usage values for future timestamps * @author Jonas * */ public class ForecastComputationUnit { public final int N_TIMESTEPS = 5; private HolonControlUnit hcu; public ForecastComputationUnit(HolonControlUnit hcu) { this.hcu = hcu; } public ArrayList computeForecast(HashMap childStates, int timeStep){ ArrayList forecast = new ArrayList(); Holon holon = this.hcu.getHolon(); for(int i=0; i= holon.model.getIterations()) break; float powerUsage = 0f; for(String s : childStates.keySet()) { powerUsage += childStates.get(s).getPredictedPowerUsage().get(i); } if(holon.isPhysical) { powerUsage += holon.getHolonObject().getEnergyAtTimeStep(t); } forecast.add(powerUsage); } // System.out.println("Forecast for "+holon.getHolonObject()+"\n\t"+forecast); return forecast; } }