Changeset 1055 for DCWoRMS/branches


Ignore:
Timestamp:
05/27/13 14:50:51 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java

    r913 r1055  
    22 
    33import schedframe.Parameter; 
     4import schedframe.events.scheduling.EventReason; 
    45import schedframe.resources.computing.ComputingResource; 
    56import schedframe.resources.computing.Processor; 
     
    1112public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { 
    1213 
     14        private static int OUT_START_ID = 0; 
     15        private static int OUT_END_ID = 8; 
     16         
    1317        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 
    1418                        ComputingResource resource) { 
     
    3337        } 
    3438 
     39        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource) { 
     40 
     41                double airThroughput = 0; 
     42                try { 
     43                        if(event.getReason() == EventReason.SIM_INIT) 
     44                                return airThroughput; 
     45                                //airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF); 
     46                        else 
     47                                airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
     48                } catch (NoSuchFieldException e) { 
     49                        // TODO Auto-generated catch block 
     50                        e.printStackTrace(); 
     51                } 
     52                 
     53                Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 
     54                //we estimate the air flow related to the outlets (nodes placed in the outlet row of RECS) 
     55                if(resId >= OUT_START_ID  && resId <= OUT_END_ID){ 
     56                        for(ComputingResource compResource: resource.getParent().getChildren()){ 
     57                                Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 
     58                                //we take into account the inlet air flow (nodes placed "behind" the given node) 
     59                                if(id - resId == 9 || id - resId == -9){ 
     60                                        try { 
     61                                                airThroughput = airThroughput + compResource.getAirThroughputInterface().getAirFlow(compResource.getAirThroughputInterface().getAirThroughputState())/2; 
     62                                        } catch (NoSuchFieldException e) { 
     63                 
     64                                        } 
     65                                } 
     66                        } 
     67                } 
     68 
     69                return airThroughput; 
     70        } 
     71 
     72        public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource) { 
     73                double tout = 0; 
     74                double tin = 21.3; 
     75                double Q = 0.0056085; 
     76                double C = 1004; 
     77                double delta1 = 1.780594389/2; 
     78                double delta2 = 2.162043729/2; 
     79                double ro = 1.168; 
     80                double power1 = resource.getPowerInterface().getRecentPowerUsage().getValue(); 
     81                double power2 = 0; 
     82                 
     83                Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 
     84                 
     85                //we estimate outlet temperature (related to the temperature of the nodes placed in outlet row) 
     86                for(ComputingResource compResource: resource.getParent().getChildren()){ 
     87                        Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 
     88                        //we take into account the power of nodes placed "behind" the given nodes 
     89                        if(id - resId == 9 || id - resId == -9){ 
     90                                power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue(); 
     91                        } 
     92                } 
     93                 
     94                tout = tin + delta1 * (power1/(Q * C * ro)) +  delta2 * (power2/(Q * C * ro));; 
     95                return tout; 
     96        } 
     97         
    3598} 
Note: See TracChangeset for help on using the changeset viewer.