Ignore:
Timestamp:
06/26/14 14:18:01 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

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

    r1317 r1396  
    1010import schedframe.resources.computing.description.ResourceDescription; 
    1111import 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; 
     12import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateNameFactory; 
     13import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 
     14import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState; 
     15import schedframe.resources.computing.profiles.energy.airthroughput.plugin.AirflowEstimationPlugin; 
     16import schedframe.resources.computing.profiles.energy.airthroughput.plugin.DefaultAirflowEstimationPlugin; 
    1617import schedframe.resources.computing.profiles.energy.power.PState; 
    1718import schedframe.resources.computing.profiles.energy.power.PowerProfile; 
     
    3637 
    3738        protected PowerProfile powerProfile; 
    38         protected AirThroughputProfile airThroughputProfile; 
     39        protected AirflowProfile airflowProfile; 
    3940        protected ThermalProfile thermalProfile; 
    4041        protected LoadProfile loadProfile; 
     
    5859                if (profile != null) { 
    5960                        initPowerProfile(profile.getPowerProfile()); 
    60                         initAirThroughputProfile(profile.getAirThroughputProfile()); 
     61                        initAirflowProfile(profile.getAirThroughputProfile()); 
    6162                        initThermalProfile(profile.getThermalProfile()); 
    6263                        initLoadProfile(profile.getLoadProfile()); 
     
    151152        } 
    152153 
    153         protected void initAirThroughputProfile(schemas.AirThroughputProfile airThroughputProfile) { 
    154                 if (airThroughputProfile != null) { 
    155                          
    156                         AirThroughputEstimationPlugin airThroughputEstimationPlugin = null; 
    157                         List<AirThroughputState> airThroughputStates = null; 
    158                         if(airThroughputProfile.getAirThroughputEstimationPlugin() != null){ 
    159                                 String airThroughputEstimationPluginName = airThroughputProfile.getAirThroughputEstimationPlugin().getName(); 
    160                                 if(airThroughputEstimationPluginName != null) { 
    161                                         airThroughputEstimationPlugin = (AirThroughputEstimationPlugin) InstanceFactory.createInstance( 
    162                                                         airThroughputEstimationPluginName, 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);                     
    163164                                } else { 
    164                                         airThroughputEstimationPlugin = new DefaultAirThroughputEstimationPlugin(); 
    165                                 } 
    166                                 Parameters params = extractParameters(airThroughputProfile.getAirThroughputEstimationPlugin().getParameter()); 
    167                                 airThroughputEstimationPlugin.init(params); 
    168                         } 
    169                         if(airThroughputProfile.getAirThroughputStates() != null){ 
    170                                 airThroughputStates = new ArrayList<AirThroughputState>(); 
    171                                 int airThrouhputStateCount = airThroughputProfile.getAirThroughputStates().getAirThroughputStateCount(); 
    172                                 for (int i = 0; i < airThrouhputStateCount; i++) { 
    173                                         schemas.AirThroughputState ats = airThroughputProfile.getAirThroughputStates().getAirThroughputState(i); 
    174                                         AirThroughputState 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() 
    175176                                                        .getContent(), ats.getPowerUsage().getContent()); 
    176177                                        Parameters params = extractParameters(ats.getParameter()); 
    177                                         airThroughputState.init(params); 
    178                                         airThroughputStates.add(airThroughputState); 
    179                                 } 
    180                         } 
    181                         this.airThroughputProfile = new AirThroughputProfile(airThroughputEstimationPlugin, airThroughputStates); 
    182                         Parameters params = extractParameters(airThroughputProfile.getParameter()); 
    183                         this.airThroughputProfile.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); 
    184185                } 
    185186        } 
     
    281282        } 
    282283 
    283         public AirThroughputProfile getAirThroughputProfile() { 
    284                 return airThroughputProfile; 
     284        public AirflowProfile getAirflowProfile() { 
     285                return airflowProfile; 
    285286        } 
    286287 
Note: See TracChangeset for help on using the changeset viewer.