Index: DCWoRMS/branches/coolemall/src/example/energy/device/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/device/FanEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/device/FanEnergyEstimationPlugin.java	(revision 1415)
@@ -1,6 +1,6 @@
 package example.energy.device;
 
-import schedframe.events.scheduling.EventReason;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.events.EventReason;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName;
 import schedframe.resources.devices.PhysicalResource;
@@ -10,5 +10,5 @@
 public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		double powerConsumption = 0;
@@ -24,5 +24,5 @@
 	}
 
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		double airflow= 0;
 		try {
Index: DCWoRMS/branches/coolemall/src/example/energy/BaseEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/BaseEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/BaseEnergyEstimationPlugin.java	(revision 1415)
@@ -3,29 +3,44 @@
 import schedframe.Parameters;
 import schedframe.PluginConfiguration;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.plugin.EnergyEstimationPlugin;
+import schedframe.resources.computing.profiles.energy.power.plugin.EnergyPluginConfiguration;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
+import schemas.StringValueWithUnit;
 
 public abstract class BaseEnergyEstimationPlugin implements EnergyEstimationPlugin {
 
+	 EnergyPluginConfiguration plugConf;
+	 
 	@Override
 	public PluginConfiguration getConfiguration() {
-		// TODO Auto-generated method stub
-		return null;
+		return plugConf;
 	}
 	
 	@Override
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		throw new RuntimeException("Not implemented.");
 	}
 
 	@Override
-	public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource  resource) {
+	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource  resource) {
 		throw new RuntimeException("Not implemented.");
 	}
 	
 	public void init(Parameters parameters) {
-
+		plugConf = new EnergyPluginConfiguration();
+		try{
+			StringValueWithUnit powerCapLevel = parameters.get("powerCapLevel").get(0);
+			plugConf.setPowerCapLevel(Double.valueOf(powerCapLevel.getContent()).doubleValue());
+		} catch(Exception e){
+			plugConf.setPowerCapLevel(-1);
+		}
+		try{
+			StringValueWithUnit powerFloorLevel = parameters.get("powerFloorLevel").get(0);
+			plugConf.setPowerFloorLevel(Double.valueOf(powerFloorLevel.getContent()).doubleValue());
+		} catch(Exception e){
+			plugConf.setPowerFloorLevel(-1);
+		}
 	}
 
Index: DCWoRMS/branches/coolemall/src/example/energy/DataCenterEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/DataCenterEnergyEstimationPlugin.java	(revision 1258)
+++ DCWoRMS/branches/coolemall/src/example/energy/DataCenterEnergyEstimationPlugin.java	(revision 1415)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.DataCenter;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.PowerUsage;
 import schedframe.resources.devices.PhysicalResource;
@@ -11,5 +11,5 @@
 
 	@Override
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		double power = 0;
Index: DCWoRMS/branches/coolemall/src/example/energy/ProcessorEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/ProcessorEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/ProcessorEnergyEstimationPlugin.java	(revision 1415)
@@ -3,5 +3,5 @@
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.PhysicalResource;
@@ -10,5 +10,5 @@
 public class ProcessorEnergyEstimationPlugin extends BaseEnergyEstimationPlugin  {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		double powerConsumption;
@@ -42,4 +42,7 @@
 			
 		}
+		if(cpu.getLoadInterface().getRecentUtilization().getValue() != 0.0){
+			powerConsumption = powerConsumption * cpu.getLoadInterface().getRecentUtilization().getValue()/100;			
+		}
 		return powerConsumption;
 	}
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java	(revision 1322)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java	(revision 1415)
@@ -2,5 +2,5 @@
 
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.PhysicalResource;
@@ -10,5 +10,5 @@
 public class ProcessorEnergyEstimationPlugin extends BaseEnergyEstimationPlugin  {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeGroupEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeGroupEnergyEstimationPlugin.java	(revision 1247)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeGroupEnergyEstimationPlugin.java	(revision 1415)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -10,5 +10,5 @@
 public class NodeGroupEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java	(revision 1415)
@@ -1,8 +1,8 @@
 package example.energy.coolemall;
 
-import schedframe.events.scheduling.EventReason;
+import schedframe.events.EventReason;
 import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Node;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.Device;
@@ -14,5 +14,5 @@
 public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
@@ -35,5 +35,5 @@
 	}
 	
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		
 		double airflow = 0;
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java	(revision 1415)
@@ -10,5 +10,5 @@
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
 import schedframe.resources.computing.profiles.energy.power.PState;
@@ -26,5 +26,5 @@
 	double powerUpgradeLevel = -1;
 	
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java	(revision 1415)
@@ -5,5 +5,5 @@
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.Device;
 import schedframe.resources.devices.Fan;
@@ -15,5 +15,5 @@
 public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
@@ -86,5 +86,5 @@
 	}
 	
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		double airflow = 0;
 		double Vair_total;
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java	(revision 1415)
@@ -5,5 +5,5 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.Device;
@@ -15,5 +15,5 @@
 public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		double powerConsumption = 0;
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java	(revision 1415)
@@ -8,5 +8,5 @@
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.Device;
@@ -19,5 +19,5 @@
 public class CB2EnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1415)
@@ -5,5 +5,5 @@
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.Device;
 import schedframe.resources.devices.Fan;
@@ -15,5 +15,5 @@
 public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
@@ -23,5 +23,5 @@
 	}
 	
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		double airflow = 0;
 		double Vair_total;
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/HeatsinkEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/HeatsinkEnergyEstimationPlugin.java	(revision 1247)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/HeatsinkEnergyEstimationPlugin.java	(revision 1415)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.Device;
 import schedframe.resources.devices.PhysicalResource;
