Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/resources1.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/resources1.xml	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/resources1.xml	(revision 1312)
@@ -20,5 +20,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -29,5 +29,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -38,5 +38,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -47,5 +47,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -56,5 +56,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -65,5 +65,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -74,5 +74,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -83,5 +83,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -92,5 +92,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -101,5 +101,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -112,5 +112,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -123,5 +123,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -134,5 +134,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -145,5 +145,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -156,5 +156,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -167,5 +167,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -178,5 +178,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -189,5 +189,5 @@
                     <powerProfile>
                        <energyEstimationPlugin>
-                          <name>test.thermal.recs.plugins.energy.FanEEP</name>
+                          <name>test.thermal.recs.plugins.energy.RecsFanEEP</name>
                        </energyEstimationPlugin>
                     </powerProfile>
@@ -206,5 +206,5 @@
 					<powerProfile>
 						<energyEstimationPlugin>
-							<name>test.thermal.recs.plugins.energy.NodeEEP</name>
+							<name>test.thermal.recs.plugins.energy.RecsNodeEEP</name>
 						</energyEstimationPlugin>	
 						<powerStates>
@@ -394,5 +394,5 @@
 					<powerProfile>
 						<energyEstimationPlugin>
-							<name>test.thermal.recs.plugins.energy.NodeEEP</name>
+							<name>test.thermal.recs.plugins.energy.RecsNodeEEP</name>
 						</energyEstimationPlugin>	
 						<powerStates>
@@ -452,5 +452,5 @@
 					<powerProfile>
 						<energyEstimationPlugin>
-							<name>test.thermal.recs.plugins.energy.NodeEEP</name>
+							<name>test.thermal.recs.plugins.energy.RecsNodeEEP</name>
 						</energyEstimationPlugin>	
 						<powerStates>
@@ -570,5 +570,5 @@
 			<!-- Definition of scheduling plugin at cluster level -->
 			<schedulingPlugin>
-				<name>test.thermal.recs.plugins.scheduling.RecsExclusivenessTempIncrOptSP</name>
+				<name>test.thermal.recs.plugins.scheduling.RecsExclusivenessCoolestSP</name>
 			</schedulingPlugin>	
 			<!-- Reference to managed resources - cluster manages resources belonging to the defined data center -->
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/experiment1.properties
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/experiment1.properties	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/experiment1.properties	(revision 1312)
@@ -6,5 +6,5 @@
 # and swf file, which name is declared by readscenario.workloadfilename parameter.
 # Swf file must be placed in readscenario.inputfolder directory.  
-readscenario.workloadfilename=src/test/thermal/recs/workload_test.swf
+readscenario.workloadfilename=src/test/thermal/recs/workload70.swf
 
 # Choose directory where all result files should be placed.
@@ -17,5 +17,5 @@
 
 # Resource utilization chart - only for processors
-creatediagrams.resutilization=Node;DataCenter
+#creatediagrams.resutilization=Node;DataCenter
 
 # Power usage chart - for computing nodes and processors
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/workload_test.swf
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/workload_test.swf	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/workload_test.swf	(revision 1312)
@@ -12,14 +12,15 @@
 ;PUSpeed: 1
 ;StartTime: Thu Jan 15 10:00:00 CET 2009
