source: DCWoRMS/branches/coolemall/src/test/simpat/models/article/DataCenterEnergyEstimationPlugin.java @ 1469

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