@@ -11,5 +11,5 @@
 public class HeatsinkEnergyEstimationPlugin extends BaseEnergyEstimationPlugin  {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java	(revision 1415)
@@ -7,5 +7,5 @@
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.Device;
@@ -18,10 +18,10 @@
 public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		double airflow = 0;
 		return airflow;
 	}
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		
Index: DCWoRMS/branches/coolemall/src/example/energy/DefaultEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/DefaultEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/DefaultEnergyEstimationPlugin.java	(revision 1415)
@@ -2,5 +2,5 @@
 
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -10,5 +10,5 @@
 
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		double powerConsumption = 0;
 		try {
Index: DCWoRMS/branches/coolemall/src/example/energy/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/NodeEnergyEstimationPlugin.java	(revision 1247)
+++ DCWoRMS/branches/coolemall/src/example/energy/NodeEnergyEstimationPlugin.java	(revision 1415)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.Device;
 import schedframe.resources.devices.PhysicalResource;
@@ -10,5 +10,5 @@
 public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
 		double powerConsumption = 0;
Index: DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithPausingResuming.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithPausingResuming.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithPausingResuming.java	(revision 1415)
@@ -0,0 +1,172 @@
+package example.localplugin;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.ResourceStatus;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Processor;
+import schedframe.resources.units.ProcessingElements;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
+import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.manager.resources.ClusterResourceManager;
+import schedframe.scheduling.manager.resources.ResourceManager;
+import schedframe.scheduling.manager.tasks.JobRegistry;
+import schedframe.scheduling.plan.SchedulingPlanInterface;
+import schedframe.scheduling.plan.impl.SchedulingPlan;
+import schedframe.scheduling.plugin.ModuleList;
+import schedframe.scheduling.queue.TaskQueue;
+import schedframe.scheduling.queue.TaskQueueList;
+import schedframe.scheduling.tasks.TaskInterface;
+import dcworms.schedframe.scheduling.ExecTask;
+import example.localplugin.BaseLocalSchedulingPlugin;
+import gridsim.dcworms.DCWormsTags;
+
+public class FCFSBF_RandomPluginWithPausingResuming extends BaseLocalSchedulingPlugin {
+
+	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
+			ResourceManager resManager, ModuleList modules) {
+
+		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		List<Processor> processors = resourceManager.getProcessors();
+		SchedulingPlan plan = new SchedulingPlan();
+		// choose the events types to serve.
+		// Different actions for different events are possible.
+		switch (event.getType()) {
+		case START_TASK_EXECUTION:
+		case TASK_RESUMED:
+		//case TIMER:
+			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
+			TaskQueue q = queues.get(0);
+			// check all tasks in queue
+
+			for (int i = 0; i < q.size(); i++) {
+				TaskInterface<?> task = q.get(i);
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+
+					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
+					if (choosenResources != null) {
+						addToSchedulingPlan(plan, task, choosenResources);
+					} else {
+						ExecTask taskToPause = getTaskWithLowestPriority(jobRegistry.getRunningTasks());
+						if(getTaskPriority(task) > getTaskPriority(taskToPause)){
+							jobRegistry.pauseTask(taskToPause.getJobId(), taskToPause.getId());
+						}
+					}
+				}
+			}
+
+			break;
+		case TASK_FINISHED:
+			for(ExecTask exec: jobRegistry.getTasks(DCWormsTags.PAUSED)){
+				jobRegistry.resumeTask(exec.getJobId(), exec.getId());
+			}
+			q = queues.get(0);
+			// check all tasks in queue
+
+			for (int i = 0; i < q.size(); i++) {
+				TaskInterface<?> task = q.get(i);
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
+					if (choosenResources != null) {
+						addToSchedulingPlan(plan, task, choosenResources);
+					}
+				}
+			}
+
+			break;
+		case TASK_PAUSED: 
+			 q = queues.get(0);
+			// check all tasks in queue
+
+			for (int i = 0; i < q.size(); i++) {
+				TaskInterface<?> task = q.get(i);
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+
+					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
+					if (choosenResources != null) {
+						addToSchedulingPlan(plan, task, choosenResources);
+					}
+				}
+			}
+
+		}
+		
+		return plan;
+	}
+
+	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
+			List<Processor> processors, TaskInterface<?> task) {
+
+		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
+
+		int cpuRequest;
+		try {
+			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+		} catch (NoSuchFieldException e) {
+			cpuRequest = 0;
+		}
+
+		if (cpuRequest != 0) {
+
+			if (processors.size() < cpuRequest) {
+				return null;
+			}
+
+			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
+			for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {
+				if (processors.get(i).getStatus() == ResourceStatus.FREE) {
+					choosenResources.add(processors.get(i));
+					cpuRequest--;
+				}
+			}
+			if (cpuRequest > 0) {
+				return null;
+			}
+
+			ProcessingElements pe = new ProcessingElements();
+			pe.addAll(choosenResources);
+			map.put(StandardResourceUnitName.PE, pe);
+			return map;
+		}
+
+		return null;
+	}
+	
+	
+	private int getTaskPriority(TaskInterface<?> task){
+		int priority;
+		
+		try {
+			double cpuRequest = task.getCpuCntRequest();
+			priority = (-1) * Double.valueOf(cpuRequest).intValue();
+		} catch (NoSuchFieldException e) {
+			priority = Integer.MIN_VALUE;
+		}
+		
+		return priority;
+	}
+	
+	private ExecTask getTaskWithLowestPriority(List<ExecTask> tasks){
+		ExecTask lowestPriorityTask = null;
+		int lowestPriority = Integer.MAX_VALUE;
+		for(ExecTask execTask: tasks){
+			int taskPriority = getTaskPriority(execTask);
+			if(taskPriority < lowestPriority){
+				lowestPriority = getTaskPriority(execTask);
+				lowestPriorityTask = execTask;
+			}
+		}
+		
+		return lowestPriorityTask;
+	}
+
+
+}
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationHighPerf_NodePowMan_SP.java	(revision 1415)
@@ -9,5 +9,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -94,10 +93,7 @@
 		Node node;
 		if(avNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new FavourableNodeComparator());
 			node = turnOnFirstNode(nodes, task);
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationLowPower_NodePowMan_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationLowPower_NodePowMan_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox1/CB1_FCFS_ConsolidationLowPower_NodePowMan_SP.java	(revision 1415)
@@ -9,5 +9,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -94,10 +93,7 @@
 		Node node;
 		if(avNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new FavourableNodeComparator());
 			node = turnOnFirstNode(nodes, task);
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationHighPerf_NodePowMan_SP.java	(revision 1415)
@@ -9,5 +9,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -95,10 +94,7 @@
 		Node node;
 		if(avNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+			
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new PerformanceComparator());
 			node = turnOnFirstNode(nodes, task);
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationLowPower_NodePowMan_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationLowPower_NodePowMan_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_ConsolidationLowPower_NodePowMan_SP.java	(revision 1415)
@@ -9,5 +9,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -94,10 +93,7 @@
 		Node node;
 		if(avNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new PowerComparator());
 			node = turnOnFirstNode(nodes, task);
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_PowerCapping_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_PowerCapping_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_PowerCapping_SP.java	(revision 1415)
@@ -78,11 +78,7 @@
 				if (task.getStatus() == DCWormsTags.READY) {
 
-					try {
-						if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0)
-							break;
-					} catch (ResourceException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
+					if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0)
+						break;
+
 					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task);
 					if (choosenResources != null) {
Index: DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_SP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_SP.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/coolemall/computebox2/CB2_FCFS_Random_SP.java	(revision 1415)
@@ -8,5 +8,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -61,11 +60,7 @@
 				if (task.getStatus() == DCWormsTags.READY) {
 
-					try {
-						if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0)
-							break;
-					} catch (ResourceException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
-					}
+					if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0)
+						break;
+
 					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task);
 					if (choosenResources != null) {
Index: DCWoRMS/branches/coolemall/src/example/localplugin/BaseLocalSchedulingPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/BaseLocalSchedulingPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/BaseLocalSchedulingPlugin.java	(revision 1415)
@@ -6,12 +6,9 @@
 import schedframe.Parameters;
 import schedframe.PluginConfiguration;
-import schedframe.events.scheduling.SchedulingEvent;
 import schedframe.events.scheduling.SchedulingEventType;
-import schedframe.events.scheduling.SchedulingResponseType;
 import schedframe.resources.units.ResourceUnit;
 import schedframe.resources.units.ResourceUnitName;
 import schedframe.scheduling.TaskList;
 import schedframe.scheduling.manager.resources.ResourceManager;
-import schedframe.scheduling.manager.tasks.JobRegistry;
 import schedframe.scheduling.plan.impl.Allocation;
 import schedframe.scheduling.plan.impl.ScheduledTask;
@@ -31,17 +28,4 @@
 	public PluginConfiguration getConfiguration() {
 		return plugConf;
-	}
-	
-	public SchedulingResponseType handleResourceAllocationViolation(SchedulingEvent event,
-			TaskQueueList queues, 
-			JobRegistry jobRegistry, 
-					ResourceManager resourceManager, ModuleList modules){
-		SchedulingResponseType responeEvent = null;
-		switch(event.getType()){
-			case TASK_REQUESTED_TIME_EXPIRED: 
-				responeEvent = SchedulingResponseType.KILL_TASK;
-				break;
-		}
-		return responeEvent;
 	}
 	
Index: DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithMigration.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithMigration.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/FCFSBF_RandomPluginWithMigration.java	(revision 1415)
@@ -0,0 +1,141 @@
+package example.localplugin;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.ResourceStatus;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Node;
+import schedframe.resources.computing.Processor;
+import schedframe.resources.units.ProcessingElements;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
+import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.manager.resources.ClusterResourceManager;
+import schedframe.scheduling.manager.resources.ResourceManager;
+import schedframe.scheduling.manager.tasks.JobRegistry;
+import schedframe.scheduling.manager.tasks.JobRegistryImpl;
+import schedframe.scheduling.plan.SchedulingPlanInterface;
+import schedframe.scheduling.plan.impl.SchedulingPlan;
+import schedframe.scheduling.plugin.ModuleList;
+import schedframe.scheduling.queue.TaskQueue;
+import schedframe.scheduling.queue.TaskQueueList;
+import schedframe.scheduling.tasks.TaskInterface;
+import dcworms.schedframe.scheduling.ExecTask;
+import example.localplugin.BaseLocalSchedulingPlugin;
+import gridsim.dcworms.DCWormsTags;
+
+public class FCFSBF_RandomPluginWithMigration extends BaseLocalSchedulingPlugin {
+
+	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
+			ResourceManager resManager, ModuleList modules) {
+
+		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		List<Processor> processors = resourceManager.getProcessors();
+		SchedulingPlan plan = new SchedulingPlan();
+		// choose the events types to serve.
+		// Different actions for different events are possible.
+		switch (event.getType()) {
+		case START_TASK_EXECUTION:
+		case TASK_FINISHED:
+		//case TIMER:
+			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
+			TaskQueue q = queues.get(0);
+			// check all tasks in queue
+
+			for (int i = 0; i < q.size(); i++) {
+				TaskInterface<?> task = q.get(i);
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
+					if (choosenResources != null) {
+						addToSchedulingPlan(plan, task, choosenResources);
+					} 
+				}
+			}
+			break;
+		case POWER_LIMIT_EXCEEDED:
+			String src = event.getSource();
+			optimizeEnergyUsage(jobRegistry, resourceManager , src);
+			break;
+
+		}
+		
+		return plan;
+	}
+
+	private void optimizeEnergyUsage(JobRegistry jobRegistry, ClusterResourceManager resourceManager, String resName) {
+		Node overLoadedNode = (Node)resourceManager .getResourceByName(resName);
+		Node leastLoadedNode = findLeastLoadedResource(resourceManager.getNodes());
+		
+		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue() >= overLoadedNode.getLoadInterface().getRecentUtilization().getValue()){
+			return;
+		}
+
+		JobRegistry srcHostJr = new JobRegistryImpl(overLoadedNode.getFullName());
+		int runningTasksNumber = srcHostJr.getRunningTasks().size();
+		for(int i = srcHostJr.getRunningTasks().size() - 1; i >= 0 && runningTasksNumber > 2; i--) {
+			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
+			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
+			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
+			runningTasksNumber--;
+		}
+	}
+
+	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
+			List<Processor> processors, TaskInterface<?> task) {
+
+		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
+
+		int cpuRequest;
+		try {
+			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+		} catch (NoSuchFieldException e) {
+			cpuRequest = 0;
+		}
+
+		if (cpuRequest != 0) {
+
+			if (processors.size() < cpuRequest) {
+				return null;
+			}
+
+			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
+			for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {
+				if (processors.get(i).getStatus() == ResourceStatus.FREE) {
+					choosenResources.add(processors.get(i));
+					cpuRequest--;
+				}
+			}
+			if (cpuRequest > 0) {
+				return null;
+			}
+
+			ProcessingElements pe = new ProcessingElements();
+			pe.addAll(choosenResources);
+			map.put(StandardResourceUnitName.PE, pe);
+			return map;
+		}
+
+		return null;
+	}
+
+	private Node findLeastLoadedResource(List<Node> nodes ){
+		Node leastLoadedNode = null;
+		double minLoad = Double.MAX_VALUE;
+		
+		for(int i = 0; i < nodes.size(); i++){
+			Node node = nodes.get(i);
+			double totalLoad = node.getLoadInterface().getRecentUtilization().getValue();
+			if(totalLoad < minLoad){
+				leastLoadedNode= node;
+				minLoad = totalLoad;
+			}
+		}
+		return leastLoadedNode;
+	}
+
+}
Index: DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationHighPerf_NodePowMan_Plugin.java	(revision 1415)
@@ -7,9 +7,10 @@
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -17,8 +18,11 @@
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.airthroughput.StandardAirflowStateName;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirflowState;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName;
+import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
 import schedframe.resources.computing.profiles.energy.power.PState;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.Device;
+import schedframe.resources.devices.Fan;
 import schedframe.resources.units.ProcessingElements;
 import schedframe.resources.units.ResourceUnit;
@@ -55,5 +59,5 @@
 			// check all tasks in queue
 
-			List<Node> notSelectedNodes = resourceManager.getNodes();
+			Set<Node> selectedNodes = new HashSet<Node>();
 			
 			for (int i = 0; i < q.size(); i++) {
@@ -67,9 +71,20 @@
 						ProcessingElements pe = (ProcessingElements) choosenResources.get(StandardResourceUnitName.PE);
 						Node node = (Node) pe.get(0).getParent();
-						notSelectedNodes.remove(node);
+						selectedNodes.add(node);
 					} 
 				}
 			}
-			turnOffIdleNodes(notSelectedNodes);
+			List<Node> nodes = resourceManager.getNodes();
+			nodes.removeAll(selectedNodes);
+			turnOffIdleNodes(nodes);
+			for(Node node: resourceManager.getNodes()){
+				for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
+					if(device.getType().equals(StandardResourceType.Fan)){
+						Fan fan = (Fan) device;
+						adjustFanSpeed(fan, selectedNodes);
+						break;
+					}
+				}
+			}
 			break;
 		}
@@ -84,10 +99,7 @@
 		Node node;
 		if(availableNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new PerformanceComparator());
 			node = turnOnFirstNode(nodes, task);
@@ -112,4 +124,5 @@
 			}
 		}
+
 		ProcessingElements result = new ProcessingElements(node.getFullName());
 		result.addAll(choosenResources);
@@ -167,10 +180,4 @@
 					continue;
 				else {
-					for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Fan)){
-							device.getAirflowInterface().setAirflowState(StandardAirflowStateName.ON);
-							break;
-						}
-					}
 					node.getPowerInterface().setPowerState(StandardPowerStateName.ON);
 					startedNode = node;
@@ -190,13 +197,6 @@
 			
 			if(freeProcessors == node.getProcessors().size()) {
-				for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-					if(device.getType().equals(StandardResourceType.Fan)){
-						device.getAirflowInterface().setAirflowState(StandardAirflowStateName.OFF);
-						break;
-					}
-				}
 				node.getPowerInterface().setPowerState(StandardPowerStateName.OFF);
 			}
-
 		}
 	}
@@ -249,4 +249,59 @@
 	    }
 	}
+	
+	private void adjustFanSpeed(Fan fan, Set<Node> selectedNodes){
+		AirflowStateName newState;
+		double totalLoad = 0;
+		double loadLevel;
+		ComputingResource compRes = fan.getComputingResource();
+		for(ComputingResource n: compRes.getChildren()){
+			if(fan.getChilledResources().contains(n.getFullName())){
+				if(selectedNodes.contains(n)){
+					totalLoad = totalLoad + 100;
+				} else {
+					totalLoad = totalLoad + n.getLoadInterface().getRecentUtilization().getValue();
+				}	
+			}
+		}
+		loadLevel = totalLoad / compRes.getChildren().size();
+		
+		double highestLoadLevel = 0;
+
+		if(fan.getAirflowInterface().supportAirflowState(new CustomAirflowStateName("ON_" + new Double(loadLevel).intValue()))){
+			newState = new CustomAirflowStateName("ON_" + new Double(loadLevel).intValue());
+		} else {
+			for(AirflowState airflowState: fan.getAirflowInterface().getSupportedAirflowStates()){
+				Double load;
+				try{
+					load = Double.valueOf(airflowState.getName().getLabel().substring(3));
+				}catch (Exception e){
+					continue;
+				}
+				if(highestLoadLevel < load){
+					highestLoadLevel = load;
+				}
+			}
+			if(loadLevel == 0){
+				newState = new CustomAirflowStateName("OFF");
+			} else {
+
+				double higherLoadLevel = highestLoadLevel;
+
+				for(AirflowState airflowState: fan.getAirflowInterface().getSupportedAirflowStates()){
+					Double load;
+					try{
+						load = Double.valueOf(airflowState.getName().getLabel().substring(3));
+					}catch (Exception e){
+						continue;
+					}
+					if(loadLevel < load){
+						higherLoadLevel = load;
+					}
+				}
+				newState = new CustomAirflowStateName("ON_" + Double.valueOf(higherLoadLevel).intValue());
+			}
+		}
+		fan.getAirflowInterface().setAirflowState(newState);
+	}
 
 }
