Changeset 1299 for DCWoRMS/branches/coolemall/src/example
- Timestamp:
- 03/19/14 18:22:27 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/example
- Files:
-
- 5 added
- 2 deleted
- 11 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java
r1207 r1299 1 1 package example.energy.coolemall; 2 2 3 import schedframe.resources.computing.Node; 3 4 import schedframe.resources.computing.coolemall.ComputeBox1; 4 5 import schedframe.resources.computing.coolemall.NodeGroup; 5 6 import schedframe.resources.computing.profiles.energy.EnergyEvent; 7 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 6 8 import schedframe.resources.devices.PhysicalResource; 7 9 import schedframe.scheduling.manager.tasks.JobRegistry; … … 21 23 } 22 24 } 23 powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY; 25 26 int nrOfPoweredOffNodes = 0; 27 for(Node node: computeBox1.getNodes()){ 28 if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 29 nrOfPoweredOffNodes++; 30 } 31 } 32 if(nrOfPoweredOffNodes != computeBox1.getNodes().size()){ 33 powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY; 34 } 24 35 return powerConsumption; 25 36 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java
r1253 r1299 9 9 import schedframe.resources.computing.coolemall.NodeGroup; 10 10 import schedframe.resources.computing.profiles.energy.EnergyEvent; 11 import schedframe.resources.computing.profiles.energy. airthroughput.UserAirThroughputStateName;11 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 12 12 import schedframe.resources.devices.Device; 13 import schedframe.resources.devices.Fan; 13 14 import schedframe.resources.devices.PhysicalResource; 14 15 import schedframe.scheduling.manager.tasks.JobRegistry; 15 16 import simulator.ConfigurationOptions; 16 import test.Node_Fan_Mapping;17 17 import example.energy.BaseEnergyEstimationPlugin; 18 18 19 19 public class CB2EnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ 20 20 21 22 21 public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 23 22 PhysicalResource resource) { 24 25 23 26 24 double Pdc; … … 36 34 37 35 /*********** Pload_dc ***********/ 38 for(ComputingResource cr: room.getChildren()){ 39 ComputeBox1 cb1 = (ComputeBox1)cr; 40 Pload_dc = Pload_dc + cb1.getPowerInterface().getRecentPowerUsage().getValue(); 41 } 42 36 Pload_dc = calculatePit(room); 37 43 38 44 39 … … 46 41 47 42 /*********** Pothers ***********/ 48 double a;//experiment 49 try{ 50 a = ConfigurationOptions.alpha; 51 } catch (Exception e){ 52 a = 0.02; 53 } 54 55 //if not defined assume alpha = 0.02 56 if(a == -1) 57 a = 0.02; 58 59 Pothers = a * Pload_dc; 43 Pothers = calculatePothers(Pload_dc); 60 44 61 45 62 46 63 47 /************* COOLING PART *************/ 64 48 49 50 /*********** Pfans_dc ***********/ 51 Pfans_dc = calculatePfans(room); 52 53 /************ Pcooling_device ************/ 65 54 Device coolingDevice = null; 66 55 for(Device device: room.getResourceCharacteristic().getDevices()){ … … 72 61 73 62 74 /*********** Pfans_dc ***********/ 75 double ro = 1.168;//constant 76 double nf;//DEBB 77 try{ 78 nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 79 } catch (Exception e){ 80 nf = 0.6; 81 } 82 double delta_p;//from database, CFD 83 try{ 84 delta_p = ConfigurationOptions.pressureDrop; 85 } catch (Exception e){ 86 delta_p = -1; 87 } 88 89 double Vair_total; 90 double mair_total; 91 92 //in case of DCworms calculation of Vair_total 93 double mair_rack = 0; 94 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; 95 126 for(ComputingResource cr: room.getChildren()){ 96 127 ComputeBox1 cb1 = (ComputeBox1)cr; 97 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 98 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 99 if(device.getType().equals(StandardResourceType.Outlet)){ 100 double mair_recs = 0; 101 double Vair_recs = 0; 102 103 double Vair_recs1 = 0; 104 /*try { 105 Vair_recs1 = device.getAirThroughputInterface().getAirFlow(device.getAirThroughputInterface().getAirThroughputState()); 106 } catch (NoSuchFieldException e) { 128 Pload_dc = Pload_dc + cb1.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 ComputeBox1 cb1 = (ComputeBox1)cr; 184 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 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.getAirThroughputInterface().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.getAirThroughputInterface().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; 107 210 } 108 */109 if(device.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){110 Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW;111 } else {112 Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW;113 }114 double Vair_recs2 = 0;115 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){116 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(device.getFullName().replace("Outlet", "Inlet"))){117 /*try {118 Vair_recs2 = device2.getAirThroughputInterface().getAirFlow(device2.getAirThroughputInterface().getAirThroughputState());119 } catch (NoSuchFieldException e) {120 }121 */122 if(device2.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){123 Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW;124 } else {125 Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW;126 }127 break;128 }129 }130 131 Vair_recs = Math.max(Vair_recs1, Vair_recs2);132 133 mair_recs = Vair_recs * ro;134 mair_rack = mair_rack + mair_recs;135 211 } 136 212 } 137 213 } 138 } 139 mair_total = mair_rack; 140 Vair_total = mair_total / ro; 141 142 //in case of CFD calculation of Vair_total 143 try{ 144 Vair_total = ConfigurationOptions.airFlowVolume; 145 } catch (Exception e){ 146 Vair_total = 0; 147 } 148 mair_total = Vair_total * ro; 149 150 //if data not present in DB than don't take Pfans_dc into account 151 if(delta_p != -1 && Vair_total != -1) 152 Pfans_dc = delta_p * Vair_total / nf; 153 154 155 156 /************ Pcooling_device ************/ 157 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){ 158 225 159 226 double Pchiller = 0; 160 double Pdry_cooler; 161 162 /*********** Pchiller ***********/ 163 double Cp = 1004;//constant 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 } 164 249 165 250 double ncc;//DEBB … … 174 259 Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue(); 175 260 } catch (Exception e){ 176 Qcooling_rated = 3000;261 Qcooling_rated = 80000; 177 262 } 178 263 … … 183 268 EERrated = 5; 184 269 } 185 186 double Tco;//DEBB187 try{188 Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue();189 } catch (Exception e){190 Tco = 30;191 }192 270 193 271 double delta_Th_ex;//DEBB … … 197 275 delta_Th_ex = 10; 198 276 } 199 200 double Tr_out;//from database, CFD201 try{202 Tr_out = ConfigurationOptions.outletRoomAirTempeature;203 } catch (Exception e){204 Tr_out = -1;205 }206 277 207 278 double Tr_in;//experiment 208 279 try{ 209 Tr_in = ConfigurationOptions. inletRoomAirTempeature;280 Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 210 281 } catch (Exception e){ 211 282 Tr_in = -1; 212 283 } 213 214 double Qdc; 215 double Qcooling; 284 216 285 217 286 double Tev; … … 228 297 229 298 230 Qdc = mair_total * Cp * (Tr_out - Tr_in);231 Qcooling = Qdc / ncc;299 double Qdc = calculateQ(Pfans_dc, Pothers, room); 300 double Qcooling = Qdc / ncc; 232 301 233 302 Tev = Tr_in - delta_Th_ex; 234 303 double Tevf = 32 + 1.8 * Tev; 304 305 double Tco = Tamb + delta_Th_dry_cooler; 306 235 307 double Tcof = 32 + 1.8 * Tco; 236 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; … … 247 319 Pchiller = Qcooling/EER; 248 320 249 250 251 252 /*********** Pdry_cooler ***********/ 253 double delta_Th_dry_cooler;//DEBB 254 try{ 255 delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 256 } catch (Exception e){ 257 delta_Th_dry_cooler = 10; 258 } 259 260 double Tamb;//experiment 261 try{ 262 Tamb = ConfigurationOptions.ambientAirTempeature; 263 } catch (Exception e){ 264 Tamb = -1; 265 } 266 267 Pdry_cooler = 0.02 * Qcooling; 268 269 270 //if data not present in DB than don't take Pchiller into account 271 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) { 272 if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler > Tev - Tamb) 273 Pcooling_device = Pdry_cooler; 274 else 275 Pcooling_device = Pchiller; 276 } 277 278 279 280 Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device; 281 //System.out.println("---"); 282 //System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller); 283 //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device); 284 285 286 287 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 288 377 /**************** HEAT ****************/ 289 double Qdc2;290 378 291 379 double Qload_dc = 0; … … 306 394 Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); 307 395 } 308 double Qfan = 0; 309 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 310 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 311 if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 312 Qfan = Qfan + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 313 }else 314 Qfan = Qfan + device.getPowerInterface().getRecentPowerUsage().getValue(); 315 break; 396 Qnodes = Qnodes + Qcpu; 397 } 398 double Qfans = 0; 399 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 400 Fan fan = (Fan) device; 401 if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 402 try { 403 Qfans = Qfans + (1 - delta_2) * fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 404 } catch (NoSuchFieldException e) { 405 // TODO Auto-generated catch block 406 e.printStackTrace(); 407 } 408 }else 409 Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); 410 } 411 QnodeGroup = QnodeGroup + Qnodes + Qfans; 412 } 413 int nrOfPoweredOffNodes = 0; 414 for(Node node: cb1.getNodes()){ 415 if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 416 nrOfPoweredOffNodes++; 417 } 418 } 419 if(nrOfPoweredOffNodes != cb1.getNodes().size()){ 420 Qload_dc = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 421 } else { 422 Qload_dc = Qload_dc + QnodeGroup; 423 } 424 } 425 426 Qothers = Pothers; 427 428 Qfans_dc = (1 - nf) * Pfans_dc; 429 430 Qdc = Qload_dc + Qothers + Qfans_dc; 431 432 433 return Qdc; 434 } 435 436 437 private double calculateQ2(ComputingResource room){ 438 439 double Qdc = 0; 440 441 double mair_total; 442 double Vair_total; 443 double ro = 1.168;//constant 444 445 Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 446 447 if(Vair_total != -1) { 448 mair_total = Vair_total * ro; 449 } 450 else { 451 452 //in case of DCworms calculation of Vair_total 453 double mair_rack = 0; 454 455 for(ComputingResource cr: room.getChildren()){ 456 ComputeBox1 cb1 = (ComputeBox1)cr; 457 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 458 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 459 if(device.getType().equals(StandardResourceType.Outlet)){ 460 461 Fan fan = (Fan) device; 462 double mair_recs = 0; 463 double Vair_recs = 0; 464 465 double Vair_recs1 = 0; 466 467 Vair_recs1 = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 468 469 double Vair_recs2 = 0; 470 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 471 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 472 473 Vair_recs2 = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 474 475 break; 476 } 477 } 478 479 Vair_recs = Math.max(Vair_recs1, Vair_recs2); 480 481 mair_recs = Vair_recs * ro; 482 mair_rack = mair_rack + mair_recs; 316 483 } 317 484 } 318 Qnodes = Qnodes + Qcpu + (1 - delta_2) * Qfan;319 485 } 320 QnodeGroup = QnodeGroup + Qnodes; 321 } 322 Qload_dc = Qload_dc + QnodeGroup; 323 } 324 325 Qload_dc = Qload_dc + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 326 327 Qothers = Pothers; 328 329 Qfans_dc = (1 - nf) * Pfans_dc; 330 331 Qdc2 = Qload_dc + Qothers + Qfans_dc; 332 333 double Qdc2v2 = 0; 334 335 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) 336 Qdc2v2 = mair_total * Cp * (Tr_out - Tr_in); 337 338 //System.out.println("Qdc2: " + Qdc2 + " Qdc2v2: " + Qdc2v2 + "diff: " + (Qdc2v2 - Qdc2)); 339 340 341 return Pdc; 342 } 343 344 486 } 487 mair_total = mair_rack; 488 } 489 490 double Cp = 1004;//constant 491 492 493 double Tr_out;//from database, CFD 494 try{ 495 Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 496 } catch (Exception e){ 497 Tr_out = -1; 498 } 499 500 double Tr_in;//experiment 501 try{ 502 Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 503 } catch (Exception e){ 504 Tr_in = -1; 505 } 506 507 508 Qdc = mair_total * Cp * (Tr_out - Tr_in); 509 510 return Qdc; 511 } 512 345 513 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolEmAllTestbedMeasurements.java
r1207 r1299 4 4 5 5 //HARDWARE 6 public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112;7 public static final double SINGLE_FAN_OFF_AIR_FLOW = 0;6 //public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112; 7 //public static final double SINGLE_FAN_OFF_AIR_FLOW = 0; 8 8 9 public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 6;10 public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0;9 //public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 0; 10 //public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0; 11 11 12 public static final double OTHER_DEVICES_POWER_CONSUMPTION = 775;12 public static final double OTHER_DEVICES_POWER_CONSUMPTION = 0; 13 13 14 14 public static final double POWER_SUPPLY_EFFICIENCY = 0.87; 15 15 16 16 17 public static final int Atom_D510_NR_OF_THREADS = 2;18 19 public static final int Atom_N2600_NR_OF_THREADS = 2;20 21 public static final int Core_i7_2715QE_NR_OF_THREADS = 4;22 23 public static final int Core_i7_3615QE_NR_OF_THREADS = 4;24 25 public static final int Fusion_G_T40N_NR_OF_THREADS = 2;26 27 //APPLICATIONS28 public static final double Atom_D510 = 336.3;29 30 public static final double Atom_N2600 = 336.3;31 32 public static final double Core_i7_2715QE = 3076.4;33 34 public static final double Core_i7_3615QE = 3786.0;35 36 public static final double Fusion_G_T40N = 649.3;37 38 39 17 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java
r1207 r1299 1 1 package example.energy.coolemall; 2 2 3 import schedframe.events.scheduling.EventReason; 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.coolemall.ComputeBox1; 8 import schedframe.resources.computing.coolemall.NodeGroup; 4 9 import schedframe.resources.computing.profiles.energy.EnergyEvent; 10 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 5 11 import schedframe.resources.devices.Device; 12 import schedframe.resources.devices.Fan; 6 13 import schedframe.resources.devices.PhysicalResource; 7 14 import schedframe.scheduling.manager.tasks.JobRegistry; … … 11 18 public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { 12 19 20 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 21 double airThroughput = 0; 22 return airThroughput; 23 } 24 13 25 public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 14 26 PhysicalResource resource) { 15 27 16 28 double powerConsumption = 0; 17 29 18 30 Device coolingDevice = (Device) resource; 19 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 ComputeBox1 cb1 = (ComputeBox1)cr; 100 Pload_dc = Pload_dc + cb1.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 ComputeBox1 cb1 = (ComputeBox1)cr; 156 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 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.getAirThroughputInterface().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.getAirThroughputInterface().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 20 198 double Pchiller = 0; 21 double Pdry_cooler; 22 23 /*********** Pchiller ***********/ 24 double Cp = 1004;//constant 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 } 25 221 26 222 double ncc;//DEBB … … 35 231 Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue(); 36 232 } catch (Exception e){ 37 Qcooling_rated = 3000;233 Qcooling_rated = 80000; 38 234 } 39 235 … … 44 240 EERrated = 5; 45 241 } 46 47 double Tco;//DEBB48 try{49 Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue();50 } catch (Exception e){51 Tco = 30;52 }53 242 54 243 double delta_Th_ex;//DEBB … … 58 247 delta_Th_ex = 10; 59 248 } 60 61 double Tr_out;//from database, CFD62 try{63 Tr_out = ConfigurationOptions.outletRoomAirTempeature;64 } catch (Exception e){65 Tr_out = -1;66 }67 249 68 250 double Tr_in;//experiment 69 251 try{ 70 Tr_in = ConfigurationOptions. inletRoomAirTempeature;252 Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 71 253 } catch (Exception e){ 72 254 Tr_in = -1; 73 255 } 74 256 75 76 77 double ro = 1.168;//cosntant78 double Vair_total;79 double mair_total;80 try{81 Vair_total = ConfigurationOptions.airFlowVolume;82 } catch (Exception e){83 Vair_total = 0;84 }85 mair_total = Vair_total * ro;86 87 88 double Qdc;89 double Qcooling;90 257 91 258 double Tev; … … 102 269 103 270 104 Qdc = mair_total * Cp * (Tr_out - Tr_in);105 Qcooling = Qdc / ncc;271 double Qdc = calculateQ(Pfans_dc, Pothers, room); 272 double Qcooling = Qdc / ncc; 106 273 107 274 Tev = Tr_in - delta_Th_ex; 108 275 double Tevf = 32 + 1.8 * Tev; 276 277 double Tco = Tamb + delta_Th_dry_cooler; 278 109 279 double Tcof = 32 + 1.8 * Tco; 110 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; … … 121 291 Pchiller = Qcooling/EER; 122 292 123 124 125 126 /*********** Pdry_cooler ***********/ 127 double delta_Th_dry_cooler;//DEBB 128 try{ 129 delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 130 } catch (Exception e){ 131 delta_Th_dry_cooler = 10; 132 } 133 134 double Tamb;//experiment 135 try{ 136 Tamb = ConfigurationOptions.ambientAirTempeature; 137 } catch (Exception e){ 138 Tamb = -1; 139 } 140 141 Pdry_cooler = 0.02 * Qcooling; 142 143 144 //if data not present in DB than don't take Pchiller into account 145 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) { 146 if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler > Tev - Tamb) 147 powerConsumption = Pdry_cooler; 148 else 149 powerConsumption = Pchiller; 150 } 151 152 153 154 155 return powerConsumption; 156 } 157 158 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 159 double airThroughput = 0; 160 try { 161 if(event.getReason() == EventReason.SIM_INIT) 162 return airThroughput; 163 //airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF); 164 else 165 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 166 } catch (NoSuchFieldException e) { 167 // TODO Auto-generated catch block 168 e.printStackTrace(); 169 } 170 171 return airThroughput; 172 } 173 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 ComputeBox1 cb1 = (ComputeBox1)cr; 360 double QnodeGroup = 0; 361 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 362 double Qnodes = 0; 363 for(Node node: nodeGroup.getNodes()){ 364 double Qcpu = 0; 365 for(Processor proc: node.getProcessors()){ 366 Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); 367 } 368 Qnodes = Qnodes + Qcpu; 369 } 370 double Qfans = 0; 371 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 372 Fan fan = (Fan) device; 373 if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 374 try { 375 Qfans = Qfans + (1 - delta_2) * fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 376 } catch (NoSuchFieldException e) { 377 // TODO Auto-generated catch block 378 e.printStackTrace(); 379 } 380 }else 381 Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); 382 } 383 QnodeGroup = QnodeGroup + Qnodes + Qfans; 384 } 385 int nrOfPoweredOffNodes = 0; 386 for(Node node: cb1.getNodes()){ 387 if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 388 nrOfPoweredOffNodes++; 389 } 390 } 391 if(nrOfPoweredOffNodes != cb1.getNodes().size()){ 392 Qload_dc = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 393 } else { 394 Qload_dc = Qload_dc + QnodeGroup; 395 } 396 } 397 398 Qothers = Pothers; 399 400 Qfans_dc = (1 - nf) * Pfans_dc; 401 402 Qdc = Qload_dc + Qothers + Qfans_dc; 403 404 405 return Qdc; 406 } 407 408 409 private double calculateQ2(ComputingResource room){ 410 411 double Qdc = 0; 412 413 double mair_total; 414 double Vair_total; 415 double ro = 1.168;//constant 416 417 Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 418 419 if(Vair_total != -1) { 420 mair_total = Vair_total * ro; 421 } 422 else { 423 424 //in case of DCworms calculation of Vair_total 425 double mair_rack = 0; 426 427 for(ComputingResource cr: room.getChildren()){ 428 ComputeBox1 cb1 = (ComputeBox1)cr; 429 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 430 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 431 if(device.getType().equals(StandardResourceType.Outlet)){ 432 433 Fan fan = (Fan) device; 434 double mair_recs = 0; 435 double Vair_recs = 0; 436 437 double Vair_recs1 = 0; 438 439 Vair_recs1 = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 440 441 double Vair_recs2 = 0; 442 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 443 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 444 445 Vair_recs2 = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 446 447 break; 448 } 449 } 450 451 Vair_recs = Math.max(Vair_recs1, Vair_recs2); 452 453 mair_recs = Vair_recs * ro; 454 mair_rack = mair_rack + mair_recs; 455 } 456 } 457 } 458 } 459 mair_total = mair_rack; 460 } 461 462 double Cp = 1004;//constant 463 464 465 double Tr_out;//from database, CFD 466 try{ 467 Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 468 } catch (Exception e){ 469 Tr_out = -1; 470 } 471 472 double Tr_in;//experiment 473 try{ 474 Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 475 } catch (Exception e){ 476 Tr_in = -1; 477 } 478 479 480 Qdc = mair_total * Cp * (Tr_out - Tr_in); 481 482 return Qdc; 483 } 174 484 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java
r1207 r1299 2 2 3 3 import schedframe.events.scheduling.EventReason; 4 import schedframe.resources.computing.ComputingResource; 5 import schedframe.resources.computing.Node; 4 6 import schedframe.resources.computing.profiles.energy.EnergyEvent; 5 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 7 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 8 import schedframe.resources.devices.Device; 9 import schedframe.resources.devices.Fan; 6 10 import schedframe.resources.devices.PhysicalResource; 7 11 import schedframe.scheduling.manager.tasks.JobRegistry; … … 14 18 15 19 double powerConsumption = 0; 16 /*try { 17 powerConsumption = resource.getAirThroughputInterface().getPowerConsumption(resource.getAirThroughputInterface().getAirThroughputState()); 20 21 Fan fan = (Fan) resource; 22 try { 23 powerConsumption = fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 18 24 } catch (NoSuchFieldException e) { 19 25 // TODO Auto-generated catch block 20 26 e.printStackTrace(); 21 } */27 } 22 28 23 if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){29 /*if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 24 30 powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_POWER_CONSUMPTION; 25 31 } else { 26 32 powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 27 } 28 return powerConsumption ;33 }*/ 34 return powerConsumption * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size(); 29 35 } 30 36 31 37 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 38 32 39 double airThroughput = 0; 33 /*try { 40 Fan fan = (Fan) resource; 41 try { 34 42 if(event.getReason() == EventReason.SIM_INIT) 35 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());43 airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState()); 36 44 else 37 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());45 airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState()); 38 46 } catch (NoSuchFieldException e) { 39 47 // TODO Auto-generated catch block 40 48 e.printStackTrace(); 41 } */49 } 42 50 43 if(event.getReason() == EventReason.SIM_INIT){51 /*if(event.getReason() == EventReason.SIM_INIT){ 44 52 if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 45 53 airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW; … … 54 62 airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW; 55 63 } 56 } 64 }*/ 57 65 58 66 59 return airThroughput; 67 return airThroughput * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size(); 68 } 69 70 private int getNumberOfWorkingNodes(Device device){ 71 int quantity = 0; 72 Fan fan = (Fan) device; 73 for(ComputingResource compRes: device.getComputingResource().getChildren()){ 74 Node node = (Node)compRes; 75 if(fan.getChilledResources().contains(node.getFullName()) && node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) ){ 76 quantity++; 77 } 78 } 79 return quantity; 60 80 } 61 81 -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java
r1207 r1299 1 1 package example.energy.coolemall; 2 2 3 import schedframe.resources.StandardResourceType; 4 import schedframe.resources.computing.ComputingResource; 5 import schedframe.resources.computing.coolemall.ComputeBox1; 6 import schedframe.resources.computing.coolemall.NodeGroup; 3 7 import schedframe.resources.computing.profiles.energy.EnergyEvent; 8 import schedframe.resources.devices.Device; 9 import schedframe.resources.devices.Fan; 4 10 import schedframe.resources.devices.PhysicalResource; 5 11 import schedframe.scheduling.manager.tasks.JobRegistry; … … 12 18 PhysicalResource resource) { 13 19 20 /*********** Pfans_dc ***********/ 14 21 double powerConsumption = 0; 22 double nf = 0.6; 23 24 double delta_p;//from database, CFD 25 double Vair_total; 26 27 delta_p = ConfigurationOptions.coolingData.getPressureDrop(); 28 Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 29 30 if(delta_p != -1 && Vair_total != -1) 31 powerConsumption = delta_p * Vair_total / nf; 32 else { 33 Device flowPump = (Device) resource; 34 ComputingResource room = flowPump.getComputingResource(); 35 36 double ro = 1.168;//constant 37 38 double mair_total; 39 40 //in case of DCworms calculation of Vair_total 41 double mair_rack = 0; 15 42 16 double nf = 0.6; 43 for(ComputingResource cr: room.getChildren()){ 44 ComputeBox1 cb1 = (ComputeBox1)cr; 45 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 46 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 47 if(device.getType().equals(StandardResourceType.Outlet)){ 48 49 Fan fan = (Fan) device; 50 double mair_recs = 0; 51 double Vair_recs = 0; 52 53 double Vair_recs1 = 0; 17 54 18 double delta_p;//from database, CFD 19 try{ 20 delta_p = ConfigurationOptions.pressureDrop; 21 } catch (Exception e){ 22 delta_p = 0; 55 Vair_recs1 = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 56 57 double Vair_recs2 = 0; 58 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 59 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 60 61 Vair_recs2 = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 62 63 break; 64 } 65 } 66 67 Vair_recs = Math.max(Vair_recs1, Vair_recs2); 68 69 mair_recs = Vair_recs * ro; 70 mair_rack = mair_rack + mair_recs; 71 } 72 } 73 } 74 } 75 mair_total = mair_rack; 76 Vair_total = mair_total / ro; 77 78 79 if(delta_p != -1 && Vair_total != -1) 80 powerConsumption = delta_p * Vair_total / nf; 23 81 } 24 82 25 double Vair_total; 26 27 try{ 28 Vair_total = ConfigurationOptions.airFlowVolume; 29 } catch (Exception e){ 30 Vair_total = 0; 31 } 32 33 34 //if data not present in DB than don't take Pfans_dc into account 35 if(delta_p != -1 && Vair_total != -1) 36 powerConsumption = delta_p * Vair_total / nf; 83 //System.out.println("Flow Pump power: " + powerConsumption); 37 84 38 85 return powerConsumption; … … 43 90 double Vair_total; 44 91 45 try{ 46 Vair_total = ConfigurationOptions.airFlowVolume; 47 } catch (Exception e){ 48 Vair_total = 0; 92 Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 93 if(Vair_total != -1) { 94 airThroughput = Vair_total; 95 } else { 96 Device flowPump = (Device) resource; 97 ComputingResource room = flowPump.getComputingResource(); 98 99 double ro = 1.168;//constant 100 101 double mair_total; 102 double mair_rack = 0; 103 104 for(ComputingResource cr: room.getChildren()){ 105 ComputeBox1 cb1 = (ComputeBox1)cr; 106 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 107 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 108 if(device.getType().equals(StandardResourceType.Outlet)){ 109 110 Fan fan = (Fan) device; 111 double mair_recs = 0; 112 double Vair_recs = 0; 113 114 double Vair_recs1 = 0; 115 116 Vair_recs1 = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 117 118 double Vair_recs2 = 0; 119 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 120 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 121 122 Vair_recs2 = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 123 124 break; 125 } 126 } 127 128 Vair_recs = Math.max(Vair_recs1, Vair_recs2); 129 130 mair_recs = Vair_recs * ro; 131 mair_rack = mair_rack + mair_recs; 132 } 133 } 134 } 135 } 136 mair_total = mair_rack; 137 Vair_total = mair_total / ro; 138 airThroughput = Vair_total; 49 139 } 50 airThroughput = Vair_total;51 140 return airThroughput; 52 141 } 53 142 54 143 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java
r1207 r1299 1 1 package example.energy.coolemall; 2 2 3 import schedframe.resources.StandardResourceType; 4 import schedframe.resources.computing.ComputingResource; 5 import schedframe.resources.computing.coolemall.ComputeBox1; 6 import schedframe.resources.computing.coolemall.NodeGroup; 3 7 import schedframe.resources.computing.profiles.energy.EnergyEvent; 8 import schedframe.resources.devices.Device; 9 import schedframe.resources.devices.Fan; 4 10 import schedframe.resources.devices.PhysicalResource; 5 11 import schedframe.scheduling.manager.tasks.JobRegistry; … … 21 27 double Vair_total; 22 28 23 try{ 24 Vair_total = ConfigurationOptions.airFlowVolume; 25 } catch (Exception e){ 26 Vair_total = 0; 29 Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 30 if(Vair_total != -1) { 31 airThroughput = Vair_total; 32 } else { 33 Device flowPump = (Device) resource; 34 ComputingResource room = flowPump.getComputingResource(); 35 36 double ro = 1.168;//constant 37 38 double mair_total; 39 double mair_rack = 0; 40 41 for(ComputingResource cr: room.getChildren()){ 42 ComputeBox1 cb1 = (ComputeBox1)cr; 43 for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 44 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 45 if(device.getType().equals(StandardResourceType.Outlet)){ 46 47 Fan fan = (Fan) device; 48 double mair_recs = 0; 49 double Vair_recs = 0; 50 51 double Vair_recs1 = 0; 52 53 Vair_recs1 = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 54 55 double Vair_recs2 = 0; 56 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 57 if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 58 59 Vair_recs2 = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 60 61 break; 62 } 63 } 64 65 Vair_recs = Math.max(Vair_recs1, Vair_recs2); 66 67 mair_recs = Vair_recs * ro; 68 mair_rack = mair_rack + mair_recs; 69 } 70 } 71 } 72 } 73 mair_total = mair_rack; 74 Vair_total = mair_total / ro; 75 airThroughput = Vair_total; 27 76 } 28 airThroughput = Vair_total;29 77 return airThroughput; 30 78 } 31 32 79 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java
r1253 r1299 1 1 package example.energy.coolemall; 2 2 3 import schedframe.resources.StandardResourceType; 4 import schedframe.resources.computing.ComputingResource; 3 5 import schedframe.resources.computing.Node; 4 6 import schedframe.resources.computing.Processor; … … 6 8 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 7 9 import schedframe.resources.devices.Device; 10 import schedframe.resources.devices.Fan; 8 11 import schedframe.resources.devices.PhysicalResource; 9 12 import schedframe.scheduling.manager.tasks.JobRegistry; 10 import test.Node_Fan_Mapping;11 13 import example.energy.BaseEnergyEstimationPlugin; 12 14 13 15 public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { 14 16 15 //private static int OUT_START_ID = 0;16 //private static int OUT_END_ID = 8;17 18 17 public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 19 18 PhysicalResource resource) { … … 30 29 //powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 31 30 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 32 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 33 if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 34 powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 35 }else 36 powerConsumption = powerConsumption + device.getPowerInterface().getRecentPowerUsage().getValue(); 37 break; 31 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 32 Fan fan = (Fan) device; 33 if(fan.getChilledResources().contains(node.getFullName())){ 34 if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 35 try { 36 powerConsumption = powerConsumption + fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState())/getNumberOfWorkingNodes(fan); 37 } catch (NoSuchFieldException e) { 38 // TODO Auto-generated catch block 39 e.printStackTrace(); 40 } 41 }else 42 powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue()/getNumberOfWorkingNodes(fan); 43 } 38 44 } 39 45 } 40 46 } 41 47 42 43 48 return powerConsumption; 44 49 } 45 46 /*public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 47 48 double airThroughput = 0; 49 try { 50 if(event.getReason() == EventReason.SIM_INIT) 51 return airThroughput; 52 //airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF); 53 else { 54 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 55 //airThroughput = computingResource.getResourceCharacteristic().getDevices().get(0).getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 56 //airThroughput = 0.28; 57 } 58 } catch (NoSuchFieldException e) { 59 // TODO Auto-generated catch block 60 e.printStackTrace(); 61 } 62 63 //Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 64 //ComputingResource computingResource = (ComputingResource) resource; 65 //we estimate the air flow related to the outlets (nodes placed in the outlet row of RECS) 66 //if(resId >= OUT_START_ID && resId <= OUT_END_ID){ 67 // for(ComputingResource compResource: computingResource.getParent().getChildren()){ 68 // Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 69 // //we take into account the inlet air flow (nodes placed "behind" the given node) 70 // if(id - resId == 9 || id - resId == -9){ 71 // try { 72 // airThroughput = airThroughput + compResource.getAirThroughputInterface().getAirFlow(compResource.getAirThroughputInterface().getAirThroughputState())/2; 73 // } catch (NoSuchFieldException e) { 74 // 75 // } 76 // } 77 // } 78 //} 79 80 return airThroughput; 81 }*/ 82 83 /*public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 84 double tout = 0; 85 double tin = 21.3; 86 double Q = 0.0056085; 87 double C = 1004; 88 double delta1 = 1.780594389/2; 89 double delta2 = 2.162043729/2; 90 double ro = 1.168; 91 double power1 = 0; 92 double power2 = 0; 93 94 Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 95 96 ComputingResource computingResource = (ComputingResource) resource; 97 98 //we estimate outlet temperature (related to the temperature of the nodes placed in outlet row) 99 for(ComputingResource compResource: computingResource.getParent().getChildren()){ 100 Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 101 //we take into account the power of nodes placed "behind" the given nodes 102 if(id - resId == 9){ 103 power1 = compResource.getPowerInterface().getRecentPowerUsage().getValue(); 104 power2 = resource.getPowerInterface().getRecentPowerUsage().getValue(); 105 } else if(id - resId == -9){ 106 power1 = resource.getPowerInterface().getRecentPowerUsage().getValue(); 107 power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue(); 50 51 52 private int getNumberOfWorkingNodes(Device device){ 53 int quantity = 0; 54 Fan fan = (Fan) device; 55 for(ComputingResource compRes: device.getComputingResource().getChildren()){ 56 Node node = (Node)compRes; 57 if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) && fan.getChilledResources().contains(node.getFullName())){ 58 quantity++; 108 59 } 109 60 } 110 111 tout = tin + delta1 * (power1/(Q * C * ro)) + delta2 * (power2/(Q * C * ro));; 112 return tout; 113 }*/ 114 61 return quantity; 62 } 63 115 64 } -
DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java
r1207 r1299 1 1 package example.energy.coolemall; 2 2 3 import dcworms.schedframe.scheduling.ExecTask;4 import schedframe.resources.ResourceStatus;5 import schedframe.resources.computing.Core;6 3 import schedframe.resources.computing.Processor; 7 4 import schedframe.resources.computing.profiles.energy.EnergyEvent; … … 9 6 import schedframe.resources.devices.PhysicalResource; 10 7 import schedframe.scheduling.manager.tasks.JobRegistry; 11 import schedframe.scheduling.manager.tasks.JobRegistryImpl;12 import schedframe.scheduling.tasks.phases.PhaseBehaviour;13 8 import example.energy.BaseEnergyEstimationPlugin; 14 9 … … 18 13 PhysicalResource resource) { 19 14 20 /*double powerConsumption = 0; 21 Processor cpu = (Processor)resource; 22 if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) 23 powerConsumption = 0; 24 else { 25 if(resource.getStatus() == ResourceStatus.BUSY){ 26 try { 27 powerConsumption = cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); 28 } catch (NoSuchFieldException e) { 29 Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower"); 30 if(param != null) 31 powerConsumption = Double.valueOf(param.get(0).getContent()); 32 } 33 } 34 else { 35 try { 36 powerConsumption = cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); 37 } catch (NoSuchFieldException e) { 38 Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower"); 39 if(param != null) 40 powerConsumption = 0.7 * Double.valueOf(param.get(0).getContent()); 41 } 42 } 43 } 44 return powerConsumption;*/ 15 double processorLoad = 0; 45 16 double powerConsumption = 0; 46 17 Processor proc = (Processor)resource; … … 48 19 return 0; 49 20 else { 50 double processorLoad;51 double sumCoresLoad = 0;52 53 int nrOfThreadsOnCpu = 1;54 55 if(proc.getResourceCharacteristic().getParameters().get("product") != null){56 String productName = proc.getResourceCharacteristic().getParameters().get("product").get(0).getContent();57 if(productName.equals("Fusion G - T40N"))58 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Fusion_G_T40N_NR_OF_THREADS;59 else if(productName.equals("Atom - D510"))60 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_D510_NR_OF_THREADS;61 else if(productName.equals("Atom - N2600"))62 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_N2600_NR_OF_THREADS;63 else if(productName.equals("Core i7 - 2715QE"))64 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_2715QE_NR_OF_THREADS;65 else if(productName.equals("Core i7 - 3615QE"))66 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_3615QE_NR_OF_THREADS;67 }68 21 69 for(Core core: proc.getCores()){ 70 71 if(core.getStatus().equals(ResourceStatus.BUSY)){ 72 JobRegistry jr = new JobRegistryImpl(core.getFullName()); 73 for(ExecTask task: jr.getRunningTasks()){ 74 double cpuUsage = 100; 75 double nrOfThreadsOfApplciation = 1; 76 for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 77 if(pb.getResouceName().equals("PM_CPU_Usage")){ 78 cpuUsage = pb.getUtilization(); 79 } 80 if(pb.getResouceName().equals("PM_Threads")){ 81 nrOfThreadsOfApplciation = pb.getUtilization(); 82 break; 83 } 84 } 85 sumCoresLoad = sumCoresLoad + cpuUsage * (nrOfThreadsOnCpu / nrOfThreadsOfApplciation); 86 } 22 /*double usedFreq = proc.getPowerInterface().getHighestPState().getFrequency(); 23 24 JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 25 for(ExecTask task: jr.getRunningTasks()){ 26 String taskFreqString = task.getCurrentResourceConsumption().getReferenceHardware().get("cpu_maxfreq"); 27 double taskFreq = Double.valueOf(taskFreqString); 28 if(taskFreq > usedFreq){ 29 usedFreq = taskFreq; 87 30 } 88 31 } 89 processorLoad = 100 * sumCoresLoad/proc.getCores().size(); 32 33 processorLoad = proc.getLoadInterface().getRecentUtilization().getValue(); 34 //System.out.println(proc.getFullName() + "processorLoad v2: " + processorLoad); 35 36 if(processorLoad != 0 && proc.getPowerInterface().getFrequency() != usedFreq) { 37 proc.getPowerInterface().setFrequency(usedFreq); 38 }*/ 39 40 processorLoad = proc.getLoadInterface().getRecentUtilization().getValue(); 90 41 double lowestLoadLevel = 100; 91 42 double highestLoadLevel = 0; … … 130 81 double a; 131 82 double b; 132 if(lowerLoadLevel != higherLoadLevel) 133 { 83 if(lowerLoadLevel != higherLoadLevel) { 134 84 powerBelow = proc.getPowerInterface().getPState().getLoadPowerUsage().get(lowerLoadLevel); 135 85 powerAbove = proc.getPowerInterface().getPState().getLoadPowerUsage().get(higherLoadLevel); … … 155 105 } 156 106 } 157 158 159 powerConsumption = powerConsumption - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;160 107 //System.out.println("estiamted power consumption: " + powerConsumption); 161 108 return powerConsumption; -
DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java
r1286 r1299 1 1 package example.load; 2 2 3 import schedframe.resources.ResourceStatus;4 import schedframe.resources.computing.Core;5 3 import schedframe.resources.computing.Processor; 6 4 import schedframe.resources.computing.profiles.energy.EnergyEvent; … … 13 11 public class ProcessorLoadEstimationPlugin extends BaseLoadEstimationPlugin{ 14 12 15 @Override16 13 public double estimateUtlization(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 17 14 Processor proc = (Processor) resource; … … 24 21 } 25 22 26 //for(Core core: proc.getCores()){27 28 //if(core.getStatus().equals(ResourceStatus.BUSY)){29 JobRegistry jr = new JobRegistryImpl(proc.getFullName());30 for(ExecTask task: jr.getRunningTasks()){31 double cpuUsage = 1 / nrOfThreadsOnCpu;32 double nrOfThreadsOfApplication = 1;33 23 34 for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 35 if(pb.getResouceName().equals("PM_CPU_Usage")){ 36 cpuUsage = pb.getUtilization(); 37 } 38 if(pb.getResouceName().equals("PM_Threads")){ 39 nrOfThreadsOfApplication = pb.getUtilization(); 40 break; 41 } 42 } 43 sumCoresLoad = sumCoresLoad + cpuUsage;// * (nrOfThreadsOfApplication / nrOfThreadsOnCpu); 24 JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 25 for(ExecTask task: jr.getRunningTasks()){ 26 double cpuUsage = 1 / nrOfThreadsOnCpu; 44 27 28 for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 29 if(pb.getResouceName().equals("PM_CPU_Usage")){ 30 cpuUsage = pb.getUtilization(); 45 31 } 46 // } 47 //} 32 } 33 sumCoresLoad = sumCoresLoad + cpuUsage; 34 35 } 36 48 37 49 38 double processorLoad = 100 * sumCoresLoad; -
DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin.java
r1258 r1299 11 11 12 12 import schedframe.events.scheduling.SchedulingEvent; 13 import schedframe.exceptions.ResourceException; 13 14 import schedframe.resources.ResourceStatus; 15 import schedframe.resources.StandardResourceType; 16 import schedframe.resources.computing.ComputingResource; 14 17 import schedframe.resources.computing.Node; 15 import schedframe.resources.computing.ComputingResource; 16 import schedframe.resources.units.Memory; 18 import schedframe.resources.computing.Processor; 19 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 20 import schedframe.resources.computing.profiles.energy.power.PState; 21 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 22 import schedframe.resources.devices.Device; 17 23 import schedframe.resources.units.ProcessingElements; 18 24 import schedframe.resources.units.ResourceUnit; … … 29 35 import schedframe.scheduling.tasks.TaskInterface; 30 36 31 public class Cluster_FCFSBF_Consolidation Plugin extends BaseLocalSchedulingPlugin {32 33 public Cluster_FCFSBF_Consolidation Plugin () {37 public class Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin extends BaseLocalSchedulingPlugin { 38 39 public Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin () { 34 40 } 35 41 … … 49 55 // check all tasks in queue 50 56 57 List<Node> notSelectedNodes = resourceManager.getNodes(); 58 51 59 for (int i = 0; i < q.size(); i++) { 52 60 TaskInterface<?> task = q.get(i); … … 57 65 if (choosenResources != null) { 58 66 addToSchedulingPlan(plan, task, choosenResources); 67 ProcessingElements pe = (ProcessingElements) choosenResources.get(StandardResourceUnitName.PE); 68 Node node = (Node) pe.get(0).getParent(); 69 notSelectedNodes.remove(node); 59 70 } 60 71 } 61 72 } 62 73 turnOffIdleNodes(notSelectedNodes); 63 74 break; 64 75 } … … 66 77 } 67 78 79 @SuppressWarnings("unchecked") 68 80 private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(ClusterResourceManager resourceManager, TaskInterface<?> task){ 69 81 70 82 List<Node> nodes = resourceManager.getNodes(); 71 nodes = findSuitableNodes(task, nodes); 72 Collections.sort(nodes, new Comparator<Node>(){ 73 public int compare(Node node1, Node node2){ 74 return node1.getResourceCharacteristic().getParameters().get("category").get(0).getContent().compareTo(node2.getResourceCharacteristic().getParameters().get("category").get(0).getContent()); 75 } 76 }); 77 if(nodes.size() > 0) 78 { 79 Node node = nodes.get(0); 80 Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(); 81 List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(); 82 int cpuRequest; 83 List<Node> availableNodes = findSuitableNodes(task, nodes); 84 Node node; 85 if(availableNodes.size() == 0){ 83 86 try { 84 cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 85 } catch (NoSuchFieldException e) { 86 cpuRequest = 0; 87 } 88 for (int i = 0; i < node.getProcessors().size() && cpuRequest > 0; i++) { 89 if (node.getProcessors().get(i).getStatus() == ResourceStatus.FREE) { 90 choosenResources.add(node.getProcessors().get(i)); 91 cpuRequest--; 92 } 93 } 94 ProcessingElements result = new ProcessingElements(node.getFullName()); 95 result.addAll(choosenResources); 96 map.put(StandardResourceUnitName.PE, result); 97 98 int memoryRequest; 99 try { 100 memoryRequest = Double.valueOf(task.getMemoryRequest()).intValue(); 101 } catch (NoSuchFieldException e) { 102 memoryRequest = 0; 103 } 104 if (memoryRequest != 0) { 105 Memory memory; 106 try { 107 memory = new Memory(node.getMemory(), memoryRequest, memoryRequest); 108 map.put(StandardResourceUnitName.MEMORY, memory); 109 } catch (NoSuchFieldException e) { 110 return null; 111 } 112 113 } 114 return map; 115 } else 116 return null; 87 nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE); 88 } catch (ResourceException e) { 89 // TODO Auto-generated catch block 90 e.printStackTrace(); 91 } 92 Collections.sort(nodes, new PerformanceComparator()); 93 node = turnOnFirstNode(nodes, task); 94 if(node == null) 95 return null; 96 }else{ 97 Collections.sort(availableNodes, new PerformanceComparator()); 98 node = availableNodes.get(0); 99 } 100 Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(); 101 List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(); 102 int cpuRequest; 103 try { 104 cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 105 } catch (NoSuchFieldException e) { 106 cpuRequest = 0; 107 } 108 for (int i = 0; i < node.getProcessors().size() && cpuRequest > 0; i++) { 109 if (node.getProcessors().get(i).getStatus() == ResourceStatus.FREE) { 110 choosenResources.add(node.getProcessors().get(i)); 111 cpuRequest--; 112 } 113 } 114 ProcessingElements result = new ProcessingElements(node.getFullName()); 115 result.addAll(choosenResources); 116 map.put(StandardResourceUnitName.PE, result); 117 return map; 117 118 } 118 119 … … 124 125 cpuRequest = 1; 125 126 } 126 int memoryRequest; 127 try { 128 memoryRequest = Double.valueOf(task.getMemoryRequest()).intValue(); 129 } catch (NoSuchFieldException e) { 130 memoryRequest = 0; 131 } 127 132 128 List<Node> suitableNodes = new ArrayList<Node>(); 133 129 for(Node node: nodes){ 134 try{ 135 if(node.getFreeProcessorsNumber() >= cpuRequest && node.getFreeMemory() >= memoryRequest){ 136 suitableNodes.add(node); 137 } 138 } catch (NoSuchFieldException e){ 130 if(node.getFreeProcessorsNumber() >= cpuRequest){ 131 suitableNodes.add(node); 132 } 133 134 } 135 return suitableNodes; 136 } 137 138 private Node turnOnFirstNode(List<Node> nodes, TaskInterface<?> task){ 139 Node startedNode = null; 140 141 int cpuRequest; 142 try { 143 cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 144 } catch (NoSuchFieldException e) { 145 cpuRequest = 0; 146 } 147 148 for(Node node: nodes){ 149 150 if (cpuRequest != 0) { 151 152 List<Processor> processors = node.getProcessors(); 153 if (processors.size() < cpuRequest) { 154 if(processors.size() == 0){ 155 if(node.getProcessors().size() < cpuRequest) 156 continue; 157 } 158 } 139 159 140 } 141 } 142 return suitableNodes; 160 int freeProcessor = 0; 161 for(Processor processor: processors){ 162 if(processor.getStatus() == ResourceStatus.FREE || processor.getStatus() == ResourceStatus.UNAVAILABLE) 163 freeProcessor++; 164 } 165 166 if(freeProcessor < cpuRequest) 167 continue; 168 else { 169 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 170 if(device.getType().equals(StandardResourceType.Fan)){ 171 device.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.ON); 172 break; 173 } 174 } 175 node.getPowerInterface().setPowerState(StandardPowerStateName.ON); 176 startedNode = node; 177 break; 178 } 179 } 180 } 181 return startedNode; 182 } 183 private void turnOffIdleNodes(List<Node> nodes){ 184 for(Node node : nodes){ 185 int freeProcessors = 0; 186 for(Processor proc: node.getProcessors()){ 187 if(proc.getStatus() == ResourceStatus.FREE) 188 freeProcessors++; 189 } 190 191 if(freeProcessors == node.getProcessors().size()) { 192 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 193 if(device.getType().equals(StandardResourceType.Fan)){ 194 device.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.OFF); 195 break; 196 } 197 } 198 node.getPowerInterface().setPowerState(StandardPowerStateName.OFF); 199 } 200 201 } 202 } 203 204 class PerformanceComparator implements Comparator<Node>{ 205 206 public int compare(Node node1, Node node2){ 207 double node1Rank = Double.MIN_VALUE; 208 double node2Rank = Double.MIN_VALUE; 209 210 double node1Speed = 0; 211 for(Processor proc: node1.getProcessors()){ 212 node1Speed = proc.getMIPS(); 213 } 214 node1Rank = node1Speed / node1.getProcessors().size(); 215 216 double node2Speed = 0; 217 for(Processor proc: node2.getProcessors()){ 218 node2Speed = proc.getMIPS(); 219 } 220 node2Rank = node2Speed / node2.getProcessors().size(); 221 222 if(node1Rank == node2Rank){ 223 node1Rank = Double.MIN_VALUE; 224 node2Rank = Double.MIN_VALUE; 225 PState pState; 226 for(Processor proc: node1.getProcessors()){ 227 if(proc.getPowerInterface() != null) { 228 pState = proc.getPowerInterface().getLowestPState(); 229 if(pState != null && pState.getFrequency() > node1Rank){ 230 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 231 } 232 } 233 } 234 for(Processor proc: node2.getProcessors()){ 235 if(proc.getPowerInterface() != null) { 236 pState = proc.getPowerInterface().getLowestPState(); 237 if(pState != null && pState.getFrequency() > node2Rank){ 238 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 239 } 240 } 241 } 242 } 243 244 if(node1Rank < node2Rank) 245 return 1; 246 else if (node1Rank > node2Rank) 247 return -1; 248 else return 0; 249 } 143 250 } 144 251 -
DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_DFSPlugin.java
r574 r1299 26 26 import schedframe.scheduling.tasks.TaskInterface; 27 27 28 public class FCFSBF_DFSClusterPlugin extends BaseLocalSchedulingPlugin {28 public class Cluster_FCFSBF_DFSPlugin extends BaseLocalSchedulingPlugin { 29 29 30 30 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, -
DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ExamplePlugin.java
r1247 r1299 30 30 import schedframe.scheduling.tasks.TaskInterface; 31 31 32 public class FCFSBF_ClusterPlugin extends BaseLocalSchedulingPlugin {32 public class Cluster_FCFSBF_ExamplePlugin extends BaseLocalSchedulingPlugin { 33 33 34 34 public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP.java
r1258 r1299 17 17 import schedframe.resources.computing.Processor; 18 18 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 19 import schedframe.resources.computing.profiles.energy.power.PState; 19 20 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 20 21 import schedframe.resources.devices.Device; 22 import schedframe.resources.devices.Fan; 21 23 import schedframe.resources.units.ProcessingElements; 22 24 import schedframe.resources.units.ResourceUnit; … … 37 39 import gridsim.dcworms.DCWormsTags; 38 40 39 public class CB1_FCFS_Consolidation _NodePowMan_SP extends BaseLocalSchedulingPlugin {40 41 42 public CB1_FCFS_Consolidation _NodePowMan_SP () {41 public class CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP extends BaseLocalSchedulingPlugin { 42 43 44 public CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP () { 43 45 Node_Fan_Mapping.init(); 44 46 } … … 221 223 else { 222 224 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 223 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 224 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 225 break; 225 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 226 Fan fan = (Fan) device; 227 if(fan.getChilledResources().contains(node.getFullName())){ 228 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 229 } 226 230 } 227 231 } … … 252 256 if(freeCores == proc.getCores().size()) { 253 257 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 254 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 255 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 256 break; 258 259 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 260 Fan fan = (Fan) device; 261 int nrOfChilldedNodes = fan.getChilledResources().size(); 262 if(fan.getChilledResources().contains(node.getFullName())){ 263 if(nrOfChilldedNodes == 1) 264 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 265 else { 266 for(String chilledNode: fan.getChilledResources()){ 267 for(Node node2: nodes){ 268 if(chilledNode.equals(node2.getFullName())){ 269 if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 270 nrOfChilldedNodes--; 271 } 272 } 273 } 274 } 275 if(nrOfChilldedNodes <= 1) 276 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 277 } 278 279 } 257 280 } 258 281 } … … 329 352 } 330 353 354 class PerformanceComparator implements Comparator<Node>{ 355 356 public int compare(Node node1, Node node2){ 357 double node1Rank = Double.MIN_VALUE; 358 double node2Rank = Double.MIN_VALUE; 359 360 double node1Speed = 0; 361 for(Processor proc: node1.getProcessors()){ 362 node1Speed = node1Speed + proc.getMIPS(); 363 } 364 node1Rank = node1Speed / node1.getProcessors().size(); 365 366 double node2Speed = 0; 367 for(Processor proc: node2.getProcessors()){ 368 node2Speed = node2Speed + proc.getMIPS(); 369 } 370 node2Rank = node2Speed / node2.getProcessors().size(); 371 372 if(node1Rank == node2Rank){ 373 node1Rank = Double.MIN_VALUE; 374 node2Rank = Double.MIN_VALUE; 375 PState pState; 376 for(Processor proc: node1.getProcessors()){ 377 if(proc.getPowerInterface() != null) { 378 pState = proc.getPowerInterface().getLowestPState(); 379 if(pState != null && pState.getFrequency() > node1Rank){ 380 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 381 } 382 } 383 } 384 for(Processor proc: node2.getProcessors()){ 385 if(proc.getPowerInterface() != null) { 386 pState = proc.getPowerInterface().getLowestPState(); 387 if(pState != null && pState.getFrequency() > node2Rank){ 388 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 389 } 390 } 391 } 392 } 393 394 if(node1Rank < node2Rank) 395 return 1; 396 else if (node1Rank > node2Rank) 397 return -1; 398 else return 0; 399 } 400 } 331 401 } -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_SP.java
r1258 r1299 13 13 import schedframe.resources.computing.Core; 14 14 import schedframe.resources.computing.Node; 15 import schedframe.resources.computing.Processor; 16 import schedframe.resources.computing.profiles.energy.power.PState; 15 17 import schedframe.resources.units.ProcessingElements; 16 18 import schedframe.resources.units.ResourceUnit; … … 31 33 import gridsim.dcworms.DCWormsTags; 32 34 33 public class CB1_FCFS_Consolidation _SP extends BaseLocalSchedulingPlugin {34 35 36 public CB1_FCFS_Consolidation _SP () {35 public class CB1_FCFS_ConsolidationHighPerf_SP extends BaseLocalSchedulingPlugin { 36 37 38 public CB1_FCFS_ConsolidationHighPerf_SP () { 37 39 Node_Fan_Mapping.init(); 38 40 } … … 208 210 } 209 211 212 class PerformanceComparator implements Comparator<Node>{ 213 214 public int compare(Node node1, Node node2){ 215 double node1Rank = Double.MIN_VALUE; 216 double node2Rank = Double.MIN_VALUE; 217 218 double node1Speed = 0; 219 for(Processor proc: node1.getProcessors()){ 220 node1Speed = node1Speed + proc.getMIPS(); 221 } 222 node1Rank = node1Speed / node1.getProcessors().size(); 223 224 double node2Speed = 0; 225 for(Processor proc: node2.getProcessors()){ 226 node2Speed = node2Speed + proc.getMIPS(); 227 } 228 node2Rank = node2Speed / node2.getProcessors().size(); 229 230 if(node1Rank == node2Rank){ 231 node1Rank = Double.MIN_VALUE; 232 node2Rank = Double.MIN_VALUE; 233 PState pState; 234 for(Processor proc: node1.getProcessors()){ 235 if(proc.getPowerInterface() != null) { 236 pState = proc.getPowerInterface().getLowestPState(); 237 if(pState != null && pState.getFrequency() > node1Rank){ 238 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 239 } 240 } 241 } 242 for(Processor proc: node2.getProcessors()){ 243 if(proc.getPowerInterface() != null) { 244 pState = proc.getPowerInterface().getLowestPState(); 245 if(pState != null && pState.getFrequency() > node2Rank){ 246 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 247 } 248 } 249 } 250 } 251 252 if(node1Rank < node2Rank) 253 return 1; 254 else if (node1Rank > node2Rank) 255 return -1; 256 else return 0; 257 } 258 } 259 210 260 } -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationLowPower_NodePowMan_SP.java
r1258 r1299 17 17 import schedframe.resources.computing.Processor; 18 18 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 19 import schedframe.resources.computing.profiles.energy.power.PState; 19 20 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 20 21 import schedframe.resources.devices.Device; 22 import schedframe.resources.devices.Fan; 21 23 import schedframe.resources.units.ProcessingElements; 22 24 import schedframe.resources.units.ResourceUnit; … … 37 39 import gridsim.dcworms.DCWormsTags; 38 40 39 public class CB1_FCFS_Consolidation Atom_NodePowMan_SP extends BaseLocalSchedulingPlugin {40 41 42 public CB1_FCFS_Consolidation Atom_NodePowMan_SP () {41 public class CB1_FCFS_ConsolidationLowPower_NodePowMan_SP extends BaseLocalSchedulingPlugin { 42 43 44 public CB1_FCFS_ConsolidationLowPower_NodePowMan_SP () { 43 45 Node_Fan_Mapping.init(); 44 46 } … … 221 223 else { 222 224 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 223 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 224 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 225 break; 225 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 226 Fan fan = (Fan) device; 227 if(fan.getChilledResources().contains(node.getFullName())){ 228 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 229 } 226 230 } 227 231 } … … 252 256 if(freeCores == proc.getCores().size()) { 253 257 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 254 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 255 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 256 break; 258 259 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 260 Fan fan = (Fan) device; 261 int nrOfChilldedNodes = fan.getChilledResources().size(); 262 if(fan.getChilledResources().contains(node.getFullName())){ 263 if(nrOfChilldedNodes == 1) 264 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 265 else { 266 for(String chilledNode: fan.getChilledResources()){ 267 for(Node node2: nodes){ 268 if(chilledNode.equals(node2.getFullName())){ 269 if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 270 nrOfChilldedNodes--; 271 } 272 } 273 } 274 } 275 if(nrOfChilldedNodes <= 1) 276 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 277 } 278 279 } 257 280 } 258 281 } … … 329 352 } 330 353 354 class PowerComparator implements Comparator<Node>{ 355 356 public int compare(Node node1, Node node2){ 357 double node1Rank = Double.MAX_VALUE; 358 double node2Rank = Double.MAX_VALUE; 359 360 PState pState; 361 for(Processor proc: node1.getProcessors()){ 362 if(proc.getPowerInterface() != null) { 363 pState = proc.getPowerInterface().getLowestPState(); 364 if(pState != null && pState.getPower() < node1Rank){ 365 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 366 } 367 } 368 } 369 for(Processor proc: node2.getProcessors()){ 370 if(proc.getPowerInterface() != null) { 371 pState = proc.getPowerInterface().getLowestPState(); 372 if(pState != null && pState.getPower() < node2Rank){ 373 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 374 } 375 } 376 } 377 378 if(node1Rank > node2Rank) 379 return 1; 380 else if (node1Rank < node2Rank) 381 return -1; 382 else return 0; 383 } 384 } 331 385 } -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP.java
r1258 r1299 16 16 import schedframe.resources.computing.Node; 17 17 import schedframe.resources.computing.Processor; 18 import schedframe.resources.computing.Rack; 18 19 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 20 import schedframe.resources.computing.profiles.energy.power.PState; 19 21 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 20 22 import schedframe.resources.devices.Device; 23 import schedframe.resources.devices.Fan; 21 24 import schedframe.resources.units.ProcessingElements; 22 25 import schedframe.resources.units.ResourceUnit; … … 37 40 import gridsim.dcworms.DCWormsTags; 38 41 39 public class CB2_FCFS_Consolidation _NodePowMan_SP extends BaseLocalSchedulingPlugin {40 41 42 public CB2_FCFS_Consolidation _NodePowMan_SP () {42 public class CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP extends BaseLocalSchedulingPlugin { 43 44 45 public CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP () { 43 46 Node_Fan_Mapping.init(); 44 47 } … … 98 101 e.printStackTrace(); 99 102 } 100 Collections.sort(nodes, new FavourableNodeComparator());103 Collections.sort(nodes, new PerformanceComparator()); 101 104 node = turnOnFirstNode(nodes, task); 102 105 if(node == null) 103 106 return null; 104 107 } else { 105 Collections.sort(avNodes, new FavourableNodeComparator());108 Collections.sort(avNodes, new PerformanceComparator()); 106 109 node = findTheMostLoadedNode(avNodes); 107 110 } … … 221 224 else { 222 225 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 223 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 224 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 225 break; 226 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 227 Fan fan = (Fan) device; 228 if(fan.getChilledResources().contains(node.getFullName())){ 229 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 230 } 226 231 } 227 232 } … … 252 257 if(freeCores == proc.getCores().size()) { 253 258 for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 254 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 255 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 256 break; 257 } 259 260 if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 261 Fan fan = (Fan) device; 262 int nrOfChilldedNodes = fan.getChilledResources().size(); 263 if(fan.getChilledResources().contains(node.getFullName())){ 264 if(nrOfChilldedNodes == 1) 265 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 266 else { 267 for(String chilledNode: fan.getChilledResources()){ 268 for(Node node2: nodes){ 269 if(chilledNode.equals(node2.getFullName())){ 270 if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 271 nrOfChilldedNodes--; 272 } 273 } 274 } 275 } 276 if(nrOfChilldedNodes <= 1) 277 fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 278 } 279 280 } 281 } 282 258 283 } 259 284 node.getPowerInterface().setPowerState(StandardPowerStateName.OFF); 260 285 } 261 262 286 } 263 287 } … … 325 349 else if (node1Rank < node2Rank) 326 350 return -1; 351 else { 352 //return 0; 353 double node1LoadRank = Double.MIN_VALUE; 354 double node2LoadRank = Double.MIN_VALUE; 355 356 try { 357 Rack rack1 = (Rack) node1.getParent().getParent(); 358 JobRegistry jr1 = new JobRegistryImpl(rack1.getFullName()); 359 node1LoadRank = jr1.getRunningTasks().size(); 360 361 Rack rack2 = (Rack) node2.getParent().getParent(); 362 JobRegistry jr2 = new JobRegistryImpl(rack2.getFullName()); 363 node2LoadRank = jr2.getRunningTasks().size(); 364 if(node1LoadRank < node2LoadRank) 365 return 1; 366 else if (node1LoadRank > node2LoadRank) 367 return -1; 368 else return 0; 369 } catch (Exception e){ 370 return 0; 371 } 372 } 373 } 374 } 375 376 class PerformanceComparator implements Comparator<Node>{ 377 378 public int compare(Node node1, Node node2){ 379 double node1Rank = Double.MIN_VALUE; 380 double node2Rank = Double.MIN_VALUE; 381 382 double node1Speed = 0; 383 for(Processor proc: node1.getProcessors()){ 384 node1Speed = node1Speed + proc.getMIPS(); 385 } 386 node1Rank = node1Speed / node1.getProcessors().size(); 387 388 double node2Speed = 0; 389 for(Processor proc: node2.getProcessors()){ 390 node2Speed = node2Speed + proc.getMIPS(); 391 } 392 node2Rank = node2Speed / node2.getProcessors().size(); 393 394 if(node1Rank == node2Rank){ 395 node1Rank = Double.MIN_VALUE; 396 node2Rank = Double.MIN_VALUE; 397 PState pState; 398 for(Processor proc: node1.getProcessors()){ 399 if(proc.getPowerInterface() != null) { 400 pState = proc.getPowerInterface().getLowestPState(); 401 if(pState != null && pState.getFrequency() > node1Rank){ 402 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 403 } 404 } 405 } 406 for(Processor proc: node2.getProcessors()){ 407 if(proc.getPowerInterface() != null) { 408 pState = proc.getPowerInterface().getLowestPState(); 409 if(pState != null && pState.getFrequency() > node2Rank){ 410 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 411 } 412 } 413 } 414 } 415 416 if(node1Rank < node2Rank) 417 return 1; 418 else if (node1Rank > node2Rank) 419 return -1; 327 420 else return 0; 328 421 } 329 } 330 422 } 331 423 } -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_SP.java
r1258 r1299 13 13 import schedframe.resources.computing.Core; 14 14 import schedframe.resources.computing.Node; 15 import schedframe.resources.computing.Processor; 16 import schedframe.resources.computing.Rack; 17 import schedframe.resources.computing.profiles.energy.power.PState; 15 18 import schedframe.resources.units.ProcessingElements; 16 19 import schedframe.resources.units.ResourceUnit; … … 31 34 import gridsim.dcworms.DCWormsTags; 32 35 33 public class CB2_FCFS_Consolidation _SP extends BaseLocalSchedulingPlugin {34 35 36 public CB2_FCFS_Consolidation _SP () {36 public class CB2_FCFS_ConsolidationHighPerf_SP extends BaseLocalSchedulingPlugin { 37 38 39 public CB2_FCFS_ConsolidationHighPerf_SP () { 37 40 Node_Fan_Mapping.init(); 38 41 } … … 70 73 } 71 74 72 @SuppressWarnings("unchecked")73 75 private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution( 74 76 ClusterResourceManager resourceManager, TaskInterface<?> task) { … … 78 80 List<Node> nodes = resourceManager.getNodes(); 79 81 List<Node> avNodes = filterNodes(nodes, task); 80 Collections.sort(avNodes, new FavourableNodeComparator());82 Collections.sort(avNodes, new PerformanceComparator()); 81 83 if(avNodes.size() == 0) 82 84 return null; … … 205 207 else if (node1Rank < node2Rank) 206 208 return -1; 209 else { 210 //return 0; 211 double node1LoadRank = Double.MIN_VALUE; 212 double node2LoadRank = Double.MIN_VALUE; 213 214 try { 215 Rack rack1 = (Rack) node1.getParent().getParent(); 216 JobRegistry jr1 = new JobRegistryImpl(rack1.getFullName()); 217 node1LoadRank = jr1.getRunningTasks().size(); 218 219 Rack rack2 = (Rack) node2.getParent().getParent(); 220 JobRegistry jr2 = new JobRegistryImpl(rack2.getFullName()); 221 node2LoadRank = jr2.getRunningTasks().size(); 222 if(node1LoadRank < node2LoadRank) 223 return 1; 224 else if (node1LoadRank > node2LoadRank) 225 return -1; 226 else return 0; 227 } catch (Exception e){ 228 return 0; 229 } 230 231 } 232 } 233 } 234 235 class PerformanceComparator implements Comparator<Node>{ 236 237 public int compare(Node node1, Node node2){ 238 double node1Rank = Double.MIN_VALUE; 239 double node2Rank = Double.MIN_VALUE; 240 241 double node1Speed = 0; 242 for(Processor proc: node1.getProcessors()){ 243 node1Speed = node1Speed + proc.getMIPS(); 244 } 245 node1Rank = node1Speed / node1.getProcessors().size(); 246 247 double node2Speed = 0; 248 for(Processor proc: node2.getProcessors()){ 249 node2Speed = node2Speed + proc.getMIPS(); 250 } 251 node2Rank = node2Speed / node2.getProcessors().size(); 252 253 if(node1Rank == node2Rank){ 254 node1Rank = Double.MIN_VALUE; 255 node2Rank = Double.MIN_VALUE; 256 PState pState; 257 for(Processor proc: node1.getProcessors()){ 258 if(proc.getPowerInterface() != null) { 259 pState = proc.getPowerInterface().getLowestPState(); 260 if(pState != null && pState.getFrequency() > node1Rank){ 261 node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 262 } 263 } 264 } 265 for(Processor proc: node2.getProcessors()){ 266 if(proc.getPowerInterface() != null) { 267 pState = proc.getPowerInterface().getLowestPState(); 268 if(pState != null && pState.getFrequency() > node2Rank){ 269 node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 270 } 271 } 272 } 273 } 274 275 if(node1Rank < node2Rank) 276 return 1; 277 else if (node1Rank > node2Rank) 278 return -1; 207 279 else return 0; 208 280 } 209 } 210 281 } 211 282 } -
DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_SP.java
r1258 r1299 8 8 9 9 import schedframe.events.scheduling.SchedulingEvent; 10 import schedframe.exceptions.ResourceException; 11 import schedframe.resources.ResourceStatus; 12 import schedframe.resources.StandardResourceType; 10 13 import schedframe.resources.computing.ComputingResource; 14 import schedframe.resources.computing.Core; 11 15 import schedframe.resources.computing.Node; 12 import schedframe.resources.computing.Processor;13 16 import schedframe.resources.units.ProcessingElements; 14 17 import schedframe.resources.units.ResourceUnit; … … 18 21 import schedframe.scheduling.manager.resources.ResourceManager; 19 22 import schedframe.scheduling.manager.tasks.JobRegistry; 20 import schedframe.scheduling.manager.tasks.JobRegistryImpl;21 23 import schedframe.scheduling.plan.SchedulingPlanInterface; 22 24 import schedframe.scheduling.plan.impl.SchedulingPlan; … … 25 27 import schedframe.scheduling.queue.TaskQueueList; 26 28 import schedframe.scheduling.tasks.TaskInterface; 27 import schedframe.scheduling.tasks.phases.PhaseBehaviour;28 29 import test.Node_Fan_Mapping; 29 import dcworms.schedframe.scheduling.ExecTask;30 import example.energy.coolemall.CoolEmAllTestbedMeasurements;31 30 import example.localplugin.BaseLocalSchedulingPlugin; 32 31 import gridsim.dcworms.DCWormsTags; … … 62 61 if (task.getStatus() == DCWormsTags.READY) { 63 62 63 try { 64 if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0) 65 break; 66 } catch (ResourceException e) { 67 // TODO Auto-generated catch block 68 e.printStackTrace(); 69 } 64 70 Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 65 71 if (choosenResources != null) { … … 70 76 break; 71 77 } 78 72 79 return plan; 73 80 } 74 75 81 @SuppressWarnings("unchecked") 76 82 private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution( … … 94 100 95 101 List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(); 96 97 choosenResources.add(node.getProcessors().get(0)); 102 List<Core> cores = node.getCores(); 103 for (int i = 0; i < cores.size() && cpuRequest > 0; i++) { 104 if (cores.get(i).getStatus() == ResourceStatus.FREE) { 105 choosenResources.add(cores.get(i)); 106 cpuRequest--; 107 } 108 } 109 if (cpuRequest > 0) { 110 return null; 111 } 112 113 //choosenResources.add(node.getProcessors().get(0)); 98 114 ProcessingElements pe = new ProcessingElements(); 99 115 pe.addAll(choosenResources); … … 116 132 if (cpuRequest != 0) { 117 133 118 double sumLoad = 0; 119 Processor proc = node.getProcessors().get(0); 120 JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 121 for(ExecTask execTask: jr.getRunningTasks()){ 122 double cpuUsage = 100; 123 double nrOfThreadsOfApplciation = 1; 124 for(PhaseBehaviour pb: execTask.getCurrentResourceConsumption().getBehaviourList()){ 125 if(pb.getResouceName().equals("PM_CPU_Usage")){ 126 cpuUsage = pb.getUtilization(); 127 } 128 if(pb.getResouceName().equals("PM_Threads")){ 129 nrOfThreadsOfApplciation = pb.getUtilization(); 130 break; 131 } 134 List<Core> cores = node.getCores(); 135 if (cores.size() < cpuRequest) { 136 if(cores.size() == 0){ 137 if(node.getProcessors().size() < cpuRequest) 138 continue; 132 139 } 133 sumLoad = sumLoad + nrOfThreadsOfApplciation;134 140 } 135 141 136 int nrOfThreadsOnCpu = 1; 142 int freeCores = 0; 143 for(Core core: cores){ 144 if(core.getStatus() == ResourceStatus.FREE) 145 freeCores++; 146 } 137 147 138 if(proc.getResourceCharacteristic().getParameters().get("product") != null){ 139 String productName = proc.getResourceCharacteristic().getParameters().get("product").get(0).getContent(); 140 if(productName.equals("Fusion G - T40N")) 141 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Fusion_G_T40N_NR_OF_THREADS; 142 else if(productName.equals("Atom - D510")) 143 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_D510_NR_OF_THREADS/2; 144 else if(productName.equals("Atom - N2600")) 145 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_N2600_NR_OF_THREADS/2; 146 else if(productName.equals("Core i7 - 2715QE")) 147 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_2715QE_NR_OF_THREADS/2; 148 else if(productName.equals("Core i7 - 3615QE")) 149 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_3615QE_NR_OF_THREADS/2; 150 } 151 152 System.out.println(sumLoad + ":" + nrOfThreadsOnCpu + ";" + cpuRequest); 153 int freeThreads = (int) (nrOfThreadsOnCpu - sumLoad) ; 154 155 156 if(freeThreads < cpuRequest) 148 if(freeCores < cpuRequest) 157 149 continue; 158 150 … … 167 159 return nodes.get(rand.nextInt(nodes.size())); 168 160 } 169 170 161 171 162 }
Note: See TracChangeset
for help on using the changeset viewer.