source: DCWoRMS/branches/coolemall/src/experiments/simpat2014/models/recs/FlowPumpInletEnergyEstimationPlugin.java @ 1500

Revision 1500, 4.3 KB checked in by wojtekp, 10 years ago (diff)
RevLine 
[1500]1package experiments.simpat2014.models.recs;
[1469]2
3import schedframe.resources.StandardResourceType;
4import schedframe.resources.computing.ComputingResource;
5import schedframe.resources.computing.Node;
6import schedframe.resources.computing.Rack;
7import schedframe.resources.computing.coolemall.ComputeBox1;
8import schedframe.resources.computing.coolemall.NodeGroup;
9import schedframe.resources.computing.profiles.energy.ResourceEvent;
10import schedframe.resources.devices.Device;
11import schedframe.resources.devices.Fan;
12import schedframe.resources.devices.PhysicalResource;
13import schedframe.scheduling.manager.tasks.JobRegistry;
14import simulator.ConfigurationOptions;
15import example.energy.BaseEnergyEstimationPlugin;
16
17public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
18
19        public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
20                        PhysicalResource resource) {
21               
22                /*********** Pfans_dc ***********/
23                double powerConsumption = 0;
24                double nf = 0.6;
25               
26                double delta_p;//from database, CFD
27                double Vair_total;
28               
29                delta_p = ConfigurationOptions.coolingData.getPressureDrop();
30                Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
31               
32                if(delta_p != -1 && Vair_total != -1)
33                        powerConsumption = delta_p * Vair_total / nf;
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                       
42                        //in case of DCworms calculation of Vair_total
43                        double mair_rack = 0;
44
45                        for(ComputingResource cr: room.getChildren()){
46                                Rack rack = (Rack)cr;
47                                for(ComputingResource nodeGroup: rack.getChildren()){
48                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
49                                                if(device.getType().equals(StandardResourceType.Outlet)){
50                                                       
51                                                        Fan fan = (Fan) device;
52                                                        double mair_recs = 0;
53                                                        double Vair_recs = 0;
54                                                       
55                                                        double Vair_recs1 = 0;
56
57                                                        Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
58
59                                                        double Vair_recs2 = 0;
60                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
61                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
62
63                                                                        Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
64
65                                                                        break;
66                                                                }
67                                                        }       
68
69                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
70
71                                                        mair_recs = Vair_recs * ro;
72                                                        mair_rack  = mair_rack + mair_recs;
73                                                }
74                                        }
75                                }
76                        }
77                        mair_total = mair_rack;
78                        Vair_total = mair_total / ro;
79                       
80
81                        if(delta_p != -1 && Vair_total != -1)
82                                powerConsumption = delta_p * Vair_total / nf;
83                }
84               
85                //System.out.println("Flow Pump power: " + powerConsumption);
86               
87                return powerConsumption;
88        }
89       
90        public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
91                double airflow = 0;
92                double Vair_total;
93               
94                Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
95                if(Vair_total != -1) {
96                        airflow = Vair_total;
97                } else {
98                        Device flowPump = (Device) resource;
99                        ComputingResource room = flowPump.getComputingResource();
100
101                        double ro = 1.168;//constant
102                       
103                        double mair_total;
104                        double mair_rack = 0;
105
106                        for(ComputingResource cr: room.getChildren()){
107                                Rack rack = (Rack)cr;
108                                for(ComputingResource nodeGroup: rack.getChildren()){
109                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
110                                                if(device.getType().equals(StandardResourceType.Outlet)){
111                                                       
112                                                        Fan fan = (Fan) device;
113                                                        double mair_recs = 0;
114                                                        double Vair_recs = 0;
115                                                       
116                                                        double Vair_recs1 = 0;
117
118                                                        Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
119
120                                                        double Vair_recs2 = 0;
121                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
122                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
123
124                                                                        Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
125
126                                                                        break;
127                                                                }
128                                                        }       
129
130                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
131
132                                                        mair_recs = Vair_recs * ro;
133                                                        mair_rack  = mair_rack + mair_recs;
134                                                }
135                                        }
136                                }
137                        }
138                        mair_total = mair_rack;
139                        Vair_total = mair_total / ro;
140                        airflow = Vair_total;
141                }
142                return airflow;
143        }
144       
145}
Note: See TracBrowser for help on using the repository browser.