Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/trunk/build/classes/schedframe/resources
Files:
16 added
41 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingNode.java

    r477 r539  
    1010import schedframe.resources.computing.extensions.ExtensionType; 
    1111import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    12 import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory; 
     12import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory; 
    1313import schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface; 
    1414import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
     
    2626                 
    2727                //extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin())); 
    28                 PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
     28                PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
    2929                accept(new EnergyExtension(pi, resDesc.getPowerProfile()));      
    3030        } 
     
    3939         
    4040        public ComputingNodePowerInterface getPowerInterface(){ 
    41                 ComputingNodePowerInterface powerProfile = null; 
     41                ComputingNodePowerInterface powerInterface = null; 
    4242                if(extensionList.isExtensionAvailable(ExtensionType.ENERGY_EXTENSION)){ 
    4343                        EnergyExtension ee = (EnergyExtension)extensionList.getExtension(ExtensionType.ENERGY_EXTENSION); 
    44                         powerProfile = (ComputingNodePowerInterface)ee.getPowerInterface(); 
     44                        powerInterface = (ComputingNodePowerInterface)ee.getPowerInterface(); 
    4545                } 
    46                 return powerProfile; 
     46                return powerInterface; 
    4747        } 
    4848 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingResource.java

    r477 r539  
    22 
    33import gridsim.GridSimTags; 
    4 import gridsim.gssim.WormsTags; 
     4import gridsim.dcworms.DCWormsTags; 
    55 
    66import java.util.ArrayList; 
     
    2828import schedframe.resources.computing.profiles.energy.EnergyEventType; 
    2929import schedframe.resources.computing.profiles.energy.EnergyExtension; 
     30import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
    3031import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    3132import schedframe.resources.computing.properties.DefaultPropertiesBuilder; 
     
    6869        } 
    6970 
    70         //TODO remove if possible (check if all scenarios can be realized - statistics issue) , since it's temporary method 
     71        //TODO remove if possible (check if all scenarios can be realized - statistics issue), since it's a temporary method 
    7172        private void addFakeProcessors() { 
    7273                if(getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.PE) != null){ 
     
    145146                sec.execute(event); 
    146147 
    147                  
    148148                //old, correctly working method 
    149149                /*if (extensionList != null) { 
     
    157157                //if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){ 
    158158                //      String src = event.getSource() != null ? event.getSource() : name; 
    159                 //      scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, src); 
     159                //      scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, src); 
    160160                //} 
    161161                //triggerEventUp(event); 
     
    188188        } 
    189189         
    190         protected List<? extends ComputingResource> searchDescendants(List<ResourceValidator> validators, boolean cutoff) { 
     190        protected List<? extends ComputingResource> searchDescendants(List<ResourceValidator> validators, boolean cutOff) { 
    191191 
    192192                List<ComputingResource> descendants = new ArrayList<ComputingResource>(); 
     
    198198                                ComputingResource resource = toExamine.pop(); 
    199199                                List<ComputingResource> resources = resource.getChildren(); 
    200                                 /*if (resources == null) 
    201                                         continue;*/ 
    202200                                int numberOfRes = resources.size(); 
    203201                                for (int i = 0; i < numberOfRes; i++) { 
     
    205203                                        if (resourceChild.match(validators)) { 
    206204                                                descendants.add(resourceChild); 
    207                                                 if(cutoff == false) { 
     205                                                if(cutOff == false) { 
    208206                                                        toExamine.addLast(resourceChild); 
    209207                                                } 
     
    243241                return null; 
    244242        } 
     243         
     244        public AirThroughputInterface getAirThroughputInterface(){ 
     245                if (extensionList != null) { 
     246                        for (Extension extension : extensionList) { 
     247                                if (extension.getType() == ExtensionType.ENERGY_EXTENSION) { 
     248                                        EnergyExtension ee = (EnergyExtension)extension; 
     249                                        return ee.getAirThroughputInterface(); 
     250                                } 
     251                        } 
     252                } 
     253                return null; 
     254        } 
    245255 
    246256        public Scheduler getScheduler() { 
     
    257267        } 
    258268 
    259         class SimpleEventHandler implements EventHandler{ 
     269        class ComputingResourceEventHandler implements EventHandler{ 
    260270                 
    261271                public void handleResourceEvent(Event event){ 
     
    275285                        if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){ 
    276286                                String src = event.getSource() != null ? event.getSource() : name; 
    277                                 scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, WormsTags.UPDATE, src); 
     287                                scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, src); 
    278288                        } else if(parent != null) 
    279289                                parent.getEventHandler().handleSchedulingEvent(event); 
     
    282292         
    283293        public EventHandler getEventHandler(){ 
    284                 return new SimpleEventHandler(); 
     294                return new ComputingResourceEventHandler(); 
    285295        } 
    286296         
    287297        public void initiate(){ 
     298                 
    288299                ResourceEventCommand rec = new ResourceEventCommand(this); 
    289                 EnergyEvent event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller"); 
     300                EnergyEvent event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller"); 
    290301                event.setReason(EventReason.SIM_INIT); 
    291302                rec.execute(event); 
     303                 
     304                rec = new ResourceEventCommand(this); 
     305                event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller"); 
     306                event.setReason(EventReason.SIM_INIT); 
     307                rec.execute(event); 
     308                 
    292309                //alternative way 
     310                //getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller")); 
    293311                //getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller")); 
    294312        } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/Core.java

    r477 r539  
    33import schedframe.resources.computing.description.ComputingResourceDescription; 
    44import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    5 import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory; 
     5import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory; 
    66import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    77import schedframe.resources.units.CpuSpeed; 
     
    1313        public Core (ComputingResourceDescription resDesc) { 
    1414                super(resDesc); 
    15                 PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
     15                PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
    1616                accept(new EnergyExtension(pi, resDesc.getPowerProfile()));      
    1717        } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/DataCenter.java

    r477 r539  
    33import schedframe.resources.computing.description.ComputingResourceDescription; 
    44import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    5 import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory; 
     5import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory; 
    66import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    77 
     
    1111                super(resDesc); 
    1212                //extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin())); 
    13                 PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
     13                PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
    1414                accept(new EnergyExtension(pi, resDesc.getPowerProfile())); 
    1515        } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/Processor.java

    r477 r539  
    88import schedframe.resources.computing.extensions.ExtensionType; 
    99import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    10 import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory; 
     10import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory; 
    1111import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    1212import schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface; 
     
    2222                super(resDesc); 
    2323                //extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin())); 
    24                 PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
     24                PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
    2525                accept(new EnergyExtension(pi, resDesc.getPowerProfile()));      
    2626        } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/Rack.java

    r477 r539  
    66import schedframe.resources.computing.description.ComputingResourceDescription; 
    77import schedframe.resources.computing.profiles.energy.EnergyExtension; 
    8 import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory; 
     8import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory; 
    99import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    1010 
     
    1414        public Rack (ComputingResourceDescription resDesc) { 
    1515                super(resDesc); 
    16                 PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
     16                PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile()); 
    1717                accept(new EnergyExtension(pi, resDesc.getPowerProfile()));      
    1818        } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/ResourceFactory.java

    r477 r539  
    1111import schedframe.scheduling.policy.local.LocalManagementSystem; 
    1212import schedframe.scheduling.queue.TaskQueueList; 
    13 import simulator.WormsConstants; 
     13import simulator.DCWormsConstants; 
    1414 
    1515 
     
    2020                if (resDesc.getType().equals(StandardResourceType.DataCenter)) 
    2121                        return new DataCenter(resDesc); 
     22                else if (resDesc.getType().equals(StandardResourceType.Rack)) 
     23                        return  new Rack(resDesc); 
    2224                else if (resDesc.getType().equals(StandardResourceType.ComputingNode)) 
    2325                        return  new ComputingNode(resDesc); 
     
    4648                        } 
    4749                        case LS: { 
    48                                 ms = new LocalManagementSystem(id, WormsConstants.MANAGEMENT_SYSTEM, 
     50                                ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, 
    4951                                                schedulingPlugin, execTimeEstimationPlugin, queues); 
    5052                                return new Scheduler(ms, type, managedResources); 
     
    5254 
    5355                default:{ 
    54                                 ms = new LocalManagementSystem(id, WormsConstants.MANAGEMENT_SYSTEM, 
     56                                ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM, 
    5557                                                schedulingPlugin, execTimeEstimationPlugin, queues); 
    5658                                return new Scheduler(ms, type, managedResources); 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyEventType.java

    r477 r539  
    1515        FREQUENCY_CHANGED(64), 
    1616        VOLTAGE_CHANGED(128), 
    17         RESOURCE_FAILED(256) 
     17         
     18        AIRFLOW_STATE_CHANGED(256), 
     19         
     20        RESOURCE_FAILED(512) 
    1821        ; 
    1922 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java

    r477 r539  
    1111import schedframe.resources.computing.extensions.ExtensionException; 
    1212import schedframe.resources.computing.extensions.ExtensionType; 
     13import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 
     14import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 
    1315import schedframe.resources.computing.profiles.energy.power.PowerProfile; 
    1416import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 
    1517import schedframe.scheduling.manager.tasks.JobRegistryImpl; 
    1618 
    17 public class EnergyExtension implements Extension/*, ResourceVisitor */{ 
     19public class EnergyExtension implements Extension{ 
    1820 
    1921        private Log log = LogFactory.getLog(EnergyExtension.class); 
     
    2123        protected PowerInterface powerInterface; 
    2224        protected PowerProfile powerProfile; 
    23  
     25         
     26        protected AirThroughputInterface airFlowInterface; 
     27        protected AirThroughputProfile airFlowProfile; 
     28         
    2429        protected ComputingResource computingResource; 
    2530 
     
    2934        } 
    3035 
    31         @Override 
     36        public EnergyExtension(PowerInterface powerInterface, PowerProfile powerProfile, 
     37                        AirThroughputInterface airFlowInterface, AirThroughputProfile airFlowProfile) { 
     38                super(); 
     39                this.powerInterface = powerInterface; 
     40                this.powerProfile = powerProfile; 
     41                this.airFlowInterface = airFlowInterface; 
     42                this.airFlowProfile = airFlowProfile; 
     43        } 
     44 
    3245        public boolean supportsEvent(Event event) { 
    3346 
    3447                if(powerProfile == null || powerProfile.getEnergyEstimationPlugin() == null) 
    3548                        return false; 
    36                  
    3749                if(event.getType().getName().equals(EnergyEventType.POWER_STATE_CHANGED.getName())) 
    3850                        return true; 
     
    4355                else if(event.getType().getName().equals(EnergyEventType.TASK_FINISHED.getName())) 
    4456                        return true; 
     57                 
     58                if(airFlowProfile == null) 
     59                        return false;    
     60                if(event.getType().getName().equals(EnergyEventType.AIRFLOW_STATE_CHANGED.getName())) 
     61                        return true; 
     62                 
    4563                else return false; 
    4664 
    4765        } 
    48          
    4966 
    50         @Override 
    5167        public void handleEvent(Event event) { 
    5268                EnergyEvent enEvent = (EnergyEvent)event; 
     
    87103                        //System.out.println(this.resource.getName() + " - ESTIMATED ENERGY:" + power); 
    88104                        powerProfile.addToPowerUsageHistory(power); 
    89  
     105                        break; 
     106                case AIRFLOW_STATE_CHANGED: 
     107                        System.out.println("====="); 
     108                        double airFlow = powerProfile.getEnergyEstimationPlugin().estimateAirThroughput(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 
     109                        airFlowProfile.addToPowerUsageHistory(airFlow); 
     110                        power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 
     111                        powerProfile.addToPowerUsageHistory(power); 
    90112                        break; 
    91113                } 
    92114        } 
    93          
    94         @Override 
     115 
    95116        public void init(Properties properties) throws ExtensionException { 
    96117                // TODO Auto-generated method stub 
    97118        } 
    98119 
    99         @Override 
    100120        public ExtensionType getType() { 
    101121                return ExtensionType.ENERGY_EXTENSION; 
     
    118138        } 
    119139 
     140        public AirThroughputInterface getAirThroughputInterface() { 
     141                return airFlowInterface; 
     142        } 
     143 
     144        public AirThroughputProfile getAirFlowProfile() { 
     145                return airFlowProfile; 
     146        } 
    120147 
    121148} 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java

    r477 r539  
    11package schedframe.resources.computing.profiles.energy.airthroughput; 
    22 
     3import java.util.ArrayList; 
    34import java.util.List; 
     5 
     6import org.joda.time.DateTimeUtils; 
    47 
    58import schedframe.Parameters; 
     
    811public class AirThroughputProfile { 
    912         
    10         AirThroughputEstimationPlugin airThroughputEstimationPlugin; 
     13        protected List<AirFlowValue> airFlowHistory; 
     14         
     15        protected AirThroughputEstimationPlugin airThroughputEstimationPlugin; 
    1116        protected List <AirThroughputState> airThroughputStates; 
     17        protected Parameters parameters; 
    1218 
    1319        public AirThroughputProfile(AirThroughputEstimationPlugin airThroughputEstimationPlugin, List<AirThroughputState> airThroughputStates) { 
     
    1521                this.airThroughputEstimationPlugin = airThroughputEstimationPlugin; 
    1622                this.airThroughputStates = airThroughputStates; 
     23                this.airFlowHistory = new ArrayList<AirFlowValue>(); 
    1724        } 
    1825 
     
    2128        } 
    2229         
    23         public void init(Parameters parameters){ 
    24                  
     30        public void addToPowerUsageHistory(double airFlow) { 
     31 
     32                if (airFlowHistory.size() == 0) { 
     33                        AirFlowValue usage = new AirFlowValue(DateTimeUtils.currentTimeMillis(), airFlow); 
     34                        airFlowHistory.add(usage); 
     35                        return; 
     36                } 
     37 
     38                int lastIdx = airFlowHistory.size() - 1; 
     39                double lastAirFlow = airFlowHistory.get(lastIdx).getValue(); 
     40                if (lastAirFlow != airFlow) { 
     41                        AirFlowValue usage = airFlowHistory.get(lastIdx); 
     42                        long currentTime = DateTimeUtils.currentTimeMillis(); 
     43                        if (usage.getTimestamp() == currentTime) { 
     44                                usage.setValue(airFlow); 
     45                                if(lastIdx > 0 && airFlowHistory.get(lastIdx - 1).getValue() == airFlow) 
     46                                        airFlowHistory.remove(usage); 
     47                        } else { 
     48                                usage = new AirFlowValue(DateTimeUtils.currentTimeMillis(), airFlow); 
     49                                airFlowHistory.add(usage); 
     50                        } 
     51                } 
     52        } 
     53 
     54        public List<AirFlowValue> getAirThroughputHistory() { 
     55                return airFlowHistory; 
     56        } 
     57         
     58        public void init(Parameters params){ 
     59                this.parameters = params; 
     60        } 
     61 
     62        public Parameters getParameters() { 
     63                return parameters; 
    2564        } 
    2665} 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerProfile.java

    r477 r539  
    1919        protected Map<String, PState> supportedPStates; 
    2020         
     21        protected Parameters parameters; 
     22         
    2123 
    22         public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<schedframe.resources.computing.profiles.energy.power.PowerState> supportedPowerStates) { 
     24        public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates) { 
    2325                this.energyEstimationPlugin = energyEstimationPlugin; 
    2426                this.powerUsage = new ArrayList<PowerUsage>(); 
    25                 this.supportedPowerStates = supportedPowerStates; 
     27                this.supportedPowerStates = powerStates; 
    2628        } 
    2729         
    28         public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<schedframe.resources.computing.profiles.energy.power.PowerState> supportedPowerStates,  List<schedframe.resources.computing.profiles.energy.power.PState> pStates) { 
     30        public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates,  List<PState> pStates) { 
    2931                this.energyEstimationPlugin = energyEstimationPlugin; 
    30                 this.supportedPowerStates = supportedPowerStates; 
     32                this.supportedPowerStates = powerStates; 
    3133                this.powerUsage = new ArrayList<PowerUsage>(); 
    3234                if(pStates.size() > 0) 
     
    98100        } 
    99101 
    100         public void init(Parameters parameters){ 
    101                  
     102        public void init(Parameters params){ 
     103                this.parameters = params; 
     104        } 
     105         
     106        public Parameters getParameters() { 
     107                return parameters; 
    102108        } 
    103109 
     110 
    104111} 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerUsage.java

    r477 r539  
    11package schedframe.resources.computing.profiles.energy.power; 
    22 
    3 public class PowerUsage { 
     3import schedframe.resources.computing.profiles.energy.MeasurementHistory; 
    44 
    5         protected long timestamp; 
    6         protected double value; 
     5public class PowerUsage extends MeasurementHistory{ 
    76 
    87        public PowerUsage(long timestamp, double value){ 
    9                 this.timestamp = timestamp; 
    10                 this.value = value; 
    11         } 
    12          
    13         public long getTimestamp() { 
    14                 return timestamp; 
    15         } 
    16  
    17         public double getValue() { 
    18                 return value; 
    19         } 
    20          
    21         public void setValue(double value) { 
    22                 this.value = value; 
     8                super(timestamp, value); 
    239        } 
    2410         
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java

    r477 r539  
    1010        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource); 
    1111 
    12         public double estimateEnergyDissipation(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource); 
     12        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource); 
    1313 
    1414        public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource); 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingNodePowerInterface.java

    r477 r539  
    1010import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    1111 
    12 public class ComputingNodePowerInterface extends AbstractPowerInterface{ 
     12public class ComputingNodePowerInterface extends ComputingResourcePowerInterface{ 
    1313 
    1414        public static long START_TIME = 600000; 
     
    2828                currentPowerState = state; 
    2929                ComputingNode computingNode = (ComputingNode) resource; 
     30                boolean pePowerStateChangeStatus = false; 
    3031                if(computingNode.getProcessors() != null) 
    3132                { 
    3233                        for(ComputingResource child:computingNode.getProcessors()){ 
    33                                 child.getPowerInterface().setPowerState(state); 
     34                                if(child.getPowerInterface() != null){ 
     35                                        pePowerStateChangeStatus = child.getPowerInterface().setPowerState(state);       
     36                                } 
    3437                        } 
    35                 } else { 
     38                }  
     39                 
     40                if(!pePowerStateChangeStatus){ 
    3641                        computingNode.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getName())); 
    3742                } 
    38                  
     43 
    3944                if(state == StandardPowerStateName.OFF){ 
    4045                        computingNode.setStatus(ResourceStatus.UNAVAILABLE); 
     
    4651                return true; 
    4752        } 
    48          
    49         /*public double getPowerConsumption(PowerState state) { 
    50                 if(currentPowerState == PowerState.OFF) 
    51                         return 0; 
    52                 else if(currentPowerState == PowerState.ON) 
    53                         return 750; 
    54                 else return 500; 
    55         }*/ 
    56  
    57         /*public boolean supportPowerState(PowerState state) { 
    58                 switch(state){ 
    59                         case ON:  
    60                                 return true; 
    61                         case OFF:  
    62                                 return true; 
    63                         case SLEEP:  
    64                                 return true; 
    65                         case HIBERNATE:  
    66                                 return true; 
    67                         default:  
    68                                 return false; 
    69                 } 
    70         } 
    71  
    72         public List<PowerState> getSupportedPowerStates() { 
    73                 return Arrays.asList(new PowerState[]{PowerState.ON, PowerState.OFF, PowerState.SLEEP, PowerState.HIBERNATE}); 
    74         }*/ 
    7553 
    7654        public void turnOn(){ 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/DataCenterPowerInterface.java

    r477 r539  
    77import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; 
    88 
    9 public class DataCenterPowerInterface extends AbstractPowerInterface{ 
     9public class DataCenterPowerInterface extends ComputingResourcePowerInterface{ 
    1010 
    11  
    12  
    13          
    1411        public DataCenterPowerInterface(ComputingResource resource, PowerProfile pp){ 
    1512                super(resource, pp); 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/PowerInterface.java

    r477 r539  
    33import java.util.List; 
    44 
     5import schedframe.Parameters; 
    56import schedframe.resources.computing.profiles.energy.power.PowerState; 
    67import schedframe.resources.computing.profiles.energy.power.PowerStateName; 
     
    2526        List<PowerUsage> getPowerUsageHistory(); 
    2627         
     28        public Parameters getParameters(); 
    2729} 
  • DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java

    r477 r539  
    11package schedframe.resources.computing.profiles.energy.power.ui; 
     2 
     3 
     4import gridsim.GridSimTags; 
     5import gridsim.dcworms.DCWormsTags; 
    26 
    37import java.util.Map; 
    48 
    5 import schedframe.events.ResourceEventCommand; 
    69import schedframe.resources.ResourceStatus; 
    710import schedframe.resources.computing.ComputingResource; 
    8 import schedframe.resources.computing.Processor; 
    911import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    1012import schedframe.resources.computing.profiles.energy.EnergyEventType; 
     
    1618import schedframe.resources.units.StandardResourceUnitName; 
    1719 
    18 public class ProcessorPowerInterface extends AbstractPowerInterface { 
     20public class ProcessorPowerInterface extends ComputingResourcePowerInterface { 
    1921 
    2022        protected PState currentPState; 
     
    3638                if(powerState != currentPowerState){ 
    3739                        currentPowerState = powerState; 
    38                         //Processor cpu = (Processor) resource; 
    3940                        if(powerState == StandardPowerStateName.OFF){ 
    4041                                resource.setStatus(ResourceStatus.UNAVAILABLE); 
     
    4243                                resource.setStatus(ResourceStatus.FREE); 
    4344                        } 
    44                         resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getName())); 
    45                         //cpu.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, cpu.getName()));                  
     45                        resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getName()));          
    4646                } 
    4747 
     
    7979 
    8080                if(newPState != currentPState){ 
    81                         double factor = newPState.getFrequency()/currentPState.getFrequency(); 
     81                        //double factor = newPState.getFrequency()/currentPState.getFrequency(); 
    8282                        currentPState = newPState; 
    83                         CpuSpeed speed = (CpuSpeed)resource.getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.CPUSPEED).get(0); 
    84                         speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue()); 
     83                        //CpuSpeed speed = (CpuSpeed)resource.getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.CPUSPEED).get(0); 
     84                        //speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue()); 
    8585                        //new ResourceEventCommand(resource).execute(EnergyEventType.FREQUENCY_CHANGED); 
    8686                        resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.getName())); 
    87                         //resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, resource.getName()); 
     87                        //resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, resource.getName()); 
    8888                        return true; 
    8989                } 
  • DCWoRMS/trunk/build/classes/schedframe/resources/units/AbstractResourceUnit.java

    r477 r539  
    7878        public ResourceUnitProvisioner getProvisioner() { 
    7979        return provisioner; 
    80  
     80        } 
     81         
     82        public Parameters getParameters(){ 
     83                return null; 
    8184        } 
    8285 
  • DCWoRMS/trunk/build/classes/schedframe/resources/units/ResourceUnit.java

    r477 r539  
    2323        public void init(Parameters parameters); 
    2424         
     25        public Parameters getParameters(); 
     26         
    2527        public ResourceUnitProvisioner getProvisioner(); 
    2628} 
Note: See TracChangeset for help on using the changeset viewer.