[1593] | 1 | package experiments.e2dc2015.models.arm; |
---|
| 2 | |
---|
| 3 | import schedframe.resources.StandardResourceType; |
---|
| 4 | import schedframe.resources.computing.ComputingResource; |
---|
| 5 | import schedframe.resources.computing.Rack; |
---|
| 6 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
| 7 | import schedframe.resources.devices.Device; |
---|
| 8 | import schedframe.resources.devices.Fan; |
---|
| 9 | import schedframe.resources.devices.PhysicalResource; |
---|
| 10 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 11 | import simulator.ConfigurationOptions; |
---|
| 12 | import example.energy.BaseEnergyEstimationPlugin; |
---|
| 13 | import experiments.e2dc2015.EnvironmentConditions; |
---|
| 14 | |
---|
| 15 | public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 16 | |
---|
| 17 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
| 18 | PhysicalResource resource) { |
---|
| 19 | |
---|
| 20 | double powerConsumption = 0; |
---|
| 21 | |
---|
| 22 | return powerConsumption; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
| 26 | double airflow = 0; |
---|
| 27 | double Vair_total; |
---|
| 28 | |
---|
| 29 | Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); |
---|
| 30 | if(Vair_total != -1) { |
---|
| 31 | airflow = Vair_total; |
---|
| 32 | } else { |
---|
| 33 | Device flowPump = (Device) resource; |
---|
| 34 | ComputingResource room = flowPump.getComputingResource(); |
---|
| 35 | |
---|
| 36 | double ro = 1.168;//constant |
---|
| 37 | |
---|
| 38 | double mair_total; |
---|
| 39 | double mair_rack = 0; |
---|
| 40 | |
---|
| 41 | for(ComputingResource cr: room.getChildren()){ |
---|
| 42 | Rack rack = (Rack)cr; |
---|
| 43 | for(ComputingResource nodeGroup: rack.getChildren()){ |
---|
| 44 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 45 | if(device.getType().equals(StandardResourceType.Fan)){ |
---|
| 46 | |
---|
| 47 | Fan fan = (Fan) device; |
---|
| 48 | double mair_recs = 0; |
---|
| 49 | double Vair_recs = 0; |
---|
| 50 | |
---|
| 51 | double Vair_recs1 = 0; |
---|
| 52 | |
---|
| 53 | Vair_recs1 = fan.getAirflowInterface().getRecentAirflow().getValue(); |
---|
| 54 | |
---|
| 55 | double Vair_recs2 = 0; |
---|
| 56 | for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 57 | if(device2.getType().equals(StandardResourceType.Fan) || Integer.valueOf(device2.getName().split("_")[1]) == Integer.valueOf(device.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){ |
---|
| 58 | |
---|
| 59 | Vair_recs2 = device2.getAirflowInterface().getRecentAirflow().getValue(); |
---|
| 60 | |
---|
| 61 | break; |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | Vair_recs = Math.max(Vair_recs1, Vair_recs2); |
---|
| 66 | |
---|
| 67 | mair_recs = Vair_recs * ro; |
---|
| 68 | mair_rack = mair_rack + mair_recs; |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | mair_total = mair_rack; |
---|
| 74 | Vair_total = mair_total / ro; |
---|
| 75 | airflow = Vair_total; |
---|
| 76 | } |
---|
| 77 | return airflow; |
---|
| 78 | } |
---|
| 79 | } |
---|