Index: DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationLowPower_NodePowMan_Plugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationLowPower_NodePowMan_Plugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/localplugin/Cluster_FCFSBF_ConsolidationLowPower_NodePowMan_Plugin.java	(revision 1415)
@@ -11,5 +11,4 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.StandardResourceType;
@@ -83,10 +82,7 @@
 		Node node;
 		if(availableNodes.size() == 0){
-			try {
-				nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
-			} catch (ResourceException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+			
+			nodes = (List<Node>) resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Node, ResourceStatus.UNAVAILABLE);
+
 			Collections.sort(nodes, new PowerComparator());
 			node = turnOnFirstNode(nodes, task);
Index: DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/PhaseBasedTimeEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/PhaseBasedTimeEstimationPlugin.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/PhaseBasedTimeEstimationPlugin.java	(revision 1415)
@@ -0,0 +1,77 @@
+package example.timeestimation.coolemall;
+
+
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Core;
+import schedframe.resources.computing.Processor;
+import schedframe.resources.units.PEUnit;
+import schedframe.resources.units.ProcessingElements;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
+import schedframe.resources.units.StandardResourceUnitName;
+import dcworms.schedframe.scheduling.ExecTask;
+import example.timeestimation.BaseTimeEstimationPlugin;
+
+public class PhaseBasedTimeEstimationPlugin extends BaseTimeEstimationPlugin{
+
+	/*
+	 * This method should return an estimation of time required to execute the task.
+	 * Requested calculation should be done based on the resources allocated for the task,
+	 * task description and task completion percentage.
+	 * 
+	 * Example implementation calculate the estimation based on processing power.
+	 * There is also a simple assumption, that processing power is a linear function
+	 * of number of allocated units and their speed.
+	 */
+	public double execTimeEstimation(SchedulingEvent event, ExecTask task,
+			Map<ResourceUnitName, ResourceUnit> allocatedResources,
+			double completionPercentage) {
+		
+
+		//String taskFreqString = task.getExecutionProfile().getCurrentResourceConsumption().getReferenceHardware().get("cpu_maxfreq");
+		//double taskFreq = Double.valueOf(taskFreqString);
+
+		double speed = 0;
+		PEUnit peUnit = (PEUnit) allocatedResources.get(StandardResourceUnitName.PE);	
+		
+		try {
+			ProcessingElements pes = (ProcessingElements) peUnit;
+			for (ComputingResource compResource : pes) {
+				if(compResource instanceof Core) {
+					Core core = (Core) compResource;
+					speed = core.getProcessor().getPowerInterface().getPState().getFrequency();
+					break;
+				} else if (compResource instanceof Processor) {
+					Processor processor = (Processor) compResource;
+					speed = processor.getPowerInterface().getPState().getFrequency();
+					break;
+				}
+			}		
+		} catch (Exception e){
+			speed = peUnit.getSpeed();			
+		}
+
+		//speed =  taskFreq;
+		int cnt = peUnit.getUsedAmount();
+
+		double execTime = (1 - completionPercentage/100) * task.getExecutionProfile().getCurrentResourceConsumption().getLenght() / (speed * cnt);
+
+		//double execTime = (1 - completionPercentage/100) * task.getExecutionProfile().getCurrentResourceConsumption().getDuration() * (taskFreq / currentFrequency);
+		//double execTime = (1 - completionPercentage/100) * task.getExecutionProfile().getCurrentResourceConsumption().getDuration();
+		
+		// if the result is very close to 0, but less then one millisecond then round this result to 0.001
+		if (Double.compare(execTime, 0.001) < 0) {
+			execTime = 0.001;
+		}
+
+		// time is measured in integer units, so get the nearest execTime int value.
+		execTime = Math.round(execTime);
+		return execTime;
+	}
+
+}
+
+
Index: DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/CPUFreqScalingPhaseTimeEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/CPUFreqScalingPhaseTimeEstimationPlugin.java	(revision 1396)
+++ 	(revision )
@@ -1,59 +1,0 @@
-package example.timeestimation.coolemall;
-
-import java.util.Map;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Core;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.units.PEUnit;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-import dcworms.schedframe.scheduling.ExecTask;
-import example.timeestimation.BaseTimeEstimationPlugin;
-
-public class CPUFreqScalingPhaseTimeEstimationPlugin extends BaseTimeEstimationPlugin{
-
-	
-	public double execTimeEstimation(SchedulingEvent event, ExecTask task,
-			Map<ResourceUnitName, ResourceUnit> allocatedResources,
-			double completionPercentage) {
-		
-		String taskFreqString = task.getExecutionProfile().getCurrentResourceConsumption().getReferenceHardware().get("cpu_maxfreq");
-		double taskFreq = Double.valueOf(taskFreqString);
-		
-		PEUnit peUnit = (PEUnit) allocatedResources.get(StandardResourceUnitName.PE);
-		double currentFrequency = 0;
-		
-		if(peUnit instanceof ProcessingElements){
-			ProcessingElements pes = (ProcessingElements) peUnit;
-			for (ComputingResource compResource : pes) {
-				if(compResource instanceof Core) {
-					Core core = (Core) compResource;
-					currentFrequency = core.getProcessor().getPowerInterface().getPState().getFrequency();
-					break;
-				} else if (compResource instanceof Processor) {
-					Processor processor = (Processor) compResource;
-					currentFrequency = processor.getPowerInterface().getPState().getFrequency();
-					break;
-				}
-			}
-		}
-		else 
-			currentFrequency = taskFreq;
-
-		double execTime = (1 - completionPercentage/100) * task.getExecutionProfile().getCurrentResourceConsumption().getDuration() * (taskFreq / currentFrequency);
-
-		// if the result is very close to 0, but less then one millisecond then round this result to 0.001
-		if (Double.compare(execTime, 0.001) < 0) {
-			execTime = 0.001;
-		}
-
-		// time is measured in integer units, so get the nearest execTime int value.
-		execTime = Math.round(execTime);
-		return execTime;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/PhaseTimeEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/timeestimation/coolemall/PhaseTimeEstimationPlugin.java	(revision 1396)
+++ 	(revision )
@@ -1,41 +1,0 @@
-package example.timeestimation.coolemall;
-
-
-import java.util.Map;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.scheduling.tasks.phases.ResourceConsumption;
-import dcworms.schedframe.scheduling.ExecTask;
-import dcworms.schedframe.scheduling.Executable;
-import example.timeestimation.BaseTimeEstimationPlugin;
-
-public class PhaseTimeEstimationPlugin extends BaseTimeEstimationPlugin{
-
-	/*
-	 * This method should return an estimation of time required to execute the task.
-	 * Requested calculation should be done based on the resources allocated for the task,
-	 * task description and task completion percentage.
-	 */
-	public double execTimeEstimation(SchedulingEvent event, ExecTask task,
-			Map<ResourceUnitName, ResourceUnit> allocatedResources,
-			double completionPercentage) {
-
-		Executable exec = (Executable) task;
-
-		ResourceConsumption resConsumption = exec.getExecutionProfile().getCurrentResourceConsumption();
-
-		double execTime = (1 - completionPercentage/100) * resConsumption.getDuration();
-
-		// if the result is very close to 0, but less then one millisecond then round this result to 0.001
-		if (Double.compare(execTime, 0.001) < 0) {
-			execTime = 0.001;
-		}
-
-		// time is measured in integer units, so get the nearest execTime int value.
-		execTime = Math.round(execTime);
-		return execTime;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java	(revision 1415)
@@ -2,14 +2,14 @@
 
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
 import schedframe.scheduling.manager.tasks.JobRegistryImpl;
-import schedframe.scheduling.tasks.phases.PhaseBehaviour;
+import schedframe.scheduling.tasks.phases.PhaseSystemLoad;
 import dcworms.schedframe.scheduling.ExecTask;
 
 public class ProcessorLoadEstimationPlugin extends BaseLoadEstimationPlugin{
 
-	public double estimateUtlization(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateUtlization(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 		Processor proc = (Processor) resource;
 		double sumCoresLoad = 0;
@@ -26,5 +26,5 @@
 			double cpuUsage = 1 / nrOfThreadsOnCpu;
 
-			for(PhaseBehaviour pb: task.getExecutionProfile().getCurrentResourceConsumption().getBehaviourList()){
+			for(PhaseSystemLoad pb: task.getExecutionProfile().getCurrentResourceConsumption().getSystemLoad()){
 				if(pb.getResouceName().equals("PM_CPU_Usage")){
 					cpuUsage = pb.getUtilization();
Index: DCWoRMS/branches/coolemall/src/example/load/DefaultLoadEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/load/DefaultLoadEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/example/load/DefaultLoadEstimationPlugin.java	(revision 1415)
@@ -2,5 +2,5 @@
 
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -10,5 +10,5 @@
 public class DefaultLoadEstimationPlugin extends BaseLoadEstimationPlugin{
 
-	public double estimateUtlization(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+	public double estimateUtlization(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
 
 		ComputingResource computingResource = (ComputingResource) resource;
Index: DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java
===================================================================
--- DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java	(revision 1415)
@@ -30,5 +30,5 @@
 import schedframe.scheduling.tasks.AbstractProcessesGroup;
 import schedframe.scheduling.tasks.Task;
-import schedframe.scheduling.tasks.phases.ResourceConsumption;
+import schedframe.scheduling.tasks.phases.ExecutionPhase;
 import schedframe.scheduling.tasks.phases.ExecutionProfile;
 import schedframe.scheduling.tasks.requirements.ResourceParameterName;
@@ -48,5 +48,5 @@
 	
 	protected String reservationId;
-	protected double completionPercentage;
+	protected double completionPercentageTotal;
 	
 	protected int estimatedDuration;
@@ -64,5 +64,5 @@
 	protected ExecutionProfile execProfile;
 	
-	protected LinkedList<ExecutionHistoryItem> execHistory;;
+	protected LinkedList<ExecutionHistoryItem> execHistory;
 	protected LinkedList<ResourceItem> allocatedResources;
 	
@@ -187,5 +187,5 @@
 		
 		if (newStatus == DCWormsTags.SUCCESS || newStatus == DCWormsTags.CANCELED) {
-            finishTime = DateTimeUtilsExt.currentTimeMillis() / 1000;
+            finishTime = currentTime;
         }
 		
@@ -196,6 +196,6 @@
         if ((prevStatus == DCWormsTags.INEXEC) && (status == DCWormsTags.CANCELED || status == DCWormsTags.PAUSED ||
                 status == DCWormsTags.SUCCESS)){
-                totalCompletionTime += (currentTime -  execStartTime);
-                execStartTime = execStartTimeFirst;
+            totalCompletionTime += (currentTime -  execStartTime);
+            execStartTime = execStartTimeFirst;
         }
 
@@ -218,5 +218,5 @@
         if(status == DCWormsTags.NEW_EXEC_PHASE && prevStatus == DCWormsTags.INEXEC){
     		status = DCWormsTags.INEXEC;
-    		completionPercentage = 0;
+    		execProfile.setCompletionPercentage(0.0);
     		execProfile.setCurrentPhase(execProfile.getCurrentPhase() + 1);
         }
@@ -255,10 +255,10 @@
 	}
 	
-	public double getCompletionPercentage() {
-		return completionPercentage;
-	}
-
-	public void setCompletionPercentage(double completionPercentage) {
-		this.completionPercentage = completionPercentage;
+	public double getTotalCompletionPercentage() {
+		return completionPercentageTotal;
+	}
+
+	public void setTotalCompletionPercentage(double completionPercentage) {
+		this.completionPercentageTotal = completionPercentage;
 	}
 
@@ -370,8 +370,4 @@
 	}
 
-	public ResourceConsumption getCurrentResourceConsumption(){
-		return execProfile.getCurrentResourceConsumption();
-	}
-	
 	public String getApplicationName(){
 		return task.getApplicationName();
@@ -379,5 +375,5 @@
 	
 	private void preparePhases(String resourceType) {
-		LinkedList<ResourceConsumption> resourceConsumptionList = new LinkedList<ResourceConsumption>();
+		LinkedList<ExecutionPhase> resourceConsumptionList = new LinkedList<ExecutionPhase>();
 		
 		long usefulWork = -1;
@@ -385,7 +381,7 @@
 		if(task.getDescription().getExecution() == null || task.getDescription().getExecution().getResourceConsumptionProfile() == null
 				|| task.getDescription().getExecution().getResourceConsumptionProfile().length == 0 ){
-			ResourceConsumption resConsumption = null;
+			ExecutionPhase resConsumption = null;
 			try {
-				resConsumption = new ResourceConsumption(getLength(), task.getComputingResourceRequirements());
+				resConsumption = new ExecutionPhase(getLength(), task.getComputingResourceRequirements());
 			} catch (NoSuchFieldException e) {
 				// TODO Auto-generated catch block
@@ -399,5 +395,5 @@
 					if(resConsumptioProfile.getType() != null && resConsumptioProfile.getType().equals(resourceType)){
 						for(ResourceConsumptionType resConsumption: resConsumptioProfile.getResourceConsumption()){
-							ResourceConsumption resourceConsumption = new ResourceConsumption(resConsumption);
+							ExecutionPhase resourceConsumption = new ExecutionPhase(resConsumption);
 							resourceConsumptionList.add(resourceConsumption);
 						}
@@ -415,5 +411,5 @@
 			if(!found){
 				for(ResourceConsumptionType resConsumption: task.getDescription().getExecution().getResourceConsumptionProfile()[0].getResourceConsumption()){
-					ResourceConsumption resourceConsumption = new ResourceConsumption(resConsumption);
+					ExecutionPhase resourceConsumption = new ExecutionPhase(resConsumption);
 					resourceConsumptionList.add(resourceConsumption);
 				}
Index: DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java
===================================================================
--- DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java	(revision 1381)
+++ DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java	(revision 1415)
@@ -10,5 +10,5 @@
 	protected static final int DCWORMSBASE = 600; 
 	
-	public static final int TO_COMP_RESOURCES = DCWORMSBASE - 4;
+	public static final int TO_RESOURCES = DCWORMSBASE - 4;
 	
 	public static final int TO_SCHEDULERS = DCWORMSBASE - 3;
Index: DCWoRMS/branches/coolemall/src/simulator/DataCenterWorkloadSimulator.java
===================================================================
--- DCWoRMS/branches/coolemall/src/simulator/DataCenterWorkloadSimulator.java	(revision 1346)
+++ DCWoRMS/branches/coolemall/src/simulator/DataCenterWorkloadSimulator.java	(revision 1415)
@@ -271,9 +271,7 @@
 
 
-		boolean traceFlag = true; // means: trace GridSim events/activities
-		String[] excludeFromFile = { "" }, excludeFromProcessing = { "" };
-		
-		GridSimWrapper.init(numUser, calendar, traceFlag, excludeFromFile,
-				excludeFromProcessing, null);
+		boolean traceFlag = false; // means: trace GridSim events/activities
+
+		GridSimWrapper.init(numUser, calendar, traceFlag);
 		DateTimeUtilsExt.initVirtualTimeAccess(calendar);
 
Index: DCWoRMS/branches/coolemall/src/simulator/stats/DCwormsMetricsCalculator.java
===================================================================
--- DCWoRMS/branches/coolemall/src/simulator/stats/DCwormsMetricsCalculator.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/simulator/stats/DCwormsMetricsCalculator.java	(revision 1415)
@@ -14,8 +14,6 @@
 	public List<MetricsStats> calulateMetrics(){
 		List<MetricsStats> metrics = new ArrayList<MetricsStats>();
-		/*for(String resourceTypeName: metricsData.keySet()){
-			MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax());
-			metrics.add(metric);}
-		}*/
+
+		/*
 		metrics.add(calculateITComputingEnergyConsumption());
 		metrics.add(calculateITEnergyConsumption());
@@ -34,5 +32,6 @@
 		metrics.add(calculateUsefulWork());
 		metrics.add(calculateProductivity());
-
+		 */
+		
 		return metrics;
 	}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/EventHandler.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/EventHandler.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/EventHandler.java	(revision 1415)
@@ -2,8 +2,9 @@
 
 import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 
 public interface EventHandler {
 	
-	public void handleResourceEvent(Event event);
+	public void handleResourceEvent(ResourceEvent event);
 	
 	public void handleSchedulingEvent(SchedulingEvent event);
Index: DCWoRMS/branches/coolemall/src/schedframe/events/EventCommand.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/EventCommand.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/EventCommand.java	(revision 1415)
@@ -1,3 +1,5 @@
 package schedframe.events;
+
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 
 
@@ -5,4 +7,4 @@
 public interface EventCommand {
 	
-	public void execute(Event event);
+	public void execute(ResourceEvent event);
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/events/Event.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/Event.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/Event.java	(revision 1415)
@@ -1,5 +1,4 @@
 package schedframe.events;
 
-import schedframe.events.scheduling.EventReason;
 
 public interface Event {
@@ -9,6 +8,4 @@
 	public String getSource();
 	
-	public int getTag();
-	
 	public Object getData();
 	
Index: DCWoRMS/branches/coolemall/src/schedframe/events/EventType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/EventType.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/EventType.java	(revision 1415)
@@ -5,5 +5,3 @@
 	public String getName();
 	
-	public int getTag();
-	
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/ResourceStateChangedEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/ResourceStateChangedEvent.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/ResourceStateChangedEvent.java	(revision 1415)
@@ -1,22 +1,17 @@
 package schedframe.events.scheduling;
 
-import schedframe.events.EventType;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 
-public class ResourceStateChangedEvent  extends SchedulingEvent {
+public class ResourceStateChangedEvent extends SchedulingEvent {
 
-	protected String resourceName;
-	protected EventType eventType;
+	protected ResourceEventType eventType;
 	
-	public ResourceStateChangedEvent(String resourceName, EventType eventType) {
+	public ResourceStateChangedEvent(ResourceEventType eventType) {
 		super(SchedulingEventType.RESOURCE_STATE_CHANGED);
-		this.resourceName = resourceName;
 		this.eventType = eventType;
 	}
 
-	public String getResourceName() {
-		return resourceName;
-	}
 
-	public EventType getEventType() {
+	public ResourceEventType getResourceEventType() {
 		return eventType;
 	}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventCommand.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventCommand.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventCommand.java	(revision 1415)
@@ -1,7 +1,7 @@
 package schedframe.events.scheduling;
 
-import schedframe.events.Event;
 import schedframe.events.EventCommand;
 import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 
 public class SchedulingEventCommand implements EventCommand {
@@ -13,6 +13,6 @@
 	}
 	
-	public void execute(Event event) {
-		SchedulingEvent ev = new ResourceStateChangedEvent(compResource.getFullName(), event.getType());
+	public void execute(ResourceEvent event) {
+		SchedulingEvent ev = new ResourceStateChangedEvent(event.getType());
 		ev.setSource(compResource.getFullName());
 		compResource.getEventHandler().handleSchedulingEvent(ev);
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskPausedEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskPausedEvent.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskPausedEvent.java	(revision 1415)
@@ -0,0 +1,22 @@
+package schedframe.events.scheduling;
+
+public class TaskPausedEvent extends SchedulingEvent {
+
+	protected String jobId;
+	protected String taskId;
+	
+	public TaskPausedEvent(String jobId, String taskId) {
+		super(SchedulingEventType.TASK_PAUSED);
+		this.jobId = jobId;
+		this.taskId = taskId;
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+
+	public String getTaskId() {
+		return taskId;
+	}
+	
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEvent.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEvent.java	(revision 1415)
@@ -2,4 +2,5 @@
 
 import schedframe.events.Event;
+import schedframe.events.EventReason;
 import schedframe.events.EventType;
 
@@ -25,5 +26,5 @@
 			schedEventType = (SchedulingEventType)type;
 		} catch(Exception e){
-			schedEventType = SchedulingEventType.RESOURCE_STATE_CHANGED;
+			schedEventType = null;
 		}
 		return schedEventType;
@@ -42,8 +43,4 @@
 	}
 
-	public int getTag() {
-		return type.getTag();
-	}
-
 	public Object getData() {
 		return null;
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventType.java	(revision 1360)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingEventType.java	(revision 1415)
@@ -6,48 +6,33 @@
 
 	// task related
-	TASK_FINISHED(1),
-	TASK_FAILED(2),
-	TASK_CANCELED(4),
-	TASK_ARRIVED(8),
-	TASK_PAUSED(16),
-	TASK_RESUMED(32),
-	TASK_MOVED(64),
-	START_TASK_EXECUTION(128),
-	TASK_REQUESTED_TIME_EXPIRED(256),
+	TASK_FINISHED,
+	TASK_FAILED,
+	TASK_CANCELED,
+	TASK_ARRIVED,
+	TASK_PAUSED,
+	TASK_RESUMED,
+	TASK_MOVED,
+	TASK_EXECUTION_CHANGED,
+	START_TASK_EXECUTION,
+	TASK_REQUESTED_TIME_EXPIRED,
 
 	//job related
-	JOB_ARRIVED(512),
-	JOB_FINISHED(1024),
-	JOB_FAILED(2048),
-	JOB_CANCELED(4096),
+	JOB_ARRIVED,
+	JOB_FINISHED,
+	JOB_FAILED,
+	JOB_CANCELED,
 
 	//time related
-	TIMER(8192),
+	TIMER,
+		
+	//resource related
+	RESOURCE_FAILED,
+	//provider related (relevant to grid scheduling)
+	PROVIDER_FAILED,
+
+	RESOURCE_STATE_CHANGED,
 	
-	//reservation related
-	RESERVATION_ACTIVE(16384),
-	RESERVATION_FINISHED(32768),
-	RESERVATION_FAILED(65536),
-	RESERVATION_EXPIRED(131072),
-	
-	//resource related
-	RESOURCE_FAILED(262144),
-	//provider related (relevant to grid scheduling)
-	PROVIDER_FAILED(524288),
+	POWER_LIMIT_EXCEEDED;
 
-	RESOURCE_STATE_CHANGED(1048576),
-	
-	POWER_LIMIT_EXCEEDED(2097152)
-	;
-	
-	protected int tag;
-	
-	private SchedulingEventType(int tag){
-		this.tag = tag;
-	}
-	
-	public int getTag(){
-		return this.tag;
-	}
 	
 	public String getName(){
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskResumedEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskResumedEvent.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskResumedEvent.java	(revision 1415)
@@ -0,0 +1,22 @@
+package schedframe.events.scheduling;
+
+public class TaskResumedEvent extends SchedulingEvent {
+
+	protected String jobId;
+	protected String taskId;
+	
+	public TaskResumedEvent(String jobId, String taskId) {
+		super(SchedulingEventType.TASK_RESUMED);
+		this.jobId = jobId;
+		this.taskId = taskId;
+	}
+
+	public String getJobId() {
+		return jobId;
+	}
+
+	public String getTaskId() {
+		return taskId;
+	}
+	
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskCanceledEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskCanceledEvent.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/TaskCanceledEvent.java	(revision 1415)
@@ -2,4 +2,6 @@
 
 import java.util.List;
+
+import schedframe.events.EventReason;
 
 
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingResponseType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/SchedulingResponseType.java	(revision 477)
+++ 	(revision )
@@ -1,20 +1,0 @@
-package schedframe.events.scheduling;
-
-public enum SchedulingResponseType {
-
-	TERMINATE_TASK(0),
-	KILL_TASK(0),
-	STOP_AND_RESUME_FROM_CHECKPOINT(0),
-	EXECUTE_ANYWAY(0),
-	ONE_HOUR_GRACE_PERIOD(3600);
-	
-	protected int timer;
-	
-	private SchedulingResponseType(int timer){
-		this.timer = timer;
-	}
-	
-	public int getTimer(){
-		return this.timer;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/EventReason.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/scheduling/EventReason.java	(revision 477)
+++ 	(revision )
@@ -1,24 +1,0 @@
-package schedframe.events.scheduling;
-
-public enum EventReason {
-	//Reasons that caused given events
-	UNKNOWN,
-
-	//task-related
-	//TASK_FAILED
-	APP_FAILURE,
-	SYSTEM_FAILURE,
-	RESOURCE_FAILURE,
-	
-	//TASK_CANCELED
-	RESERVATION_EXCEEDED,
-	RESOURCES_EXCEEDED,
-	
-	//resource/provider-related
-	TEMPORARY_FAILURE,
-	PERMAMENT_FAILURE,
-	
-	
-	SIM_INIT
-	;
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/ResourceEventCommand.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/ResourceEventCommand.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/ResourceEventCommand.java	(revision 1415)
@@ -1,4 +1,5 @@
 package schedframe.events;
 
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 
@@ -11,5 +12,5 @@
 	}
 
-	public void execute(Event event) {
+	public void execute(ResourceEvent event) {
 		resource.getEventHandler().handleResourceEvent(event);
 	}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/EventReason.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/EventReason.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/events/EventReason.java	(revision 1415)
@@ -0,0 +1,24 @@
+package schedframe.events;
+
+public enum EventReason {
+	
+	//Reasons that caused given events
+	UNKNOWN,
+
+	//task-related
+	//TASK_FAILED
+	APP_FAILURE,
+	SYSTEM_FAILURE,
+	RESOURCE_FAILURE,
+	
+	//TASK_CANCELED
+	RESOURCES_EXCEEDED,
+	
+	//resource/provider-related
+	TEMPORARY_FAILURE,
+	PERMAMENT_FAILURE,
+	
+	
+	SIM_INIT
+	;
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/events/TaskEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/events/TaskEvent.java	(revision 478)
+++ 	(revision )
@@ -1,27 +1,0 @@
-package schedframe.events;
-
-import schedframe.scheduling.tasks.WorkloadUnit;
-
-
-
-public class TaskEvent {
-
-	protected WorkloadUnit task;
-	protected String resourceName;
-	
-	public TaskEvent(WorkloadUnit task,
-			 String resourceName) {
-		super();
-		this.task = task;
-		this.resourceName = resourceName;
-	}
-	
-	public WorkloadUnit getTask() {
-		return task;
-	}
-
-	public String getResourceName() {
-		return resourceName;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java	(revision 1415)
@@ -55,10 +55,10 @@
 					Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames();
 					for(String res: visitedResource){
-						if(res.contains(context)){
+						if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){
 							taskList.add(task);
 							break;
 						}
 					}
-					if(task.getSchedulerName().contains(context)) {
+					if(task.getSchedulerName().equals(context)) {
 						taskList.add(task);
 					}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java	(revision 1415)
@@ -107,5 +107,5 @@
 	}
 
-	public List<? extends ComputingResource> getResourcesOfType(ResourceType type) throws ResourceException {
+	public List<? extends ComputingResource> getResourcesOfType(ResourceType type) {
 		List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>();
 		for (ComputingResource resource : computingResources) {
@@ -118,6 +118,5 @@
 	}
 
-	public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status)
-			throws ResourceException {
+	public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status){
 
 		List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>();
@@ -225,9 +224,7 @@
 		List<ComputingResource> computingResources = null;
 		if(areResourcesAchievable(StandardResourceType.Core)){
-			try {
-				computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Core);
-			} catch (ResourceException e) {
-				throw new RuntimeException("DCWorms internal error");
-			}
+
+			computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Core);
+
 			PEUnit peUnit = new ProcessingElements(computingResources);
 			peUnits = new ArrayList<ResourceUnit>();
@@ -236,9 +233,7 @@
 
 		else if(areResourcesAchievable(StandardResourceType.Processor)){
-			try {
-				computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Processor);
-			} catch (ResourceException e) {
-				throw new RuntimeException("DCWorms internal error");
-			}
+
+			computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Processor);
+
 			PEUnit peUnit = new ProcessingElements(computingResources);
 			peUnits = new ArrayList<ResourceUnit>();
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java	(revision 1247)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java	(revision 1415)
@@ -1,12 +1,10 @@
 package schedframe.scheduling.manager.resources;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Node;
-import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Processor;
 import schedframe.scheduling.Scheduler;
@@ -22,18 +20,10 @@
 	@SuppressWarnings("unchecked")
 	public List<Node> getNodes(){
-		try {
-			return (List<Node>) getResourcesOfType(StandardResourceType.Node);
-		} catch (ResourceException e) {
-			return new ArrayList<Node>();
-		}
+		return (List<Node>) getResourcesOfType(StandardResourceType.Node);
 	}
 	
 	@SuppressWarnings("unchecked")
 	public List<Processor> getProcessors(){
-		try {
-			return (List<Processor>) getResourcesOfType(StandardResourceType.Processor);
-		} catch (Exception e) {
-			return new ArrayList<Processor>();
-		}
+		return (List<Processor>) getResourcesOfType(StandardResourceType.Processor);
 	}
 
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java	(revision 1415)
@@ -0,0 +1,87 @@
+package schedframe.scheduling.tasks.phases;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.qcg.broker.schemas.resreqs.ComputingResourceBaseTypeItem;
+import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType;
+import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
+import org.qcg.broker.schemas.resreqs.StringParameterType;
+
+import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;
+
+public class ExecutionPhase {
+
+	protected String id;
+    protected Map<String, String> referenceHardware;
+    protected long originDuration;
+    protected long lenght;
+    protected List<PhaseSystemLoad> systemLoad;
+    
+    public ExecutionPhase(long duration, ComputingResourceBaseTypeItem item[]){
+    	this.id = null;
+    	this.referenceHardware = null;
+    	this.originDuration = duration;
+    	this.systemLoad = new ArrayList<PhaseSystemLoad>();
+    	for(ComputingResourceBaseTypeItem compResItem: item){
+    		ComputingResourceParameterType hostParameter = compResItem.getHostParameter();
+        	PhaseSystemLoad pb = new PhaseSystemLoad(hostParameter.getName().toString());
+        	systemLoad.add(pb);
+    	}
+    	this.lenght = duration;
+    }
+    
+    public ExecutionPhase(ResourceConsumptionType resConsumptionType){
+    	this.id = resConsumptionType.getId();
+    	this.referenceHardware = new HashMap<String, String>();
+    	this.originDuration = resConsumptionType.getDuration().toLong() / 1000;
+    	
+    	double speed = 1;
+    	if(resConsumptionType.getReferenceHardware() != null){
+        	for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){
+        		StringParameterType spt = resConsumptionType.getReferenceHardware().getReference(i);
+        		this.referenceHardware.put(spt.getName(), spt.getContent());
+            	if(spt.getName().equals("cpu_maxfreq")){
+            		speed = new Double(spt.getContent());
+            	}
+        	}
+    	}
+    	this.systemLoad = new ArrayList<PhaseSystemLoad>();
+    	int nrOfThreads = 1;
+    	for(PhaseBehaviourType pbt: resConsumptionType.getBehaviour()){
+        	PhaseSystemLoad pb = new PhaseSystemLoad(pbt);
+        	this.systemLoad.add(pb);
+        	if(pbt.getName().equals("PM_Threads")){
+        		nrOfThreads = new Double(pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent()).intValue();
+        	}
+    	}
+    	this.lenght = (long) (originDuration * nrOfThreads * speed);
+    }
+    
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public Map<String, String> getReferenceHardware() {
+		return referenceHardware;
+	}
+
+	public long getDuration() {
+		return originDuration;
+	}
+
+	public List<PhaseSystemLoad> getSystemLoad() {
+		return systemLoad;
+	}
+
+	public long getLenght() {
+		return lenght;
+	}
+
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java	(revision 1362)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java	(revision 1415)
@@ -5,18 +5,21 @@
 public class ExecutionProfile {
 	
-	protected LinkedList<ResourceConsumption> resourceConsumptionList;
+	protected LinkedList<ExecutionPhase> resourceConsumptionList;
 	protected long usefulWork;
+	protected double completionPercentage;
 	private int currentPhase;
+	
 
-	public ExecutionProfile(LinkedList<ResourceConsumption> resourceConsumptionList) {
+	public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) {
 		this.resourceConsumptionList = resourceConsumptionList;
+		this.completionPercentage = 0;
 		this.currentPhase = 0;
 	}
 	
-	public LinkedList<ResourceConsumption> getResourceConsumptionList(){
+	public LinkedList<ExecutionPhase> getResourceConsumptionList(){
 		return resourceConsumptionList;
 	}
 	
-	public ResourceConsumption getCurrentResourceConsumption(){
+	public ExecutionPhase getCurrentResourceConsumption(){
 		return resourceConsumptionList.get(currentPhase);
 	}
@@ -44,3 +47,19 @@
 		return false;
 	}
+
+	public double getCompletionPercentage() {
+		return completionPercentage;
+	}
+
+	public void setCompletionPercentage(double completionPercentage) {
+		this.completionPercentage = completionPercentage;
+	}
+	
+	public long getLength() {
+		long length = 0;
+		for(ExecutionPhase execPhase: resourceConsumptionList){
+			length = length + execPhase.getLenght();
+		}
+		return length;
+	}
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java	(revision 1415)
@@ -0,0 +1,32 @@
+package schedframe.scheduling.tasks.phases;
+
+import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
+
+public class PhaseSystemLoad {
+	
+	protected String resName;
+	protected double utilization;
+	
+	PhaseSystemLoad(String resName, double utilization) {
+		this.resName = resName;
+		this.utilization = utilization;
+	}
+	
+	PhaseSystemLoad(String resName) {
+		this.resName = resName;
+		this.utilization = 100;
+	}
+	
+	PhaseSystemLoad(PhaseBehaviourType pbt) {
+		this.resName = pbt.getName();
+		this.utilization = pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent();
+	}
+	
+	public String getResouceName() {
+		return resName;
+	}
+	
+	public double getUtilization() {
+		return utilization;
+	}
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseBehaviour.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseBehaviour.java	(revision 883)
+++ 	(revision )
@@ -1,32 +1,0 @@
-package schedframe.scheduling.tasks.phases;
-
-import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
-
-public class PhaseBehaviour {
-	
-	protected String resName;
-	protected double utilization;
-	
-	PhaseBehaviour(String resName, double utilization) {
-		this.resName = resName;
-		this.utilization = utilization;
-	}
-	
-	PhaseBehaviour(String resName) {
-		this.resName = resName;
-		this.utilization = 100;
-	}
-	
-	PhaseBehaviour(PhaseBehaviourType pbt) {
-		this.resName = pbt.getName();
-		this.utilization = pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent();
-	}
-	
-	public String getResouceName() {
-		return resName;
-	}
-	
-	public double getUtilization() {
-		return utilization;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java	(revision 1207)
+++ 	(revision )
@@ -1,71 +1,0 @@
-package schedframe.scheduling.tasks.phases;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.qcg.broker.schemas.resreqs.ComputingResourceBaseTypeItem;
-import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType;
-import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
-import org.qcg.broker.schemas.resreqs.StringParameterType;
-
-import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;
-
-public class ResourceConsumption {
-
-	protected String id;
-    protected Map<String, String> referenceHardware;
-    protected long duration;
-    protected List<PhaseBehaviour> phaseBehaviourList;
-    
-    public ResourceConsumption(long duration, ComputingResourceBaseTypeItem item[]){
-    	this.id = null;
-    	this.referenceHardware = null;
-    	this.duration = duration;
-    	this.phaseBehaviourList = new ArrayList<PhaseBehaviour>();
-    	for(ComputingResourceBaseTypeItem compResItem: item){
-    		ComputingResourceParameterType hostParameter = compResItem.getHostParameter();
-        	PhaseBehaviour pb = new PhaseBehaviour(hostParameter.getName().toString());
-        	phaseBehaviourList.add(pb);
-    	}
-    }
-    
-    public ResourceConsumption(ResourceConsumptionType resConsumptionType){
-    	this.id = resConsumptionType.getId();
-    	this.referenceHardware = new HashMap<String, String>();
-    	if(resConsumptionType.getReferenceHardware() != null){
-        	for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){
-        		StringParameterType spt = resConsumptionType.getReferenceHardware().getReference(i);
-        		referenceHardware.put(spt.getName(), spt.getContent());
-        	}
-    	}
-    	this.duration = resConsumptionType.getDuration().toLong()/1000;
-    	this.phaseBehaviourList = new ArrayList<PhaseBehaviour>();
-    	for(PhaseBehaviourType pbt: resConsumptionType.getBehaviour()){
-        	PhaseBehaviour pb = new PhaseBehaviour(pbt);
-        	phaseBehaviourList.add(pb);
-    	}
-    }
-    
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public Map<String, String> getReferenceHardware() {
-		return referenceHardware;
-	}
-
-	public long getDuration() {
-		return duration;
-	}
-
-	public List<PhaseBehaviour> getBehaviourList() {
-		return phaseBehaviourList;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java	(revision 1415)
@@ -1,9 +1,9 @@
 package schedframe.scheduling;
 
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 
 import schedframe.resources.computing.ComputingResource;
@@ -16,9 +16,9 @@
 
 	protected Map<ResourceUnitName, ResourceUnit> usedResources;
-	protected Set<String> visitedResources;
+	protected Set<String> resourceNames;
 
 	public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){
 		this.usedResources = usedResources;
-		this.visitedResources = new HashSet<String>();
+		this.resourceNames = new TreeSet<String>();
 		saveResourceNames();
 	}
@@ -29,5 +29,5 @@
 	
 	public Set<String> getResourceNames(){
-		return visitedResources;
+		return resourceNames;
 	}
 	
@@ -43,6 +43,6 @@
 				List<ComputingResource> resources = compResource.getChildren();
 				if(resources.isEmpty()){
-					if(!visitedResources.contains(compResource.getFullName())){
-						visitedResources.add(compResource.getFullName());
+					if(!resourceNames.contains(compResource.getFullName())){
+						resourceNames.add(compResource.getFullName());
 					}
 				} else {
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java	(revision 1362)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java	(revision 1415)
@@ -63,10 +63,4 @@
 		List<Integer> schedRes = GridSim.getGridResourceList();
 		schedRes.add(schedulerIdObj);
-
-		/*if (supportsAR) {
-			res = GridSim.getAdvancedReservationList();
-			res.add(resIdObj);
-		} */
-
 	}
 	
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java	(revision 1415)
@@ -1,19 +1,9 @@
 package schedframe.scheduling.plugin.local;
 
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.events.scheduling.SchedulingResponseType;
-import schedframe.scheduling.manager.resources.ResourceManager;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import schedframe.scheduling.plugin.ModuleList;
 import schedframe.scheduling.plugin.SchedulingPlugin;
-import schedframe.scheduling.queue.TaskQueueList;
 
 
 public interface LocalSchedulingPlugin extends SchedulingPlugin {
 
-	public SchedulingResponseType handleResourceAllocationViolation(SchedulingEvent event,
-					TaskQueueList queues, 
-					JobRegistry jobRegistry, 
-					ResourceManager resourceManager, ModuleList modules);
 
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java	(revision 1385)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java	(revision 1415)
@@ -78,5 +78,4 @@
 			return;
 		}
-		
 		registerWorkloadUnit(wu);
 
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1415)
@@ -19,10 +19,12 @@
 import schedframe.events.scheduling.StartTaskExecutionEvent;
 import schedframe.events.scheduling.TaskFinishedEvent;
+import schedframe.events.scheduling.TaskPausedEvent;
 import schedframe.events.scheduling.TaskRequestedTimeExpiredEvent;
+import schedframe.events.scheduling.TaskResumedEvent;
 import schedframe.exceptions.ResourceException;
 import schedframe.resources.StandardResourceType;
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.units.PEUnit;
 import schedframe.resources.units.ProcessingElements;
@@ -163,7 +165,7 @@
 			String[] ids = (String[]) ev.get_data();
 			execTask = jobRegistry.getTask(ids[0], ids[1]);
-			taskPause(execTask);
+			pauseTask(execTask);
 			if (pluginSupportsEvent(tag)) {
-				SchedulingEvent event = new SchedulingEvent(SchedulingEventType.TASK_PAUSED);
+				SchedulingEvent event = new TaskPausedEvent(ids[0], ids[1]);
 				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
 						queues, jobRegistry, getResourceManager(), moduleList);
@@ -176,7 +178,7 @@
 			String[] ids = (String[]) ev.get_data();
 			execTask = jobRegistry.getTask(ids[0], ids[1]);
-			taskResume(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true);
+			resumeTask(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true);
 			if (pluginSupportsEvent(tag)) {
-				SchedulingEvent event = new StartTaskExecutionEvent(ids[0], ids[1]);
+				SchedulingEvent event = new TaskResumedEvent(ids[0], ids[1]);
 				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
 						queues, jobRegistry, getResourceManager(), moduleList);
@@ -189,5 +191,6 @@
 			Object[] data = (Object[]) ev.get_data();
 			execTask = jobRegistry.getTask((String)data[0], (String)data[1]);
-			double migrationTime = execTimeEstimationPlugin.estimateMigrationTime(new StartTaskExecutionEvent((String)data[0], (String)data[1]), execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), (Map<ResourceUnitName, ResourceUnit>)data[2]);
+			double migrationTime = execTimeEstimationPlugin.estimateMigrationTime(new StartTaskExecutionEvent((String)data[0], 
+					(String)data[1]), execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), (Map<ResourceUnitName, ResourceUnit>)data[2]);
 			scheduler.sendInternal(migrationTime, DCWormsTags.TASK_MOVE, data);
 		}
@@ -197,5 +200,5 @@
 			Object[] data = (Object[]) ev.get_data();
 			execTask = jobRegistry.getTask((String)data[0], (String)data[1]);
-			taskMove(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]);
+			moveTask(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]);
 			if (pluginSupportsEvent(tag)) {
 				SchedulingEvent event = new StartTaskExecutionEvent((String)data[0], (String)data[1]);
@@ -209,5 +212,5 @@
 		case DCWormsTags.TASK_EXECUTION_CHANGED:
 			execTask = (ExecTask) ev.get_data();
-			updateTaskExecutionPhase(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED);
+			updateTaskExecutionPhase(execTask);
 			break;
 
@@ -231,9 +234,12 @@
 			}
 			break;
-		}
-	}
-
-
-	public void taskPause(ExecTask execTask) {
+		default: 		
+			
+			break;
+		}
+	}
+
+
+	protected void pauseTask(ExecTask execTask) {
 		if (execTask == null) {
 			return;
@@ -246,5 +252,5 @@
 				getAllocationManager().freeResources(lastUsed, true);
 				
-				saveExecutionHistory(exec, exec.getCompletionPercentage(), exec.getEstimatedDuration());
+				saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), exec.getEstimatedDuration());
 				
 				ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), -1);
@@ -252,5 +258,5 @@
 				
 				PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE);
-				updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);
+				updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
@@ -260,5 +266,5 @@
 	}
 	
-	public void taskResume(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) {
+	protected void resumeTask(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) {
 		if (execTask == null) {
 			return;
@@ -278,5 +284,5 @@
 					
 					PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE);
-					updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);
+					updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec);
 				}
 
@@ -288,7 +294,7 @@
 	}
 	
-	public void taskMove(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> map) {
-		taskPause(execTask);
-		taskResume(execTask, map, false);
+	protected void moveTask(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> map) {
+		pauseTask(execTask);
+		resumeTask(execTask, map, false);
 	}
 	
@@ -351,5 +357,5 @@
 		
 		PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE);
-		updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
+		updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec);
 		
 
@@ -377,7 +383,7 @@
 
 		int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.START_TASK_EXECUTION), 
-				execTask, resources, exec.getCompletionPercentage())).intValue();
-
-		saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+				execTask, resources, exec.getExecutionProfile().getCompletionPercentage())).intValue();
+
+		saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration);
 		if(exec.getExecutionProfile().isLast()){
 			scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);;
@@ -387,5 +393,5 @@
 		
 		PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE);
-		updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);
+		updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec);
 		
 	}
@@ -429,10 +435,10 @@
 		
 		PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE);
-		updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);
+		updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec);
 		
 		log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime());
 		log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad());
 		
-		updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
+		updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec);
 	}
 	
@@ -452,5 +458,6 @@
 			//System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() );
 			//System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  execHistItem.getCompletionPercentage());
-			exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0)));
+			exec.getExecutionProfile().setCompletionPercentage(exec.getExecutionProfile().getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0)));
+			exec.setTotalCompletionPercentage(exec.getTotalCompletionPercentage() + 100 * (timeSpan / execHistItem.getEstimatedDuration()) * exec.getExecutionProfile().getCurrentResourceConsumption().getLenght() / exec.getExecutionProfile().getLength());
 			//System.out.println("newProgress: " + exec.getCompletionPercentage()  );	
 
@@ -458,9 +465,9 @@
 	}
 	
-	private void updateComputingResources(PEUnit peUnit, EnergyEventType eventType, Object obj){
+	private void updateComputingResources(PEUnit peUnit, ResourceEventType eventType, Object obj){
 		if(peUnit instanceof ProcessingElements){
 			ProcessingElements pes = (ProcessingElements) peUnit;
 			for (ComputingResource resource : pes) {
-				resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName()));
+				resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName()));
 				//DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj));
 			}
@@ -480,5 +487,5 @@
 				return;
 			}
-			resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName()));
+			resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName()));
 		}
 	}
