Index: DCWoRMS/trunk/build/classes/test/ariel/workload.swf
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/workload.swf	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/workload.swf	(revision 539)
@@ -0,0 +1,19 @@
+;Automatically generated workload description by the Grid Scheduling Simulator
+;		j|		s|		w|		r|		c|		c|		m|		p|		t|		m|		s|		u|		g|		e|		q|		p|		p|		t|
+;		o|		u|		a|		u|		p|		p|		e|		r|		i|		e|		t|		i|		i|		x|		u|		a|		r|		h|
+;		b|		b|		i|		n|		u|		u|		m|		o|		m|		m|		a|		d|		d|		e|		e|		r|		e|		i|
+;		 |		m|		t|		t|		 |		 |		 |		c|		e|		 |		t|		 |		 |		c|		u|		t|		c|		n|
+;		 |		i|		 |		i|		a|		t|		u|		 |		 |		r|		u|		 |		 |		u|		e|		i|		 |		k|
+;		 |		t|		 |		m|		l|		i|		s|		r|		r|		e|		s|		 |		 |		t|		 |		t|		j|		 |
+;		 |		 |		 |		e|		l|		m|		e|		e|		e|		q|		 |		 |		 |		a|		n|		i|		o|		t|
+;		 |		 |		 |		 |		o|		e|		d|		q|		q|		 |		 |		 |		 |		b|		r|		o|		b|		i|
+;		 |		 |		 |		 |		c|		 |		 |		 |		 |		 |		 |		 |		 |		l|		 |		n|		 |		m|
+;		 |		 |		 |		 |		 |		 |		 |		 |		 |		 |		 |		 |		 |		e|		 |		 |		 |		e|
+;StartTime: Mon Nov 03 00:00:00 CET 2008
+;PUSpeed: 1
+
+
+		1			0			-1		14400	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
+		2			1800		-1		14400	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
+		3			3600		-1		14400	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
+		4			5400		-1		14400	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
Index: DCWoRMS/trunk/build/classes/test/ariel/RunExperiment.java
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/RunExperiment.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/RunExperiment.java	(revision 539)
@@ -0,0 +1,19 @@
+package test.ariel;
+import simulator.DataCenterWorkloadSimulator;
+
+
+public class RunExperiment {
+	
+	public static void main(String args[]){
+		RunExperiment runner = new RunExperiment();
+		runner.run();
+	}
+	
+	public void run(){
+		String args[] = {
+				"src/test/ariel/experiment1.properties"
+				};
+		DataCenterWorkloadSimulator.main(args);
+	}
+
+}
Index: DCWoRMS/trunk/build/classes/test/ariel/CPUFreqScalingExecTimeEstimationPlugin.java
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/CPUFreqScalingExecTimeEstimationPlugin.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/CPUFreqScalingExecTimeEstimationPlugin.java	(revision 539)
@@ -0,0 +1,46 @@
+package test.ariel;
+
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+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 CPUFreqScalingExecTimeEstimationPlugin extends BaseTimeEstimationPlugin{
+
+	public double execTimeEstimation(SchedulingEvent event, ExecTask task,
+			Map<ResourceUnitName, ResourceUnit> allocatedResources,
+			double completionPercentage) {
+
+		PEUnit peUnit = (PEUnit) allocatedResources.get(StandardResourceUnitName.PE);
+
+		double speed;
+		if(peUnit instanceof ProcessingElements){
+			ProcessingElements pe = (ProcessingElements)peUnit;
+			Processor cpu = (Processor)pe.get(0);
+			speed = cpu.getPowerInterface().getPState().getFrequency()/1000;
+		}
+		else 
+			speed = peUnit.getSpeed();
+		
+		int cnt = peUnit.getUsedAmount();
+
+		double remainingLength =  task.getLength() * (1 - completionPercentage/100);
+
+		double execTime = (remainingLength / (cnt * speed));
+
+		if (Double.compare(execTime, 0.001) < 0) {
+			execTime = 0.001;
+		}
+
+		execTime = Math.ceil(execTime);
+		return execTime;
+	}
+
+}
Index: DCWoRMS/trunk/build/classes/test/ariel/FCFSCPUFreqScalingPlugin.java
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/FCFSCPUFreqScalingPlugin.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/FCFSCPUFreqScalingPlugin.java	(revision 539)
@@ -0,0 +1,109 @@
+package test.ariel;
+
+import gridsim.dcworms.DCWormsTags;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import schedframe.events.scheduling.SchedulingEvent;
+import schedframe.events.scheduling.TaskFinishedEvent;
+import schedframe.events.scheduling.TaskRequestedTimeExpiredEvent;
+import schedframe.resources.ResourceStatus;
+import schedframe.resources.computing.ComputingNode;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Processor;
+import schedframe.resources.units.Memory;
+import schedframe.resources.units.ProcessingElements;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
+import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.UsedResourcesList;
+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.grid.ModuleList;
+import schedframe.scheduling.queue.TaskQueue;
+import schedframe.scheduling.queue.TaskQueueList;
+import schedframe.scheduling.tasks.TaskInterface;
+import schedframe.scheduling.tasks.WorkloadUnit;
+import dcworms.schedframe.scheduling.Executable;
+import example.localplugin.BaseLocalSchedulingPlugin;
+
+public class FCFSCPUFreqScalingPlugin extends BaseLocalSchedulingPlugin {
+
+	int cnt;
+
+	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
+			 ResourceManager resManager, ModuleList modules) {
+		
+		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		SchedulingPlan plan = new SchedulingPlan();
+		// chose the events types to serve.
+		// Different actions for different events are possible.
+		switch (event.getType()) {
+		case START_TASK_EXECUTION:
+			
+		//case TIMER:
+			// our tasks are placed only in first queue (see
+			// BaseLocalPlugin.placeJobsInQueues() method)
+			TaskQueue q = queues.get(0);
+			
+			// check all tasks in queue
+			for (int i = 0; i < q.size(); i++) {
+				WorkloadUnit job = q.get(i);
+				TaskInterface<?> task = (TaskInterface<?>) job;
+				// if status of the tasks in READY
+				if (task.getStatus() == DCWormsTags.READY) {
+
+					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task);
+					if (choosenResources != null) {
+						addToSchedulingPlan(plan, task, choosenResources);
+					}
+					
+					for(Processor cpu: resourceManager.getProcessors()){
+						cpu.getPowerInterface().setPState("P"+cnt);
+					}
+				}
+			}
+			break;
+		}
+		cnt++;
+		return plan;
+	}
+
+	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
+			ClusterResourceManager resourceManager, TaskInterface<?> task) {
+
+		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>();
+		List<Processor> processors = resourceManager.getProcessors();
+		int cpuRequest;
+		try {
+			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+		} catch (NoSuchFieldException e) {
+			cpuRequest = 1;
+		}
+
+		if (cpuRequest != 0) {
+
+			List<Processor> choosenProcessor = new ArrayList<Processor>();				
+			for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {
+				if (processors.get(i).getStatus() == ResourceStatus.FREE) {
+					choosenProcessor.add(processors.get(i));
+					cpuRequest--;
+				}
+			}
+
+			ProcessingElements result = new ProcessingElements();
+			result.addAll(choosenProcessor);
+			map.put(StandardResourceUnitName.PE, result);
+		}
+	
+		return map;
+	}
+
+
+}
Index: DCWoRMS/trunk/build/classes/test/ariel/resources.xml
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/resources.xml	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/resources.xml	(revision 539)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<environment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:noNamespaceSchemaLocation="../../../simulator/schemas/resources/WormsResSchema.xsd">
+	
+	<timeEstimationPlugin>
+		<name>test.ariel.CPUFreqScalingExecTimeEstimationPlugin</name>
+	</timeEstimationPlugin>
+	<!-- Simple data center description -->
+	<resources>
+		<computingResource class="DataCenter" name="compRes">
+			<computingResource class="Processor" count="4">
+				<profile>
+					<powerProfile>
+						<energyEstimationPlugin>
+							<name>example.energy.CPUEnergyEstimationPlugin</name>
+						</energyEstimationPlugin>		
+						<parameter name="pState">
+							<property name="name">
+								<value>P0</value>
+							</property>	
+							<property name="frequency">
+								<value unit="Hz">2000</value>
+							</property>		
+							<property name="powerUsage">
+								<value unit="W">350</value>
+							</property>						
+						</parameter>
+						<parameter name="pState">
+							<property name="name">
+								<value>P1</value>
+							</property>	
+							<property name="frequency">
+								<value unit="H`">1500</value>
+							</property>		
+							<property name="powerUsage">
+								<value unit="W">343</value>
+							</property>						
+						</parameter>	
+						<parameter name="pState">
+							<property name="name">
+								<value>P2</value>
+							</property>	
+							<property name="frequency">
+								<value unit="H`">1000</value>
+							</property>		
+							<property name="powerUsage">
+								<value unit="W">337</value>
+							</property>						
+						</parameter>
+						<parameter name="pState">
+							<property name="name">
+								<value>P3</value>
+							</property>	
+							<property name="frequency">
+								<value unit="H`">500</value>
+							</property>		
+							<property name="powerUsage">
+								<value unit="W">330</value>
+							</property>						
+						</parameter>								
+					</powerProfile>
+				</profile>
+			</computingResource>
+		</computingResource>
+		<scheduler class="Cluster" name="cluster">
+			<schedulingPlugin>
+				<name>test.ariel.FCFSCPUFreqScalingPlugin</name>
+			</schedulingPlugin>	
+			<managedComputingResources include="false">
+				<resourceName>compRes</resourceName>
+			</managedComputingResources>
+		</scheduler>	
+	</resources>
+
+</environment>
Index: DCWoRMS/trunk/build/classes/test/ariel/experiment1.properties
===================================================================
--- DCWoRMS/trunk/build/classes/test/ariel/experiment1.properties	(revision 539)
+++ DCWoRMS/trunk/build/classes/test/ariel/experiment1.properties	(revision 539)
@@ -0,0 +1,17 @@
+# Use single *.swf file as workload description.
+
+# Path to xml file which describes resource characteristics.
+resdesc=src/test/ariel/resources.xml
+
+# and swf file, which name is declared by readscenario.workloadfilename parameter.
+# Swf file must be placed in readscenario.inputfolder directory.  
+readscenario.workloadfilename=src/test/ariel/workload.swf
+
+# Choose directory where all result files should be placed.
+stats.outputfolder=../experiment_result
+
+
+creatediagrams.gantt=true
+
+creatediagrams.respowerusage=Processor
+
