source: DCWoRMS/branches/coolemall/src/test/fips/models/i7/NodeGroupEnergyEstimationPlugin.java @ 1600

Revision 1600, 1.2 KB checked in by wojtekp, 8 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package test.fips.models.i7;
2
3import schedframe.resources.StandardResourceType;
4import schedframe.resources.computing.Node;
5import schedframe.resources.computing.coolemall.NodeGroup;
6import schedframe.resources.computing.profiles.energy.ResourceEvent;
7import schedframe.resources.devices.Device;
8import schedframe.resources.devices.Fan;
9import schedframe.resources.devices.PhysicalResource;
10import schedframe.scheduling.manager.tasks.JobRegistry;
11import example.energy.BaseEnergyEstimationPlugin;
12
13public class NodeGroupEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
14
15        public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
16                        PhysicalResource resource) {
17               
18                double powerConsumption = 0;
19                NodeGroup nodeGroup = (NodeGroup)resource;
20                for(Node node: nodeGroup.getNodes()){
21                        try{
22                                powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue();
23
24                        } catch (Exception e){
25                        }
26                }
27                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
28                        if(device.getType().equals(StandardResourceType.Fan)){
29                                Fan fan = (Fan) device;
30                                powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue();
31                        }
32                }
33                return powerConsumption;
34        }
35
36}
Note: See TracBrowser for help on using the repository browser.