- Timestamp:
- 06/26/14 14:18:01 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/resources/devices
- Files:
-
- 1 deleted
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Device.java
r1207 r1396 25 25 this.extensionList = new ExtensionListImpl(1); 26 26 initCharacteristics(devDesc); 27 accept(new EnergyExtension.Builder().resource(this).powerProfile(devDesc.getPowerProfile()).air FlowProfile(devDesc.getAirThroughputProfile()).thermalProfile(devDesc.getThermalProfile()).build());27 accept(new EnergyExtension.Builder().resource(this).powerProfile(devDesc.getPowerProfile()).airflowProfile(devDesc.getAirflowProfile()).thermalProfile(devDesc.getThermalProfile()).build()); 28 28 } 29 29 -
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 -
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/PhysicalResource.java
r1287 r1396 12 12 import schedframe.resources.computing.extensions.ExtensionType; 13 13 import schedframe.resources.computing.profiles.energy.EnergyExtension; 14 import schedframe.resources.computing.profiles.energy.airthroughput.ui.Air ThroughputInterface;14 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface; 15 15 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 16 16 import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; … … 70 70 } 71 71 72 public Air ThroughputInterface getAirThroughputInterface(){72 public AirflowInterface getAirflowInterface(){ 73 73 Extension extension = getExtension(ExtensionType.ENERGY_EXTENSION); 74 74 if(extension != null){ 75 75 EnergyExtension ee = (EnergyExtension)extension; 76 return ee.getAir ThroughputInterface();76 return ee.getAirflowInterface(); 77 77 } 78 78 return null; -
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/coolemall/FanAirflowInterface.java
r1317 r1396 1 1 package schedframe.resources.devices.coolemall; 2 2 3 import schedframe.resources.computing.profiles.energy.airthroughput.Air ThroughputProfile;4 import schedframe.resources.computing.profiles.energy.airthroughput. UserAirThroughputStateName;3 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 4 import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName; 5 5 import schedframe.resources.devices.PhysicalResource; 6 import schedframe.resources.devices.DeviceAir ThroughputInterface;6 import schedframe.resources.devices.DeviceAirflowInterface; 7 7 8 public class FanAir ThroughputInterface extends DeviceAirThroughputInterface {8 public class FanAirflowInterface extends DeviceAirflowInterface { 9 9 10 public FanAir ThroughputInterface(PhysicalResource resource, AirThroughputProfile airThroughputProfile) {11 super(resource, air ThroughputProfile);12 this.currentAir ThroughputState = new UserAirThroughputStateName("2");10 public FanAirflowInterface(PhysicalResource resource, AirflowProfile airflowProfile) { 11 super(resource, airflowProfile); 12 this.currentAirflowState = new CustomAirflowStateName("2"); 13 13 } 14 14 15 15 public boolean turnOn(){ 16 return setAir ThroughputState(new UserAirThroughputStateName("2"));16 return setAirflowState(new CustomAirflowStateName("2")); 17 17 } 18 18 19 19 public boolean turnOff(){ 20 return setAir ThroughputState(new UserAirThroughputStateName("1"));20 return setAirflowState(new CustomAirflowStateName("1")); 21 21 } 22 22 } -
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java
r1317 r1396 10 10 import schedframe.resources.computing.description.ResourceDescription; 11 11 import schedframe.resources.computing.location.Location; 12 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 13 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState; 14 import schedframe.resources.computing.profiles.energy.airthroughput.plugin.AirThroughputEstimationPlugin; 15 import schedframe.resources.computing.profiles.energy.airthroughput.plugin.DefaultAirThroughputEstimationPlugin; 12 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateNameFactory; 13 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 14 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState; 15 import schedframe.resources.computing.profiles.energy.airthroughput.plugin.AirflowEstimationPlugin; 16 import schedframe.resources.computing.profiles.energy.airthroughput.plugin.DefaultAirflowEstimationPlugin; 16 17 import schedframe.resources.computing.profiles.energy.power.PState; 17 18 import schedframe.resources.computing.profiles.energy.power.PowerProfile; … … 36 37 37 38 protected PowerProfile powerProfile; 38 protected Air ThroughputProfile airThroughputProfile;39 protected AirflowProfile airflowProfile; 39 40 protected ThermalProfile thermalProfile; 40 41 protected LoadProfile loadProfile; … … 58 59 if (profile != null) { 59 60 initPowerProfile(profile.getPowerProfile()); 60 initAir ThroughputProfile(profile.getAirThroughputProfile());61 initAirflowProfile(profile.getAirThroughputProfile()); 61 62 initThermalProfile(profile.getThermalProfile()); 62 63 initLoadProfile(profile.getLoadProfile()); … … 151 152 } 152 153 153 protected void initAir ThroughputProfile(schemas.AirThroughputProfile airThroughputProfile) {154 if (air ThroughputProfile != null) {155 156 Air ThroughputEstimationPlugin airThroughputEstimationPlugin = null;157 List<Air ThroughputState> airThroughputStates = null;158 if(air ThroughputProfile.getAirThroughputEstimationPlugin() != null){159 String air ThroughputEstimationPluginName = airThroughputProfile.getAirThroughputEstimationPlugin().getName();160 if(air ThroughputEstimationPluginName != null) {161 air ThroughputEstimationPlugin = (AirThroughputEstimationPlugin) InstanceFactory.createInstance(162 air ThroughputEstimationPluginName, AirThroughputEstimationPlugin.class);154 protected void initAirflowProfile(schemas.AirThroughputProfile airflowProfile) { 155 if (airflowProfile != null) { 156 157 AirflowEstimationPlugin airflowEstimationPlugin = null; 158 List<AirflowState> airflowStates = null; 159 if(airflowProfile.getAirThroughputEstimationPlugin() != null){ 160 String airflowEstimationPluginName = airflowProfile.getAirThroughputEstimationPlugin().getName(); 161 if(airflowEstimationPluginName != null) { 162 airflowEstimationPlugin = (AirflowEstimationPlugin) InstanceFactory.createInstance( 163 airflowEstimationPluginName, AirflowEstimationPlugin.class); 163 164 } else { 164 air ThroughputEstimationPlugin = new DefaultAirThroughputEstimationPlugin();165 } 166 Parameters params = extractParameters(air ThroughputProfile.getAirThroughputEstimationPlugin().getParameter());167 air ThroughputEstimationPlugin.init(params);168 } 169 if(air ThroughputProfile.getAirThroughputStates() != null){170 air ThroughputStates = new ArrayList<AirThroughputState>();171 int air ThrouhputStateCount = airThroughputProfile.getAirThroughputStates().getAirThroughputStateCount();172 for (int i = 0; i < air ThrouhputStateCount; i++) {173 schemas.AirThroughputState ats = air ThroughputProfile.getAirThroughputStates().getAirThroughputState(i);174 Air ThroughputState airThroughputState = new AirThroughputState(ats.getName(), ats.getValue()165 airflowEstimationPlugin = new DefaultAirflowEstimationPlugin(); 166 } 167 Parameters params = extractParameters(airflowProfile.getAirThroughputEstimationPlugin().getParameter()); 168 airflowEstimationPlugin.init(params); 169 } 170 if(airflowProfile.getAirThroughputStates() != null){ 171 airflowStates = new ArrayList<AirflowState>(); 172 int airflowStateCount = airflowProfile.getAirThroughputStates().getAirThroughputStateCount(); 173 for (int i = 0; i < airflowStateCount; i++) { 174 schemas.AirThroughputState ats = airflowProfile.getAirThroughputStates().getAirThroughputState(i); 175 AirflowState airflowState = new AirflowState(AirflowStateNameFactory.createAirflowStateName(ats.getName()), ats.getValue() 175 176 .getContent(), ats.getPowerUsage().getContent()); 176 177 Parameters params = extractParameters(ats.getParameter()); 177 air ThroughputState.init(params);178 air ThroughputStates.add(airThroughputState);179 } 180 } 181 this.air ThroughputProfile = new AirThroughputProfile(airThroughputEstimationPlugin, airThroughputStates);182 Parameters params = extractParameters(air ThroughputProfile.getParameter());183 this.air ThroughputProfile.init(params);178 airflowState.init(params); 179 airflowStates.add(airflowState); 180 } 181 } 182 this.airflowProfile = new AirflowProfile(airflowEstimationPlugin, airflowStates); 183 Parameters params = extractParameters(airflowProfile.getParameter()); 184 this.airflowProfile.init(params); 184 185 } 185 186 } … … 281 282 } 282 283 283 public Air ThroughputProfile getAirThroughputProfile() {284 return air ThroughputProfile;284 public AirflowProfile getAirflowProfile() { 285 return airflowProfile; 285 286 } 286 287
Note: See TracChangeset
for help on using the changeset viewer.