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 FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { double 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.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; airflow = Vair_total; } return airflow; } }