- Timestamp:
- 11/26/13 11:56:07 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java
r1165 r1207 7 7 8 8 import schedframe.events.Event; 9 import schedframe.resources.computing.ComputingResource;10 9 import schedframe.resources.computing.extensions.Extension; 11 10 import schedframe.resources.computing.extensions.ExtensionException; … … 20 19 import schedframe.resources.computing.profiles.energy.thermal.ThermalProfile; 21 20 import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; 21 import schedframe.resources.devices.PhysicalResource; 22 22 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 23 import simulator.DataCenterWorkloadSimulator; 23 24 24 25 public class EnergyExtension implements Extension{ … … 35 36 protected ThermalProfile thermalProfile; 36 37 37 protected ComputingResource computingResource; 38 39 40 public EnergyExtension(ComputingResource computingResource, PowerInterface powerInterface, PowerProfile powerProfile) { 38 protected PhysicalResource resource; 39 40 41 /*public EnergyExtension(PhysicalResource resource, PowerInterface powerInterface, PowerProfile powerProfile) { 42 super(); 43 this.resource = resource; 41 44 this.powerProfile = powerProfile; 42 this.powerInterface = PowerInterfaceFactory.createPowerInterface( computingResource, powerProfile);43 } 44 45 public EnergyExtension( ComputingResource computingResource, PowerProfile powerProfile,45 this.powerInterface = PowerInterfaceFactory.createPowerInterface(resource, powerProfile); 46 } 47 48 public EnergyExtension(PhysicalResource resource, PowerProfile powerProfile, 46 49 AirThroughputProfile airFlowProfile) { 47 50 super(); 48 this. computingResource = computingResource;51 this.resource = resource; 49 52 this.powerProfile = powerProfile; 50 this.powerInterface = PowerInterfaceFactory.createPowerInterface( computingResource, powerProfile);53 this.powerInterface = PowerInterfaceFactory.createPowerInterface(resource, powerProfile); 51 54 this.airFlowProfile = airFlowProfile; 52 this.airFlowInterface = AirThroughputInterfaceFactory.createAirThroughputInterface( computingResource, airFlowProfile);53 } 54 55 public EnergyExtension( ComputingResource computingResource, PowerProfile powerProfile,55 this.airFlowInterface = AirThroughputInterfaceFactory.createAirThroughputInterface(resource, airFlowProfile); 56 } 57 58 public EnergyExtension(PhysicalResource resource, PowerProfile powerProfile, 56 59 AirThroughputProfile airFlowProfile, ThermalProfile thermalProfile) { 57 60 super(); 58 this. computingResource = computingResource;61 this.resource = resource; 59 62 this.powerProfile = powerProfile; 60 this.powerInterface = PowerInterfaceFactory.createPowerInterface( computingResource, powerProfile);63 this.powerInterface = PowerInterfaceFactory.createPowerInterface(resource, powerProfile); 61 64 this.airFlowProfile = airFlowProfile; 62 this.airFlowInterface = AirThroughputInterfaceFactory.createAirThroughputInterface( computingResource, airFlowProfile);65 this.airFlowInterface = AirThroughputInterfaceFactory.createAirThroughputInterface(resource, airFlowProfile); 63 66 this.thermalProfile = thermalProfile; 64 this.thermalInterface = ThermalInterfaceFactory.createThermalInterface(computingResource, thermalProfile); 65 } 66 67 this.thermalInterface = ThermalInterfaceFactory.createThermalInterface(resource, thermalProfile); 68 }*/ 69 70 public static class Builder { 71 72 protected PhysicalResource resource; 73 protected PowerInterface powerInterface; 74 protected PowerProfile powerProfile; 75 76 protected AirThroughputInterface airFlowInterface; 77 protected AirThroughputProfile airFlowProfile; 78 79 protected ThermalInterface thermalInterface; 80 protected ThermalProfile thermalProfile; 81 82 public Builder resource(PhysicalResource res) {this.resource = res; return this;} 83 84 public Builder powerProfile(PowerProfile pp){this.powerProfile = pp; this.powerInterface = PowerInterfaceFactory.createPowerInterface(resource, powerProfile); return this; } 85 86 public Builder airFlowProfile(AirThroughputProfile atp){this.airFlowProfile = atp; this.airFlowInterface = AirThroughputInterfaceFactory.createAirThroughputInterface(resource, airFlowProfile); return this; } 87 88 public Builder thermalProfile(ThermalProfile tp){this.thermalProfile = tp; this.thermalInterface = ThermalInterfaceFactory.createThermalInterface(resource, thermalProfile); return this; } 89 90 public EnergyExtension build() { 91 return new EnergyExtension(this); 92 } 93 } 94 95 private EnergyExtension(Builder builder) { 96 this.resource = builder.resource; 97 this.powerInterface = builder.powerInterface; 98 this.powerProfile = builder.powerProfile; 99 100 this.airFlowInterface = builder.airFlowInterface ; 101 this.airFlowProfile = builder.airFlowProfile; 102 103 this.thermalInterface = builder.thermalInterface; 104 this.thermalProfile = builder.thermalProfile; 105 } 106 107 67 108 public boolean supportsEvent(Event event) { 68 109 … … 82 123 if(event.getType().getName().equals(EnergyEventType.AIRFLOW_STATE_CHANGED.getName())) 83 124 return true; 125 if(event.getType().getName().equals(EnergyEventType.TEMPERATURE_CHANGED.getName())) 126 return true; 84 127 85 128 else return false; … … 90 133 EnergyEvent enEvent = (EnergyEvent)event; 91 134 double power = 0; 92 double temperature = 0;135 boolean status = false; 93 136 try{ 94 137 switch (enEvent.getType()) { 95 138 96 139 case POWER_STATE_CHANGED: 97 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl( computingResource.getName()), computingResource);140 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 98 141 /*if(computingResource instanceof ComputingNode){ 99 142 ComputingNode node = (ComputingNode)computingResource; … … 109 152 } 110 153 } 111 else*/ powerProfile.addToPowerUsageHistory(power);112 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource);113 thermalProfile.addToTemperatureHistory(temperature);154 else*/ 155 156 status = powerProfile.addToPowerUsageHistory(power); 114 157 break; 115 158 116 159 case FREQUENCY_CHANGED: 117 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 118 powerProfile.addToPowerUsageHistory(power); 119 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 120 thermalProfile.addToTemperatureHistory(temperature); 160 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 161 status = powerProfile.addToPowerUsageHistory(power); 121 162 break; 122 163 123 164 case TASK_STARTED: 124 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 125 powerProfile.addToPowerUsageHistory(power); 126 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 127 thermalProfile.addToTemperatureHistory(temperature); 165 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 166 status = powerProfile.addToPowerUsageHistory(power); 128 167 break; 129 168 130 169 case TASK_FINISHED: 131 //System.out.println(this.resource.getName() + " - ENERGY EXTENSION: TASK FINISHED"); 132 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 133 //System.out.println(this.resource.getName() + " - ESTIMATED ENERGY:" + power); 134 powerProfile.addToPowerUsageHistory(power); 135 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 136 thermalProfile.addToTemperatureHistory(temperature); 170 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 171 status = powerProfile.addToPowerUsageHistory(power); 137 172 break; 138 173 139 174 case RESOURCE_UTILIZATION_CHANGED: 140 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 141 powerProfile.addToPowerUsageHistory(power); 142 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 143 thermalProfile.addToTemperatureHistory(temperature); 175 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 176 status = powerProfile.addToPowerUsageHistory(power); 144 177 break; 145 178 146 179 case AIRFLOW_STATE_CHANGED: 147 double airFlow = powerProfile.getEnergyEstimationPlugin().estimateAirThroughput(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 148 airFlowProfile.addToPowerUsageHistory(airFlow); 149 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 150 powerProfile.addToPowerUsageHistory(power); 151 temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 180 double airFlow = powerProfile.getEnergyEstimationPlugin().estimateAirThroughput(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 181 airFlowProfile.addToAirFlowHistory(airFlow); 182 break; 183 184 case TEMPERATURE_CHANGED: 185 double temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(resource.getFullName()), resource); 152 186 thermalProfile.addToTemperatureHistory(temperature); 153 187 break; … … 156 190 157 191 } 192 if(status){ 193 DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(EnergyEventType.TEMPERATURE_CHANGED, resource.getFullName())); 194 } 158 195 } 159 196 -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputInterfaceFactory.java
r753 r1207 1 1 package schedframe.resources.computing.profiles.energy.airthroughput; 2 2 3 import schedframe.resources.StandardResourceType; 3 4 import schedframe.resources.computing.ComputingResource; 4 5 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 5 6 import schedframe.resources.computing.profiles.energy.airthroughput.ui.ComputingResourceAirThroughputInterface; 7 import schedframe.resources.devices.PhysicalResource; 8 import schedframe.resources.devices.PhysicalResourceAirThroughputInterface; 9 import schedframe.resources.devices.coolemall.FanAirThroughputInterface; 6 10 7 11 public class AirThroughputInterfaceFactory { 8 12 9 public static AirThroughputInterface createAirThroughputInterface( ComputingResource resource, AirThroughputProfile atp){13 public static AirThroughputInterface createAirThroughputInterface(PhysicalResource resource, AirThroughputProfile atp){ 10 14 if(atp == null) 11 15 return null; 12 AirThroughputInterface airThroughputInterface = new ComputingResourceAirThroughputInterface(resource, atp); 13 16 AirThroughputInterface airThroughputInterface = null; 17 if(resource.getType().getName().equals(StandardResourceType.CRAH.getName())) 18 airThroughputInterface = new PhysicalResourceAirThroughputInterface(resource, atp); 19 else if(resource.getType().getName().equals(StandardResourceType.Fan.getName())) 20 airThroughputInterface = new FanAirThroughputInterface(resource, atp); 21 else if(resource.getType().getName().equals(StandardResourceType.Inlet.getName())) 22 airThroughputInterface = new FanAirThroughputInterface(resource, atp); 23 else if(resource.getType().getName().equals(StandardResourceType.Outlet.getName())) 24 airThroughputInterface = new FanAirThroughputInterface(resource, atp); 25 else if(resource.getType().getName().equals(StandardResourceType.CoolingDevice.getName())) 26 airThroughputInterface = new PhysicalResourceAirThroughputInterface(resource, atp); 27 else 28 airThroughputInterface = new ComputingResourceAirThroughputInterface((ComputingResource)resource, atp); 14 29 return airThroughputInterface; 15 30 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java
r495 r1207 28 28 } 29 29 30 public void addTo PowerUsageHistory(double airFlow) {30 public void addToAirFlowHistory(double airFlow) { 31 31 32 32 if (airFlowHistory.size() == 0) { -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/StandardAirThroughputStateName.java
r753 r1207 3 3 public enum StandardAirThroughputStateName implements AirThroughputStateName{ 4 4 5 FAN_ON,6 FAN_OFF;5 ON, 6 OFF; 7 7 8 8 public String getName() { -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java
r754 r1207 4 4 5 5 import schedframe.Parameters; 6 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 6 7 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 7 8 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; … … 9 10 public interface AirThroughputInterface { 10 11 11 public AirThroughputStateName 12 public AirThroughputStateName getAirThroughputState(); 12 13 13 14 public boolean setAirThroughputState(AirThroughputStateName airThroughputState); … … 21 22 public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException; 22 23 24 public AirFlowValue getRecentAirFlow(); 25 26 List<AirFlowValue> getAirFlowHistory(); 27 23 28 public Parameters getParameters(); 29 30 24 31 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirThroughputInterface.java
r754 r1207 4 4 import java.util.List; 5 5 6 import org.joda.time.DateTimeUtils; 7 6 8 import schedframe.Parameters; 7 9 import schedframe.resources.computing.ComputingResource; 8 10 import schedframe.resources.computing.profiles.energy.EnergyEvent; 9 11 import schedframe.resources.computing.profiles.energy.EnergyEventType; 12 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 10 13 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 11 14 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; … … 22 25 this.resource = resource; 23 26 this.airThroughputProfile = airThroughputProfile; 24 this.currentAirThroughputState = StandardAirThroughputStateName. FAN_ON;27 this.currentAirThroughputState = StandardAirThroughputStateName.ON; 25 28 } 26 29 … … 34 37 35 38 //TO DO - notifications should be called for all resources starting form the lowest layer 36 resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getName())); 39 resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getFullName())); 40 resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName())); 37 41 return true; 38 42 } … … 83 87 } 84 88 89 public AirFlowValue getRecentAirFlow() { 90 AirFlowValue airFlow = null; 91 int lastIdx = getAirFlowHistory().size() - 1; 92 if(lastIdx >= 0) 93 airFlow = getAirFlowHistory().get(lastIdx); 94 else { 95 try { 96 airFlow = new AirFlowValue(DateTimeUtils.currentTimeMillis(), getAirFlow(currentAirThroughputState)); 97 } catch (NoSuchFieldException e) { 98 } 99 } 100 return airFlow; 101 } 102 103 public List<AirFlowValue> getAirFlowHistory(){ 104 return airThroughputProfile.getAirThroughputHistory(); 105 } 106 107 85 108 public Parameters getParameters() { 86 109 return airThroughputProfile.getParameters(); -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/PState.java
r1119 r1207 1 1 package schedframe.resources.computing.profiles.energy.power; 2 3 import java.util.Map; 4 import java.util.TreeMap; 2 5 3 6 public class PState { … … 9 12 protected double powerUsageMin; 10 13 protected double powerUsageMax; 11 14 //protected List<LoadPowerUsage> loadPowerUsageList; 15 protected Map<Double, Double> loadPowerUsage; 16 12 17 /*public PState(PStateType name, double frequency, double voltage, double power) { 13 18 super(); … … 38 43 return powerUsageMax; 39 44 } 40 45 /*public List<LoadPowerUsage> getLoadPowerUsageList() { 46 return loadPowerUsageList; 47 }*/ 48 public Map<Double, Double> getLoadPowerUsage() { 49 if(loadPowerUsage == null) { 50 return new TreeMap<Double, Double>(); 51 } 52 return loadPowerUsage; 53 } 54 41 55 public static class Builder { 42 56 … … 47 61 protected double powerUsageMin; 48 62 protected double powerUsageMax; 63 //protected List<LoadPowerUsage> loadPowerUsageList = new ArrayList<LoadPowerUsage>(); 64 protected Map<Double, Double> loadPowerUsage = new TreeMap<Double, Double>(); 49 65 50 66 public Builder name(String name){this.name = name; return this; } … … 54 70 public Builder powerUsageMin(double rate){this.powerUsageMin = rate; return this; } 55 71 public Builder powerUsageMax(double rate){this.powerUsageMax = rate; return this; } 72 //public Builder loadPowerUsage(LoadPowerUsage lpu){this.loadPowerUsageList.add(lpu); return this; } 73 public Builder loadPowerUsage(double load, double power){this.loadPowerUsage.put(load, power); return this; } 56 74 57 75 public PState build() { … … 67 85 this.powerUsageMin = builder.powerUsageMin; 68 86 this.powerUsageMax = builder.powerUsageMax; 87 //this.loadPowerUsageList = builder.loadPowerUsageList; 88 this.loadPowerUsage = builder.loadPowerUsage; 69 89 } 90 91 70 92 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/PowerInterfaceFactory.java
r1104 r1207 1 1 package schedframe.resources.computing.profiles.energy.power; 2 2 3 import schedframe.resources.CoolEmAllResourceType;4 3 import schedframe.resources.StandardResourceType; 5 4 import schedframe.resources.computing.ComputingResource; 6 5 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 6 import schedframe.resources.devices.PhysicalResource; 7 import schedframe.resources.devices.PhysicalResourcePowerInterface; 7 8 8 9 public class PowerInterfaceFactory { 9 10 10 11 12 //new113 /*public static PowerInterface createPowerProfile(ResourceType resourceType, List<PowerState> powerStates, List<PState> pStates, String eepn){14 15 PowerInterface powerProfile;16 17 switch(resourceType){18 case DataCenter: powerProfile = new DataCenterPowerInterfaceNew(eepn, powerStates); break;19 case ComputingNode: powerProfile = new ComputingNodePowerInterfaceNew(eepn, powerStates); break;20 case Processor: powerProfile = new CPUPowerInterfaceNew(eepn, powerStates, pStates); break;21 default:22 throw new IllegalArgumentException("ResourceType " + resourceType + " is not supported.");23 }24 25 return powerProfile;26 }*/27 11 28 public static PowerInterface createPowerInterface( ComputingResource resource, PowerProfile pp){12 public static PowerInterface createPowerInterface(PhysicalResource resource, PowerProfile pp){ 29 13 if(pp == null) 30 14 return null; 31 15 PowerInterface powerInterface; 32 16 33 17 if(resource.getType().getName().equals(StandardResourceType.DataCenter.getName())) 34 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.DataCenterPowerInterface( resource, pp);35 else if (resource.getType().getName().equals(StandardResourceType. ComputingNode.getName()))36 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface( resource, pp);18 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.DataCenterPowerInterface((ComputingResource)resource, pp); 19 else if (resource.getType().getName().equals(StandardResourceType.Node.getName())) 20 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface((ComputingResource)resource, pp); 37 21 else if (resource.getType().getName().equals(StandardResourceType.Processor.getName())) 38 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface(resource, pp); 39 else if (resource.getType().getName().equals(CoolEmAllResourceType.Node.getName())) 40 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface(resource, pp); 22 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface((ComputingResource)resource, pp); 23 else if (resource.getType().getName().equals(StandardResourceType.CRAH.getName())) 24 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 25 else if (resource.getType().getName().equals(StandardResourceType.Fan.getName())) 26 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 27 else if (resource.getType().getName().equals(StandardResourceType.Inlet.getName())) 28 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 29 else if (resource.getType().getName().equals(StandardResourceType.Outlet.getName())) 30 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 31 else if (resource.getType().getName().equals(StandardResourceType.CoolingDevice.getName())) 32 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 33 else if (resource.getType().getName().equals(StandardResourceType.Heatsink.getName())) 34 powerInterface = new PhysicalResourcePowerInterface(resource, pp); 41 35 else 42 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingResourcePowerInterface( resource, pp);36 powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingResourcePowerInterface((ComputingResource)resource, pp); 43 37 44 38 /*switch(resource.getType()){ -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/PowerProfile.java
r1167 r1207 24 24 public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates) { 25 25 this.energyEstimationPlugin = energyEstimationPlugin; 26 this.supportedPowerStates = powerStates; 26 27 this.powerUsage = new ArrayList<PowerUsage>(); 27 this.supportedPowerStates = powerStates;28 initDefaultPowerStates(); 28 29 } 29 30 30 public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates, 31 public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates, List<PState> pStates) { 31 32 this.energyEstimationPlugin = energyEstimationPlugin; 32 33 this.supportedPowerStates = powerStates; … … 37 38 supportedPStates.put(pState.getName(), pState); 38 39 } 40 initDefaultPowerStates(); 39 41 } 40 42 … … 60 62 } 61 63 62 public List<PowerState> getSupportedPowerStates() throws NoSuchFieldException{64 public List<PowerState> getSupportedPowerStates() { 63 65 if(supportedPowerStates == null) 64 throw new NoSuchFieldException("Supported power states are not defined.");66 return new ArrayList<PowerState>(); 65 67 return supportedPowerStates; 66 68 } … … 111 113 } 112 114 113 115 protected void initDefaultPowerStates(){ 116 boolean supportsON = false; 117 boolean supportsOFF = false; 118 if(supportedPowerStates == null){ 119 supportedPowerStates = new ArrayList<PowerState>(); 120 } 121 for(PowerState ps: supportedPowerStates){ 122 if(ps.getName().equals(StandardPowerStateName.ON)){ 123 supportsON = true; 124 } else if (ps.getName().equals(StandardPowerStateName.OFF)){ 125 supportsOFF = true; 126 } 127 } 128 129 if(!supportsON){ 130 supportedPowerStates.add(new PowerState(StandardPowerStateName.ON, -1, new ArrayList<Transition>())); 131 } 132 if(!supportsOFF){ 133 supportedPowerStates.add(new PowerState(StandardPowerStateName.OFF, -1, new ArrayList<Transition>())); 134 } 135 } 114 136 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java
r477 r1207 2 2 3 3 import schedframe.Plugin; 4 import schedframe.resources.computing.ComputingResource;5 4 import schedframe.resources.computing.profiles.energy.EnergyEvent; 5 import schedframe.resources.devices.PhysicalResource; 6 6 import schedframe.scheduling.manager.tasks.JobRegistry; 7 7 8 8 public interface EnergyEstimationPlugin extends Plugin { 9 9 10 public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);10 public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource); 11 11 12 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);12 public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource); 13 13 14 public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);14 public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource); 15 15 16 16 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingNodePowerInterface.java
r1166 r1207 1 1 package schedframe.resources.computing.profiles.energy.power.ui; 2 2 3 4 5 import org.joda.time.DateTime; 6 7 import schedframe.SimulatedEnvironment; 3 8 import schedframe.resources.ResourceStatus; 4 9 import schedframe.resources.computing.ComputingNode; … … 38 43 39 44 if(!pePowerStateChangeStatus){ 40 computingNode.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.get Name()));45 computingNode.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getFullName())); 41 46 } 42 47 … … 48 53 } 49 54 //computingNode.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getName())); 55 //ResourceController.traceResource(new DateTime().getMillis(), resource.getFullName(), "POWER_STATE_CHANGED", state.getName()); 50 56 return true; 51 57 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java
r579 r1207 4 4 import java.util.List; 5 5 6 import org.joda.time.DateTime; 6 7 import org.joda.time.DateTimeUtils; 7 8 8 9 import schedframe.Parameters; 10 import schedframe.SimulatedEnvironment; 9 11 import schedframe.resources.ResourceStatus; 10 12 import schedframe.resources.computing.ComputingResource; … … 46 48 } 47 49 //notifications from all levels 48 resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.get Name()));50 resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName())); 49 51 50 52 //notification from last level 51 53 //if (resource.getChildren() == null) resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource)); 52 54 55 //ResourceController.traceResource(new DateTime().getMillis(), resource.getFullName(), "POWER_STATE_CHANGED", state.getName()); 53 56 return true; 54 57 } … … 70 73 71 74 public boolean supportPowerState(PowerStateName state) { 72 try { 73 for(PowerState powerState: powerProfile.getSupportedPowerStates()){ 74 if(powerState.getName().equals(state)){ 75 return true; 76 } 75 for(PowerState powerState: powerProfile.getSupportedPowerStates()){ 76 if(powerState.getName().equals(state)){ 77 return true; 77 78 } 78 } catch (NoSuchFieldException e) {79 return false;80 79 } 81 80 return false; -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/DataCenterPowerInterface.java
r495 r1207 1 1 package schedframe.resources.computing.profiles.energy.power.ui; 2 2 3 import org.joda.time.DateTime; 4 5 import schedframe.SimulatedEnvironment; 3 6 import schedframe.resources.computing.ComputingResource; 4 7 import schedframe.resources.computing.DataCenter; … … 23 26 child.getPowerInterface().setPowerState(state); 24 27 } 25 28 //ResourceController.traceResource(new DateTime().getMillis(), resource.getFullName(), "POWER_STATE_CHANGED", state.getName()); 26 29 return true; 27 30 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java
r782 r1207 4 4 import java.util.Map; 5 5 6 import org.joda.time.DateTime; 7 8 import schedframe.SimulatedEnvironment; 6 9 import schedframe.resources.ResourceStatus; 7 10 import schedframe.resources.computing.ComputingResource; … … 16 19 17 20 protected PState currentPState; 18 19 21 20 22 public ProcessorPowerInterface(ComputingResource resource, PowerProfile pp){ … … 34 36 resource.setStatus(ResourceStatus.FREE); 35 37 } 36 resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.get Name()));38 resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName())); 37 39 } 38 40 … … 68 70 //speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue()); 69 71 //new ResourceEventCommand(resource).execute(EnergyEventType.FREQUENCY_CHANGED); 70 resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.get Name()));72 resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.getFullName())); 71 73 //resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, resource.getName()); 74 75 //ResourceController.traceResource(new DateTime().getMillis(), resource.getFullName(), "PSTATE_CHANGED", pStateName); 72 76 return true; 73 77 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/thermal/ThermalInterfaceFactory.java
r803 r1207 1 1 package schedframe.resources.computing.profiles.energy.thermal; 2 2 3 import schedframe.resources.StandardResourceType; 3 4 import schedframe.resources.computing.ComputingResource; 4 5 import schedframe.resources.computing.profiles.energy.thermal.ui.ComputingResourceThermalInterface; 5 6 import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; 7 import schedframe.resources.devices.PhysicalResource; 8 import schedframe.resources.devices.PhysicalResourceThermalInterface; 6 9 7 10 public class ThermalInterfaceFactory { 8 public static ThermalInterface createThermalInterface( ComputingResource resource, ThermalProfile tp){11 public static ThermalInterface createThermalInterface(PhysicalResource resource, ThermalProfile tp){ 9 12 if(tp == null) 10 13 return null; 11 ThermalInterface thermalInterface = new ComputingResourceThermalInterface(resource, tp); 12 14 ThermalInterface thermalInterface; 15 if (resource.getType().getName().equals(StandardResourceType.CRAH.getName())) 16 thermalInterface = new PhysicalResourceThermalInterface(resource, tp); 17 else if (resource.getType().getName().equals(StandardResourceType.Fan.getName())) 18 thermalInterface = new PhysicalResourceThermalInterface(resource, tp); 19 else 20 thermalInterface = new ComputingResourceThermalInterface((ComputingResource)resource, tp); 13 21 return thermalInterface; 14 22 }
Note: See TracChangeset
for help on using the changeset viewer.