package experiments.e2dc2015.models.i5; import schedframe.resources.StandardResourceType; import schedframe.resources.computing.ComputingResource; import schedframe.resources.computing.Node; import schedframe.resources.computing.Processor; import schedframe.resources.computing.Rack; import schedframe.resources.computing.profiles.energy.ResourceEvent; import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; import schedframe.resources.devices.Device; import schedframe.resources.devices.Fan; import schedframe.resources.devices.PhysicalResource; import schedframe.scheduling.manager.tasks.JobRegistry; import simulator.ConfigurationOptions; import example.energy.BaseEnergyEstimationPlugin; import example.energy.coolemall.CoolEmAllTestbedMeasurements; import experiments.e2dc2015.EnvironmentConditions; public class TangHeatDataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double Pdc; double Pload_dc = 0; double Pothers = 0; double Pcooling_device = 0; ComputingResource room = (ComputingResource) resource; /**************** IT PART ****************/ /*********** Pload_dc ***********/ Pload_dc = calculatePit(room); /**************** NON- IT PART ****************/ /*********** Pothers ***********/ Pothers = calculatePothers(Pload_dc); /************* COOLING PART *************/ Device coolingDevice = null; for(Device device: room.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.CoolingDevice)){ coolingDevice = device; break; } } /************ Pcooling_device ************/ double airTemp = EnvironmentConditions.ROOM_TEMPERATURE; double CoP = 0.0068 * Math.pow(airTemp, 2) + 0.0008 * airTemp + 0.458; // double Q= calculateQ(Pothers, room); Pcooling_device = coolingDevice.getPowerInterface().getRecentPowerUsage().getValue(); Pdc = Pload_dc + Pcooling_device+ Pothers; //System.out.println("---"); //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pcooling_device: " + Pcooling_device); return Pdc; } private double calculatePit(ComputingResource room){ double Pload_dc = 0; for(ComputingResource cr: room.getChildren()){ Rack rack = (Rack)cr; Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue(); } return Pload_dc; } private double calculatePothers(double Pload_dc){ double Pothers = 0; double a;//experiment try{ a = ConfigurationOptions.coolingData.getAlpha(); } catch (Exception e){ a = 0.02; } Pothers = a * Pload_dc; return Pothers; } private double calculateQ(double Pothers, ComputingResource room){ double Qdc = 0; /**************** HEAT ****************/ double Qload_dc = 0; double Qothers = 0; double delta_2; //DEBB - currently not present; delta_2 = 0.4; for(ComputingResource cr: room.getChildren()){ Rack rack = (Rack)cr; double QnodeGroup = 0; for(ComputingResource nodeGroup: rack.getChildren()){ double Qnodes = 0; for(ComputingResource node: nodeGroup.getChildren()){ double Qcpu = 0; Node n = (Node)node; for(Processor proc: n.getProcessors()){ Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); } Qnodes = node.getPowerInterface().getRecentPowerUsage().getValue() + Qcpu; } double Qfans = 0; for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ Fan fan = (Fan) device; if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ try { Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState()); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } }else Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); } QnodeGroup = QnodeGroup + Qnodes + Qfans; } int nrOfPoweredOffNodes = 0; for(Node node: rack.getNodes()){ if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ nrOfPoweredOffNodes++; } } if(nrOfPoweredOffNodes != rack.getNodes().size()){ Qload_dc = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; } else { Qload_dc = Qload_dc + QnodeGroup; } } Qothers = Pothers; Qdc = Qload_dc + Qothers; return Qdc; } }