Ignore:
Timestamp:
06/26/14 14:18:01 (11 years ago)
Author:
wojtekp
Message:
 
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  
    2525                this.extensionList = new ExtensionListImpl(1); 
    2626                initCharacteristics(devDesc); 
    27                 accept(new EnergyExtension.Builder().resource(this).powerProfile(devDesc.getPowerProfile()).airFlowProfile(devDesc.getAirThroughputProfile()).thermalProfile(devDesc.getThermalProfile()).build());      
     27                accept(new EnergyExtension.Builder().resource(this).powerProfile(devDesc.getPowerProfile()).airflowProfile(devDesc.getAirflowProfile()).thermalProfile(devDesc.getThermalProfile()).build());    
    2828        } 
    2929 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java

    r1380 r1396  
    99import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    1010import schedframe.resources.computing.profiles.energy.EnergyEventType; 
    11 import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
    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.AirThroughputStateName; 
    15 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 
    16 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
     11import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue; 
     12import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 
     13import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState; 
     14import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName; 
     15import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName; 
     16import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface; 
    1717 
    18 public class DeviceAirThroughputInterface implements AirThroughputInterface{ 
     18public class DeviceAirflowInterface implements AirflowInterface{ 
    1919 
    20         protected AirThroughputStateName currentAirThroughputState; 
    21         protected AirThroughputProfile airThroughputProfile; 
     20        protected AirflowStateName currentAirflowState; 
     21        protected AirflowProfile airflowProfile; 
    2222        protected PhysicalResource resource; 
    2323         
    24         public DeviceAirThroughputInterface(PhysicalResource resource, AirThroughputProfile airThroughputProfile){ 
     24        public DeviceAirflowInterface(PhysicalResource resource, AirflowProfile airflowProfile){ 
    2525                this.resource = resource; 
    26                 this.airThroughputProfile = airThroughputProfile; 
    27                 this.currentAirThroughputState = StandardAirThroughputStateName.ON; 
     26                this.airflowProfile = airflowProfile; 
     27                this.currentAirflowState = StandardAirflowStateName.ON; 
    2828        } 
    2929         
    30         public AirThroughputStateName getAirThroughputState() { 
    31                 return currentAirThroughputState; 
     30        public AirflowStateName getAirflowState() { 
     31                return currentAirflowState; 
    3232        } 
    3333 
    34         public boolean setAirThroughputState(AirThroughputStateName state) { 
    35                 if(supportAirThroughputState(state)){ 
    36                         currentAirThroughputState = state; 
     34        public boolean setAirflowState(AirflowStateName state) { 
     35                if(supportAirflowState(state)){ 
     36                        currentAirflowState = state; 
    3737                         
    3838                        //TO DO - notifications should be called for all resources starting form the lowest layer 
     
    4444        } 
    4545 
    46         public boolean supportAirThroughputState(AirThroughputStateName state) { 
    47                 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    48                         if(airFlowState.getName().equals(state.getName())){ 
     46        public boolean supportAirflowState(AirflowStateName state) { 
     47                for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 
     48                        if(airflowState.getName().getLabel().equals(state.getLabel())){ 
    4949                                return true; 
    5050                        } 
     
    5353        } 
    5454 
    55         public List<AirThroughputState> getSupportedAirThroughputStates(){ 
    56                 List<AirThroughputState> airThroughputStates = new ArrayList<AirThroughputState>(); 
    57                 for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    58                         airThroughputStates.add(airFlowState); 
     55        public List<AirflowState> getSupportedAirflowStates(){ 
     56                List<AirflowState> airflowStates = new ArrayList<AirflowState>(); 
     57                for(AirflowState airFlowState: airflowProfile.getAirflowStates()){ 
     58                        airflowStates.add(airFlowState); 
    5959                } 
    60                 return airThroughputStates; 
     60                return airflowStates; 
    6161        } 
    6262 
    63         public double getAirFlow(AirThroughputStateName state) throws NoSuchFieldException { 
    64                 double airThroughput = 0; 
    65                 if(supportAirThroughputState(state)){ 
    66                         for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    67                                 if(airFlowState.getName().equals(state.getName())){ 
    68                                         airThroughput = 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(); 
    6969                                        break; 
    7070                                } 
    7171                        } 
    7272                } 
    73                 return airThroughput; 
     73                return airflow; 
    7474        } 
    7575 
    76         public double getPowerConsumption(AirThroughputStateName state) throws NoSuchFieldException { 
     76        public double getPowerConsumption(AirflowStateName state) throws NoSuchFieldException { 
    7777                double powerConsumption = 0; 
    78                 if(supportAirThroughputState(state)){ 
    79                         for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){ 
    80                                 if(airFlowState.getName().equals(state.getName())){ 
    81                                         powerConsumption = airFlowState.getPowerUsage(); 
     78                if(supportAirflowState(state)){ 
     79                        for(AirflowState airflowState: airflowProfile.getAirflowStates()){ 
     80                                if(airflowState.getName().getLabel().equals(state.getLabel())){ 
     81                                        powerConsumption = airflowState.getPowerUsage(); 
    8282                                        break; 
    8383                                } 
     
    8787        } 
    8888         
    89         public AirFlowValue getRecentAirFlow() { 
    90                 AirFlowValue airFlow = null; 
    91                 int lastIdx = getAirFlowHistory().size() - 1; 
     89        public AirflowValue getRecentAirflow() { 
     90                AirflowValue airflow = null; 
     91                int lastIdx = getAirflowHistory().size() - 1; 
    9292                if(lastIdx >= 0) 
    93                         airFlow = getAirFlowHistory().get(lastIdx); 
     93                        airflow = getAirflowHistory().get(lastIdx); 
    9494                else {   
    9595                        try { 
    96                                 airFlow = new AirFlowValue(DateTimeUtils.currentTimeMillis(), getAirFlow(currentAirThroughputState)); 
     96                                airflow = new AirflowValue(DateTimeUtils.currentTimeMillis(), getAirflow(currentAirflowState)); 
    9797                        } catch (NoSuchFieldException e) { 
    9898                        } 
    9999                } 
    100                 return airFlow; 
     100                return airflow; 
    101101        } 
    102102         
    103         public List<AirFlowValue> getAirFlowHistory(){ 
    104                 return airThroughputProfile.getAirThroughputHistory(); 
     103        public List<AirflowValue> getAirflowHistory(){ 
     104                return airflowProfile.getAirflowHistory(); 
    105105        } 
    106106         
    107107        public Parameters getParameters() { 
    108                 return airThroughputProfile.getParameters(); 
     108                return airflowProfile.getParameters(); 
    109109        } 
    110110 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/devices/PhysicalResource.java

    r1287 r1396  
    1212import schedframe.resources.computing.extensions.ExtensionType; 
    1313import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    14 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
     14import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface; 
    1515import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    1616import schedframe.resources.computing.profiles.energy.thermal.ui.ThermalInterface; 
     
    7070        } 
    7171         
    72         public AirThroughputInterface getAirThroughputInterface(){ 
     72        public AirflowInterface getAirflowInterface(){ 
    7373                Extension extension = getExtension(ExtensionType.ENERGY_EXTENSION); 
    7474                if(extension != null){ 
    7575                        EnergyExtension ee = (EnergyExtension)extension; 
    76                         return ee.getAirThroughputInterface(); 
     76                        return ee.getAirflowInterface(); 
    7777                } 
    7878                return null; 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/devices/coolemall/FanAirflowInterface.java

    r1317 r1396  
    11package schedframe.resources.devices.coolemall; 
    22 
    3 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 
    4 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     3import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile; 
     4import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName; 
    55import schedframe.resources.devices.PhysicalResource; 
    6 import schedframe.resources.devices.DeviceAirThroughputInterface; 
     6import schedframe.resources.devices.DeviceAirflowInterface; 
    77 
    8 public class FanAirThroughputInterface extends DeviceAirThroughputInterface { 
     8public class FanAirflowInterface extends DeviceAirflowInterface { 
    99 
    10         public FanAirThroughputInterface(PhysicalResource resource, AirThroughputProfile airThroughputProfile) { 
    11                 super(resource, airThroughputProfile); 
    12                 this.currentAirThroughputState = new UserAirThroughputStateName("2"); 
     10        public FanAirflowInterface(PhysicalResource resource, AirflowProfile airflowProfile) { 
     11                super(resource, airflowProfile); 
     12                this.currentAirflowState = new CustomAirflowStateName("2"); 
    1313        } 
    1414         
    1515        public boolean turnOn(){ 
    16                 return setAirThroughputState(new UserAirThroughputStateName("2")); 
     16                return setAirflowState(new CustomAirflowStateName("2")); 
    1717        } 
    1818 
    1919        public boolean turnOff(){ 
    20                 return setAirThroughputState(new UserAirThroughputStateName("1")); 
     20                return setAirflowState(new CustomAirflowStateName("1")); 
    2121        } 
    2222} 
  • 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.