[1500] | 1 | package experiments.simpat2014.models.recs; |
---|
[1469] | 2 | |
---|
| 3 | import schedframe.resources.computing.Node; |
---|
| 4 | import schedframe.resources.computing.Processor; |
---|
| 5 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
| 6 | import schedframe.resources.devices.Fan; |
---|
| 7 | import schedframe.resources.devices.PhysicalResource; |
---|
| 8 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 9 | import example.energy.BaseEnergyEstimationPlugin; |
---|
[1500] | 10 | import experiments.simpat2014.EnvironmentConditions; |
---|
[1469] | 11 | |
---|
| 12 | public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 13 | |
---|
| 14 | /*private static int PFanMax = 6; |
---|
| 15 | private static int TFanLow = 45; |
---|
| 16 | private static int TFanHigh = 47;*/ |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
| 20 | PhysicalResource resource) { |
---|
| 21 | |
---|
| 22 | double powerConsumption = 0; |
---|
| 23 | Fan fan = (Fan) resource; |
---|
| 24 | /*Node node = (Node) fan.getComputingResource(); |
---|
| 25 | double Tcpu = 0; |
---|
| 26 | for(Processor cpu: node.getProcessors()){ |
---|
| 27 | Tcpu = Tcpu + cpu.getThermalInterface().getRecentTemperature().getValue(); |
---|
| 28 | } |
---|
| 29 | Tcpu = Tcpu/node.getProcessors().size(); |
---|
| 30 | |
---|
| 31 | if (Tcpu < TFanLow) { |
---|
| 32 | powerConsumption = 4; |
---|
| 33 | } else if (Tcpu > TFanHigh){ |
---|
| 34 | powerConsumption = PFanMax; |
---|
| 35 | } |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | try { |
---|
| 39 | powerConsumption = fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState()); |
---|
| 40 | } catch (NoSuchFieldException e) { |
---|
| 41 | // |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | return powerConsumption; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
| 48 | |
---|
| 49 | double airflow = 0; |
---|
| 50 | Fan fan = (Fan) resource; |
---|
| 51 | |
---|
| 52 | /*double fanEfficiency = 0; |
---|
| 53 | try{ |
---|
| 54 | fanEfficiency = Double.valueOf(fan.getPowerInterface().getParameters().get("fanEfficiency").get(0).getContent()).doubleValue(); |
---|
| 55 | } catch (Exception e){ |
---|
| 56 | // |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | double dp = 1013.25; |
---|
| 60 | airflow = fan.getPowerInterface().getRecentPowerUsage().getValue() * fanEfficiency /dp;*/ |
---|
| 61 | |
---|
| 62 | try { |
---|
| 63 | airflow = fan.getAirflowInterface().getAirflow(fan.getAirflowInterface().getAirflowState()); |
---|
| 64 | } catch (NoSuchFieldException e) { |
---|
| 65 | // |
---|
| 66 | } |
---|
| 67 | return airflow; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | public double estimateTemperature (ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
| 71 | double temperature = EnvironmentConditions.ROOM_TEMPERATURE; |
---|
| 72 | return temperature; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | } |
---|