1 | package example.energy.device; |
---|
2 | |
---|
3 | import schedframe.events.EventReason; |
---|
4 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
5 | import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName; |
---|
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(ResourceEvent event, JobRegistry jobRegistry, |
---|
13 | PhysicalResource resource) { |
---|
14 | double powerConsumption = 0; |
---|
15 | try { |
---|
16 | if(event.getReason() == EventReason.SIM_INIT) |
---|
17 | powerConsumption = powerConsumption + resource.getAirflowInterface().getPowerConsumption(StandardAirflowStateName.OFF); |
---|
18 | else |
---|
19 | powerConsumption = powerConsumption + resource.getAirflowInterface().getPowerConsumption(resource.getAirflowInterface().getAirflowState()); |
---|
20 | } catch (NoSuchFieldException e) { |
---|
21 | } |
---|
22 | |
---|
23 | return powerConsumption; |
---|
24 | } |
---|
25 | |
---|
26 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
27 | double airflow= 0; |
---|
28 | try { |
---|
29 | if(event.getReason() == EventReason.SIM_INIT) |
---|
30 | airflow = resource.getAirflowInterface().getAirflow(StandardAirflowStateName.OFF); |
---|
31 | else |
---|
32 | airflow = resource.getAirflowInterface().getAirflow(resource.getAirflowInterface().getAirflowState()); |
---|
33 | } catch (NoSuchFieldException e) { |
---|
34 | // TODO Auto-generated catch block |
---|
35 | e.printStackTrace(); |
---|
36 | } |
---|
37 | return airflow; |
---|
38 | } |
---|
39 | } |
---|