Index: xssim/branches/tpiontek/src/example/localplugin/FCFSPreferedRandomClusterLocalPlugin.java
===================================================================
--- xssim/branches/tpiontek/src/example/localplugin/FCFSPreferedRandomClusterLocalPlugin.java	(revision 256)
+++ xssim/branches/tpiontek/src/example/localplugin/FCFSPreferedRandomClusterLocalPlugin.java	(revision 257)
@@ -31,4 +31,7 @@
 	private boolean init = true;
 	
+	int scenario = 1;
+	String prefered = null;
+	
 	public FCFSPreferedRandomClusterLocalPlugin() {
 		rand = new Random(5);
@@ -37,6 +40,4 @@
 	public SchedulingPlanInterfaceNew schedule(SchedulingEvent event, QueueList queues, JobRegistryInterface jobRegistry,
 			 ResourceManagerInterface resManager, ModuleList modules) {
-		
-		int scenario = 1;
 		
 		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
@@ -71,5 +72,5 @@
 				if (task.getStatus() == Gridlet.READY) {
 					
-					ComputingNode node = chooseRandomProvider(resourceManager, task);
+					ComputingNode node = chooseRandomProvider(resourceManager, ResourceStatus.FREE, task);
 					
 					if (node != null) {
@@ -84,10 +85,8 @@
 						case 1: break;
 						case 2:
-							findSuitableNodes( "", getCpuRequest(task), ResourceStatus.UNAVAILABLE, resourceManager.getComputingNodes());
+							//ComputingNode node = chooseRandomProvider(resourceManager, ResourceStatus.UNAVAILABLE, task);
 							break;
 						}
 					}
-					
-					
 				}
 			}
@@ -156,5 +155,5 @@
 	}
 	
-	private ComputingNode chooseRandomProvider(ClusterResourceManager resourceManager, TaskInterface<?> task) {
+	private ComputingNode chooseRandomProvider(ClusterResourceManager resourceManager, ResourceStatus status, TaskInterface<?> task) {
 		
 		int cpuRequest = getCpuRequest(task);
@@ -164,5 +163,5 @@
 		String prefered = null;
 		
-		nodes = findSuitableNodes(prefered, cpuRequest, ResourceStatus.FREE, resourceManager.getComputingNodes());
+		nodes = findSuitableNodes(prefered, cpuRequest, status, resourceManager.getComputingNodes());
 		if( nodes.size() > 0)
 		{	
@@ -179,10 +178,5 @@
 		if( prefered != null)
 		{	
-			if( prefered.equals("A"))
-				prefered = "B";
-			else
-				prefered = "A";
-			
-			nodes = findSuitableNodes(prefered, cpuRequest, ResourceStatus.FREE, resourceManager.getComputingNodes());
+			nodes = findSuitableNodes( getUnprefered(), cpuRequest, status, resourceManager.getComputingNodes());
 			if( nodes.size() > 0)
 			{	
@@ -214,4 +208,15 @@
 		return cpus.subList(0, cpuRequest);
 	}
+	
+	private String getUnprefered()
+	{
+		if( prefered.equals("A"))
+			return "B";
+		
+		if( prefered.equals("B"))
+			return "A";
+		
+		return null;
+	}
 
 }
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 241)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_A_PowerProfile.java	(revision 257)
@@ -23,8 +23,8 @@
 		static {
 			Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>();
-			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));
+			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 3000, 0, 14, 2000));
+			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 12, 1777));
+			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 10, 1553));
+			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 8, 1333));
 			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 252)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java	(revision 257)
@@ -111,9 +111,7 @@
 		if(newPState != null)
 		{
-			double factor = newPState.getFrequency() / pState.getFrequency();
-			
 			pState = newPState;
 			CpuSpeed speed = (CpuSpeed )cpu.getResourceCharacteristic().getResourceUnits().get(ResourceParameterName.CPUSPEED).get(0);
-			speed.setAmount( (int)(speed.getAmount() * factor));
+			speed.setAmount( newPState.getSpeed());
 			
 			cpu.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, cpu.getName()));
@@ -132,8 +130,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, 350, 1000));
+			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 343, 1000));
+			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 337, 1000));
+			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 330, 1000));
 			pStates = Collections.unmodifiableMap(pStatesMap);
 		}
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 252)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java	(revision 257)
@@ -23,8 +23,8 @@
 		static {
 			Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>();
-			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2200, 0, 20));
-			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2000, 0, 17));
-			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 1800, 0, 16));
-			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1000, 0, 10));
+			pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2200, 0, 20, 1000));
+			pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2000, 0, 17, 909));
+			pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 1800, 0, 16, 818));
+			pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1000, 0, 10, 454));
 			pStates = Collections.unmodifiableMap(pStatesMap);
 		}
Index: xssim/branches/tpiontek/src/test/rewolucja/energy/profile/PState.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/energy/profile/PState.java	(revision 104)
+++ xssim/branches/tpiontek/src/test/rewolucja/energy/profile/PState.java	(revision 257)
@@ -7,6 +7,7 @@
 	protected double voltage;
 	protected double power;
+	protected int speed;
 
-	public PState(PStateType name, double frequency, double voltage, double power) {
+	public PState(PStateType name, double frequency, double voltage, double power, int speed) {
 		super();
 		this.name = name;
@@ -28,3 +29,6 @@
 		return power;
 	}
+	public int getSpeed() {
+		return speed;
+	}
 }
Index: xssim/branches/tpiontek/src/test/rewolucja/resources/ProcessingElements.java
===================================================================
--- xssim/branches/tpiontek/src/test/rewolucja/resources/ProcessingElements.java	(revision 141)
+++ xssim/branches/tpiontek/src/test/rewolucja/resources/ProcessingElements.java	(revision 257)
@@ -51,4 +51,5 @@
 		avgSpeed = avgSpeed / peCnt;
 		int speed = (int) Math.round(avgSpeed);
+		
 		return speed;
 	}
