[1500] | 1 | package experiments.simpat2014.models.recs; |
---|
[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; |
---|
| 16 | |
---|
| 17 | public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 18 | |
---|
| 19 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
| 20 | PhysicalResource resource) { |
---|
| 21 | |
---|
| 22 | double powerConsumption = 0; |
---|
| 23 | |
---|
| 24 | return powerConsumption; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
| 28 | double airflow = 0; |
---|
| 29 | double Vair_total; |
---|
| 30 | |
---|
| 31 | Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); |
---|
| 32 | if(Vair_total != -1) { |
---|
| 33 | airflow = Vair_total; |
---|
| 34 | } else { |
---|
| 35 | Device flowPump = (Device) resource; |
---|
| 36 | ComputingResource room = flowPump.getComputingResource(); |
---|
| 37 | |
---|
| 38 | double ro = 1.168;//constant |
---|
| 39 | |
---|
| 40 | double mair_total; |
---|
| 41 | double mair_rack = 0; |
---|
| 42 | |
---|
| 43 | for(ComputingResource cr: room.getChildren()){ |
---|
| 44 | Rack rack = (Rack)cr; |
---|
| 45 | for(ComputingResource nodeGroup: rack.getChildren()){ |
---|
| 46 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 47 | if(device.getType().equals(StandardResourceType.Outlet)){ |
---|
| 48 | |
---|
| 49 | Fan fan = (Fan) device; |
---|
| 50 | double mair_recs = 0; |
---|
| 51 | double Vair_recs = 0; |
---|
| 52 | |
---|
| 53 | double Vair_recs1 = 0; |
---|
| 54 | |
---|
| 55 | Vair_recs1 = fan.getAirflowInterface().getRecentAirflow().getValue(); |
---|
| 56 | |
---|
| 57 | double Vair_recs2 = 0; |
---|
| 58 | for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
| 59 | if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ |
---|
| 60 | |
---|
| 61 | Vair_recs2 = device2.getAirflowInterface().getRecentAirflow().getValue(); |
---|
| 62 | |
---|
| 63 | break; |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | Vair_recs = Math.max(Vair_recs1, Vair_recs2); |
---|
| 68 | |
---|
| 69 | mair_recs = Vair_recs * ro; |
---|
| 70 | mair_rack = mair_rack + mair_recs; |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | } |
---|
| 75 | mair_total = mair_rack; |
---|
| 76 | Vair_total = mair_total / ro; |
---|
| 77 | airflow = Vair_total; |
---|
| 78 | } |
---|
| 79 | return airflow; |
---|
| 80 | } |
---|
| 81 | } |
---|