Changeset 1288 for DCWoRMS/branches/coolemall/src/schedframe/resources
- Timestamp:
- 03/17/14 12:52:26 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java
r1207 r1288 23 23 import schedframe.resources.computing.profiles.energy.thermal.plugin.DefaultTemperatureEstimationPlugin; 24 24 import schedframe.resources.computing.profiles.energy.thermal.plugin.TemperatureEstimationPlugin; 25 import schedframe.resources.computing.profiles.load.LoadEstimationPluginFactory; 26 import schedframe.resources.computing.profiles.load.LoadProfile; 27 import schedframe.resources.computing.profiles.load.ResourceLoadCalendar; 28 import schedframe.resources.computing.profiles.load.plugin.LoadEstimationPlugin; 25 29 import schemas.PowerUsage; 26 30 import schemas.Profile; 27 31 import simulator.utils.InstanceFactory; 28 32 import example.energy.DefaultEnergyEstimationPlugin; 33 import example.energy.coolemall.DefaultLoadEstimationPlugin; 29 34 30 35 public class PhysicalResourceDescription extends ResourceDescription{ … … 33 38 protected AirThroughputProfile airThroughputProfile; 34 39 protected ThermalProfile thermalProfile; 40 protected LoadProfile loadProfile; 35 41 36 42 protected String category; … … 47 53 initAirThroughputProfile(profile.getAirThroughputProfile()); 48 54 initThermalProfile(profile.getThermalProfile()); 55 initLoadProfile(profile.getLoadProfile()); 56 } else { 57 initLoadProfile(null); 49 58 } 50 59 } … … 115 124 builder = builder.powerUsage(Double.valueOf(property.getStringValueWithUnit(0).getContent())); 116 125 } 117 } else if (property.getName().equals("powerUsageMin")){ 118 if(property.getStringValueWithUnit(0).getContent() != null && property.getStringValueWithUnit(0).getContent().length() > 0){ 119 builder = builder.powerUsageMin(Double.valueOf(property.getStringValueWithUnit(0).getContent())); 120 } 121 } else if (property.getName().equals("powerUsageMax")){ 122 if(property.getStringValueWithUnit(0).getContent() != null && property.getStringValueWithUnit(0).getContent().length() > 0){ 123 builder = builder.powerUsageMax(Double.valueOf(property.getStringValueWithUnit(0).getContent())); 124 } 125 }else if (property.getName().equals("loadPowerUsage")){ 126 } else if (property.getName().equals("loadPowerUsage")){ 126 127 if(property.getStringValueWithUnit(0).getContent() != null && property.getStringValueWithUnit(0).getContent().length() > 0 && 127 128 property.getStringValueWithUnit(1).getContent() != null && property.getStringValueWithUnit(1).getContent().length() > 0){ … … 197 198 Parameters params = extractParameters(thermalProfile.getParameter()); 198 199 this.thermalProfile.init(params); 200 } 201 } 202 203 protected void initLoadProfile(schemas.LoadProfile loadProfile) { 204 205 if (loadProfile != null) { 206 207 LoadEstimationPlugin loadEstimationPlugin = null; 208 209 if(loadProfile.getLoadEstimationPlugin() != null){ 210 String loadEstimationPluginName = loadProfile.getLoadEstimationPlugin().getName(); 211 if(loadEstimationPluginName != null) { 212 loadEstimationPlugin = (LoadEstimationPlugin) InstanceFactory.createInstance( 213 loadEstimationPluginName, LoadEstimationPlugin.class); 214 } else { 215 loadEstimationPlugin = new DefaultLoadEstimationPlugin(); 216 } 217 Parameters params = extractParameters(loadProfile.getLoadEstimationPlugin().getParameter()); 218 loadEstimationPlugin.init(params); 219 } 220 ResourceLoadCalendar resLoadCalander = new ResourceLoadCalendar(loadProfile.getLoadCalendar()); 221 this.loadProfile = new LoadProfile(loadEstimationPlugin, resLoadCalander); 222 Parameters params = extractParameters(loadProfile.getParameter()); 223 this.loadProfile.init(params); 224 } else { 225 ResourceLoadCalendar resLoadCalander = new ResourceLoadCalendar(); 226 LoadEstimationPlugin loadEstimationPlugin = LoadEstimationPluginFactory.createLoadEstimationPlugi(getType()); 227 this.loadProfile = new LoadProfile(loadEstimationPlugin, resLoadCalander); 199 228 } 200 229 } … … 252 281 return thermalProfile; 253 282 } 283 284 public LoadProfile getLoadProfile() { 285 return loadProfile; 286 } 254 287 255 288 public Location getLocation() {
Note: See TracChangeset
for help on using the changeset viewer.