Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/TaskToApp.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/TaskToApp.java	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/TaskToApp.java	(revision 1305)
@@ -0,0 +1,77 @@
+package test.thermal.recs.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.TreeMap;
+
+import dcworms.schedframe.scheduling.Executable;
+
+import schedframe.scheduling.tasks.TaskInterface;
+
+public class TaskToApp {
+	
+	private static int ABINIT = 20;
+	private static int C_RAY = 40;
+	private static int TAR = 60;
+	private static int LIN_3GB = 70;
+	private static int LIN_TINY = 80;
+	private static int FFT = 100;
+	private static Random rand = new Random(5);
+	private static Map<String, AppType> mapping = new TreeMap<String, AppType>();
+
+	private static Random randLoad = new Random(5);
+	private static Map<String, Double> loadMapping = new HashMap<String, Double>();
+	private static double [] loadLevels = {0.25, 0.5, 0.75, 1};
+	
+	public AppType getAppType(TaskInterface<?> task){
+
+		AppType appType = null;
+		if(mapping.get(task.getJobId())!= null){
+			appType = mapping.get(task.getJobId());
+			Executable exec = (Executable) task;
+			exec.getDescription().getExecution().getExecutable().getApplication().setName(appType.toString());
+		}else{
+			appType = randomAppType();
+			mapping.put(task.getJobId(), appType);
+		}
+		return appType;
+	}
+	
+	private AppType randomAppType(){
+		AppType appType = null;
+		int n = rand.nextInt(100);
+		if(n < ABINIT){
+			appType = AppType.abinit;
+		}else if(n < C_RAY){
+			appType = AppType.c_ray;
+		}else if(n < TAR){
+			appType = AppType.tar;
+		}else if(n < LIN_3GB){
+			appType = AppType.lin_3gb;
+		}else if(n < LIN_TINY){
+			appType = AppType.lin_tiny;
+		}else if(n < FFT){
+			appType = AppType.fft;
+		} 
+		return appType;
+	}
+	
+	public double getAppLoad(TaskInterface<?> task){
+		double appLoad = 0;
+		if(loadMapping.get(task.getJobId())!= null){
+			appLoad = loadMapping.get(task.getJobId());
+		}else{
+			appLoad = randomAppLoad();
+			loadMapping.put(task.getJobId(), appLoad);
+		}return appLoad;
+	}
+	
+	private double randomAppLoad(){
+		double appLoad = 0;
+		int n = randLoad.nextInt(7);
+		appLoad = loadLevels[n];
+		return appLoad;
+	}
+	
+}
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/RecsProcessorPowerInterface.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/RecsProcessorPowerInterface.java	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/RecsProcessorPowerInterface.java	(revision 1305)
@@ -0,0 +1,134 @@
+package test.thermal.recs.utils;
+
+import java.util.Map;
+
+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.power.PState;
+import schedframe.resources.computing.profiles.energy.power.PowerProfile;
+import schedframe.resources.computing.profiles.energy.power.PowerStateName;
+import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
+import schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface;
+
+public class RecsProcessorPowerInterface extends ProcessorPowerInterface {
+
+	protected PState currentPState;
+
+	public RecsProcessorPowerInterface(ComputingResource resource, PowerProfile pp){
+		super(resource, pp);
+		currentPowerState = StandardPowerStateName.ON;
+		currentPState = getLowestPState();
+		if(currentPState == null)
+			currentPState = getSupportedPStates().get("P0");
+	}
+	
+	public boolean setPowerState(PowerStateName powerState){
+		if(!supportPowerState(powerState))
+			return false;
+		if(powerState != currentPowerState){
+			currentPowerState = powerState;
+			if(powerState == StandardPowerStateName.OFF){
+				resource.setStatus(ResourceStatus.UNAVAILABLE);
+			} else if(powerState == StandardPowerStateName.ON){
+				resource.setStatus(ResourceStatus.FREE);
+			}
+			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getFullName()));		
+		}
+
+		return true;
+	}
+
+	public PState getPState(){
+		return currentPState;
+	}
+	
+	public Map<String, PState> getSupportedPStates() {
+		return powerProfile.getSupportedPStates();
+	}
+	
+	public boolean supportPState(PState pState) {
+
+		for(String pStateName: getSupportedPStates().keySet()){
+			if(pState.getName().equals(pStateName)){
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public boolean setPState(String pStateName){
+		PState newPState = getSupportedPStates().get(pStateName);
+
+
+		if(newPState != null && newPState != currentPState){
+			//double factor = newPState.getFrequency()/currentPState.getFrequency();
+			currentPState = newPState;
+			//CpuSpeed speed = (CpuSpeed)resource.getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.CPUSPEED).get(0);
+			//speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue());
+			//new ResourceEventCommand(resource).execute(EnergyEventType.FREQUENCY_CHANGED);
+			resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.getFullName()));
+			//resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, resource.getName());
+			return true;
+		}
+
+		return false;
+	}
+	
+	public double getFrequency() {
+		return currentPState.getFrequency();
+	}
+
+	public boolean setFrequency(double freq) {
+
+		for(String pStateName: getSupportedPStates().keySet()){
+			if(getSupportedPStates().get(pStateName).getFrequency() == freq){
+				setPState(pStateName);
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public double getPowerConsumption(PState state) throws NoSuchFieldException{
+		double powerConsumption = 0;
+		if(supportPState(state)){
+			for(String pStateName: getSupportedPStates().keySet()){
+				if(pStateName.equals(state.getName())){
+					powerConsumption = getSupportedPStates().get(pStateName).getPower();
+					break;
+				}
+			}
+		}
+		return powerConsumption;
+	}
+	
+	public PState getLowestPState(){
+		PState lowPState = null;
+		double highestFreq = Double.MIN_VALUE;
+		for(String key: getSupportedPStates() .keySet()){
+			PState pState = getSupportedPStates().get(key);
+			if(pState.getFrequency() > highestFreq){
+				highestFreq = pState.getFrequency();
+				lowPState = pState;
+			}
+		}
+		return lowPState;
+	}
+	
+	public PState getHighestPState(){
+		PState highPState = null;
+		double lowestFreq = Double.MAX_VALUE;
+		for(String key: getSupportedPStates() .keySet()){
+			PState pState = getSupportedPStates().get(key);
+			if(pState.getFrequency() < lowestFreq){
+				lowestFreq = pState.getFrequency();
+				highPState = pState;
+			}
+		}
+		return highPState;
+	}
+
+}
+
Index: DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/AppType.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/AppType.java	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/recs/utils/AppType.java	(revision 1305)
@@ -0,0 +1,10 @@
+package test.thermal.recs.utils;
+
+public enum AppType {
+	abinit,
+	c_ray,
+	tar,
+	lin_tiny,
+	lin_3gb,
+	fft;
+}
Index: DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig10.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig10.xml	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig10.xml	(revision 1305)
@@ -0,0 +1,34 @@
+<tns:WorkloadConfiguration 
+	xmlns:tns="http://www.man.poznan.pl/WorkloadSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 
+  	<SimulationStartTime>2009-01-15T10:00:00</SimulationStartTime>
+ 
+	<JobCount avg="1000" distribution="constant"/>
+ 
+	<TaskCount avg="1" distribution="constant"/>
+ 
+	<TaskLength avg="14400" min="10800" max="18000" stdev="3600.0" distribution="normal"/>
+ 
+	<JobPackageLength avg="1.0" min="1.0" max="1.0" stdev="0.0" distribution="constant"/>
+ 
+	<JobInterval avg="3000" min="0" max="3600" stdev="300" distribution="poisson" seed="21"/>
+	
+	<ComputingResourceHostParameter metric="cpucount">
+		<value id="cpucnt">
+	  		<MultiDistribution>
+  				<dist avg="1" min="1" max="1" stdev="0" distribution="uniform">0.3</dist>
+      			<dist avg="2" min="2" max="2" stdev="0" distribution="uniform">0.3</dist>
+     		 	<dist avg="3" min="3" max="3" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="4" min="4" max="4" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="5" min="5" max="5" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="6" min="6" max="6" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="7" min="7" max="7" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="8" min="8" max="8" stdev="0" distribution="uniform">0.05</dist>
+   			</MultiDistribution>
+   		</value>	
+	</ComputingResourceHostParameter>
+	 
+</tns:WorkloadConfiguration>
+
+
Index: DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig30.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig30.xml	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig30.xml	(revision 1305)
@@ -0,0 +1,34 @@
+<tns:WorkloadConfiguration 
+	xmlns:tns="http://www.man.poznan.pl/WorkloadSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 
+  	<SimulationStartTime>2009-01-15T10:00:00</SimulationStartTime>
+ 
+	<JobCount avg="1000" distribution="constant"/>
+ 
+	<TaskCount avg="1" distribution="constant"/>
+ 
+	<TaskLength avg="14400" min="10800" max="18000" stdev="3600.0" distribution="normal"/>
+ 
+	<JobPackageLength avg="1.0" min="1.0" max="1.0" stdev="0.0" distribution="constant"/>
+ 
+	<JobInterval avg="1200" min="0" max="1500" stdev="300" distribution="poisson" seed="21"/>
+	
+	<ComputingResourceHostParameter metric="cpucount">
+		<value id="cpucnt">
+	  		<MultiDistribution>
+  				<dist avg="1" min="1" max="1" stdev="0" distribution="uniform">0.3</dist>
+      			<dist avg="2" min="2" max="2" stdev="0" distribution="uniform">0.3</dist>
+     		 	<dist avg="3" min="3" max="3" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="4" min="4" max="4" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="5" min="5" max="5" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="6" min="6" max="6" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="7" min="7" max="7" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="8" min="8" max="8" stdev="0" distribution="uniform">0.05</dist>
+   			</MultiDistribution>
+   		</value>	
+	</ComputingResourceHostParameter>
+	 
+</tns:WorkloadConfiguration>
+
+
Index: DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig50.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig50.xml	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig50.xml	(revision 1305)
@@ -0,0 +1,34 @@
+<tns:WorkloadConfiguration 
+	xmlns:tns="http://www.man.poznan.pl/WorkloadSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 
+  	<SimulationStartTime>2009-01-15T10:00:00</SimulationStartTime>
+ 
+	<JobCount avg="1000" distribution="constant"/>
+ 
+	<TaskCount avg="1" distribution="constant"/>
+ 
+	<TaskLength avg="14400" min="10800" max="18000" stdev="3600.0" distribution="normal"/>
+ 
+	<JobPackageLength avg="1.0" min="1.0" max="1.0" stdev="0.0" distribution="constant"/>
+ 
+	<JobInterval avg="720" min="0" max="1200" stdev="300" distribution="poisson" seed="21"/>
+	
+	<ComputingResourceHostParameter metric="cpucount">
+		<value id="cpucnt">
+	  		<MultiDistribution>
+  				<dist avg="1" min="1" max="1" stdev="0" distribution="uniform">0.3</dist>
+      			<dist avg="2" min="2" max="2" stdev="0" distribution="uniform">0.3</dist>
+     		 	<dist avg="3" min="3" max="3" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="4" min="4" max="4" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="5" min="5" max="5" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="6" min="6" max="6" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="7" min="7" max="7" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="8" min="8" max="8" stdev="0" distribution="uniform">0.05</dist>
+   			</MultiDistribution>
+   		</value>	
+	</ComputingResourceHostParameter>
+	 
+</tns:WorkloadConfiguration>
+
+
Index: DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig70.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig70.xml	(revision 1305)
+++ DCWoRMS/branches/coolemall/src/test/thermal/workloadgen/conf1/WorkloadConfig70.xml	(revision 1305)
@@ -0,0 +1,34 @@
+<tns:WorkloadConfiguration 
+	xmlns:tns="http://www.man.poznan.pl/WorkloadSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ 
+  	<SimulationStartTime>2009-01-15T10:00:00</SimulationStartTime>
+ 
+	<JobCount avg="1000" distribution="constant"/>
+ 
+	<TaskCount avg="1" distribution="constant"/>
+ 
+	<TaskLength avg="14400" min="10800" max="18000" stdev="3600.0" distribution="normal"/>
+ 
+	<JobPackageLength avg="1.0" min="1.0" max="1.0" stdev="0.0" distribution="constant"/>
+ 
+	<JobInterval avg="520" min="0" max="1200" stdev="300" distribution="poisson" seed="21"/>
+	
+	<ComputingResourceHostParameter metric="cpucount">
+		<value id="cpucnt">
+	  		<MultiDistribution>
+  				<dist avg="1" min="1" max="1" stdev="0" distribution="uniform">0.3</dist>
+      			<dist avg="2" min="2" max="2" stdev="0" distribution="uniform">0.3</dist>
+     		 	<dist avg="3" min="3" max="3" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="4" min="4" max="4" stdev="0" distribution="uniform">0.1</dist>
+     		 	<dist avg="5" min="5" max="5" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="6" min="6" max="6" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="7" min="7" max="7" stdev="0" distribution="uniform">0.05</dist>
+     		 	<dist avg="8" min="8" max="8" stdev="0" distribution="uniform">0.05</dist>
+   			</MultiDistribution>
+   		</value>	
+	</ComputingResourceHostParameter>
+	 
+</tns:WorkloadConfiguration>
+
+
