package example.energy.device; import schedframe.events.scheduling.EventReason; import schedframe.resources.computing.profiles.energy.EnergyEvent; import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; import schedframe.resources.devices.PhysicalResource; import schedframe.scheduling.manager.tasks.JobRegistry; import example.energy.BaseEnergyEstimationPlugin; public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double powerConsumption = 0; try { if(event.getReason() == EventReason.SIM_INIT) powerConsumption = powerConsumption + resource.getAirThroughputInterface().getPowerConsumption(StandardAirThroughputStateName.OFF); else powerConsumption = powerConsumption + resource.getAirThroughputInterface().getPowerConsumption(resource.getAirThroughputInterface().getAirThroughputState()); } catch (NoSuchFieldException e) { } return powerConsumption; } public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double airThroughput = 0; try { if(event.getReason() == EventReason.SIM_INIT) airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.OFF); else airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } return airThroughput; } }