@@ -492,9 +499,9 @@
 
 			int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.RESOURCE_STATE_CHANGED), 
-					execTask, choosenResources, exec.getCompletionPercentage())).intValue();
+					execTask, choosenResources, exec.getExecutionProfile().getCompletionPercentage())).intValue();
 
 			ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast();
-			double lastTimeStamp = execHistItem.getTimeStamp().getMillis()/1000;
-			if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)) == 0.0){
+			double lastTimeStamp = execHistItem.getTimeStamp().getMillis() / 1000;
+			if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis() / 1000 + phaseDuration)) == 0.0){
 				continue;
 			}
@@ -504,5 +511,5 @@
 			//System.out.println("completionPercantage: " + exec.getCompletionPercentage() + "; basic duration: " +exec.getResourceConsumptionProfile().getCurrentResourceConsumption().getDuration() +   "; phaseDuration: " +  phaseDuration);
 
-			saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+			saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration);
 			
 			if(exec.getExecutionProfile().isLast()){
@@ -522,5 +529,5 @@
 	}	
 
-	protected void updateTaskExecutionPhase(ExecTask execTask, SchedulingEventType schedEvType) {
+	protected void updateTaskExecutionPhase(ExecTask execTask) {
 
 		if (execTask.getStatus() == DCWormsTags.INEXEC) {
@@ -535,8 +542,8 @@
 			Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getAllocatedResources().getLast().getResourceUnits();
 
-			int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(schedEvType), 
-					execTask, choosenResources, exec.getCompletionPercentage())).intValue();
-			
-			saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+			int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.TASK_EXECUTION_CHANGED), 
+					execTask, choosenResources, exec.getExecutionProfile().getCompletionPercentage())).intValue();
+			
+			saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration);
 			
 			if(exec.getExecutionProfile().isLast()){
@@ -547,20 +554,16 @@
 			
 			PEUnit peUnit = (PEUnit)exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
-			updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
+			updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec);
 		}
 	}	
 
