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