Ignore:
Timestamp:
03/19/14 18:22:27 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/example/energy/coolemall
Files:
9 edited

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; 
Note: See TracChangeset for help on using the changeset viewer.