Index: /DCWoRMS/trunk/src/test/PhaseTimeEstimationPlugin.java
===================================================================
--- /DCWoRMS/trunk/src/test/PhaseTimeEstimationPlugin.java	(revision 780)
+++ /DCWoRMS/trunk/src/test/PhaseTimeEstimationPlugin.java	(revision 780)
@@ -0,0 +1,53 @@
+package test;
+
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.resources.units.PEUnit;
+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 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.
+	 * 
+	 * Example implementation calculate the estimation based on cpu processing power.
+	 * There is also a simple assumption, that cpu processing power is a linear function
+	 * of number of allocated cpus and their speed.
+	 */
+	public double execTimeEstimation(SchedulingEvent event, ExecTask task,
+			Map<ResourceUnitName, ResourceUnit> allocatedResources,
+			double completionPercentage) {
+		
+		// collect all information necessary to do the calculation
+		PEUnit peUnit = (PEUnit) allocatedResources.get(StandardResourceUnitName.PE);
+
+		// obtain single pe speed
+		int speed = peUnit.getSpeed();
+
+		// number of used pe  
+		int cnt = peUnit.getUsedAmount();
+
+		// estimate remainingTaskLength
+		double remainingLength =  task.getLength() * (1 - completionPercentage/100);
+		
+		// do the calculation
+		double execTime = (remainingLength / (cnt * speed));
+
+		// 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/trunk/src/test/EventManager.java
===================================================================
--- /DCWoRMS/trunk/src/test/EventManager.java	(revision 776)
+++ /DCWoRMS/trunk/src/test/EventManager.java	(revision 780)
@@ -3,7 +3,17 @@
 import gridsim.GridSimCore;
 
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
 import java.util.Properties;
 
+import schedframe.ResourceController;
+import schedframe.events.ResourceEventCommand;
+import schedframe.events.scheduling.EventReason;
 import schedframe.exceptions.ModuleException;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.scheduling.Scheduler;
 import schedframe.scheduling.plugin.grid.Module;
 import schedframe.scheduling.plugin.grid.ModuleType;
@@ -11,4 +21,6 @@
 public class EventManager extends GridSimCore implements Module{
 
+	protected ResourceController resourceController;
+	
 	public EventManager(String name) throws Exception {
 		super(name, 1);
@@ -30,4 +42,66 @@
 	}
 
+	public void sendToAllSchedulers(double delay, int tag, Object data){
+		List<Scheduler> allSchedulers =  new ArrayList<Scheduler>();
+		if (resourceController.getScheduler().getChildren() != null) {
+			LinkedList<Scheduler> toExamine = new LinkedList<Scheduler>();
+			toExamine.push(resourceController.getScheduler());
+			allSchedulers.add(resourceController.getScheduler());
+
+			while (!toExamine.isEmpty()) {
+				Scheduler scheduler = toExamine.pop();
+				List<Scheduler> schedulers = scheduler.getChildren();
+				int numberOfSched = schedulers.size();
+				for (int i = 0; i < numberOfSched; i++) {
+					Scheduler schedulerChild = schedulers.get(i);
+					toExamine.addLast(schedulerChild);
+					allSchedulers.add(schedulerChild);
+				}
+			}
+		}
+		
+		for(Scheduler scheduler: allSchedulers){
+			super.send(scheduler.get_id(), delay, tag, data);
+		}
+	}
+	
+	public void sendToAllResources(double delay, int tag, Object data){
+		List<ComputingResource> allComputingResources = new ArrayList<ComputingResource>();
+
+		if (resourceController.getComputingResources() != null) {
+			LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>();
+			for(ComputingResource compRes: resourceController.getComputingResources()){
+				toExamine.push(compRes);
+				allComputingResources.add(compRes);
+			}
+
+			while (!toExamine.isEmpty()) {
+				ComputingResource resource = toExamine.pop();
+				List<ComputingResource> resources = resource.getChildren();
+				int numberOfRes = resources.size();
+				for (int i = 0; i < numberOfRes; i++) {
+					ComputingResource resourceChild = resources.get(i);
+					toExamine.addLast(resourceChild);
+					allComputingResources.add(resourceChild);
+				}
+			}
+		}
+		
+		ResourceEventCommand rec;
+		EnergyEvent event;
+		for(ComputingResource compRes: allComputingResources){
+			rec = new ResourceEventCommand(compRes);
+			event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
+			event.setReason(EventReason.SIM_INIT);
+			rec.execute(event);
+			//super.send(scheduler.get_id(), delay, tag, data);
+		}
+
+	}
+	
+	public void sendTo(List<String> ids){
+		
+	}
+	
 	public void dispose() throws ModuleException {
 	}
