[1593] | 1 | package experiments.e2dc2015.models.i5; |
---|
| 2 | |
---|
| 3 | import schedframe.resources.StandardResourceType; |
---|
| 4 | import schedframe.resources.computing.ComputingResource; |
---|
| 5 | import schedframe.resources.computing.Node; |
---|
| 6 | import schedframe.resources.computing.Processor; |
---|
| 7 | import schedframe.resources.computing.Rack; |
---|
| 8 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
| 9 | import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; |
---|
| 10 | import schedframe.resources.devices.Device; |
---|
| 11 | import schedframe.resources.devices.Fan; |
---|
| 12 | import schedframe.resources.devices.PhysicalResource; |
---|
| 13 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 14 | import simulator.ConfigurationOptions; |
---|
| 15 | import example.energy.BaseEnergyEstimationPlugin; |
---|
| 16 | import example.energy.coolemall.CoolEmAllTestbedMeasurements; |
---|
| 17 | import experiments.e2dc2015.EnvironmentConditions; |
---|
| 18 | |
---|
| 19 | public class TangHeatCoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 20 | |
---|
| 21 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
| 22 | double airflow = 0; |
---|
| 23 | return airflow; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
| 27 | PhysicalResource resource) { |
---|
| 28 | |
---|
| 29 | double powerConsumption = 0; |
---|
| 30 | |
---|
| 31 | Device coolingDevice = (Device) resource; |
---|
| 32 | ComputingResource room = (ComputingResource) coolingDevice.getComputingResource(); |
---|
| 33 | |
---|
| 34 | double Pload_dc = calculatePit(room); |
---|
| 35 | double Q = calculateQ( 0.02*Pload_dc, room); |
---|
| 36 | double airTemp = EnvironmentConditions.ROOM_TEMPERATURE; |
---|
| 37 | double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458; |
---|
| 38 | |
---|
| 39 | powerConsumption = Q/CoP; |
---|
| 40 | return powerConsumption; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | private double calculatePit(ComputingResource room){ |
---|
| 44 | double Pload_dc = 0; |
---|
| 45 | for(ComputingResource cr: room.getChildren()){ |
---|
| 46 | Rack rack = (Rack)cr; |
---|
| 47 | Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 48 | } |
---|
| 49 | return Pload_dc; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | private double calculateQ(double Pothers, ComputingResource room){ |
---|
| 54 | |
---|
| 55 | double Qdc = 0; |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | /**************** HEAT ****************/ |
---|
| 59 | |
---|
| 60 | double Qload_dc = 0; |
---|
| 61 | double Qothers = 0; |
---|
| 62 | |
---|
| 63 | double delta_2; //DEBB - currently not present; |
---|
| 64 | delta_2 = 0.4; |
---|
| 65 | |
---|
| 66 | for(ComputingResource cr: room.getChildren()){ |
---|
| 67 | Rack rack = (Rack)cr; |
---|
| 68 | double QnodeGroup = 0; |
---|
| 69 | for(ComputingResource nodeGroup: rack.getChildren()){ |
---|
| 70 | double Qnodes = 0; |
---|
| 71 | for(ComputingResource node: nodeGroup.getChildren()){ |
---|
| 72 | double Qcpu = 0; |
---|
| 73 | Node n = (Node)node; |
---|
| 74 | for(Processor proc: n.getProcessors()){ |
---|
| 75 | Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 76 | } |
---|
| 77 | Qnodes = Qnodes + n.getPowerInterface().getRecentPowerUsage().getValue();; |
---|
| 78 | } |
---|
| 79 | double Qfans = 0; |
---|
| 80 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 81 | Fan fan = (Fan) device; |
---|
| 82 | if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ |
---|
| 83 | try { |
---|
| 84 | Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState()); |
---|
| 85 | } catch (NoSuchFieldException e) { |
---|
| 86 | // TODO Auto-generated catch block |
---|
| 87 | e.printStackTrace(); |
---|
| 88 | } |
---|
| 89 | }else |
---|
| 90 | Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 91 | } |
---|
| 92 | QnodeGroup = QnodeGroup + Qnodes + Qfans; |
---|
| 93 | } |
---|
| 94 | int nrOfPoweredOffNodes = 0; |
---|
| 95 | for(Node node: rack.getNodes()){ |
---|
| 96 | if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ |
---|
| 97 | nrOfPoweredOffNodes++; |
---|
| 98 | } |
---|
| 99 | } |
---|
| 100 | if(nrOfPoweredOffNodes != rack.getNodes().size()){ |
---|
| 101 | Qload_dc = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; |
---|
| 102 | } else { |
---|
| 103 | Qload_dc = Qload_dc + QnodeGroup; |
---|
| 104 | } |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | Qothers = Pothers; |
---|
| 108 | |
---|
| 109 | Qdc = Qload_dc + Qothers; |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | return Qdc; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | } |
---|