-		0		3486		-1		11604		1		-1		-1		1		11604		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		1		7045		-1		12814		2		-1		-1		2		12814		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		2		10575		-1		14575		3		-1		-1		3		14575		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		3		14205		-1		13197		1		-1		-1		1		13197		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		4		17858		-1		13352		1		-1		-1		1		13352		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		5		21413		-1		13214		1		-1		-1		1		13214		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		6		24981		-1		12162		1		-1		-1		1		12162		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		7		28628		-1		14534		4		-1		-1		4		14534		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		8		32227		-1		14680		3		-1		-1		3		14680		-1		-1		-1		-1		-1		-1		-1		-1		-1
-		9		35816		-1		10939		1		-1		-1		1		10939		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		00		0		-1		11604		1		-1		-1		1		11604		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		01		0		-1		12814		2		-1		-1		2		12814		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		02		0		-1		14575		3		-1		-1		3		14575		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		03		0		-1		11604		1		-1		-1		1		11604		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		04		0		-1		12814		2		-1		-1		2		12814		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		05		0		-1		14575		3		-1		-1		3		14575		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		06		0		-1		11604		1		-1		-1		1		11604		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		07		0		-1		12814		2		-1		-1		2		12814		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		08		0		-1		14575		3		-1		-1		3		14575		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		09		0		-1		11604		1		-1		-1		1		11604		-1		-1		-1		-1		-1		-1		-1		-1		-1
+;IDMapping: swfID:jobID:taskID
 ;IDMapping: swfID:jobID:taskID
 ; 0:0:0, 1:1:0, 2:2:0, 3:3:0, 4:4:0, 5:5:0, 6:6:0, 7:7:0, 8:8:0, 9:9:0, 
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/VirtualNode.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/VirtualNode.java	(revision 1312)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/VirtualNode.java	(revision 1312)
@@ -0,0 +1,28 @@
+package test.thermal.recs.plugins.scheduling;
+
+public class VirtualNode {
+
+	private int id;
+	private double power;
+	private double temperature;
+	
+	VirtualNode(int id){
+		this.id = id;
+	}
+	
+	public void setPower(double power){
+		this.power = power;
+	}
+	
+	public void setTemperature(double temperature){
+		this.temperature = temperature;
+	}
+	
+	public double getPower(){
+		return power;
+	}
+	
+	public double getTemperature(){
+		return temperature;
+	}
+}
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessMaxTempOptSP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessMaxTempOptSP.java	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessMaxTempOptSP.java	(revision 1312)
@@ -47,4 +47,8 @@
 	private ResourceBundle timeBundle;
 	