-	public double calculateTotalLoad() {
+	protected double calculateTotalLoad() {
 
 		DCwormsAccumulator loadAcc = new DCwormsAccumulator();
-		try {
-			for(ComputingResource compRes: getResourceManager().getResourcesOfType(StandardResourceType.Node)){
-				loadAcc.add(compRes.getLoadInterface().getRecentUtilization().getValue());				
-			}
-		} catch (ResourceException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
+
+		for(ComputingResource compRes: getResourceManager().getResourcesOfType(StandardResourceType.Node)){
+			loadAcc.add(compRes.getLoadInterface().getRecentUtilization().getValue());				
+		}
+
 		return loadAcc.getMean();
 	}
@@ -703,5 +706,4 @@
 	
 	private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){
-
 		ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime());
 		execHistoryItem.setCompletionPercentage(completionPercentage);
@@ -710,5 +712,4 @@
 		execHistoryItem.setStatus(exec.getStatus());
 		exec.addExecHistory(execHistoryItem);
-		
 	}
 	
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DevicePowerInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DevicePowerInterface.java	(revision 1380)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DevicePowerInterface.java	(revision 1415)
@@ -7,6 +7,6 @@
 
 import schedframe.Parameters;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
 import schedframe.resources.computing.profiles.energy.power.PowerState;
