1 | package test.fips.models.i5; |
---|
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 test.fips.EnvironmentConditions; |
---|
14 | |
---|
15 | public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
16 | |
---|
17 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
18 | PhysicalResource resource) { |
---|
19 | |
---|
20 | /*********** Pfans_dc ***********/ |
---|
21 | double powerConsumption = 0; |
---|
22 | double nf = 0.6; |
---|
23 | |
---|
24 | double delta_p;//from database, CFD |
---|
25 | double Vair_total; |
---|
26 | |
---|
27 | delta_p = ConfigurationOptions.coolingData.getPressureDrop(); |
---|
28 | Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); |
---|
29 | |
---|
30 | if(delta_p != -1 && Vair_total != -1) |
---|
31 | powerConsumption = delta_p * Vair_total / nf; |
---|
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 | |
---|
40 | //in case of DCworms calculation of Vair_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.Fan)){ |
---|
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.Fan) && Integer.valueOf(device2.getName().split("_")[1]) == Integer.valueOf(device.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){ |
---|
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 | |
---|
78 | |
---|
79 | if(delta_p != -1 && Vair_total != -1) |
---|
80 | powerConsumption = delta_p * Vair_total / nf; |
---|
81 | } |
---|
82 | |
---|
83 | //System.out.println("Flow Pump power: " + powerConsumption); |
---|
84 | //powerConsumption = 0; |
---|
85 | return powerConsumption; |
---|
86 | } |
---|
87 | |
---|
88 | public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
89 | double airflow = 0; |
---|
90 | double Vair_total; |
---|
91 | |
---|
92 | Vair_total = ConfigurationOptions.coolingData.getAirflowVolume(); |
---|
93 | if(Vair_total != -1) { |
---|
94 | airflow = Vair_total; |
---|
95 | } else { |
---|
96 | Device flowPump = (Device) resource; |
---|
97 | ComputingResource room = flowPump.getComputingResource(); |
---|
98 | |
---|
99 | double ro = 1.168;//constant |
---|
100 | |
---|
101 | double mair_total; |
---|
102 | double mair_rack = 0; |
---|
103 | |
---|
104 | for(ComputingResource cr: room.getChildren()){ |
---|
105 | Rack rack = (Rack)cr; |
---|
106 | for(ComputingResource nodeGroup: rack.getChildren()){ |
---|
107 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
108 | if(device.getType().equals(StandardResourceType.Fan)){ |
---|
109 | |
---|
110 | Fan fan = (Fan) device; |
---|
111 | double mair_recs = 0; |
---|
112 | double Vair_recs = 0; |
---|
113 | |
---|
114 | double Vair_recs1 = 0; |
---|
115 | |
---|
116 | Vair_recs1 = fan.getAirflowInterface().getRecentAirflow().getValue(); |
---|
117 | |
---|
118 | double Vair_recs2 = 0; |
---|
119 | for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
120 | if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ |
---|
121 | |
---|
122 | Vair_recs2 = device2.getAirflowInterface().getRecentAirflow().getValue(); |
---|
123 | |
---|
124 | break; |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | Vair_recs = Math.max(Vair_recs1, Vair_recs2); |
---|
129 | |
---|
130 | mair_recs = Vair_recs * ro; |
---|
131 | mair_rack = mair_rack + mair_recs; |
---|
132 | } |
---|
133 | } |
---|
134 | } |
---|
135 | } |
---|
136 | mair_total = mair_rack; |
---|
137 | Vair_total = mair_total / ro; |
---|
138 | airflow = Vair_total; |
---|
139 | } |
---|
140 | return airflow; |
---|
141 | } |
---|
142 | |
---|
143 | } |
---|