Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/SchedulerDescription.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/SchedulerDescription.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/SchedulerDescription.java	(revision 1207)
@@ -2,4 +2,5 @@
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -9,14 +10,15 @@
 import schedframe.resources.StandardResourceType;
 import schedframe.resources.computing.description.ExecutingResourceDescription;
+import schedframe.resources.computing.description.ResourceDescription;
 import schedframe.resources.providers.ResourceProvider;
-import schedframe.resources.units.AbstractResourceUnit;
 import schedframe.resources.units.ResourceUnit;
 import schedframe.resources.units.ResourceUnitName;
 import schedframe.scheduling.queue.QueueDescription;
 
-public class SchedulerDescription extends ExecutingResourceDescription{
+public class SchedulerDescription extends ResourceDescription implements ExecutingResourceDescription{
 
 	protected ResourceProvider provider;
 	protected List<QueueDescription> accesQueues;
+	protected Map<ResourceUnitName, List<ResourceUnit>> resUnits;
 
 	public SchedulerDescription(ResourceProvider provider){
@@ -62,3 +64,46 @@
 		return provider;
 	}
+	
+	public void addResourceUnit(ResourceUnit unit) {
+		if (this.resUnits == null)
+			this.resUnits = new HashMap<ResourceUnitName, List<ResourceUnit>>(1);
+		List<ResourceUnit> list = null;
+		if (this.resUnits.containsKey(unit.getName())) {
+			list = this.resUnits.get(unit.getName());
+		} else {
+			list = new ArrayList<ResourceUnit>(1);
+			this.resUnits.put(unit.getName(), list);
+		}
+		list.add(unit);
+	}
+	
+	public ResourceUnit getResourceUnit(ResourceUnitName unitName) throws NoSuchFieldException {
+		return getResourceUnitList(unitName).get(0);
+	}
+
+	public List<ResourceUnit> getResourceUnitList(ResourceUnitName unitName) throws NoSuchFieldException {
+		if (resUnits.containsKey(unitName))
+			return resUnits.get(unitName);
+		else
+			throw new NoSuchFieldException("Resource unit " + unitName + " is not available in resource " + this.id);
+	}
+
+	public Collection<ResourceUnit> getResourceUnit() {
+		if (resUnits == null)
+			return null;
+		List<ResourceUnit> values = new ArrayList<ResourceUnit>();
+		Collection<List<ResourceUnit>> lists = resUnits.values();
+		Iterator<List<ResourceUnit>> itr = lists.iterator();
+
+		while (itr.hasNext()) {
+			List<ResourceUnit> list = itr.next();
+			values.addAll(list);
+		}
+
+		return values;
+	}
+
+	public Map<ResourceUnitName, List<ResourceUnit>> getResourceUnits() {
+		return resUnits;
+	}
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java	(revision 1207)
@@ -8,4 +8,5 @@
 import schedframe.resources.units.ResourceUnitName;
 
+//TODO - change name
 public class ResourceHistoryItem {
 
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java	(revision 1054)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java	(revision 1207)
@@ -19,4 +19,5 @@
 import schedframe.resources.StandardResourceType;
 import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.ComputingResourceCharacteristics;
 import schedframe.resources.computing.ResourceCharacteristics;
 import schedframe.resources.computing.validator.ResourcePropertiesValidator;
@@ -138,5 +139,5 @@
 		for (int i = 0; i < computingResources.size() && resourceWithName == null; i++) {
 			ComputingResource resource = computingResources.get(i);
-			if (resource.getName().equals(resourceName))
+			if (resource.getFullName().equals(resourceName))
 				resourceWithName = resource;
 			else
@@ -154,5 +155,5 @@
 			while (!toExamine.isEmpty()) {
 				ComputingResource resource = toExamine.pop();
-				ResourceCharacteristics resourceCharacteristic = resource.getResourceCharacteristic();
+				ComputingResourceCharacteristics resourceCharacteristic = (ComputingResourceCharacteristics)resource.getResourceCharacteristic();
 				List<ResourceUnit> units = null;
 				units = resourceCharacteristic.getResourceUnits().get(unitName);
@@ -266,5 +267,5 @@
 		for(int i = 0 ; i < computingResources.size() && resourceWithName == null; i++){
 			ComputingResource resource = computingResources.get(i);
-			if(resource.getName().equals(resName))
+			if(resource.getFullName().equals(resName))
 				resourceWithName = resource;
 			else
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java	(revision 477)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java	(revision 1207)
@@ -23,5 +23,5 @@
 	public List<ComputingNode> getComputingNodes(){
 		try {
-			return (List<ComputingNode>) getResourcesOfType(StandardResourceType.ComputingNode);
+			return (List<ComputingNode>) getResourcesOfType(StandardResourceType.Node);
 		} catch (ResourceException e) {
 			return new ArrayList<ComputingNode>();
@@ -40,5 +40,5 @@
 	@SuppressWarnings("unchecked")
 	public List<ComputingNode> getComputingNodes(Properties properties){
-		properties.setProperty("type", StandardResourceType.ComputingNode.toString());
+		properties.setProperty("type", StandardResourceType.Node.toString());
 		return (List<ComputingNode>) filterResources(properties);
 
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java	(revision 1194)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java	(revision 1207)
@@ -4,5 +4,4 @@
 import java.io.StringWriter;
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.List;
 
@@ -22,5 +21,4 @@
 import org.qcg.broker.schemas.resreqs.ProcessesResourceRequirements;
 import org.qcg.broker.schemas.resreqs.Requirements;
-import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;
 import org.qcg.broker.schemas.resreqs.TaskResourceRequirements;
 import org.qcg.broker.schemas.resreqs.TimePeriod;
@@ -31,6 +29,4 @@
 import schedframe.scheduling.WorkloadUnitHandler;
 import schedframe.scheduling.manager.tasks.JobRegistryImpl;
-import schedframe.scheduling.tasks.phases.ResourceConsumption;
-import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;
 import schedframe.scheduling.tasks.requirements.ResourceParameterName;
 
@@ -75,5 +71,4 @@
 	private long workloadLogWaitTime;
 	
-	private ResourceConsumptionProfile resourceConsumptionProfile;
 
 	public Task(org.qcg.broker.schemas.resreqs.Task task){
@@ -96,27 +91,5 @@
 	}
 
-	private void preparePhases() {
-		LinkedList<ResourceConsumption> resourceConsumptionList = new LinkedList<ResourceConsumption>();
-		
-		if(task.getExecution() == null || task.getExecution().getResourceConsumptionProfile() == null){
-			ResourceConsumption resConsumption = null;
-			try {
-				resConsumption = new ResourceConsumption(this.length, getComputingResourceRequirements());
-			} catch (NoSuchFieldException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			resourceConsumptionList.add(resConsumption);
-		}
-		else{
-			for(ResourceConsumptionType resConsumption: task.getExecution().getResourceConsumptionProfile().getResourceConsumption()){
-				ResourceConsumption resourceConsumption = new ResourceConsumption(resConsumption);
-				resourceConsumptionList.add(resourceConsumption);
-			}
-		}
-		this.resourceConsumptionProfile = new ResourceConsumptionProfile(resourceConsumptionList);
-		
-	//	System.out.println("======"+task.getExecution().getExecutable().getApplication().getName());
-	}
+	
 	
 	public DateTime getExecutionStartTime() throws NoSuchFieldException {
@@ -310,5 +283,5 @@
 	}
 	
-	protected ComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{
+	public ComputingResourceBaseTypeItem[] getComputingResourceRequirements() throws NoSuchFieldException{
 		
 		Requirements req = this.task.getRequirements();
@@ -450,5 +423,4 @@
 	public void setLength(long length) {
 		this.length = length;
-		preparePhases();
 	}
 
@@ -515,9 +487,5 @@
 		wuh.handleTask(this);
 	}
-	
-	public ResourceConsumptionProfile getResourceConsumptionProfile(){
-		return resourceConsumptionProfile;
-	}
-	
+
 	public String getApplicationName(){
 		try{
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/TaskInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/TaskInterface.java	(revision 1190)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/TaskInterface.java	(revision 1207)
@@ -7,5 +7,4 @@
 
 import schedframe.DescriptionContainer;
-import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;
 import schedframe.scheduling.tasks.requirements.ResourceParameterName;
 
@@ -111,5 +110,5 @@
 	public long getWorkloadLogWaitTime();
 	
-	public ResourceConsumptionProfile getResourceConsumptionProfile();
+	//public ResourceConsumptionProfile getResourceConsumptionProfile();
 	
 	public String getApplicationName();
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java	(revision 1129)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumption.java	(revision 1207)
@@ -9,5 +9,6 @@
 import org.qcg.broker.schemas.resreqs.ComputingResourceParameterType;
 import org.qcg.broker.schemas.resreqs.PhaseBehaviourType;
-import org.qcg.broker.schemas.resreqs.ReferenceType;
+import org.qcg.broker.schemas.resreqs.StringParameterType;
+
 import org.qcg.broker.schemas.resreqs.ResourceConsumptionType;
 
@@ -36,6 +37,6 @@
     	if(resConsumptionType.getReferenceHardware() != null){
         	for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){
-        		ReferenceType rt = resConsumptionType.getReferenceHardware().getReference(i);
-        		referenceHardware.put(rt.getName(), rt.getContent());
+        		StringParameterType spt = resConsumptionType.getReferenceHardware().getReference(i);
+        		referenceHardware.put(spt.getName(), spt.getContent());
         	}
     	}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java	(revision 896)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java	(revision 1207)
@@ -2,10 +2,10 @@
 
 import java.util.LinkedList;
-import java.util.List;
 
 public class ResourceConsumptionProfile {
 	
 	protected LinkedList<ResourceConsumption> resourceConsumptionList;
-	protected int currentPhase;
+	protected long usefulWork;
+	private int currentPhase;
 	
 	public ResourceConsumptionProfile() {
@@ -37,3 +37,11 @@
 		this.currentPhase = currentPhase;
 	}
+
+	public long getUsefulWork() {
+		return usefulWork;
+	}
+
+	public void setUsefulWork(long usefulWork) {
+		this.usefulWork = usefulWork;
+	}
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java	(revision 1159)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Job.java	(revision 1207)
@@ -7,5 +7,4 @@
 import org.qcg.broker.schemas.resreqs.types.TaskStatesName;
 
-import gridsim.dcworms.DCWormsTags;
 
 import java.io.StringWriter;
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1162)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1207)
@@ -24,5 +24,5 @@
 
 import qcg.shared.constants.BrokerConstants;
-import schedframe.ResourceController;
+import schedframe.SimulatedEnvironment;
 import schedframe.events.scheduling.SchedulingEvent;
 import schedframe.events.scheduling.SchedulingEventType;
@@ -323,5 +323,4 @@
 			ExecTask task = iter.next();
 			Executable exec = (Executable)task;
-			//exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * timeSpan/exec.getEstimatedDuration());
 			exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration()));
 			UsedResourcesList usedResourcesList = exec.getUsedResources();
@@ -338,4 +337,5 @@
 			for (ComputingResource resource : pes) {
 				resource.handleEvent(new EnergyEvent(eventType, obj));
+				//DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj));
 			}
 			/*try {
@@ -350,5 +350,5 @@
 			ComputingResource resource = null;
 			try {
-				resource = ResourceController.getComputingResourceByName(peUnit.getResourceId());
+				resource = SimulatedEnvironment.getComputingResourceByName(peUnit.getResourceId());
 			} catch (ResourceException e) {
 				return;
@@ -428,6 +428,10 @@
 			if(exec.getResourceConsumptionProfile().getCurrentResourceConsumption() == exec.getResourceConsumptionProfile().getResourceConsumptionList().getLast()){
 				scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);
+				PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
+				notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
 			} else {
 				scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_CHANGED, execTask);
+				PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
+				notifyComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
 			}
 		}
@@ -540,5 +544,4 @@
 					job.setStatus((int)BrokerConstants.JOB_STATUS_SUBMITTED);
 			} catch (Exception e) {
-				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
