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