@@ -32,5 +32,5 @@
 			currentPowerState = state;
 
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, resource.getFullName()));
 
 			return true;
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Device.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Device.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Device.java	(revision 1415)
@@ -1,8 +1,7 @@
 package schedframe.resources.devices;
 
-import schedframe.events.Event;
 import schedframe.events.EventHandler;
+import schedframe.events.EventReason;
 import schedframe.events.ResourceEventCommand;
-import schedframe.events.scheduling.EventReason;
 import schedframe.events.scheduling.SchedulingEvent;
 import schedframe.resources.ResourceStatus;
@@ -11,6 +10,6 @@
 import schedframe.resources.computing.extensions.Extension;
 import schedframe.resources.computing.extensions.ExtensionListImpl;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
 import schedframe.resources.devices.description.DeviceDescription;
@@ -44,5 +43,5 @@
 	}
 
-	public void handleEvent(Event event) {
+	public void handleEvent(ResourceEvent event) {
 		ResourceEventCommand rec = new ResourceEventCommand(this);
 		rec.execute(event);
@@ -51,5 +50,5 @@
 	class DeviceEventHandler implements EventHandler{
 		
-		public void handleResourceEvent(Event event){
+		public void handleResourceEvent(ResourceEvent event){
 			if (extensionList != null) {
 				for (Extension extension : extensionList) {
@@ -75,15 +74,15 @@
 		
 		ResourceEventCommand rec = new ResourceEventCommand(this);
-		EnergyEvent event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
+		ResourceEvent event = new ResourceEvent(ResourceEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
 		
 		rec = new ResourceEventCommand(this);
-		event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller");
+		event = new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
 		
 		rec = new ResourceEventCommand(this);
-		event = new EnergyEvent(EnergyEventType.TEMPERATURE_CHANGED, "Resource controller");
+		event = new ResourceEvent(ResourceEventType.TEMPERATURE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/description/PhysicalResourceDescription.java	(revision 1415)
@@ -30,4 +30,5 @@
 import schemas.PowerUsage;
 import schemas.Profile;
+import schemas.StringValueWithUnit;
 import simulator.utils.InstanceFactory;
 import example.energy.DefaultEnergyEstimationPlugin;
@@ -82,4 +83,26 @@
 				}
 				Parameters params = extractParameters(powerProfileCharacteristic.getEnergyEstimationPlugin().getParameter());
+				if(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerCapLevel() != null) {
+					Parameter param = new Parameter("powerCapLevel");
+					StringValueWithUnit sv = new StringValueWithUnit();
+					sv.setContent(String.valueOf(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerCapLevel().getContent()));
+					sv.setUnit(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerCapLevel().getUnit());
+					param.add(sv);
+					
+					if(params == null)
+						params = new Parameters();
+					params.put("powerCapLevel", param);
+				}
+				if(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerFloorLevel() != null) {
+					Parameter param = new Parameter("powerFloorLevel");
+					StringValueWithUnit sv = new StringValueWithUnit();
+					sv.setContent(String.valueOf(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerFloorLevel().getContent()));
+					sv.setUnit(powerProfileCharacteristic.getEnergyEstimationPlugin().getPowerFloorLevel().getUnit());
+					param.add(sv);
+					
+					if(params == null)
+						params = new Parameters();
+					params.put("powerFloorLevel", param);
+				}
 				energyEstimationPlugin.init(params);
 			}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/DeviceAirflowInterface.java	(revision 1415)
@@ -7,6 +7,6 @@
 
 import schedframe.Parameters;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue;
 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile;
@@ -37,6 +37,6 @@
 			
 			//TO DO - notifications should be called for all resources starting form the lowest layer
-			resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getFullName()));
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.AIRFLOW_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, resource.getFullName()));
 			return true;
 		}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Fan.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Fan.java	(revision 1274)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/Fan.java	(revision 1415)
@@ -4,4 +4,5 @@
 import java.util.List;
 
+import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.devices.description.DeviceDescription;
 
@@ -12,8 +13,14 @@
 	public Fan(DeviceDescription devDesc) {
 		super(devDesc);
-		this.chilledResources = new ArrayList<String>();
 	}
 	
 	public List<String> getChilledResources(){
+		if(chilledResources == null){
+			List<String> resNames =  new ArrayList<String>();
+			for(ComputingResource compRes: this.getComputingResource().getChildren()){
+				resNames.add(compRes.getFullName());
+			}
+			return resNames;
+		}
 		return chilledResources;
 	}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/devices/PhysicalResource.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/devices/PhysicalResource.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/devices/PhysicalResource.java	(revision 1415)
@@ -12,4 +12,5 @@
 import schedframe.resources.computing.extensions.ExtensionType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirflowInterface;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
@@ -28,5 +29,5 @@
 
 	
-	public abstract void handleEvent(Event event);
+	public abstract void handleEvent(ResourceEvent event);
 	
 	public abstract EventHandler getEventHandler();
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/units/StandardResourceUnitName.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/units/StandardResourceUnitName.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/units/StandardResourceUnitName.java	(revision 1415)
@@ -37,5 +37,5 @@
     COST("cost"),
     
-    PE("processingElement");
+    PE("processingelement");
 
     
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/LoadExtension.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/LoadExtension.java	(revision 1285)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/LoadExtension.java	(revision 1415)
@@ -7,6 +7,6 @@
 import schedframe.resources.computing.extensions.ExtensionException;
 import schedframe.resources.computing.extensions.ExtensionType;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.load.ui.LoadInterface;
 import schedframe.resources.devices.PhysicalResource;
@@ -29,13 +29,13 @@
 		if(loadProfile == null || loadProfile.getLoadEstimationPlugin() == null)
 			return false;
-		if(event.getType().getName().equals(EnergyEventType.POWER_STATE_CHANGED.getName()))
+		if(event.getType().getName().equals(ResourceEventType.POWER_STATE_CHANGED.getName()))
 			return true;
-		else if(event.getType().getName().equals(EnergyEventType.FREQUENCY_CHANGED.getName()))
+		else if(event.getType().getName().equals(ResourceEventType.CPU_FREQUENCY_CHANGED.getName()))
 			return true;
-		else if(event.getType().getName().equals(EnergyEventType.TASK_STARTED.getName()))
+		else if(event.getType().getName().equals(ResourceEventType.TASK_STARTED.getName()))
 			return true;
-		else if(event.getType().getName().equals(EnergyEventType.TASK_FINISHED.getName()))
+		else if(event.getType().getName().equals(ResourceEventType.TASK_FINISHED.getName()))
 			return true;
-		else if(event.getType().getName().equals(EnergyEventType.RESOURCE_UTILIZATION_CHANGED.getName()))
+		else if(event.getType().getName().equals(ResourceEventType.UTILIZATION_CHANGED.getName()))
 			return true;		
 		else return false;
@@ -44,5 +44,5 @@
 	public void handleEvent(Event event) {
 		
-		EnergyEvent enEvent = (EnergyEvent)event;
+		ResourceEvent enEvent = (ResourceEvent)event;
 		double load = 0;
 		try{
@@ -54,5 +54,5 @@
 				break;
 				
-			case FREQUENCY_CHANGED:
+			case CPU_FREQUENCY_CHANGED:
 				load = loadProfile.getLoadEstimationPlugin().estimateUtlization(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				loadProfile.addToLoadHistory(load);
@@ -69,5 +69,5 @@
 				break;
 				
-			case RESOURCE_UTILIZATION_CHANGED:
+			case UTILIZATION_CHANGED:
 				load = loadProfile.getLoadEstimationPlugin().estimateUtlization(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				loadProfile.addToLoadHistory(load);
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/plugin/LoadEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/plugin/LoadEstimationPlugin.java	(revision 1285)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/load/plugin/LoadEstimationPlugin.java	(revision 1415)
@@ -2,5 +2,5 @@
 
 import schedframe.Plugin;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -8,5 +8,5 @@
 public interface LoadEstimationPlugin extends Plugin {
 	
-	public double estimateUtlization(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource);
+	public double estimateUtlization(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource);
 
 
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEvent.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEvent.java	(revision 1415)
@@ -0,0 +1,53 @@
+package schedframe.resources.computing.profiles.energy;
+
+import schedframe.events.Event;
+import schedframe.events.EventReason;
+import schedframe.events.EventType;
+
+
+public class ResourceEvent implements Event{
+
+	protected EventType type;
+	protected EventReason reason;
+	protected String source;
+	protected Object data;
+
+	public ResourceEvent(EventType eventType, String source){
+		this.type = eventType;
+		this.source = source;
+		setReason(EventReason.UNKNOWN);
+	}
+	
+	public ResourceEvent(EventType eventType, Object data, String source){
+		this.type = eventType;
+		this.data = data;
+		this.source = source;
+		setReason(EventReason.UNKNOWN);
+	}
+	
+	public ResourceEventType getType() {
+		ResourceEventType resEventType; 
+		try{
+			resEventType = (ResourceEventType)type;
+		} catch(Exception e){
+			resEventType = null; 
+		}
+		return resEventType;
+	}
+
+	public Object getData() {
+		return data;
+	}
+
+	public String getSource() {
+		return source;
+	}
+
+	public EventReason getReason() {
+		return reason;
+	}
+
+	public void setReason(EventReason reason) {
+		this.reason = reason;
+	}
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEventType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEventType.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/ResourceEventType.java	(revision 1415)
@@ -0,0 +1,23 @@
+package schedframe.resources.computing.profiles.energy;
+
+import schedframe.events.EventType;
+
+public enum ResourceEventType implements EventType {
+	
+	TASK_STARTED,
+	TASK_FINISHED,
+
+	POWER_STATE_CHANGED,
+	CPU_FREQUENCY_CHANGED,
+	AIRFLOW_STATE_CHANGED,
+	
+	UTILIZATION_CHANGED,
+	
+	TEMPERATURE_CHANGED,
+	
+	UPDATE_POWER_STATE;
+
+	public String getName(){
+		return toString();
+	}
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java	(revision 1415)
@@ -9,6 +9,6 @@
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
 import schedframe.resources.computing.profiles.energy.power.PowerState;
@@ -49,5 +49,5 @@
 			}
 			//notifications from all levels
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, resource.getFullName()));
 
 			//notification from last level
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java	(revision 1299)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java	(revision 1415)
@@ -6,6 +6,6 @@
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.power.PState;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
@@ -33,5 +33,5 @@
 				resource.setStatus(ResourceStatus.FREE);
 			}
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));		
+			resource.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, resource.getFullName()));		
 		}
 
