1 | package test.fips.models.i5; |
---|
2 | |
---|
3 | import schedframe.resources.computing.ComputingResource; |
---|
4 | import schedframe.resources.computing.Rack; |
---|
5 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
6 | import schedframe.resources.devices.Device; |
---|
7 | import schedframe.resources.devices.PhysicalResource; |
---|
8 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
9 | import simulator.ConfigurationOptions; |
---|
10 | import example.energy.BaseEnergyEstimationPlugin; |
---|
11 | import test.fips.EnvironmentConditions; |
---|
12 | |
---|
13 | public class TangCoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
14 | |
---|
15 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
16 | double airflow = 0; |
---|
17 | return airflow; |
---|
18 | } |
---|
19 | |
---|
20 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
21 | PhysicalResource resource) { |
---|
22 | |
---|
23 | double powerConsumption = 0; |
---|
24 | |
---|
25 | Device coolingDevice = (Device) resource; |
---|
26 | ComputingResource room = (ComputingResource) coolingDevice.getComputingResource(); |
---|
27 | |
---|
28 | double Pload_dc = calculatePit(room); |
---|
29 | double Pothers = calculatePothers(Pload_dc); |
---|
30 | double airTemp = EnvironmentConditions.ROOM_TEMPERATURE; |
---|
31 | double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458; |
---|
32 | |
---|
33 | powerConsumption = (Pload_dc + Pothers)/CoP; |
---|
34 | return powerConsumption; |
---|
35 | } |
---|
36 | |
---|
37 | private double calculatePit(ComputingResource room){ |
---|
38 | double Pload_dc = 0; |
---|
39 | for(ComputingResource cr: room.getChildren()){ |
---|
40 | Rack rack = (Rack)cr; |
---|
41 | Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
42 | } |
---|
43 | return Pload_dc; |
---|
44 | } |
---|
45 | private double calculatePothers(double Pload_dc){ |
---|
46 | |
---|
47 | double Pothers = 0; |
---|
48 | |
---|
49 | double a;//experiment |
---|
50 | try{ |
---|
51 | a = ConfigurationOptions.coolingData.getAlpha(); |
---|
52 | } catch (Exception e){ |
---|
53 | a = 0.02; |
---|
54 | } |
---|
55 | |
---|
56 | Pothers = a * Pload_dc; |
---|
57 | return Pothers; |
---|
58 | } |
---|
59 | |
---|
60 | } |
---|