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