@@ -67,5 +67,5 @@
 			//speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue());
 			//new ResourceEventCommand(resource).execute(EnergyEventType.FREQUENCY_CHANGED);
-			resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.CPU_FREQUENCY_CHANGED, resource.getFullName()));
 			//resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, resource.getName());
 			
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/NodePowerInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/NodePowerInterface.java	(revision 1384)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/ui/NodePowerInterface.java	(revision 1415)
@@ -3,12 +3,17 @@
 
 
+import java.util.List;
+
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Node;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
+import schedframe.resources.computing.profiles.energy.power.PowerState;
 import schedframe.resources.computing.profiles.energy.power.PowerStateName;
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
+import schedframe.resources.computing.profiles.energy.power.Transition;
+import simulator.DataCenterWorkloadSimulator;
 
 public class NodePowerInterface extends ComputingResourcePowerInterface{
@@ -26,5 +31,5 @@
 			
 			Node node = (Node) resource;
-			for(ComputingResource child:node.getProcessors()){
+			for(ComputingResource child: node.getProcessors()){
 				if(child.getPowerInterface() != null){
 					child.getPowerInterface().setPowerState(state);	
@@ -39,5 +44,5 @@
 			}
 	
-			node.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, node.getFullName()));
+			node.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, node.getFullName()));
 
 			//node.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getName()));
@@ -48,11 +53,32 @@
 
 	public void turnOn(){
+		/*double timePenalty = getTransitionTime(currentPowerState, StandardPowerStateName.ON);
+		setPowerState(StandardPowerStateName.BOOT);
+		DataCenterWorkloadSimulator.getEventManager().sendToResource(resource.getFullName(), timePenalty, new ResourceEvent(ResourceEventType.UPDATE_POWER_STATE, StandardPowerStateName.ON, resource.getFullName()));*/
 		setPowerState(StandardPowerStateName.ON);
 	}
 	
 	public void turnOff(){
+		/*double timePenalty = getTransitionTime(currentPowerState, StandardPowerStateName.OFF);
+		setPowerState(StandardPowerStateName.POWEROFF);
+		DataCenterWorkloadSimulator.getEventManager().sendToResource(resource.getFullName(), timePenalty, new ResourceEvent(ResourceEventType.UPDATE_POWER_STATE, StandardPowerStateName.OFF, resource.getFullName()));*/
 		setPowerState(StandardPowerStateName.OFF);
 	}
 
+	private double getTransitionTime(PowerStateName from, PowerStateName to){
+		List<PowerState> availablePowerStates = getSupportedPowerStates();
+		double timePenalty = 0;
+		for(PowerState ps : availablePowerStates){
+			if(ps.getName().getLabel().equals(from.getLabel())){
+				List<Transition> transitions = ps.getTransitions();
+				for(Transition t: transitions){
+					if(t.getTo().getLabel().equals(to)){
+						timePenalty = t.getTime();
+					}
+				}
+			}
+		}
+		return timePenalty;
+	}
 
 
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyPluginConfiguration.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyPluginConfiguration.java	(revision 1415)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyPluginConfiguration.java	(revision 1415)
@@ -0,0 +1,43 @@
+package schedframe.resources.computing.profiles.energy.power.plugin;
+
+import java.util.Map;
+
+import schedframe.PluginConfiguration;
+import schedframe.events.scheduling.SchedulingEventType;
+
+public class EnergyPluginConfiguration  implements PluginConfiguration {
+	
+	//private Map<SchedulingEventType, Object> events;
+	private double powerCapLevel;
+	private double powerFloorLevel;
+
+	public EnergyPluginConfiguration(){
+		//this.events = new HashMap<SchedulingEventType, Object>();
+	}
+	
+	public void addServedEvent(SchedulingEventType eventType, Object argument){
+		//events.put(eventType, argument);
+	}
+	
+	public Map<SchedulingEventType, Object> getServedEvents() {
+		//return events;
+		return null;
+	}
+
+	public double getPowerCapLevel() {
+		return powerCapLevel;
+	}
+
+	public void setPowerCapLevel(double powerCapLevel) {
+		this.powerCapLevel = powerCapLevel;
+	}
+
+	public double getPowerFloorLevel() {
+		return powerFloorLevel;
+	}
+
+	public void setPowerFloorLevel(double powerFloorLevel) {
+		this.powerFloorLevel = powerFloorLevel;
+	}
+}
+
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java	(revision 1415)
@@ -2,5 +2,5 @@
 
 import schedframe.Plugin;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -8,9 +8,9 @@
 public interface EnergyEstimationPlugin extends Plugin {
 	
-	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource);
+	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource);
 
