Changeset 1299 for DCWoRMS/branches
- Timestamp:
- 03/19/14 18:22:27 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src
- Files:
-
- 7 added
- 2 deleted
- 20 edited
- 1 copied
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java
r1207 r1299 2 2 3 3 4 import example.energy.coolemall.CoolEmAllTestbedMeasurements;5 4 import gridsim.GridSim; 6 5 import gridsim.dcworms.DCWormsTags; … … 36 35 import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile; 37 36 import schedframe.scheduling.tasks.requirements.ResourceParameterName; 38 import simulator.stats.implementation.ResourceUsefulWorkStats;39 37 40 38 /** … … 213 211 for (ComputingResource resource : pes) { 214 212 213 LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 214 toExamine.push(resource); 215 216 while (!toExamine.isEmpty()) { 217 ComputingResource compResource = toExamine.pop(); 218 List<ComputingResource> resources = compResource.getChildren(); 219 int numberOfRes = resources.size(); 220 for (int i = 0; i < numberOfRes; i++) { 221 ComputingResource resourceChild = resources.get(i); 222 trackResource(resourceChild.getFullName()); 223 toExamine.addLast(resourceChild); 224 } 225 } 226 227 215 228 trackResource(resource.getFullName()); 216 229 … … 477 490 String productName = resource.getResourceCharacteristic().getParameters().get("product").get(0).getContent(); 478 491 if(productName.equals("Fusion G - T40N")) 479 preparePhases(" amdf");492 preparePhases("Fusion G - T40N"); 480 493 else if(productName.equals("Atom - D510")) 481 preparePhases(" atom64");494 preparePhases("Atom - D510"); 482 495 else if(productName.equals("Atom - N2600")) 483 preparePhases(" atom64");496 preparePhases("Atom - N2600"); 484 497 else if(productName.equals("Core i7 - 2715QE")) 485 preparePhases(" i7-2715QE");498 preparePhases("Core i7 - 2715QE"); 486 499 else if(productName.equals("Core i7 - 3615QE")) 487 preparePhases("i7-3615QE"); 500 preparePhases("Core i7 - 3615QE"); 501 else if(productName.equals("Xeon E5-2630")) 502 preparePhases("Xeon E5-2630"); 503 else if(productName.equals("Xeon E5-2603")) 504 preparePhases("Xeon E5-2603"); 505 else if(productName.equals("Xeon L5310")) 506 preparePhases("Xeon L5310"); 488 507 } 489 508 return true; -
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 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java
r1207 r1299 3 3 import gridsim.GridSimTags; 4 4 import gridsim.dcworms.DCWormsTags; 5 import gridsim.dcworms.filter.ResourceEventFilter; 5 6 6 7 import java.util.ArrayList; … … 24 25 import schedframe.resources.computing.profiles.energy.EnergyEventType; 25 26 import schedframe.resources.computing.profiles.energy.EnergyExtension; 27 import schedframe.resources.computing.profiles.load.LoadExtension; 28 import schedframe.resources.computing.profiles.load.ResourceLoadCalendar; 29 import schedframe.resources.computing.profiles.load.TimestampUtilization; 30 import schedframe.resources.computing.profiles.load.ui.LoadInterface; 26 31 import schedframe.resources.computing.properties.DefaultPropertiesBuilder; 27 32 import schedframe.resources.computing.properties.PropertiesDirector; … … 34 39 import schedframe.resources.devices.PhysicalResource; 35 40 import schedframe.scheduling.Scheduler; 41 import simulator.DataCenterWorkloadSimulator; 36 42 37 43 public class ComputingResource extends PhysicalResource{ … … 51 57 this.extensionList = new ExtensionListImpl(1); 52 58 initCharacteristics(resDesc); 59 accept(new LoadExtension(resDesc.getLoadProfile(), this)); 53 60 accept(new EnergyExtension.Builder().resource(this).powerProfile(resDesc.getPowerProfile()).airFlowProfile(resDesc.getAirThroughputProfile()).thermalProfile(resDesc.getThermalProfile()).build()); 54 61 } … … 67 74 public void setParent(ComputingResource newParent) { 68 75 parent = newParent; 76 if(this.getLoadInterface().getLoadCalendar().getLoadDistribution().size() == 0){ 77 this.getLoadInterface().getLoadCalendar().getLoadDistribution().addAll(parent.getLoadInterface().getLoadCalendar().getLoadDistribution()); 78 } 69 79 } 70 80 … … 220 230 public void handleResourceEvent(Event event){ 221 231 if (extensionList != null) { 222 for (Extension extension 232 for (Extension extension: extensionList) { 223 233 if (extension.supportsEvent(event)) { 224 234 extension.handleEvent(event); … … 227 237 228 238 for (Device device: ((ComputingResourceCharacteristics)resourceCharacteristic).getDevices()) { 229 for (Extension extension 239 for (Extension extension: device.getExtensionList()) { 230 240 if (extension.supportsEvent(event)) { 231 //extension.handleEvent(event);241 extension.handleEvent(event); 232 242 } 233 243 } … … 242 252 if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){ 243 253 String src = event.getSource() != null ? event.getSource() : name; 254 ResourceEventFilter filter = new ResourceEventFilter(src.hashCode(), DCWormsTags.UPDATE_PROCESSING); 255 scheduler.sim_cancel(filter, null); 244 256 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 245 257 } else if(parent != null) … … 274 286 rec.execute(event); 275 287 288 LoadInterface li = getLoadInterface(); 289 if(li != null){ 290 ResourceLoadCalendar rlc = li.getLoadCalendar(); 291 LinkedList<TimestampUtilization> ll = rlc.getLoadDistribution(); 292 for(TimestampUtilization tu: ll){ 293 DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getStartTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName())); 294 DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getEndTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName())); 295 } 296 } 276 297 //alternative way 277 298 //getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller")); -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/coolemall/NodeGroup.java
r1247 r1299 1 1 package schedframe.resources.computing.coolemall; 2 2 3 import java.util.ArrayList; 3 4 import java.util.List; 4 5 … … 8 9 import schedframe.resources.computing.Processor; 9 10 import schedframe.resources.computing.description.ComputingResourceDescription; 11 import schedframe.resources.computing.description.ResourceDescription; 12 import schedframe.resources.devices.Device; 13 import schedframe.resources.devices.Fan; 14 import test.Node_Fan_Mapping; 10 15 11 16 public class NodeGroup extends ComputingResource{ … … 13 18 public NodeGroup(ComputingResourceDescription resDesc) { 14 19 super(resDesc); 20 initNodes_FansMapping(resDesc); 15 21 } 16 22 … … 25 31 } 26 32 33 34 private void initNodes_FansMapping(ComputingResourceDescription resDesc){ 35 Node_Fan_Mapping.init(); 36 for(Device dev: this.getResourceCharacteristic().getDevices()){ 37 if(dev.getType().equals(StandardResourceType.Fan) || dev.getType().equals(StandardResourceType.Inlet) | dev.getType().equals(StandardResourceType.Outlet)){ 38 Fan fan = (Fan) dev; 39 List<String> chilledResources = new ArrayList<String>(); 40 for(ResourceDescription nodeDesc: resDesc.getChildren()){ 41 String nodeName = this.getFullName() + "/" + nodeDesc.getId(); 42 if(!Node_Fan_Mapping.getNode_fan().containsKey(nodeName)){ 43 chilledResources.add(nodeName); 44 } else if(Node_Fan_Mapping.getNode_fan().get(nodeName).equals(fan.getFullName())){ 45 chilledResources.add(nodeName); 46 } else { 47 //if mapping present but there is no match do nothing 48 } 49 } 50 fan.setChilledResources(chilledResources); 51 } 52 } 53 } 27 54 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java
r1281 r1299 20 20 super(resource, pp); 21 21 currentPowerState = StandardPowerStateName.ON; 22 currentPState = get HighestPState();22 currentPState = getLowestPState(); 23 23 } 24 24 -
DCWoRMS/branches/coolemall/src/simulator/ConfigurationOptions.java
r1279 r1299 8 8 import java.util.PropertyResourceBundle; 9 9 import java.util.ResourceBundle; 10 11 import test.CoolingModelData; 10 12 11 13 /** … … 189 191 public String [] resForUtilizationChart; 190 192 191 public static double pressureDrop; 192 public static double outletRoomAirTempeature; 193 public static double inletRoomAirTempeature; 194 public static double ambientAirTempeature; 195 public static double airFlowVolume; 196 public static double alpha 197 ; 193 public double pressureDrop; 194 public double outletRoomAirTempeature; 195 public double inletRoomAirTempeature; 196 public double ambientAirTempeature; 197 public double airFlowVolume; 198 public double alpha; 199 200 public static CoolingModelData coolingData; 198 201 /** 199 202 * An empty constructor. … … 389 392 390 393 try { 391 ConfigurationOptions.pressureDrop = Double.valueOf(bundle.getString(PRESSURE_DROP)).doubleValue(); 392 } catch(MissingResourceException e){ 393 ConfigurationOptions.pressureDrop = 65; 394 } 395 396 try { 397 ConfigurationOptions.outletRoomAirTempeature = Double.valueOf(bundle.getString(OUTLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 398 } catch(MissingResourceException e){ 399 ConfigurationOptions.outletRoomAirTempeature = 23; 400 } 401 402 try { 403 ConfigurationOptions.inletRoomAirTempeature = Double.valueOf(bundle.getString(INLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 404 } catch(MissingResourceException e){ 405 ConfigurationOptions.inletRoomAirTempeature = 17; 406 } 407 408 try { 409 ConfigurationOptions.ambientAirTempeature = Double.valueOf(bundle.getString(AMBIENT_AIR_TEMPERATURE)).doubleValue(); 410 } catch(MissingResourceException e){ 411 ConfigurationOptions.ambientAirTempeature = 17; 412 } 413 414 try { 415 ConfigurationOptions.airFlowVolume = Double.valueOf(bundle.getString(AIR_FLOW_VOLUME)).doubleValue(); 416 } catch(MissingResourceException e){ 417 ConfigurationOptions.airFlowVolume = 4; 418 } 419 420 try { 421 ConfigurationOptions.alpha = Double.valueOf(bundle.getString(ALPHA)).doubleValue(); 422 } catch(MissingResourceException e){ 423 ConfigurationOptions.alpha = 0.2; 424 } 425 394 co.pressureDrop = Double.valueOf(bundle.getString(PRESSURE_DROP)).doubleValue(); 395 } catch(MissingResourceException e){ 396 co.pressureDrop = -1; 397 } 398 399 try { 400 co.outletRoomAirTempeature = Double.valueOf(bundle.getString(OUTLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 401 } catch(MissingResourceException e){ 402 co.outletRoomAirTempeature = -1; 403 } 404 405 try { 406 co.inletRoomAirTempeature = Double.valueOf(bundle.getString(INLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 407 } catch(MissingResourceException e){ 408 co.inletRoomAirTempeature = -1; 409 } 410 411 try { 412 co.ambientAirTempeature = Double.valueOf(bundle.getString(AMBIENT_AIR_TEMPERATURE)).doubleValue(); 413 } catch(MissingResourceException e){ 414 co.ambientAirTempeature = -1; 415 } 416 417 try { 418 co.airFlowVolume = Double.valueOf(bundle.getString(AIR_FLOW_VOLUME)).doubleValue(); 419 } catch(MissingResourceException e){ 420 co.airFlowVolume = -1; 421 } 422 423 try { 424 co.alpha = Double.valueOf(bundle.getString(ALPHA)).doubleValue(); 425 } catch(MissingResourceException e){ 426 co.alpha = -1; 427 } 428 429 ConfigurationOptions.coolingData = new CoolingModelData(co.pressureDrop, co.outletRoomAirTempeature, co.inletRoomAirTempeature, co.ambientAirTempeature, co.airFlowVolume, co.alpha); 426 430 return co; 427 431 } -
DCWoRMS/branches/coolemall/src/simulator/DCWormsUsers.java
r1207 r1299 74 74 sendJobsIds = new HashSet<String>(); 75 75 returnedJobsIds = new HashSet<String>(); 76 76 returnedJobs = new ArrayList<JobInterface<?>>(); 77 77 this.xsltTransformer = new XsltTransformations(); 78 78 } … … 80 80 @Override 81 81 public void body() { 82 sendJobs(); 83 collectJobs(); 82 if(workloadLoader != null){ 83 sendJobs(); 84 collectJobs(); 85 } else { 86 submissionStartTime = 0; 87 } 84 88 85 89 //GridSim dependent code for shutting down the simulation … … 93 97 */ 94 98 protected void collectJobs() { 95 final int FACTOR = Math.min(10 , workloadLoader.getTaskCount()); //the refresh rate of the gauge: at most 10 times99 final int FACTOR = Math.min(100, workloadLoader.getTaskCount() > 0 ? workloadLoader.getTaskCount() : 1); //the refresh rate of the gauge: at most 10 times 96 100 final int denominator = workloadLoader.getTaskCount() / FACTOR; 97 101 allTasksAreFinished = true; 98 returnedJobs = new ArrayList<JobInterface<?>>();99 102 int counter = 0; 100 103 int oldRemeinder = 0; … … 244 247 245 248 public List<JobDescription> getAllSentJobs() { 249 if (workloadLoader == null) 250 return new ArrayList<JobDescription>(); 246 251 return (List<JobDescription>) workloadLoader.getJobs(); 247 252 } … … 349 354 350 355 public boolean isSimStartTimeDefined(){ 356 if(workloadLoader == null){ 357 return false; 358 } 351 359 return workloadLoader.isSimStartTimeDefined(); 352 360 } -
DCWoRMS/branches/coolemall/src/simulator/DataCenterWorkloadSimulator.java
r1207 r1299 21 21 import org.joda.time.DateTimeUtilsExt; 22 22 23 import schedframe.Initializable;24 23 import schedframe.SimulatedEnvironment; 25 24 import simulator.reader.ResourceReader; … … 252 251 // (default 1) 253 252 254 Date date = workload.getSimulationStartTime();255 253 Calendar calendar = Calendar.getInstance(); 256 if (date == null)254 if(workload == null){ 257 255 calendar.setTimeInMillis(0L); 258 else 259 calendar.setTime(date); 256 } else { 257 Date date = workload.getSimulationStartTime(); 258 if (date == null) 259 calendar.setTimeInMillis(0L); 260 else 261 calendar.setTime(date); 262 } 263 260 264 261 265 boolean traceFlag = true; // means: trace GridSim events/activities … … 268 272 ResourceReader resourceReader = new ResourceReader( 269 273 options.resdescFileName); 270 SimulatedEnvironment rc = resourceReader.read(); 271 eventManager = new EventManager("eventManager", rc); 272 273 for(Initializable initObj: rc.getToInit()){ 274 SimulatedEnvironment simEnv = resourceReader.read(); 275 276 eventManager = new EventManager("eventManager", simEnv); 277 278 /*for(Initializable initObj: rc.getToInit()){ 274 279 initObj.initiate(); 275 280 } 276 rc.setInitList(null); 281 rc.setInitList(null);*/ 277 282 278 283 DCWormsUsers users = new DCWormsUsers("Users", 279 rc.getScheduler().get_name(), workload);284 simEnv.getScheduler().get_name(), workload); 280 285 281 286 System.out.println("Starting simulation..."); … … 287 292 288 293 DCWormsStatistics stats = new DCWormsStatistics(simulationIdentifier, 289 options, users, statsOutputPath, rc);294 options, users, statsOutputPath, simEnv); 290 295 accumulatedStatistics.add(stats); 291 296 if (log.isInfoEnabled()) … … 309 314 private WorkloadLoader loadWorkload(ConfigurationOptions options) throws IOException, MarshalException, ValidationException{ 310 315 XMLJobReader<org.qcg.broker.schemas.jobdesc.Job> xmlJobReader = null; 311 WAReader<org.qcg.broker.schemas.jobdesc.Job> swfReader = null;316 WAReader<org.qcg.broker.schemas.jobdesc.Job> workloadReader = null; 312 317 313 318 String wlFileName = options.inputWorkloadFileName; 314 319 315 String appProfilesFolder = options.appProfilesFolder; 320 if(wlFileName == null){ 321 return null; 322 } 323 316 324 if (options.inputFolder != null) { 317 File f = null; 318 if (options.inputTar != null) { 319 f = new File(options.inputFolder + File.separator 320 + options.inputTar); 321 } else { 322 f = new File(options.inputFolder); 323 } 324 325 File f = new File(options.inputFolder); 325 326 xmlJobReader = new QcgXmlJobReader(f); 326 327 … … 329 330 } 330 331 331 swfReader = AbstractWAReader.getInstace(wlFileName); 332 333 WorkloadLoader workload = new WorkloadLoader(xmlJobReader, swfReader, appProfilesFolder); 332 workloadReader = AbstractWAReader.getInstace(wlFileName); 333 334 String appProfilesFolderName = options.appProfilesFolder; 335 336 WorkloadLoader workload = new WorkloadLoader(xmlJobReader, workloadReader, appProfilesFolderName); 334 337 workload.load(); 335 338 -
DCWoRMS/branches/coolemall/src/simulator/stats/AbstractMetricsCalculator.java
r1207 r1299 7 7 8 8 import simulator.stats.implementation.MetricsStats; 9 import example.energy.coolemall.CoolEmAllTestbedMeasurements;10 9 11 public class MetricsCalculator{10 public abstract class AbstractMetricsCalculator implements MetricsCalculator{ 12 11 13 12 protected static final double MILLI_SEC = 1000; … … 15 14 16 15 protected Map<String, List<GSSAccumulator>> metricsData = new HashMap<String, List<GSSAccumulator>>(); 17 protected long timestamp; 16 18 17 protected long startTime; 19 18 protected long endTime; 20 21 public List<MetricsStats> calulateMetrics(long timestamp){ 19 protected long timestamp; 20 21 public AbstractMetricsCalculator(long startTime, long endTime, long timestamp) { 22 super(); 23 this.startTime = startTime; 24 this.endTime = endTime; 22 25 this.timestamp = timestamp; 23 List<MetricsStats> metrics = new ArrayList<MetricsStats>();24 /*for(String resourceTypeName: metricsData.keySet()){25 MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax());26 metrics.add(metric);}27 }*/28 metrics.add(calculateITComputingEnergyConsumption());29 metrics.add(calculateITEnergyConsumption());30 metrics.add(calculateNodeGroupFansEnergyConsumption());31 32 metrics.add(calculateRackEnergyConsumption());33 metrics.add(calculateDataCenterFansEnergyConsumption());34 metrics.add(calculateCoolingDeviceEnergyConsumption());35 metrics.add(calculateOtherDevicesEnergyConsumption());36 37 metrics.add(calculateTotalEnergyConsumption());38 39 metrics.add(calculateMeanRackPower());40 metrics.add(calculateMeanPower());41 metrics.add(calculateMaxRackPower());42 metrics.add(calculateMaxPower());43 44 metrics.add(calculatePUE());45 metrics.add(calculatePUELevel4());46 metrics.add(calculateEnergyWasteRate());47 48 metrics.add(calculateUsefulWork());49 metrics.add(calculateProductivity());50 51 return metrics;52 26 } 27 28 abstract public List<MetricsStats> calulateMetrics(); 53 29 54 30 public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator){ … … 64 40 return metricsData; 65 41 } 66 67 private MetricsStats calculateTotalEnergyConsumption(){68 69 MetricsStats metric;70 try{71 72 double roomPower = 0;73 for(GSSAccumulator acc: metricsData.get("Room")){74 roomPower = roomPower + acc.getSum();75 }76 metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh");77 } catch (Exception e){78 metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh");79 }80 return metric;81 }82 83 private MetricsStats calculateITComputingEnergyConsumption(){84 85 MetricsStats metric;86 try{87 double itComputingPower = 0;88 for(GSSAccumulator acc: metricsData.get("Processor")){89 itComputingPower = itComputingPower + acc.getSum();90 }91 metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh");92 } catch (Exception e){93 metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh");94 }95 return metric;96 }97 98 private MetricsStats calculateITEnergyConsumption(){99 100 MetricsStats metric;101 try{102 double totalSitePower = 0;103 for(GSSAccumulator acc: metricsData.get("Rack")){104 totalSitePower = totalSitePower + acc.getSum();105 }106 double nodeComputingPower = 0;107 for(GSSAccumulator acc: metricsData.get("Node")){108 nodeComputingPower = nodeComputingPower+ acc.getSum();109 }110 double itComputingPower = 0;111 for(GSSAccumulator acc: metricsData.get("Processor")){112 itComputingPower = itComputingPower + acc.getSum();113 }114 double fanPowerConumspion = nodeComputingPower - itComputingPower;115 metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - fanPowerConumspion), timestamp, "Wh");116 } catch (Exception e){117 metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh");118 }119 return metric;120 }121 122 private MetricsStats calculateNodeGroupFansEnergyConsumption(){123 124 MetricsStats metric;125 try{126 double nodeComputingPower = 0;127 for(GSSAccumulator acc: metricsData.get("Node")){128 nodeComputingPower = nodeComputingPower+ acc.getSum();129 }130 double itComputingPower = 0;131 for(GSSAccumulator acc: metricsData.get("Processor")){132 itComputingPower = itComputingPower + acc.getSum();133 }134 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;135 metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh");136 } catch (Exception e){137 metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh");138 }139 return metric;140 }141 142 private MetricsStats calculatePUELevel4(){143 144 MetricsStats metric;145 try{146 147 double roomPower = 0;148 for(GSSAccumulator acc: metricsData.get("Room")){149 roomPower = roomPower + acc.getSum();150 }151 152 double totalSitePower = 0;153 for(GSSAccumulator acc: metricsData.get("Rack")){154 totalSitePower = totalSitePower + acc.getSum();155 }156 157 158 double nodeComputingPower = 0;159 for(GSSAccumulator acc: metricsData.get("Node")){160 nodeComputingPower = nodeComputingPower+ acc.getSum();161 }162 double itComputingPower = 0;163 for(GSSAccumulator acc: metricsData.get("Processor")){164 itComputingPower = itComputingPower + acc.getSum();165 }166 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;167 42 168 metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, "");169 } catch (Exception e){170 metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, "");171 }172 return metric;173 }174 175 private MetricsStats calculatePUE(){176 177 MetricsStats metric;178 try{179 180 double roomPower = 0;181 for(GSSAccumulator acc: metricsData.get("Room")){182 roomPower = roomPower + acc.getSum();183 }184 185 double totalSitePower = 0;186 for(GSSAccumulator acc: metricsData.get("Rack")){187 totalSitePower = totalSitePower + acc.getSum();188 }189 190 191 metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, "");192 } catch (Exception e){193 metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, "");194 }195 return metric;196 }197 198 private MetricsStats calculateUsefulWork(){199 200 MetricsStats metric;201 try{202 double usefulWork = 0;203 for(String key: metricsData.keySet()){204 if(key.contains("/")){205 for(GSSAccumulator acc: metricsData.get(key)){206 usefulWork= usefulWork + acc.getSum();207 }208 }209 }210 metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units");211 } catch (Exception e){212 metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units");213 }214 215 return metric;216 }217 218 private MetricsStats calculateProductivity(){219 220 MetricsStats metric;221 try{222 double usefulWork = 0;223 for(String key: metricsData.keySet()){224 if(key.contains("/")){225 for(GSSAccumulator acc: metricsData.get(key)){226 usefulWork= usefulWork + acc.getSum();227 }228 }229 }230 double totalSitePower = 0;231 for(GSSAccumulator acc: metricsData.get("Rack")){232 totalSitePower = totalSitePower + acc.getSum();233 }234 235 metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh");236 } catch (Exception e){237 metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh");238 }239 240 return metric;241 }242 243 244 private MetricsStats calculateMaxRackPower(){245 246 MetricsStats metric;247 try{248 double maxPower = 0;249 250 for(GSSAccumulator acc: metricsData.get("Rack_MAX")){251 maxPower = maxPower + acc.getSum();252 }253 254 metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W");255 } catch (Exception e){256 metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W");257 }258 259 return metric;260 }261 262 private MetricsStats calculateMaxPower(){263 264 MetricsStats metric;265 try{266 double maxPower = 0;267 268 for(GSSAccumulator acc: metricsData.get("Room_MAX")){269 maxPower = maxPower + acc.getSum();270 }271 272 metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W");273 } catch (Exception e){274 metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W");275 }276 277 return metric;278 }279 280 private MetricsStats calculateDataCenterFansEnergyConsumption(){281 282 MetricsStats metric;283 try{284 double inletsPower = 0;285 for(GSSAccumulator acc: metricsData.get("Inlet")){286 inletsPower = inletsPower + acc.getSum();287 }288 289 double outletsPower = 0;290 for(GSSAccumulator acc: metricsData.get("Outlet")){291 outletsPower = outletsPower + acc.getSum();292 }293 294 double nodeComputingPower = 0;295 for(GSSAccumulator acc: metricsData.get("Node")){296 nodeComputingPower = nodeComputingPower+ acc.getSum();297 }298 double itComputingPower = 0;299 for(GSSAccumulator acc: metricsData.get("Processor")){300 itComputingPower = itComputingPower + acc.getSum();301 }302 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;303 304 metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh");305 } catch (Exception e){306 metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh");307 }308 return metric;309 }310 311 312 private MetricsStats calculateRackEnergyConsumption(){313 314 MetricsStats metric;315 try{316 double roomPower = 0;317 for(GSSAccumulator acc: metricsData.get("Rack")){318 roomPower = roomPower + acc.getSum();319 }320 metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh");321 } catch (Exception e){322 metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_device_consumption", -1, timestamp, "Wh");323 }324 return metric;325 }326 327 private MetricsStats calculateCoolingDeviceEnergyConsumption(){328 329 MetricsStats metric;330 try{331 double coolingDevicePower = 0;332 for(GSSAccumulator acc: metricsData.get("CoolingDevice")){333 coolingDevicePower = coolingDevicePower + acc.getSum();334 }335 metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh");336 } catch (Exception e){337 metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_consumption", -1, timestamp, "Wh");338 }339 return metric;340 }341 342 private MetricsStats calculateOtherDevicesEnergyConsumption(){343 344 MetricsStats metric;345 try{346 double roomPower = 0;347 for(GSSAccumulator acc: metricsData.get("Room")){348 roomPower = roomPower + acc.getSum();349 }350 351 double totalSitePower = 0;352 for(GSSAccumulator acc: metricsData.get("Rack")){353 totalSitePower = totalSitePower + acc.getSum();354 }355 356 double coolingDevicePower = 0;357 for(GSSAccumulator acc: metricsData.get("CoolingDevice")){358 coolingDevicePower = coolingDevicePower + acc.getSum();359 }360 361 double inletsPower = 0;362 for(GSSAccumulator acc: metricsData.get("Inlet")){363 inletsPower = inletsPower + acc.getSum();364 }365 366 double outletsPower = 0;367 for(GSSAccumulator acc: metricsData.get("Outlet")){368 outletsPower = outletsPower + acc.getSum();369 }370 371 double nodeComputingPower = 0;372 for(GSSAccumulator acc: metricsData.get("Node")){373 nodeComputingPower = nodeComputingPower+ acc.getSum();374 }375 double itComputingPower = 0;376 for(GSSAccumulator acc: metricsData.get("Processor")){377 itComputingPower = itComputingPower + acc.getSum();378 }379 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;380 381 metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower - nodeGroupFansPowerConumspion)), timestamp, "Wh");382 } catch (Exception e){383 metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_consumption", -1, timestamp, "Wh");384 }385 return metric;386 }387 388 389 private MetricsStats calculateMeanPower(){390 391 MetricsStats metric;392 try{393 394 double roomPower = 0;395 for(GSSAccumulator acc: metricsData.get("Room")){396 roomPower = roomPower + acc.getSum();397 }398 metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");399 } catch (Exception e){400 metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W");401 }402 return metric;403 }404 405 406 private MetricsStats calculateMeanRackPower(){407 408 MetricsStats metric;409 try{410 411 double roomPower = 0;412 for(GSSAccumulator acc: metricsData.get("Rack")){413 roomPower = roomPower + acc.getSum();414 }415 metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");416 } catch (Exception e){417 metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W");418 }419 return metric;420 }421 422 private MetricsStats calculateEnergyWasteRate(){423 424 MetricsStats metric;425 try{426 double itComputingEnergy = 0;427 for(GSSAccumulator acc: metricsData.get("Processor_CALC")){428 itComputingEnergy = itComputingEnergy + acc.getSum();429 }430 itComputingEnergy = itComputingEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC);431 double itEnergy = calculateITEnergyConsumption().getValue();432 433 metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%");434 } catch (Exception e){435 metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%");436 }437 return metric;438 }439 440 public long getStartTime() {441 return startTime;442 }443 444 public void setStartTime(long startTime) {445 this.startTime = startTime;446 }447 448 public long getEndTime() {449 return endTime;450 }451 452 public void setEndTime(long endTime) {453 this.endTime = endTime;454 }455 43 } -
DCWoRMS/branches/coolemall/src/simulator/stats/MetricsCalculator.java
r1207 r1299 1 1 package simulator.stats; 2 2 3 import java.util.ArrayList;4 import java.util.HashMap;5 3 import java.util.List; 6 4 import java.util.Map; 7 5 8 6 import simulator.stats.implementation.MetricsStats; 9 import example.energy.coolemall.CoolEmAllTestbedMeasurements;10 7 11 public classMetricsCalculator {8 public interface MetricsCalculator { 12 9 13 protected static final double MILLI_SEC = 1000; 14 protected static final double SEC_IN_HOUR = 3600; 10 public List<MetricsStats> calulateMetrics(); 15 11 16 protected Map<String, List<GSSAccumulator>> metricsData = new HashMap<String, List<GSSAccumulator>>(); 17 protected long timestamp; 18 protected long startTime; 19 protected long endTime; 20 21 public List<MetricsStats> calulateMetrics(long timestamp){ 22 this.timestamp = timestamp; 23 List<MetricsStats> metrics = new ArrayList<MetricsStats>(); 24 /*for(String resourceTypeName: metricsData.keySet()){ 25 MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax()); 26 metrics.add(metric);} 27 }*/ 28 metrics.add(calculateITComputingEnergyConsumption()); 29 metrics.add(calculateITEnergyConsumption()); 30 metrics.add(calculateNodeGroupFansEnergyConsumption()); 31 32 metrics.add(calculateRackEnergyConsumption()); 33 metrics.add(calculateDataCenterFansEnergyConsumption()); 34 metrics.add(calculateCoolingDeviceEnergyConsumption()); 35 metrics.add(calculateOtherDevicesEnergyConsumption()); 36 37 metrics.add(calculateTotalEnergyConsumption()); 38 39 metrics.add(calculateMeanRackPower()); 40 metrics.add(calculateMeanPower()); 41 metrics.add(calculateMaxRackPower()); 42 metrics.add(calculateMaxPower()); 43 44 metrics.add(calculatePUE()); 45 metrics.add(calculatePUELevel4()); 46 metrics.add(calculateEnergyWasteRate()); 47 48 metrics.add(calculateUsefulWork()); 49 metrics.add(calculateProductivity()); 50 51 return metrics; 52 } 12 public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator); 53 13 54 public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator){ 55 List<GSSAccumulator> resourceEnergyAccumulatorList = metricsData.get(resourceTypeName); 56 if(resourceEnergyAccumulatorList == null){ 57 resourceEnergyAccumulatorList = new ArrayList<GSSAccumulator>(); 58 } 59 resourceEnergyAccumulatorList.add(resourceEnergyAccumulator); 60 metricsData.put(resourceTypeName, resourceEnergyAccumulatorList); 61 } 14 public Map<String, List<GSSAccumulator>> getMetricsData(); 62 15 63 public Map<String, List<GSSAccumulator>> getMetricsData(){64 return metricsData;65 }66 67 private MetricsStats calculateTotalEnergyConsumption(){68 69 MetricsStats metric;70 try{71 72 double roomPower = 0;73 for(GSSAccumulator acc: metricsData.get("Room")){74 roomPower = roomPower + acc.getSum();75 }76 metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh");77 } catch (Exception e){78 metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh");79 }80 return metric;81 }82 83 private MetricsStats calculateITComputingEnergyConsumption(){84 85 MetricsStats metric;86 try{87 double itComputingPower = 0;88 for(GSSAccumulator acc: metricsData.get("Processor")){89 itComputingPower = itComputingPower + acc.getSum();90 }91 metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh");92 } catch (Exception e){93 metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh");94 }95 return metric;96 }97 98 private MetricsStats calculateITEnergyConsumption(){99 100 MetricsStats metric;101 try{102 double totalSitePower = 0;103 for(GSSAccumulator acc: metricsData.get("Rack")){104 totalSitePower = totalSitePower + acc.getSum();105 }106 double nodeComputingPower = 0;107 for(GSSAccumulator acc: metricsData.get("Node")){108 nodeComputingPower = nodeComputingPower+ acc.getSum();109 }110 double itComputingPower = 0;111 for(GSSAccumulator acc: metricsData.get("Processor")){112 itComputingPower = itComputingPower + acc.getSum();113 }114 double fanPowerConumspion = nodeComputingPower - itComputingPower;115 metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - fanPowerConumspion), timestamp, "Wh");116 } catch (Exception e){117 metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh");118 }119 return metric;120 }121 122 private MetricsStats calculateNodeGroupFansEnergyConsumption(){123 124 MetricsStats metric;125 try{126 double nodeComputingPower = 0;127 for(GSSAccumulator acc: metricsData.get("Node")){128 nodeComputingPower = nodeComputingPower+ acc.getSum();129 }130 double itComputingPower = 0;131 for(GSSAccumulator acc: metricsData.get("Processor")){132 itComputingPower = itComputingPower + acc.getSum();133 }134 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;135 metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh");136 } catch (Exception e){137 metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh");138 }139 return metric;140 }141 142 private MetricsStats calculatePUELevel4(){143 144 MetricsStats metric;145 try{146 147 double roomPower = 0;148 for(GSSAccumulator acc: metricsData.get("Room")){149 roomPower = roomPower + acc.getSum();150 }151 152 double totalSitePower = 0;153 for(GSSAccumulator acc: metricsData.get("Rack")){154 totalSitePower = totalSitePower + acc.getSum();155 }156 157 158 double nodeComputingPower = 0;159 for(GSSAccumulator acc: metricsData.get("Node")){160 nodeComputingPower = nodeComputingPower+ acc.getSum();161 }162 double itComputingPower = 0;163 for(GSSAccumulator acc: metricsData.get("Processor")){164 itComputingPower = itComputingPower + acc.getSum();165 }166 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;167 168 metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, "");169 } catch (Exception e){170 metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, "");171 }172 return metric;173 }174 175 private MetricsStats calculatePUE(){176 177 MetricsStats metric;178 try{179 180 double roomPower = 0;181 for(GSSAccumulator acc: metricsData.get("Room")){182 roomPower = roomPower + acc.getSum();183 }184 185 double totalSitePower = 0;186 for(GSSAccumulator acc: metricsData.get("Rack")){187 totalSitePower = totalSitePower + acc.getSum();188 }189 190 191 metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, "");192 } catch (Exception e){193 metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, "");194 }195 return metric;196 }197 198 private MetricsStats calculateUsefulWork(){199 200 MetricsStats metric;201 try{202 double usefulWork = 0;203 for(String key: metricsData.keySet()){204 if(key.contains("/")){205 for(GSSAccumulator acc: metricsData.get(key)){206 usefulWork= usefulWork + acc.getSum();207 }208 }209 }210 metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units");211 } catch (Exception e){212 metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units");213 }214 215 return metric;216 }217 218 private MetricsStats calculateProductivity(){219 220 MetricsStats metric;221 try{222 double usefulWork = 0;223 for(String key: metricsData.keySet()){224 if(key.contains("/")){225 for(GSSAccumulator acc: metricsData.get(key)){226 usefulWork= usefulWork + acc.getSum();227 }228 }229 }230 double totalSitePower = 0;231 for(GSSAccumulator acc: metricsData.get("Rack")){232 totalSitePower = totalSitePower + acc.getSum();233 }234 235 metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh");236 } catch (Exception e){237 metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh");238 }239 240 return metric;241 }242 243 244 private MetricsStats calculateMaxRackPower(){245 246 MetricsStats metric;247 try{248 double maxPower = 0;249 250 for(GSSAccumulator acc: metricsData.get("Rack_MAX")){251 maxPower = maxPower + acc.getSum();252 }253 254 metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W");255 } catch (Exception e){256 metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W");257 }258 259 return metric;260 }261 262 private MetricsStats calculateMaxPower(){263 264 MetricsStats metric;265 try{266 double maxPower = 0;267 268 for(GSSAccumulator acc: metricsData.get("Room_MAX")){269 maxPower = maxPower + acc.getSum();270 }271 272 metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W");273 } catch (Exception e){274 metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W");275 }276 277 return metric;278 }279 280 private MetricsStats calculateDataCenterFansEnergyConsumption(){281 282 MetricsStats metric;283 try{284 double inletsPower = 0;285 for(GSSAccumulator acc: metricsData.get("Inlet")){286 inletsPower = inletsPower + acc.getSum();287 }288 289 double outletsPower = 0;290 for(GSSAccumulator acc: metricsData.get("Outlet")){291 outletsPower = outletsPower + acc.getSum();292 }293 294 double nodeComputingPower = 0;295 for(GSSAccumulator acc: metricsData.get("Node")){296 nodeComputingPower = nodeComputingPower+ acc.getSum();297 }298 double itComputingPower = 0;299 for(GSSAccumulator acc: metricsData.get("Processor")){300 itComputingPower = itComputingPower + acc.getSum();301 }302 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;303 304 metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh");305 } catch (Exception e){306 metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh");307 }308 return metric;309 }310 311 312 private MetricsStats calculateRackEnergyConsumption(){313 314 MetricsStats metric;315 try{316 double roomPower = 0;317 for(GSSAccumulator acc: metricsData.get("Rack")){318 roomPower = roomPower + acc.getSum();319 }320 metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh");321 } catch (Exception e){322 metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_device_consumption", -1, timestamp, "Wh");323 }324 return metric;325 }326 327 private MetricsStats calculateCoolingDeviceEnergyConsumption(){328 329 MetricsStats metric;330 try{331 double coolingDevicePower = 0;332 for(GSSAccumulator acc: metricsData.get("CoolingDevice")){333 coolingDevicePower = coolingDevicePower + acc.getSum();334 }335 metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh");336 } catch (Exception e){337 metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_consumption", -1, timestamp, "Wh");338 }339 return metric;340 }341 342 private MetricsStats calculateOtherDevicesEnergyConsumption(){343 344 MetricsStats metric;345 try{346 double roomPower = 0;347 for(GSSAccumulator acc: metricsData.get("Room")){348 roomPower = roomPower + acc.getSum();349 }350 351 double totalSitePower = 0;352 for(GSSAccumulator acc: metricsData.get("Rack")){353 totalSitePower = totalSitePower + acc.getSum();354 }355 356 double coolingDevicePower = 0;357 for(GSSAccumulator acc: metricsData.get("CoolingDevice")){358 coolingDevicePower = coolingDevicePower + acc.getSum();359 }360 361 double inletsPower = 0;362 for(GSSAccumulator acc: metricsData.get("Inlet")){363 inletsPower = inletsPower + acc.getSum();364 }365 366 double outletsPower = 0;367 for(GSSAccumulator acc: metricsData.get("Outlet")){368 outletsPower = outletsPower + acc.getSum();369 }370 371 double nodeComputingPower = 0;372 for(GSSAccumulator acc: metricsData.get("Node")){373 nodeComputingPower = nodeComputingPower+ acc.getSum();374 }375 double itComputingPower = 0;376 for(GSSAccumulator acc: metricsData.get("Processor")){377 itComputingPower = itComputingPower + acc.getSum();378 }379 double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;380 381 metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower - nodeGroupFansPowerConumspion)), timestamp, "Wh");382 } catch (Exception e){383 metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_consumption", -1, timestamp, "Wh");384 }385 return metric;386 }387 388 389 private MetricsStats calculateMeanPower(){390 391 MetricsStats metric;392 try{393 394 double roomPower = 0;395 for(GSSAccumulator acc: metricsData.get("Room")){396 roomPower = roomPower + acc.getSum();397 }398 metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");399 } catch (Exception e){400 metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W");401 }402 return metric;403 }404 405 406 private MetricsStats calculateMeanRackPower(){407 408 MetricsStats metric;409 try{410 411 double roomPower = 0;412 for(GSSAccumulator acc: metricsData.get("Rack")){413 roomPower = roomPower + acc.getSum();414 }415 metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");416 } catch (Exception e){417 metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W");418 }419 return metric;420 }421 422 private MetricsStats calculateEnergyWasteRate(){423 424 MetricsStats metric;425 try{426 double itComputingEnergy = 0;427 for(GSSAccumulator acc: metricsData.get("Processor_CALC")){428 itComputingEnergy = itComputingEnergy + acc.getSum();429 }430 itComputingEnergy = itComputingEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC);431 double itEnergy = calculateITEnergyConsumption().getValue();432 433 metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%");434 } catch (Exception e){435 metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%");436 }437 return metric;438 }439 440 public long getStartTime() {441 return startTime;442 }443 444 public void setStartTime(long startTime) {445 this.startTime = startTime;446 }447 448 public long getEndTime() {449 return endTime;450 }451 452 public void setEndTime(long endTime) {453 this.endTime = endTime;454 }455 16 } -
DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java
r1207 r1299 62 62 import schedframe.resources.UserResourceType; 63 63 import schedframe.resources.computing.ComputingResource; 64 import schedframe.resources.computing.Processor; 64 65 import schedframe.resources.computing.extensions.Extension; 65 66 import schedframe.resources.computing.extensions.ExtensionList; 66 67 import schedframe.resources.computing.extensions.ExtensionType; 67 68 import schedframe.resources.computing.profiles.energy.EnergyExtension; 69 import schedframe.resources.computing.profiles.energy.MeasurementHistory; 68 70 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 69 71 import schedframe.resources.computing.profiles.energy.power.PowerUsage; 70 72 import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue; 73 import schedframe.resources.computing.profiles.load.LoadExtension; 71 74 import schedframe.resources.devices.Device; 72 75 import schedframe.resources.devices.PhysicalResource; … … 85 88 import simulator.DataCenterWorkloadSimulator; 86 89 import simulator.GenericUser; 90 import simulator.stats.CoolEmAllMetricsCalculator; 91 import simulator.stats.DCwormsMetricsCalculator; 87 92 import simulator.stats.GSSAccumulator; 88 93 import simulator.stats.MetricsCalculator; 89 94 import simulator.stats.SimulationStatistics; 90 import simulator.stats.implementation.out.AbstractStringSerializer;91 95 import simulator.stats.implementation.out.CoolEmAllStringSerializer; 92 96 import simulator.stats.implementation.out.StringSerializer; … … 110 114 protected static final int MILLI_SEC = 1000; 111 115 112 protected static final String RAW_TASKS_STATISTICS_OUTPUT_FILE_NAME = "Tasks.txt";116 protected static final String TASKS_STATISTICS_OUTPUT_FILE_NAME = "Tasks.txt"; 113 117 protected static final String JOBS_STATISTICS_OUTPUT_FILE_NAME = "Jobs.txt"; 114 118 115 119 protected static final String SIMULATION_STATISTICS_OUTPUT_FILE_NAME = "Simulation.txt"; 120 protected static final String RESOURCEOCCUPANCY_STATISTICS_OUTPUT_FILE_NAME = "ResourceOccupancy.txt"; 116 121 protected static final String RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME = "ResourceUtilization.txt"; 117 122 protected static final String ENERGYUSAGE_STATISTICS_OUTPUT_FILE_NAME = "EnergyUsage.txt"; … … 141 146 protected SimulatedEnvironment resourceController; 142 147 protected boolean generateDiagrams = true; 143 protected AbstractStringSerializer serializer;148 protected StringSerializer serializer; 144 149 protected long startSimulationTime; 145 150 protected long endSimulationTime; 146 151 147 152 //RESOURCES 148 protected Map<String, List<ResStat>> basicResStats;153 protected Map<String, List<ResStat>> pesStats; 149 154 protected Map<String, Double> basicResLoad; 150 155 … … 156 161 protected Map<String, List<XYDataset>> resourceAirFlowDiagrams; 157 162 protected Map<String, List<XYDataset>> resourceTemperatureDiagrams; 158 protected Map<String, List<XYDataset>> resourceLoadDiagrams; 163 protected Map<String, List<XYDataset>> resourceOccupancyDiagrams; 164 protected Map<String, List<XYDataset>> resourceUtilizationDiagrams; 159 165 160 166 //TASKS … … 178 184 179 185 this.outputFolderName = outputFolderName; 180 181 this.serializer = new StringSerializer();182 183 if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){184 this.serializer = new CoolEmAllStringSerializer();185 }186 this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT);187 188 186 this.resourceController = resourceController; 189 187 this.jr = new JobRegistryImpl(""); 190 init(); 191 metCalc = new MetricsCalculator(); 192 } 193 194 public void generateStatistics() { 195 188 196 189 if(users.isSimStartTimeDefined()) 197 190 this.startSimulationTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis(); 198 191 else 199 192 this.startSimulationTime = new DateTime(users.getSubmissionStartTime() * 1000l).getMillis(); 193 200 194 this.endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 201 195 202 metCalc.setStartTime(startSimulationTime); 203 metCalc.setEndTime(endSimulationTime); 196 init(); 197 } 198 199 public void generateStatistics() { 204 200 205 201 long s = 0; … … 234 230 accStats = new GSSAccumulatorsStats(); 235 231 statsData = new HashMap<String, GSSAccumulator>(); 232 233 this.serializer = new StringSerializer(); 234 this.metCalc = new DCwormsMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 235 236 if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){ 237 this.serializer = new CoolEmAllStringSerializer(); 238 this.metCalc = new CoolEmAllMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 239 } 240 this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT); 236 241 } 237 242 … … 262 267 System.out.println("#STATS " + "===== Performance statistics ====="); 263 268 System.out.println("#STATS " + "Makespan: " + df.format(accStats.makespan.getMean()) + " [s]"); 264 System.out.println("#STATS " + "Task completion time - " + "min: " + df.format(accStats.meanTaskCompletionTime.getMin()) + " [s]" + "; max: " + df.format(accStats.meanTaskCompletionTime.getMax()) + " [s]" );269 System.out.println("#STATS " + "Task completion time - " + "min: " + df.format(accStats.meanTaskCompletionTime.getMin()) + " [s]" + "; max: " + df.format(accStats.meanTaskCompletionTime.getMax()) + " [s]" + "; mean: " + df.format(accStats.meanTaskCompletionTime.getMean()) + " [s]"); 265 270 System.out.println("#STATS " + "Mean task execution time: " + df.format(accStats.meanTaskExecutionTime.getMean()) + " [s]"); 271 System.out.println("#STATS " + "System occupancy: " + df.format(accStats.meanTotalOccupancy.getMean() * 100) + " [%]"); 266 272 System.out.println("#STATS " + "System load: " + df.format(accStats.meanTotalLoad.getMean() * 100) + " [%]"); 273 267 274 268 275 simulationStatsFile.println(txt); … … 300 307 taskGanttMap = new HashMap<String, TimetableEventGroup>(); 301 308 302 resourceLoadDiagrams = new HashMap<String, List<XYDataset>>(); 309 resourceOccupancyDiagrams = new HashMap<String, List<XYDataset>>(); 310 resourceUtilizationDiagrams = new HashMap<String, List<XYDataset>>(); 303 311 resourcePowerUsageDiagrams = new HashMap<String, List<XYDataset>>(); 304 312 resourceAirFlowDiagrams = new HashMap<String, List<XYDataset>>(); … … 309 317 310 318 311 PrintStream resourceLoadStatsFile = null; 319 PrintStream resourceOccupancyStatsFile = null; 320 try { 321 File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX 322 + simulationIdentifier + "_" 323 + RESOURCEOCCUPANCY_STATISTICS_OUTPUT_FILE_NAME); 324 resourceOccupancyStatsFile = new PrintStream(new FileOutputStream(file)); 325 } catch (IOException e) { 326 resourceOccupancyStatsFile = null; 327 } 328 329 PrintStream resourceUtilizationStatsFile = null; 312 330 try { 313 331 File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX 314 332 + simulationIdentifier + "_" 315 333 + RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME); 316 resource LoadStatsFile = new PrintStream(new FileOutputStream(file));334 resourceUtilizationStatsFile = new PrintStream(new FileOutputStream(file)); 317 335 } catch (IOException e) { 318 resource LoadStatsFile = null;336 resourceUtilizationStatsFile = null; 319 337 } 320 338 … … 389 407 } 390 408 391 basicResStats = gatherPEStats(jr.getTasks());392 peStatsPostProcessing( basicResStats);393 basicResLoad = calculatePELoad( basicResStats);409 pesStats = gatherPEStats(jr.getTasks()); 410 peStatsPostProcessing(pesStats); 411 basicResLoad = calculatePELoad(pesStats); 394 412 395 413 if (configuration.creatediagrams_gantt) { 396 createPEGanttDiagram( basicResStats);414 createPEGanttDiagram(pesStats); 397 415 } 398 416 … … 412 430 413 431 for(ComputingResource compResource: compResources){ 414 ResourceUsageStats resourceUsage = null; 432 ResourceUsageStats resourceUtilization = null; 433 ResourceUsageStats resourceOccupancy = null; 415 434 ResourcePowerStats energyUsage = null; 416 435 ResourceAirFlowStats airFlow = null; … … 418 437 ResourceUsefulWorkStats usefulWork = null; 419 438 if(type_stats.get(resourceTypeName).contains(Stats.textLoad)){ 420 resource Usage = gatherResourceLoadStats(compResource, basicResStats);421 resource Usage.setMeanValue(calculateMeanValue(resourceUsage));422 if (resource LoadStatsFile != null) {423 Object txt = resource Usage.serialize(serializer);424 resource LoadStatsFile.print(txt);439 resourceOccupancy = gatherResourceOccupancyStats(compResource, pesStats); 440 resourceOccupancy.setMeanValue(calculateMeanValue(resourceOccupancy)); 441 if (resourceOccupancyStatsFile != null) { 442 Object txt = resourceOccupancy.serialize(serializer); 443 resourceOccupancyStatsFile.print(txt); 425 444 } 426 445 446 resourceUtilization = gatherResourceUtlizationStats(compResource); 447 resourceUtilization.setMeanValue(calculateMeanValue(resourceUtilization)); 448 if (resourceUtilizationStatsFile != null) { 449 Object txt = resourceUtilization.serialize(serializer); 450 resourceUtilizationStatsFile.print(txt); 451 } 427 452 } 428 453 if(type_stats.get(resourceTypeName).contains(Stats.chartLoad)){ 429 454 if (configuration.creatediagrams_resutilization) { 430 createResourceLoadDiagram(resourceUsage); 455 createResourceOccupancyDiagram(resourceOccupancy); 456 createResourceUtilizationDiagram(resourceUtilization); 431 457 } 432 458 } … … 437 463 resourceEnergyAccumulator.add(energyUsage.getSumValue()); 438 464 maxResourceEnergyAccumulator.add(calculateMaxValue(energyUsage)); 439 double cal ulcationsEnergy = 0;465 double calculationsEnergy = 0; 440 466 try { 441 /*boolean doCalc = false;442 double prevTimestamp = 0;443 for(Long key: resourceUsage.getHistory().keySet()){444 if(doCalc){445 System.out.println(energyUsage.getHistory().get(key));446 calulcationsEnergy = calulcationsEnergy + energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600 * MILLI_SEC);447 doCalc = false;448 }449 if(resourceUsage.getHistory().get(key)>0){450 prevTimestamp = key;451 doCalc = true;452 }453 }*/454 467 boolean doCalc = false; 468 double load = 0; 455 469 long prevTimestamp = 0; 456 470 for(Long key: energyUsage.getHistory().keySet()){ 457 471 if(doCalc){ 458 double load = 0; 459 if(resourceUsage.getHistory().get(prevTimestamp)!= null){ 460 load = resourceUsage.getHistory().get(prevTimestamp); 472 if(resourceTypeName.equals("Rack")){ 473 calculationsEnergy = calculationsEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 474 }/* else if(resourceTypeName.equals("Processor")){ 475 Processor proc =( Processor) compResource; 476 double maxPower = proc.getPowerInterface().getLowestPState().getLoadPowerUsage().get(100.0); 477 calculationsEnergy = calculationsEnergy + load * maxPower * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 478 }*/ 479 else 480 calculationsEnergy = calculationsEnergy + load * energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 481 doCalc = false; 482 load = 0; 483 } 484 485 if(resourceUtilization.getHistory().get(key) != null){ 486 load = resourceUtilization.getHistory().get(key); 487 if(load > 0 ){ 488 doCalc = true; 489 prevTimestamp = key; 461 490 } 462 calulcationsEnergy = calulcationsEnergy + load * energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600.0 * MILLI_SEC);463 doCalc = false;464 }465 if(energyUsage.getHistory().get(key) > compResource.getPowerInterface().getSupportedPowerStates().get(0).getPowerUsage() - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION){466 467 prevTimestamp = key;468 doCalc = true;469 491 } 470 492 } 471 //calulcationsEnergy = energyUsage.getSumValue() - 472 // ((1 - resourceUsage.getMeanValue()) * (endSimulationTime - startSimulationTime) / (3600 * MILLI_SEC)) * 473 // (compResource.getPowerInterface().getSupportedPowerStates().get(0).getPowerUsage() - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION); 474 //System.out.println(compResource.getFullName() + ";" + resourceUsage.getMeanValue() +":"+ calulcationsEnergy + ":" + energyUsage.getSumValue()); 475 calculationsEnergyAccumulator.add(calulcationsEnergy); 493 494 calculationsEnergyAccumulator.add(calculationsEnergy); 476 495 } catch (Exception e) { 477 496 e.printStackTrace(); … … 510 529 devAccumulator.add(deviceEnergyUsage.getSumValue()); 511 530 metCalc.addMetricsData(device.getType().getName(), devAccumulator); 531 metCalc.addMetricsData(device.getFullName(), devAccumulator); 512 532 if (deviceStatsFile != null) { 513 533 Object txt = deviceEnergyUsage.serialize(serializer); … … 666 686 //log.info("#STATS " + "Metrics"); 667 687 System.out.println("#STATS " + "===== Metrics ====="); 668 for(MetricsStats metric: metCalc.calulateMetrics( endSimulationTime)){688 for(MetricsStats metric: metCalc.calulateMetrics()){ 669 689 Object txt = metric.serialize(serializer); 670 690 //log.info("#STATS " + metric.getResourceName() + " " + metric.getMetricName() + ": " + metric.getValue()); … … 676 696 } 677 697 } 678 saveResource UsageDiagrams();698 saveResourceDiagrams(); 679 699 createAccumulatedResourceSimulationStatistic(); 680 700 … … 688 708 energyStatsFile.close(); 689 709 } 690 if (resourceLoadStatsFile != null) { 691 resourceLoadStatsFile.close(); 710 if (resourceOccupancyStatsFile != null) { 711 resourceOccupancyStatsFile.close(); 712 } 713 if (resourceUtilizationStatsFile != null) { 714 resourceUtilizationStatsFile.close(); 692 715 } 693 716 … … 813 836 814 837 815 private ResourceUsageStats gatherResource LoadStats(ComputingResource resource, Map<String, List<ResStat>> basicStats) {838 private ResourceUsageStats gatherResourceOccupancyStats(ComputingResource resource, Map<String, List<ResStat>> basicStats) { 816 839 String usageType = null; 817 840 if(resource.getResourceCharacteristic().getParameters().get("load-sensor")!= null){ … … 844 867 int usedResources = 0; 845 868 for(ComputingResource compResource: resource.getChildren()){ 846 double meanLoad = calculateMeanValue(gatherResource LoadStats(compResource, basicResStats));869 double meanLoad = calculateMeanValue(gatherResourceOccupancyStats(compResource, pesStats)); 847 870 if(meanLoad > 0){ 848 871 usedResources++; … … 916 939 } 917 940 941 private ResourceUsageStats gatherResourceUtlizationStats(PhysicalResource resource) { 942 943 String usageType = null; 944 if(resource.getResourceCharacteristic().getParameters().get("load-sensor")!= null){ 945 usageType = resource.getResourceCharacteristic().getParameters().get("load-sensor").get(0).getContent(); 946 } 947 ResourceUsageStats resUtlization = new ResourceUsageStats(resource.getFullName(), resource.getType(), usageType); 948 Map<Long, Double> usage = resUtlization.getHistory(); 949 950 ExtensionList extensionList = resource.getExtensionList(); 951 if(extensionList != null){ 952 for (Extension extension : extensionList) { 953 if (extension.getType() == ExtensionType.LOAD_EXTENSION) { 954 LoadExtension le = (LoadExtension)extension; 955 if(le.getLoadProfile() == null) 956 break; 957 List<MeasurementHistory> loadHistory = le.getLoadProfile().getUtilizationHistory(); 958 if(loadHistory.size() == 0) 959 break; 960 long endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 961 962 loadHistory.add(new MeasurementHistory(endSimulationTime, le.getLoadProfile().getUtilizationHistory().get(le.getLoadProfile().getUtilizationHistory().size() - 1).getValue()/100)); 963 for(MeasurementHistory l:loadHistory){ 964 usage.put(l.getTimestamp(), l.getValue()/100); 965 } 966 } 967 } 968 } 969 return resUtlization; 970 } 918 971 919 972 private ResourcePowerStats gatherResourcePowerConsumptionStats(PhysicalResource resource) { … … 921 974 922 975 String usageType = null; 923 if(resource.getResourceCharacteristic().getParameters().get("power-sensor") != null){976 if(resource.getResourceCharacteristic().getParameters().get("power-sensor") != null){ 924 977 usageType = resource.getResourceCharacteristic().getParameters().get("power-sensor").get(0).getContent(); 925 978 } … … 954 1007 } 955 1008 956 957 1009 private ResourceAirFlowStats gatherResourceAirFlowStats(PhysicalResource resource) { 958 1010 959 1011 String usageType = null; 960 if(resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor") != null){1012 if(resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor") != null){ 961 1013 usageType = resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor").get(0).getContent(); 962 1014 } … … 1016 1068 } 1017 1069 1018 private void createResource LoadDiagram(ResourceUsageStats resLoadStats) {1070 private void createResourceOccupancyDiagram(ResourceUsageStats resLoadStats) { 1019 1071 1020 1072 for(Long key: resLoadStats.getHistory().keySet()){ … … 1026 1078 startSimulationTime, endSimulationTime); 1027 1079 1028 List<XYDataset> loadDiagram = resourceLoadDiagrams.get(resLoadStats.getResourceType().getName());1029 if( loadDiagram == null){1030 loadDiagram = new ArrayList<XYDataset>();1031 loadDiagram.add(dataset);1032 resource LoadDiagrams.put(resLoadStats.getResourceType().getName(), loadDiagram);1080 List<XYDataset> occupancyDiagram = resourceOccupancyDiagrams.get(resLoadStats.getResourceType().getName()); 1081 if(occupancyDiagram == null){ 1082 occupancyDiagram = new ArrayList<XYDataset>(); 1083 occupancyDiagram.add(dataset); 1084 resourceOccupancyDiagrams.put(resLoadStats.getResourceType().getName(), occupancyDiagram); 1033 1085 } else { 1034 loadDiagram.add(dataset); 1086 occupancyDiagram.add(dataset); 1087 } 1088 } 1089 1090 private void createResourceUtilizationDiagram(ResourceUsageStats resLoadStats) { 1091 1092 for(Long key: resLoadStats.getHistory().keySet()){ 1093 Double value = resLoadStats.getHistory().get(key) * 100; 1094 resLoadStats.getHistory().put(key, value); 1095 } 1096 1097 XYDataset dataset = createResourceChartDataSet(resLoadStats, 1098 startSimulationTime, endSimulationTime); 1099 1100 List<XYDataset> utilizationDiagram = resourceUtilizationDiagrams.get(resLoadStats.getResourceType().getName()); 1101 if(utilizationDiagram == null){ 1102 utilizationDiagram = new ArrayList<XYDataset>(); 1103 utilizationDiagram.add(dataset); 1104 resourceUtilizationDiagrams.put(resLoadStats.getResourceType().getName(), utilizationDiagram); 1105 } else { 1106 utilizationDiagram.add(dataset); 1035 1107 } 1036 1108 } … … 1109 1181 } 1110 1182 1111 private boolean saveResource UsageDiagrams() {1183 private boolean saveResourceDiagrams() { 1112 1184 1113 1185 if (!generateDiagrams) … … 1133 1205 chartName = "Load diagram for " 1134 1206 + DataCenterWorkloadSimulator.SIMULATOR_NAME; 1135 JFreeChart resourceLoadDiagram = null; 1207 JFreeChart resourceOccupancyDiagram = null; 1208 if (configuration.creatediagrams_resutilization) { 1209 String axisName = "OCCUPANCY [%]"; 1210 for(String resType: resourceOccupancyDiagrams.keySet()){ 1211 resourceOccupancyDiagram = getResourceDynamicDiagram(resourceOccupancyDiagrams.get(resType), simulationTime, chartName, 1212 subtitle, axisName); 1213 if (!saveXYPlotChart(resourceOccupancyDiagram, fileName + "ResourcesOccupancy_" + resType)) 1214 return false; 1215 } 1216 } 1217 1218 chartName = "Utilization diagram for " 1219 + DataCenterWorkloadSimulator.SIMULATOR_NAME; 1220 JFreeChart resourceUtilizationDiagram = null; 1136 1221 if (configuration.creatediagrams_resutilization) { 1137 1222 String axisName = "UTILIZATION [%]"; 1138 for(String resType: resource LoadDiagrams.keySet()){1139 resource LoadDiagram = getResourceDynamicDiagram(resourceLoadDiagrams.get(resType), simulationTime, chartName,1223 for(String resType: resourceUtilizationDiagrams.keySet()){ 1224 resourceUtilizationDiagram = getResourceDynamicDiagram(resourceUtilizationDiagrams.get(resType), simulationTime, chartName, 1140 1225 subtitle, axisName); 1141 if (!saveXYPlotChart(resource LoadDiagram, fileName + "ResourcesLoad_" + resType))1226 if (!saveXYPlotChart(resourceUtilizationDiagram, fileName + "ResourcesUtilization_" + resType)) 1142 1227 return false; 1143 1228 } … … 1322 1407 //double load = calculateMeanValue(resourceUsage); 1323 1408 double load = calculateResourceLoad(compRes, basicResLoad); 1324 accStats.meanTotalLoad.add(load); 1409 accStats.meanTotalOccupancy.add(load); 1410 1411 ResourceUsageStats resourceUtilization = gatherResourceUtlizationStats(compRes); 1412 accStats.meanTotalLoad.add(calculateMeanValue(resourceUtilization)); 1325 1413 /*ResourceEnergyStats energyUsage = gatherResourceEnergyStats(compRes); 1326 1414 energyUsage.setMeanUsage(calculateEnergyLoad(energyUsage)); … … 1365 1453 1366 1454 1367 private double calculateMeanValue(ResourceDynamicStats resDynamicStats 1455 private double calculateMeanValue(ResourceDynamicStats resDynamicStats){ 1368 1456 double meanValue = 0; 1369 1457 long time = -1; … … 1387 1475 1388 1476 1389 private double calculateMaxValue(ResourceDynamicStats resDynamicStats 1477 private double calculateMaxValue(ResourceDynamicStats resDynamicStats){ 1390 1478 double maxValue = 0; 1391 1479 … … 1414 1502 try { 1415 1503 File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX + simulationIdentifier + "_" 1416 + RAW_TASKS_STATISTICS_OUTPUT_FILE_NAME);1504 + TASKS_STATISTICS_OUTPUT_FILE_NAME); 1417 1505 taskStatsFile = new PrintStream(new FileOutputStream(file)); 1418 1506 } catch (IOException e) { … … 1634 1722 chartName = "Task waiting times diagram for " + DataCenterWorkloadSimulator.SIMULATOR_NAME; 1635 1723 if (configuration.creatediagrams_taskswaitingtime) { 1636 waitingTimeDiagram = get WaitingTimeDiagram(chartName, subtitle, simulationTime);1724 waitingTimeDiagram = getTaskWaitingTimeDiagram(chartName, subtitle, simulationTime); 1637 1725 if (!saveCategoryChart(waitingTimeDiagram, fileName + "Waiting_Time", null /* "Task {1} at {0}" */)) 1638 1726 return false; … … 1655 1743 } 1656 1744 1657 private JFreeChart get WaitingTimeDiagram(String chartName, Title subtitle, String simulationTime) {1745 private JFreeChart getTaskWaitingTimeDiagram(String chartName, Title subtitle, String simulationTime) { 1658 1746 String tasks = "Tasks"; 1659 1747 boolean urls = false; … … 1878 1966 textTemperature, 1879 1967 chartTemperature, 1880 textUsefulWor l;1968 textUsefulWork; 1881 1969 }
Note: See TracChangeset
for help on using the changeset viewer.