package test.fips.models.i5; import schedframe.resources.StandardResourceType; import schedframe.resources.computing.ComputingResource; import schedframe.resources.computing.Rack; import schedframe.resources.computing.profiles.energy.ResourceEvent; 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 test.fips.EnvironmentConditions; public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { /*********** Pfans_dc ***********/ double powerConsumption = 0; double 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) powerConsumption = delta_p * Vair_total / nf; else { Device flowPump = (Device) resource; ComputingResource room = flowPump.getComputingResource(); double ro = 1.168;//constant double mair_total; //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.Fan)){ 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.Fan) && Integer.valueOf(device2.getName().split("_")[1]) == Integer.valueOf(device.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){ 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) powerConsumption = delta_p * Vair_total / nf; } //System.out.println("Flow Pump power: " + powerConsumption); //powerConsumption = 0; return powerConsumption; } public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double airflow = 0; double Vair_total; Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); if(Vair_total != -1) { airflow = Vair_total; } else { Device flowPump = (Device) resource; ComputingResource room = flowPump.getComputingResource(); 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.Fan)){ 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; airflow = Vair_total; } return airflow; } }