Ignore:
Timestamp:
01/07/13 14:52:39 (12 years ago)
Author:
wojtekp
Message:
 
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  
    55import schedframe.Parameters; 
    66import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 
     7import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 
    78 
    89public interface AirThroughputInterface { 
    910         
    10         public String getAirThroughputState(); 
     11        public AirThroughputStateName getAirThroughputState(); 
    1112         
    12         public boolean setAirThroughputState(String airThroughputState); 
     13        public boolean setAirThroughputState(AirThroughputStateName airThroughputState); 
    1314         
    14         public boolean supportAirThroughputState(String powerState); 
     15        public boolean supportAirThroughputState(AirThroughputStateName powerState); 
    1516         
    1617        public List<AirThroughputState> getSupportedAirThroughputStates() throws NoSuchFieldException; 
    1718         
    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; 
    1922         
    2023        public Parameters getParameters(); 
  • DCWoRMS/trunk/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirThroughputInterface.java

    r495 r754  
    1010import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 
    1111import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 
     12import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputStateName; 
     13import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 
    1214 
    13 public class DefaultAirThroughputInterface implements AirThroughputInterface{ 
     15public class ComputingResourceAirThroughputInterface implements AirThroughputInterface{ 
    1416 
    15         protected String currentAirThroughputState; 
     17        protected AirThroughputStateName currentAirThroughputState; 
    1618        protected AirThroughputProfile airThroughputProfile; 
    1719        protected ComputingResource resource; 
    1820         
    19         public DefaultAirThroughputInterface(ComputingResource resource, AirThroughputProfile airThroughputProfile){ 
     21        public ComputingResourceAirThroughputInterface(ComputingResource resource, AirThroughputProfile airThroughputProfile){ 
    2022                this.resource = resource; 
    2123                this.airThroughputProfile = airThroughputProfile; 
     24                this.currentAirThroughputState = StandardAirThroughputStateName.FAN_ON; 
    2225        } 
    2326         
    24         public String getAirThroughputState() { 
     27        public AirThroughputStateName getAirThroughputState() { 
    2528                return currentAirThroughputState; 
    2629        } 
    2730 
    28         public boolean setAirThroughputState(String state) { 
     31        public boolean setAirThroughputState(AirThroughputStateName state) { 
    2932                if(supportAirThroughputState(state)){ 
    3033                        currentAirThroughputState = state; 
     
    3235                        //TO DO - notifications should be called for all resources starting form the lowest layer 
    3336                        resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getName())); 
    34  
    3537                        return true; 
    3638                } 
     
    3840        } 
    3941 
    40         public boolean supportAirThroughputState(String state) { 
     42        public boolean supportAirThroughputState(AirThroughputStateName state) { 
    4143                for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    42                         if(airFlowState.getName().equals(state)){ 
     44                        if(airFlowState.getName().equals(state.getName())){ 
    4345                                return true; 
    4446                        } 
     
    5557        } 
    5658 
    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 { 
    5873                double powerConsumption = 0; 
    5974                if(supportAirThroughputState(state)){ 
    6075                        for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    61                                 if(airFlowState.getName().equals(state)){ 
     76                                if(airFlowState.getName().equals(state.getName())){ 
    6277                                        powerConsumption = airFlowState.getPowerUsage(); 
    6378                                        break; 
     
    6782                return powerConsumption; 
    6883        } 
    69  
     84         
    7085        public Parameters getParameters() { 
    7186                return airThroughputProfile.getParameters(); 
Note: See TracChangeset for help on using the changeset viewer.