Index: xssim/branches/tpiontek/src/example/energy/ComputingNodeEnergyEstimationPlugin.java
===================================================================
--- xssim/branches/tpiontek/src/example/energy/ComputingNodeEnergyEstimationPlugin.java	(revision 206)
+++ xssim/branches/tpiontek/src/example/energy/ComputingNodeEnergyEstimationPlugin.java	(revision 241)
@@ -5,6 +5,6 @@
 import test.rewolucja.energy.EnergyEvent;
 import test.rewolucja.resources.physical.base.ComputingResource;
+import test.rewolucja.resources.physical.implementation.ComputingNode;
 import test.rewolucja.resources.physical.implementation.Processor;
-import test.rewolucja.resources.physical.implementation.ComputingNode;
 import test.rewolucja.scheduling.JobRegistryInterface;
 
@@ -16,4 +16,17 @@
 		double power = 0;
 		ComputingNode node = (ComputingNode) resource;
+		
+		if( node.getCategory().getName().equals("A"))
+			power = 240;
+		else if( node.getCategory().getName().equals("B"))
+			power = 95;
+		else
+		{
+			System.err.println("Unknown Model: "  +node.getCategory().getName());
+			System.exit(1);
+		}	
+		
+		
+		
 		for(Processor cpu: node.getProcessors()){
 			//try{
@@ -23,5 +36,5 @@
 			//}
 		}
-		power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState());
+		//power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState());
 		return power;
 	}
Index: xssim/branches/tpiontek/src/example/energy/CPUEnergyEstimationPlugin.java
===================================================================
--- xssim/branches/tpiontek/src/example/energy/CPUEnergyEstimationPlugin.java	(revision 206)
+++ xssim/branches/tpiontek/src/example/energy/CPUEnergyEstimationPlugin.java	(revision 241)
@@ -1,4 +1,7 @@
 package example.energy;
 
+import gssim.schedframe.scheduling.ExecTaskInterface;
+
+import java.util.List;
 import java.util.Properties;
 
@@ -16,10 +19,24 @@
 			ComputingResource resource) {
 		Processor cpu = (Processor)resource;
+		
 		if(resource.getPowerInterface().getPowerState() == PowerState.OFF)
 			return 0;
+		
+		double factor = 1.3;
+		
 		if(resource.getStatus() == ResourceStatus.BUSY)
-			return cpu.getPowerInterface().getPState().getPower();
+		{
+			List<ExecTaskInterface> tasks = jobRegistry.getRunningTasks();
+			int type = Integer.parseInt( tasks.get(0).getJobId());
+			
+			switch( type % 4)
+			{
+				default: factor = 1.3; 
+			}
+			
+			return cpu.getPowerInterface().getPState().getPower() * factor;
+		}	
 		else 
-			return 1; 
+			return cpu.getPowerInterface().getPState().getPower(); 
 	}
 
Index: xssim/branches/tpiontek/src/example/localplugin/FCFSRandomClusterLocalPlugin.java
===================================================================
--- xssim/branches/tpiontek/src/example/localplugin/FCFSRandomClusterLocalPlugin.java	(revision 192)
+++ xssim/branches/tpiontek/src/example/localplugin/FCFSRandomClusterLocalPlugin.java	(revision 241)
@@ -3,4 +3,5 @@
 import gridsim.Gridlet;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
@@ -11,7 +12,9 @@
 import schedframe.scheduling.plugin.grid.ModuleList;
 import test.rewolucja.GSSIMJobInterface;
+import test.rewolucja.energy.profile.PStateType;
 import test.rewolucja.resources.manager.implementation.ClusterResourceManager;
 import test.rewolucja.resources.manager.interfaces.ResourceManagerInterface;
 import test.rewolucja.resources.physical.implementation.ComputingNode;
+import test.rewolucja.resources.physical.implementation.Processor;
 import test.rewolucja.scheduling.JobRegistryInterface;
 import test.rewolucja.scheduling.plan.SchedulingPlanInterfaceNew;
@@ -23,4 +26,5 @@
 
 	private Random rand;
