Changeset 1299 for DCWoRMS/branches


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

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java

    r1207 r1299  
    22 
    33 
    4 import example.energy.coolemall.CoolEmAllTestbedMeasurements; 
    54import gridsim.GridSim; 
    65import gridsim.dcworms.DCWormsTags; 
     
    3635import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile; 
    3736import schedframe.scheduling.tasks.requirements.ResourceParameterName; 
    38 import simulator.stats.implementation.ResourceUsefulWorkStats; 
    3937 
    4038/** 
     
    213211                for (ComputingResource resource : pes) { 
    214212 
     213                                LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 
     214                                toExamine.push(resource); 
     215 
     216                                while (!toExamine.isEmpty()) { 
     217                                        ComputingResource compResource = toExamine.pop(); 
     218                                        List<ComputingResource> resources = compResource.getChildren(); 
     219                                        int numberOfRes = resources.size(); 
     220                                        for (int i = 0; i < numberOfRes; i++) { 
     221                                                ComputingResource resourceChild = resources.get(i); 
     222                                                trackResource(resourceChild.getFullName()); 
     223                                                toExamine.addLast(resourceChild); 
     224                                        } 
     225                                } 
     226 
     227                         
    215228                        trackResource(resource.getFullName()); 
    216229                         
     
    477490                                        String productName = resource.getResourceCharacteristic().getParameters().get("product").get(0).getContent(); 
    478491                                        if(productName.equals("Fusion G - T40N")) 
    479                                                 preparePhases("amdf"); 
     492                                                preparePhases("Fusion G - T40N"); 
    480493                                        else if(productName.equals("Atom - D510")) 
    481                                                 preparePhases("atom64"); 
     494                                                preparePhases("Atom - D510"); 
    482495                                        else if(productName.equals("Atom - N2600")) 
    483                                                 preparePhases("atom64"); 
     496                                                preparePhases("Atom - N2600"); 
    484497                                        else if(productName.equals("Core i7 - 2715QE")) 
    485                                                 preparePhases("i7-2715QE"); 
     498                                                preparePhases("Core i7 - 2715QE"); 
    486499                                        else if(productName.equals("Core i7 - 3615QE")) 
    487                                                 preparePhases("i7-3615QE"); 
     500                                                preparePhases("Core i7 - 3615QE"); 
     501                                        else if(productName.equals("Xeon E5-2630")) 
     502                                                preparePhases("Xeon E5-2630"); 
     503                                        else if(productName.equals("Xeon E5-2603")) 
     504                                                preparePhases("Xeon E5-2603"); 
     505                                        else if(productName.equals("Xeon L5310")) 
     506                                                preparePhases("Xeon L5310"); 
    488507                                } 
    489508                                return true; 
  • DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    r1207 r1299  
    33import gridsim.GridSimTags; 
    44import gridsim.dcworms.DCWormsTags; 
     5import gridsim.dcworms.filter.ResourceEventFilter; 
    56 
    67import java.util.ArrayList; 
     
    2425import schedframe.resources.computing.profiles.energy.EnergyEventType; 
    2526import schedframe.resources.computing.profiles.energy.EnergyExtension; 
     27import schedframe.resources.computing.profiles.load.LoadExtension; 
     28import schedframe.resources.computing.profiles.load.ResourceLoadCalendar; 
     29import schedframe.resources.computing.profiles.load.TimestampUtilization; 
     30import schedframe.resources.computing.profiles.load.ui.LoadInterface; 
    2631import schedframe.resources.computing.properties.DefaultPropertiesBuilder; 
    2732import schedframe.resources.computing.properties.PropertiesDirector; 
     
    3439import schedframe.resources.devices.PhysicalResource; 
    3540import schedframe.scheduling.Scheduler; 
     41import simulator.DataCenterWorkloadSimulator; 
    3642 
    3743public class ComputingResource extends PhysicalResource{ 
     
    5157                this.extensionList = new ExtensionListImpl(1); 
    5258                initCharacteristics(resDesc); 
     59                accept(new LoadExtension(resDesc.getLoadProfile(), this)); 
    5360                accept(new EnergyExtension.Builder().resource(this).powerProfile(resDesc.getPowerProfile()).airFlowProfile(resDesc.getAirThroughputProfile()).thermalProfile(resDesc.getThermalProfile()).build());      
    5461        } 
     
    6774        public void setParent(ComputingResource newParent) { 
    6875                parent = newParent; 
     76                if(this.getLoadInterface().getLoadCalendar().getLoadDistribution().size() == 0){ 
     77                        this.getLoadInterface().getLoadCalendar().getLoadDistribution().addAll(parent.getLoadInterface().getLoadCalendar().getLoadDistribution()); 
     78                } 
    6979        } 
    7080 
     
    220230                public void handleResourceEvent(Event event){ 
    221231                        if (extensionList != null) { 
    222                                 for (Extension extension : extensionList) { 
     232                                for (Extension extension: extensionList) { 
    223233                                        if (extension.supportsEvent(event)) { 
    224234                                                extension.handleEvent(event); 
     
    227237                                 
    228238                                for (Device device: ((ComputingResourceCharacteristics)resourceCharacteristic).getDevices()) { 
    229                                         for (Extension extension : device.getExtensionList()) { 
     239                                        for (Extension extension: device.getExtensionList()) { 
    230240                                                if (extension.supportsEvent(event)) { 
    231                                                         //extension.handleEvent(event); 
     241                                                        extension.handleEvent(event); 
    232242                                                } 
    233243                                        } 
     
    242252                        if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){ 
    243253                                String src = event.getSource() != null ? event.getSource() : name; 
     254                                ResourceEventFilter filter = new ResourceEventFilter(src.hashCode(), DCWormsTags.UPDATE_PROCESSING); 
     255                                scheduler.sim_cancel(filter, null); 
    244256                                scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src); 
    245257                        } else if(parent != null) 
     
    274286                rec.execute(event); 
    275287                 
     288                LoadInterface li = getLoadInterface(); 
     289                if(li != null){ 
     290                        ResourceLoadCalendar rlc = li.getLoadCalendar(); 
     291                        LinkedList<TimestampUtilization> ll = rlc.getLoadDistribution(); 
     292                        for(TimestampUtilization tu: ll){ 
     293                                DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getStartTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName())); 
     294                                DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getEndTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName())); 
     295                        }                                        
     296                } 
    276297                //alternative way 
    277298                //getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller")); 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/coolemall/NodeGroup.java

    r1247 r1299  
    11package schedframe.resources.computing.coolemall; 
    22 
     3import java.util.ArrayList; 
    34import java.util.List; 
    45 
     
    89import schedframe.resources.computing.Processor; 
    910import schedframe.resources.computing.description.ComputingResourceDescription; 
     11import schedframe.resources.computing.description.ResourceDescription; 
     12import schedframe.resources.devices.Device; 
     13import schedframe.resources.devices.Fan; 
     14import test.Node_Fan_Mapping; 
    1015 
    1116public class NodeGroup extends ComputingResource{ 
     
    1318        public NodeGroup(ComputingResourceDescription resDesc) { 
    1419                super(resDesc); 
     20                initNodes_FansMapping(resDesc); 
    1521        } 
    1622 
     
    2531        } 
    2632 
     33         
     34        private void initNodes_FansMapping(ComputingResourceDescription resDesc){ 
     35                Node_Fan_Mapping.init(); 
     36                for(Device dev: this.getResourceCharacteristic().getDevices()){ 
     37                        if(dev.getType().equals(StandardResourceType.Fan) || dev.getType().equals(StandardResourceType.Inlet) | dev.getType().equals(StandardResourceType.Outlet)){ 
     38                                Fan fan = (Fan) dev; 
     39                                List<String> chilledResources = new ArrayList<String>(); 
     40                                for(ResourceDescription nodeDesc: resDesc.getChildren()){ 
     41                                        String nodeName = this.getFullName() + "/" + nodeDesc.getId(); 
     42                                        if(!Node_Fan_Mapping.getNode_fan().containsKey(nodeName)){ 
     43                                                chilledResources.add(nodeName); 
     44                                        } else if(Node_Fan_Mapping.getNode_fan().get(nodeName).equals(fan.getFullName())){ 
     45                                                chilledResources.add(nodeName); 
     46                                        } else { 
     47                                                //if mapping present but there is no match do nothing 
     48                                        } 
     49                                } 
     50                                fan.setChilledResources(chilledResources); 
     51                        } 
     52                } 
     53        } 
    2754} 
  • DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java

    r1281 r1299  
    2020                super(resource, pp); 
    2121                currentPowerState = StandardPowerStateName.ON; 
    22                 currentPState = getHighestPState(); 
     22                currentPState = getLowestPState(); 
    2323        } 
    2424         
  • DCWoRMS/branches/coolemall/src/simulator/ConfigurationOptions.java

    r1279 r1299  
    88import java.util.PropertyResourceBundle; 
    99import java.util.ResourceBundle; 
     10 
     11import test.CoolingModelData; 
    1012 
    1113/** 
     
    189191        public String [] resForUtilizationChart; 
    190192         
    191         public static double pressureDrop; 
    192         public static double outletRoomAirTempeature; 
    193         public static double inletRoomAirTempeature; 
    194         public static double ambientAirTempeature; 
    195         public static double airFlowVolume; 
    196         public static double alpha 
    197         ; 
     193        public double pressureDrop; 
     194        public double outletRoomAirTempeature; 
     195        public double inletRoomAirTempeature; 
     196        public double ambientAirTempeature; 
     197        public double airFlowVolume; 
     198        public double alpha; 
     199         
     200        public static CoolingModelData coolingData; 
    198201        /** 
    199202         * An empty constructor. 
     
    389392 
    390393                try { 
    391                         ConfigurationOptions.pressureDrop = Double.valueOf(bundle.getString(PRESSURE_DROP)).doubleValue(); 
    392                 } catch(MissingResourceException e){ 
    393                         ConfigurationOptions.pressureDrop = 65; 
    394                 } 
    395                  
    396                 try { 
    397                         ConfigurationOptions.outletRoomAirTempeature = Double.valueOf(bundle.getString(OUTLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 
    398                 } catch(MissingResourceException e){ 
    399                         ConfigurationOptions.outletRoomAirTempeature = 23; 
    400                 } 
    401                  
    402                 try { 
    403                         ConfigurationOptions.inletRoomAirTempeature = Double.valueOf(bundle.getString(INLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 
    404                 } catch(MissingResourceException e){ 
    405                         ConfigurationOptions.inletRoomAirTempeature = 17; 
    406                 } 
    407                  
    408                 try { 
    409                         ConfigurationOptions.ambientAirTempeature = Double.valueOf(bundle.getString(AMBIENT_AIR_TEMPERATURE)).doubleValue(); 
    410                 } catch(MissingResourceException e){ 
    411                         ConfigurationOptions.ambientAirTempeature = 17; 
    412                 } 
    413                  
    414                 try { 
    415                         ConfigurationOptions.airFlowVolume = Double.valueOf(bundle.getString(AIR_FLOW_VOLUME)).doubleValue(); 
    416                 } catch(MissingResourceException e){ 
    417                         ConfigurationOptions.airFlowVolume = 4; 
    418                 } 
    419                  
    420                 try { 
    421                         ConfigurationOptions.alpha = Double.valueOf(bundle.getString(ALPHA)).doubleValue(); 
    422                 } catch(MissingResourceException e){ 
    423                         ConfigurationOptions.alpha = 0.2; 
    424                 } 
    425                  
     394                        co.pressureDrop = Double.valueOf(bundle.getString(PRESSURE_DROP)).doubleValue(); 
     395                } catch(MissingResourceException e){ 
     396                        co.pressureDrop = -1; 
     397                } 
     398                 
     399                try { 
     400                        co.outletRoomAirTempeature = Double.valueOf(bundle.getString(OUTLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 
     401                } catch(MissingResourceException e){ 
     402                        co.outletRoomAirTempeature = -1; 
     403                } 
     404                 
     405                try { 
     406                        co.inletRoomAirTempeature = Double.valueOf(bundle.getString(INLET_ROOM_AIR_TEMPERATURE)).doubleValue(); 
     407                } catch(MissingResourceException e){ 
     408                        co.inletRoomAirTempeature = -1; 
     409                } 
     410                 
     411                try { 
     412                        co.ambientAirTempeature = Double.valueOf(bundle.getString(AMBIENT_AIR_TEMPERATURE)).doubleValue(); 
     413                } catch(MissingResourceException e){ 
     414                        co.ambientAirTempeature = -1; 
     415                } 
     416                 
     417                try { 
     418                        co.airFlowVolume = Double.valueOf(bundle.getString(AIR_FLOW_VOLUME)).doubleValue(); 
     419                } catch(MissingResourceException e){ 
     420                        co.airFlowVolume = -1; 
     421                } 
     422                 
     423                try { 
     424                        co.alpha = Double.valueOf(bundle.getString(ALPHA)).doubleValue(); 
     425                } catch(MissingResourceException e){ 
     426                        co.alpha = -1; 
     427                } 
     428                 
     429                ConfigurationOptions.coolingData = new CoolingModelData(co.pressureDrop, co.outletRoomAirTempeature, co.inletRoomAirTempeature, co.ambientAirTempeature, co.airFlowVolume, co.alpha); 
    426430                return co; 
    427431        } 
  • DCWoRMS/branches/coolemall/src/simulator/DCWormsUsers.java

    r1207 r1299  
    7474                sendJobsIds = new HashSet<String>(); 
    7575                returnedJobsIds = new HashSet<String>(); 
    76                  
     76                returnedJobs = new ArrayList<JobInterface<?>>(); 
    7777                this.xsltTransformer = new XsltTransformations(); 
    7878        } 
     
    8080        @Override 
    8181        public void body() { 
    82                 sendJobs(); 
    83                 collectJobs(); 
     82                if(workloadLoader != null){ 
     83                        sendJobs(); 
     84                        collectJobs();   
     85                } else { 
     86                        submissionStartTime = 0; 
     87                } 
    8488 
    8589                //GridSim dependent code for shutting down the simulation 
     
    9397         */ 
    9498        protected void collectJobs() { 
    95                 final int FACTOR = Math.min(10, workloadLoader.getTaskCount()); //the refresh rate of the gauge: at most 10 times 
     99                final int FACTOR = Math.min(100, workloadLoader.getTaskCount() > 0 ? workloadLoader.getTaskCount() : 1); //the refresh rate of the gauge: at most 10 times 
    96100                final int denominator = workloadLoader.getTaskCount() / FACTOR; 
    97101                allTasksAreFinished = true; 
    98                 returnedJobs = new ArrayList<JobInterface<?>>(); 
    99102                int counter = 0; 
    100103                int oldRemeinder = 0; 
     
    244247         
    245248        public List<JobDescription> getAllSentJobs() { 
     249                if (workloadLoader == null) 
     250                        return new ArrayList<JobDescription>(); 
    246251                return (List<JobDescription>) workloadLoader.getJobs(); 
    247252        } 
     
    349354         
    350355        public boolean isSimStartTimeDefined(){ 
     356                if(workloadLoader == null){ 
     357                        return false; 
     358                } 
    351359                return workloadLoader.isSimStartTimeDefined(); 
    352360        } 
  • DCWoRMS/branches/coolemall/src/simulator/DataCenterWorkloadSimulator.java

    r1207 r1299  
    2121import org.joda.time.DateTimeUtilsExt; 
    2222 
    23 import schedframe.Initializable; 
    2423import schedframe.SimulatedEnvironment; 
    2524import simulator.reader.ResourceReader; 
     
    252251                // (default 1) 
    253252                 
    254                 Date date = workload.getSimulationStartTime(); 
    255253                Calendar calendar = Calendar.getInstance(); 
    256                 if (date == null) 
     254                if(workload == null){ 
    257255                        calendar.setTimeInMillis(0L); 
    258                 else 
    259                         calendar.setTime(date); 
     256                } else { 
     257                        Date date = workload.getSimulationStartTime(); 
     258                        if (date == null) 
     259                                calendar.setTimeInMillis(0L); 
     260                        else 
     261                                calendar.setTime(date);                  
     262                } 
     263 
    260264 
    261265                boolean traceFlag = true; // means: trace GridSim events/activities 
     
    268272                ResourceReader resourceReader = new ResourceReader( 
    269273                                options.resdescFileName); 
    270                 SimulatedEnvironment rc = resourceReader.read(); 
    271                 eventManager = new EventManager("eventManager", rc); 
    272                  
    273                 for(Initializable initObj: rc.getToInit()){ 
     274                SimulatedEnvironment simEnv = resourceReader.read(); 
     275                 
     276                eventManager = new EventManager("eventManager", simEnv); 
     277                 
     278                /*for(Initializable initObj: rc.getToInit()){ 
    274279                        initObj.initiate(); 
    275280                } 
    276                 rc.setInitList(null); 
     281                rc.setInitList(null);*/ 
    277282                 
    278283                DCWormsUsers users = new DCWormsUsers("Users", 
    279                                 rc.getScheduler().get_name(), workload); 
     284                                simEnv.getScheduler().get_name(), workload); 
    280285                 
    281286                System.out.println("Starting simulation..."); 
     
    287292 
    288293                DCWormsStatistics stats = new DCWormsStatistics(simulationIdentifier, 
    289                                 options, users, statsOutputPath, rc); 
     294                                options, users, statsOutputPath, simEnv); 
    290295                accumulatedStatistics.add(stats); 
    291296                if (log.isInfoEnabled()) 
     
    309314        private WorkloadLoader loadWorkload(ConfigurationOptions options) throws IOException, MarshalException, ValidationException{ 
    310315                XMLJobReader<org.qcg.broker.schemas.jobdesc.Job> xmlJobReader = null; 
    311                 WAReader<org.qcg.broker.schemas.jobdesc.Job> swfReader = null; 
     316                WAReader<org.qcg.broker.schemas.jobdesc.Job> workloadReader = null; 
    312317 
    313318                String wlFileName = options.inputWorkloadFileName; 
    314319 
    315                 String appProfilesFolder = options.appProfilesFolder; 
     320                if(wlFileName == null){ 
     321                        return null; 
     322                } 
     323                 
    316324                if (options.inputFolder != null) { 
    317                         File f = null; 
    318                         if (options.inputTar != null) { 
    319                                 f = new File(options.inputFolder + File.separator 
    320                                                 + options.inputTar); 
    321                         } else { 
    322                                 f = new File(options.inputFolder); 
    323                         } 
    324  
     325                        File f = new File(options.inputFolder); 
    325326                        xmlJobReader = new QcgXmlJobReader(f); 
    326327 
     
    329330                } 
    330331 
    331                 swfReader = AbstractWAReader.getInstace(wlFileName); 
    332  
    333                 WorkloadLoader workload = new WorkloadLoader(xmlJobReader, swfReader, appProfilesFolder); 
     332                workloadReader = AbstractWAReader.getInstace(wlFileName); 
     333                 
     334                String appProfilesFolderName = options.appProfilesFolder; 
     335                 
     336                WorkloadLoader workload = new WorkloadLoader(xmlJobReader, workloadReader, appProfilesFolderName); 
    334337                workload.load(); 
    335338 
  • DCWoRMS/branches/coolemall/src/simulator/stats/AbstractMetricsCalculator.java

    r1207 r1299  
    77 
    88import simulator.stats.implementation.MetricsStats; 
    9 import example.energy.coolemall.CoolEmAllTestbedMeasurements; 
    109 
    11 public class MetricsCalculator { 
     10public abstract class AbstractMetricsCalculator implements MetricsCalculator{ 
    1211         
    1312        protected static final double MILLI_SEC = 1000; 
     
    1514         
    1615        protected Map<String, List<GSSAccumulator>> metricsData = new HashMap<String, List<GSSAccumulator>>(); 
    17         protected long timestamp; 
     16 
    1817        protected long startTime; 
    1918        protected long endTime; 
    20  
    21         public List<MetricsStats> calulateMetrics(long timestamp){ 
     19        protected long timestamp; 
     20         
     21        public AbstractMetricsCalculator(long startTime, long endTime, long timestamp) { 
     22                super(); 
     23                this.startTime = startTime; 
     24                this.endTime = endTime; 
    2225                this.timestamp = timestamp; 
    23                 List<MetricsStats> metrics = new ArrayList<MetricsStats>(); 
    24                 /*for(String resourceTypeName: metricsData.keySet()){ 
    25                         MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax()); 
    26                         metrics.add(metric);} 
    27                 }*/ 
    28                 metrics.add(calculateITComputingEnergyConsumption()); 
    29                 metrics.add(calculateITEnergyConsumption()); 
    30                 metrics.add(calculateNodeGroupFansEnergyConsumption()); 
    31                  
    32                 metrics.add(calculateRackEnergyConsumption()); 
    33                 metrics.add(calculateDataCenterFansEnergyConsumption()); 
    34                 metrics.add(calculateCoolingDeviceEnergyConsumption()); 
    35                 metrics.add(calculateOtherDevicesEnergyConsumption()); 
    36                  
    37                 metrics.add(calculateTotalEnergyConsumption()); 
    38                  
    39                 metrics.add(calculateMeanRackPower()); 
    40                 metrics.add(calculateMeanPower()); 
    41                 metrics.add(calculateMaxRackPower()); 
    42                 metrics.add(calculateMaxPower()); 
    43                  
    44                 metrics.add(calculatePUE()); 
    45                 metrics.add(calculatePUELevel4()); 
    46                 metrics.add(calculateEnergyWasteRate()); 
    47                  
    48                 metrics.add(calculateUsefulWork()); 
    49                 metrics.add(calculateProductivity()); 
    50  
    51                 return metrics; 
    5226        } 
     27         
     28        abstract public List<MetricsStats> calulateMetrics(); 
    5329         
    5430        public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator){ 
     
    6440                return metricsData; 
    6541        } 
    66          
    67         private MetricsStats calculateTotalEnergyConsumption(){ 
    68                  
    69                 MetricsStats metric; 
    70                 try{ 
    71                          
    72                         double roomPower = 0; 
    73                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    74                                 roomPower = roomPower + acc.getSum(); 
    75                         } 
    76                         metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh"); 
    77                 } catch (Exception e){ 
    78                         metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh"); 
    79                 } 
    80                 return metric; 
    81         } 
    82          
    83         private MetricsStats calculateITComputingEnergyConsumption(){ 
    84                  
    85                 MetricsStats metric; 
    86                 try{ 
    87                         double itComputingPower = 0; 
    88                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    89                                 itComputingPower = itComputingPower + acc.getSum(); 
    90                         } 
    91                         metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh"); 
    92                 } catch (Exception e){ 
    93                         metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh"); 
    94                 } 
    95                 return metric; 
    96         } 
    97          
    98         private MetricsStats calculateITEnergyConsumption(){ 
    99                  
    100                 MetricsStats metric; 
    101                 try{ 
    102                         double totalSitePower = 0;  
    103                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    104                                 totalSitePower = totalSitePower + acc.getSum(); 
    105                         } 
    106                         double nodeComputingPower = 0; 
    107                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    108                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    109                         } 
    110                         double itComputingPower = 0; 
    111                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    112                                 itComputingPower = itComputingPower + acc.getSum(); 
    113                         } 
    114                         double fanPowerConumspion = nodeComputingPower - itComputingPower; 
    115                         metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - fanPowerConumspion), timestamp, "Wh"); 
    116                 } catch (Exception e){ 
    117                         metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh"); 
    118                 } 
    119                 return metric; 
    120         } 
    121          
    122         private MetricsStats calculateNodeGroupFansEnergyConsumption(){ 
    123                  
    124                 MetricsStats metric; 
    125                 try{ 
    126                         double nodeComputingPower = 0; 
    127                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    128                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    129                         } 
    130                         double itComputingPower = 0; 
    131                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    132                                 itComputingPower = itComputingPower + acc.getSum(); 
    133                         } 
    134                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    135                         metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh"); 
    136                 } catch (Exception e){ 
    137                         metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh"); 
    138                 } 
    139                 return metric; 
    140         } 
    141          
    142         private MetricsStats calculatePUELevel4(){ 
    143                  
    144                 MetricsStats metric; 
    145                 try{ 
    146                          
    147                         double roomPower = 0; 
    148                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    149                                 roomPower = roomPower + acc.getSum(); 
    150                         } 
    151                          
    152                         double totalSitePower = 0; 
    153                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    154                                 totalSitePower = totalSitePower + acc.getSum(); 
    155                         } 
    156                          
    157                  
    158                         double nodeComputingPower = 0; 
    159                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    160                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    161                         } 
    162                         double itComputingPower = 0; 
    163                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    164                                 itComputingPower = itComputingPower + acc.getSum(); 
    165                         } 
    166                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    16742 
    168                         metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, ""); 
    169                 } catch (Exception e){ 
    170                         metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, ""); 
    171                 } 
    172                 return metric; 
    173         } 
    174          
    175         private MetricsStats calculatePUE(){ 
    176                  
    177                 MetricsStats metric; 
    178                 try{ 
    179                          
    180                         double roomPower = 0; 
    181                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    182                                 roomPower = roomPower + acc.getSum(); 
    183                         } 
    184                          
    185                         double totalSitePower = 0; 
    186                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    187                                 totalSitePower = totalSitePower + acc.getSum(); 
    188                         } 
    189  
    190  
    191                         metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, ""); 
    192                 } catch (Exception e){ 
    193                         metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, ""); 
    194                 } 
    195                 return metric; 
    196         } 
    197  
    198         private MetricsStats calculateUsefulWork(){ 
    199                  
    200                 MetricsStats metric; 
    201                 try{ 
    202                         double usefulWork = 0; 
    203                         for(String key: metricsData.keySet()){ 
    204                                 if(key.contains("/")){ 
    205                                         for(GSSAccumulator acc: metricsData.get(key)){ 
    206                                                 usefulWork= usefulWork + acc.getSum(); 
    207                                         } 
    208                                 } 
    209                         } 
    210                         metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units"); 
    211                 } catch (Exception e){ 
    212                         metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units"); 
    213                 } 
    214                  
    215                 return metric; 
    216         } 
    217          
    218         private MetricsStats calculateProductivity(){ 
    219                  
    220                 MetricsStats metric; 
    221                 try{ 
    222                         double usefulWork = 0; 
    223                         for(String key: metricsData.keySet()){ 
    224                                 if(key.contains("/")){ 
    225                                         for(GSSAccumulator acc: metricsData.get(key)){ 
    226                                                 usefulWork= usefulWork + acc.getSum(); 
    227                                         } 
    228                                 } 
    229                         } 
    230                         double totalSitePower = 0;  
    231                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    232                                 totalSitePower = totalSitePower + acc.getSum(); 
    233                         } 
    234                          
    235                         metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh"); 
    236                 } catch (Exception e){ 
    237                         metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh"); 
    238                 } 
    239                  
    240                 return metric; 
    241         } 
    242          
    243          
    244         private MetricsStats calculateMaxRackPower(){ 
    245                  
    246                 MetricsStats metric; 
    247                 try{ 
    248                         double maxPower = 0; 
    249                          
    250                         for(GSSAccumulator acc: metricsData.get("Rack_MAX")){ 
    251                                 maxPower = maxPower + acc.getSum(); 
    252                         } 
    253  
    254                         metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W"); 
    255                 } catch (Exception e){ 
    256                         metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W"); 
    257                 } 
    258                  
    259                 return metric; 
    260         } 
    261          
    262         private MetricsStats calculateMaxPower(){ 
    263                  
    264                 MetricsStats metric; 
    265                 try{ 
    266                         double maxPower = 0; 
    267                          
    268                         for(GSSAccumulator acc: metricsData.get("Room_MAX")){ 
    269                                 maxPower = maxPower + acc.getSum(); 
    270                         } 
    271  
    272                         metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W"); 
    273                 } catch (Exception e){ 
    274                         metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W"); 
    275                 } 
    276                  
    277                 return metric; 
    278         } 
    279          
    280         private MetricsStats calculateDataCenterFansEnergyConsumption(){ 
    281                  
    282                 MetricsStats metric; 
    283                 try{ 
    284                         double inletsPower = 0; 
    285                         for(GSSAccumulator acc: metricsData.get("Inlet")){ 
    286                                 inletsPower = inletsPower + acc.getSum(); 
    287                         } 
    288                          
    289                         double outletsPower = 0; 
    290                         for(GSSAccumulator acc: metricsData.get("Outlet")){ 
    291                                 outletsPower = outletsPower + acc.getSum(); 
    292                         } 
    293                          
    294                         double nodeComputingPower = 0; 
    295                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    296                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    297                         } 
    298                         double itComputingPower = 0; 
    299                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    300                                 itComputingPower = itComputingPower + acc.getSum(); 
    301                         } 
    302                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    303                          
    304                         metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh"); 
    305                 } catch (Exception e){ 
    306                         metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh"); 
    307                 } 
    308                 return metric; 
    309         } 
    310          
    311          
    312         private MetricsStats calculateRackEnergyConsumption(){ 
    313                  
    314                 MetricsStats metric; 
    315                 try{ 
    316                         double roomPower = 0; 
    317                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    318                                 roomPower = roomPower + acc.getSum(); 
    319                         } 
    320                         metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh"); 
    321                 } catch (Exception e){ 
    322                         metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_device_consumption", -1, timestamp, "Wh"); 
    323                 } 
    324                 return metric; 
    325         } 
    326          
    327         private MetricsStats calculateCoolingDeviceEnergyConsumption(){ 
    328                  
    329                 MetricsStats metric; 
    330                 try{ 
    331                         double coolingDevicePower = 0; 
    332                         for(GSSAccumulator acc: metricsData.get("CoolingDevice")){ 
    333                                 coolingDevicePower = coolingDevicePower + acc.getSum(); 
    334                         } 
    335                         metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh"); 
    336                 } catch (Exception e){ 
    337                         metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_consumption", -1, timestamp, "Wh"); 
    338                 } 
    339                 return metric; 
    340         } 
    341          
    342         private MetricsStats calculateOtherDevicesEnergyConsumption(){ 
    343                  
    344                 MetricsStats metric; 
    345                 try{ 
    346                         double roomPower = 0; 
    347                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    348                                 roomPower = roomPower + acc.getSum(); 
    349                         } 
    350                          
    351                         double totalSitePower = 0; 
    352                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    353                                 totalSitePower = totalSitePower + acc.getSum(); 
    354                         } 
    355                          
    356                         double coolingDevicePower = 0; 
    357                         for(GSSAccumulator acc: metricsData.get("CoolingDevice")){ 
    358                                 coolingDevicePower = coolingDevicePower + acc.getSum(); 
    359                         } 
    360                          
    361                         double inletsPower = 0; 
    362                         for(GSSAccumulator acc: metricsData.get("Inlet")){ 
    363                                 inletsPower = inletsPower + acc.getSum(); 
    364                         } 
    365                          
    366                         double outletsPower = 0; 
    367                         for(GSSAccumulator acc: metricsData.get("Outlet")){ 
    368                                 outletsPower = outletsPower + acc.getSum(); 
    369                         } 
    370                          
    371                         double nodeComputingPower = 0; 
    372                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    373                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    374                         } 
    375                         double itComputingPower = 0; 
    376                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    377                                 itComputingPower = itComputingPower + acc.getSum(); 
    378                         } 
    379                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    380                          
    381                         metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower - nodeGroupFansPowerConumspion)), timestamp, "Wh"); 
    382                 } catch (Exception e){ 
    383                         metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_consumption", -1, timestamp, "Wh"); 
    384                 } 
    385                 return metric; 
    386         } 
    387  
    388          
    389         private MetricsStats calculateMeanPower(){ 
    390                  
    391                 MetricsStats metric; 
    392                 try{ 
    393                          
    394                         double roomPower = 0; 
    395                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    396                                 roomPower = roomPower + acc.getSum(); 
    397                         } 
    398                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); 
    399                 } catch (Exception e){ 
    400                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W"); 
    401                 } 
    402                 return metric; 
    403         } 
    404          
    405          
    406         private MetricsStats calculateMeanRackPower(){ 
    407                  
    408                 MetricsStats metric; 
    409                 try{ 
    410                          
    411                         double roomPower = 0; 
    412                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    413                                 roomPower = roomPower + acc.getSum(); 
    414                         } 
    415                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); 
    416                 } catch (Exception e){ 
    417                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W"); 
    418                 } 
    419                 return metric; 
    420         } 
    421          
    422         private MetricsStats calculateEnergyWasteRate(){ 
    423                  
    424                 MetricsStats metric; 
    425                 try{ 
    426                         double itComputingEnergy = 0; 
    427                         for(GSSAccumulator acc: metricsData.get("Processor_CALC")){ 
    428                                 itComputingEnergy = itComputingEnergy + acc.getSum(); 
    429                         } 
    430                         itComputingEnergy = itComputingEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC); 
    431                         double itEnergy = calculateITEnergyConsumption().getValue(); 
    432                          
    433                         metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%"); 
    434                 } catch (Exception e){ 
    435                         metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%"); 
    436                 } 
    437                 return metric; 
    438         } 
    439          
    440         public long getStartTime() { 
    441                 return startTime; 
    442         } 
    443  
    444         public void setStartTime(long startTime) { 
    445                 this.startTime = startTime; 
    446         } 
    447  
    448         public long getEndTime() { 
    449                 return endTime; 
    450         } 
    451  
    452         public void setEndTime(long endTime) { 
    453                 this.endTime = endTime; 
    454         } 
    45543} 
  • DCWoRMS/branches/coolemall/src/simulator/stats/MetricsCalculator.java

    r1207 r1299  
    11package simulator.stats; 
    22 
    3 import java.util.ArrayList; 
    4 import java.util.HashMap; 
    53import java.util.List; 
    64import java.util.Map; 
    75 
    86import simulator.stats.implementation.MetricsStats; 
    9 import example.energy.coolemall.CoolEmAllTestbedMeasurements; 
    107 
    11 public class MetricsCalculator { 
     8public interface MetricsCalculator { 
    129         
    13         protected static final double MILLI_SEC = 1000; 
    14         protected static final double SEC_IN_HOUR = 3600; 
     10        public List<MetricsStats> calulateMetrics(); 
    1511         
    16         protected Map<String, List<GSSAccumulator>> metricsData = new HashMap<String, List<GSSAccumulator>>(); 
    17         protected long timestamp; 
    18         protected long startTime; 
    19         protected long endTime; 
    20  
    21         public List<MetricsStats> calulateMetrics(long timestamp){ 
    22                 this.timestamp = timestamp; 
    23                 List<MetricsStats> metrics = new ArrayList<MetricsStats>(); 
    24                 /*for(String resourceTypeName: metricsData.keySet()){ 
    25                         MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax()); 
    26                         metrics.add(metric);} 
    27                 }*/ 
    28                 metrics.add(calculateITComputingEnergyConsumption()); 
    29                 metrics.add(calculateITEnergyConsumption()); 
    30                 metrics.add(calculateNodeGroupFansEnergyConsumption()); 
    31                  
    32                 metrics.add(calculateRackEnergyConsumption()); 
    33                 metrics.add(calculateDataCenterFansEnergyConsumption()); 
    34                 metrics.add(calculateCoolingDeviceEnergyConsumption()); 
    35                 metrics.add(calculateOtherDevicesEnergyConsumption()); 
    36                  
    37                 metrics.add(calculateTotalEnergyConsumption()); 
    38                  
    39                 metrics.add(calculateMeanRackPower()); 
    40                 metrics.add(calculateMeanPower()); 
    41                 metrics.add(calculateMaxRackPower()); 
    42                 metrics.add(calculateMaxPower()); 
    43                  
    44                 metrics.add(calculatePUE()); 
    45                 metrics.add(calculatePUELevel4()); 
    46                 metrics.add(calculateEnergyWasteRate()); 
    47                  
    48                 metrics.add(calculateUsefulWork()); 
    49                 metrics.add(calculateProductivity()); 
    50  
    51                 return metrics; 
    52         } 
     12        public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator); 
    5313         
    54         public void addMetricsData(String resourceTypeName, GSSAccumulator resourceEnergyAccumulator){ 
    55                 List<GSSAccumulator> resourceEnergyAccumulatorList = metricsData.get(resourceTypeName); 
    56                 if(resourceEnergyAccumulatorList == null){ 
    57                         resourceEnergyAccumulatorList = new ArrayList<GSSAccumulator>(); 
    58                 } 
    59                 resourceEnergyAccumulatorList.add(resourceEnergyAccumulator); 
    60                 metricsData.put(resourceTypeName, resourceEnergyAccumulatorList); 
    61         } 
     14        public Map<String, List<GSSAccumulator>> getMetricsData(); 
    6215         
    63         public Map<String, List<GSSAccumulator>> getMetricsData(){ 
    64                 return metricsData; 
    65         } 
    66          
    67         private MetricsStats calculateTotalEnergyConsumption(){ 
    68                  
    69                 MetricsStats metric; 
    70                 try{ 
    71                          
    72                         double roomPower = 0; 
    73                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    74                                 roomPower = roomPower + acc.getSum(); 
    75                         } 
    76                         metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh"); 
    77                 } catch (Exception e){ 
    78                         metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh"); 
    79                 } 
    80                 return metric; 
    81         } 
    82          
    83         private MetricsStats calculateITComputingEnergyConsumption(){ 
    84                  
    85                 MetricsStats metric; 
    86                 try{ 
    87                         double itComputingPower = 0; 
    88                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    89                                 itComputingPower = itComputingPower + acc.getSum(); 
    90                         } 
    91                         metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh"); 
    92                 } catch (Exception e){ 
    93                         metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh"); 
    94                 } 
    95                 return metric; 
    96         } 
    97          
    98         private MetricsStats calculateITEnergyConsumption(){ 
    99                  
    100                 MetricsStats metric; 
    101                 try{ 
    102                         double totalSitePower = 0;  
    103                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    104                                 totalSitePower = totalSitePower + acc.getSum(); 
    105                         } 
    106                         double nodeComputingPower = 0; 
    107                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    108                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    109                         } 
    110                         double itComputingPower = 0; 
    111                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    112                                 itComputingPower = itComputingPower + acc.getSum(); 
    113                         } 
    114                         double fanPowerConumspion = nodeComputingPower - itComputingPower; 
    115                         metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - fanPowerConumspion), timestamp, "Wh"); 
    116                 } catch (Exception e){ 
    117                         metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh"); 
    118                 } 
    119                 return metric; 
    120         } 
    121          
    122         private MetricsStats calculateNodeGroupFansEnergyConsumption(){ 
    123                  
    124                 MetricsStats metric; 
    125                 try{ 
    126                         double nodeComputingPower = 0; 
    127                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    128                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    129                         } 
    130                         double itComputingPower = 0; 
    131                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    132                                 itComputingPower = itComputingPower + acc.getSum(); 
    133                         } 
    134                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    135                         metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh"); 
    136                 } catch (Exception e){ 
    137                         metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh"); 
    138                 } 
    139                 return metric; 
    140         } 
    141          
    142         private MetricsStats calculatePUELevel4(){ 
    143                  
    144                 MetricsStats metric; 
    145                 try{ 
    146                          
    147                         double roomPower = 0; 
    148                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    149                                 roomPower = roomPower + acc.getSum(); 
    150                         } 
    151                          
    152                         double totalSitePower = 0; 
    153                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    154                                 totalSitePower = totalSitePower + acc.getSum(); 
    155                         } 
    156                          
    157                  
    158                         double nodeComputingPower = 0; 
    159                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    160                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    161                         } 
    162                         double itComputingPower = 0; 
    163                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    164                                 itComputingPower = itComputingPower + acc.getSum(); 
    165                         } 
    166                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    167  
    168                         metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, ""); 
    169                 } catch (Exception e){ 
    170                         metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, ""); 
    171                 } 
    172                 return metric; 
    173         } 
    174          
    175         private MetricsStats calculatePUE(){ 
    176                  
    177                 MetricsStats metric; 
    178                 try{ 
    179                          
    180                         double roomPower = 0; 
    181                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    182                                 roomPower = roomPower + acc.getSum(); 
    183                         } 
    184                          
    185                         double totalSitePower = 0; 
    186                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    187                                 totalSitePower = totalSitePower + acc.getSum(); 
    188                         } 
    189  
    190  
    191                         metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, ""); 
    192                 } catch (Exception e){ 
    193                         metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, ""); 
    194                 } 
    195                 return metric; 
    196         } 
    197  
    198         private MetricsStats calculateUsefulWork(){ 
    199                  
    200                 MetricsStats metric; 
    201                 try{ 
    202                         double usefulWork = 0; 
    203                         for(String key: metricsData.keySet()){ 
    204                                 if(key.contains("/")){ 
    205                                         for(GSSAccumulator acc: metricsData.get(key)){ 
    206                                                 usefulWork= usefulWork + acc.getSum(); 
    207                                         } 
    208                                 } 
    209                         } 
    210                         metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units"); 
    211                 } catch (Exception e){ 
    212                         metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units"); 
    213                 } 
    214                  
    215                 return metric; 
    216         } 
    217          
    218         private MetricsStats calculateProductivity(){ 
    219                  
    220                 MetricsStats metric; 
    221                 try{ 
    222                         double usefulWork = 0; 
    223                         for(String key: metricsData.keySet()){ 
    224                                 if(key.contains("/")){ 
    225                                         for(GSSAccumulator acc: metricsData.get(key)){ 
    226                                                 usefulWork= usefulWork + acc.getSum(); 
    227                                         } 
    228                                 } 
    229                         } 
    230                         double totalSitePower = 0;  
    231                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    232                                 totalSitePower = totalSitePower + acc.getSum(); 
    233                         } 
    234                          
    235                         metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh"); 
    236                 } catch (Exception e){ 
    237                         metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh"); 
    238                 } 
    239                  
    240                 return metric; 
    241         } 
    242          
    243          
    244         private MetricsStats calculateMaxRackPower(){ 
    245                  
    246                 MetricsStats metric; 
    247                 try{ 
    248                         double maxPower = 0; 
    249                          
    250                         for(GSSAccumulator acc: metricsData.get("Rack_MAX")){ 
    251                                 maxPower = maxPower + acc.getSum(); 
    252                         } 
    253  
    254                         metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W"); 
    255                 } catch (Exception e){ 
    256                         metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W"); 
    257                 } 
    258                  
    259                 return metric; 
    260         } 
    261          
    262         private MetricsStats calculateMaxPower(){ 
    263                  
    264                 MetricsStats metric; 
    265                 try{ 
    266                         double maxPower = 0; 
    267                          
    268                         for(GSSAccumulator acc: metricsData.get("Room_MAX")){ 
    269                                 maxPower = maxPower + acc.getSum(); 
    270                         } 
    271  
    272                         metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W"); 
    273                 } catch (Exception e){ 
    274                         metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W"); 
    275                 } 
    276                  
    277                 return metric; 
    278         } 
    279          
    280         private MetricsStats calculateDataCenterFansEnergyConsumption(){ 
    281                  
    282                 MetricsStats metric; 
    283                 try{ 
    284                         double inletsPower = 0; 
    285                         for(GSSAccumulator acc: metricsData.get("Inlet")){ 
    286                                 inletsPower = inletsPower + acc.getSum(); 
    287                         } 
    288                          
    289                         double outletsPower = 0; 
    290                         for(GSSAccumulator acc: metricsData.get("Outlet")){ 
    291                                 outletsPower = outletsPower + acc.getSum(); 
    292                         } 
    293                          
    294                         double nodeComputingPower = 0; 
    295                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    296                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    297                         } 
    298                         double itComputingPower = 0; 
    299                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    300                                 itComputingPower = itComputingPower + acc.getSum(); 
    301                         } 
    302                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    303                          
    304                         metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh"); 
    305                 } catch (Exception e){ 
    306                         metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh"); 
    307                 } 
    308                 return metric; 
    309         } 
    310          
    311          
    312         private MetricsStats calculateRackEnergyConsumption(){ 
    313                  
    314                 MetricsStats metric; 
    315                 try{ 
    316                         double roomPower = 0; 
    317                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    318                                 roomPower = roomPower + acc.getSum(); 
    319                         } 
    320                         metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh"); 
    321                 } catch (Exception e){ 
    322                         metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_device_consumption", -1, timestamp, "Wh"); 
    323                 } 
    324                 return metric; 
    325         } 
    326          
    327         private MetricsStats calculateCoolingDeviceEnergyConsumption(){ 
    328                  
    329                 MetricsStats metric; 
    330                 try{ 
    331                         double coolingDevicePower = 0; 
    332                         for(GSSAccumulator acc: metricsData.get("CoolingDevice")){ 
    333                                 coolingDevicePower = coolingDevicePower + acc.getSum(); 
    334                         } 
    335                         metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh"); 
    336                 } catch (Exception e){ 
    337                         metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_consumption", -1, timestamp, "Wh"); 
    338                 } 
    339                 return metric; 
    340         } 
    341          
    342         private MetricsStats calculateOtherDevicesEnergyConsumption(){ 
    343                  
    344                 MetricsStats metric; 
    345                 try{ 
    346                         double roomPower = 0; 
    347                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    348                                 roomPower = roomPower + acc.getSum(); 
    349                         } 
    350                          
    351                         double totalSitePower = 0; 
    352                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    353                                 totalSitePower = totalSitePower + acc.getSum(); 
    354                         } 
    355                          
    356                         double coolingDevicePower = 0; 
    357                         for(GSSAccumulator acc: metricsData.get("CoolingDevice")){ 
    358                                 coolingDevicePower = coolingDevicePower + acc.getSum(); 
    359                         } 
    360                          
    361                         double inletsPower = 0; 
    362                         for(GSSAccumulator acc: metricsData.get("Inlet")){ 
    363                                 inletsPower = inletsPower + acc.getSum(); 
    364                         } 
    365                          
    366                         double outletsPower = 0; 
    367                         for(GSSAccumulator acc: metricsData.get("Outlet")){ 
    368                                 outletsPower = outletsPower + acc.getSum(); 
    369                         } 
    370                          
    371                         double nodeComputingPower = 0; 
    372                         for(GSSAccumulator acc: metricsData.get("Node")){ 
    373                                 nodeComputingPower = nodeComputingPower+ acc.getSum(); 
    374                         } 
    375                         double itComputingPower = 0; 
    376                         for(GSSAccumulator acc: metricsData.get("Processor")){ 
    377                                 itComputingPower = itComputingPower + acc.getSum(); 
    378                         } 
    379                         double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; 
    380                          
    381                         metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower - nodeGroupFansPowerConumspion)), timestamp, "Wh"); 
    382                 } catch (Exception e){ 
    383                         metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_consumption", -1, timestamp, "Wh"); 
    384                 } 
    385                 return metric; 
    386         } 
    387  
    388          
    389         private MetricsStats calculateMeanPower(){ 
    390                  
    391                 MetricsStats metric; 
    392                 try{ 
    393                          
    394                         double roomPower = 0; 
    395                         for(GSSAccumulator acc: metricsData.get("Room")){ 
    396                                 roomPower = roomPower + acc.getSum(); 
    397                         } 
    398                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); 
    399                 } catch (Exception e){ 
    400                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W"); 
    401                 } 
    402                 return metric; 
    403         } 
    404          
    405          
    406         private MetricsStats calculateMeanRackPower(){ 
    407                  
    408                 MetricsStats metric; 
    409                 try{ 
    410                          
    411                         double roomPower = 0; 
    412                         for(GSSAccumulator acc: metricsData.get("Rack")){ 
    413                                 roomPower = roomPower + acc.getSum(); 
    414                         } 
    415                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); 
    416                 } catch (Exception e){ 
    417                         metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W"); 
    418                 } 
    419                 return metric; 
    420         } 
    421          
    422         private MetricsStats calculateEnergyWasteRate(){ 
    423                  
    424                 MetricsStats metric; 
    425                 try{ 
    426                         double itComputingEnergy = 0; 
    427                         for(GSSAccumulator acc: metricsData.get("Processor_CALC")){ 
    428                                 itComputingEnergy = itComputingEnergy + acc.getSum(); 
    429                         } 
    430                         itComputingEnergy = itComputingEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC); 
    431                         double itEnergy = calculateITEnergyConsumption().getValue(); 
    432                          
    433                         metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%"); 
    434                 } catch (Exception e){ 
    435                         metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%"); 
    436                 } 
    437                 return metric; 
    438         } 
    439          
    440         public long getStartTime() { 
    441                 return startTime; 
    442         } 
    443  
    444         public void setStartTime(long startTime) { 
    445                 this.startTime = startTime; 
    446         } 
    447  
    448         public long getEndTime() { 
    449                 return endTime; 
    450         } 
    451  
    452         public void setEndTime(long endTime) { 
    453                 this.endTime = endTime; 
    454         } 
    45516} 
  • DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java

    r1207 r1299  
    6262import schedframe.resources.UserResourceType; 
    6363import schedframe.resources.computing.ComputingResource; 
     64import schedframe.resources.computing.Processor; 
    6465import schedframe.resources.computing.extensions.Extension; 
    6566import schedframe.resources.computing.extensions.ExtensionList; 
    6667import schedframe.resources.computing.extensions.ExtensionType; 
    6768import schedframe.resources.computing.profiles.energy.EnergyExtension; 
     69import schedframe.resources.computing.profiles.energy.MeasurementHistory; 
    6870import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue; 
    6971import schedframe.resources.computing.profiles.energy.power.PowerUsage; 
    7072import schedframe.resources.computing.profiles.energy.thermal.TemperatureValue; 
     73import schedframe.resources.computing.profiles.load.LoadExtension; 
    7174import schedframe.resources.devices.Device; 
    7275import schedframe.resources.devices.PhysicalResource; 
     
    8588import simulator.DataCenterWorkloadSimulator; 
    8689import simulator.GenericUser; 
     90import simulator.stats.CoolEmAllMetricsCalculator; 
     91import simulator.stats.DCwormsMetricsCalculator; 
    8792import simulator.stats.GSSAccumulator; 
    8893import simulator.stats.MetricsCalculator; 
    8994import simulator.stats.SimulationStatistics; 
    90 import simulator.stats.implementation.out.AbstractStringSerializer; 
    9195import simulator.stats.implementation.out.CoolEmAllStringSerializer; 
    9296import simulator.stats.implementation.out.StringSerializer; 
     
    110114        protected static final int MILLI_SEC = 1000; 
    111115 
    112         protected static final String RAW_TASKS_STATISTICS_OUTPUT_FILE_NAME = "Tasks.txt"; 
     116        protected static final String TASKS_STATISTICS_OUTPUT_FILE_NAME = "Tasks.txt"; 
    113117        protected static final String JOBS_STATISTICS_OUTPUT_FILE_NAME = "Jobs.txt"; 
    114118 
    115119        protected static final String SIMULATION_STATISTICS_OUTPUT_FILE_NAME = "Simulation.txt"; 
     120        protected static final String RESOURCEOCCUPANCY_STATISTICS_OUTPUT_FILE_NAME = "ResourceOccupancy.txt"; 
    116121        protected static final String RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME = "ResourceUtilization.txt"; 
    117122        protected static final String ENERGYUSAGE_STATISTICS_OUTPUT_FILE_NAME = "EnergyUsage.txt"; 
     
    141146        protected SimulatedEnvironment resourceController; 
    142147        protected boolean generateDiagrams = true; 
    143         protected AbstractStringSerializer serializer; 
     148        protected StringSerializer serializer; 
    144149        protected long startSimulationTime; 
    145150        protected long endSimulationTime; 
    146151         
    147152        //RESOURCES 
    148         protected Map<String, List<ResStat>> basicResStats; 
     153        protected Map<String, List<ResStat>> pesStats; 
    149154        protected Map<String, Double> basicResLoad; 
    150155         
     
    156161        protected Map<String, List<XYDataset>> resourceAirFlowDiagrams; 
    157162        protected Map<String, List<XYDataset>> resourceTemperatureDiagrams; 
    158         protected Map<String, List<XYDataset>> resourceLoadDiagrams; 
     163        protected Map<String, List<XYDataset>> resourceOccupancyDiagrams; 
     164        protected Map<String, List<XYDataset>> resourceUtilizationDiagrams; 
    159165         
    160166        //TASKS 
     
    178184 
    179185                this.outputFolderName = outputFolderName; 
    180  
    181                 this.serializer = new StringSerializer(); 
    182                  
    183                 if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){ 
    184                         this.serializer = new CoolEmAllStringSerializer();       
    185                 } 
    186                 this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT); 
    187  
    188186                this.resourceController = resourceController; 
    189187                this.jr = new JobRegistryImpl(""); 
    190                 init(); 
    191                 metCalc = new MetricsCalculator(); 
    192         } 
    193  
    194         public void generateStatistics() { 
    195  
     188                 
    196189                if(users.isSimStartTimeDefined()) 
    197190                        this.startSimulationTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis(); 
    198191                else 
    199192                        this.startSimulationTime = new DateTime(users.getSubmissionStartTime() * 1000l).getMillis(); 
     193                 
    200194                this.endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 
    201195 
    202                 metCalc.setStartTime(startSimulationTime); 
    203                 metCalc.setEndTime(endSimulationTime); 
     196                init(); 
     197        } 
     198 
     199        public void generateStatistics() { 
    204200                 
    205201                long s = 0; 
     
    234230                accStats = new GSSAccumulatorsStats(); 
    235231                statsData = new HashMap<String, GSSAccumulator>(); 
     232                 
     233                this.serializer = new StringSerializer();                
     234                this.metCalc =  new DCwormsMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 
     235                 
     236                if(DataCenterWorkloadSimulator.MODE.equals("CoolEmAll")){ 
     237                        this.serializer = new CoolEmAllStringSerializer(); 
     238                        this.metCalc = new CoolEmAllMetricsCalculator(startSimulationTime, endSimulationTime, endSimulationTime); 
     239                } 
     240                this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT); 
    236241        } 
    237242 
     
    262267                        System.out.println("#STATS " + "===== Performance statistics ====="); 
    263268                        System.out.println("#STATS " + "Makespan: " + df.format(accStats.makespan.getMean()) + " [s]"); 
    264                         System.out.println("#STATS " + "Task completion time - " + "min: " + df.format(accStats.meanTaskCompletionTime.getMin()) + " [s]" + "; max: " + df.format(accStats.meanTaskCompletionTime.getMax()) + " [s]"); 
     269                        System.out.println("#STATS " + "Task completion time - " + "min: " + df.format(accStats.meanTaskCompletionTime.getMin()) + " [s]" + "; max: " + df.format(accStats.meanTaskCompletionTime.getMax()) + " [s]" + "; mean: " + df.format(accStats.meanTaskCompletionTime.getMean()) + " [s]"); 
    265270                        System.out.println("#STATS " + "Mean task execution time: " + df.format(accStats.meanTaskExecutionTime.getMean()) + " [s]"); 
     271                        System.out.println("#STATS " + "System occupancy: " + df.format(accStats.meanTotalOccupancy.getMean() * 100) + " [%]"); 
    266272                        System.out.println("#STATS " + "System load: " + df.format(accStats.meanTotalLoad.getMean() * 100) + " [%]"); 
     273                         
    267274                         
    268275                        simulationStatsFile.println(txt); 
     
    300307                taskGanttMap = new HashMap<String, TimetableEventGroup>();               
    301308                 
    302                 resourceLoadDiagrams = new HashMap<String, List<XYDataset>>(); 
     309                resourceOccupancyDiagrams = new HashMap<String, List<XYDataset>>(); 
     310                resourceUtilizationDiagrams = new HashMap<String, List<XYDataset>>(); 
    303311                resourcePowerUsageDiagrams = new HashMap<String, List<XYDataset>>(); 
    304312                resourceAirFlowDiagrams = new HashMap<String, List<XYDataset>>(); 
     
    309317                 
    310318                 
    311                 PrintStream resourceLoadStatsFile = null; 
     319                PrintStream resourceOccupancyStatsFile = null; 
     320                try { 
     321                        File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX 
     322                                        + simulationIdentifier + "_" 
     323                                        + RESOURCEOCCUPANCY_STATISTICS_OUTPUT_FILE_NAME); 
     324                        resourceOccupancyStatsFile = new PrintStream(new FileOutputStream(file)); 
     325                } catch (IOException e) { 
     326                        resourceOccupancyStatsFile = null; 
     327                } 
     328                 
     329                PrintStream resourceUtilizationStatsFile = null; 
    312330                try { 
    313331                        File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX 
    314332                                        + simulationIdentifier + "_" 
    315333                                        + RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME); 
    316                         resourceLoadStatsFile = new PrintStream(new FileOutputStream(file)); 
     334                        resourceUtilizationStatsFile = new PrintStream(new FileOutputStream(file)); 
    317335                } catch (IOException e) { 
    318                         resourceLoadStatsFile = null; 
     336                        resourceUtilizationStatsFile = null; 
    319337                } 
    320338                 
     
    389407                } 
    390408                 
    391                 basicResStats = gatherPEStats(jr.getTasks()); 
    392                 peStatsPostProcessing(basicResStats); 
    393                 basicResLoad = calculatePELoad( basicResStats); 
     409                pesStats = gatherPEStats(jr.getTasks()); 
     410                peStatsPostProcessing(pesStats); 
     411                basicResLoad = calculatePELoad(pesStats); 
    394412 
    395413                if (configuration.creatediagrams_gantt) { 
    396                         createPEGanttDiagram(basicResStats); 
     414                        createPEGanttDiagram(pesStats); 
    397415                } 
    398416                 
     
    412430                                 
    413431                                for(ComputingResource compResource: compResources){ 
    414                                         ResourceUsageStats resourceUsage = null; 
     432                                        ResourceUsageStats resourceUtilization = null;                                   
     433                                        ResourceUsageStats resourceOccupancy = null; 
    415434                                        ResourcePowerStats energyUsage = null; 
    416435                                        ResourceAirFlowStats airFlow = null; 
     
    418437                                        ResourceUsefulWorkStats usefulWork = null; 
    419438                                        if(type_stats.get(resourceTypeName).contains(Stats.textLoad)){ 
    420                                                 resourceUsage = gatherResourceLoadStats(compResource, basicResStats); 
    421                                                 resourceUsage.setMeanValue(calculateMeanValue(resourceUsage)); 
    422                                                 if (resourceLoadStatsFile != null) { 
    423                                                         Object txt = resourceUsage.serialize(serializer); 
    424                                                         resourceLoadStatsFile.print(txt); 
     439                                                resourceOccupancy = gatherResourceOccupancyStats(compResource, pesStats); 
     440                                                resourceOccupancy.setMeanValue(calculateMeanValue(resourceOccupancy)); 
     441                                                if (resourceOccupancyStatsFile != null) { 
     442                                                        Object txt = resourceOccupancy.serialize(serializer); 
     443                                                        resourceOccupancyStatsFile.print(txt); 
    425444                                                } 
    426  
     445                                                 
     446                                                resourceUtilization = gatherResourceUtlizationStats(compResource); 
     447                                                resourceUtilization.setMeanValue(calculateMeanValue(resourceUtilization)); 
     448                                                if (resourceUtilizationStatsFile != null) { 
     449                                                        Object txt = resourceUtilization.serialize(serializer); 
     450                                                        resourceUtilizationStatsFile.print(txt); 
     451                                                } 
    427452                                        } 
    428453                                        if(type_stats.get(resourceTypeName).contains(Stats.chartLoad)){ 
    429454                                                if (configuration.creatediagrams_resutilization) { 
    430                                                         createResourceLoadDiagram(resourceUsage); 
     455                                                        createResourceOccupancyDiagram(resourceOccupancy); 
     456                                                        createResourceUtilizationDiagram(resourceUtilization); 
    431457                                                } 
    432458                                        } 
     
    437463                                                resourceEnergyAccumulator.add(energyUsage.getSumValue()); 
    438464                                                maxResourceEnergyAccumulator.add(calculateMaxValue(energyUsage)); 
    439                                                 double calulcationsEnergy = 0; 
     465                                                double calculationsEnergy = 0; 
    440466                                                try { 
    441                                                         /*boolean doCalc = false; 
    442                                                         double prevTimestamp = 0; 
    443                                                         for(Long key: resourceUsage.getHistory().keySet()){ 
    444                                                                 if(doCalc){ 
    445                                                                         System.out.println(energyUsage.getHistory().get(key)); 
    446                                                                         calulcationsEnergy = calulcationsEnergy + energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600 * MILLI_SEC); 
    447                                                                         doCalc  = false; 
    448                                                                 } 
    449                                                                 if(resourceUsage.getHistory().get(key)>0){ 
    450                                                                         prevTimestamp = key; 
    451                                                                         doCalc = true; 
    452                                                                 } 
    453                                                         }*/ 
    454467                                                        boolean doCalc = false; 
     468                                                        double load = 0; 
    455469                                                        long prevTimestamp = 0; 
    456470                                                        for(Long key: energyUsage.getHistory().keySet()){ 
    457471                                                                if(doCalc){ 
    458                                                                         double load = 0; 
    459                                                                         if(resourceUsage.getHistory().get(prevTimestamp)!= null){ 
    460                                                                                 load = resourceUsage.getHistory().get(prevTimestamp); 
     472                                                                        if(resourceTypeName.equals("Rack")){ 
     473                                                                                calculationsEnergy = calculationsEnergy + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 
     474                                                                        }/* else if(resourceTypeName.equals("Processor")){ 
     475                                                                                Processor proc =( Processor) compResource; 
     476                                                                                double maxPower = proc.getPowerInterface().getLowestPState().getLoadPowerUsage().get(100.0); 
     477                                                                                calculationsEnergy = calculationsEnergy + load * maxPower * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 
     478                                                                        }*/ 
     479                                                                        else  
     480                                                                                calculationsEnergy = calculationsEnergy + load * energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 
     481                                                                        doCalc = false; 
     482                                                                        load = 0; 
     483                                                                } 
     484                                                                 
     485                                                                if(resourceUtilization.getHistory().get(key) != null){ 
     486                                                                        load = resourceUtilization.getHistory().get(key); 
     487                                                                        if(load > 0 ){ 
     488                                                                                doCalc = true; 
     489                                                                                prevTimestamp = key; 
    461490                                                                        } 
    462                                                                         calulcationsEnergy = calulcationsEnergy + load * energyUsage.getHistory().get(prevTimestamp) * (key - prevTimestamp) /(3600.0 * MILLI_SEC); 
    463                                                                         doCalc = false; 
    464                                                                 } 
    465                                                                 if(energyUsage.getHistory().get(key) > compResource.getPowerInterface().getSupportedPowerStates().get(0).getPowerUsage() - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION){ 
    466                                                                          
    467                                                                         prevTimestamp = key; 
    468                                                                         doCalc = true; 
    469491                                                                } 
    470492                                                        } 
    471                                                         //calulcationsEnergy = energyUsage.getSumValue() -  
    472                                                         //      ((1 - resourceUsage.getMeanValue()) * (endSimulationTime - startSimulationTime) / (3600 * MILLI_SEC)) *  
    473                                                         //      (compResource.getPowerInterface().getSupportedPowerStates().get(0).getPowerUsage() - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION); 
    474                                                         //System.out.println(compResource.getFullName() + ";" + resourceUsage.getMeanValue() +":"+ calulcationsEnergy  + ":" + energyUsage.getSumValue()); 
    475                                                         calculationsEnergyAccumulator.add(calulcationsEnergy); 
     493 
     494                                                        calculationsEnergyAccumulator.add(calculationsEnergy); 
    476495                                                } catch (Exception e) { 
    477496                                                        e.printStackTrace(); 
     
    510529                                                        devAccumulator.add(deviceEnergyUsage.getSumValue()); 
    511530                                                        metCalc.addMetricsData(device.getType().getName(), devAccumulator); 
     531                                                        metCalc.addMetricsData(device.getFullName(), devAccumulator); 
    512532                                                        if (deviceStatsFile != null) { 
    513533                                                                Object txt = deviceEnergyUsage.serialize(serializer); 
     
    666686                        //log.info("#STATS " + "Metrics"); 
    667687                        System.out.println("#STATS " + "===== Metrics ====="); 
    668                         for(MetricsStats metric: metCalc.calulateMetrics(endSimulationTime)){ 
     688                        for(MetricsStats metric: metCalc.calulateMetrics()){ 
    669689                                Object txt = metric.serialize(serializer); 
    670690                                //log.info("#STATS " +  metric.getResourceName() + " " + metric.getMetricName() + ": " + metric.getValue()); 
     
    676696                        } 
    677697                } 
    678                 saveResourceUsageDiagrams(); 
     698                saveResourceDiagrams(); 
    679699                createAccumulatedResourceSimulationStatistic(); 
    680700                 
     
    688708                        energyStatsFile.close(); 
    689709                } 
    690                 if (resourceLoadStatsFile != null) { 
    691                         resourceLoadStatsFile.close(); 
     710                if (resourceOccupancyStatsFile != null) { 
     711                        resourceOccupancyStatsFile.close(); 
     712                } 
     713                if (resourceUtilizationStatsFile != null) { 
     714                        resourceUtilizationStatsFile.close(); 
    692715                } 
    693716                 
     
    813836         
    814837         
    815         private ResourceUsageStats gatherResourceLoadStats(ComputingResource resource, Map<String, List<ResStat>> basicStats) { 
     838        private ResourceUsageStats gatherResourceOccupancyStats(ComputingResource resource, Map<String, List<ResStat>> basicStats) { 
    816839                String usageType = null; 
    817840                if(resource.getResourceCharacteristic().getParameters().get("load-sensor")!= null){ 
     
    844867                int usedResources = 0; 
    845868                for(ComputingResource compResource: resource.getChildren()){ 
    846                         double meanLoad = calculateMeanValue(gatherResourceLoadStats(compResource, basicResStats)); 
     869                        double meanLoad = calculateMeanValue(gatherResourceOccupancyStats(compResource, pesStats)); 
    847870                        if(meanLoad > 0){ 
    848871                                usedResources++; 
     
    916939        } 
    917940         
     941        private ResourceUsageStats gatherResourceUtlizationStats(PhysicalResource resource) { 
     942                 
     943                String usageType = null; 
     944                if(resource.getResourceCharacteristic().getParameters().get("load-sensor")!= null){ 
     945                        usageType = resource.getResourceCharacteristic().getParameters().get("load-sensor").get(0).getContent(); 
     946                } 
     947                ResourceUsageStats resUtlization = new ResourceUsageStats(resource.getFullName(), resource.getType(), usageType); 
     948                Map<Long, Double> usage = resUtlization.getHistory(); 
     949                 
     950                ExtensionList extensionList = resource.getExtensionList(); 
     951                if(extensionList != null){ 
     952                        for (Extension extension : extensionList) { 
     953                                if (extension.getType() == ExtensionType.LOAD_EXTENSION) { 
     954                                        LoadExtension le = (LoadExtension)extension; 
     955                                        if(le.getLoadProfile() == null) 
     956                                                break; 
     957                                        List<MeasurementHistory> loadHistory = le.getLoadProfile().getUtilizationHistory(); 
     958                                        if(loadHistory.size() == 0) 
     959                                                break; 
     960                                        long endSimulationTime = DateTimeUtilsExt.currentTimeMillis(); 
     961 
     962                                        loadHistory.add(new MeasurementHistory(endSimulationTime, le.getLoadProfile().getUtilizationHistory().get(le.getLoadProfile().getUtilizationHistory().size() - 1).getValue()/100)); 
     963                                        for(MeasurementHistory l:loadHistory){ 
     964                                                usage.put(l.getTimestamp(), l.getValue()/100); 
     965                                        } 
     966                                } 
     967                        } 
     968                } 
     969                return resUtlization; 
     970        } 
    918971         
    919972        private ResourcePowerStats gatherResourcePowerConsumptionStats(PhysicalResource resource) { 
     
    921974                 
    922975                String usageType = null; 
    923                 if(resource.getResourceCharacteristic().getParameters().get("power-sensor")!= null){ 
     976                if(resource.getResourceCharacteristic().getParameters().get("power-sensor") != null){ 
    924977                        usageType = resource.getResourceCharacteristic().getParameters().get("power-sensor").get(0).getContent(); 
    925978                } 
     
    9541007        } 
    9551008         
    956          
    9571009        private ResourceAirFlowStats gatherResourceAirFlowStats(PhysicalResource resource) { 
    9581010 
    9591011                String usageType = null; 
    960                 if(resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor")!= null){ 
     1012                if(resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor") != null){ 
    9611013                        usageType = resource.getResourceCharacteristic().getParameters().get("airflow_volume-sensor").get(0).getContent(); 
    9621014                } 
     
    10161068        } 
    10171069         
    1018         private void createResourceLoadDiagram(ResourceUsageStats resLoadStats) { 
     1070        private void createResourceOccupancyDiagram(ResourceUsageStats resLoadStats) { 
    10191071 
    10201072                for(Long key: resLoadStats.getHistory().keySet()){ 
     
    10261078                                startSimulationTime, endSimulationTime); 
    10271079 
    1028                 List<XYDataset> loadDiagram = resourceLoadDiagrams.get(resLoadStats.getResourceType().getName()); 
    1029                 if(loadDiagram == null){ 
    1030                         loadDiagram = new ArrayList<XYDataset>(); 
    1031                         loadDiagram.add(dataset); 
    1032                         resourceLoadDiagrams.put(resLoadStats.getResourceType().getName(), loadDiagram); 
     1080                List<XYDataset> occupancyDiagram = resourceOccupancyDiagrams.get(resLoadStats.getResourceType().getName()); 
     1081                if(occupancyDiagram == null){ 
     1082                        occupancyDiagram = new ArrayList<XYDataset>(); 
     1083                        occupancyDiagram.add(dataset); 
     1084                        resourceOccupancyDiagrams.put(resLoadStats.getResourceType().getName(), occupancyDiagram); 
    10331085                } else { 
    1034                         loadDiagram.add(dataset); 
     1086                        occupancyDiagram.add(dataset); 
     1087                } 
     1088        } 
     1089         
     1090        private void createResourceUtilizationDiagram(ResourceUsageStats resLoadStats) { 
     1091 
     1092                for(Long key: resLoadStats.getHistory().keySet()){ 
     1093                        Double value = resLoadStats.getHistory().get(key) * 100; 
     1094                        resLoadStats.getHistory().put(key, value); 
     1095                } 
     1096                 
     1097                XYDataset dataset = createResourceChartDataSet(resLoadStats, 
     1098                                startSimulationTime, endSimulationTime); 
     1099 
     1100                List<XYDataset> utilizationDiagram = resourceUtilizationDiagrams.get(resLoadStats.getResourceType().getName()); 
     1101                if(utilizationDiagram == null){ 
     1102                        utilizationDiagram = new ArrayList<XYDataset>(); 
     1103                        utilizationDiagram.add(dataset); 
     1104                        resourceUtilizationDiagrams.put(resLoadStats.getResourceType().getName(), utilizationDiagram); 
     1105                } else { 
     1106                        utilizationDiagram.add(dataset); 
    10351107                } 
    10361108        } 
     
    11091181        } 
    11101182 
    1111         private boolean saveResourceUsageDiagrams() { 
     1183        private boolean saveResourceDiagrams() { 
    11121184 
    11131185                if (!generateDiagrams) 
     
    11331205                chartName = "Load diagram for " 
    11341206                        + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    1135                 JFreeChart resourceLoadDiagram = null; 
     1207                JFreeChart resourceOccupancyDiagram = null; 
     1208                if (configuration.creatediagrams_resutilization) { 
     1209                        String axisName = "OCCUPANCY [%]"; 
     1210                        for(String resType: resourceOccupancyDiagrams.keySet()){ 
     1211                                resourceOccupancyDiagram = getResourceDynamicDiagram(resourceOccupancyDiagrams.get(resType), simulationTime, chartName, 
     1212                                                subtitle, axisName); 
     1213                                if (!saveXYPlotChart(resourceOccupancyDiagram, fileName + "ResourcesOccupancy_" + resType)) 
     1214                                        return false; 
     1215                        } 
     1216                } 
     1217                 
     1218                chartName = "Utilization diagram for " 
     1219                        + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
     1220                JFreeChart resourceUtilizationDiagram = null; 
    11361221                if (configuration.creatediagrams_resutilization) { 
    11371222                        String axisName = "UTILIZATION [%]"; 
    1138                         for(String resType: resourceLoadDiagrams.keySet()){ 
    1139                                 resourceLoadDiagram = getResourceDynamicDiagram(resourceLoadDiagrams.get(resType), simulationTime, chartName, 
     1223                        for(String resType: resourceUtilizationDiagrams.keySet()){ 
     1224                                resourceUtilizationDiagram = getResourceDynamicDiagram(resourceUtilizationDiagrams.get(resType), simulationTime, chartName, 
    11401225                                                subtitle, axisName); 
    1141                                 if (!saveXYPlotChart(resourceLoadDiagram, fileName + "ResourcesLoad_" + resType)) 
     1226                                if (!saveXYPlotChart(resourceUtilizationDiagram, fileName + "ResourcesUtilization_" + resType)) 
    11421227                                        return false; 
    11431228                        } 
     
    13221407                                //double load = calculateMeanValue(resourceUsage); 
    13231408                                double load = calculateResourceLoad(compRes, basicResLoad); 
    1324                                 accStats.meanTotalLoad.add(load); 
     1409                                accStats.meanTotalOccupancy.add(load); 
     1410 
     1411                                ResourceUsageStats resourceUtilization = gatherResourceUtlizationStats(compRes); 
     1412                                accStats.meanTotalLoad.add(calculateMeanValue(resourceUtilization)); 
    13251413                                /*ResourceEnergyStats energyUsage = gatherResourceEnergyStats(compRes); 
    13261414                                energyUsage.setMeanUsage(calculateEnergyLoad(energyUsage)); 
     
    13651453 
    13661454         
    1367         private double calculateMeanValue(ResourceDynamicStats resDynamicStats ){ 
     1455        private double calculateMeanValue(ResourceDynamicStats resDynamicStats){ 
    13681456                double meanValue = 0; 
    13691457                long time = -1; 
     
    13871475         
    13881476         
    1389         private double calculateMaxValue(ResourceDynamicStats resDynamicStats ){ 
     1477        private double calculateMaxValue(ResourceDynamicStats resDynamicStats){ 
    13901478                double maxValue = 0; 
    13911479 
     
    14141502                try { 
    14151503                        File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX + simulationIdentifier + "_" 
    1416                                         + RAW_TASKS_STATISTICS_OUTPUT_FILE_NAME); 
     1504                                        + TASKS_STATISTICS_OUTPUT_FILE_NAME); 
    14171505                        taskStatsFile = new PrintStream(new FileOutputStream(file)); 
    14181506                } catch (IOException e) { 
     
    16341722                chartName = "Task waiting times diagram for " + DataCenterWorkloadSimulator.SIMULATOR_NAME; 
    16351723                if (configuration.creatediagrams_taskswaitingtime) { 
    1636                         waitingTimeDiagram = getWaitingTimeDiagram(chartName, subtitle, simulationTime); 
     1724                        waitingTimeDiagram = getTaskWaitingTimeDiagram(chartName, subtitle, simulationTime); 
    16371725                        if (!saveCategoryChart(waitingTimeDiagram, fileName + "Waiting_Time", null /* "Task {1} at {0}" */)) 
    16381726                                return false; 
     
    16551743        } 
    16561744 
    1657         private JFreeChart getWaitingTimeDiagram(String chartName, Title subtitle, String simulationTime) { 
     1745        private JFreeChart getTaskWaitingTimeDiagram(String chartName, Title subtitle, String simulationTime) { 
    16581746                String tasks = "Tasks"; 
    16591747                boolean urls = false; 
     
    18781966        textTemperature, 
    18791967        chartTemperature, 
    1880         textUsefulWorl; 
     1968        textUsefulWork; 
    18811969} 
Note: See TracChangeset for help on using the changeset viewer.