+	// virtual nodes are to keep track of the intermediate power and temperature between job assignments 
+	private List<VirtualNode> virtualNodes = new ArrayList<VirtualNode>();
+	private boolean firstCall = true;
+	
 	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
 			ResourceManager resManager, ModuleList modules) {
@@ -52,4 +56,41 @@
 		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
 		SchedulingPlan plan = new SchedulingPlan();
+		
+		List<Node> nodes = resourceManager.getNodes();
+		
+		// create the virtualNodes on the first scheduling call
+		if (firstCall){
+			
+			VirtualNode dummyVN = new VirtualNode(0);
+			virtualNodes.add(dummyVN);
+			
+			int numNodes = nodes.size();
+			for (int i = 1; i <= numNodes; i++){
+				VirtualNode vn = new VirtualNode(i);
+				virtualNodes.add(vn);
+			}
+			firstCall = false;
+		}
+		
+		// update the power of the virtual nodes
+		for (Node node : nodes){
+			double power = node.getPowerInterface().getRecentPowerUsage().getValue();
+			int nodeId = Integer.parseInt(node.getName().split("_")[1]);
+			virtualNodes.get(nodeId).setPower(power);
+		}
+		
+		// update the temperature of the virtual nodes
+		for (int i = 1; i <= 9; i++){
+			VirtualNode vn1 = virtualNodes.get(i+9);
+			VirtualNode vn2 = virtualNodes.get(i);
+			
+			double power1 = vn1.getPower();
+			double power2 = vn2.getPower();
+			
+			double tout = ThermalConstants.calculateOutletTemp(power1, power2);
+			vn1.setTemperature(tout);
+			vn2.setTemperature(tout);
+		}
+		
 		// choose the events types to serve.
 		// Different actions for different events are possible.
@@ -138,4 +179,39 @@
 				pe.addAll(choosenResources);
 				map.put(StandardResourceUnitName.PE, pe);
+				
+				// update the power and temperature of the virtualNode corresponding to the node
+				int nodeId = Integer.parseInt(node.getName().split("_")[1]);
+				VirtualNode vn = virtualNodes.get(nodeId);
+				
+				// power update
+				double extraPower = 0;
+		    	try{
+		    		extraPower = Math.abs(getMeasuredPower(createQuery(task, node)) - node.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON));
+			    } catch (FileNotFoundException e) {
+		
+				} catch (IOException e) {
+		
+				} catch (MissingResourceException e){
+					
+		    	} catch (NoSuchFieldException e) {
+
+		    	}
+		    	vn.setPower(vn.getPower() + extraPower);
+		    	
+				// temperature update
+		    	double delta = 1;
+		    	VirtualNode vn2;
+		    	if (nodeId >= 1 && nodeId <= 9){
+		    		delta = ThermalConstants.delta2;
+		    		vn2 = virtualNodes.get(nodeId + 9);
+		    	}
+		    	else{
+		    		delta = ThermalConstants.delta1;
+		    		vn2 = virtualNodes.get(nodeId - 9);
+		    	}
+		    	double extraTemp = delta * (extraPower/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
+		    	vn.setTemperature(vn.getTemperature() + extraTemp);
+		    	vn2.setTemperature(vn2.getTemperature() + extraTemp);
+				
 				return map;
 
@@ -179,10 +255,4 @@
 		private TaskInterface<?> task;
 		
-		double Q = ThermalConstants.Q;
-		double C = ThermalConstants.C;
-		double delta1 = ThermalConstants.delta1;
-		double delta2 = ThermalConstants.delta2;
-		double ro = ThermalConstants.ro;
-		
 		public TemperatureComparator(TaskInterface<?> task){
 			this.task = task;
@@ -190,6 +260,10 @@
 		
 	    public int compare(Node node1, Node node2){    
-	    	double currentNode1Temp = node1.getThermalInterface().getRecentTemperature().getValue();
-	    	double currentNode2Temp = node2.getThermalInterface().getRecentTemperature().getValue();
+	    	
+	    	int id1 = Integer.parseInt(node1.getName().split("_")[1]);
+	    	int id2 = Integer.parseInt(node2.getName().split("_")[1]);
+	    	
+	    	double currentNode1Temp = virtualNodes.get(id1).getTemperature();
+	    	double currentNode2Temp = virtualNodes.get(id2).getTemperature();
 	    	
 	    	double power1 = 0;
@@ -208,19 +282,16 @@
 	    	}
 	    	
-	    	Integer id1 = Integer.parseInt(node1.getName().split("_")[1]);
-	    	Integer id2 = Integer.parseInt(node2.getName().split("_")[1]);
-	    	
 	    	double deltaOne = 1, deltaTwo = 1;
-	    	if (id1 >= 0 && id1 <= 8) // outlet
-	    		deltaOne = delta2;
-	    	else if (id1 >= 9 && id1 <= 17) // inlet
-	    		deltaOne = delta1;
-	    	if (id2 >= 0 && id2 <= 8) // outlet
-	    		deltaTwo = delta2;
-	    	else if (id2 >= 9 && id2 <= 17) // inlet
-	    		deltaTwo = delta1;
-	    	
-	    	double afterNode1Temp = currentNode1Temp + deltaOne * (power1/(Q * C * ro));
-	    	double afterNode2Temp = currentNode2Temp + deltaTwo * (power2/(Q * C * ro));
+	    	if (id1 >= 1 && id1 <= 9) // outlet
+	    		deltaOne = ThermalConstants.delta2;
+	    	else if (id1 >= 10 && id1 <= 18) // inlet
+	    		deltaOne = ThermalConstants.delta1;
+	    	if (id2 >= 1 && id2 <= 9) // outlet
+	    		deltaTwo = ThermalConstants.delta2;
+	    	else if (id2 >= 10 && id2 <= 18) // inlet
+	    		deltaTwo = ThermalConstants.delta1;
+	    	
+	    	double afterNode1Temp = currentNode1Temp + deltaOne * (power1/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
+	    	double afterNode2Temp = currentNode2Temp + deltaTwo * (power2/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
 	    	
 	    	if (afterNode1Temp > afterNode2Temp)
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessTempIncrOptSP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessTempIncrOptSP.java	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessTempIncrOptSP.java	(revision 1312)
@@ -178,10 +178,4 @@
 		private TaskInterface<?> task;
 		
-		double Q = ThermalConstants.Q;
-		double C = ThermalConstants.C;
-		double delta1 = ThermalConstants.delta1;
-		double delta2 = ThermalConstants.delta2;
-		double ro = ThermalConstants.ro;
-		
 		public TemperatureComparator(TaskInterface<?> task){
 			this.task = task;
@@ -192,11 +186,7 @@
 	    	double power1 = 0;
 	    	double power2 = 0;
-	    	double time1 = 0;
-	    	double time2 = 0;
 	    	try{
 	    		power1 = Math.abs(getMeasuredPower(createQuery(task, node1)) - node1.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON));
 		    	power2 = Math.abs(getMeasuredPower(createQuery(task, node2)) - node2.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON));
-		    	time1 = getMeasuredTime(createQuery(task, node1));
-		    	time2 = getMeasuredTime(createQuery(task, node2));
 	    	} catch (FileNotFoundException e) {
 	
@@ -213,15 +203,15 @@
 	    	
 	    	double deltaOne = 1, deltaTwo = 1;
-	    	if (id1 >= 0 && id1 <= 8) // outlet
-	    		deltaOne = delta2;
-	    	else if (id1 >= 9 && id1 <= 17) // inlet
-	    		deltaOne = delta1;
-	    	if (id2 >= 0 && id2 <= 8) // outlet
-	    		deltaTwo = delta2;
-	    	else if (id2 >= 9 && id2 <= 17) // inlet
-	    		deltaTwo = delta1;
-	    	
-	    	double extraNode1Temp =  deltaOne * (power1/(Q * C * ro)) * time1;
-	    	double extraNode2Temp =  deltaTwo * (power2/(Q * C * ro)) * time2;
+	    	if (id1 >= 1 && id1 <= 9) // outlet
+	    		deltaOne = ThermalConstants.delta2;
+	    	else if (id1 >= 10 && id1 <= 18) // inlet
+	    		deltaOne = ThermalConstants.delta1;
+	    	if (id2 >= 1 && id2 <= 9) // outlet
+	    		deltaTwo = ThermalConstants.delta2;
+	    	else if (id2 >= 10 && id2 <= 18) // inlet
+	    		deltaTwo = ThermalConstants.delta1;
+	    	
+	    	double extraNode1Temp =  deltaOne * (power1/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
+	    	double extraNode2Temp =  deltaTwo * (power2/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
 	    	
 	    	if (extraNode1Temp > extraNode2Temp)
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessCoolestSP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessCoolestSP.java	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/scheduling/RecsExclusivenessCoolestSP.java	(revision 1312)
@@ -30,4 +30,5 @@
 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;
@@ -36,4 +37,5 @@
 import schedframe.scheduling.queue.TaskQueueList;
 import schedframe.scheduling.tasks.TaskInterface;
+import test.thermal.recs.plugins.energy.ThermalConstants;
 import test.thermal.recs.utils.AppType;
 
@@ -46,9 +48,50 @@
 	private ResourceBundle timeBundle;
 	
+	// virtual nodes are to keep track of the intermediate power and temperature between job assignments 
+	private List<VirtualNode> virtualNodes = new ArrayList<VirtualNode>();
+	private boolean firstCall = true;
+	
 	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
 			ResourceManager resManager, ModuleList modules) {
-
+		
 		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
 		SchedulingPlan plan = new SchedulingPlan();
+		
+		List<Node> nodes = resourceManager.getNodes();
+		
+		// create the virtualNodes on the first scheduling call
+		if (firstCall){
+			
+			VirtualNode dummyVN = new VirtualNode(0);
+			virtualNodes.add(dummyVN);
+			
+			int numNodes = nodes.size();
+			for (int i = 1; i <= numNodes; i++){
+				VirtualNode vn = new VirtualNode(i);
+				virtualNodes.add(vn);
+			}
+			firstCall = false;
+		}
+		
+		// update the power of the virtual nodes
+		for (Node node : nodes){
+			double power = node.getPowerInterface().getRecentPowerUsage().getValue();
+			int nodeId = Integer.parseInt(node.getName().split("_")[1]);
+			virtualNodes.get(nodeId).setPower(power);
+		}
+		
+		// update the temperature of the virtual nodes
+		for (int i = 1; i <= 9; i++){
+			VirtualNode vn1 = virtualNodes.get(i+9);
+			VirtualNode vn2 = virtualNodes.get(i);
+			
+			double power1 = vn1.getPower();
+			double power2 = vn2.getPower();
+			
+			double tout = ThermalConstants.calculateOutletTemp(power1, power2);
+			vn1.setTemperature(tout);
+			vn2.setTemperature(tout);
+		}
+		
 		// choose the events types to serve.
 		// Different actions for different events are possible.
@@ -87,5 +130,17 @@
 		Collections.shuffle(nodes);
 		Collections.sort(nodes, new TemperatureComparator(task));
-		
+		/*
+		System.out.println("*************************");
+		System.out.println("Assigning task " + task.getJobId());
+		for (Node node : nodes) {
+			int nodeId = Integer.parseInt(node.getName().split("_")[1]);
+			double node_power = node.getPowerInterface().getRecentPowerUsage().getValue();
+			double node_temp = node.getThermalInterface().getRecentTemperature().getValue();
+			double vn_power = virtualNodes.get(nodeId).getPower();
+			double vn_temp = virtualNodes.get(nodeId).getTemperature();
+			System.out.println(node.getName() + ": node_power = " + node_power + " ; node_temp = " + node_temp + " ; vn_power = " + vn_power + " ; vn_temp = " + vn_temp);
+		}
+		System.out.println("*************************");
+		*/
 		for (Node node : nodes) {
 			int cpuRequest;
@@ -138,6 +193,40 @@
 				pe.addAll(choosenResources);
 				map.put(StandardResourceUnitName.PE, pe);
+				
+				// update the power and temperature of the virtualNode corresponding to the node
+				int nodeId = Integer.parseInt(node.getName().split("_")[1]);
+				VirtualNode vn = virtualNodes.get(nodeId);
+				
+				// power update
+				double extraPower = 0;
+		    	try{
+		    		extraPower = Math.abs(getMeasuredPower(createQuery(task, node)) - node.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON));
+			    } catch (FileNotFoundException e) {
+		
+				} catch (IOException e) {
+		
+				} catch (MissingResourceException e){
+					
+		    	} catch (NoSuchFieldException e) {
+
+		    	}
+		    	vn.setPower(vn.getPower() + extraPower);
+		    	
+				// temperature update
+		    	double delta = 1;
+		    	VirtualNode vn2;
+		    	if (nodeId >= 1 && nodeId <= 9){
+		    		delta = ThermalConstants.delta2;
+		    		vn2 = virtualNodes.get(nodeId + 9);
+		    	}
+		    	else{
+		    		delta = ThermalConstants.delta1;
+		    		vn2 = virtualNodes.get(nodeId - 9);
+		    	}
+		    	double extraTemp = delta * (extraPower/(ThermalConstants.Q * ThermalConstants.C * ThermalConstants.ro));
+		    	vn.setTemperature(vn.getTemperature() + extraTemp);
+		    	vn2.setTemperature(vn2.getTemperature() + extraTemp);
+		    	
 				return map;
-
 			}
 		}
@@ -183,7 +272,11 @@
 		}
 		
-	    public int compare(Node node1, Node node2){    
-	    	double node1Temp = node1.getThermalInterface().getRecentTemperature().getValue();
-	    	double node2Temp = node2.getThermalInterface().getRecentTemperature().getValue();
+	    public int compare(Node node1, Node node2){   
+	    	
+	    	int id1 = Integer.parseInt(node1.getName().split("_")[1]);
+	    	int id2 = Integer.parseInt(node2.getName().split("_")[1]);
+	    	
+	    	double node1Temp = virtualNodes.get(id1).getTemperature();
+	    	double node2Temp = virtualNodes.get(id2).getTemperature();
 	    	
 	    	if (node1Temp > node2Temp)
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/ThermalConstants.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/ThermalConstants.java	(revision 1301)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/ThermalConstants.java	(revision 1312)
@@ -3,5 +3,32 @@
 public class ThermalConstants {
 	
-	public static double tin = 0;
+	/*
+	 * v1. Hongyang Sun, 21/03/2014.
+	 * 
+	 * This package is created for the thermal-aware scheduling policies designed in CoolEmAll (www.cooemall.eu).
+	 * Details of these policies and experimental results can be found in deliverable D4.6 on the project website.
+	 * 
+	 * The setting and the temperature estimation is for a CoolEmAll RECS with 18 nodes and the following layout:
+	 *     | 10   01 | 
+	 *     | 11	  02 |
+	 *     | 12	  03 |
+	 *     | 13	  04 |
+	 *     | 14	  05 |
+	 *     | 15	  06 |
+	 *     | 16	  07 |
+	 *     | 17	  08 |
+	 *     | 18	  09 |
+	 * where node i and i+9 share the same outlet and inlet for i = 1..9.
+	 * 
+	 * The thermal-aware scheduling plugins (Coolest, MaxTempOpt and TempIncrOpt) are implemented in the version 
+	 * of the simulator dated 2014 March. In this version, 
+	 * (1). The power estimation of a node is guaranteed to be correct upon each invocation of the scheduler.
+	 * (2). The temperature, however, may not be up to date, so one should always derive temperature from power.
+	 * (3). If each invocation of the scheduler schedules several jobs, the power (and temperature) is not 
+	 * 		updated between job assignments. So one should always keep track of the power (and temperature)
+	 * 		changes locally in this case.   
+	 */
+	
+	public static double tin = 25;
 	public static double Q = 0.0056085;
 	public static double C = 1004;
@@ -11,3 +38,9 @@
 	
 	public static double fanPower = 6;
+	
+	// calculate the outlet temperature, given the power1 on the inlet node and power2 on the outlet node.
+	public static double calculateOutletTemp(double power1, double power2){
+		double tout = tin + delta1 * (power1/(Q * C * ro)) +  delta2 * (power2/(Q * C * ro));
+		return tout;
+	}
 }
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsFanEEP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsFanEEP.java	(revision 1312)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsFanEEP.java	(revision 1312)
@@ -0,0 +1,52 @@
+package test.thermal.recs.plugins.energy;
+
+import example.energy.BaseEnergyEstimationPlugin;
+
+import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.devices.Device;
+import schedframe.resources.devices.PhysicalResource;
+import schedframe.scheduling.manager.tasks.JobRegistry;
+
+public class RecsFanEEP extends BaseEnergyEstimationPlugin {
+
+	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		
+		return ThermalConstants.fanPower;
+	}
+	
+	public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		
+		double temp = 0;
+		
+		// thermal constants
+		double tin = ThermalConstants.tin;
+		double Q = ThermalConstants.Q;
+		double C = ThermalConstants.C;
+		double delta1 = ThermalConstants.delta1;
+		double delta2 = ThermalConstants.delta2;
+		double ro = ThermalConstants.ro;
+		
+		Device device = (Device) resource; 
+		Integer device_id = Integer.parseInt(device.getName().split("_")[1]);
+		String device_type = device.getName().split("_")[0];
+		if (device_type.equals("Outlet")){
+			double power1 = 0;
+			double power2 = 0;
+			for(PhysicalResource compResource: device.getComputingResource().getChildren()){
+				Integer node_id = Integer.parseInt(compResource.getName().split("_")[1]);
+				if(node_id == device_id){
+					power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
+				}else if(node_id - device_id == 9){
+					power1 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
+				}
+			}
+			temp = tin + delta1 * (power1/(Q * C * ro)) +  delta2 * (power2/(Q * C * ro));;
+		}else if (device_type.equals("Inlet")){
+			temp = tin;
+		}
+		
+		//System.out.println(resource.getName());
+		return temp;
+		
+	}
+}
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsNodeEEP.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsNodeEEP.java	(revision 1312)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/plugins/energy/RecsNodeEEP.java	(revision 1312)
@@ -0,0 +1,61 @@
+package test.thermal.recs.plugins.energy;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import schedframe.resources.computing.Node;
+import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.devices.PhysicalResource;
+import schedframe.scheduling.manager.tasks.JobRegistry;
+
+public class RecsNodeEEP extends RecsNodeBaseEEP {
+
+	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		double powerConsumption = 0;
+		Node node = (Node) resource;
+		
+		try {
+			if(jobRegistry.getRunningTasks().size() > 0) {
+				powerConsumption = powerConsumption + getMeasuredPower(createQuery(jobRegistry.getRunningTasks().get(0)));
+			}
+			else {
+				try {
+					powerConsumption = powerConsumption + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState());
+				} catch (NoSuchFieldException e) {
+				}
+			}
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		return powerConsumption;
+	}
+	
+	public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		
+		double power1 = 0;
+		double power2 = 0;
+		
+		Integer resId = Integer.parseInt(resource.getName().split("_")[1]);
+		Node node = (Node)resource;
+		//we estimate outlet temperature (related to the temperature of the nodes placed in outlet row)
+		for(PhysicalResource compResource: node.getParent().getChildren()){
+			Integer id = Integer.parseInt(compResource.getName().split("_")[1]);
+			//we take into account the power of nodes placed "behind" the given nodes
+			if(id - resId == 9){
+				power1 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
+				power2 = resource.getPowerInterface().getRecentPowerUsage().getValue();
+			}else if(id - resId == -9){
+				power1 = resource.getPowerInterface().getRecentPowerUsage().getValue();
+				power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
+			}
+		}
+
+		return ThermalConstants.calculateOutletTemp(power1, power2);
+	}
+
+}