+	private boolean init = true;
 	
 	public FCFSRandomClusterLocalPlugin() {
@@ -30,6 +34,19 @@
 	public SchedulingPlanInterfaceNew schedule(SchedulingEvent event, QueueList queues, JobRegistryInterface jobRegistry,
 			 ResourceManagerInterface resManager, ModuleList modules) {
+		
+		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		
+		if( init)
+		{
+			List<Processor> cpus = resourceManager.getProcessors();
+			
+			for( Processor cpu : cpus)
+				cpu.getPowerInterface().setPState( PStateType.P3);
+			
+			init = false;
+		}
+		
 
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
+		
 		SchedulingPlanNew plan = new SchedulingPlanNew();
 		// chose the events types to serve.
@@ -48,5 +65,5 @@
 				// if status of the tasks in READY
 				if (task.getStatus() == Gridlet.READY) {
-					String nodeName = chooseRandomProvider(resourceManager);
+					String nodeName = chooseRandomProvider(resourceManager, task);
 					if (nodeName != null) {
 						addToSchedulingPlan(plan, task, nodeName);
@@ -59,6 +76,27 @@
 	}
 
-	private String chooseRandomProvider(ClusterResourceManager resourceManager) {
+	private List<ComputingNode> findSuitableNodes(int cpuRequest, List<ComputingNode> nodes){
+		List<ComputingNode> avNodes = new ArrayList<ComputingNode>();
+		for(ComputingNode node: nodes){
+			if(node.getFreeProcessorsNumber() >= cpuRequest){
+				avNodes.add(node);
+			}
+		}
+		return avNodes;
+	}
+	
+	private String chooseRandomProvider(ClusterResourceManager resourceManager, TaskInterface<?> task) {
+		
+		int cpuRequest;
+		try {
+			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
+		} catch (NoSuchFieldException e) {
+			cpuRequest = 1;
+		}
+		
 		List<ComputingNode> nodes = resourceManager.getComputingNodes();
+		
+		nodes = findSuitableNodes(cpuRequest, nodes);
+		
 		int nodeIdx = rand.nextInt(nodes.size());
 		return nodes.get(nodeIdx).getName();
Index: xssim/branches/tpiontek/src/example/timeestimation/ExecTimeEstimationPlugin.java
===================================================================
--- xssim/branches/tpiontek/src/example/timeestimation/ExecTimeEstimationPlugin.java	(revision 184)
+++ xssim/branches/tpiontek/src/example/timeestimation/ExecTimeEstimationPlugin.java	(revision 241)
@@ -10,5 +10,8 @@
 import schedframe.scheduling.plugin.SchedulingPluginConfiguration;
 import schedframe.scheduling.utils.ResourceParameterName;
+import test.rewolucja.energy.profile.PState;
+import test.rewolucja.energy.profile.PStateType;
 import test.rewolucja.resources.ProcessingElements;
+import test.rewolucja.resources.physical.implementation.Processor;
 
 
@@ -38,5 +41,5 @@
 		// obtain single pe speed
 		int speed = pes.getSpeed();
-
+		
 		// number of used pe  
 		int cnt = pes.getUsedAmount();
@@ -44,5 +47,5 @@
 		double remainingLength =  task.getLength() * (1- completionPercentage);
 		// do the calculation
-		double execTime = (remainingLength / (cnt * speed));
+		double execTime = (remainingLength / (cnt * speed/1000));
 
 		// if the result is very close to 0, but less then one millisecond then round this result to 0.001
Index: xssim/branches/tpiontek/src/simulator/GridSchedulingSimulator.java
===================================================================
--- xssim/branches/tpiontek/src/simulator/GridSchedulingSimulator.java	(revision 159)
+++ xssim/branches/tpiontek/src/simulator/GridSchedulingSimulator.java	(revision 241)
@@ -292,5 +292,5 @@
 		};
 
-		File tarArchive = new File(outputDir, "results.tar");
+		/*File tarArchive = new File(outputDir, "results.tar");
 
 		File networkTopologyFile = (configurationOptions.networkTopologyFileName == null) ? null
@@ -302,6 +302,5 @@
 		} catch (IOException e) {
 			log.error("IOException occured while creating archive file", e);
-		}
-	}
+		}*/	}
 
 	public void runMultiuser(String rootDirPath, GridSchedulingSimulator gssim) {
Index: xssim/branches/tpiontek/src/simulator/stats/implementation/GSSimStatistics.java
===================================================================
--- xssim/branches/tpiontek/src/simulator/stats/implementation/GSSimStatistics.java	(revision 233)
+++ xssim/branches/tpiontek/src/simulator/stats/implementation/GSSimStatistics.java	(revision 241)
@@ -326,5 +326,6 @@
 						if (resourceLoadStatsFile != null) {
 							Object txt = resourceUsage.serialize(serializer);
-							resourceLoadStatsFile.println(txt);
+							if( resType == ResourceType.DATA_CENTER)
+								resourceLoadStatsFile.println(txt);
 						}
 					}
@@ -340,5 +341,6 @@
 						if (energyStatsFile != null) {
 							Object txt = energyUsage.serialize(serializer);
-							energyStatsFile.println(txt);
+							if( resType == ResourceType.DATA_CENTER)
+								energyStatsFile.println(txt);
 						}
 					}
Index: xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_A_PowerProfile.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_A_PowerProfile.java	(revision 131)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_A_PowerProfile.java	(revision 241)
@@ -23,8 +23,8 @@
 		static {
 			Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>();
-			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 3000, 0, 350));
-			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 343));
-			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 337));
-			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 330));
+			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 3000, 0, 14));
+			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 12));
+			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 10));
+			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 8));
 			pStates = Collections.unmodifiableMap(pStatesMap);
 		}
