Changeset 1207 for DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput
- Timestamp:
- 11/26/13 11:56:07 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note: See TracChangeset
for help on using the changeset viewer.