source: DCWoRMS/branches/coolemall/src/experiments/simpat2014/models/basic/FlowPumpOutletEnergyEstimationPlugin.java @ 1500

Revision 1500, 2.5 KB checked in by wojtekp, 10 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package experiments.simpat2014.models.basic;
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 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(Node node: rack.getNodes()){
46                                        for(Device device: node.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: node.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}
Note: See TracBrowser for help on using the repository browser.