source: DCWoRMS/branches/coolemall/src/test/fips/models/i5/TangHeatDataCenterEnergyEstimationPlugin.java @ 1600

Revision 1600, 4.5 KB checked in by wojtekp, 8 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.fips.models.i5;
2
3
4import schedframe.resources.StandardResourceType;
5import schedframe.resources.computing.ComputingResource;
6import schedframe.resources.computing.Node;
7import schedframe.resources.computing.Processor;
8import schedframe.resources.computing.Rack;
9import schedframe.resources.computing.profiles.energy.ResourceEvent;
10import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
11import schedframe.resources.devices.Device;
12import schedframe.resources.devices.Fan;
13import schedframe.resources.devices.PhysicalResource;
14import schedframe.scheduling.manager.tasks.JobRegistry;
15import simulator.ConfigurationOptions;
16import example.energy.BaseEnergyEstimationPlugin;
17import example.energy.coolemall.CoolEmAllTestbedMeasurements;
18import test.fips.EnvironmentConditions;
19
20public class TangHeatDataCenterEnergyEstimationPlugin 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 Pcooling_device = 0;
30
31                ComputingResource room = (ComputingResource) resource;
32               
33                /**************** IT PART ****************/
34               
35                /*********** Pload_dc ***********/
36                Pload_dc = calculatePit(room);
37
38               
39               
40                /**************** NON- IT PART ****************/
41               
42                /*********** Pothers ***********/               
43                Pothers = calculatePothers(Pload_dc);
44               
45               
46               
47                /************* COOLING PART *************/
48
49                Device coolingDevice = null;
50                for(Device device: room.getResourceCharacteristic().getDevices()){
51                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
52                                coolingDevice = device;
53                                break;
54                        }
55                }
56               
57                /************ Pcooling_device ************/
58                double airTemp = EnvironmentConditions.ROOM_TEMPERATURE;
59                double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458;
60                //
61                double Q= calculateQ(Pothers, room);
62                Pcooling_device = coolingDevice.getPowerInterface().getRecentPowerUsage().getValue();
63                Pdc = Pload_dc + Pcooling_device+ Pothers;
64                //System.out.println("---");
65                //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers +  " Pcooling_device: " + Pcooling_device);
66
67                return Pdc;
68        }
69       
70        private double calculatePit(ComputingResource room){
71                double Pload_dc = 0;
72                for(ComputingResource cr: room.getChildren()){
73                        Rack rack = (Rack)cr;
74                        Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
75                }
76                return Pload_dc;
77        }
78       
79        private double calculatePothers(double Pload_dc){
80               
81                double Pothers = 0;
82               
83                double a;//experiment
84                try{
85                        a = ConfigurationOptions.coolingData.getAlpha();
86                } catch (Exception e){
87                        a = 0.02;
88                }
89
90                Pothers = a * Pload_dc;
91                return Pothers;
92        }
93       
94
95        private double calculateQ(double Pothers, ComputingResource room){
96
97                double Qdc = 0;
98               
99
100                /**************** HEAT ****************/
101               
102                double Qload_dc = 0;
103                double Qothers = 0;
104
105                double delta_2; //DEBB - currently not present;
106                delta_2 = 0.4;
107               
108                for(ComputingResource cr: room.getChildren()){
109                        Rack rack = (Rack)cr;
110                        double QnodeGroup = 0;
111                        for(ComputingResource nodeGroup: rack.getChildren()){
112                                double Qnodes = 0;
113                                for(ComputingResource node: nodeGroup.getChildren()){
114                                        double Qcpu = 0;
115                                        Node n = (Node)node;
116                                        for(Processor proc: n.getProcessors()){
117                                                Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
118                                        }
119                                        Qnodes = node.getPowerInterface().getRecentPowerUsage().getValue() + Qcpu;
120                                }
121                                double Qfans = 0;
122                                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
123                                        Fan fan = (Fan) device;
124                                        if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
125                                                try {
126                                                        Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
127                                                } catch (NoSuchFieldException e) {
128                                                        // TODO Auto-generated catch block
129                                                        e.printStackTrace();
130                                                }
131                                        }else
132                                                Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
133                                }
134                                QnodeGroup = QnodeGroup + Qnodes + Qfans;
135                        }
136                        int nrOfPoweredOffNodes = 0;
137                        for(Node node: rack.getNodes()){
138                                if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
139                                        nrOfPoweredOffNodes++;
140                                }
141                        }
142                        if(nrOfPoweredOffNodes != rack.getNodes().size()){
143                                Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
144                        } else {
145                                Qload_dc  = Qload_dc + QnodeGroup;
146                        }
147                }
148               
149                Qothers = Pothers;
150               
151               
152                Qdc = Qload_dc + Qothers;
153
154               
155                return Qdc;
156        }
157       
158}
Note: See TracBrowser for help on using the repository browser.