-	public double estimateAirflow(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource);
+	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource);
 
-	public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource);
+	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource);
 
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/StandardPowerStateName.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/StandardPowerStateName.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/power/StandardPowerStateName.java	(revision 1415)
@@ -8,5 +8,7 @@
 	SLEEP,
 	SUSPEND,
-	HIBERNATE;
+	HIBERNATE,
+	BOOT,
+	POWEROFF;
 
 	public String getLabel() {
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirflowInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirflowInterface.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/airthroughput/ui/ComputingResourceAirflowInterface.java	(revision 1415)
@@ -8,6 +8,6 @@
 import schedframe.Parameters;
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowValue;
 import schedframe.resources.computing.profiles.energy.airthroughput.AirflowProfile;
@@ -37,6 +37,6 @@
 			
 			//TO DO - notifications should be called for all resources starting form the lowest layer
-			resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getFullName()));
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.AIRFLOW_STATE_CHANGED, resource.getFullName()));
+			resource.handleEvent(new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, resource.getFullName()));
 			return true;
 		}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyExtension.java	(revision 1415)
@@ -15,4 +15,5 @@
 import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
+import schedframe.resources.computing.profiles.energy.power.PowerStateName;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 import schedframe.resources.computing.profiles.energy.thermal.ThermalInterfaceFactory;
@@ -110,18 +111,18 @@
 		if(powerProfile == null || powerProfile.getEnergyEstimationPlugin() == null)
 			return false;
-		if(event.getType().getName().equals(EnergyEventType.POWER_STATE_CHANGED.getName()))
-			return true;
-		else if(event.getType().getName().equals(EnergyEventType.FREQUENCY_CHANGED.getName()))
-			return true;
-		else if(event.getType().getName().equals(EnergyEventType.TASK_STARTED.getName()))
-			return true;
-		else if(event.getType().getName().equals(EnergyEventType.TASK_FINISHED.getName()))
-			return true;
-		else if(event.getType().getName().equals(EnergyEventType.RESOURCE_UTILIZATION_CHANGED.getName()))
-			return true;
-	
-		if(event.getType().getName().equals(EnergyEventType.AIRFLOW_STATE_CHANGED.getName()))
-			return true;
-		if(event.getType().getName().equals(EnergyEventType.TEMPERATURE_CHANGED.getName()))
+		if(event.getType().getName().equals(ResourceEventType.POWER_STATE_CHANGED.getName()))
+			return true;
+		else if(event.getType().getName().equals(ResourceEventType.CPU_FREQUENCY_CHANGED.getName()))
+			return true;
+		else if(event.getType().getName().equals(ResourceEventType.TASK_STARTED.getName()))
+			return true;
+		else if(event.getType().getName().equals(ResourceEventType.TASK_FINISHED.getName()))
+			return true;
+		else if(event.getType().getName().equals(ResourceEventType.UTILIZATION_CHANGED.getName()))
+			return true;
+	
+		if(event.getType().getName().equals(ResourceEventType.AIRFLOW_STATE_CHANGED.getName()))
+			return true;
+		if(event.getType().getName().equals(ResourceEventType.TEMPERATURE_CHANGED.getName()))
 			return true;
 		
@@ -131,42 +132,47 @@
 	public void handleEvent(Event event) {
 		
-		EnergyEvent enEvent = (EnergyEvent)event;
+		ResourceEvent resEvent = (ResourceEvent)event;
 		double power = 0;
 		boolean status = false;
 		try{
-			switch (enEvent.getType()) {
+			switch (resEvent.getType()) {
 			
+			case UPDATE_POWER_STATE:
+				PowerStateName newPowerState = (PowerStateName) resEvent.getData();
+				powerInterface.setPowerState(newPowerState);
+				break;
+				
 			case POWER_STATE_CHANGED:
-				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource);			
-				status = powerProfile.addToPowerUsageHistory(power);
-				break;
-				
-			case FREQUENCY_CHANGED:
-				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(resEvent, new JobRegistryImpl(resource.getFullName()), resource);			
+				status = powerProfile.addToPowerUsageHistory(power);
+				break;
+				
+			case CPU_FREQUENCY_CHANGED:
+				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				status = powerProfile.addToPowerUsageHistory(power);
 				break;
 				
 			case TASK_STARTED:
-				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				status = powerProfile.addToPowerUsageHistory(power);
 				break;
 	
 			case TASK_FINISHED:
-				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
-				status = powerProfile.addToPowerUsageHistory(power);
-				break;
-				
-			case RESOURCE_UTILIZATION_CHANGED:
-				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				status = powerProfile.addToPowerUsageHistory(power);
+				break;
+				
+			case UTILIZATION_CHANGED:
+				power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				status = powerProfile.addToPowerUsageHistory(power);
 				break;
 				
 			case AIRFLOW_STATE_CHANGED:
-				double airflow = powerProfile.getEnergyEstimationPlugin().estimateAirflow(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				double airflow = powerProfile.getEnergyEstimationPlugin().estimateAirflow(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				airflowProfile.addToAirFlowHistory(airflow);
 				break;
 				
 			case TEMPERATURE_CHANGED:
-				double temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(enEvent, new JobRegistryImpl(resource.getFullName()), resource);
+				double temperature = powerProfile.getEnergyEstimationPlugin().estimateTemperature(resEvent, new JobRegistryImpl(resource.getFullName()), resource);
 				thermalProfile.addToTemperatureHistory(temperature);
 				break;
@@ -176,5 +182,5 @@
 		}
 		if(status){
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(EnergyEventType.TEMPERATURE_CHANGED, resource.getFullName()));
+			DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new ResourceEvent(ResourceEventType.TEMPERATURE_CHANGED, resource.getFullName()));
 		}
 	}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyException.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyException.java	(revision 477)
+++ 	(revision )
@@ -1,22 +1,0 @@
-package schedframe.resources.computing.profiles.energy;
-
-public class EnergyException extends Exception{
-
-	private static final long serialVersionUID = 1L;
-
-	public EnergyException(){
-		super();
-	}
-
-	public EnergyException(String message){
-		super(message);
-	}
-	
-	public EnergyException(Throwable cause){
-		super(cause);
-	}
-	
-	public EnergyException(String message, Throwable cause){
-		super(message, cause);
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyEvent.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyEvent.java	(revision 1320)
+++ 	(revision )
@@ -1,58 +1,0 @@
-package schedframe.resources.computing.profiles.energy;
-
-import schedframe.events.Event;
-import schedframe.events.EventType;
-import schedframe.events.scheduling.EventReason;
-
-
-public class EnergyEvent implements Event{
-
-	protected EventType type;
-	protected EventReason reason;
-	protected Object data;
-	protected String source;
-
-	public EnergyEvent(EventType eventType, String source){
-		this.type = eventType;
-		this.source = source;
-		setReason(EventReason.UNKNOWN);
-	}
-	
-	public EnergyEvent(EventType eventType, Object data, String source){
-		this.type = eventType;
-		this.data = data;
-		this.source = source;
-		setReason(EventReason.UNKNOWN);
-	}
-	
-	public EnergyEventType getType() {
-		EnergyEventType enEventType = null; 
-		try{
-			enEventType = (EnergyEventType)type;
-		} catch(Exception e){
-
-		}
-		return enEventType;
-
-	}
-
-	public int getTag() {
-		return type.getTag();
-	}
-
-	public Object getData() {
-		return data;
-	}
-
-	public String getSource() {
-		return source;
-	}
-
-	public EventReason getReason() {
-		return reason;
-	}
-
-	public void setReason(EventReason reason) {
-		this.reason = reason;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyEventType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/profiles/energy/EnergyEventType.java	(revision 1320)
+++ 	(revision )
@@ -1,40 +1,0 @@
-package schedframe.resources.computing.profiles.energy;
-
-import schedframe.events.EventType;
-
-public enum EnergyEventType implements EventType {
-	
-	TASK_FINISHED(1),
-	TASK_FAILED(2),
-	TASK_CANCELED(4),
-	TASK_STARTED(8),
-
-	TIMER(16),
-
-	POWER_STATE_CHANGED(32),
-	FREQUENCY_CHANGED(64),
-	
-	AIRFLOW_STATE_CHANGED(256),
-	
-	RESOURCE_FAILED(512),
-	
-	RESOURCE_UTILIZATION_CHANGED(1024),
-	
-	TEMPERATURE_CHANGED(2048)
-	
-	;
-
-	protected int tag;
-	
-	public int getTag() {
-		return tag;
-	}
-
-	private EnergyEventType(int tag){
-		this.tag = tag;
-	}
-	
-	public String getName(){
-		return toString();
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java	(revision 1396)
+++ DCWoRMS/branches/coolemall/src/schedframe/resources/computing/ComputingResource.java	(revision 1415)
@@ -9,8 +9,7 @@
 import java.util.Properties;
 
-import schedframe.events.Event;
 import schedframe.events.EventHandler;
+import schedframe.events.EventReason;
 import schedframe.events.ResourceEventCommand;
-import schedframe.events.scheduling.EventReason;
 import schedframe.events.scheduling.ResourceStateChangedEvent;
 import schedframe.events.scheduling.SchedulingEvent;
@@ -21,6 +20,6 @@
 import schedframe.resources.computing.extensions.Extension;
 import schedframe.resources.computing.extensions.ExtensionListImpl;
-import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.ResourceEvent;
+import schedframe.resources.computing.profiles.energy.ResourceEventType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
 import schedframe.resources.computing.profiles.load.LoadExtension;
@@ -117,10 +116,10 @@
 	}
 	
-	private void triggerEventUp(Event event) {
+	private void triggerEventUp(ResourceEvent event) {
 		if(parent != null)
 			parent.handleEvent(event);
 	}
 
-	public void handleEvent(Event event){
+	public void handleEvent(ResourceEvent event){
 		ResourceEventCommand rec = new ResourceEventCommand(this);
 		rec.execute(event);
@@ -227,5 +226,5 @@
 	class ComputingResourceEventHandler implements EventHandler{
 		
-		public void handleResourceEvent(Event event){
+		public void handleResourceEvent(ResourceEvent event){
 			if (extensionList != null) {
 				for (Extension extension: extensionList) {
@@ -254,13 +253,13 @@
 				//scheduler.sim_cancel(filter, null);
 				ResourceStateChangedEvent rscEvent = (ResourceStateChangedEvent) event;
-				EnergyEventType eeType = (EnergyEventType)rscEvent.getEventType();
+				ResourceEventType reType = rscEvent.getResourceEventType();
 				//scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src);
-				switch(eeType){
+				switch(reType){
 				
-					case RESOURCE_UTILIZATION_CHANGED: {
+					case UTILIZATION_CHANGED: {
 						scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src);
 						break;
 					}
-					case FREQUENCY_CHANGED: {
+					case CPU_FREQUENCY_CHANGED: {
 						scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE_PROCESSING, src);
 						break;
@@ -286,14 +285,14 @@
 		}
 		ResourceEventCommand rec = new ResourceEventCommand(this);
-		EnergyEvent event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
+		ResourceEvent event = new ResourceEvent(ResourceEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
 		/*ResourceEventCommand*/ rec = new ResourceEventCommand(this);
-		/*EnergyEvent*/ event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller");
+		/*ResourceEvent*/ event = new ResourceEvent(ResourceEventType.POWER_STATE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
 		
 		rec = new ResourceEventCommand(this);
-		event = new EnergyEvent(EnergyEventType.TEMPERATURE_CHANGED, "Resource controller");
+		event = new ResourceEvent(ResourceEventType.TEMPERATURE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
@@ -302,8 +301,8 @@
 		if(li != null){
 			ResourceLoadCalendar rlc = li.getLoadCalendar();
-			LinkedList<TimestampUtilization> ll = rlc.getLoadDistribution();
-			for(TimestampUtilization tu: ll){
-				DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getStartTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName()));
-				DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getEndTime(), new EnergyEvent(EnergyEventType.RESOURCE_UTILIZATION_CHANGED, getFullName()));
+			LinkedList<TimestampUtilization> ld = rlc.getLoadDistribution();
+			for(TimestampUtilization tu: ld){
+				DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getStartTime(), new ResourceEvent(ResourceEventType.UTILIZATION_CHANGED, getFullName()));
+				DataCenterWorkloadSimulator.getEventManager().sendToResource(getFullName(), tu.getEndTime(), new ResourceEvent(ResourceEventType.UTILIZATION_CHANGED, getFullName()));
 			}					
 		}
