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

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