Changeset 754 for DCWoRMS/trunk/src/schedframe/resources/computing
- Timestamp:
- 01/07/13 14:52:39 (12 years ago)
- Location:
- DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/airthroughput/ui
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java
r495 r754 5 5 import schedframe.Parameters; 6 6 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 7 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 7 8 8 9 public interface AirThroughputInterface { 9 10 10 public StringgetAirThroughputState();11 public AirThroughputStateName getAirThroughputState(); 11 12 12 public boolean setAirThroughputState( StringairThroughputState);13 public boolean setAirThroughputState(AirThroughputStateName airThroughputState); 13 14 14 public boolean supportAirThroughputState( StringpowerState);15 public boolean supportAirThroughputState(AirThroughputStateName powerState); 15 16 16 17 public List<AirThroughputState> getSupportedAirThroughputStates() throws NoSuchFieldException; 17 18 18 public double getPowerConsumption(String state) throws NoSuchFieldException; 19 public double getAirFlow(AirThroughputStateName state) throws NoSuchFieldException; 20 21 public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException; 19 22 20 23 public Parameters getParameters(); -
DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirThroughputInterface.java
r495 r754 10 10 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 11 11 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 12 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 13 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 12 14 13 public class DefaultAirThroughputInterface implements AirThroughputInterface{15 public class ComputingResourceAirThroughputInterface implements AirThroughputInterface{ 14 16 15 protected StringcurrentAirThroughputState;17 protected AirThroughputStateName currentAirThroughputState; 16 18 protected AirThroughputProfile airThroughputProfile; 17 19 protected ComputingResource resource; 18 20 19 public DefaultAirThroughputInterface(ComputingResource resource, AirThroughputProfile airThroughputProfile){21 public ComputingResourceAirThroughputInterface(ComputingResource resource, AirThroughputProfile airThroughputProfile){ 20 22 this.resource = resource; 21 23 this.airThroughputProfile = airThroughputProfile; 24 this.currentAirThroughputState = StandardAirThroughputStateName.FAN_ON; 22 25 } 23 26 24 public StringgetAirThroughputState() {27 public AirThroughputStateName getAirThroughputState() { 25 28 return currentAirThroughputState; 26 29 } 27 30 28 public boolean setAirThroughputState( Stringstate) {31 public boolean setAirThroughputState(AirThroughputStateName state) { 29 32 if(supportAirThroughputState(state)){ 30 33 currentAirThroughputState = state; … … 32 35 //TO DO - notifications should be called for all resources starting form the lowest layer 33 36 resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getName())); 34 35 37 return true; 36 38 } … … 38 40 } 39 41 40 public boolean supportAirThroughputState( Stringstate) {42 public boolean supportAirThroughputState(AirThroughputStateName state) { 41 43 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 42 if(airFlowState.getName().equals(state )){44 if(airFlowState.getName().equals(state.getName())){ 43 45 return true; 44 46 } … … 55 57 } 56 58 57 public double getPowerConsumption(String state) throws NoSuchFieldException { 59 public double getAirFlow(AirThroughputStateName state) throws NoSuchFieldException { 60 double airThroughput = 0; 61 if(supportAirThroughputState(state)){ 62 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 63 if(airFlowState.getName().equals(state.getName())){ 64 airThroughput = airFlowState.getValue(); 65 break; 66 } 67 } 68 } 69 return airThroughput; 70 } 71 72 public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException { 58 73 double powerConsumption = 0; 59 74 if(supportAirThroughputState(state)){ 60 75 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 61 if(airFlowState.getName().equals(state )){76 if(airFlowState.getName().equals(state.getName())){ 62 77 powerConsumption = airFlowState.getPowerUsage(); 63 78 break; … … 67 82 return powerConsumption; 68 83 } 69 84 70 85 public Parameters getParameters() { 71 86 return airThroughputProfile.getParameters();
Note: See TracChangeset
for help on using the changeset viewer.