1 | package test.fips.models.fpga; |
---|
2 | |
---|
3 | |
---|
4 | import schedframe.resources.StandardResourceType; |
---|
5 | import schedframe.resources.computing.ComputingResource; |
---|
6 | import schedframe.resources.computing.Node; |
---|
7 | import schedframe.resources.computing.Processor; |
---|
8 | import schedframe.resources.computing.Rack; |
---|
9 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
10 | import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; |
---|
11 | import schedframe.resources.devices.Device; |
---|
12 | import schedframe.resources.devices.Fan; |
---|
13 | import schedframe.resources.devices.PhysicalResource; |
---|
14 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
15 | import simulator.ConfigurationOptions; |
---|
16 | import example.energy.BaseEnergyEstimationPlugin; |
---|
17 | import example.energy.coolemall.CoolEmAllTestbedMeasurements; |
---|
18 | import test.fips.EnvironmentConditions; |
---|
19 | |
---|
20 | public class TangDataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ |
---|
21 | |
---|
22 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
23 | PhysicalResource resource) { |
---|
24 | |
---|
25 | double Pdc; |
---|
26 | |
---|
27 | double Pload_dc = 0; |
---|
28 | double Pothers = 0; |
---|
29 | double Pfans_dc = 0; |
---|
30 | double Pcooling_device = 0; |
---|
31 | |
---|
32 | ComputingResource room = (ComputingResource) resource; |
---|
33 | |
---|
34 | /**************** IT PART ****************/ |
---|
35 | |
---|
36 | /*********** Pload_dc ***********/ |
---|
37 | Pload_dc = calculatePit(room); |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | /**************** NON- IT PART ****************/ |
---|
42 | |
---|
43 | /*********** Pothers ***********/ |
---|
44 | Pothers = calculatePothers(Pload_dc); |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | /************* COOLING PART *************/ |
---|
49 | |
---|
50 | |
---|
51 | /*********** Pfans_dc ***********/ |
---|
52 | Pfans_dc = calculatePfans(room); |
---|
53 | |
---|
54 | /************ Pcooling_device ************/ |
---|
55 | double airTemp = EnvironmentConditions.ROOM_TEMPERATURE; |
---|
56 | double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458; |
---|
57 | // |
---|
58 | Pcooling_device = (Pload_dc + Pothers + Pfans_dc)/CoP; |
---|
59 | Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device; |
---|
60 | //System.out.println("---"); |
---|
61 | //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device); |
---|
62 | |
---|
63 | return Pdc; |
---|
64 | } |
---|
65 | |
---|
66 | private double calculatePit(ComputingResource room){ |
---|
67 | double Pload_dc = 0; |
---|
68 | for(ComputingResource cr: room.getChildren()){ |
---|
69 | Rack rack = (Rack)cr; |
---|
70 | Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
71 | } |
---|
72 | return Pload_dc; |
---|
73 | } |
---|
74 | |
---|
75 | private double calculatePothers(double Pload_dc){ |
---|
76 | |
---|
77 | double Pothers = 0; |
---|
78 | |
---|
79 | double a;//experiment |
---|
80 | try{ |
---|
81 | a = ConfigurationOptions.coolingData.getAlpha(); |
---|
82 | } catch (Exception e){ |
---|
83 | a = 0.02; |
---|
84 | } |
---|
85 | |
---|
86 | Pothers = a * Pload_dc; |
---|
87 | return Pothers; |
---|
88 | } |
---|
89 | |
---|
90 | private double calculatePfans(ComputingResource room){ |
---|
91 | |
---|
92 | double Pfans_dc = 0; |
---|
93 | for(Device d: room.getResourceCharacteristic().getDevices()){ |
---|
94 | if(d.getType().getName().equals("Outlet") || d.getType().getName().equals("Inlet") ) |
---|
95 | Pfans_dc = Pfans_dc + d.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
96 | } |
---|
97 | |
---|
98 | return Pfans_dc; |
---|
99 | } |
---|
100 | |
---|
101 | } |
---|