Changeset 1288 for DCWoRMS/branches


Ignore:
Timestamp:
03/17/14 12:52:26 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java

    r1207 r1288  
    2323import schedframe.resources.computing.profiles.energy.thermal.plugin.DefaultTemperatureEstimationPlugin; 
    2424import schedframe.resources.computing.profiles.energy.thermal.plugin.TemperatureEstimationPlugin; 
     25import schedframe.resources.computing.profiles.load.LoadEstimationPluginFactory; 
     26import schedframe.resources.computing.profiles.load.LoadProfile; 
     27import schedframe.resources.computing.profiles.load.ResourceLoadCalendar; 
     28import schedframe.resources.computing.profiles.load.plugin.LoadEstimationPlugin; 
    2529import schemas.PowerUsage; 
    2630import schemas.Profile; 
    2731import simulator.utils.InstanceFactory; 
    2832import example.energy.DefaultEnergyEstimationPlugin; 
     33import example.energy.coolemall.DefaultLoadEstimationPlugin; 
    2934 
    3035public class PhysicalResourceDescription extends ResourceDescription{ 
     
    3338        protected AirThroughputProfile airThroughputProfile; 
    3439        protected ThermalProfile thermalProfile; 
     40        protected LoadProfile loadProfile; 
    3541         
    3642        protected String category; 
     
    4753                        initAirThroughputProfile(profile.getAirThroughputProfile()); 
    4854                        initThermalProfile(profile.getThermalProfile()); 
     55                        initLoadProfile(profile.getLoadProfile()); 
     56                } else { 
     57                        initLoadProfile(null); 
    4958                } 
    5059        } 
     
    115124                                                                        builder = builder.powerUsage(Double.valueOf(property.getStringValueWithUnit(0).getContent()));   
    116125                                                                } 
    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")){ 
    126127                                                                if(property.getStringValueWithUnit(0).getContent() != null && property.getStringValueWithUnit(0).getContent().length() > 0 && 
    127128                                                                                property.getStringValueWithUnit(1).getContent() != null && property.getStringValueWithUnit(1).getContent().length() > 0){ 
     
    197198                        Parameters params = extractParameters(thermalProfile.getParameter()); 
    198199                        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); 
    199228                } 
    200229        } 
     
    252281                return thermalProfile; 
    253282        } 
     283 
     284        public LoadProfile getLoadProfile() { 
     285                return loadProfile; 
     286        } 
    254287         
    255288        public Location getLocation() { 
Note: See TracChangeset for help on using the changeset viewer.