package test.fips.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; public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double airflow = 0; return airflow; } public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double powerConsumption = 0; Device coolingDevice = (Device) resource; ComputingResource room = (ComputingResource) coolingDevice.getComputingResource(); double Pload_dc = calculatePit(room); double Pothers = calculatePothers(Pload_dc); double Pfans_dc = calculatePfans(room); double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room); double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room); double delta_Th_ex;//DEBB try{ delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue(); } catch (Exception e){ delta_Th_ex = 10; } double delta_Th_dry_cooler;//DEBB try{ delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); } catch (Exception e){ delta_Th_dry_cooler = 10; } double Tamb;//experiment try{ Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); } catch (Exception e){ Tamb = -1; } double Tr_out;//from database, CFD try{ Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); } catch (Exception e){ Tr_out = -1; } double Tr_in;//experiment try{ Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); } catch (Exception e){ Tr_in = -1; } double Tev = Tr_in - delta_Th_ex; //if data is not present in DB than don't take Pchiller into account if(Tr_in != -1 && Tr_out != -1) { if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb) powerConsumption = Pdry_cooler; else powerConsumption = Pchiller; } //System.out.println("CoolingDevice heat data: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc); //System.out.println("CoolingDevice power: " + powerConsumption); return powerConsumption; } 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.2; } Pothers = a * Pload_dc; return Pothers; } private double calculatePfans(ComputingResource room){ double Pfans_dc = 0; Device coolingDevice = null; for(Device device: room.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.CoolingDevice)){ coolingDevice = device; break; } } double nf;//DEBB try{ nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); } catch (Exception e){ nf = 0.6; } double delta_p;//from database, CFD double Vair_total; delta_p = ConfigurationOptions.coolingData.getPressureDrop(); Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); if(delta_p != -1 && Vair_total != -1) Pfans_dc = delta_p * Vair_total / nf; else { double ro = 1.168;//constant double mair_total; double mair_rack = 0; for(ComputingResource cr: room.getChildren()){ Rack rack = (Rack)cr; for(ComputingResource nodeGroup: rack.getChildren()){ for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.Outlet)){ Fan fan = (Fan) device; double mair_recs = 0; double Vair_recs = 0; double Vair_recs1 = 0; Vair_recs1 = fan.getAirflowInterface().getRecentAirflow().getValue(); double Vair_recs2 = 0; for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ Vair_recs2 = device2.getAirflowInterface().getRecentAirflow().getValue(); break; } } Vair_recs = Math.max(Vair_recs1, Vair_recs2); mair_recs = Vair_recs * ro; mair_rack = mair_rack + mair_recs; } } } } mair_total = mair_rack; Vair_total = mair_total / ro; if(delta_p != -1 && Vair_total != -1) Pfans_dc = delta_p * Vair_total / nf; } return Pfans_dc; } private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ double Pchiller = 0; Device coolingDevice = null; for(Device device: room.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.CoolingDevice)){ coolingDevice = device; break; } } double delta_Th_dry_cooler;//DEBB try{ delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); } catch (Exception e){ delta_Th_dry_cooler = 10; } double Tamb;//experiment try{ Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); } catch (Exception e){ Tamb = -1; } double ncc;//DEBB try{ ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue(); } catch (Exception e){ ncc = 0.95; } double Qcooling_rated;//DEBB try{ Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue(); } catch (Exception e){ Qcooling_rated = 80000; } double EERrated;//DEBB try{ EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue(); } catch (Exception e){ EERrated = 5; } double delta_Th_ex;//DEBB try{ delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue(); } catch (Exception e){ delta_Th_ex = 10; } double Tr_in;//experiment try{ Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); } catch (Exception e){ Tr_in = -1; } double Tev; double CoolT; double Qcooling_nom; double PLR; double delta_T; double CoolPR; double CoolPRrated; double CoolPRT; double CoolPRPLR; double EER; double Qdc = calculateQ(Pfans_dc, Pothers, room); double Qcooling = Qdc / ncc; Tev = Tr_in - delta_Th_ex; double Tevf = 32 + 1.8 * Tev; double Tco = Tamb + delta_Th_dry_cooler; double Tcof = 32 + 1.8 * Tco; 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; Qcooling_nom = Qcooling_rated * CoolT; PLR = Qcooling / Qcooling_nom; delta_T = Tcof - Tevf; CoolPRrated = 1 / EERrated; CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof; CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T; CoolPR = CoolPRrated * CoolPRT * CoolPRPLR; EER = 1/CoolPR; Pchiller = Qcooling/EER; return Pchiller; } private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ double Pdry_cooler = 0; Device coolingDevice = null; for(Device device: room.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.CoolingDevice)){ coolingDevice = device; break; } } double n_dry_cooler;//DEBB try{ n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue(); } catch (Exception e){ n_dry_cooler = 0.02; } double ncc;//DEBB try{ ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue(); } catch (Exception e){ ncc = 0.95; } double Qdc = calculateQ(Pfans_dc, Pothers, room); double Qcooling = Qdc / ncc; Pdry_cooler = n_dry_cooler * Qcooling; return Pdry_cooler; } private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){ double Qdc = 0; Device coolingDevice = null; for(Device device: room.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.CoolingDevice)){ coolingDevice = device; break; } } double nf;//DEBB try{ nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); } catch (Exception e){ nf = 0.6; } /**************** HEAT ****************/ double Qload_dc = 0; double Qothers = 0; double Qfans_dc = 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 = Qnodes + 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; Qfans_dc = (1 - nf) * Pfans_dc; Qdc = Qload_dc + Qothers + Qfans_dc; return Qdc; } private double calculateQ2(ComputingResource room){ double Qdc = 0; double mair_total; double Vair_total; double ro = 1.168;//constant Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); if(Vair_total != -1) { mair_total = Vair_total * ro; } else { //in case of DCworms calculation of Vair_total double mair_rack = 0; for(ComputingResource cr: room.getChildren()){ Rack rack = (Rack)cr; for(ComputingResource nodeGroup: rack.getChildren()){ for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ if(device.getType().equals(StandardResourceType.Outlet)){ Fan fan = (Fan) device; double mair_recs = 0; double Vair_recs = 0; double Vair_recs1 = 0; Vair_recs1 = fan.getAirflowInterface().getRecentAirflow().getValue(); double Vair_recs2 = 0; for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ Vair_recs2 = device2.getAirflowInterface().getRecentAirflow().getValue(); break; } } Vair_recs = Math.max(Vair_recs1, Vair_recs2); mair_recs = Vair_recs * ro; mair_rack = mair_rack + mair_recs; } } } } mair_total = mair_rack; } double Cp = 1004;//constant double Tr_out;//from database, CFD try{ Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); } catch (Exception e){ Tr_out = -1; } double Tr_in;//experiment try{ Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); } catch (Exception e){ Tr_in = -1; } Qdc = mair_total * Cp * (Tr_out - Tr_in); return Qdc; } }