Ignore:
Timestamp:
03/19/14 18:22:27 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/example
Files:
5 added
2 deleted
11 edited
8 moved

Legend:

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

    r1207 r1299  
    11package example.energy.coolemall; 
    22 
     3import schedframe.resources.computing.Node; 
    34import schedframe.resources.computing.coolemall.ComputeBox1; 
    45import schedframe.resources.computing.coolemall.NodeGroup; 
    56import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     7import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    68import schedframe.resources.devices.PhysicalResource; 
    79import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    2123                        } 
    2224                } 
    23                 powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY; 
     25                 
     26                int nrOfPoweredOffNodes = 0; 
     27                for(Node node: computeBox1.getNodes()){ 
     28                        if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     29                                nrOfPoweredOffNodes++; 
     30                        } 
     31                } 
     32                if(nrOfPoweredOffNodes != computeBox1.getNodes().size()){ 
     33                        powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;                       
     34                } 
    2435                return powerConsumption; 
    2536        } 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java

    r1253 r1299  
    99import schedframe.resources.computing.coolemall.NodeGroup; 
    1010import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    11 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     11import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    1212import schedframe.resources.devices.Device; 
     13import schedframe.resources.devices.Fan; 
    1314import schedframe.resources.devices.PhysicalResource; 
    1415import schedframe.scheduling.manager.tasks.JobRegistry; 
    1516import simulator.ConfigurationOptions; 
    16 import test.Node_Fan_Mapping; 
    1717import example.energy.BaseEnergyEstimationPlugin; 
    1818 
    1919public class CB2EnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ 
    2020 
    21          
    2221        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 
    2322                        PhysicalResource resource) { 
    24                  
    2523                 
    2624                double Pdc; 
     
    3634                 
    3735                /*********** Pload_dc ***********/ 
    38                 for(ComputingResource cr: room.getChildren()){ 
    39                         ComputeBox1 cb1 = (ComputeBox1)cr; 
    40                         Pload_dc = Pload_dc + cb1.getPowerInterface().getRecentPowerUsage().getValue(); 
    41                 } 
    42                  
     36                Pload_dc = calculatePit(room); 
     37 
    4338                 
    4439                 
     
    4641                 
    4742                /*********** Pothers ***********/                
    48                 double a;//experiment 
    49                 try{ 
    50                         a = ConfigurationOptions.alpha; 
    51                 } catch (Exception e){ 
    52                         a = 0.02; 
    53                 } 
    54                  
    55                 //if not defined assume alpha = 0.02 
    56                 if(a == -1) 
    57                         a = 0.02; 
    58                  
    59                 Pothers = a * Pload_dc;  
     43                Pothers = calculatePothers(Pload_dc); 
    6044                 
    6145                 
    6246                 
    6347                /************* COOLING PART *************/ 
    64                  
     48 
     49                 
     50                /*********** Pfans_dc ***********/ 
     51                Pfans_dc = calculatePfans(room); 
     52                 
     53                /************ Pcooling_device ************/ 
    6554                Device coolingDevice = null; 
    6655                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     
    7261 
    7362                 
    74                 /*********** Pfans_dc ***********/ 
    75                 double ro = 1.168;//constant 
    76                 double nf;//DEBB 
    77                 try{ 
    78                         nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 
    79                 } catch (Exception e){ 
    80                         nf = 0.6; 
    81                 } 
    82                 double delta_p;//from database, CFD 
    83                 try{ 
    84                         delta_p = ConfigurationOptions.pressureDrop; 
    85                 } catch (Exception e){ 
    86                         delta_p = -1; 
    87                 } 
    88                  
    89                 double Vair_total; 
    90                 double mair_total; 
    91                  
    92                 //in case of DCworms calculation of Vair_total 
    93                 double mair_rack = 0; 
    94  
     63                double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room); 
     64                double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room); 
     65                 
     66                double delta_Th_ex;//DEBB 
     67                try{ 
     68                        delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue(); 
     69                } catch (Exception e){ 
     70                        delta_Th_ex = 10; 
     71                } 
     72 
     73                double delta_Th_dry_cooler;//DEBB 
     74                try{ 
     75                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
     76                } catch (Exception e){ 
     77                        delta_Th_dry_cooler = 10; 
     78                } 
     79                 
     80                double Tamb;//experiment 
     81                try{ 
     82                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); 
     83                } catch (Exception e){ 
     84                        Tamb = -1; 
     85                } 
     86 
     87                double Tr_out;//from database, CFD 
     88                try{ 
     89                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 
     90                } catch (Exception e){ 
     91                        Tr_out = -1; 
     92                } 
     93                 
     94                double Tr_in;//experiment 
     95                try{ 
     96                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
     97                } catch (Exception e){ 
     98                        Tr_in = -1; 
     99                } 
     100 
     101                double Tev = Tr_in - delta_Th_ex; 
     102 
     103                 
     104                //if data not present in DB than don't take Pchiller into account 
     105                if(Tr_in != -1 && Tr_out != -1) { 
     106                        if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb) 
     107                                Pcooling_device = Pdry_cooler; 
     108                        else 
     109                                Pcooling_device = Pchiller;      
     110                } 
     111                 
     112 
     113                Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device; 
     114                //System.out.println("---"); 
     115                //System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller); 
     116                //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device); 
     117                 
     118                //System.out.println("CB2 heat: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc); 
     119                //System.out.println("CB2 power: " + Pload_dc + "; " + Pothers + "; " + Pfans_dc + "; " + Pcooling_device + "; " + Pdc); 
     120 
     121                return Pdc; 
     122        } 
     123         
     124        private double calculatePit(ComputingResource room){ 
     125                double Pload_dc = 0; 
    95126                for(ComputingResource cr: room.getChildren()){ 
    96127                        ComputeBox1 cb1 = (ComputeBox1)cr; 
    97                         for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
    98                                 for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
    99                                         if(device.getType().equals(StandardResourceType.Outlet)){ 
    100                                                 double mair_recs = 0; 
    101                                                 double Vair_recs = 0; 
    102                                                  
    103                                                 double Vair_recs1 = 0; 
    104                                                 /*try { 
    105                                                         Vair_recs1  = device.getAirThroughputInterface().getAirFlow(device.getAirThroughputInterface().getAirThroughputState()); 
    106                                                 } catch (NoSuchFieldException e) { 
     128                        Pload_dc = Pload_dc + cb1.getPowerInterface().getRecentPowerUsage().getValue(); 
     129                } 
     130                return Pload_dc; 
     131        } 
     132         
     133        private double calculatePothers(double Pload_dc){ 
     134                 
     135                double Pothers = 0; 
     136                 
     137                double a;//experiment 
     138                try{ 
     139                        a = ConfigurationOptions.coolingData.getAlpha(); 
     140                } catch (Exception e){ 
     141                        a = 0.2; 
     142                } 
     143 
     144                Pothers = a * Pload_dc; 
     145                return Pothers; 
     146        } 
     147         
     148        private double calculatePfans(ComputingResource room){ 
     149                 
     150                double Pfans_dc = 0; 
     151 
     152                Device coolingDevice = null; 
     153                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     154                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     155                                coolingDevice = device; 
     156                                break; 
     157                        } 
     158                } 
     159                 
     160                double nf;//DEBB 
     161                try{ 
     162                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 
     163                } catch (Exception e){ 
     164                        nf = 0.6; 
     165                } 
     166                double delta_p;//from database, CFD 
     167                double Vair_total; 
     168                 
     169                delta_p = ConfigurationOptions.coolingData.getPressureDrop(); 
     170                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     171                 
     172                if(delta_p != -1 && Vair_total != -1) 
     173                        Pfans_dc = delta_p * Vair_total / nf; 
     174                else { 
     175                         
     176                        double ro = 1.168;//constant 
     177                 
     178                        double mair_total; 
     179                         
     180                        double mair_rack = 0; 
     181 
     182                        for(ComputingResource cr: room.getChildren()){ 
     183                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     184                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     185                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     186                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     187                                                         
     188                                                        Fan fan = (Fan) device; 
     189                                                        double mair_recs = 0; 
     190                                                        double Vair_recs = 0; 
     191                                                         
     192                                                        double Vair_recs1 = 0; 
     193 
     194                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     195 
     196                                                        double Vair_recs2 = 0; 
     197                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     198                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     199 
     200                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     201 
     202                                                                        break; 
     203                                                                } 
     204                                                        }        
     205 
     206                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     207 
     208                                                        mair_recs = Vair_recs * ro; 
     209                                                        mair_rack  = mair_rack + mair_recs; 
    107210                                                } 
    108                                                 */ 
    109                                                 if(device.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 
    110                                                         Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW; 
    111                                                 } else { 
    112                                                         Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW; 
    113                                                 } 
    114                                                 double Vair_recs2 = 0; 
    115                                                 for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
    116                                                         if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(device.getFullName().replace("Outlet", "Inlet"))){ 
    117                                                                 /*try { 
    118                                                                         Vair_recs2  = device2.getAirThroughputInterface().getAirFlow(device2.getAirThroughputInterface().getAirThroughputState()); 
    119                                                                 } catch (NoSuchFieldException e) { 
    120                                                                 } 
    121                                                                 */ 
    122                                                                 if(device2.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 
    123                                                                         Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW; 
    124                                                                 } else { 
    125                                                                         Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW; 
    126                                                                 } 
    127                                                                 break; 
    128                                                         } 
    129                                                 }        
    130  
    131                                                 Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
    132  
    133                                                 mair_recs = Vair_recs * ro; 
    134                                                 mair_rack  = mair_rack + mair_recs; 
    135211                                        } 
    136212                                } 
    137213                        } 
    138                 } 
    139                 mair_total = mair_rack; 
    140                 Vair_total = mair_total / ro; 
    141                  
    142                 //in case of CFD calculation of Vair_total 
    143                 try{ 
    144                         Vair_total = ConfigurationOptions.airFlowVolume; 
    145                 } catch (Exception e){ 
    146                         Vair_total = 0; 
    147                 } 
    148                 mair_total = Vair_total * ro; 
    149                  
    150                 //if data not present in DB than don't take Pfans_dc into account 
    151                 if(delta_p != -1 && Vair_total != -1) 
    152                         Pfans_dc = delta_p * Vair_total / nf; 
    153                  
    154                  
    155                  
    156                 /************ Pcooling_device ************/ 
    157                  
     214                        mair_total = mair_rack; 
     215                        Vair_total = mair_total / ro; 
     216                         
     217 
     218                        if(delta_p != -1 && Vair_total != -1) 
     219                                Pfans_dc = delta_p * Vair_total / nf; 
     220                } 
     221                return Pfans_dc; 
     222        } 
     223         
     224        private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ 
    158225                 
    159226                double Pchiller = 0; 
    160                 double Pdry_cooler; 
    161                  
    162                 /*********** Pchiller ***********/ 
    163                 double Cp = 1004;//constant 
     227                 
     228                Device coolingDevice = null; 
     229                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     230                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     231                                coolingDevice = device; 
     232                                break; 
     233                        } 
     234                } 
     235                 
     236                double delta_Th_dry_cooler;//DEBB 
     237                try{ 
     238                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
     239                } catch (Exception e){ 
     240                        delta_Th_dry_cooler = 10; 
     241                } 
     242                 
     243                double Tamb;//experiment 
     244                try{ 
     245                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); 
     246                } catch (Exception e){ 
     247                        Tamb = -1; 
     248                } 
    164249                 
    165250                double ncc;//DEBB 
     
    174259                        Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue(); 
    175260                } catch (Exception e){ 
    176                         Qcooling_rated = 3000; 
     261                        Qcooling_rated = 80000; 
    177262                } 
    178263                 
     
    183268                        EERrated = 5; 
    184269                } 
    185                  
    186                 double Tco;//DEBB 
    187                 try{ 
    188                         Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue(); 
    189                 } catch (Exception e){ 
    190                         Tco = 30; 
    191                 } 
    192270 
    193271                double delta_Th_ex;//DEBB 
     
    197275                        delta_Th_ex = 10; 
    198276                } 
    199  
    200                 double Tr_out;//from database, CFD 
    201                 try{ 
    202                         Tr_out = ConfigurationOptions.outletRoomAirTempeature; 
    203                 } catch (Exception e){ 
    204                         Tr_out = -1; 
    205                 } 
    206277                 
    207278                double Tr_in;//experiment 
    208279                try{ 
    209                         Tr_in = ConfigurationOptions.inletRoomAirTempeature; 
     280                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
    210281                } catch (Exception e){ 
    211282                        Tr_in = -1; 
    212283                } 
    213                  
    214                 double Qdc; 
    215                 double Qcooling; 
     284 
    216285                 
    217286                double Tev;              
     
    228297                 
    229298                 
    230                 Qdc = mair_total * Cp * (Tr_out - Tr_in); 
    231                 Qcooling = Qdc / ncc; 
     299                double Qdc = calculateQ(Pfans_dc, Pothers, room); 
     300                double Qcooling = Qdc / ncc; 
    232301 
    233302                Tev = Tr_in - delta_Th_ex; 
    234303                double Tevf = 32 + 1.8 * Tev; 
     304                 
     305                double Tco = Tamb + delta_Th_dry_cooler; 
     306                 
    235307                double Tcof = 32 + 1.8 * Tco; 
    236308                CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof; 
     
    247319                Pchiller = Qcooling/EER; 
    248320 
    249                          
    250                  
    251  
    252                 /*********** Pdry_cooler ***********/ 
    253                 double delta_Th_dry_cooler;//DEBB 
    254                 try{ 
    255                         delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
    256                 } catch (Exception e){ 
    257                         delta_Th_dry_cooler = 10; 
    258                 } 
    259                  
    260                 double Tamb;//experiment 
    261                 try{ 
    262                         Tamb = ConfigurationOptions.ambientAirTempeature; 
    263                 } catch (Exception e){ 
    264                         Tamb = -1; 
    265                 } 
    266                  
    267                 Pdry_cooler = 0.02 * Qcooling; 
    268                  
    269                  
    270                 //if data not present in DB than don't take Pchiller into account 
    271                 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) { 
    272                         if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler > Tev - Tamb) 
    273                                 Pcooling_device = Pdry_cooler; 
    274                         else 
    275                                 Pcooling_device = Pchiller;      
    276                 } 
    277                  
    278                  
    279  
    280                 Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device; 
    281                 //System.out.println("---"); 
    282                 //System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller); 
    283                 //System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device); 
    284                  
    285                  
    286                  
    287                  
     321                return Pchiller; 
     322        } 
     323         
     324        private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ 
     325 
     326                double Pdry_cooler = 0; 
     327                Device coolingDevice = null; 
     328                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     329                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     330                                coolingDevice = device; 
     331                                break; 
     332                        } 
     333                } 
     334                 
     335                double n_dry_cooler;//DEBB 
     336                try{ 
     337                         n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue(); 
     338                } catch (Exception e){ 
     339                         n_dry_cooler = 0.02; 
     340                } 
     341 
     342                double ncc;//DEBB 
     343                try{ 
     344                        ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue(); 
     345                } catch (Exception e){ 
     346                        ncc = 0.95; 
     347                } 
     348                 
     349 
     350                double Qdc = calculateQ(Pfans_dc, Pothers, room); 
     351                double Qcooling = Qdc / ncc; 
     352 
     353                Pdry_cooler = n_dry_cooler * Qcooling; 
     354                 
     355                return Pdry_cooler; 
     356        } 
     357         
     358        private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){ 
     359 
     360                double Qdc = 0; 
     361                 
     362                Device coolingDevice = null; 
     363                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     364                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     365                                coolingDevice = device; 
     366                                break; 
     367                        } 
     368                } 
     369 
     370                double nf;//DEBB 
     371                try{ 
     372                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 
     373                } catch (Exception e){ 
     374                        nf = 0.6; 
     375                } 
     376 
    288377                /**************** HEAT ****************/ 
    289                 double Qdc2; 
    290378                 
    291379                double Qload_dc = 0; 
     
    306394                                                Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); 
    307395                                        } 
    308                                         double Qfan = 0; 
    309                                         for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    310                                                 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    311                                                         if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 
    312                                                                 Qfan = Qfan + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 
    313                                                         }else 
    314                                                                 Qfan = Qfan + device.getPowerInterface().getRecentPowerUsage().getValue(); 
    315                                                         break; 
     396                                        Qnodes = Qnodes + Qcpu; 
     397                                } 
     398                                double Qfans = 0; 
     399                                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     400                                        Fan fan = (Fan) device; 
     401                                        if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 
     402                                                try { 
     403                                                        Qfans = Qfans + (1 - delta_2) * fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 
     404                                                } catch (NoSuchFieldException e) { 
     405                                                        // TODO Auto-generated catch block 
     406                                                        e.printStackTrace(); 
     407                                                } 
     408                                        }else 
     409                                                Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); 
     410                                } 
     411                                QnodeGroup = QnodeGroup + Qnodes + Qfans; 
     412                        } 
     413                        int nrOfPoweredOffNodes = 0; 
     414                        for(Node node: cb1.getNodes()){ 
     415                                if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     416                                        nrOfPoweredOffNodes++; 
     417                                } 
     418                        } 
     419                        if(nrOfPoweredOffNodes != cb1.getNodes().size()){ 
     420                                Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 
     421                        } else { 
     422                                Qload_dc  = Qload_dc + QnodeGroup; 
     423                        } 
     424                } 
     425                 
     426                Qothers = Pothers; 
     427                 
     428                Qfans_dc = (1 - nf) * Pfans_dc; 
     429                 
     430                Qdc = Qload_dc + Qothers + Qfans_dc; 
     431 
     432                 
     433                return Qdc; 
     434        } 
     435         
     436         
     437        private double calculateQ2(ComputingResource room){ 
     438 
     439                double Qdc = 0; 
     440 
     441                double mair_total; 
     442                double Vair_total; 
     443                double ro = 1.168;//constant 
     444                 
     445                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     446                 
     447                if(Vair_total != -1) { 
     448                        mair_total = Vair_total * ro; 
     449                } 
     450                else { 
     451         
     452                        //in case of DCworms calculation of Vair_total 
     453                        double mair_rack = 0; 
     454 
     455                        for(ComputingResource cr: room.getChildren()){ 
     456                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     457                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     458                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     459                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     460                                                         
     461                                                        Fan fan = (Fan) device; 
     462                                                        double mair_recs = 0; 
     463                                                        double Vair_recs = 0; 
     464                                                         
     465                                                        double Vair_recs1 = 0; 
     466 
     467                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     468 
     469                                                        double Vair_recs2 = 0; 
     470                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     471                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     472 
     473                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     474 
     475                                                                        break; 
     476                                                                } 
     477                                                        }        
     478 
     479                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     480 
     481                                                        mair_recs = Vair_recs * ro; 
     482                                                        mair_rack  = mair_rack + mair_recs; 
    316483                                                } 
    317484                                        } 
    318                                         Qnodes = Qnodes + Qcpu + (1 - delta_2) * Qfan; 
    319485                                } 
    320                                 QnodeGroup = QnodeGroup + Qnodes; 
    321                         } 
    322                         Qload_dc  = Qload_dc + QnodeGroup; 
    323                 } 
    324                  
    325                 Qload_dc = Qload_dc + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 
    326                  
    327                 Qothers = Pothers; 
    328                  
    329                 Qfans_dc = (1 - nf) * Pfans_dc; 
    330                  
    331                 Qdc2 = Qload_dc + Qothers + Qfans_dc; 
    332                  
    333                 double Qdc2v2 = 0; 
    334                  
    335                 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) 
    336                         Qdc2v2 = mair_total * Cp * (Tr_out - Tr_in); 
    337  
    338                 //System.out.println("Qdc2: " + Qdc2 + " Qdc2v2: " + Qdc2v2 + "diff: " + (Qdc2v2 - Qdc2)); 
    339  
    340                  
    341                 return Pdc; 
    342         } 
    343          
    344  
     486                        } 
     487                        mair_total = mair_rack; 
     488                } 
     489                 
     490                double Cp = 1004;//constant 
     491 
     492 
     493                double Tr_out;//from database, CFD 
     494                try{ 
     495                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 
     496                } catch (Exception e){ 
     497                        Tr_out = -1; 
     498                } 
     499                 
     500                double Tr_in;//experiment 
     501                try{ 
     502                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
     503                } catch (Exception e){ 
     504                        Tr_in = -1; 
     505                } 
     506 
     507 
     508                Qdc = mair_total * Cp * (Tr_out - Tr_in); 
     509                 
     510                return Qdc; 
     511        } 
     512         
    345513} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolEmAllTestbedMeasurements.java

    r1207 r1299  
    44 
    55        //HARDWARE 
    6         public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112; 
    7         public static final double SINGLE_FAN_OFF_AIR_FLOW = 0; 
     6        //public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112; 
     7        //public static final double SINGLE_FAN_OFF_AIR_FLOW = 0; 
    88         
    9         public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 6; 
    10         public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0; 
     9        //public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 0; 
     10        //public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0; 
    1111         
    12         public static final double OTHER_DEVICES_POWER_CONSUMPTION = 775; 
     12        public static final double OTHER_DEVICES_POWER_CONSUMPTION = 0; 
    1313         
    1414        public static final double POWER_SUPPLY_EFFICIENCY = 0.87; 
    1515         
    1616 
    17         public static final int Atom_D510_NR_OF_THREADS = 2; 
    18          
    19         public static final int Atom_N2600_NR_OF_THREADS = 2; 
    20          
    21         public static final int Core_i7_2715QE_NR_OF_THREADS = 4; 
    22          
    23         public static final int Core_i7_3615QE_NR_OF_THREADS = 4; 
    24          
    25         public static final int Fusion_G_T40N_NR_OF_THREADS = 2; 
    26          
    27         //APPLICATIONS 
    28         public static final double Atom_D510 = 336.3; 
    29          
    30         public static final double Atom_N2600 = 336.3; 
    31          
    32         public static final double Core_i7_2715QE = 3076.4; 
    33          
    34         public static final double Core_i7_3615QE = 3786.0; 
    35          
    36         public static final double Fusion_G_T40N = 649.3; 
    37          
    38  
    3917} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java

    r1207 r1299  
    11package example.energy.coolemall; 
    22 
    3 import schedframe.events.scheduling.EventReason; 
     3import schedframe.resources.StandardResourceType; 
     4import schedframe.resources.computing.ComputingResource; 
     5import schedframe.resources.computing.Node; 
     6import schedframe.resources.computing.Processor; 
     7import schedframe.resources.computing.coolemall.ComputeBox1; 
     8import schedframe.resources.computing.coolemall.NodeGroup; 
    49import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     10import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    511import schedframe.resources.devices.Device; 
     12import schedframe.resources.devices.Fan; 
    613import schedframe.resources.devices.PhysicalResource; 
    714import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    1118public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { 
    1219 
     20        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
     21                double airThroughput = 0; 
     22                return airThroughput; 
     23        } 
     24 
    1325        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 
    1426                        PhysicalResource resource) { 
    1527                 
    1628                double powerConsumption = 0; 
    17  
     29                 
    1830                Device coolingDevice = (Device) resource; 
    19  
     31                ComputingResource room = (ComputingResource) coolingDevice.getComputingResource(); 
     32                 
     33                double Pload_dc = calculatePit(room); 
     34                double Pothers = calculatePothers(Pload_dc); 
     35                double Pfans_dc = calculatePfans(room); 
     36                 
     37                 
     38                double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room); 
     39                double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room); 
     40                 
     41                 
     42                double delta_Th_ex;//DEBB 
     43                try{ 
     44                        delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue(); 
     45                } catch (Exception e){ 
     46                        delta_Th_ex = 10; 
     47                } 
     48 
     49                double delta_Th_dry_cooler;//DEBB 
     50                try{ 
     51                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
     52                } catch (Exception e){ 
     53                        delta_Th_dry_cooler = 10; 
     54                } 
     55                 
     56                double Tamb;//experiment 
     57                try{ 
     58                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); 
     59                } catch (Exception e){ 
     60                        Tamb = -1; 
     61                } 
     62 
     63                double Tr_out;//from database, CFD 
     64                try{ 
     65                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 
     66                } catch (Exception e){ 
     67                        Tr_out = -1; 
     68                } 
     69                 
     70                double Tr_in;//experiment 
     71                try{ 
     72                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
     73                } catch (Exception e){ 
     74                        Tr_in = -1; 
     75                } 
     76 
     77                double Tev = Tr_in - delta_Th_ex; 
     78                 
     79                //if data is not present in DB than don't take Pchiller into account 
     80                if(Tr_in != -1 && Tr_out != -1) { 
     81                        if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb) 
     82                                powerConsumption = Pdry_cooler; 
     83                        else 
     84                                powerConsumption = Pchiller;     
     85                } 
     86                 
     87                 
     88                //System.out.println("CoolingDevice heat data: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc); 
     89                 
     90                //System.out.println("CoolingDevice power: " + powerConsumption); 
     91                 
     92                 
     93                return powerConsumption; 
     94        } 
     95         
     96        private double calculatePit(ComputingResource room){ 
     97                double Pload_dc = 0; 
     98                for(ComputingResource cr: room.getChildren()){ 
     99                        ComputeBox1 cb1 = (ComputeBox1)cr; 
     100                        Pload_dc = Pload_dc + cb1.getPowerInterface().getRecentPowerUsage().getValue(); 
     101                } 
     102                return Pload_dc; 
     103        } 
     104         
     105        private double calculatePothers(double Pload_dc){ 
     106                 
     107                double Pothers = 0; 
     108                 
     109                double a;//experiment 
     110                try{ 
     111                        a = ConfigurationOptions.coolingData.getAlpha(); 
     112                } catch (Exception e){ 
     113                        a = 0.2; 
     114                } 
     115 
     116                Pothers = a * Pload_dc; 
     117                return Pothers; 
     118        } 
     119         
     120        private double calculatePfans(ComputingResource room){ 
     121                 
     122                double Pfans_dc = 0; 
     123 
     124                Device coolingDevice = null; 
     125                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     126                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     127                                coolingDevice = device; 
     128                                break; 
     129                        } 
     130                } 
     131                 
     132                double nf;//DEBB 
     133                try{ 
     134                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 
     135                } catch (Exception e){ 
     136                        nf = 0.6; 
     137                } 
     138                double delta_p;//from database, CFD 
     139                double Vair_total; 
     140                 
     141                delta_p = ConfigurationOptions.coolingData.getPressureDrop(); 
     142                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     143                 
     144                if(delta_p != -1 && Vair_total != -1) 
     145                        Pfans_dc = delta_p * Vair_total / nf; 
     146                else { 
     147                         
     148                        double ro = 1.168;//constant 
     149                 
     150                        double mair_total; 
     151                         
     152                        double mair_rack = 0; 
     153 
     154                        for(ComputingResource cr: room.getChildren()){ 
     155                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     156                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     157                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     158                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     159                                                         
     160                                                        Fan fan = (Fan) device; 
     161                                                        double mair_recs = 0; 
     162                                                        double Vair_recs = 0; 
     163                                                         
     164                                                        double Vair_recs1 = 0; 
     165 
     166                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     167 
     168                                                        double Vair_recs2 = 0; 
     169                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     170                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     171 
     172                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     173 
     174                                                                        break; 
     175                                                                } 
     176                                                        }        
     177 
     178                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     179 
     180                                                        mair_recs = Vair_recs * ro; 
     181                                                        mair_rack  = mair_rack + mair_recs; 
     182                                                } 
     183                                        } 
     184                                } 
     185                        } 
     186                        mair_total = mair_rack; 
     187                        Vair_total = mair_total / ro; 
     188                         
     189 
     190                        if(delta_p != -1 && Vair_total != -1) 
     191                                Pfans_dc = delta_p * Vair_total / nf; 
     192                } 
     193                return Pfans_dc; 
     194        } 
     195         
     196        private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ 
     197                 
    20198                double Pchiller = 0; 
    21                 double Pdry_cooler; 
    22                  
    23                 /*********** Pchiller ***********/ 
    24                 double Cp = 1004;//constant 
     199                 
     200                Device coolingDevice = null; 
     201                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     202                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     203                                coolingDevice = device; 
     204                                break; 
     205                        } 
     206                } 
     207                 
     208                double delta_Th_dry_cooler;//DEBB 
     209                try{ 
     210                        delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
     211                } catch (Exception e){ 
     212                        delta_Th_dry_cooler = 10; 
     213                } 
     214                 
     215                double Tamb;//experiment 
     216                try{ 
     217                        Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature(); 
     218                } catch (Exception e){ 
     219                        Tamb = -1; 
     220                } 
    25221                 
    26222                double ncc;//DEBB 
     
    35231                        Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue(); 
    36232                } catch (Exception e){ 
    37                         Qcooling_rated = 3000; 
     233                        Qcooling_rated = 80000; 
    38234                } 
    39235                 
     
    44240                        EERrated = 5; 
    45241                } 
    46                  
    47                 double Tco;//DEBB 
    48                 try{ 
    49                         Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue(); 
    50                 } catch (Exception e){ 
    51                         Tco = 30; 
    52                 } 
    53242 
    54243                double delta_Th_ex;//DEBB 
     
    58247                        delta_Th_ex = 10; 
    59248                } 
    60  
    61                 double Tr_out;//from database, CFD 
    62                 try{ 
    63                         Tr_out = ConfigurationOptions.outletRoomAirTempeature; 
    64                 } catch (Exception e){ 
    65                         Tr_out = -1; 
    66                 } 
    67249                 
    68250                double Tr_in;//experiment 
    69251                try{ 
    70                         Tr_in = ConfigurationOptions.inletRoomAirTempeature; 
     252                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
    71253                } catch (Exception e){ 
    72254                        Tr_in = -1; 
    73255                } 
    74256 
    75                  
    76                  
    77                 double ro = 1.168;//cosntant 
    78                 double  Vair_total; 
    79                 double mair_total; 
    80                 try{ 
    81                         Vair_total = ConfigurationOptions.airFlowVolume; 
    82                 } catch (Exception e){ 
    83                         Vair_total = 0; 
    84                 } 
    85                 mair_total = Vair_total * ro; 
    86                  
    87                  
    88                 double Qdc; 
    89                 double Qcooling; 
    90257                 
    91258                double Tev;              
     
    102269                 
    103270                 
    104                 Qdc = mair_total * Cp * (Tr_out - Tr_in); 
    105                 Qcooling = Qdc / ncc; 
     271                double Qdc = calculateQ(Pfans_dc, Pothers, room); 
     272                double Qcooling = Qdc / ncc; 
    106273 
    107274                Tev = Tr_in - delta_Th_ex; 
    108275                double Tevf = 32 + 1.8 * Tev; 
     276                 
     277                double Tco = Tamb + delta_Th_dry_cooler; 
     278                 
    109279                double Tcof = 32 + 1.8 * Tco; 
    110280                CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof; 
     
    121291                Pchiller = Qcooling/EER; 
    122292 
    123                          
    124                  
    125  
    126                 /*********** Pdry_cooler ***********/ 
    127                 double delta_Th_dry_cooler;//DEBB 
    128                 try{ 
    129                         delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue(); 
    130                 } catch (Exception e){ 
    131                         delta_Th_dry_cooler = 10; 
    132                 } 
    133                  
    134                 double Tamb;//experiment 
    135                 try{ 
    136                         Tamb = ConfigurationOptions.ambientAirTempeature; 
    137                 } catch (Exception e){ 
    138                         Tamb = -1; 
    139                 } 
    140                  
    141                 Pdry_cooler = 0.02 * Qcooling; 
    142                  
    143                  
    144                 //if data not present in DB than don't take Pchiller into account 
    145                 if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) { 
    146                         if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler > Tev - Tamb) 
    147                                 powerConsumption = Pdry_cooler; 
    148                         else 
    149                                 powerConsumption = Pchiller;     
    150                 } 
    151                  
    152                  
    153  
    154                  
    155                 return powerConsumption; 
    156         } 
    157          
    158         public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
    159                 double airThroughput = 0; 
    160                 try { 
    161                         if(event.getReason() == EventReason.SIM_INIT) 
    162                                 return airThroughput; 
    163                                 //airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF); 
    164                         else 
    165                                 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
    166                 } catch (NoSuchFieldException e) { 
    167                         // TODO Auto-generated catch block 
    168                         e.printStackTrace(); 
    169                 } 
    170  
    171                 return airThroughput; 
    172         } 
    173  
     293                return Pchiller; 
     294        } 
     295         
     296        private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){ 
     297 
     298                double Pdry_cooler = 0; 
     299                Device coolingDevice = null; 
     300                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     301                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     302                                coolingDevice = device; 
     303                                break; 
     304                        } 
     305                } 
     306                 
     307                double n_dry_cooler;//DEBB 
     308                try{ 
     309                         n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue(); 
     310                } catch (Exception e){ 
     311                         n_dry_cooler = 0.02; 
     312                } 
     313 
     314                double ncc;//DEBB 
     315                try{ 
     316                        ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue(); 
     317                } catch (Exception e){ 
     318                        ncc = 0.95; 
     319                } 
     320                 
     321 
     322                double Qdc = calculateQ(Pfans_dc, Pothers, room); 
     323                double Qcooling = Qdc / ncc; 
     324 
     325                Pdry_cooler = n_dry_cooler * Qcooling; 
     326                 
     327                return Pdry_cooler; 
     328        } 
     329         
     330        private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){ 
     331 
     332                double Qdc = 0; 
     333                 
     334                Device coolingDevice = null; 
     335                for(Device device: room.getResourceCharacteristic().getDevices()){ 
     336                        if(device.getType().equals(StandardResourceType.CoolingDevice)){ 
     337                                coolingDevice = device; 
     338                                break; 
     339                        } 
     340                } 
     341 
     342                double nf;//DEBB 
     343                try{ 
     344                        nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue(); 
     345                } catch (Exception e){ 
     346                        nf = 0.6; 
     347                } 
     348 
     349                /**************** HEAT ****************/ 
     350                 
     351                double Qload_dc = 0; 
     352                double Qothers = 0; 
     353                double Qfans_dc = 0; 
     354 
     355                double delta_2; //DEBB - currently not present; 
     356                delta_2 = 0.4; 
     357                 
     358                for(ComputingResource cr: room.getChildren()){ 
     359                        ComputeBox1 cb1 = (ComputeBox1)cr; 
     360                        double QnodeGroup = 0; 
     361                        for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     362                                double Qnodes = 0; 
     363                                for(Node node: nodeGroup.getNodes()){ 
     364                                        double Qcpu = 0; 
     365                                        for(Processor proc: node.getProcessors()){ 
     366                                                Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue(); 
     367                                        } 
     368                                        Qnodes = Qnodes + Qcpu; 
     369                                } 
     370                                double Qfans = 0; 
     371                                for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     372                                        Fan fan = (Fan) device; 
     373                                        if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 
     374                                                try { 
     375                                                        Qfans = Qfans + (1 - delta_2) * fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 
     376                                                } catch (NoSuchFieldException e) { 
     377                                                        // TODO Auto-generated catch block 
     378                                                        e.printStackTrace(); 
     379                                                } 
     380                                        }else 
     381                                                Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue(); 
     382                                } 
     383                                QnodeGroup = QnodeGroup + Qnodes + Qfans; 
     384                        } 
     385                        int nrOfPoweredOffNodes = 0; 
     386                        for(Node node: cb1.getNodes()){ 
     387                                if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     388                                        nrOfPoweredOffNodes++; 
     389                                } 
     390                        } 
     391                        if(nrOfPoweredOffNodes != cb1.getNodes().size()){ 
     392                                Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION; 
     393                        } else { 
     394                                Qload_dc  = Qload_dc + QnodeGroup; 
     395                        } 
     396                } 
     397                 
     398                Qothers = Pothers; 
     399                 
     400                Qfans_dc = (1 - nf) * Pfans_dc; 
     401                 
     402                Qdc = Qload_dc + Qothers + Qfans_dc; 
     403 
     404                 
     405                return Qdc; 
     406        } 
     407         
     408         
     409        private double calculateQ2(ComputingResource room){ 
     410 
     411                double Qdc = 0; 
     412 
     413                double mair_total; 
     414                double Vair_total; 
     415                double ro = 1.168;//constant 
     416                 
     417                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     418                 
     419                if(Vair_total != -1) { 
     420                        mair_total = Vair_total * ro; 
     421                } 
     422                else { 
     423         
     424                        //in case of DCworms calculation of Vair_total 
     425                        double mair_rack = 0; 
     426 
     427                        for(ComputingResource cr: room.getChildren()){ 
     428                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     429                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     430                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     431                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     432                                                         
     433                                                        Fan fan = (Fan) device; 
     434                                                        double mair_recs = 0; 
     435                                                        double Vair_recs = 0; 
     436                                                         
     437                                                        double Vair_recs1 = 0; 
     438 
     439                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     440 
     441                                                        double Vair_recs2 = 0; 
     442                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     443                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     444 
     445                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     446 
     447                                                                        break; 
     448                                                                } 
     449                                                        }        
     450 
     451                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     452 
     453                                                        mair_recs = Vair_recs * ro; 
     454                                                        mair_rack  = mair_rack + mair_recs; 
     455                                                } 
     456                                        } 
     457                                } 
     458                        } 
     459                        mair_total = mair_rack; 
     460                } 
     461                 
     462                double Cp = 1004;//constant 
     463 
     464 
     465                double Tr_out;//from database, CFD 
     466                try{ 
     467                        Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature(); 
     468                } catch (Exception e){ 
     469                        Tr_out = -1; 
     470                } 
     471                 
     472                double Tr_in;//experiment 
     473                try{ 
     474                        Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature(); 
     475                } catch (Exception e){ 
     476                        Tr_in = -1; 
     477                } 
     478 
     479 
     480                Qdc = mair_total * Cp * (Tr_out - Tr_in); 
     481                 
     482                return Qdc; 
     483        } 
    174484} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java

    r1207 r1299  
    22 
    33import schedframe.events.scheduling.EventReason; 
     4import schedframe.resources.computing.ComputingResource; 
     5import schedframe.resources.computing.Node; 
    46import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    5 import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     7import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
     8import schedframe.resources.devices.Device; 
     9import schedframe.resources.devices.Fan; 
    610import schedframe.resources.devices.PhysicalResource; 
    711import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    1418                 
    1519                double powerConsumption = 0; 
    16                 /*try { 
    17                         powerConsumption = resource.getAirThroughputInterface().getPowerConsumption(resource.getAirThroughputInterface().getAirThroughputState()); 
     20                 
     21                Fan fan = (Fan) resource; 
     22                try { 
     23                        powerConsumption = fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState()); 
    1824                } catch (NoSuchFieldException e) { 
    1925                        // TODO Auto-generated catch block 
    2026                        e.printStackTrace(); 
    21                 }*/ 
     27                } 
    2228 
    23                 if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 
     29                /*if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 
    2430                        powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_POWER_CONSUMPTION; 
    2531                } else { 
    2632                        powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 
    27                 } 
    28                 return powerConsumption; 
     33                }*/ 
     34                return powerConsumption * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size(); 
    2935        } 
    3036         
    3137        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
     38                 
    3239                double airThroughput = 0; 
    33                 /*try { 
     40                Fan fan = (Fan) resource; 
     41                try { 
    3442                        if(event.getReason() == EventReason.SIM_INIT) 
    35                                 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
     43                                airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState()); 
    3644                        else 
    37                                 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
     45                                airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState()); 
    3846                } catch (NoSuchFieldException e) { 
    3947                        // TODO Auto-generated catch block 
    4048                        e.printStackTrace(); 
    41                 }*/ 
     49                } 
    4250 
    43                 if(event.getReason() == EventReason.SIM_INIT){ 
     51                /*if(event.getReason() == EventReason.SIM_INIT){ 
    4452                        if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){ 
    4553                                airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW; 
     
    5462                                airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW; 
    5563                        } 
    56                 } 
     64                }*/ 
    5765 
    5866                 
    59                 return airThroughput; 
     67                return airThroughput * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size(); 
     68        } 
     69         
     70        private int getNumberOfWorkingNodes(Device device){ 
     71                int quantity = 0; 
     72                Fan fan = (Fan) device; 
     73                for(ComputingResource compRes: device.getComputingResource().getChildren()){ 
     74                        Node node = (Node)compRes; 
     75                        if(fan.getChilledResources().contains(node.getFullName()) && node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) ){ 
     76                                quantity++; 
     77                        } 
     78                } 
     79                return quantity; 
    6080        } 
    6181 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java

    r1207 r1299  
    11package example.energy.coolemall; 
    22 
     3import schedframe.resources.StandardResourceType; 
     4import schedframe.resources.computing.ComputingResource; 
     5import schedframe.resources.computing.coolemall.ComputeBox1; 
     6import schedframe.resources.computing.coolemall.NodeGroup; 
    37import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     8import schedframe.resources.devices.Device; 
     9import schedframe.resources.devices.Fan; 
    410import schedframe.resources.devices.PhysicalResource; 
    511import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    1218                        PhysicalResource resource) { 
    1319                 
     20                /*********** Pfans_dc ***********/ 
    1421                double powerConsumption = 0; 
     22                double nf = 0.6; 
     23                 
     24                double delta_p;//from database, CFD 
     25                double Vair_total; 
     26                 
     27                delta_p = ConfigurationOptions.coolingData.getPressureDrop(); 
     28                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     29                 
     30                if(delta_p != -1 && Vair_total != -1) 
     31                        powerConsumption = delta_p * Vair_total / nf; 
     32                else { 
     33                        Device flowPump = (Device) resource; 
     34                        ComputingResource room = flowPump.getComputingResource(); 
     35                         
     36                        double ro = 1.168;//constant 
     37                 
     38                        double mair_total; 
     39                         
     40                        //in case of DCworms calculation of Vair_total 
     41                        double mair_rack = 0; 
    1542 
    16                 double nf = 0.6; 
     43                        for(ComputingResource cr: room.getChildren()){ 
     44                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     45                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     46                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     47                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     48                                                         
     49                                                        Fan fan = (Fan) device; 
     50                                                        double mair_recs = 0; 
     51                                                        double Vair_recs = 0; 
     52                                                         
     53                                                        double Vair_recs1 = 0; 
    1754 
    18                 double delta_p;//from database, CFD 
    19                 try{ 
    20                         delta_p = ConfigurationOptions.pressureDrop; 
    21                 } catch (Exception e){ 
    22                         delta_p = 0; 
     55                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     56 
     57                                                        double Vair_recs2 = 0; 
     58                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     59                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     60 
     61                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     62 
     63                                                                        break; 
     64                                                                } 
     65                                                        }        
     66 
     67                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     68 
     69                                                        mair_recs = Vair_recs * ro; 
     70                                                        mair_rack  = mair_rack + mair_recs; 
     71                                                } 
     72                                        } 
     73                                } 
     74                        } 
     75                        mair_total = mair_rack; 
     76                        Vair_total = mair_total / ro; 
     77                         
     78 
     79                        if(delta_p != -1 && Vair_total != -1) 
     80                                powerConsumption = delta_p * Vair_total / nf; 
    2381                } 
    2482                 
    25                 double Vair_total; 
    26                  
    27                 try{ 
    28                         Vair_total = ConfigurationOptions.airFlowVolume; 
    29                 } catch (Exception e){ 
    30                         Vair_total = 0; 
    31                 } 
    32  
    33                  
    34                 //if data not present in DB than don't take Pfans_dc into account 
    35                 if(delta_p != -1 && Vair_total != -1) 
    36                         powerConsumption = delta_p * Vair_total / nf; 
     83                //System.out.println("Flow Pump power: " + powerConsumption); 
    3784                 
    3885                return powerConsumption; 
     
    4390                double Vair_total; 
    4491                 
    45                 try{ 
    46                         Vair_total = ConfigurationOptions.airFlowVolume; 
    47                 } catch (Exception e){ 
    48                         Vair_total = 0; 
     92                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     93                if(Vair_total != -1) { 
     94                        airThroughput = Vair_total; 
     95                } else { 
     96                        Device flowPump = (Device) resource; 
     97                        ComputingResource room = flowPump.getComputingResource(); 
     98 
     99                        double ro = 1.168;//constant 
     100                         
     101                        double mair_total; 
     102                        double mair_rack = 0; 
     103 
     104                        for(ComputingResource cr: room.getChildren()){ 
     105                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     106                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     107                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     108                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     109                                                         
     110                                                        Fan fan = (Fan) device; 
     111                                                        double mair_recs = 0; 
     112                                                        double Vair_recs = 0; 
     113                                                         
     114                                                        double Vair_recs1 = 0; 
     115 
     116                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     117 
     118                                                        double Vair_recs2 = 0; 
     119                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     120                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     121 
     122                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     123 
     124                                                                        break; 
     125                                                                } 
     126                                                        }        
     127 
     128                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     129 
     130                                                        mair_recs = Vair_recs * ro; 
     131                                                        mair_rack  = mair_rack + mair_recs; 
     132                                                } 
     133                                        } 
     134                                } 
     135                        } 
     136                        mair_total = mair_rack; 
     137                        Vair_total = mair_total / ro; 
     138                        airThroughput = Vair_total; 
    49139                } 
    50                 airThroughput = Vair_total; 
    51140                return airThroughput; 
    52141        } 
    53  
     142         
    54143} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java

    r1207 r1299  
    11package example.energy.coolemall; 
    22 
     3import schedframe.resources.StandardResourceType; 
     4import schedframe.resources.computing.ComputingResource; 
     5import schedframe.resources.computing.coolemall.ComputeBox1; 
     6import schedframe.resources.computing.coolemall.NodeGroup; 
    37import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     8import schedframe.resources.devices.Device; 
     9import schedframe.resources.devices.Fan; 
    410import schedframe.resources.devices.PhysicalResource; 
    511import schedframe.scheduling.manager.tasks.JobRegistry; 
     
    2127                double Vair_total; 
    2228                 
    23                 try{ 
    24                         Vair_total = ConfigurationOptions.airFlowVolume; 
    25                 } catch (Exception e){ 
    26                         Vair_total = 0; 
     29                Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume(); 
     30                if(Vair_total != -1) { 
     31                        airThroughput = Vair_total; 
     32                } else { 
     33                        Device flowPump = (Device) resource; 
     34                        ComputingResource room = flowPump.getComputingResource(); 
     35 
     36                        double ro = 1.168;//constant 
     37                         
     38                        double mair_total; 
     39                        double mair_rack = 0; 
     40 
     41                        for(ComputingResource cr: room.getChildren()){ 
     42                                ComputeBox1 cb1 = (ComputeBox1)cr; 
     43                                for(NodeGroup nodeGroup: cb1.getNodesGroups()){ 
     44                                        for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ 
     45                                                if(device.getType().equals(StandardResourceType.Outlet)){ 
     46                                                         
     47                                                        Fan fan = (Fan) device; 
     48                                                        double mair_recs = 0; 
     49                                                        double Vair_recs = 0; 
     50                                                         
     51                                                        double Vair_recs1 = 0; 
     52 
     53                                                        Vair_recs1  = fan.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     54 
     55                                                        double Vair_recs2 = 0; 
     56                                                        for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){ 
     57                                                                if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){ 
     58 
     59                                                                        Vair_recs2  = device2.getAirThroughputInterface().getRecentAirFlow().getValue(); 
     60 
     61                                                                        break; 
     62                                                                } 
     63                                                        }        
     64 
     65                                                        Vair_recs  = Math.max(Vair_recs1, Vair_recs2); 
     66 
     67                                                        mair_recs = Vair_recs * ro; 
     68                                                        mair_rack  = mair_rack + mair_recs; 
     69                                                } 
     70                                        } 
     71                                } 
     72                        } 
     73                        mair_total = mair_rack; 
     74                        Vair_total = mair_total / ro; 
     75                        airThroughput = Vair_total; 
    2776                } 
    28                 airThroughput = Vair_total; 
    2977                return airThroughput; 
    3078        } 
    31  
    3279} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java

    r1253 r1299  
    11package example.energy.coolemall; 
    22 
     3import schedframe.resources.StandardResourceType; 
     4import schedframe.resources.computing.ComputingResource; 
    35import schedframe.resources.computing.Node; 
    46import schedframe.resources.computing.Processor; 
     
    68import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    79import schedframe.resources.devices.Device; 
     10import schedframe.resources.devices.Fan; 
    811import schedframe.resources.devices.PhysicalResource; 
    912import schedframe.scheduling.manager.tasks.JobRegistry; 
    10 import test.Node_Fan_Mapping; 
    1113import example.energy.BaseEnergyEstimationPlugin; 
    1214 
    1315public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { 
    1416 
    15         //private static int OUT_START_ID = 0; 
    16         //private static int OUT_END_ID = 8; 
    17          
    1817        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, 
    1918                        PhysicalResource resource) { 
     
    3029                        //powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 
    3130                        for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    32                                 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    33                                         if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 
    34                                                 powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 
    35                                         }else 
    36                                                 powerConsumption = powerConsumption + device.getPowerInterface().getRecentPowerUsage().getValue(); 
    37                                         break; 
     31                                if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     32                                        Fan fan = (Fan) device; 
     33                                        if(fan.getChilledResources().contains(node.getFullName())){ 
     34                                                if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){ 
     35                                                        try { 
     36                                                                powerConsumption = powerConsumption + fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState())/getNumberOfWorkingNodes(fan); 
     37                                                        } catch (NoSuchFieldException e) { 
     38                                                                // TODO Auto-generated catch block 
     39                                                                e.printStackTrace(); 
     40                                                        } 
     41                                                }else 
     42                                                        powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue()/getNumberOfWorkingNodes(fan); 
     43                                        } 
    3844                                } 
    3945                        } 
    4046                }  
    4147 
    42  
    4348                return powerConsumption; 
    4449        } 
    45  
    46         /*public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
    47  
    48                 double airThroughput = 0; 
    49                 try { 
    50                         if(event.getReason() == EventReason.SIM_INIT) 
    51                                 return airThroughput; 
    52                                 //airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF); 
    53                         else { 
    54                                 airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
    55                                 //airThroughput = computingResource.getResourceCharacteristic().getDevices().get(0).getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState()); 
    56                                 //airThroughput = 0.28; 
    57                         } 
    58                 } catch (NoSuchFieldException e) { 
    59                         // TODO Auto-generated catch block 
    60                         e.printStackTrace(); 
    61                 } 
    62                  
    63                 //Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 
    64                 //ComputingResource computingResource = (ComputingResource) resource; 
    65                 //we estimate the air flow related to the outlets (nodes placed in the outlet row of RECS) 
    66                 //if(resId >= OUT_START_ID  && resId <= OUT_END_ID){ 
    67                 //      for(ComputingResource compResource: computingResource.getParent().getChildren()){ 
    68                 //              Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 
    69                 //              //we take into account the inlet air flow (nodes placed "behind" the given node) 
    70                 //              if(id - resId == 9 || id - resId == -9){ 
    71                 //                      try { 
    72                 //                              airThroughput = airThroughput + compResource.getAirThroughputInterface().getAirFlow(compResource.getAirThroughputInterface().getAirThroughputState())/2; 
    73                 //                      } catch (NoSuchFieldException e) { 
    74                 // 
    75                 //                      } 
    76                 //              } 
    77                 //      } 
    78                 //} 
    79  
    80                 return airThroughput; 
    81         }*/ 
    82  
    83         /*public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
    84                 double tout = 0; 
    85                 double tin = 21.3; 
    86                 double Q = 0.0056085; 
    87                 double C = 1004; 
    88                 double delta1 = 1.780594389/2; 
    89                 double delta2 = 2.162043729/2; 
    90                 double ro = 1.168; 
    91                 double power1 = 0; 
    92                 double power2 = 0; 
    93                  
    94                 Integer resId = Integer.parseInt(resource.getName().split("_")[1]); 
    95                  
    96                 ComputingResource computingResource = (ComputingResource) resource; 
    97                  
    98                 //we estimate outlet temperature (related to the temperature of the nodes placed in outlet row) 
    99                 for(ComputingResource compResource: computingResource.getParent().getChildren()){ 
    100                         Integer id = Integer.parseInt(compResource.getName().split("_")[1]); 
    101                         //we take into account the power of nodes placed "behind" the given nodes 
    102                         if(id - resId == 9){ 
    103                                 power1 = compResource.getPowerInterface().getRecentPowerUsage().getValue(); 
    104                                 power2 = resource.getPowerInterface().getRecentPowerUsage().getValue(); 
    105                         } else if(id - resId == -9){ 
    106                                 power1 = resource.getPowerInterface().getRecentPowerUsage().getValue(); 
    107                                 power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue(); 
     50         
     51         
     52        private int getNumberOfWorkingNodes(Device device){ 
     53                int quantity = 0; 
     54                Fan fan = (Fan) device; 
     55                for(ComputingResource compRes: device.getComputingResource().getChildren()){ 
     56                        Node node = (Node)compRes; 
     57                        if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) && fan.getChilledResources().contains(node.getFullName())){ 
     58                                quantity++; 
    10859                        } 
    10960                } 
    110                  
    111                 tout = tin + delta1 * (power1/(Q * C * ro)) +  delta2 * (power2/(Q * C * ro));; 
    112                 return tout; 
    113         }*/ 
    114          
     61                return quantity; 
     62        } 
     63 
    11564} 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java

    r1207 r1299  
    11package example.energy.coolemall; 
    22 
    3 import dcworms.schedframe.scheduling.ExecTask; 
    4 import schedframe.resources.ResourceStatus; 
    5 import schedframe.resources.computing.Core; 
    63import schedframe.resources.computing.Processor; 
    74import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     
    96import schedframe.resources.devices.PhysicalResource; 
    107import schedframe.scheduling.manager.tasks.JobRegistry; 
    11 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 
    12 import schedframe.scheduling.tasks.phases.PhaseBehaviour; 
    138import example.energy.BaseEnergyEstimationPlugin; 
    149 
     
    1813                        PhysicalResource resource) { 
    1914                 
    20                 /*double powerConsumption = 0; 
    21                 Processor cpu = (Processor)resource; 
    22                 if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) 
    23                         powerConsumption = 0; 
    24                 else { 
    25                         if(resource.getStatus() == ResourceStatus.BUSY){ 
    26                                 try { 
    27                                         powerConsumption = cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); 
    28                                 } catch (NoSuchFieldException e) { 
    29                                         Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower"); 
    30                                         if(param != null) 
    31                                                 powerConsumption = Double.valueOf(param.get(0).getContent()); 
    32                                 } 
    33                         } 
    34                         else { 
    35                                 try { 
    36                                         powerConsumption = cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); 
    37                                 } catch (NoSuchFieldException e) { 
    38                                         Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower"); 
    39                                         if(param != null) 
    40                                                 powerConsumption = 0.7 * Double.valueOf(param.get(0).getContent()); 
    41                                 } 
    42                         } 
    43                 } 
    44                 return powerConsumption;*/ 
     15                double processorLoad = 0; 
    4516                double powerConsumption = 0; 
    4617                Processor proc = (Processor)resource; 
     
    4819                        return 0; 
    4920                else { 
    50                         double processorLoad; 
    51                         double sumCoresLoad = 0; 
    52                          
    53                         int nrOfThreadsOnCpu = 1; 
    54                          
    55                         if(proc.getResourceCharacteristic().getParameters().get("product") != null){ 
    56                                 String productName = proc.getResourceCharacteristic().getParameters().get("product").get(0).getContent(); 
    57                                 if(productName.equals("Fusion G - T40N")) 
    58                                         nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Fusion_G_T40N_NR_OF_THREADS; 
    59                                 else if(productName.equals("Atom - D510")) 
    60                                         nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_D510_NR_OF_THREADS; 
    61                                 else if(productName.equals("Atom - N2600")) 
    62                                         nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_N2600_NR_OF_THREADS; 
    63                                 else if(productName.equals("Core i7 - 2715QE")) 
    64                                         nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_2715QE_NR_OF_THREADS; 
    65                                 else if(productName.equals("Core i7 - 3615QE")) 
    66                                         nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_3615QE_NR_OF_THREADS; 
    67                         } 
    6821 
    69                         for(Core core: proc.getCores()){ 
    70                                  
    71                                 if(core.getStatus().equals(ResourceStatus.BUSY)){ 
    72                                         JobRegistry jr = new JobRegistryImpl(core.getFullName()); 
    73                                         for(ExecTask task: jr.getRunningTasks()){ 
    74                                                 double cpuUsage = 100; 
    75                                                 double nrOfThreadsOfApplciation = 1; 
    76                                                 for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 
    77                                                         if(pb.getResouceName().equals("PM_CPU_Usage")){ 
    78                                                                 cpuUsage = pb.getUtilization(); 
    79                                                         } 
    80                                                         if(pb.getResouceName().equals("PM_Threads")){ 
    81                                                                 nrOfThreadsOfApplciation = pb.getUtilization(); 
    82                                                                 break; 
    83                                                         } 
    84                                                 } 
    85                                                 sumCoresLoad = sumCoresLoad + cpuUsage * (nrOfThreadsOnCpu / nrOfThreadsOfApplciation); 
    86                                         } 
     22                        /*double usedFreq = proc.getPowerInterface().getHighestPState().getFrequency(); 
     23 
     24                        JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 
     25                        for(ExecTask task: jr.getRunningTasks()){ 
     26                                String taskFreqString = task.getCurrentResourceConsumption().getReferenceHardware().get("cpu_maxfreq"); 
     27                                double taskFreq = Double.valueOf(taskFreqString); 
     28                                if(taskFreq > usedFreq){ 
     29                                        usedFreq = taskFreq; 
    8730                                } 
    8831                        } 
    89                         processorLoad = 100 * sumCoresLoad/proc.getCores().size(); 
     32                         
     33                        processorLoad = proc.getLoadInterface().getRecentUtilization().getValue(); 
     34                        //System.out.println(proc.getFullName() + "processorLoad v2: " +  processorLoad); 
     35                         
     36                        if(processorLoad != 0 && proc.getPowerInterface().getFrequency() != usedFreq) { 
     37                                proc.getPowerInterface().setFrequency(usedFreq); 
     38                        }*/ 
     39                         
     40                        processorLoad = proc.getLoadInterface().getRecentUtilization().getValue(); 
    9041                        double lowestLoadLevel = 100; 
    9142                        double highestLoadLevel = 0; 
     
    13081                                                double a; 
    13182                                                double b; 
    132                                                 if(lowerLoadLevel != higherLoadLevel) 
    133                                                 { 
     83                                                if(lowerLoadLevel != higherLoadLevel) { 
    13484                                                        powerBelow = proc.getPowerInterface().getPState().getLoadPowerUsage().get(lowerLoadLevel); 
    13585                                                        powerAbove = proc.getPowerInterface().getPState().getLoadPowerUsage().get(higherLoadLevel); 
     
    155105                        } 
    156106                } 
    157                          
    158  
    159                 powerConsumption = powerConsumption - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION; 
    160107                //System.out.println("estiamted power consumption: " + powerConsumption); 
    161108                return powerConsumption; 
  • DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java

    r1286 r1299  
    11package example.load; 
    22 
    3 import schedframe.resources.ResourceStatus; 
    4 import schedframe.resources.computing.Core; 
    53import schedframe.resources.computing.Processor; 
    64import schedframe.resources.computing.profiles.energy.EnergyEvent; 
     
    1311public class ProcessorLoadEstimationPlugin extends BaseLoadEstimationPlugin{ 
    1412 
    15         @Override 
    1613        public double estimateUtlization(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) { 
    1714                Processor proc = (Processor) resource; 
     
    2421                } 
    2522 
    26                 //for(Core core: proc.getCores()){ 
    27                          
    28                         //if(core.getStatus().equals(ResourceStatus.BUSY)){ 
    29                                 JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 
    30                                 for(ExecTask task: jr.getRunningTasks()){ 
    31                                         double cpuUsage = 1 / nrOfThreadsOnCpu; 
    32                                         double nrOfThreadsOfApplication = 1; 
    3323 
    34                                         for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 
    35                                                 if(pb.getResouceName().equals("PM_CPU_Usage")){ 
    36                                                         cpuUsage = pb.getUtilization(); 
    37                                                 } 
    38                                                 if(pb.getResouceName().equals("PM_Threads")){ 
    39                                                         nrOfThreadsOfApplication = pb.getUtilization(); 
    40                                                         break; 
    41                                                 } 
    42                                         } 
    43                                         sumCoresLoad = sumCoresLoad + cpuUsage;// * (nrOfThreadsOfApplication / nrOfThreadsOnCpu); 
     24                JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 
     25                for(ExecTask task: jr.getRunningTasks()){ 
     26                        double cpuUsage = 1 / nrOfThreadsOnCpu; 
    4427 
     28                        for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){ 
     29                                if(pb.getResouceName().equals("PM_CPU_Usage")){ 
     30                                        cpuUsage = pb.getUtilization(); 
    4531                                } 
    46                 //      } 
    47                 //} 
     32                        } 
     33                        sumCoresLoad = sumCoresLoad + cpuUsage; 
     34 
     35                } 
     36 
    4837 
    4938                double processorLoad = 100 * sumCoresLoad;       
  • DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin.java

    r1258 r1299  
    1111 
    1212import schedframe.events.scheduling.SchedulingEvent; 
     13import schedframe.exceptions.ResourceException; 
    1314import schedframe.resources.ResourceStatus; 
     15import schedframe.resources.StandardResourceType; 
     16import schedframe.resources.computing.ComputingResource; 
    1417import schedframe.resources.computing.Node; 
    15 import schedframe.resources.computing.ComputingResource; 
    16 import schedframe.resources.units.Memory; 
     18import schedframe.resources.computing.Processor; 
     19import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirThroughputStateName; 
     20import schedframe.resources.computing.profiles.energy.power.PState; 
     21import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
     22import schedframe.resources.devices.Device; 
    1723import schedframe.resources.units.ProcessingElements; 
    1824import schedframe.resources.units.ResourceUnit; 
     
    2935import schedframe.scheduling.tasks.TaskInterface; 
    3036 
    31 public class Cluster_FCFSBF_ConsolidationPlugin extends BaseLocalSchedulingPlugin { 
    32  
    33         public Cluster_FCFSBF_ConsolidationPlugin () { 
     37public class Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin extends BaseLocalSchedulingPlugin { 
     38 
     39        public Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin () { 
    3440        } 
    3541 
     
    4955                        // check all tasks in queue 
    5056 
     57                        List<Node> notSelectedNodes = resourceManager.getNodes(); 
     58                         
    5159                        for (int i = 0; i < q.size(); i++) { 
    5260                                TaskInterface<?> task = q.get(i); 
     
    5765                                        if (choosenResources  != null) { 
    5866                                                addToSchedulingPlan(plan, task, choosenResources); 
     67                                                ProcessingElements pe = (ProcessingElements) choosenResources.get(StandardResourceUnitName.PE); 
     68                                                Node node = (Node) pe.get(0).getParent(); 
     69                                                notSelectedNodes.remove(node); 
    5970                                        }  
    6071                                } 
    6172                        } 
    62  
     73                        turnOffIdleNodes(notSelectedNodes); 
    6374                        break; 
    6475                } 
     
    6677        } 
    6778         
     79        @SuppressWarnings("unchecked") 
    6880        private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(ClusterResourceManager resourceManager, TaskInterface<?> task){ 
    6981 
    7082                List<Node> nodes = resourceManager.getNodes(); 
    71                 nodes = findSuitableNodes(task, nodes); 
    72                 Collections.sort(nodes, new Comparator<Node>(){ 
    73                     public int compare(Node node1, Node node2){    
    74                         return node1.getResourceCharacteristic().getParameters().get("category").get(0).getContent().compareTo(node2.getResourceCharacteristic().getParameters().get("category").get(0).getContent()); 
    75                     } 
    76                 }); 
    77                 if(nodes.size() > 0) 
    78                 { 
    79                         Node node = nodes.get(0); 
    80                         Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(); 
    81                         List<ComputingResource> choosenResources =  new ArrayList<ComputingResource>(); 
    82                         int cpuRequest; 
     83                List<Node> availableNodes = findSuitableNodes(task, nodes); 
     84                Node node; 
     85                if(availableNodes.size() == 0){ 
    8386                        try { 
    84                                 cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 
    85                         } catch (NoSuchFieldException e) { 
    86                                 cpuRequest = 0; 
    87                         } 
    88                         for (int i = 0; i < node.getProcessors().size() && cpuRequest > 0; i++) { 
    89                                 if (node.getProcessors().get(i).getStatus() == ResourceStatus.FREE) { 
    90                                         choosenResources.add(node.getProcessors().get(i)); 
    91                                         cpuRequest--; 
    92                                 } 
    93                         } 
    94                         ProcessingElements result = new ProcessingElements(node.getFullName()); 
    95                         result.addAll(choosenResources); 
    96                         map.put(StandardResourceUnitName.PE, result); 
    97                          
    98                         int memoryRequest; 
    99                         try { 
    100                                 memoryRequest = Double.valueOf(task.getMemoryRequest()).intValue(); 
    101                         } catch (NoSuchFieldException e) { 
    102                                 memoryRequest = 0; 
    103                         } 
    104                         if (memoryRequest != 0) { 
    105                                 Memory memory; 
    106                                 try { 
    107                                         memory = new Memory(node.getMemory(), memoryRequest, memoryRequest); 
    108                                         map.put(StandardResourceUnitName.MEMORY, memory); 
    109                                 } catch (NoSuchFieldException e) { 
    110                                         return null; 
    111                                 } 
    112  
    113                         } 
    114                         return map; 
    115                 } else  
    116                         return null; 
     87                                nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE); 
     88                        } catch (ResourceException e) { 
     89                                // TODO Auto-generated catch block 
     90                                e.printStackTrace(); 
     91                        } 
     92                        Collections.sort(nodes, new PerformanceComparator()); 
     93                        node = turnOnFirstNode(nodes, task); 
     94                        if(node == null) 
     95                                return null; 
     96                }else{ 
     97                        Collections.sort(availableNodes, new PerformanceComparator()); 
     98                        node = availableNodes.get(0); 
     99                }  
     100                Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(); 
     101                List<ComputingResource> choosenResources =  new ArrayList<ComputingResource>(); 
     102                int cpuRequest; 
     103                try { 
     104                        cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 
     105                } catch (NoSuchFieldException e) { 
     106                        cpuRequest = 0; 
     107                } 
     108                for (int i = 0; i < node.getProcessors().size() && cpuRequest > 0; i++) { 
     109                        if (node.getProcessors().get(i).getStatus() == ResourceStatus.FREE) { 
     110                                choosenResources.add(node.getProcessors().get(i)); 
     111                                cpuRequest--; 
     112                        } 
     113                } 
     114                ProcessingElements result = new ProcessingElements(node.getFullName()); 
     115                result.addAll(choosenResources); 
     116                map.put(StandardResourceUnitName.PE, result); 
     117                return map; 
    117118        } 
    118119         
     
    124125                        cpuRequest = 1; 
    125126                } 
    126                 int memoryRequest; 
    127                 try { 
    128                         memoryRequest = Double.valueOf(task.getMemoryRequest()).intValue(); 
    129                 } catch (NoSuchFieldException e) { 
    130                         memoryRequest = 0; 
    131                 } 
     127 
    132128                List<Node> suitableNodes = new ArrayList<Node>(); 
    133129                for(Node node: nodes){ 
    134                         try{ 
    135                                 if(node.getFreeProcessorsNumber() >= cpuRequest && node.getFreeMemory() >= memoryRequest){ 
    136                                         suitableNodes.add(node); 
    137                                 }        
    138                         } catch (NoSuchFieldException e){ 
     130                        if(node.getFreeProcessorsNumber() >= cpuRequest){ 
     131                                suitableNodes.add(node); 
     132                        }        
     133 
     134                } 
     135                return suitableNodes; 
     136        } 
     137         
     138        private Node turnOnFirstNode(List<Node> nodes, TaskInterface<?> task){ 
     139                Node startedNode = null; 
     140 
     141                int cpuRequest; 
     142                try { 
     143                        cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 
     144                } catch (NoSuchFieldException e) { 
     145                        cpuRequest = 0; 
     146                } 
     147                 
     148                for(Node node: nodes){ 
     149                         
     150                        if (cpuRequest != 0) { 
     151 
     152                                List<Processor> processors = node.getProcessors(); 
     153                                if (processors.size() < cpuRequest) { 
     154                                        if(processors.size() == 0){ 
     155                                                if(node.getProcessors().size() < cpuRequest) 
     156                                                        continue; 
     157                                        } 
     158                                } 
    139159                                 
    140                         } 
    141                 } 
    142                 return suitableNodes; 
     160                                int freeProcessor = 0; 
     161                                for(Processor processor: processors){ 
     162                                        if(processor.getStatus() == ResourceStatus.FREE || processor.getStatus() == ResourceStatus.UNAVAILABLE) 
     163                                                freeProcessor++; 
     164                                } 
     165                                 
     166                                if(freeProcessor < cpuRequest) 
     167                                        continue; 
     168                                else { 
     169                                        for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
     170                                                if(device.getType().equals(StandardResourceType.Fan)){ 
     171                                                        device.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.ON); 
     172                                                        break; 
     173                                                } 
     174                                        } 
     175                                        node.getPowerInterface().setPowerState(StandardPowerStateName.ON); 
     176                                        startedNode = node; 
     177                                        break; 
     178                                }                                
     179                        } 
     180                } 
     181                return startedNode; 
     182        } 
     183        private void turnOffIdleNodes(List<Node> nodes){ 
     184                for(Node node : nodes){ 
     185                        int freeProcessors = 0; 
     186                        for(Processor proc: node.getProcessors()){ 
     187                                if(proc.getStatus() == ResourceStatus.FREE) 
     188                                        freeProcessors++; 
     189                        } 
     190                         
     191                        if(freeProcessors == node.getProcessors().size()) { 
     192                                for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
     193                                        if(device.getType().equals(StandardResourceType.Fan)){ 
     194                                                device.getAirThroughputInterface().setAirThroughputState(StandardAirThroughputStateName.OFF); 
     195                                                break; 
     196                                        } 
     197                                } 
     198                                node.getPowerInterface().setPowerState(StandardPowerStateName.OFF); 
     199                        } 
     200 
     201                } 
     202        } 
     203         
     204        class PerformanceComparator implements Comparator<Node>{ 
     205                 
     206            public int compare(Node node1, Node node2){     
     207                double node1Rank = Double.MIN_VALUE; 
     208                double node2Rank = Double.MIN_VALUE; 
     209 
     210                double node1Speed = 0; 
     211                for(Processor proc: node1.getProcessors()){ 
     212                        node1Speed = proc.getMIPS(); 
     213                } 
     214                node1Rank = node1Speed / node1.getProcessors().size(); 
     215                 
     216                double node2Speed = 0; 
     217                for(Processor proc: node2.getProcessors()){ 
     218                        node2Speed = proc.getMIPS(); 
     219                } 
     220                node2Rank = node2Speed / node2.getProcessors().size(); 
     221                 
     222                if(node1Rank == node2Rank){ 
     223                        node1Rank = Double.MIN_VALUE; 
     224                        node2Rank = Double.MIN_VALUE; 
     225                        PState pState; 
     226                        for(Processor proc: node1.getProcessors()){ 
     227                                if(proc.getPowerInterface() != null) { 
     228                                        pState = proc.getPowerInterface().getLowestPState(); 
     229                                        if(pState != null && pState.getFrequency() > node1Rank){ 
     230                                                node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     231                                        } 
     232                                } 
     233                        } 
     234                        for(Processor proc: node2.getProcessors()){ 
     235                                if(proc.getPowerInterface() != null) { 
     236                                        pState = proc.getPowerInterface().getLowestPState(); 
     237                                        if(pState != null && pState.getFrequency() > node2Rank){ 
     238                                                node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     239                                        } 
     240                                } 
     241                        } 
     242                } 
     243                 
     244                if(node1Rank < node2Rank) 
     245                        return 1; 
     246                else if (node1Rank > node2Rank) 
     247                        return -1; 
     248                else return 0;      
     249            } 
    143250        } 
    144251 
  • DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_DFSPlugin.java

    r574 r1299  
    2626import schedframe.scheduling.tasks.TaskInterface; 
    2727 
    28 public class FCFSBF_DFSClusterPlugin extends BaseLocalSchedulingPlugin { 
     28public class Cluster_FCFSBF_DFSPlugin extends BaseLocalSchedulingPlugin { 
    2929 
    3030        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
  • DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ExamplePlugin.java

    r1247 r1299  
    3030import schedframe.scheduling.tasks.TaskInterface; 
    3131 
    32 public class FCFSBF_ClusterPlugin extends BaseLocalSchedulingPlugin { 
     32public class Cluster_FCFSBF_ExamplePlugin extends BaseLocalSchedulingPlugin { 
    3333 
    3434        public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry, 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP.java

    r1258 r1299  
    1717import schedframe.resources.computing.Processor; 
    1818import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     19import schedframe.resources.computing.profiles.energy.power.PState; 
    1920import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    2021import schedframe.resources.devices.Device; 
     22import schedframe.resources.devices.Fan; 
    2123import schedframe.resources.units.ProcessingElements; 
    2224import schedframe.resources.units.ResourceUnit; 
     
    3739import gridsim.dcworms.DCWormsTags; 
    3840 
    39 public class CB1_FCFS_Consolidation_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
    40  
    41          
    42         public CB1_FCFS_Consolidation_NodePowMan_SP () { 
     41public class CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
     42 
     43         
     44        public CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP () { 
    4345                Node_Fan_Mapping.init(); 
    4446        } 
     
    221223                                else { 
    222224                                        for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    223                                                 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    224                                                         device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
    225                                                         break; 
     225                                                if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     226                                                        Fan fan = (Fan) device; 
     227                                                        if(fan.getChilledResources().contains(node.getFullName())){ 
     228                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
     229                                                        } 
    226230                                                } 
    227231                                        } 
     
    252256                        if(freeCores == proc.getCores().size()) { 
    253257                                for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    254                                         if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    255                                                 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
    256                                                 break; 
     258                                         
     259                                        if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     260                                                Fan fan = (Fan) device; 
     261                                                int nrOfChilldedNodes = fan.getChilledResources().size(); 
     262                                                if(fan.getChilledResources().contains(node.getFullName())){ 
     263                                                        if(nrOfChilldedNodes == 1) 
     264                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     265                                                        else { 
     266                                                                for(String chilledNode: fan.getChilledResources()){ 
     267                                                                        for(Node node2: nodes){ 
     268                                                                                if(chilledNode.equals(node2.getFullName())){ 
     269                                                                                        if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     270                                                                                                nrOfChilldedNodes--; 
     271                                                                                        } 
     272                                                                                } 
     273                                                                        } 
     274                                                                } 
     275                                                                if(nrOfChilldedNodes <= 1) 
     276                                                                        fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     277                                                        } 
     278 
     279                                                } 
    257280                                        } 
    258281                                } 
     
    329352        } 
    330353         
     354        class PerformanceComparator implements Comparator<Node>{ 
     355                 
     356            public int compare(Node node1, Node node2){     
     357                double node1Rank = Double.MIN_VALUE; 
     358                double node2Rank = Double.MIN_VALUE; 
     359 
     360                double node1Speed = 0; 
     361                for(Processor proc: node1.getProcessors()){ 
     362                        node1Speed = node1Speed + proc.getMIPS(); 
     363                } 
     364                node1Rank = node1Speed / node1.getProcessors().size(); 
     365                 
     366                double node2Speed = 0; 
     367                for(Processor proc: node2.getProcessors()){ 
     368                        node2Speed = node2Speed + proc.getMIPS(); 
     369                } 
     370                node2Rank = node2Speed / node2.getProcessors().size(); 
     371                 
     372                if(node1Rank == node2Rank){ 
     373                        node1Rank = Double.MIN_VALUE; 
     374                        node2Rank = Double.MIN_VALUE; 
     375                        PState pState; 
     376                        for(Processor proc: node1.getProcessors()){ 
     377                                if(proc.getPowerInterface() != null) { 
     378                                        pState = proc.getPowerInterface().getLowestPState(); 
     379                                        if(pState != null && pState.getFrequency() > node1Rank){ 
     380                                                node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     381                                        } 
     382                                } 
     383                        } 
     384                        for(Processor proc: node2.getProcessors()){ 
     385                                if(proc.getPowerInterface() != null) { 
     386                                        pState = proc.getPowerInterface().getLowestPState(); 
     387                                        if(pState != null && pState.getFrequency() > node2Rank){ 
     388                                                node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     389                                        } 
     390                                } 
     391                        } 
     392                } 
     393                 
     394                if(node1Rank < node2Rank) 
     395                        return 1; 
     396                else if (node1Rank > node2Rank) 
     397                        return -1; 
     398                else return 0;      
     399            } 
     400        }        
    331401} 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_SP.java

    r1258 r1299  
    1313import schedframe.resources.computing.Core; 
    1414import schedframe.resources.computing.Node; 
     15import schedframe.resources.computing.Processor; 
     16import schedframe.resources.computing.profiles.energy.power.PState; 
    1517import schedframe.resources.units.ProcessingElements; 
    1618import schedframe.resources.units.ResourceUnit; 
     
    3133import gridsim.dcworms.DCWormsTags; 
    3234 
    33 public class CB1_FCFS_Consolidation_SP extends BaseLocalSchedulingPlugin { 
    34  
    35          
    36         public CB1_FCFS_Consolidation_SP () { 
     35public class CB1_FCFS_ConsolidationHighPerf_SP extends BaseLocalSchedulingPlugin { 
     36 
     37         
     38        public CB1_FCFS_ConsolidationHighPerf_SP () { 
    3739                Node_Fan_Mapping.init(); 
    3840        } 
     
    208210        } 
    209211         
     212        class PerformanceComparator implements Comparator<Node>{ 
     213                 
     214            public int compare(Node node1, Node node2){     
     215                double node1Rank = Double.MIN_VALUE; 
     216                double node2Rank = Double.MIN_VALUE; 
     217 
     218                double node1Speed = 0; 
     219                for(Processor proc: node1.getProcessors()){ 
     220                        node1Speed = node1Speed + proc.getMIPS(); 
     221                } 
     222                node1Rank = node1Speed / node1.getProcessors().size(); 
     223                 
     224                double node2Speed = 0; 
     225                for(Processor proc: node2.getProcessors()){ 
     226                        node2Speed = node2Speed + proc.getMIPS(); 
     227                } 
     228                node2Rank = node2Speed / node2.getProcessors().size(); 
     229                 
     230                if(node1Rank == node2Rank){ 
     231                        node1Rank = Double.MIN_VALUE; 
     232                        node2Rank = Double.MIN_VALUE; 
     233                        PState pState; 
     234                        for(Processor proc: node1.getProcessors()){ 
     235                                if(proc.getPowerInterface() != null) { 
     236                                        pState = proc.getPowerInterface().getLowestPState(); 
     237                                        if(pState != null && pState.getFrequency() > node1Rank){ 
     238                                                node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     239                                        } 
     240                                } 
     241                        } 
     242                        for(Processor proc: node2.getProcessors()){ 
     243                                if(proc.getPowerInterface() != null) { 
     244                                        pState = proc.getPowerInterface().getLowestPState(); 
     245                                        if(pState != null && pState.getFrequency() > node2Rank){ 
     246                                                node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     247                                        } 
     248                                } 
     249                        } 
     250                } 
     251                 
     252                if(node1Rank < node2Rank) 
     253                        return 1; 
     254                else if (node1Rank > node2Rank) 
     255                        return -1; 
     256                else return 0;      
     257            } 
     258        } 
     259         
    210260} 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationLowPower_NodePowMan_SP.java

    r1258 r1299  
    1717import schedframe.resources.computing.Processor; 
    1818import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     19import schedframe.resources.computing.profiles.energy.power.PState; 
    1920import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    2021import schedframe.resources.devices.Device; 
     22import schedframe.resources.devices.Fan; 
    2123import schedframe.resources.units.ProcessingElements; 
    2224import schedframe.resources.units.ResourceUnit; 
     
    3739import gridsim.dcworms.DCWormsTags; 
    3840 
    39 public class CB1_FCFS_ConsolidationAtom_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
    40  
    41          
    42         public CB1_FCFS_ConsolidationAtom_NodePowMan_SP () { 
     41public class CB1_FCFS_ConsolidationLowPower_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
     42 
     43         
     44        public CB1_FCFS_ConsolidationLowPower_NodePowMan_SP () { 
    4345                Node_Fan_Mapping.init(); 
    4446        } 
     
    221223                                else { 
    222224                                        for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    223                                                 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    224                                                         device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
    225                                                         break; 
     225                                                if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     226                                                        Fan fan = (Fan) device; 
     227                                                        if(fan.getChilledResources().contains(node.getFullName())){ 
     228                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
     229                                                        } 
    226230                                                } 
    227231                                        } 
     
    252256                        if(freeCores == proc.getCores().size()) { 
    253257                                for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    254                                         if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    255                                                 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
    256                                                 break; 
     258                                         
     259                                        if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     260                                                Fan fan = (Fan) device; 
     261                                                int nrOfChilldedNodes = fan.getChilledResources().size(); 
     262                                                if(fan.getChilledResources().contains(node.getFullName())){ 
     263                                                        if(nrOfChilldedNodes == 1) 
     264                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     265                                                        else { 
     266                                                                for(String chilledNode: fan.getChilledResources()){ 
     267                                                                        for(Node node2: nodes){ 
     268                                                                                if(chilledNode.equals(node2.getFullName())){ 
     269                                                                                        if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     270                                                                                                nrOfChilldedNodes--; 
     271                                                                                        } 
     272                                                                                } 
     273                                                                        } 
     274                                                                } 
     275                                                                if(nrOfChilldedNodes <= 1) 
     276                                                                        fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     277                                                        } 
     278 
     279                                                } 
    257280                                        } 
    258281                                } 
     
    329352        } 
    330353         
     354        class PowerComparator implements Comparator<Node>{ 
     355                 
     356            public int compare(Node node1, Node node2){     
     357                double node1Rank = Double.MAX_VALUE; 
     358                double node2Rank = Double.MAX_VALUE; 
     359 
     360                PState pState; 
     361                for(Processor proc: node1.getProcessors()){ 
     362                        if(proc.getPowerInterface() != null) { 
     363                                pState = proc.getPowerInterface().getLowestPState(); 
     364                                if(pState != null && pState.getPower() < node1Rank){ 
     365                                        node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     366                                } 
     367                        } 
     368                } 
     369                for(Processor proc: node2.getProcessors()){ 
     370                        if(proc.getPowerInterface() != null) { 
     371                                pState = proc.getPowerInterface().getLowestPState(); 
     372                                if(pState != null && pState.getPower() < node2Rank){ 
     373                                        node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     374                                } 
     375                        } 
     376                } 
     377                 
     378                if(node1Rank > node2Rank) 
     379                        return 1; 
     380                else if (node1Rank < node2Rank) 
     381                        return -1; 
     382                else return 0;      
     383            } 
     384        } 
    331385} 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP.java

    r1258 r1299  
    1616import schedframe.resources.computing.Node; 
    1717import schedframe.resources.computing.Processor; 
     18import schedframe.resources.computing.Rack; 
    1819import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName; 
     20import schedframe.resources.computing.profiles.energy.power.PState; 
    1921import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    2022import schedframe.resources.devices.Device; 
     23import schedframe.resources.devices.Fan; 
    2124import schedframe.resources.units.ProcessingElements; 
    2225import schedframe.resources.units.ResourceUnit; 
     
    3740import gridsim.dcworms.DCWormsTags; 
    3841 
    39 public class CB2_FCFS_Consolidation_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
    40  
    41          
    42         public CB2_FCFS_Consolidation_NodePowMan_SP () { 
     42public class CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP extends BaseLocalSchedulingPlugin { 
     43 
     44         
     45        public CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP () { 
    4346                Node_Fan_Mapping.init(); 
    4447        } 
     
    98101                                e.printStackTrace(); 
    99102                        } 
    100                         Collections.sort(nodes, new FavourableNodeComparator()); 
     103                        Collections.sort(nodes, new PerformanceComparator()); 
    101104                        node = turnOnFirstNode(nodes, task); 
    102105                        if(node == null) 
    103106                                return null; 
    104107                } else { 
    105                         Collections.sort(avNodes, new FavourableNodeComparator()); 
     108                        Collections.sort(avNodes, new PerformanceComparator()); 
    106109                        node = findTheMostLoadedNode(avNodes);                   
    107110                } 
     
    221224                                else { 
    222225                                        for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    223                                                 if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    224                                                         device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
    225                                                         break; 
     226                                                if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     227                                                        Fan fan = (Fan) device; 
     228                                                        if(fan.getChilledResources().contains(node.getFullName())){ 
     229                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("2")); 
     230                                                        } 
    226231                                                } 
    227232                                        } 
     
    252257                        if(freeCores == proc.getCores().size()) { 
    253258                                for(Device device: node.getParent().getResourceCharacteristic().getDevices()){ 
    254                                         if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){ 
    255                                                 device.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
    256                                                 break; 
    257                                         } 
     259                                         
     260                                        if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){ 
     261                                                Fan fan = (Fan) device; 
     262                                                int nrOfChilldedNodes = fan.getChilledResources().size(); 
     263                                                if(fan.getChilledResources().contains(node.getFullName())){ 
     264                                                        if(nrOfChilldedNodes == 1) 
     265                                                                fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     266                                                        else { 
     267                                                                for(String chilledNode: fan.getChilledResources()){ 
     268                                                                        for(Node node2: nodes){ 
     269                                                                                if(chilledNode.equals(node2.getFullName())){ 
     270                                                                                        if(node2.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){ 
     271                                                                                                nrOfChilldedNodes--; 
     272                                                                                        } 
     273                                                                                } 
     274                                                                        } 
     275                                                                } 
     276                                                                if(nrOfChilldedNodes <= 1) 
     277                                                                        fan.getAirThroughputInterface().setAirThroughputState(new UserAirThroughputStateName("1")); 
     278                                                        } 
     279 
     280                                                } 
     281                                        } 
     282                                         
    258283                                } 
    259284                                node.getPowerInterface().setPowerState(StandardPowerStateName.OFF); 
    260285                        } 
    261  
    262286                } 
    263287        } 
     
    325349                else if (node1Rank < node2Rank) 
    326350                        return -1; 
     351                else { 
     352                        //return 0; 
     353                        double node1LoadRank = Double.MIN_VALUE; 
     354                        double node2LoadRank = Double.MIN_VALUE; 
     355                         
     356                        try { 
     357                                Rack rack1 = (Rack) node1.getParent().getParent(); 
     358                                        JobRegistry jr1 = new JobRegistryImpl(rack1.getFullName()); 
     359                                node1LoadRank = jr1.getRunningTasks().size();  
     360                                 
     361                                Rack rack2 = (Rack) node2.getParent().getParent(); 
     362                                        JobRegistry jr2 = new JobRegistryImpl(rack2.getFullName()); 
     363                                node2LoadRank = jr2.getRunningTasks().size();  
     364                                if(node1LoadRank < node2LoadRank) 
     365                                        return 1; 
     366                                else if (node1LoadRank > node2LoadRank) 
     367                                        return -1; 
     368                                else return 0; 
     369                        } catch (Exception e){ 
     370                                return 0; 
     371                        } 
     372                } 
     373            } 
     374        } 
     375         
     376        class PerformanceComparator implements Comparator<Node>{ 
     377                 
     378            public int compare(Node node1, Node node2){     
     379                double node1Rank = Double.MIN_VALUE; 
     380                double node2Rank = Double.MIN_VALUE; 
     381 
     382                double node1Speed = 0; 
     383                for(Processor proc: node1.getProcessors()){ 
     384                        node1Speed = node1Speed + proc.getMIPS(); 
     385                } 
     386                node1Rank = node1Speed / node1.getProcessors().size(); 
     387                 
     388                double node2Speed = 0; 
     389                for(Processor proc: node2.getProcessors()){ 
     390                        node2Speed = node2Speed + proc.getMIPS(); 
     391                } 
     392                node2Rank = node2Speed / node2.getProcessors().size(); 
     393                 
     394                if(node1Rank == node2Rank){ 
     395                        node1Rank = Double.MIN_VALUE; 
     396                        node2Rank = Double.MIN_VALUE; 
     397                        PState pState; 
     398                        for(Processor proc: node1.getProcessors()){ 
     399                                if(proc.getPowerInterface() != null) { 
     400                                        pState = proc.getPowerInterface().getLowestPState(); 
     401                                        if(pState != null && pState.getFrequency() > node1Rank){ 
     402                                                node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     403                                        } 
     404                                } 
     405                        } 
     406                        for(Processor proc: node2.getProcessors()){ 
     407                                if(proc.getPowerInterface() != null) { 
     408                                        pState = proc.getPowerInterface().getLowestPState(); 
     409                                        if(pState != null && pState.getFrequency() > node2Rank){ 
     410                                                node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     411                                        } 
     412                                } 
     413                        } 
     414                } 
     415                 
     416                if(node1Rank < node2Rank) 
     417                        return 1; 
     418                else if (node1Rank > node2Rank) 
     419                        return -1; 
    327420                else return 0;      
    328421            } 
    329         } 
    330          
     422        }        
    331423} 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_SP.java

    r1258 r1299  
    1313import schedframe.resources.computing.Core; 
    1414import schedframe.resources.computing.Node; 
     15import schedframe.resources.computing.Processor; 
     16import schedframe.resources.computing.Rack; 
     17import schedframe.resources.computing.profiles.energy.power.PState; 
    1518import schedframe.resources.units.ProcessingElements; 
    1619import schedframe.resources.units.ResourceUnit; 
     
    3134import gridsim.dcworms.DCWormsTags; 
    3235 
    33 public class CB2_FCFS_Consolidation_SP extends BaseLocalSchedulingPlugin { 
    34  
    35          
    36         public CB2_FCFS_Consolidation_SP () { 
     36public class CB2_FCFS_ConsolidationHighPerf_SP extends BaseLocalSchedulingPlugin { 
     37 
     38         
     39        public CB2_FCFS_ConsolidationHighPerf_SP () { 
    3740                Node_Fan_Mapping.init(); 
    3841        } 
     
    7073        } 
    7174 
    72         @SuppressWarnings("unchecked") 
    7375        private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution( 
    7476                        ClusterResourceManager resourceManager, TaskInterface<?> task) { 
     
    7880                List<Node> nodes = resourceManager.getNodes(); 
    7981                List<Node> avNodes = filterNodes(nodes, task); 
    80                 Collections.sort(avNodes, new FavourableNodeComparator()); 
     82                Collections.sort(avNodes, new PerformanceComparator()); 
    8183                if(avNodes.size() == 0) 
    8284                        return null; 
     
    205207                else if (node1Rank < node2Rank) 
    206208                        return -1; 
     209                else { 
     210                        //return 0; 
     211                        double node1LoadRank = Double.MIN_VALUE; 
     212                        double node2LoadRank = Double.MIN_VALUE; 
     213                         
     214                        try { 
     215                                Rack rack1 = (Rack) node1.getParent().getParent(); 
     216                                        JobRegistry jr1 = new JobRegistryImpl(rack1.getFullName()); 
     217                                node1LoadRank = jr1.getRunningTasks().size();  
     218                                 
     219                                Rack rack2 = (Rack) node2.getParent().getParent(); 
     220                                        JobRegistry jr2 = new JobRegistryImpl(rack2.getFullName()); 
     221                                node2LoadRank = jr2.getRunningTasks().size();  
     222                                if(node1LoadRank < node2LoadRank) 
     223                                        return 1; 
     224                                else if (node1LoadRank > node2LoadRank) 
     225                                        return -1; 
     226                                else return 0; 
     227                        } catch (Exception e){ 
     228                                return 0; 
     229                        } 
     230    
     231                } 
     232            } 
     233        } 
     234 
     235        class PerformanceComparator implements Comparator<Node>{ 
     236                 
     237            public int compare(Node node1, Node node2){     
     238                double node1Rank = Double.MIN_VALUE; 
     239                double node2Rank = Double.MIN_VALUE; 
     240 
     241                double node1Speed = 0; 
     242                for(Processor proc: node1.getProcessors()){ 
     243                        node1Speed = node1Speed + proc.getMIPS(); 
     244                } 
     245                node1Rank = node1Speed / node1.getProcessors().size(); 
     246                 
     247                double node2Speed = 0; 
     248                for(Processor proc: node2.getProcessors()){ 
     249                        node2Speed = node2Speed + proc.getMIPS(); 
     250                } 
     251                node2Rank = node2Speed / node2.getProcessors().size(); 
     252                 
     253                if(node1Rank == node2Rank){ 
     254                        node1Rank = Double.MIN_VALUE; 
     255                        node2Rank = Double.MIN_VALUE; 
     256                        PState pState; 
     257                        for(Processor proc: node1.getProcessors()){ 
     258                                if(proc.getPowerInterface() != null) { 
     259                                        pState = proc.getPowerInterface().getLowestPState(); 
     260                                        if(pState != null && pState.getFrequency() > node1Rank){ 
     261                                                node1Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     262                                        } 
     263                                } 
     264                        } 
     265                        for(Processor proc: node2.getProcessors()){ 
     266                                if(proc.getPowerInterface() != null) { 
     267                                        pState = proc.getPowerInterface().getLowestPState(); 
     268                                        if(pState != null && pState.getFrequency() > node2Rank){ 
     269                                                node2Rank = proc.getPowerInterface().getLowestPState().getFrequency(); 
     270                                        } 
     271                                } 
     272                        } 
     273                } 
     274                 
     275                if(node1Rank < node2Rank) 
     276                        return 1; 
     277                else if (node1Rank > node2Rank) 
     278                        return -1; 
    207279                else return 0;      
    208280            } 
    209         } 
    210          
     281        }        
    211282} 
  • DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_SP.java

    r1258 r1299  
    88 
    99import schedframe.events.scheduling.SchedulingEvent; 
     10import schedframe.exceptions.ResourceException; 
     11import schedframe.resources.ResourceStatus; 
     12import schedframe.resources.StandardResourceType; 
    1013import schedframe.resources.computing.ComputingResource; 
     14import schedframe.resources.computing.Core; 
    1115import schedframe.resources.computing.Node; 
    12 import schedframe.resources.computing.Processor; 
    1316import schedframe.resources.units.ProcessingElements; 
    1417import schedframe.resources.units.ResourceUnit; 
     
    1821import schedframe.scheduling.manager.resources.ResourceManager; 
    1922import schedframe.scheduling.manager.tasks.JobRegistry; 
    20 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 
    2123import schedframe.scheduling.plan.SchedulingPlanInterface; 
    2224import schedframe.scheduling.plan.impl.SchedulingPlan; 
     
    2527import schedframe.scheduling.queue.TaskQueueList; 
    2628import schedframe.scheduling.tasks.TaskInterface; 
    27 import schedframe.scheduling.tasks.phases.PhaseBehaviour; 
    2829import test.Node_Fan_Mapping; 
    29 import dcworms.schedframe.scheduling.ExecTask; 
    30 import example.energy.coolemall.CoolEmAllTestbedMeasurements; 
    3130import example.localplugin.BaseLocalSchedulingPlugin; 
    3231import gridsim.dcworms.DCWormsTags; 
     
    6261                                if (task.getStatus() == DCWormsTags.READY) { 
    6362 
     63                                        try { 
     64                                                if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0) 
     65                                                        break; 
     66                                        } catch (ResourceException e) { 
     67                                                // TODO Auto-generated catch block 
     68                                                e.printStackTrace(); 
     69                                        } 
    6470                                        Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task); 
    6571                                        if (choosenResources != null) { 
     
    7076                        break; 
    7177                } 
     78                 
    7279                return plan; 
    7380        } 
    74  
    7581        @SuppressWarnings("unchecked") 
    7682        private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution( 
     
    94100 
    95101                        List<ComputingResource> choosenResources = new ArrayList<ComputingResource>();   
    96                          
    97                         choosenResources.add(node.getProcessors().get(0)); 
     102                        List<Core> cores = node.getCores();                      
     103                        for (int i = 0; i < cores.size() && cpuRequest > 0; i++) { 
     104                                if (cores.get(i).getStatus() == ResourceStatus.FREE) { 
     105                                        choosenResources.add(cores.get(i)); 
     106                                        cpuRequest--; 
     107                                } 
     108                        } 
     109                        if (cpuRequest > 0) { 
     110                                return null; 
     111                        } 
     112 
     113                        //choosenResources.add(node.getProcessors().get(0)); 
    98114                        ProcessingElements pe = new ProcessingElements(); 
    99115                        pe.addAll(choosenResources); 
     
    116132                        if (cpuRequest != 0) { 
    117133 
    118                                 double sumLoad = 0; 
    119                                 Processor proc = node.getProcessors().get(0); 
    120                                 JobRegistry jr = new JobRegistryImpl(proc.getFullName()); 
    121                                 for(ExecTask execTask: jr.getRunningTasks()){ 
    122                                         double cpuUsage = 100; 
    123                                         double nrOfThreadsOfApplciation = 1; 
    124                                         for(PhaseBehaviour pb: execTask.getCurrentResourceConsumption().getBehaviourList()){ 
    125                                                 if(pb.getResouceName().equals("PM_CPU_Usage")){ 
    126                                                         cpuUsage = pb.getUtilization(); 
    127                                                 } 
    128                                                 if(pb.getResouceName().equals("PM_Threads")){ 
    129                                                         nrOfThreadsOfApplciation = pb.getUtilization(); 
    130                                                         break; 
    131                                                 } 
     134                                List<Core> cores = node.getCores(); 
     135                                if (cores.size() < cpuRequest) { 
     136                                        if(cores.size() == 0){ 
     137                                                if(node.getProcessors().size() < cpuRequest) 
     138                                                        continue; 
    132139                                        } 
    133                                         sumLoad = sumLoad + nrOfThreadsOfApplciation; 
    134140                                } 
    135141 
    136                                 int nrOfThreadsOnCpu = 1; 
     142                                int freeCores = 0; 
     143                                for(Core core: cores){ 
     144                                        if(core.getStatus() == ResourceStatus.FREE) 
     145                                                freeCores++; 
     146                                } 
    137147                                 
    138                                 if(proc.getResourceCharacteristic().getParameters().get("product") != null){ 
    139                                         String productName = proc.getResourceCharacteristic().getParameters().get("product").get(0).getContent(); 
    140                                         if(productName.equals("Fusion G - T40N")) 
    141                                                 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Fusion_G_T40N_NR_OF_THREADS; 
    142                                         else if(productName.equals("Atom - D510")) 
    143                                                 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_D510_NR_OF_THREADS/2; 
    144                                         else if(productName.equals("Atom - N2600")) 
    145                                                 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_N2600_NR_OF_THREADS/2; 
    146                                         else if(productName.equals("Core i7 - 2715QE")) 
    147                                                 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_2715QE_NR_OF_THREADS/2; 
    148                                         else if(productName.equals("Core i7 - 3615QE")) 
    149                                                 nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_3615QE_NR_OF_THREADS/2; 
    150                                 } 
    151  
    152                                 System.out.println(sumLoad + ":" + nrOfThreadsOnCpu + ";" + cpuRequest); 
    153                                 int freeThreads = (int) (nrOfThreadsOnCpu - sumLoad) ; 
    154  
    155                                  
    156                                 if(freeThreads < cpuRequest) 
     148                                if(freeCores < cpuRequest) 
    157149                                        continue; 
    158150                                 
     
    167159                return nodes.get(rand.nextInt(nodes.size())); 
    168160        } 
    169  
    170161         
    171162} 
Note: See TracChangeset for help on using the changeset viewer.