Index: xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java	(revision 215)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java	(revision 241)
@@ -31,4 +31,5 @@
 		powerState = PowerState.ON;
 		pState = getSupportedPStates().get(PStateType.P0);
+		//pState = getSupportedPStates().get(PStateType.P3);
 	}
 
@@ -103,11 +104,13 @@
 	public boolean setPState(PStateType pStateType){
 		PState newPState = getSupportedPStates().get(pStateType);
+		
 		if(newPState != null)
 		{
-			double factor = pState.getFrequency()/newPState.getFrequency();
+			double factor = newPState.getFrequency() / pState.getFrequency();
+			
 			pState = newPState;
 			CpuSpeed speed = (CpuSpeed )cpu.getResourceCharacteristic().getResourceUnits().get(ResourceParameterName.CPUSPEED).get(0);
-			//speed.setAmount((int)pState.getFrequency());
-
+			speed.setAmount( (int)(speed.getAmount() * factor));
+			
 			cpu.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, cpu.getName()));
 			cpu.getLogicalResource().sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, cpu.getName());
Index: xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java	(revision 131)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java	(revision 241)
@@ -23,8 +23,8 @@
 		static {
 			Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>();
-			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2660, 0, 363));
-			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2330, 0, 357));
-			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2000, 0, 350));
-			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1860, 0, 343));
+			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2200, 0, 19));
+			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2000, 0, 16));
+			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 1800, 0, 14));
+			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1000, 0, 10));
 			pStates = Collections.unmodifiableMap(pStatesMap);
 		}
Index: xssim/branches/tpiontek/src/test/rewolucja/resources/physical/implementation/Processor.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/resources/physical/implementation/Processor.java	(revision 220)
+++ xssim/branches/tpiontek/src/test/rewolucja/resources/physical/implementation/Processor.java	(revision 241)
@@ -56,5 +56,10 @@
 	public void initCharacteristics(ExecResourceDescription resDesc){
 		resourceCharacteristic = new ResourceCharacteristics();
-		resourceCharacteristic.addResourceUnit(new CpuSpeed(name, 1, 0));
+		
+		int speed = 1000;
+		if( resDesc.getCategory().getName().equals("A"))
+			speed = 2000;
+		
+		resourceCharacteristic.addResourceUnit(new CpuSpeed(name, speed, 0));
 	}
 	
Index: xssim/branches/tpiontek/src/test/rewolucja/resources/physical/factory/ComputingNodeFactory.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/resources/physical/factory/ComputingNodeFactory.java	(revision 104)
+++ xssim/branches/tpiontek/src/test/rewolucja/resources/physical/factory/ComputingNodeFactory.java	(revision 241)
@@ -4,5 +4,4 @@
 import schedframe.resources.units.Memory;
 import test.rewolucja.resources.Category;
-import test.rewolucja.resources.ResourceCharacteristics;
 import test.rewolucja.resources.description.ExecResourceDescription;
 import test.rewolucja.resources.physical.base.ComputingResource;
@@ -37,18 +36,26 @@
 		String resName = resDesc.getResourceId();
 		Category cat = resDesc.getCategory();
-		if(cat.getName().equals("A")){
-			resDesc.addResourceUnit(new Memory(resName, 12288, 0));
+		
+		if(cat.getName().equals("A"))
+		{
+			resDesc.addResourceUnit(new Memory(resName, 8704, 0));
 			resDesc.addResourceUnit(new Cost(resName, 100));
 			return new ComputingNode(resDesc);
-		} else if (cat.getName().equals("B")){
-			resDesc.addResourceUnit(new Memory(resName, 12288, 0));
+		}
+		else if (cat.getName().equals("B"))
+		{
+			resDesc.addResourceUnit(new Memory(resName, 6144, 0));
 			resDesc.addResourceUnit(new Cost(resName, 100));
 			return new ComputingNode(resDesc);
-		} else if (cat.getName().equals("C")){
-			resDesc.addResourceUnit(new Memory(resName, 12288, 0));
+		}
+		else if (cat.getName().equals("C"))
+		{
+			resDesc.addResourceUnit(new Memory(resName, 0, 0));
 			resDesc.addResourceUnit(new Cost(resName, 100));
 			return new ComputingNode(resDesc);
-		} else {
-			resDesc.addResourceUnit(new Memory(resName, 12288, 0));
+		}
+		else
+		{
+			resDesc.addResourceUnit(new Memory(resName, 0, 0));
 			resDesc.addResourceUnit(new Cost(resName, 100));
 			return new ComputingNode(resDesc);
