[1600] | 1 | package test.fips.models.i5; |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | import schedframe.resources.StandardResourceType; |
---|
| 5 | import schedframe.resources.computing.ComputingResource; |
---|
| 6 | import schedframe.resources.computing.Node; |
---|
| 7 | import schedframe.resources.computing.Processor; |
---|
| 8 | import schedframe.resources.computing.Rack; |
---|
| 9 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
| 10 | import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; |
---|
| 11 | import schedframe.resources.devices.Device; |
---|
| 12 | import schedframe.resources.devices.Fan; |
---|
| 13 | import schedframe.resources.devices.PhysicalResource; |
---|
| 14 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 15 | import simulator.ConfigurationOptions; |
---|
| 16 | import example.energy.BaseEnergyEstimationPlugin; |
---|
| 17 | import example.energy.coolemall.CoolEmAllTestbedMeasurements; |
---|
| 18 | import test.fips.EnvironmentConditions; |
---|
| 19 | |
---|
| 20 | public class TangHeatDataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ |
---|
| 21 | |
---|
| 22 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
| 23 | PhysicalResource resource) { |
---|
| 24 | |
---|
| 25 | double Pdc; |
---|
| 26 | |
---|
| 27 | double Pload_dc = 0; |
---|
| 28 | double Pothers = 0; |
---|
| 29 | double Pcooling_device = 0; |
---|
| 30 | |
---|
| 31 | ComputingResource room = (ComputingResource) resource; |
---|
| 32 | |
---|
| 33 | /**************** IT PART ****************/ |
---|
| 34 | |
---|
| 35 | /*********** Pload_dc ***********/ |
---|
| 36 | Pload_dc = calculatePit(room); |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | /**************** NON- IT PART ****************/ |
---|
| 41 | |
---|
| 42 | /*********** Pothers ***********/ |
---|
| 43 | Pothers = calculatePothers(Pload_dc); |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | /************* COOLING PART *************/ |
---|
| 48 | |
---|
| 49 | Device coolingDevice = null; |
---|
| 50 | for(Device device: room.getResourceCharacteristic().getDevices()){ |
---|
| 51 | if(device.getType().equals(StandardResourceType.CoolingDevice)){ |
---|
| 52 | coolingDevice = device; |
---|
| 53 | break; |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /************ Pcooling_device ************/ |
---|
| 58 | double airTemp = EnvironmentConditions.ROOM_TEMPERATURE; |
---|
| 59 | double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458; |
---|
| 60 | // |
---|
| 61 | double Q= calculateQ(Pothers, room); |
---|
| 62 | Pcooling_device = coolingDevice.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 63 | Pdc = Pload_dc + Pcooling_device+ Pothers; |
---|
| 64 | //System.out.println("---"); |
---|
| 65 | //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pcooling_device: " + Pcooling_device); |
---|
| 66 | |
---|
| 67 | return Pdc; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | private double calculatePit(ComputingResource room){ |
---|
| 71 | double Pload_dc = 0; |
---|
| 72 | for(ComputingResource cr: room.getChildren()){ |
---|
| 73 | Rack rack = (Rack)cr; |
---|
| 74 | Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 75 | } |
---|
| 76 | return Pload_dc; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | private double calculatePothers(double Pload_dc){ |
---|
| 80 | |
---|
| 81 | double Pothers = 0; |
---|
| 82 | |
---|
| 83 | double a;//experiment |
---|
| 84 | try{ |
---|
| 85 | a = ConfigurationOptions.coolingData.getAlpha(); |
---|
| 86 | } catch (Exception e){ |
---|
| 87 | a = 0.02; |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | Pothers = a * Pload_dc; |
---|
| 91 | return Pothers; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | private double calculateQ(double Pothers, ComputingResource room){ |
---|
| 96 | |
---|
| 97 | double Qdc = 0; |
---|
| 98 | |
---|
| 99 | |
---|
| 100 | /**************** HEAT ****************/ |
---|
| 101 | |
---|
| 102 | double Qload_dc = 0; |
---|
| 103 | double Qothers = 0; |
---|
| 104 | |
---|
| 105 | double delta_2; //DEBB - currently not present; |
---|
| 106 | delta_2 = 0.4; |
---|
| 107 | |
---|
| 108 | for(ComputingResource cr: room.getChildren()){ |
---|
| 109 | Rack rack = (Rack)cr; |
---|
| 110 | double QnodeGroup = 0; |
---|
| 111 | for(ComputingResource nodeGroup: rack.getChildren()){ |
---|
| 112 | double Qnodes = 0; |
---|
| 113 | for(ComputingResource node: nodeGroup.getChildren()){ |
---|
| 114 | double Qcpu = 0; |
---|
| 115 | Node n = (Node)node; |
---|
| 116 | for(Processor proc: n.getProcessors()){ |
---|
| 117 | Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 118 | } |
---|
| 119 | Qnodes = node.getPowerInterface().getRecentPowerUsage().getValue() + Qcpu; |
---|
| 120 | } |
---|
| 121 | double Qfans = 0; |
---|
| 122 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 123 | Fan fan = (Fan) device; |
---|
| 124 | if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ |
---|
| 125 | try { |
---|
| 126 | Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState()); |
---|
| 127 | } catch (NoSuchFieldException e) { |
---|
| 128 | // TODO Auto-generated catch block |
---|
| 129 | e.printStackTrace(); |
---|
| 130 | } |
---|
| 131 | }else |
---|
| 132 | Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 133 | } |
---|
| 134 | QnodeGroup = QnodeGroup + Qnodes + Qfans; |
---|
| 135 | } |
---|
| 136 | int nrOfPoweredOffNodes = 0; |
---|
| 137 | for(Node node: rack.getNodes()){ |
---|
| 138 | if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ |
---|
| 139 | nrOfPoweredOffNodes++; |
---|
| 140 | } |
---|
| 141 | } |
---|
| 142 | if(nrOfPoweredOffNodes != rack.getNodes().size()){ |
---|
| 143 | Qload_dc = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; |
---|
| 144 | } else { |
---|
| 145 | Qload_dc = Qload_dc + QnodeGroup; |
---|
| 146 | } |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | Qothers = Pothers; |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | Qdc = Qload_dc + Qothers; |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | return Qdc; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | } |
---|