source: DCWoRMS/branches/coolemall/src/experiments/simpat2014/models/basic/CoolingDeviceEnergyEstimationPlugin.java @ 1500

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