1 | package example.energy.device; |
---|
2 | |
---|
3 | import schedframe.events.scheduling.EventReason; |
---|
4 | import schedframe.resources.computing.profiles.energy.EnergyEvent; |
---|
5 | import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; |
---|
6 | import schedframe.resources.devices.PhysicalResource; |
---|
7 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
8 | import example.energy.BaseEnergyEstimationPlugin; |
---|
9 | |
---|
10 | public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
11 | |
---|
12 | public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, |
---|
13 | PhysicalResource resource) { |
---|
14 | double powerConsumption = 0; |
---|
15 | try { |
---|
16 | if(event.getReason() == EventReason.SIM_INIT) |
---|
17 | powerConsumption = powerConsumption + resource.getAirThroughputInterface().getPowerConsumption(StandardAirThroughputStateName.OFF); |
---|
18 | else |
---|
19 | powerConsumption = powerConsumption + resource.getAirThroughputInterface().getPowerConsumption(resource.getAirThroughputInterface().getAirThroughputState()); |
---|
20 | } catch (NoSuchFieldException e) { |
---|
21 | } |
---|
22 | |
---|
23 | return powerConsumption; |
---|
24 | } |
---|
25 | |
---|
26 | public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
27 | double airThroughput = 0; |
---|
28 | try { |
---|
29 | if(event.getReason() == EventReason.SIM_INIT) |
---|
30 | airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.OFF); |
---|
31 | else |
---|
32 | airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); |
---|
33 | } catch (NoSuchFieldException e) { |
---|
34 | // TODO Auto-generated catch block |
---|
35 | e.printStackTrace(); |
---|
36 | } |
---|
37 | return airThroughput; |
---|
38 | } |
---|
39 | } |
---|