Revision 1415,
1.5 KB
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[1207] | 1 | package example.energy.device; |
---|
| 2 | |
---|
[1415] | 3 | import schedframe.events.EventReason; |
---|
| 4 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
[1396] | 5 | import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName; |
---|
[1207] | 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 | |
---|
[1415] | 12 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
[1207] | 13 | PhysicalResource resource) { |
---|
| 14 | double powerConsumption = 0; |
---|
| 15 | try { |
---|
| 16 | if(event.getReason() == EventReason.SIM_INIT) |
---|
[1396] | 17 | powerConsumption = powerConsumption + resource.getAirflowInterface().getPowerConsumption(StandardAirflowStateName.OFF); |
---|
[1207] | 18 | else |
---|
[1396] | 19 | powerConsumption = powerConsumption + resource.getAirflowInterface().getPowerConsumption(resource.getAirflowInterface().getAirflowState()); |
---|
[1207] | 20 | } catch (NoSuchFieldException e) { |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | return powerConsumption; |
---|
| 24 | } |
---|
| 25 | |
---|
[1415] | 26 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
[1396] | 27 | double airflow= 0; |
---|
[1207] | 28 | try { |
---|
| 29 | if(event.getReason() == EventReason.SIM_INIT) |
---|
[1396] | 30 | airflow = resource.getAirflowInterface().getAirflow(StandardAirflowStateName.OFF); |
---|
[1207] | 31 | else |
---|
[1396] | 32 | airflow = resource.getAirflowInterface().getAirflow(resource.getAirflowInterface().getAirflowState()); |
---|
[1207] | 33 | } catch (NoSuchFieldException e) { |
---|
| 34 | // TODO Auto-generated catch block |
---|
| 35 | e.printStackTrace(); |
---|
| 36 | } |
---|
[1396] | 37 | return airflow; |
---|
[1207] | 38 | } |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.