source: DCWoRMS/branches/coolemall/src/experiments/e2dc2015/models/arm/DataCenterEnergyEstimationPlugin.java @ 1593

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