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

Revision 1500, 2.6 KB checked in by wojtekp, 10 years ago (diff)
RevLine 
[1500]1package experiments.simpat2014.models.article;
[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;
[1500]16import experiments.simpat2014.EnvironmentConditions;
[1469]17
18public 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}
Note: See TracBrowser for help on using the repository browser.