Changeset 1396 for DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java
- Timestamp:
- 06/26/14 14:18:01 (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java
r1380 r1396 9 9 import schedframe.resources.computing.profiles.energy.EnergyEvent; 10 10 import schedframe.resources.computing.profiles.energy.EnergyEventType; 11 import schedframe.resources.computing.profiles.energy.airthroughput.Air FlowValue;12 import schedframe.resources.computing.profiles.energy.airthroughput.Air ThroughputProfile;13 import schedframe.resources.computing.profiles.energy.airthroughput.Air ThroughputState;14 import schedframe.resources.computing.profiles.energy.airthroughput.Air ThroughputStateName;15 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAir ThroughputStateName;16 import schedframe.resources.computing.profiles.energy.airthroughput.ui.Air ThroughputInterface;11 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue; 12 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 13 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState; 14 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName; 15 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName; 16 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface; 17 17 18 public class DeviceAir ThroughputInterface implements AirThroughputInterface{18 public class DeviceAirflowInterface implements AirflowInterface{ 19 19 20 protected Air ThroughputStateName currentAirThroughputState;21 protected Air ThroughputProfile airThroughputProfile;20 protected AirflowStateName currentAirflowState; 21 protected AirflowProfile airflowProfile; 22 22 protected PhysicalResource resource; 23 23 24 public DeviceAir ThroughputInterface(PhysicalResource resource, AirThroughputProfile airThroughputProfile){24 public DeviceAirflowInterface(PhysicalResource resource, AirflowProfile airflowProfile){ 25 25 this.resource = resource; 26 this.air ThroughputProfile = airThroughputProfile;27 this.currentAir ThroughputState = StandardAirThroughputStateName.ON;26 this.airflowProfile = airflowProfile; 27 this.currentAirflowState = StandardAirflowStateName.ON; 28 28 } 29 29 30 public Air ThroughputStateName getAirThroughputState() {31 return currentAir ThroughputState;30 public AirflowStateName getAirflowState() { 31 return currentAirflowState; 32 32 } 33 33 34 public boolean setAir ThroughputState(AirThroughputStateName state) {35 if(supportAir ThroughputState(state)){36 currentAir ThroughputState = state;34 public boolean setAirflowState(AirflowStateName state) { 35 if(supportAirflowState(state)){ 36 currentAirflowState = state; 37 37 38 38 //TO DO - notifications should be called for all resources starting form the lowest layer … … 44 44 } 45 45 46 public boolean supportAir ThroughputState(AirThroughputStateName state) {47 for(Air ThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){48 if(air FlowState.getName().equals(state.getName())){46 public boolean supportAirflowState(AirflowStateName state) { 47 for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 48 if(airflowState.getName().getLabel().equals(state.getLabel())){ 49 49 return true; 50 50 } … … 53 53 } 54 54 55 public List<Air ThroughputState> getSupportedAirThroughputStates(){56 List<Air ThroughputState> airThroughputStates = new ArrayList<AirThroughputState>();57 for(Air ThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){58 air ThroughputStates.add(airFlowState);55 public List<AirflowState> getSupportedAirflowStates(){ 56 List<AirflowState> airflowStates = new ArrayList<AirflowState>(); 57 for(AirflowState airFlowState: airflowProfile.getAirflowStates()){ 58 airflowStates.add(airFlowState); 59 59 } 60 return air ThroughputStates;60 return airflowStates; 61 61 } 62 62 63 public double getAir Flow(AirThroughputStateName state) throws NoSuchFieldException {64 double air Throughput= 0;65 if(supportAir ThroughputState(state)){66 for(Air ThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){67 if(air FlowState.getName().equals(state.getName())){68 air Throughput = airFlowState.getValue();63 public double getAirflow(AirflowStateName state) throws NoSuchFieldException { 64 double airflow = 0; 65 if(supportAirflowState(state)){ 66 for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 67 if(airflowState.getName().getLabel().equals(state.getLabel())){ 68 airflow = airflowState.getValue(); 69 69 break; 70 70 } 71 71 } 72 72 } 73 return air Throughput;73 return airflow; 74 74 } 75 75 76 public double getPowerConsumption(Air ThroughputStateName state) throws NoSuchFieldException {76 public double getPowerConsumption(AirflowStateName state) throws NoSuchFieldException { 77 77 double powerConsumption = 0; 78 if(supportAir ThroughputState(state)){79 for(Air ThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){80 if(air FlowState.getName().equals(state.getName())){81 powerConsumption = air FlowState.getPowerUsage();78 if(supportAirflowState(state)){ 79 for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 80 if(airflowState.getName().getLabel().equals(state.getLabel())){ 81 powerConsumption = airflowState.getPowerUsage(); 82 82 break; 83 83 } … … 87 87 } 88 88 89 public Air FlowValue getRecentAirFlow() {90 Air FlowValue airFlow = null;91 int lastIdx = getAir FlowHistory().size() - 1;89 public AirflowValue getRecentAirflow() { 90 AirflowValue airflow = null; 91 int lastIdx = getAirflowHistory().size() - 1; 92 92 if(lastIdx >= 0) 93 air Flow = getAirFlowHistory().get(lastIdx);93 airflow = getAirflowHistory().get(lastIdx); 94 94 else { 95 95 try { 96 air Flow = new AirFlowValue(DateTimeUtils.currentTimeMillis(), getAirFlow(currentAirThroughputState));96 airflow = new AirflowValue(DateTimeUtils.currentTimeMillis(), getAirflow(currentAirflowState)); 97 97 } catch (NoSuchFieldException e) { 98 98 } 99 99 } 100 return air Flow;100 return airflow; 101 101 } 102 102 103 public List<Air FlowValue> getAirFlowHistory(){104 return air ThroughputProfile.getAirThroughputHistory();103 public List<AirflowValue> getAirflowHistory(){ 104 return airflowProfile.getAirflowHistory(); 105 105 } 106 106 107 107 public Parameters getParameters() { 108 return air ThroughputProfile.getParameters();108 return airflowProfile.getParameters(); 109 109 } 110 110
Note: See TracChangeset
for help on using the changeset viewer.