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

Revision 1600, 14.6 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 DataCenterEnergyEstimationPlugin 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                Device coolingDevice = null;
56                for(Device device: room.getResourceCharacteristic().getDevices()){
57                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
58                                coolingDevice = device;
59                                break;
60                        }
61                }
62
63               
64                double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
65                double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
66               
67                double delta_Th_ex;//DEBB
68                try{
69                        delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
70                } catch (Exception e){
71                        delta_Th_ex = 10;
72                }
73
74                double delta_Th_dry_cooler;//DEBB
75                try{
76                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
77                } catch (Exception e){
78                        delta_Th_dry_cooler = 10;
79                }
80               
81                double Tamb;//experiment
82                try{
83                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
84                } catch (Exception e){
85                        Tamb = -1;
86                }
87
88                double Tr_out;//from database, CFD
89                try{
90                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
91                } catch (Exception e){
92                        Tr_out = -1;
93                }
94               
95                double Tr_in;//experiment
96                try{
97                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
98                } catch (Exception e){
99                        Tr_in = -1;
100                }
101
102                double Tev = Tr_in - delta_Th_ex;
103
104               
105                //if data not present in DB than don't take Pchiller into account
106                if(Tr_in != -1 && Tr_out != -1) {
107                        if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
108                                Pcooling_device = Pdry_cooler;
109                        else
110                                Pcooling_device = Pchiller;     
111                }
112               
113
114                double airTemp = EnvironmentConditions.ROOM_TEMPERATURE;
115                double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458;
116                //
117                Pcooling_device = Pload_dc/CoP;
118                Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device;
119                //System.out.println("---");
120                //System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller);
121                System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device);
122               
123                //System.out.println("CB2 heat: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
124                //System.out.println("CB2 power: " + Pload_dc + "; " + Pothers + "; " + Pfans_dc + "; " + Pcooling_device + "; " + Pdc);
125
126                return Pdc;
127        }
128       
129        private double calculatePit(ComputingResource room){
130                double Pload_dc = 0;
131                for(ComputingResource cr: room.getChildren()){
132                        Rack rack = (Rack)cr;
133                        Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
134                }
135                return Pload_dc;
136        }
137       
138        private double calculatePothers(double Pload_dc){
139               
140                double Pothers = 0;
141               
142                double a;//experiment
143                try{
144                        a = ConfigurationOptions.coolingData.getAlpha();
145                } catch (Exception e){
146                        a = 0.2;
147                }
148
149                Pothers = a * Pload_dc;
150                return Pothers;
151        }
152       
153        private double calculatePfans(ComputingResource room){
154               
155                double Pfans_dc = 0;
156
157                Device coolingDevice = null;
158                for(Device device: room.getResourceCharacteristic().getDevices()){
159                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
160                                coolingDevice = device;
161                                break;
162                        }
163                }
164               
165                double nf;//DEBB
166                try{
167                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
168                } catch (Exception e){
169                        nf = 0.6;
170                }
171                double delta_p;//from database, CFD
172                double Vair_total;
173               
174                delta_p = ConfigurationOptions.coolingData.getPressureDrop();
175                Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
176               
177                if(delta_p != -1 && Vair_total != -1)
178                        Pfans_dc = delta_p * Vair_total / nf;
179                else {
180                       
181                        double ro = 1.168;//constant
182               
183                        double mair_total;
184                       
185                        double mair_rack = 0;
186
187                        for(ComputingResource cr: room.getChildren()){
188                                Rack rack = (Rack)cr;
189                                for(ComputingResource nodeGroup: rack.getChildren()){
190                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
191                                                if(device.getType().equals(StandardResourceType.Fan)){
192                                                       
193                                                        Fan fan = (Fan) device;
194                                                        double mair_recs = 0;
195                                                        double Vair_recs = 0;
196                                                       
197                                                        double Vair_recs1 = 0;
198
199                                                        Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
200
201                                                        double Vair_recs2 = 0;
202                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
203                                                                if(device2.getType().equals(StandardResourceType.Fan) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
204
205                                                                        Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
206
207                                                                        break;
208                                                                }
209                                                        }       
210
211                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
212
213                                                        mair_recs = Vair_recs * ro;
214                                                        mair_rack  = mair_rack + mair_recs;
215                                                }
216                                        }
217                                }
218                        }
219                        mair_total = mair_rack;
220                        Vair_total = mair_total / ro;
221                       
222                        for(Device d: room.getResourceCharacteristic().getDevices()){
223                                if(d.getFullName().contains("Cooling"))
224                                        continue;
225                                Pfans_dc = Pfans_dc + d.getPowerInterface().getRecentPowerUsage().getValue();
226                        }
227                        //if(delta_p != -1 && Vair_total != -1)
228                        //      Pfans_dc = delta_p * Vair_total / nf;
229                }
230                return Pfans_dc;
231        }
232       
233        private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
234               
235                double Pchiller = 0;
236               
237                Device coolingDevice = null;
238                for(Device device: room.getResourceCharacteristic().getDevices()){
239                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
240                                coolingDevice = device;
241                                break;
242                        }
243                }
244               
245                double delta_Th_dry_cooler;//DEBB
246                try{
247                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
248                } catch (Exception e){
249                        delta_Th_dry_cooler = 10;
250                }
251               
252                double Tamb;//experiment
253                try{
254                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
255                } catch (Exception e){
256                        Tamb = -1;
257                }
258               
259                double ncc;//DEBB
260                try{
261                        ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
262                } catch (Exception e){
263                        ncc = 0.95;
264                }
265               
266                double Qcooling_rated;//DEBB
267                try{
268                        Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
269                } catch (Exception e){
270                        Qcooling_rated = 80000;
271                }
272               
273                double EERrated;//DEBB
274                try{
275                        EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
276                } catch (Exception e){
277                        EERrated = 5;
278                }
279
280                double delta_Th_ex;//DEBB
281                try{
282                        delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
283                } catch (Exception e){
284                        delta_Th_ex = 10;
285                }
286               
287                double Tr_in;//experiment
288                try{
289                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
290                } catch (Exception e){
291                        Tr_in = -1;
292                }
293
294               
295                double Tev;             
296                double CoolT;
297                double Qcooling_nom;
298                double PLR;
299
300                double delta_T;
301                double CoolPR;
302                double CoolPRrated;
303                double CoolPRT;
304                double CoolPRPLR;
305                double EER;
306               
307               
308                double Qdc = calculateQ(Pfans_dc, Pothers, room);
309                double Qcooling = Qdc / ncc;
310
311                Tev = Tr_in - delta_Th_ex;
312                double Tevf = 32 + 1.8 * Tev;
313               
314                double Tco = Tamb + delta_Th_dry_cooler;
315               
316                double Tcof = 32 + 1.8 * Tco;
317                CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
318                Qcooling_nom = Qcooling_rated * CoolT;         
319                PLR = Qcooling / Qcooling_nom;
320               
321                delta_T = Tcof - Tevf;
322                CoolPRrated = 1 / EERrated;
323                CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
324                CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
325                CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
326                EER = 1/CoolPR;
327               
328                Pchiller = Qcooling/EER;
329
330                return Pchiller;
331        }
332       
333        private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
334
335                double Pdry_cooler = 0;
336                Device coolingDevice = null;
337                for(Device device: room.getResourceCharacteristic().getDevices()){
338                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
339                                coolingDevice = device;
340                                break;
341                        }
342                }
343               
344                double n_dry_cooler;//DEBB
345                try{
346                         n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
347                } catch (Exception e){
348                         n_dry_cooler = 0.02;
349                }
350
351                double ncc;//DEBB
352                try{
353                        ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
354                } catch (Exception e){
355                        ncc = 0.95;
356                }
357               
358
359                double Qdc = calculateQ(Pfans_dc, Pothers, room);
360                double Qcooling = Qdc / ncc;
361
362                Pdry_cooler = n_dry_cooler * Qcooling;
363               
364                return Pdry_cooler;
365        }
366       
367        private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
368
369                double Qdc = 0;
370               
371                Device coolingDevice = null;
372                for(Device device: room.getResourceCharacteristic().getDevices()){
373                        if(device.getType().equals(StandardResourceType.CoolingDevice)){
374                                coolingDevice = device;
375                                break;
376                        }
377                }
378
379                double nf;//DEBB
380                try{
381                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
382                } catch (Exception e){
383                        nf = 0.6;
384                }
385
386                /**************** HEAT ****************/
387               
388                double Qload_dc = 0;
389                double Qothers = 0;
390                double Qfans_dc = 0;
391
392                double delta_2; //DEBB - currently not present;
393                delta_2 = 0.4;
394               
395                for(ComputingResource cr: room.getChildren()){
396                        Rack rack = (Rack)cr;
397                        double QnodeGroup = 0;
398                        for(ComputingResource nodeGroup: rack.getChildren()){
399                                double Qnodes = 0;
400                                for(ComputingResource node: nodeGroup.getChildren()){
401                                        double Qcpu = 0;
402                                        Node n = (Node)node;
403                                        for(Processor proc: n.getProcessors()){
404                                                Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
405                                        }
406                                        Qnodes = Qnodes + Qcpu;
407                                }
408                                double Qfans = 0;
409                                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
410                                        Fan fan = (Fan) device;
411                                        if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
412                                                try {
413                                                        Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
414                                                } catch (NoSuchFieldException e) {
415                                                        // TODO Auto-generated catch block
416                                                        e.printStackTrace();
417                                                }
418                                        }else
419                                                Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
420                                }
421                                QnodeGroup = QnodeGroup + Qnodes + Qfans;
422                        }
423                        int nrOfPoweredOffNodes = 0;
424                        for(Node node: rack.getNodes()){
425                                if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
426                                        nrOfPoweredOffNodes++;
427                                }
428                        }
429                        if(nrOfPoweredOffNodes != rack.getNodes().size()){
430                                Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
431                        } else {
432                                Qload_dc  = Qload_dc + QnodeGroup;
433                        }
434                }
435               
436                Qothers = Pothers;
437               
438                Qfans_dc = (1 - nf) * Pfans_dc;
439               
440                Qdc = Qload_dc + Qothers + Qfans_dc;
441
442               
443                return Qdc;
444        }
445       
446       
447        private double calculateQ2(ComputingResource room){
448
449                double Qdc = 0;
450
451                double mair_total;
452                double Vair_total;
453                double ro = 1.168;//constant
454               
455                Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
456               
457                if(Vair_total != -1) {
458                        mair_total = Vair_total * ro;
459                }
460                else {
461       
462                        //in case of DCworms calculation of Vair_total
463                        double mair_rack = 0;
464
465                        for(ComputingResource cr: room.getChildren()){
466                                Rack rack = (Rack)cr;
467                                for(ComputingResource nodeGroup: rack.getChildren()){
468                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
469                                                if(device.getType().equals(StandardResourceType.Outlet)){
470                                                       
471                                                        Fan fan = (Fan) device;
472                                                        double mair_recs = 0;
473                                                        double Vair_recs = 0;
474                                                       
475                                                        double Vair_recs1 = 0;
476
477                                                        Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
478
479                                                        double Vair_recs2 = 0;
480                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
481                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
482
483                                                                        Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
484
485                                                                        break;
486                                                                }
487                                                        }       
488
489                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
490
491                                                        mair_recs = Vair_recs * ro;
492                                                        mair_rack  = mair_rack + mair_recs;
493                                                }
494                                        }
495                                }
496                        }
497                        mair_total = mair_rack;
498                }
499               
500                double Cp = 1004;//constant
501
502
503                double Tr_out;//from database, CFD
504                try{
505                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
506                } catch (Exception e){
507                        Tr_out = -1;
508                }
509               
510                double Tr_in;//experiment
511                try{
512                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
513                } catch (Exception e){
514                        Tr_in = -1;
515                }
516
517
518                Qdc = mair_total * Cp * (Tr_out - Tr_in);
519               
520                return Qdc;
521        }
522       
523}
Note: See TracBrowser for help on using the repository browser.