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

Revision 1500, 13.6 KB checked in by wojtekp, 10 years ago (diff)
Line 
1package experiments.simpat2014.models.recs;
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(ComputingResource nodeGroup: rack.getChildren()){
159                                        for(Device device: nodeGroup.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: nodeGroup.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                        Rack rack = (Rack)cr;
362                        double QnodeGroup = 0;
363                        for(ComputingResource nodeGroup: rack.getChildren()){
364                                double Qnodes = 0;
365                                for(ComputingResource node: nodeGroup.getChildren()){
366                                        double Qcpu = 0;
367                                        Node n = (Node)node;
368                                        for(Processor proc: n.getProcessors()){
369                                                Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
370                                        }
371                                        Qnodes = Qnodes + Qcpu;
372                                }
373                                double Qfans = 0;
374                                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
375                                        Fan fan = (Fan) device;
376                                        if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
377                                                try {
378                                                        Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
379                                                } catch (NoSuchFieldException e) {
380                                                        // TODO Auto-generated catch block
381                                                        e.printStackTrace();
382                                                }
383                                        }else
384                                                Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
385                                }
386                                QnodeGroup = QnodeGroup + Qnodes + Qfans;
387                        }
388                        int nrOfPoweredOffNodes = 0;
389                        for(Node node: rack.getNodes()){
390                                if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
391                                        nrOfPoweredOffNodes++;
392                                }
393                        }
394                        if(nrOfPoweredOffNodes != rack.getNodes().size()){
395                                Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
396                        } else {
397                                Qload_dc  = Qload_dc + QnodeGroup;
398                        }
399                }
400               
401                Qothers = Pothers;
402               
403                Qfans_dc = (1 - nf) * Pfans_dc;
404               
405                Qdc = Qload_dc + Qothers + Qfans_dc;
406
407               
408                return Qdc;
409        }
410       
411       
412        private double calculateQ2(ComputingResource room){
413
414                double Qdc = 0;
415
416                double mair_total;
417                double Vair_total;
418                double ro = 1.168;//constant
419               
420                Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
421               
422                if(Vair_total != -1) {
423                        mair_total = Vair_total * ro;
424                }
425                else {
426       
427                        //in case of DCworms calculation of Vair_total
428                        double mair_rack = 0;
429
430                        for(ComputingResource cr: room.getChildren()){
431                                Rack rack = (Rack)cr;
432                                for(ComputingResource nodeGroup: rack.getChildren()){
433                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
434                                                if(device.getType().equals(StandardResourceType.Outlet)){
435                                                       
436                                                        Fan fan = (Fan) device;
437                                                        double mair_recs = 0;
438                                                        double Vair_recs = 0;
439                                                       
440                                                        double Vair_recs1 = 0;
441
442                                                        Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
443
444                                                        double Vair_recs2 = 0;
445                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
446                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
447
448                                                                        Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
449
450                                                                        break;
451                                                                }
452                                                        }       
453
454                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
455
456                                                        mair_recs = Vair_recs * ro;
457                                                        mair_rack  = mair_rack + mair_recs;
458                                                }
459                                        }
460                                }
461                        }
462                        mair_total = mair_rack;
463                }
464               
465                double Cp = 1004;//constant
466
467
468                double Tr_out;//from database, CFD
469                try{
470                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
471                } catch (Exception e){
472                        Tr_out = -1;
473                }
474               
475                double Tr_in;//experiment
476                try{
477                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
478                } catch (Exception e){
479                        Tr_in = -1;
480                }
481
482
483                Qdc = mair_total * Cp * (Tr_out - Tr_in);
484               
485                return Qdc;
486        }
487}
Note: See TracBrowser for help on using the repository browser.