Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/RackEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/RackEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,124 +1,0 @@
-package test.simpat.models.basic;
-
-import java.util.List;
-
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import gridsim.dcworms.DCWormsTags;
-
-public class RackEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	double powerCapLevel = -1;
-	double powerUpgradeLevel = -1;
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		if(powerCapLevel == -1 || powerUpgradeLevel == -1){
-			loadThresholds((ComputingResource) resource);
-		}
-		
-		double powerConsumption = 0;
-		Rack rack = (Rack)resource;
-		for(Node node:rack.getNodes()){
-			try{
-				powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue();
-			} catch (Exception e){
-				
-			}
-		}
-		
-		int nrOfPoweredOffNodes = 0;
-		for(Node node: rack.getNodes()){
-			if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-				nrOfPoweredOffNodes++;
-			}
-		}
-		if(nrOfPoweredOffNodes != rack.getNodes().size()){
-			powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;			
-		}
-		
-		if(powerConsumption > powerCapLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}
-		else if(powerConsumption < powerUpgradeLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}
-		return powerConsumption;
-	}
-	
-	private void loadThresholds(ComputingResource compResource){
-		
-		Rack rack = (Rack) compResource;
-		double pcLevel = 0;
-		double puLevel = 0;
-		for(Processor proc: rack.getProcessors()){
-			PState highestPState =  proc.getPowerInterface().getHighestPState();
-			PState secondHighestPState =  proc.getPowerInterface().getLowestPState();
-			for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-				PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-				if(pState.getFrequency()  < secondHighestPState.getFrequency() && pState.getFrequency() > highestPState.getFrequency()){
-					secondHighestPState = pState;
-				}
-			}
-			double maxMinPowerUsage = 0;
-			double powerUsage = 0;
-			
-			for(Double load: highestPState.getLoadPowerUsage().keySet()){
-				powerUsage = highestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			pcLevel = pcLevel + maxMinPowerUsage;
-			
-			maxMinPowerUsage = 0;
-			powerUsage = 0;
-			
-			for(Double load: secondHighestPState.getLoadPowerUsage().keySet()){
-				powerUsage = secondHighestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			puLevel = puLevel + maxMinPowerUsage;
-			
-		}
-		
-		double fpc = 0;
-		for(Node node: rack.getNodes()){
-			for(Device device: node.getResourceCharacteristic().getDevices()){
-				try {
-					fpc = fpc + device.getAirflowInterface().getPowerConsumption(new CustomAirflowStateName("ON_100"));
-				} catch (NoSuchFieldException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-
-		}
-		pcLevel = (pcLevel + fpc) / CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;
-		puLevel = (puLevel + fpc) / CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;
-
-		puLevel = (pcLevel * pcLevel / puLevel);
-
-		powerCapLevel = pcLevel;
-		powerUpgradeLevel = puLevel;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FanEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,76 +1,0 @@
-package test.simpat.models.basic;
-
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	/*private static int PFanMax = 6;
-	private static int TFanLow = 45;
-	private static int TFanHigh = 47;*/
-
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		Fan fan = (Fan) resource;
-		/*Node node = (Node) fan.getComputingResource();
-		double Tcpu = 0;
-		for(Processor cpu: node.getProcessors()){
-			Tcpu = Tcpu + cpu.getThermalInterface().getRecentTemperature().getValue();
-		}
-		Tcpu = Tcpu/node.getProcessors().size();
-		
-		if (Tcpu < TFanLow) {
-			powerConsumption = 4;
-		} else if (Tcpu > TFanHigh){
-			powerConsumption = PFanMax;
-		}
-		*/
-		
-		try {
-			powerConsumption = fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		
-		double airflow = 0;
-		Fan fan = (Fan) resource;
-		
-		/*double fanEfficiency = 0;
-		try{
-			fanEfficiency = Double.valueOf(fan.getPowerInterface().getParameters().get("fanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-
-		double dp = 1013.25;
-		airflow = fan.getPowerInterface().getRecentPowerUsage().getValue() * fanEfficiency /dp;*/
-
-		try {
-			airflow = fan.getAirflowInterface().getAirflow(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		return airflow;
-	}
-	
-	public double estimateTemperature (ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double temperature = EnvironmentConditions.ROOM_TEMPERATURE;
-		return temperature;
-	}
-	
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FlowPumpInletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FlowPumpInletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,145 +1,0 @@
-package test.simpat.models.basic;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		/*********** Pfans_dc ***********/
-		double powerConsumption = 0;
-		double nf = 0.6;
-		
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			powerConsumption = delta_p * Vair_total / nf;
-		else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				powerConsumption = delta_p * Vair_total / nf;
-		}
-		
-		//System.out.println("Flow Pump power: " + powerConsumption);
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/NodeEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,155 +1,0 @@
-package test.simpat.models.basic;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Tidle = 26;
-
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	private boolean fan = false;
-	
-	private double next_timer = -1;
-
-	private static double Pidle = 10;
-	private static double Pfull = 76;
-
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		Node node = (Node) resource;
-		double powerConsumption = 0;
-
-		/*double Pcpu = 0;	
-		for(Processor cpu: node.getProcessors()){
-			Pcpu = Pcpu + cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		}*/
-		
-		powerConsumption = Pidle + (Pfull- Pidle) * node.getLoadInterface().getRecentUtilization().getValue()/100; 
-		double Pfan = 0;
-		for(Device device: node.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				Pfan = Pfan + fan.getPowerInterface().getRecentPowerUsage().getValue();
-			}
-		}
-		//powerConsumption = Pcpu + Pfan;
-		powerConsumption = powerConsumption + Pfan;
-		return powerConsumption;
-	}
-
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double future = -1;
-
-		Node node = (Node) resource;
-		Processor cpu = node.getProcessors().get(0);
-		double Pserv = 0;
-
-		double R = 0;
-		try{
-			R = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double K = 0;
-		double V = 0;
-		double Cair = EnvironmentConditions.AIR_HEAT_CAPACITY;
-		double ro = EnvironmentConditions.AIR_DENSITY;
-
-		for(Device device: node.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				V = V + fan.getAirflowInterface().getRecentAirflow().getValue();
-				//double dp = EnvironmentConditions.AIR_PRESSURE;
-				//V = fan.getPowerInterface().getRecentPowerUsage().getValue() * 0.6 /dp;
-			}
-		}
-
-		K = V * Cair * ro;
-		//System.out.println("-------A: " + A +  "; V:" + V);
-		// 1) look where we are
-		double delta_t = Sim_system.clock() - timestamp;
-		double currentCpuTemp = cpu.getThermalInterface().getRecentTemperature().getValue();
-		
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		double Pcpu = node.getProcessors().get(0).getPowerInterface().getRecentPowerUsage().getValue();
-		double objectiveCpuTemp = Pcpu * R + Tin; 
-		double targetTemp = Pserv/K + Tin; 
-		objective_temperature = targetTemp;
-		//System.out.println("node: " + node.getFullName() +  "; objective_temperature"  + objective_temperature +" : currentCpuTemp + ; " +currentCpuTemp + "; targetCpuTemp: " +objectiveCpuTemp );
-		/*if(delta_t == 0)
-			new_temperature =Tin +  ((objectiveCpuTemp+ (currentCpuTemp-objectiveCpuTemp)* Math.exp(-delta_t/ (H * C)))/H)/A;
-		else
-			new_temperature =Tin +  ((objectiveCpuTemp+ (currentCpuTemp-objectiveCpuTemp)* Math.exp(-delta_t/ (H * C)))/H + (C *(1/delta_t)))/A;
-*/
-		
-		//new_temperature =currentCpuTemp +  (old_temperature-currentCpuTemp)* Math.exp(-delta_t/ (H * C));
-		new_temperature = objective_temperature + (old_temperature - objective_temperature) * Math.exp(-delta_t / (R * C));
-		//new_temperature = objective_temperature +   1/ (A *R) *(currentCpuTemp - objective_temperature)* Math.exp(-delta_t / (R * C));
-		
-		//new_temperature = currentCpuTemp + (Tin - currentCpuTemp) * Math.exp(-delta_t / (R * A));
-		//System.out.println("***************" +new_temperature);
-		//new_temperature = (Tin + Pserv/A + ((14.4 - Pserv/A) * Math.exp(- Sim_system.clock() * A / C)));
-		//System.out.println("################" + new_temperature);
-		//new_temperature =Tin + (currentCpuTemp - Tin)/(H * A) + (old_temperature-objective_temperature)* Math.exp(-delta_t * A/ C);
-		
-		
-		// 3) compute new objective
-
-
-		//System.out.println("=========== " + Sim_system.clock() +  "; objective_temperature: " + objective_temperature  + "; new_temperature: " + new_temperature +  "; targetTemp: " + targetTemp);
-
-		
-		// 4) check if we will need to tune fans
-		if(fan && targetTemp < EnvironmentConditions.TFanLow) {
-			double timer = Cair/K * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanLow));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-		if(!fan && targetTemp > EnvironmentConditions.TFanHigh) {
-			double timer = Cair/K * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanHigh));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-		
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-		//objective_temperature = targetTemp;
-
-
-		if((future >= 0) && ((next_timer < Sim_system.clock()) || (next_timer >= future + Sim_system.clock()))) {
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(future, DCWormsTags.FANMGT, "Test");
-			next_timer = future + Sim_system.clock() - 0.01;
-		}		
-		//System.out.println("------- " + new_temperature);
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FlowPumpOutletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,81 +1,0 @@
-package test.simpat.models.basic;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/CpuEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/CpuEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,185 +1,0 @@
-package test.simpat.models.basic;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class CpuEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Pidle = 4;
-	private static double Pfull = 50;
-
-	private static int Tidle = 33;
-	
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	
-	private boolean fan = false;
-	
-	private double next_timer = -1;    
-	
-	private int cpu_temp_monitor = 0;
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		double powerConsumption = 0;
-
-		Processor cpu = (Processor)resource;
-		powerConsumption = Pidle + (Pfull- Pidle) * cpu.getLoadInterface().getRecentUtilization().getValue()/100;			
-
-		return powerConsumption;
-	}
-	
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double future = -1;
-
-		Processor cpu = (Processor) resource;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-		double V = 0;
-	
-		for(Device device: cpu.getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				V = fan.getAirflowInterface().getRecentAirflow().getValue();
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		// 1) look where we are
-		double delta_t = Sim_system.clock() - timestamp;
-		/***************model1*************/
-		//new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/sink);
-		
-		/***************model2*************/
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		 
-
-		// 2) calculate if fan is needed ?
-		if(new_temperature <= EnvironmentConditions.TFanLow) {
-			fan = false;
-		}
-		if(new_temperature >= EnvironmentConditions.TFanHigh) {
-			fan = true; 
-		}
-		
-		// 3) compute new objective
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		double Pcpu = cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		//new_temperature = (Pcpu * R + Tin) - (Pcpu * R + Tin - Tidle) * Math.exp(-Sim_system.clock()/(R * C));;
-		
-		/***************model1 - GEO1*************/
-		//double cpuLoad = cpu.getLoadInterface().getRecentUtilization().getValue();
-		//double targetTemp = Tidle + cpuLoad/100 * dTfull;
-		//if(fan) {
-		//	targetTemp = targetTemp - dTfan;
-		//}
-		
-		
-		/***************model2 - GEO2*************/
-		//Node node = (Node) cpu.getParent();
-		//Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		//double targetTemp = Pcpu * R + Tin; 
-		
-		/***************model3 - GEO1 + GEO2*************/
-		/*double targetTemp = Pcpu * R + Tin; 
-		if(fan) {
-			targetTemp = targetTemp - dTfan;
-		}*/
-	
-		/***************model4 - WP*************/
-		double targetTemp = Pcpu * R + Tin; 
-		
-		// 4) check if we will need to tune fans
-		if(fan && targetTemp < EnvironmentConditions.TFanLow) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanLow));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-		if(!fan && targetTemp > EnvironmentConditions.TFanHigh) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanHigh));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-		objective_temperature = targetTemp;
-
-
-		if((future >= 0) && ((next_timer < Sim_system.clock()) || (next_timer >= future + Sim_system.clock()))) {
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(future, DCWormsTags.FANMGT, "Test");
-			next_timer = future + Sim_system.clock() - 0.01;
-		}		
-		
-		if(new_temperature > EnvironmentConditions.tempLevelMedium2Low && new_temperature < EnvironmentConditions.tempLevelLow2Medium){
-			if(cpu_temp_monitor != 1){
-				cpu_temp_monitor = 1;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelLow2Medium && new_temperature < EnvironmentConditions.tempLevelHigh2Medium){
-			if(cpu_temp_monitor != 2){
-				cpu_temp_monitor = 2;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelHigh2Medium && new_temperature < EnvironmentConditions.tempLevelMedium2High){
-			if(cpu_temp_monitor != 3){
-				cpu_temp_monitor = 3;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelMedium2High){
-			if(cpu_temp_monitor != 4){
-				cpu_temp_monitor = 4;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		}
-		//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/CoolingDeviceEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/CoolingDeviceEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,486 +1,0 @@
-package test.simpat.models.basic;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		return airflow;
-	}
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		
-		Device coolingDevice = (Device) resource;
-		ComputingResource room = (ComputingResource) coolingDevice.getComputingResource();
-		
-		double Pload_dc = calculatePit(room);
-		double Pothers = calculatePothers(Pload_dc);
-		double Pfans_dc = calculatePfans(room);
-		
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-		
-		//if data is not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				powerConsumption = Pdry_cooler;
-			else
-				powerConsumption = Pchiller;	
-		}
-		
-		
-		//System.out.println("CoolingDevice heat data: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		
-		//System.out.println("CoolingDevice power: " + powerConsumption);
-		
-		
-		return powerConsumption;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			double QnodeGroup = 0;
-			Rack rack = (Rack)cr;
-			for(Node node: rack.getNodes()){
-				double Qnodes = 0;
-
-				double Qcpu = 0;
-				for(Processor proc: node.getProcessors()){
-					Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				Qnodes = Qnodes + Qcpu;
-				
-				double Qfans = 0;
-				for(Device device: node.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/DataCenterEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/DataCenterEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,515 +1,0 @@
-package test.simpat.models.basic;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class DataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double Pdc;
-		
-		double Pload_dc = 0;
-		double Pothers = 0;
-		double Pfans_dc = 0;
-		double Pcooling_device = 0;
-
-		ComputingResource room = (ComputingResource) resource;
-		
-		/**************** IT PART ****************/
-		
-		/*********** Pload_dc ***********/
-		Pload_dc = calculatePit(room);
-
-		
-		
-		/**************** NON- IT PART ****************/
-		
-		/*********** Pothers ***********/		
-		Pothers = calculatePothers(Pload_dc);
-		
-		
-		
-		/************* COOLING PART *************/
-
-		
-		/*********** Pfans_dc ***********/
-		Pfans_dc = calculatePfans(room);
-		
-		/************ Pcooling_device ************/
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-
-		
-		//if data not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				Pcooling_device = Pdry_cooler;
-			else
-				Pcooling_device = Pchiller;	
-		}
-		
-
-		Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device;
-		//System.out.println("---");
-		//System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller);
-		//System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device);
-		
-		//System.out.println("CB2 heat: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		//System.out.println("CB2 power: " + Pload_dc + "; " + Pothers + "; " + Pfans_dc + "; " + Pcooling_device + "; " + Pdc);
-
-		return Pdc;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			double QnodeGroup = 0;
-			for(Node node: rack.getNodes()){
-				double Qnodes = 0;
-
-				double Qcpu = 0;
-				for(Processor proc: node.getProcessors()){
-					Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				Qnodes = Qnodes + Qcpu;
-
-				double Qfans = 0;
-				for(Device device: node.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(Node node: rack.getNodes()){
-					for(Device device: node.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: node.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FCFSBF_RandomPluginMigrate.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/basic/FCFSBF_RandomPluginMigrate.java	(revision 1469)
+++ 	(revision )
@@ -1,414 +1,0 @@
-package test.simpat.models.basic;
-
-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.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.CustomPowerStateName;
-import schedframe.resources.computing.profiles.energy.power.PowerState;
-import schedframe.resources.computing.profiles.energy.power.PowerUsage;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-import schedframe.scheduling.ResourceItem;
-import schedframe.scheduling.manager.resources.ClusterResourceManager;
-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;
-import schedframe.scheduling.plugin.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import dcworms.schedframe.scheduling.ExecTask;
-import eduni.simjava.Sim_system;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPluginMigrate extends BaseLocalSchedulingPlugin {
-
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			ResourceManager resManager, ModuleList modules) {
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		List<Processor> processors = resourceManager.getProcessors();
-		SchedulingPlan plan = new SchedulingPlan();
-//for(Node node: resourceManager.getNodes()){
-//	System.out.println(node.getFullName());
-//}
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		
-		
-		case TIMER:
-
-			System.out.println("##########################" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-			
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-
-			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			// check all tasks in queue
-
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					} 
-				}
-			}
-
-			break;
-		case RESOURCE_TEMPERATURE_LIMIT_EXCEEDED:
-			System.out.println("tuning fans");
-			ComputingResource cr = resourceManager.getResourceByName(event.getSource());
-			double temp = cr.getThermalInterface().getRecentTemperature().getValue();
-			double prevTemp;
-			if(cr.getThermalInterface().getTemperatureHistory().size() == 1)
-				prevTemp = temp;
-			else {
-				prevTemp = cr.getThermalInterface().getTemperatureHistory().get(cr.getThermalInterface().getTemperatureHistory().size() - 2).getValue();
-			}
-
-			System.out.println(prevTemp+  ";  " + temp);
-			boolean getingHotter = prevTemp < temp;
-			Node n = (Node) cr.getParent();
-			for(Device d: n.getParent().getResourceCharacteristic().getDevices()){
-				if(Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1])){
-					Fan f = (Fan) d;
-					int speed;
-					try{
-						speed= Integer.valueOf(f.getAirflowInterface().getAirflowState().getLabel().split("_")[1]).intValue();
-					} catch(Exception e){
-						speed = 0;
-					}
-					if(getingHotter){
-						if(temp > EnvironmentConditions.tempLevelLow2Medium && temp < EnvironmentConditions.tempLevelMedium2High){
-							if(speed < 60){
-								System.out.println("+++++++++ low 2 medium");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-							}
-						} else if (temp > EnvironmentConditions.tempLevelMedium2High && temp < EnvironmentConditions.tempLevelHigh2Max) {
-							if(speed < 80){
-								System.out.println("++++++++medium 2 high");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-							}
-						} else if (temp > EnvironmentConditions.tempLevelHigh2Max) {
-							if(speed < 100){
-								System.out.println("++++++++high 2 max");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_100"));
-							}
-						}					
-					} else {
-						if(temp > EnvironmentConditions.tempLevelHigh2Medium && temp < EnvironmentConditions.tempLevelMax2High){
-							System.out.println("-------- max 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						} else if(temp > EnvironmentConditions.tempLevelMedium2Low && temp < EnvironmentConditions.tempLevelHigh2Medium){
-							System.out.println("-------- high 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-						} else if (temp < EnvironmentConditions.tempLevelMedium2Low) {
-							System.out.println("-------- medium 2 low");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_30"));
-						}
-					}
-				}
-			
-
-				/*AirflowStateName state = f.getAirflowInterface().getAirflowState();
-				try{
-					Integer level = Integer.valueOf(state.getLabel().split("_")[1]);
-					Integer newLevel = level + 10;		
-					if(newLevel <= 100)
-						f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_" + newLevel));			
-				} catch (Exception e){
-					f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_10"));
-				}	*/
-			}
-			//optimizeEnergyUsage(jobRegistry, resourceManager , src);
-			break;
-
-		}	
-
-		return plan;
-	}
-	
-
-	
-	// IRIT
-	private void firstFitConsolidation(JobRegistry jobRegistry, ClusterResourceManager resourceManager, SchedulingEvent event) {
-		Node underLoadedNode = getNodeFromEvent(jobRegistry, (TaskFinishedEvent) event);
-		double remainingLoad = underLoadedNode.getLoadInterface().getRecentUtilization().getValue();
-		if(remainingLoad == 0) { return; }
-
-		PowerUsage pow = underLoadedNode.getPowerInterface().getRecentPowerUsage();
-		System.out.println(" last  : "+pow.getValue());
-		System.out.println(" Estimate  : "+getPowerConsumptionAtLoad(underLoadedNode, remainingLoad));
-	
-		for(Node node: resourceManager.getNodes()) {
-			double destLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			
-			if((node != underLoadedNode) && (destLoad!=0) && (destLoad + remainingLoad <= 100)) {
-				if(destLoad < remainingLoad) {
-					moveAllTask(jobRegistry, node, underLoadedNode);
-				}
-				else {
-					moveAllTask(jobRegistry, underLoadedNode, node);
-				}
-				return;
-			}
-		}
-	}
-	// IRIT
-	private Node getNodeFromEvent(JobRegistry jobRegistry, TaskFinishedEvent event) {
-		ExecTask task = jobRegistry.getTask(event.getJobId(), event.getTaskId());
-		ResourceItem r = task.getAllocatedResources().getLast();
-	    ProcessingElements pe = (ProcessingElements) r.getResourceUnits().get(StandardResourceUnitName.PE);
-	    ComputingResource c = pe.get(0);
-	    return (Node) c.getParent();
-
-	}
-	// IRIT
-	private void moveAllTask(JobRegistry jobRegistry, Node source, Node dest) {
-		double totalLoad = source.getLoadInterface().getRecentUtilization().getValue()+dest.getLoadInterface().getRecentUtilization().getValue();
-		if(totalLoad>100) {return;}
-		
-		JobRegistry srcHostJr = new JobRegistryImpl(source.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		for(int i=runningTasksNumber-1; i>=0; i--) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(dest.getProcessors(), execTask);
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-		}
-	}
-	// IRIT
-	public double getPowerConsumptionAtLoad(Node node, double loadLevel){
-		double powerConsumption = 0;
-		double lowestLoadLevel = 100;
-		double highestLoadLevel = 0;
-
-		System.out.println("ON_" + new Double(loadLevel).intValue());
-		System.out.println(node.getPowerInterface().supportPowerState(new CustomPowerStateName("ON_50")));
-		
-		try{
-			if(node.getPowerInterface().supportPowerState(new CustomPowerStateName("ON_" + new Double(loadLevel).intValue()))){
-				System.out.println("2 ON_" + new Double(loadLevel).intValue());
-
-				powerConsumption = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(loadLevel).intValue()));
-			} else {
-				for(PowerState powerState: node.getPowerInterface().getSupportedPowerStates()){
-					Double load;
-					System.out.println(" getname "+powerState.getName().getLabel());
-					try{
-						load = Double.valueOf(powerState.getName().getLabel().substring(3));
-					}catch (Exception e){
-						continue;
-					}
-					if(lowestLoadLevel > load){
-						lowestLoadLevel = load;
-					}
-					if(highestLoadLevel < load){
-						highestLoadLevel = load;
-					}
-				}
-				if(loadLevel == 0){
-					powerConsumption = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_0"));
-				} else {
-					
-					double lowerLoadLevel = lowestLoadLevel;
-					double higherLoadLevel = highestLoadLevel;
-
-					for(PowerState powerState: node.getPowerInterface().getSupportedPowerStates()){
-						Double load = Double.valueOf(powerState.getName().getLabel().substring(3));
-						if(loadLevel > load){
-							lowerLoadLevel = load;
-						}
-						else if(loadLevel < load){
-							higherLoadLevel = load;
-							break;
-						}
-					}
-					double powerBelow;
-					double powerAbove;
-					double a;
-					double b;
-					if(lowerLoadLevel != higherLoadLevel) {
-						powerBelow = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(lowerLoadLevel).intValue()));
-						powerAbove = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(higherLoadLevel).intValue()));
-						a = (powerAbove - powerBelow)/(higherLoadLevel - lowerLoadLevel);
-						b = powerAbove - a * higherLoadLevel;
-					} else {
-						powerBelow = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(lowestLoadLevel).intValue()));
-						powerAbove = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(highestLoadLevel).intValue()));
-						a = (powerAbove - powerBelow)/(highestLoadLevel - lowestLoadLevel);
-						b = powerAbove - a * highestLoadLevel;
-					}
-					powerConsumption = a * loadLevel + b;
-				}
-			}
-		} catch (Exception e){
-			
-		}
-	
-		return powerConsumption;
-	}
-
-
-
-	private void globalEnergyOptimizer(JobRegistry jobRegistry, ClusterResourceManager resourceManager, String resName) {
-		
-		Node leastLoadedNode = findLeastLoadedResource(resourceManager.getNodes());
-		Node mostLoadedNode = findMostLoadedResource(resourceManager.getNodes());
-		System.out.println("-------------ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLERT");
-		System.out.println("             max : "+mostLoadedNode.getLoadInterface().getRecentUtilization().getValue());
-		System.out.println("             min : "+leastLoadedNode.getLoadInterface().getRecentUtilization().getValue());
-
-		
-		
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue() >= mostLoadedNode.getLoadInterface().getRecentUtilization().getValue()){
-			return;
-		}
-		System.out.println("             ALLLLLLLLLLLLLLLL");
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue()  != 0){
-			return;
-		}
-		System.out.println("                              LLLLLLLLLLLLLLLLLLLLERT");
-
-
-		
-		JobRegistry srcHostJr = new JobRegistryImpl(mostLoadedNode.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		System.out.println("           nbtasks source "+runningTasksNumber);
-		if(runningTasksNumber >= 1) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(0);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			System.out.println("           "+destinationResources.toString());
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-		}
-/*for(int i = srcHostJr.getRunningTasks().size() - 1; i >= 0 && runningTasksNumber > 2; i--) {
-			System.out.println("           Migration");
-
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			System.out.println("           "+destinationResources.toString());
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-			runningTasksNumber--;
-		
-		}
-	*/
-
-		
-	}
-	
-	
-	private void optimizeEnergyUsage(JobRegistry jobRegistry, ClusterResourceManager resourceManager, String resName) {
-		Node overLoadedNode = (Node)resourceManager .getResourceByName(resName);
-		Node leastLoadedNode = findLeastLoadedResource(resourceManager.getNodes());
-		
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue() >= overLoadedNode.getLoadInterface().getRecentUtilization().getValue()){
-			return;
-		}
-
-		JobRegistry srcHostJr = new JobRegistryImpl(overLoadedNode.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		for(int i = srcHostJr.getRunningTasks().size() - 1; i >= 0 && runningTasksNumber > 2; i--) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-			runningTasksNumber--;
-		}
-	}
-
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			List<Processor> processors, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
-
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		if (cpuRequest != 0) {
-
-			if (processors.size() < cpuRequest) {
-				return null;
-			}
-
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
-			for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {
-				if (processors.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(processors.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-
-		return null;
-	}
-
-	private Node findLeastLoadedResource(List<Node> nodes ){
-		Node leastLoadedNoded = null;
-		double minLoad = Double.MAX_VALUE;
-		
-		for(int i = 0; i < nodes.size(); i++){
-			Node node = nodes.get(i);
-			double totalLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			if(totalLoad < minLoad){
-				leastLoadedNoded= node;
-				minLoad = totalLoad;
-			}
-		}
-		return leastLoadedNoded;
-	}
-	private Node findMostLoadedResource(List<Node> nodes ){
-		Node mostLoadedNoded = null;
-		double minLoad = 0;
-		
-		for(int i = 0; i < nodes.size(); i++){
-			Node node = nodes.get(i);
-			double totalLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			if(totalLoad >= minLoad){
-				mostLoadedNoded= node;
-				minLoad = totalLoad;
-			}
-		}
-		return mostLoadedNoded;
-	}
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeGroupEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeGroupEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,37 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class NodeGroupEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		NodeGroup nodeGroup = (NodeGroup)resource;
-		for(Node node: nodeGroup.getNodes()){
-			try{
-				powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue();
-
-			} catch (Exception e){
-			}
-		}
-
-		for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue();
-			}
-		}
-		return powerConsumption;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FanEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,76 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	/*private static int PFanMax = 6;
-	private static int TFanLow = 45;
-	private static int TFanHigh = 47;*/
-
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		Fan fan = (Fan) resource;
-		/*Node node = (Node) fan.getComputingResource();
-		double Tcpu = 0;
-		for(Processor cpu: node.getProcessors()){
-			Tcpu = Tcpu + cpu.getThermalInterface().getRecentTemperature().getValue();
-		}
-		Tcpu = Tcpu/node.getProcessors().size();
-		
-		if (Tcpu < TFanLow) {
-			powerConsumption = 4;
-		} else if (Tcpu > TFanHigh){
-			powerConsumption = PFanMax;
-		}
-		*/
-		
-		try {
-			powerConsumption = fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		
-		double airflow = 0;
-		Fan fan = (Fan) resource;
-		
-		/*double fanEfficiency = 0;
-		try{
-			fanEfficiency = Double.valueOf(fan.getPowerInterface().getParameters().get("fanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-
-		double dp = 1013.25;
-		airflow = fan.getPowerInterface().getRecentPowerUsage().getValue() * fanEfficiency /dp;*/
-
-		try {
-			airflow = fan.getAirflowInterface().getAirflow(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		return airflow;
-	}
-	
-	public double estimateTemperature (ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double temperature = EnvironmentConditions.ROOM_TEMPERATURE;
-		return temperature;
-	}
-	
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeEnergyEstimationPluginPowerCapping.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeEnergyEstimationPluginPowerCapping.java	(revision 1469)
+++ 	(revision )
@@ -1,206 +1,0 @@
-package test.simpat.models.article;
-
-
-import java.util.List;
-
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import gridsim.dcworms.DCWormsTags;
-
-
-public class NodeEnergyEstimationPluginPowerCapping extends BaseEnergyEstimationPlugin {
-
-	//double powerCapLevel = -1;
-	//double powerUpgradeLevel = -1;
-	
-	
-	private static double Tidle = 26;
-
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	private boolean fan = false;
-	
-	private double next_timer = -1;
-
-	private static double Pidle = 15;
-	private static double Pfull = 76;
-
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-
-		//loadThresholds((ComputingResource)resource);
-
-		Node node = (Node) resource;
-		double powerConsumption = 0;
-
-		/*double Pcpu = 0;	
-		for(Processor cpu: node.getProcessors()){
-			Pcpu = Pcpu + cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		}*/
-		
-		//powerConsumption = Pidle + (Pfull- Pidle) * node.getLoadInterface().getRecentUtilization().getValue()/100; 
-		powerConsumption = Pidle + node.getProcessors().get(0).getPowerInterface().getRecentPowerUsage().getValue(); 
-		
-		/*if(powerCapLevel!= -1 && powerConsumption > powerCapLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}
-		else if(powerUpgradeLevel != -1 && powerConsumption < powerUpgradeLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}*/
-		return powerConsumption;
-	}
-
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-
-		Node node = (Node) resource;
-		Processor cpu = node.getProcessors().get(0);
-		double Pserv = 0;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double V = 0;
-		double Pfan = 0;
-		for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				if(Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(node.getName().split("_")[1]) || Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(cpu.getParent().getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-					Fan fan = (Fan) device;
-					V = fan.getAirflowInterface().getRecentAirflow().getValue();
-					Pfan =  fan.getPowerInterface().getRecentPowerUsage().getValue();
-					break;
-				}
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		
-		double K = 0;
-		double Cair = EnvironmentConditions.AIR_HEAT_CAPACITY;
-		double ro = EnvironmentConditions.AIR_DENSITY;
-
-		K = V * Cair * ro;
-		//System.out.println("-------K: " + K +  "; V:" + V);
-
-		double delta_t = Sim_system.clock() - timestamp;
-
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		Pserv = Pserv + Pfan;
-		
-		NodeGroup ng = (NodeGroup) node.getParent();
-		for(Node n: ng.getNodes()){
-			if(Integer.valueOf(n.getName().split("_")[1]) - Integer.valueOf(node.getName().split("_")[1]) == EnvironmentConditions.NODES_IN_A_ROW){
-				Tin = n.getThermalInterface().getRecentTemperature().getValue();
-			}
-		}
-		
-		double targetTemp = Pserv/K + Tin; 
-		objective_temperature = targetTemp;
-
-		new_temperature = objective_temperature + (old_temperature - objective_temperature) * Math.exp(-delta_t / (R * C));
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-
-		return new_temperature;
-	}
-	
-	/*private void loadThresholds(ComputingResource compResource){
-		
-		Node n = (Node) compResource;
-		double pcLevel = 0;
-		double puLevel = 0;
-		for(Processor proc: n.getProcessors()){
-			PState highestPState =  proc.getPowerInterface().getHighestPState();
-			PState secondHighestPState =  proc.getPowerInterface().getLowestPState();
-			for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-				PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-				if(pState.getFrequency()  < secondHighestPState.getFrequency() && pState.getFrequency() > highestPState.getFrequency()){
-					secondHighestPState = pState;
-				}
-			}
-			double maxMinPowerUsage = 0;
-			double powerUsage = 0;
-			
-			for(Double load: highestPState.getLoadPowerUsage().keySet()){
-				powerUsage = highestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			pcLevel = pcLevel + maxMinPowerUsage;
-			
-			maxMinPowerUsage = 0;
-			powerUsage = 0;
-			
-			for(Double load: secondHighestPState.getLoadPowerUsage().keySet()){
-				powerUsage = secondHighestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			puLevel = puLevel + maxMinPowerUsage;
-			
-		}
-
-		puLevel = (pcLevel * pcLevel / puLevel);
-
-		//powerCapLevel = pcLevel;
-		//powerUpgradeLevel = puLevel;
-		
-		powerCapLevel = 60;
-		powerUpgradeLevel = 40;
-	}*/
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FlowPumpInletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FlowPumpInletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,143 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		/*********** Pfans_dc ***********/
-		double powerConsumption = 0;
-		double nf = 0.6;
-		
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			powerConsumption = delta_p * Vair_total / nf;
-		else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Fan)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Fan) &&  Integer.valueOf(device2.getName().split("_")[1]) == Integer.valueOf(device.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				powerConsumption = delta_p * Vair_total / nf;
-		}
-		
-		//System.out.println("Flow Pump power: " + powerConsumption);
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FlowPumpOutletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,82 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Fan)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Fan) || Integer.valueOf(device2.getName().split("_")[1]) == Integer.valueOf(device.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/PowerLeakageEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/PowerLeakageEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,45 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.List;
-
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import gridsim.dcworms.DCWormsTags;
-
-public class PowerLeakageEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	private static double Tidle = 28;
-	private static double Tfull = 60;
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-
-		double powerConsumption = 0;
-		Device pl = (Device) resource;
-		double tempDiff = pl.getComputingResource().getThermalInterface().getRecentTemperature().getValue() - Tidle;
-		double factor = 0.01 * tempDiff;
-		powerConsumption = factor * pl.getComputingResource().getPowerInterface().getRecentPowerUsage().getValue();
-		/*Device pl = (Device) resource;
-		if(pl.getComputingResource().getThermalInterface().getRecentTemperature().getValue() > 90){
-			powerConsumption = powerConsumption + 15;
-		}*/
-		return powerConsumption;
-	}
-
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/CoolingDeviceEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/CoolingDeviceEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,487 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		return airflow;
-	}
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		
-		Device coolingDevice = (Device) resource;
-		ComputingResource room = (ComputingResource) coolingDevice.getComputingResource();
-		
-		double Pload_dc = calculatePit(room);
-		double Pothers = calculatePothers(Pload_dc);
-		double Pfans_dc = calculatePfans(room);
-		
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-		
-		//if data is not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				powerConsumption = Pdry_cooler;
-			else
-				powerConsumption = Pchiller;	
-		}
-		
-		
-		//System.out.println("CoolingDevice heat data: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		
-		//System.out.println("CoolingDevice power: " + powerConsumption);
-		
-		
-		return powerConsumption;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			double QnodeGroup = 0;
-			for(ComputingResource nodeGroup: rack.getChildren()){
-				double Qnodes = 0;
-				for(ComputingResource node: nodeGroup.getChildren()){
-					double Qcpu = 0;
-					Node n = (Node)node;
-					for(Processor proc: n.getProcessors()){
-						Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-					}
-					Qnodes = Qnodes + Qcpu;
-				}
-				double Qfans = 0;
-				for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/DataCenterEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/DataCenterEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,516 +1,0 @@
-package test.simpat.models.article;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class DataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double Pdc;
-		
-		double Pload_dc = 0;
-		double Pothers = 0;
-		double Pfans_dc = 0;
-		double Pcooling_device = 0;
-
-		ComputingResource room = (ComputingResource) resource;
-		
-		/**************** IT PART ****************/
-		
-		/*********** Pload_dc ***********/
-		Pload_dc = calculatePit(room);
-
-		
-		
-		/**************** NON- IT PART ****************/
-		
-		/*********** Pothers ***********/		
-		Pothers = calculatePothers(Pload_dc);
-		
-		
-		
-		/************* COOLING PART *************/
-
-		
-		/*********** Pfans_dc ***********/
-		Pfans_dc = calculatePfans(room);
-		
-		/************ Pcooling_device ************/
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-
-		
-		//if data not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				Pcooling_device = Pdry_cooler;
-			else
-				Pcooling_device = Pchiller;	
-		}
-		
-
-		Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device;
-		//System.out.println("---");
-		//System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller);
-		//System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device);
-		
-		//System.out.println("CB2 heat: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		//System.out.println("CB2 power: " + Pload_dc + "; " + Pothers + "; " + Pfans_dc + "; " + Pcooling_device + "; " + Pdc);
-
-		return Pdc;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			double QnodeGroup = 0;
-			for(ComputingResource nodeGroup: rack.getChildren()){
-				double Qnodes = 0;
-				for(ComputingResource node: nodeGroup.getChildren()){
-					double Qcpu = 0;
-					Node n = (Node)node;
-					for(Processor proc: n.getProcessors()){
-						Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-					}
-					Qnodes = Qnodes + Qcpu;
-				}
-				double Qfans = 0;
-				for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/RackEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/RackEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,60 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.List;
-
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import gridsim.dcworms.DCWormsTags;
-
-public class RackEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-
-		
-		double powerConsumption = 0;
-		Rack rack = (Rack)resource;
-		for(ComputingResource nodeGroup: rack.getChildren()){
-			try{
-				powerConsumption = powerConsumption + nodeGroup.getPowerInterface().getRecentPowerUsage().getValue();
-			} catch (Exception e){
-				
-			}
-		}
-		
-		for(Node node: rack.getNodes()){
-				if(node.getProcessors().get(0).getThermalInterface().getRecentTemperature().getValue() > 90){
-					//powerConsumption = powerConsumption + 15;
-				}
-		}
-		
-		int nrOfPoweredOffNodes = 0;
-		for(Node node: rack.getNodes()){
-			if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-				nrOfPoweredOffNodes++;
-			}
-		}
-		if(nrOfPoweredOffNodes != rack.getNodes().size()){
-			powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;			
-		}
-
-		return powerConsumption;
-	}
-	
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeGroupEnergyEstimationPluginPowerCapping.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeGroupEnergyEstimationPluginPowerCapping.java	(revision 1469)
+++ 	(revision )
@@ -1,104 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class NodeGroupEnergyEstimationPluginPowerCapping extends BaseEnergyEstimationPlugin{
-
-	double powerCapLevel = -1;
-	double powerUpgradeLevel = -1;
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-
-		loadThresholds((ComputingResource)resource);
-		
-		double powerConsumption = 0;
-		NodeGroup nodeGroup = (NodeGroup)resource;
-		for(Node node: nodeGroup.getNodes()){
-			try{
-				powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue();
-				powerConsumption = powerConsumption + node.getProcessors().get(0).getResourceCharacteristic().getDevices().get(0).getPowerInterface().getRecentPowerUsage().getValue();
-
-			} catch (Exception e){
-			}
-		}
-
-		for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue();
-			}
-		}
-		
-		if(powerCapLevel!= -1 && powerConsumption > powerCapLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, resource.getFullName());
-		}
-		else if(powerUpgradeLevel != -1 && powerConsumption < powerUpgradeLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, resource.getFullName());
-		}
-		
-		return powerConsumption;
-	}
-
-	private void loadThresholds(ComputingResource compResource){
-		
-		NodeGroup ng = (NodeGroup) compResource;
-		double pcLevel = 0;
-		double puLevel = 0;
-		for(Processor proc: ng.getProcessors()){
-			PState highestPState =  proc.getPowerInterface().getHighestPState();
-			PState secondHighestPState =  proc.getPowerInterface().getLowestPState();
-			for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-				PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-				if(pState.getFrequency()  < secondHighestPState.getFrequency() && pState.getFrequency() > highestPState.getFrequency()){
-					secondHighestPState = pState;
-				}
-			}
-			double maxMinPowerUsage = 0;
-			double powerUsage = 0;
-			
-			for(Double load: highestPState.getLoadPowerUsage().keySet()){
-				powerUsage = highestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			pcLevel = pcLevel + maxMinPowerUsage;
-			
-			maxMinPowerUsage = 0;
-			powerUsage = 0;
-			
-			for(Double load: secondHighestPState.getLoadPowerUsage().keySet()){
-				powerUsage = secondHighestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			puLevel = puLevel + maxMinPowerUsage;
-			
-		}
-
-		puLevel = (pcLevel * pcLevel / puLevel);
-
-		//powerCapLevel = pcLevel;
-		//powerUpgradeLevel = puLevel;
-		
-		powerCapLevel = EnvironmentConditions.powerCapLevel;
-		powerUpgradeLevel = EnvironmentConditions.powerUpgradeLevel;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,184 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.events.scheduling.TaskFinishedEvent;
-import schedframe.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Core;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.CustomPowerStateName;
-import schedframe.resources.computing.profiles.energy.power.PowerState;
-import schedframe.resources.computing.profiles.energy.power.PowerUsage;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-import schedframe.scheduling.ResourceItem;
-import schedframe.scheduling.manager.resources.ClusterResourceManager;
-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;
-import schedframe.scheduling.plugin.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import dcworms.schedframe.scheduling.ExecTask;
-import eduni.simjava.Sim_system;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPlugin extends BaseLocalSchedulingPlugin {
-
-	private Random rand;
-	
-	public FCFSBF_RandomPlugin() {
-		rand = new Random(5);
-	}
-
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			ResourceManager resManager, ModuleList modules) {
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		List<Node> nodes = resourceManager.getNodes();
-		SchedulingPlan plan = new SchedulingPlan();
-
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		
-		
-		case TIMER:
-
-			System.out.println("##########################" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-			
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			// check all tasks in queue
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(nodes, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					} 
-				}
-			}
-
-			break;
-
-		}	
-		return plan;
-	}
-	
-
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			List<Node> nodes, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
-
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		List<Node> filteredNodes = filterNodes(nodes, cpuRequest);
-		if(filteredNodes.size()==0)
-			return null;
-		Node node = chooseRandomNode(filteredNodes);
-		while(node.getFreeCores().size() < cpuRequest){
-			node = chooseRandomNode(nodes);
-		}
-		
-		if (cpuRequest != 0) {
-
-			if (node.getFreeCores().size() < cpuRequest) {
-				return null;
-			}
-
-			List<Core> cores = node.getCores();
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
-			for (int i = 0; i < cores.size() && cpuRequest > 0; i++) {
-				if (cores.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(cores.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-
-		return null;
-	}
-
-
-	private List<Node> filterNodes(List<Node> nodes, int cpuRequest){
-		List<Node> filteredNodes = new ArrayList<Node>();
-
-		for (Node node : nodes) {
-
-			if (cpuRequest != 0) {
-
-				List<Core> cores = node.getCores();
-				if (cores.size() < cpuRequest) {
-					if(cores.size() == 0){
-						if(node.getProcessors().size() < cpuRequest)
-							continue;
-					}
-				}
-
-				int freeCores = 0;
-				for(Core core: cores){
-					if(core.getStatus() == ResourceStatus.FREE)
-						freeCores++;
-				}
-				
-				if(freeCores < cpuRequest)
-					continue;
-				
-				filteredNodes.add(node);
-			}
-		}
-		
-		return filteredNodes;
-	}
-	
-
-	private Node chooseRandomNode(List<Node> nodes) {
-		int nodeIdx = rand.nextInt(nodes.size());
-		return nodes.get(nodeIdx);
-	}
-
-
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/NodeEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,134 +1,0 @@
-package test.simpat.models.article;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Tidle = 26;
-
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	private boolean fan = false;
-	
-	private double next_timer = -1;
-
-	private static double Pidle = 6;
-	private static double Pfull = 16;
-
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		Node node = (Node) resource;
-		double powerConsumption = 0;
-
-		double Pcpu = 0;	
-		for(Processor cpu: node.getProcessors()){
-			Pcpu = Pcpu + cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		
-		powerConsumption = Pcpu + Pidle + (Pfull- Pidle) * node.getLoadInterface().getRecentUtilization().getValue()/100;
-		//powerConsumption = powerConsumption + node.getProcessors().get(0).getResourceCharacteristic().getDevices().get(0).getPowerInterface().getRecentPowerUsage().getValue();
-		return powerConsumption;
-	}
-
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-
-		Node node = (Node) resource;
-		Processor cpu = node.getProcessors().get(0);
-		double Pserv = 0;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double V = 0;
-		double Pfan = 0;
-		for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				if(Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(node.getName().split("_")[1]) || Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(cpu.getParent().getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-					Fan fan = (Fan) device;
-					V = fan.getAirflowInterface().getRecentAirflow().getValue();
-					Pfan =  fan.getPowerInterface().getRecentPowerUsage().getValue();
-					break;
-				}
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		
-		double K = 0;
-		double Cair = EnvironmentConditions.AIR_HEAT_CAPACITY;
-		double ro = EnvironmentConditions.AIR_DENSITY;
-
-		K = V * Cair * ro;
-		//System.out.println("-------K: " + K +  "; V:" + V);
-
-		double delta_t = Sim_system.clock() - timestamp;
-
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		Pserv = Pserv + Pfan;
-		
-		NodeGroup ng = (NodeGroup) node.getParent();
-		for(Node n: ng.getNodes()){
-			if(Integer.valueOf(n.getName().split("_")[1]) - Integer.valueOf(node.getName().split("_")[1]) == EnvironmentConditions.NODES_IN_A_ROW){
-				Tin = n.getThermalInterface().getRecentTemperature().getValue();
-			}
-		}
-		
-		double targetTemp = Pserv/K + Tin; 
-		objective_temperature = targetTemp;
-
-		new_temperature = objective_temperature + (old_temperature - objective_temperature) * Math.exp(-delta_t / (R * C));
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/CpuEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/CpuEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,291 +1,0 @@
-package test.simpat.models.article;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class CpuEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Pidle = 4;
-	private static double Pfull = 26;
-
-	private static int Tidle = 33;
-	
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	
-	private boolean fan = false;
-	
-	private double next_timer = -1;    
-	
-	private int cpu_temp_monitor = 0;
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		/*double powerConsumption = 0;
-
-		Processor cpu = (Processor)resource;
-		powerConsumption = Pidle + (Pfull- Pidle) * cpu.getLoadInterface().getRecentUtilization().getValue()/100;			
-
-		return powerConsumption;*/
-		
-		double processorLoad = 0;
-		double powerConsumption = 0;
-		Processor proc = (Processor)resource;
-		if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF))
-			return 0;
-		else {
-			
-			processorLoad = proc.getLoadInterface().getRecentUtilization().getValue();
-			double lowestLoadLevel = 100;
-			double highestLoadLevel = 0;
-			if(proc.getPowerInterface().getPState().getLoadPowerUsage().containsKey(new Double(processorLoad))){
-				powerConsumption = proc.getPowerInterface().getPState().getLoadPowerUsage().get(new Double(processorLoad));
-				//System.out.println("power from profile: " + powerConsumption);
-			} else {
-				for(Double load: proc.getPowerInterface().getPState().getLoadPowerUsage().keySet()){
-					if(lowestLoadLevel > load){
-						lowestLoadLevel = load;
-					}
-					if(highestLoadLevel < load){
-						highestLoadLevel = load;
-					}
-				}
-				if(processorLoad == 0){
-					try{
-						powerConsumption = proc.getPowerInterface().getSupportedPowerStates().get(0).getPowerUsage();
-						//System.out.println("load = 0; power = idle power usage: " + powerConsumption);
-					} catch (Exception e){
-						powerConsumption = 0.7 * proc.getPowerInterface().getPState().getLoadPowerUsage().get(new Double(highestLoadLevel));
-						//System.out.println("error load = 0; power = 0.7 max power: " + powerConsumption);
-					}
-				} else {
-					
-					double lowerLoadLevel = lowestLoadLevel;
-					double higherLoadLevel = highestLoadLevel;
-					
-					try{
-					
-						for(Double load: proc.getPowerInterface().getPState().getLoadPowerUsage().keySet()){
-							if(processorLoad > load){
-								lowerLoadLevel = load;
-							}
-							else if(processorLoad < load){
-								higherLoadLevel = load;
-								break;
-							}
-						}
-						double powerBelow;
-						double powerAbove;
-						double a;
-						double b;
-						if(lowerLoadLevel != higherLoadLevel) {
-							powerBelow = proc.getPowerInterface().getPState().getLoadPowerUsage().get(lowerLoadLevel);
-							powerAbove = proc.getPowerInterface().getPState().getLoadPowerUsage().get(higherLoadLevel);
-							a = (powerAbove - powerBelow)/(higherLoadLevel - lowerLoadLevel);
-							b = powerAbove - a * higherLoadLevel;
-						} else {
-							powerBelow = proc.getPowerInterface().getPState().getLoadPowerUsage().get(lowestLoadLevel);
-							powerAbove = proc.getPowerInterface().getPState().getLoadPowerUsage().get(highestLoadLevel);
-							a = (powerAbove - powerBelow)/(highestLoadLevel - lowestLoadLevel);
-							b = powerAbove - a * highestLoadLevel;
-						}
-						powerConsumption = a * processorLoad + b;
-						/*System.out.println("a" +lowestLoadLevel + ";" +highestLoadLevel);
-						System.out.println("b" +lowerLoadLevel + ";" +higherLoadLevel);
-						System.out.println("c" +powerBelow + ";" +powerAbove);
-						System.out.println(resource.getFullName() + "load: " + processorLoad + "linear power estimation " + powerConsumption);*/
-	
-					} catch (Exception e){
-						powerConsumption = 0.7 * proc.getPowerInterface().getPState().getLoadPowerUsage().get(new Double(highestLoadLevel));	
-						//System.out.println("error; power = 0.7 max power: " + powerConsumption);
-					}
-				}
-			}
-		}
-		//System.out.println("estimated power consumption: " + powerConsumption);
-		return powerConsumption;
-	}
-	
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double future = -1;
-
-		Processor cpu = (Processor) resource;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-		double V = 0;
-	
-		for(Device device: cpu.getParent().getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				if(Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(cpu.getParent().getName().split("_")[1]) /*|| Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(cpu.getParent().getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW*/){
-					Fan fan = (Fan) device;
-					V = fan.getAirflowInterface().getRecentAirflow().getValue();
-					break;
-				}
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		// 1) look where we are
-		double delta_t = Sim_system.clock() - timestamp;
-		/***************model1*************/
-		//new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/sink);
-		
-		/***************model2*************/
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		 
-
-		// 2) calculate if fan is needed ?
-		if(new_temperature <= EnvironmentConditions.TFanLow) {
-			fan = false;
-		}
-		if(new_temperature >= EnvironmentConditions.TFanHigh) {
-			fan = true; 
-		}
-		
-		// 3) compute new objective
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		double Pcpu = cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		//new_temperature = (Pcpu * R + Tin) - (Pcpu * R + Tin - Tidle) * Math.exp(-Sim_system.clock()/(R * C));;
-		
-		
-		NodeGroup ng = (NodeGroup) cpu.getParent().getParent();
-		for(Node n: ng.getNodes()){
-			if(Integer.valueOf(n.getName().split("_")[1]) - Integer.valueOf(cpu.getParent().getName().split("_")[1]) == EnvironmentConditions.NODES_IN_A_ROW){
-				Tin = n.getThermalInterface().getRecentTemperature().getValue();
-
-			}
-		}
-		Tin = (2 * Tin + cpu.getThermalInterface().getRecentTemperature().getValue())/3;
-		/***************model1 - GEO1*************/
-		//double cpuLoad = cpu.getLoadInterface().getRecentUtilization().getValue();
-		//double targetTemp = Tidle + cpuLoad/100 * dTfull;
-		//if(fan) {
-		//	targetTemp = targetTemp - dTfan;
-		//}
-		
-		
-		/***************model2 - GEO2*************/
-		//Node node = (Node) cpu.getParent();
-		//Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		//double targetTemp = Pcpu * R + Tin; 
-		
-		/***************model3 - GEO1 + GEO2*************/
-		/*double targetTemp = Pcpu * R + Tin; 
-		if(fan) {
-			targetTemp = targetTemp - dTfan;
-		}*/
-	
-		/***************model4 - WP*************/
-		double targetTemp = Pcpu * R + Tin; 
-		//System.out.println("----------" + targetTemp +  ": " +  Pcpu +  ": " +  R +  ": " +  Tin);
-		// 4) check if we will need to tune fans
-		if(fan && targetTemp < EnvironmentConditions.TFanLow) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanLow));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-		if(!fan && targetTemp > EnvironmentConditions.TFanHigh) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanHigh));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-		objective_temperature = targetTemp;
-
-
-		if((future >= 0) && ((next_timer < Sim_system.clock()) || (next_timer >= future + Sim_system.clock()))) {
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(future, DCWormsTags.FANMGT, "Test");
-			next_timer = future + Sim_system.clock() - 0.01;
-		}		
-		
-		if(new_temperature < EnvironmentConditions.tempLevelMedium2Low){
-			if(cpu_temp_monitor != 1){
-				cpu_temp_monitor = 1;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelMedium2Low && new_temperature < EnvironmentConditions.tempLevelLow2Medium){
-			if(cpu_temp_monitor != 2){
-				cpu_temp_monitor = 2;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelLow2Medium && new_temperature < EnvironmentConditions.tempLevelHigh2Medium){
-			if(cpu_temp_monitor != 3){
-				cpu_temp_monitor = 3;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelHigh2Medium && new_temperature < EnvironmentConditions.tempLevelMedium2High){
-			if(cpu_temp_monitor != 4){
-				cpu_temp_monitor = 4;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelMedium2High && new_temperature < EnvironmentConditions.tempLevelMax2High){
-			if(cpu_temp_monitor != 5){
-				cpu_temp_monitor = 5;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelMax2High && new_temperature < EnvironmentConditions.tempLevelHigh2Max){
-			if(cpu_temp_monitor != 6){
-				cpu_temp_monitor = 6;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelHigh2Max){
-			if(cpu_temp_monitor != 7){
-				cpu_temp_monitor = 7;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		}
-		//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginMigrate.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginMigrate.java	(revision 1469)
+++ 	(revision )
@@ -1,287 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.events.scheduling.TaskFinishedEvent;
-import schedframe.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Core;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.CustomPowerStateName;
-import schedframe.resources.computing.profiles.energy.power.PowerState;
-import schedframe.resources.computing.profiles.energy.power.PowerUsage;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-import schedframe.scheduling.ResourceItem;
-import schedframe.scheduling.manager.resources.ClusterResourceManager;
-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;
-import schedframe.scheduling.plugin.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import dcworms.schedframe.scheduling.ExecTask;
-import eduni.simjava.Sim_system;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPluginMigrate extends BaseLocalSchedulingPlugin {
-
-
-	private Random rand;
-	
-	public FCFSBF_RandomPluginMigrate() {
-		rand = new Random(5);
-	}
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			ResourceManager resManager, ModuleList modules) {
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		List<Node> nodes = resourceManager.getNodes();
-		SchedulingPlan plan = new SchedulingPlan();
-//for(Node node: resourceManager.getNodes()){
-//	System.out.println(node.getFullName());
-//}
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		
-		
-		case TIMER:
-
-			System.out.println("##" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-			
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-
-			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			// check all tasks in queue
-
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(nodes, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					} 
-				}
-			}
-
-			break;
-		case RESOURCE_TEMPERATURE_LIMIT_EXCEEDED:
-			manageFans(resourceManager.getResourceByName(event.getSource()));
-			Node n = resourceManager.getNodes().get(0);
-			double min_temp = -1;
-			List<Node> availableNodes = filterNodes(resourceManager.getNodes(), 8);
-			for(Node node: availableNodes) {
-				if(min_temp == -1 || min_temp > node.getProcessors().get(0).getThermalInterface().getRecentTemperature().getValue()){
-					min_temp = node.getProcessors().get(0).getThermalInterface().getRecentTemperature().getValue();
-					n = node;
-					
-				}
-			}
-
-			for(Node node: resourceManager.getNodes()) {
-				if(node.getProcessors().get(0).getThermalInterface().getRecentTemperature().getValue() > 46 && node != n) {
-					System.out.println("   ----------------------- OVERHEAT !");
-					moveAllTask(jobRegistry, node, n);
-					break;
-				}
-			}		
-			//optimizeEnergyUsage(jobRegistry, resourceManager , src);
-			break;
-
-		}	
-
-		return plan;
-	}
-	
-	private void manageFans(ComputingResource cr ){
-		//System.out.println("tuning fans");
-		double temp = cr.getThermalInterface().getRecentTemperature().getValue();
-		double prevTemp;
-		if(cr.getThermalInterface().getTemperatureHistory().size() == 1)
-			prevTemp = temp;
-		else {
-			prevTemp = cr.getThermalInterface().getTemperatureHistory().get(cr.getThermalInterface().getTemperatureHistory().size() - 2).getValue();
-		}
-
-		//System.out.println(prevTemp+  ";  " + temp);
-		boolean getingHotter = prevTemp < temp;
-		boolean getingColder = prevTemp > temp;
-		Node n = (Node) cr.getParent();
-		for(Device d: n.getParent().getResourceCharacteristic().getDevices()){
-			//System.out.println(d.getName() + "; " + n.getName());
-			if(Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) || Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-				Fan f = (Fan) d;
-				int speed;
-				try{
-					speed= Integer.valueOf(f.getAirflowInterface().getAirflowState().getLabel().split("_")[1]).intValue();
-				} catch(Exception e){
-					speed = 0;
-				}
-				if(getingHotter){
-					if(temp > EnvironmentConditions.tempLevelLow2Medium && temp < EnvironmentConditions.tempLevelMedium2High){
-						if(speed < 60){
-							//System.out.println("+++++++++ low 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelMedium2High && temp < EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 80){
-							//System.out.println("++++++++medium 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 100){
-							//System.out.println("++++++++high 2 max");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_100"));
-						}
-					}					
-				} else if (getingColder){
-					if(temp > EnvironmentConditions.tempLevelHigh2Medium && temp < EnvironmentConditions.tempLevelMax2High){
-						if(speed == 100){
-							//System.out.println("-------- max 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if(temp > EnvironmentConditions.tempLevelMedium2Low && temp < EnvironmentConditions.tempLevelHigh2Medium){
-						if(speed >= 80){
-							//System.out.println("-------- high 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));		
-						}
-					} else if (temp < EnvironmentConditions.tempLevelMedium2Low) {
-						if(speed >= 60){
-							//System.out.println("-------- medium 2 low");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_30"));	
-						}
-					}
-				}
-			}
-		}
-	}
-
-	private void moveAllTask(JobRegistry jobRegistry, Node source, Node dest) {
-		double totalLoad = source.getLoadInterface().getRecentUtilization().getValue()+dest.getLoadInterface().getRecentUtilization().getValue();
-		if(totalLoad>100) {return;}
-		
-		JobRegistry srcHostJr = new JobRegistryImpl(source.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		for(int i=runningTasksNumber-1; i>=0; i--) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			List<Node> nodes = new ArrayList<Node>();
-			nodes.add(dest);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(nodes, execTask);
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-		}
-	}
-
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			List<Node> nodes, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
-
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		List<Node> filteredNodes = filterNodes(nodes, cpuRequest);
-		if(filteredNodes.size()==0)
-			return null;
-		Node node = chooseRandomNode(filteredNodes);
-		while(node.getFreeCores().size() < cpuRequest){
-			node = chooseRandomNode(nodes);
-		}
-		
-		if (cpuRequest != 0) {
-
-			if (node.getFreeCores().size() < cpuRequest) {
-				return null;
-			}
-
-			List<Processor>  processors = node.getProcessors();
-			List<Core> cores = node.getCores();
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
-			for (int i = 0; i < cores.size() && cpuRequest > 0; i++) {
-				if (cores.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(cores.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-
-		return null;
-	}
-
-	
-	private List<Node> filterNodes(List<Node> nodes, int cpuRequest){
-		List<Node> filteredNodes = new ArrayList<Node>();
-
-		for (Node node : nodes) {
-
-			if (cpuRequest != 0) {
-
-				List<Core> cores = node.getCores();
-				if (cores.size() < cpuRequest) {
-					if(cores.size() == 0){
-						if(node.getProcessors().size() < cpuRequest)
-							continue;
-					}
-				}
-
-				int freeCores = 0;
-				for(Core core: cores){
-					if(core.getStatus() == ResourceStatus.FREE)
-						freeCores++;
-				}
-				
-				if(freeCores < cpuRequest)
-					continue;
-				
-				filteredNodes.add(node);
-			}
-		}
-		
-		return filteredNodes;
-	}
-	
-
-	private Node chooseRandomNode(List<Node> nodes) {
-		int nodeIdx = rand.nextInt(nodes.size());
-		return nodes.get(nodeIdx);
-	}
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginFansMng.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginFansMng.java	(revision 1469)
+++ 	(revision )
@@ -1,253 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Core;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-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.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPluginFansMng extends BaseLocalSchedulingPlugin {
-
-
-	private Random rand;
-	
-	public FCFSBF_RandomPluginFansMng() {
-		rand = new Random(5);
-	}
-
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			ResourceManager resManager, ModuleList modules) {
-
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		List<Node> nodes = resourceManager.getNodes();
-		SchedulingPlan plan = new SchedulingPlan();
-
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		
-		
-		case TIMER:
-
-			System.out.println("##" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-			
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-
-			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			// check all tasks in queue
-
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(nodes, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					} 
-				}
-			}
-
-			break;
-		case RESOURCE_TEMPERATURE_LIMIT_EXCEEDED:
-			manageFans(resourceManager.getResourceByName(event.getSource()));
-			break;
-
-		}	
-
-		return plan;
-	}
-	
-	private void manageFans(ComputingResource cr ){
-		//System.out.println("tuning fans");
-		double temp = cr.getThermalInterface().getRecentTemperature().getValue();
-		double prevTemp;
-		if(cr.getThermalInterface().getTemperatureHistory().size() == 1)
-			prevTemp = temp;
-		else {
-			prevTemp = cr.getThermalInterface().getTemperatureHistory().get(cr.getThermalInterface().getTemperatureHistory().size() - 2).getValue();
-		}
-
-		//System.out.println(prevTemp+  ";  " + temp);
-		boolean getingHotter = prevTemp < temp;
-		boolean getingColder = prevTemp > temp;
-		Node n = (Node) cr.getParent();
-		for(Device d: n.getParent().getResourceCharacteristic().getDevices()){
-			//System.out.println(d.getName() + "; " + n.getName());
-			if(Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) || Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-				Fan f = (Fan) d;
-				int speed;
-				try{
-					speed= Integer.valueOf(f.getAirflowInterface().getAirflowState().getLabel().split("_")[1]).intValue();
-				} catch(Exception e){
-					speed = 0;
-				}
-				//System.out.println("getingHotter: "+ (prevTemp < temp));
-				if(getingHotter){
-					if(temp > EnvironmentConditions.tempLevelLow2Medium && temp < EnvironmentConditions.tempLevelMedium2High){
-						if(speed < 60){
-							//System.out.println("+++++++++ low 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelMedium2High && temp < EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 80){
-							//System.out.println("++++++++medium 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 100){
-							//System.out.println("++++++++high 2 max");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_100"));
-						}
-					}					
-				} else if (getingColder){
-					if(temp > EnvironmentConditions.tempLevelHigh2Medium && temp < EnvironmentConditions.tempLevelMax2High){
-						if(speed == 100){
-							//System.out.println("-------- max 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if(temp > EnvironmentConditions.tempLevelMedium2Low && temp < EnvironmentConditions.tempLevelHigh2Medium){
-						if(speed >= 80){
-							//System.out.println("-------- high 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));		
-						}
-					} else if (temp < EnvironmentConditions.tempLevelMedium2Low) {
-						if(speed >= 60){
-							//System.out.println("-------- medium 2 low");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_30"));	
-						}
-					}
-				}
-			}
-		}
-	}
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			List<Node> nodes, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
-
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		List<Node> filteredNodes = filterNodes(nodes, task);
-		if(filteredNodes.size()==0)
-			return null;
-		Node node = chooseRandomNode(filteredNodes);
-		while(node.getFreeCores().size() < cpuRequest){
-			node = chooseRandomNode(nodes);
-		}
-		
-		if (cpuRequest != 0) {
-
-			if (node.getFreeCores().size() < cpuRequest) {
-				return null;
-			}
-
-			List<Processor>  processors = node.getProcessors();
-			List<Core> cores = node.getCores();
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
-			for (int i = 0; i < cores.size() && cpuRequest > 0; i++) {
-				if (cores.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(cores.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-
-		return null;
-	}
-
-	
-	private List<Node> filterNodes(List<Node> nodes, TaskInterface<?> task){
-		List<Node> filteredNodes = new ArrayList<Node>();
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-		for (Node node : nodes) {
-
-			if (cpuRequest != 0) {
-
-				List<Core> cores = node.getCores();
-				if (cores.size() < cpuRequest) {
-					if(cores.size() == 0){
-						if(node.getProcessors().size() < cpuRequest)
-							continue;
-					}
-				}
-
-				int freeCores = 0;
-				for(Core core: cores){
-					if(core.getStatus() == ResourceStatus.FREE)
-						freeCores++;
-				}
-				
-				if(freeCores < cpuRequest)
-					continue;
-				
-				filteredNodes.add(node);
-			}
-		}
-		
-		return filteredNodes;
-	}
-	
-
-	private Node chooseRandomNode(List<Node> nodes) {
-		int nodeIdx = rand.nextInt(nodes.size());
-		return nodes.get(nodeIdx);
-	}
-
-
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginPowerCapping.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/article/FCFSBF_RandomPluginPowerCapping.java	(revision 1469)
+++ 	(revision )
@@ -1,505 +1,0 @@
-package test.simpat.models.article;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Core;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-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.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.Node_Fan_Mapping;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPluginPowerCapping extends BaseLocalSchedulingPlugin {
-
-	private Random rand;
-	
-	private Map<String, Double> powerCapsLevels;
-	private Map<String, Double> powerUpgradesLevels;
-	private Map<String, Double> currentFrequencyLevels;
-	
-	public FCFSBF_RandomPluginPowerCapping () {
-		rand = new Random(5);
-		currentFrequencyLevels = new HashMap<String, Double>();
-		powerCapsLevels  = new HashMap<String, Double>();
-		powerUpgradesLevels  = new HashMap<String, Double>();
-	}
-
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			 ResourceManager resManager, ModuleList modules) {
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		SchedulingPlan plan = new SchedulingPlan();
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		case TIMER:
-
-			System.out.println("##" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-		//case TIMER:
-			// our tasks are placed only in first queue (see
-			// BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			
-			// check all tasks in queue
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-
-					if(resourceManager.getResourcesByTypeWithStatus(StandardResourceType.Core, ResourceStatus.FREE).size() == 0)
-						break;
-
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(resourceManager, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					}
-				}
-			}
-			break;
-		case RESOURCE_POWER_LIMIT_EXCEEDED:
-			powerCap(resManager, event.getSource().toString());
-			break;
-		case RESOURCE_TEMPERATURE_LIMIT_EXCEEDED:
-			manageFans(resourceManager.getResourceByName(event.getSource()));
-			break;
-
-		}
-		
-		return plan;
-	}
-
-	private void manageFans(ComputingResource cr ){
-		//System.out.println("tuning fans");
-		double temp = cr.getThermalInterface().getRecentTemperature().getValue();
-		double prevTemp;
-		if(cr.getThermalInterface().getTemperatureHistory().size() == 1)
-			prevTemp = temp;
-		else {
-			prevTemp = cr.getThermalInterface().getTemperatureHistory().get(cr.getThermalInterface().getTemperatureHistory().size() - 2).getValue();
-		}
-
-		//System.out.println(prevTemp+  ";  " + temp);
-		boolean getingHotter = prevTemp < temp;
-		boolean getingColder = prevTemp > temp;
-		Node n = (Node) cr.getParent();
-		for(Device d: n.getParent().getResourceCharacteristic().getDevices()){
-			//System.out.println(d.getName() + "; " + n.getName());
-			if(Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) || Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1]) - EnvironmentConditions.NODES_IN_A_ROW){
-				Fan f = (Fan) d;
-				int speed;
-				try{
-					speed= Integer.valueOf(f.getAirflowInterface().getAirflowState().getLabel().split("_")[1]).intValue();
-				} catch(Exception e){
-					speed = 0;
-				}
-				if(getingHotter){
-					if(temp > EnvironmentConditions.tempLevelLow2Medium && temp < EnvironmentConditions.tempLevelMedium2High){
-						if(speed < 60){
-							//System.out.println("+++++++++ low 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelMedium2High && temp < EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 80){
-							//System.out.println("++++++++medium 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if (temp > EnvironmentConditions.tempLevelHigh2Max) {
-						if(speed < 100){
-							//System.out.println("++++++++high 2 max");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_100"));
-						}
-					}					
-				} else if (getingColder){
-					if(temp > EnvironmentConditions.tempLevelHigh2Medium && temp < EnvironmentConditions.tempLevelMax2High){
-						if(speed == 100){
-							//System.out.println("-------- max 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						}
-					} else if(temp > EnvironmentConditions.tempLevelMedium2Low && temp < EnvironmentConditions.tempLevelHigh2Medium){
-						if(speed >= 80){
-							//System.out.println("-------- high 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));		
-						}
-					} else if (temp < EnvironmentConditions.tempLevelMedium2Low) {
-						if(speed >= 60){
-							//System.out.println("-------- medium 2 low");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_30"));	
-						}
-					}
-				}
-			}
-		}
-	}
-	
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			ClusterResourceManager resourceManager, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>();
-		
-		List<Node> nodes = resourceManager.getNodes();
-		List<Node> avNodes = filterNodes(nodes, task);
-		if(avNodes.size() == 0)
-			return null;
-		Node node = randomNode(avNodes);
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		if (cpuRequest != 0) {
-
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>();	
-			List<Core> cores = node.getCores();			
-			for (int i = 0; i < cores.size() && cpuRequest > 0; i++) {
-				if (cores.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(cores.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			//choosenResources.add(node.getProcessors().get(0));
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-		return null;
-	}
-	
-	private List<Node> filterNodes(List<Node> nodes, TaskInterface<?> task){
-		List<Node> filteredNodes = new ArrayList<Node>();
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-		for (Node node : nodes) {
-
-			if (cpuRequest != 0) {
-
-				List<Core> cores = node.getCores();
-				if (cores.size() < cpuRequest) {
-					if(cores.size() == 0){
-						if(node.getProcessors().size() < cpuRequest)
-							continue;
-					}
-				}
-
-				int freeCores = 0;
-				for(Core core: cores){
-					if(core.getStatus() == ResourceStatus.FREE)
-						freeCores++;
-				}
-				
-				if(freeCores < cpuRequest)
-					continue;
-				
-				filteredNodes.add(node);
-			}
-		}
-		
-		return filteredNodes;
-	}
-	
-	private Node randomNode(List<Node> nodes){
-		return nodes.get(rand.nextInt(nodes.size()));
-	}
-	
-	private void powerCap(ResourceManager resManager, String resName){
-		ComputingResource compRes = resManager.getResourceByName(resName);
-		//for(ComputingResource compRes: resManager.getResourcesOfType(CoolEmAllResourceType.NodeGroup)){
-			if(!powerCapsLevels.containsKey(compRes.getFullName()) || !powerUpgradesLevels.containsKey(compRes.getFullName())){
-				loadThresholds(compRes);
-			}
-			double powerConsumption = compRes.getPowerInterface().getRecentPowerUsage().getValue();
-			//System.out.println(compRes.getFullName() + " current: " + powerConsumption);
-			if(powerConsumption > powerCapsLevels.get(compRes.getFullName())){
-				NodeGroup nodeGroup = (NodeGroup) compRes;
-				List<Processor> processors = nodeGroup.getProcessors();
-				
-				double currentFrequencyLevel = 0;
-				if(currentFrequencyLevels.get(compRes.getFullName()) != null){
-					currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-				} else {
-					currentFrequencyLevel = processors.get(0).getPowerInterface().getLowestPState().getFrequency();
-				}
-				boolean overThreshold = true;
-				boolean canDoBetter = true;
-
-				while(overThreshold && canDoBetter){
-					//System.out.println(compRes.getFullName() + " - downgrading");
-					int procNumberWithoutChange = 0;
-					boolean improvement = false;
-					//System.out.println(compRes.getFullName() + "; currentFrequencyLevel: " + currentFrequencyLevel);
-					for (Processor proc: processors){
-						PState currPState = proc.getPowerInterface().getPState();
-						//System.out.println(proc.getFullName() + " - checking");
-						if(currPState.getFrequency() <= currentFrequencyLevel && proc.getFreeCores().size() != proc.getCores().size()){
-							//System.out.println("operating same level");
-							procNumberWithoutChange++;
-							continue;
-						} 
-						if (proc.getFreeCores().size() == proc.getCores().size()){	
-							//System.out.println("free");
-							procNumberWithoutChange++;
-							continue;
-						} 
-		
-						double lowerFrequency = proc.getPowerInterface().getHighestPState().getFrequency();
-						for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-							PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-							if(pState.getFrequency() > lowerFrequency && pState.getFrequency() < currPState.getFrequency()){
-								lowerFrequency = pState.getFrequency();
-							}
-						}
-						//System.out.println(proc.getFullName() + "; lower frequency: " + lowerFrequency);
-						if(lowerFrequency < currentFrequencyLevel){
-							//System.out.println(compRes.getFullName() + " - changing current frequency level");
-							currentFrequencyLevels.put(compRes.getFullName(), lowerFrequency);
-							currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-						}
-						
-						if(lowerFrequency != currPState.getFrequency()) {
-							//System.out.println(proc.getFullName() + " - lowering frequency");
-							proc.getPowerInterface().setFrequency(lowerFrequency);
-							Node n = proc.getNode();
-							for(Device device: n.getParent().getResourceCharacteristic().getDevices()){
-								
-								if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){
-									Fan fan = (Fan) device;
-
-									if(fan.getChilledResources().contains(n.getFullName())){
-										fan.getAirflowInterface().setAirflowState(new CustomAirflowStateName("2"));
-									}
-								}
-							}
-							improvement = true;
-						}
-						if(lowerFrequency == proc.getPowerInterface().getHighestPState().getFrequency()){
-							canDoBetter = false;
-						} else {
-							canDoBetter = true;
-						}
-						if(compRes.getPowerInterface().getRecentPowerUsage().getValue() <= powerCapsLevels.get(compRes.getFullName())){
-							overThreshold = false;
-							break;
-						}
-					}	
-					if(procNumberWithoutChange == processors.size() || improvement == false){
-						//System.out.println(compRes.getFullName() + " - failed to improve");
-						double nextFrequencyLevel = processors.get(0).getPowerInterface().getHighestPState().getFrequency();
-						for (Processor proc: processors){
-							for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-								PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-								if(pState.getFrequency() > nextFrequencyLevel && pState.getFrequency() < currentFrequencyLevel){
-									nextFrequencyLevel = pState.getFrequency();
-								} 
-							}
-						}
-						//System.out.println(compRes.getFullName() + "; nextFrequencyLevel: " + nextFrequencyLevel);
-						currentFrequencyLevels.put(compRes.getFullName(), nextFrequencyLevel);
-						currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-						if(currentFrequencyLevel == processors.get(0).getPowerInterface().getHighestPState().getFrequency()){
-							canDoBetter = false;
-						}
-						procNumberWithoutChange = 0;
-					}
-				}
-
-			} else if (powerConsumption < powerUpgradesLevels.get(compRes.getFullName())) {
-				NodeGroup nodeGroup = (NodeGroup) compRes;
-				List<Processor> processors = nodeGroup.getProcessors();
-				
-				double currentFrequencyLevel = 0;
-				if(currentFrequencyLevels.get(compRes.getFullName()) != null){
-					currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-				} else {
-					currentFrequencyLevel = processors.get(0).getPowerInterface().getLowestPState().getFrequency();
-				}
-				boolean overThreshold = true;
-				boolean canDoBetter = true;
-
-				while(overThreshold && canDoBetter){
-					//System.out.println(compRes.getFullName() + " - downgrading");
-					int procNumberWithoutChange = 0;
-					boolean improvement = false;
-					//System.out.println(compRes.getFullName() + "; currentFrequencyLevel: " + currentFrequencyLevel);
-					for (Processor proc: processors){
-						PState currPState = proc.getPowerInterface().getPState();
-						//System.out.println(proc.getFullName() + " - checking");
-						if(currPState.getFrequency() >= currentFrequencyLevel && proc.getFreeCores().size() != proc.getCores().size()){
-							//System.out.println("operating same level");
-							procNumberWithoutChange++;
-							continue;
-						} 
-						if (proc.getFreeCores().size() == proc.getCores().size()){	
-							//System.out.println("free");
-							procNumberWithoutChange++;
-							continue;
-						} 
-		
-						double higherFrequency = proc.getPowerInterface().getLowestPState().getFrequency();
-						for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-							PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-							if(pState.getFrequency() < higherFrequency && pState.getFrequency() > currPState.getFrequency()){
-								higherFrequency = pState.getFrequency();
-							}
-						}
-						//System.out.println(proc.getFullName() + "; lower frequency: " + lowerFrequency);
-						if(higherFrequency > currentFrequencyLevel){
-							//System.out.println(compRes.getFullName() + " - changing current frequency level");
-							currentFrequencyLevels.put(compRes.getFullName(), higherFrequency);
-							currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-						}
-						
-						if(higherFrequency != currPState.getFrequency()) {
-							//System.out.println(proc.getFullName() + " - lowering frequency");
-							proc.getPowerInterface().setFrequency(higherFrequency);
-							Node n = proc.getNode();
-							for(Device device: n.getParent().getResourceCharacteristic().getDevices()){
-								
-								if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){
-									Fan fan = (Fan) device;
-
-									if(fan.getChilledResources().contains(n.getFullName())){
-										fan.getAirflowInterface().setAirflowState(new CustomAirflowStateName("2"));
-									}
-								}
-							}
-							improvement = true;
-						}
-						if(higherFrequency == proc.getPowerInterface().getLowestPState().getFrequency()){
-							canDoBetter = false;
-						} else {
-							canDoBetter = true;
-						}
-						if(compRes.getPowerInterface().getRecentPowerUsage().getValue() >= powerCapsLevels.get(compRes.getFullName())){
-							overThreshold = false;
-							break;
-						}
-					}
-					if(procNumberWithoutChange == processors.size() || improvement == false){
-						//System.out.println(compRes.getFullName() + " - failed to improve");
-						double nextFrequencyLevel = processors.get(0).getPowerInterface().getLowestPState().getFrequency();
-						for (Processor proc: processors){
-							for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-								PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-								if(pState.getFrequency() < nextFrequencyLevel && pState.getFrequency() > currentFrequencyLevel){
-									nextFrequencyLevel = pState.getFrequency();
-								} 
-							}
-						}
-						//System.out.println(compRes.getFullName() + "; nextFrequencyLevel: " + nextFrequencyLevel);
-						currentFrequencyLevels.put(compRes.getFullName(), nextFrequencyLevel);
-						currentFrequencyLevel = currentFrequencyLevels.get(compRes.getFullName());
-						if(currentFrequencyLevel == processors.get(0).getPowerInterface().getLowestPState().getFrequency()){
-							canDoBetter = false;
-						}
-						procNumberWithoutChange = 0;
-					}
-				}
-
-			}
-		//}
-			//if(Sim_system.clock() > 1000 && Sim_system.clock() < 1100 || Sim_system.clock() > 3400)
-			//System.out.println(currentFrequencyLevels);
-
-	}
-	
-	private void loadThresholds(ComputingResource compResource){
-		
-		double pcLevel = 0;
-		double puLevel = 0;
-		
-		/*NodeGroup ng = (NodeGroup) compResource;
-		for(Processor proc: ng.getProcessors()){
-			PState highestPState =  proc.getPowerInterface().getHighestPState();
-			PState secondHighestPState =  proc.getPowerInterface().getLowestPState();
-			for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-				PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-				if(pState.getFrequency()  < secondHighestPState.getFrequency() && pState.getFrequency() > highestPState.getFrequency()){
-					secondHighestPState = pState;
-				}
-			}
-			double maxMinPowerUsage = 0;
-			double powerUsage = 0;
-			
-			for(Double load: highestPState.getLoadPowerUsage().keySet()){
-				powerUsage = highestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			pcLevel = pcLevel + maxMinPowerUsage;
-			
-			maxMinPowerUsage = 0;
-			powerUsage = 0;
-			
-			for(Double load: secondHighestPState.getLoadPowerUsage().keySet()){
-				powerUsage = secondHighestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			puLevel = puLevel + maxMinPowerUsage;
-			
-		}
-
-		puLevel = (pcLevel * pcLevel / puLevel);
-
-		*/
-		
-		pcLevel = EnvironmentConditions.powerCapLevel;
-		puLevel = EnvironmentConditions.powerUpgradeLevel;
-		
-		powerCapsLevels.put(compResource.getFullName(), pcLevel);
-		powerUpgradesLevels.put(compResource.getFullName(), puLevel);
-	}
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/CoolingDeviceEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/CoolingDeviceEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,487 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		return airflow;
-	}
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		
-		Device coolingDevice = (Device) resource;
-		ComputingResource room = (ComputingResource) coolingDevice.getComputingResource();
-		
-		double Pload_dc = calculatePit(room);
-		double Pothers = calculatePothers(Pload_dc);
-		double Pfans_dc = calculatePfans(room);
-		
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-		
-		//if data is not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				powerConsumption = Pdry_cooler;
-			else
-				powerConsumption = Pchiller;	
-		}
-		
-		
-		//System.out.println("CoolingDevice heat data: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		
-		//System.out.println("CoolingDevice power: " + powerConsumption);
-		
-		
-		return powerConsumption;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			double QnodeGroup = 0;
-			for(ComputingResource nodeGroup: rack.getChildren()){
-				double Qnodes = 0;
-				for(ComputingResource node: nodeGroup.getChildren()){
-					double Qcpu = 0;
-					Node n = (Node)node;
-					for(Processor proc: n.getProcessors()){
-						Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-					}
-					Qnodes = Qnodes + Qcpu;
-				}
-				double Qfans = 0;
-				for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/DataCenterEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/DataCenterEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,516 +1,0 @@
-package test.simpat.models.recs;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class DataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double Pdc;
-		
-		double Pload_dc = 0;
-		double Pothers = 0;
-		double Pfans_dc = 0;
-		double Pcooling_device = 0;
-
-		ComputingResource room = (ComputingResource) resource;
-		
-		/**************** IT PART ****************/
-		
-		/*********** Pload_dc ***********/
-		Pload_dc = calculatePit(room);
-
-		
-		
-		/**************** NON- IT PART ****************/
-		
-		/*********** Pothers ***********/		
-		Pothers = calculatePothers(Pload_dc);
-		
-		
-		
-		/************* COOLING PART *************/
-
-		
-		/*********** Pfans_dc ***********/
-		Pfans_dc = calculatePfans(room);
-		
-		/************ Pcooling_device ************/
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		
-		double Pchiller = calculatePchiller(Pload_dc, Pfans_dc, Pothers, room);
-		double Pdry_cooler = calculatePdryCooler(Pload_dc, Pfans_dc, Pothers, room);
-		
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		double Tev = Tr_in - delta_Th_ex;
-
-		
-		//if data not present in DB than don't take Pchiller into account
-		if(Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler < Tev - Tamb)
-				Pcooling_device = Pdry_cooler;
-			else
-				Pcooling_device = Pchiller;	
-		}
-		
-
-		Pdc = Pload_dc + Pothers + Pfans_dc + Pcooling_device;
-		//System.out.println("---");
-		//System.out.println("Pdry_cooler: " + Pdry_cooler + " Pchiller: "+ Pchiller);
-		//System.out.println("Pdc: " + Pdc + " Pload_dc: "+ Pload_dc + " Pothers: " + Pothers + " Pfans_dc: " + Pfans_dc + " Pcooling_device: " + Pcooling_device);
-		
-		//System.out.println("CB2 heat: " + Qload_dc + "; " + Qothers + "; " + Qfans_dc + "; " + Qdc);
-		//System.out.println("CB2 power: " + Pload_dc + "; " + Pothers + "; " + Pfans_dc + "; " + Pcooling_device + "; " + Pdc);
-
-		return Pdc;
-	}
-	
-	private double calculatePit(ComputingResource room){
-		double Pload_dc = 0;
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			Pload_dc = Pload_dc + rack.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		return Pload_dc;
-	}
-	
-	private double calculatePothers(double Pload_dc){
-		
-		double Pothers = 0;
-		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.coolingData.getAlpha();
-		} catch (Exception e){
-			a = 0.2;
-		}
-
-		Pothers = a * Pload_dc;
-		return Pothers;
-	}
-	
-	private double calculatePfans(ComputingResource room){
-		
-		double Pfans_dc = 0;
-
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		else {
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				Pfans_dc = delta_p * Vair_total / nf;
-		}
-		return Pfans_dc;
-	}
-	
-	private double calculatePchiller(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-		
-		double Pchiller = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double delta_Th_dry_cooler;//DEBB
-		try{
-			delta_Th_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThDryCooler").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_dry_cooler = 10;
-		}
-		
-		double Tamb;//experiment
-		try{
-			Tamb = ConfigurationOptions.coolingData.getAmbientAirTempeature();
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-		double Qcooling_rated;//DEBB
-		try{
-			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Qcooling_rated = 80000;
-		}
-		
-		double EERrated;//DEBB
-		try{
-			EERrated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("EERRated").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			EERrated = 5;
-		}
-
-		double delta_Th_ex;//DEBB
-		try{
-			delta_Th_ex = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("deltaThEx").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			delta_Th_ex = 10;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-		
-		double Tev;		
-		double CoolT;
-		double Qcooling_nom;
-		double PLR;
-
-		double delta_T;
-		double CoolPR;
-		double CoolPRrated;
-		double CoolPRT;
-		double CoolPRPLR;
-		double EER;
-		
-		
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Tev = Tr_in - delta_Th_ex;
-		double Tevf = 32 + 1.8 * Tev;
-		
-		double Tco = Tamb + delta_Th_dry_cooler;
-		
-		double Tcof = 32 + 1.8 * Tco;
-		CoolT = 0.647177 + 0.015888 * Tevf + 0.000103 * Math.pow(Tevf, 2) - 0.004167 * Tcof + 0.000007 * Math.pow(Tcof, 2) - 0.000064 * Tevf * Tcof;
-		Qcooling_nom = Qcooling_rated * CoolT;		
-		PLR = Qcooling / Qcooling_nom;
-		
-		delta_T = Tcof - Tevf;
-		CoolPRrated = 1 / EERrated;
-		CoolPRT = 0.564064 - 0.011463 * Tevf + 0.000112 * Math.pow(Tevf, 2) + 0.008091 * Tcof + 0.000070 * Math.pow(Tcof, 2) - 0.000126 * Tevf * Tcof;
-		CoolPRPLR = 0.023918 + 0.889469 * PLR + 0.077931 * Math.pow(PLR, 2) - 0.000264 * delta_T + 0.000007 * Math.pow(delta_T, 2) + 0.000180 * PLR * delta_T;
-		CoolPR = CoolPRrated * CoolPRT * CoolPRPLR;
-		EER = 1/CoolPR;
-		
-		Pchiller = Qcooling/EER;
-
-		return Pchiller;
-	}
-	
-	private double calculatePdryCooler(double Pload_dc, double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Pdry_cooler = 0;
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-		
-		double n_dry_cooler;//DEBB
-		try{
-			 n_dry_cooler = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("dryCoolerEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			 n_dry_cooler = 0.02;
-		}
-
-		double ncc;//DEBB
-		try{
-			ncc = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCoilEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			ncc = 0.95;
-		}
-		
-
-		double Qdc = calculateQ(Pfans_dc, Pothers, room);
-		double Qcooling = Qdc / ncc;
-
-		Pdry_cooler = n_dry_cooler * Qcooling;
-		
-		return Pdry_cooler;
-	}
-	
-	private double calculateQ(double Pfans_dc, double Pothers, ComputingResource room){
-
-		double Qdc = 0;
-		
-		Device coolingDevice = null;
-		for(Device device: room.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.CoolingDevice)){
-				coolingDevice = device;
-				break;
-			}
-		}
-
-		double nf;//DEBB
-		try{
-			nf = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CRAHFanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			nf = 0.6;
-		}
-
-		/**************** HEAT ****************/
-		
-		double Qload_dc = 0;
-		double Qothers = 0;
-		double Qfans_dc = 0;
-
-		double delta_2; //DEBB - currently not present;
-		delta_2 = 0.4;
-		
-		for(ComputingResource cr: room.getChildren()){
-			Rack rack = (Rack)cr;
-			double QnodeGroup = 0;
-			for(ComputingResource nodeGroup: rack.getChildren()){
-				double Qnodes = 0;
-				for(ComputingResource node: nodeGroup.getChildren()){
-					double Qcpu = 0;
-					Node n = (Node)node;
-					for(Processor proc: n.getProcessors()){
-						Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
-					}
-					Qnodes = Qnodes + Qcpu;
-				}
-				double Qfans = 0;
-				for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-					Fan fan = (Fan) device;
-					if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						try {
-							Qfans = Qfans + (1 - delta_2) * fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-						} catch (NoSuchFieldException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}else
-						Qfans = Qfans + (1 - delta_2) * fan.getPowerInterface().getRecentPowerUsage().getValue();
-				}
-				QnodeGroup = QnodeGroup + Qnodes + Qfans;
-			}
-			int nrOfPoweredOffNodes = 0;
-			for(Node node: rack.getNodes()){
-				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-					nrOfPoweredOffNodes++;
-				}
-			}
-			if(nrOfPoweredOffNodes != rack.getNodes().size()){
-				Qload_dc  = Qload_dc + QnodeGroup + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-			} else {
-				Qload_dc  = Qload_dc + QnodeGroup;
-			}
-		}
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc = Qload_dc + Qothers + Qfans_dc;
-
-		
-		return Qdc;
-	}
-	
-	
-	private double calculateQ2(ComputingResource room){
-
-		double Qdc = 0;
-
-		double mair_total;
-		double Vair_total;
-		double ro = 1.168;//constant
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(Vair_total != -1) {
-			mair_total = Vair_total * ro;
-		}
-		else {
-	
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-		}
-		
-		double Cp = 1004;//constant
-
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.coolingData.getOutletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_out = -1;
-		}
-		
-		double Tr_in;//experiment
-		try{
-			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
-		} catch (Exception e){
-			Tr_in = -1;
-		}
-
-
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		
-		return Qdc;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FCFSBF_RandomPluginMigrate.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FCFSBF_RandomPluginMigrate.java	(revision 1469)
+++ 	(revision )
@@ -1,414 +1,0 @@
-package test.simpat.models.recs;
-
-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.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.ResourceEventType;
-import schedframe.resources.computing.profiles.energy.airthroughput.AirflowStateName;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.CustomPowerStateName;
-import schedframe.resources.computing.profiles.energy.power.PowerState;
-import schedframe.resources.computing.profiles.energy.power.PowerUsage;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.units.ProcessingElements;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.resources.units.ResourceUnitName;
-import schedframe.resources.units.StandardResourceUnitName;
-import schedframe.scheduling.ResourceItem;
-import schedframe.scheduling.manager.resources.ClusterResourceManager;
-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;
-import schedframe.scheduling.plugin.ModuleList;
-import schedframe.scheduling.queue.TaskQueue;
-import schedframe.scheduling.queue.TaskQueueList;
-import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import dcworms.schedframe.scheduling.ExecTask;
-import eduni.simjava.Sim_system;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class FCFSBF_RandomPluginMigrate extends BaseLocalSchedulingPlugin {
-
-	public SchedulingPlanInterface<?> schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
-			ResourceManager resManager, ModuleList modules) {
-
-		ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;
-		List<Processor> processors = resourceManager.getProcessors();
-		SchedulingPlan plan = new SchedulingPlan();
-//for(Node node: resourceManager.getNodes()){
-//	System.out.println(node.getFullName());
-//}
-		// choose the events types to serve.
-		// Different actions for different events are possible.
-		switch (event.getType()) {
-		
-		
-		case TIMER:
-
-			System.out.println("##########################" + Sim_system.clock());
-			DataCenterWorkloadSimulator.getEventManager().sendToResources(StandardResourceType.Processor, 0.0, new ResourceEvent(ResourceEventType.TIMER, null));
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(EnvironmentConditions.SYSTEM_UDPATE_INTERVAL, DCWormsTags.TIMER, "Test");
-			break;
-			
-		case START_TASK_EXECUTION:
-		case TASK_FINISHED:
-
-			// our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
-			TaskQueue q = queues.get(0);
-			// check all tasks in queue
-
-			for (int i = 0; i < q.size(); i++) {
-				TaskInterface<?> task = q.get(i);
-				// if status of the tasks in READY
-				if (task.getStatus() == DCWormsTags.READY) {
-					Map<ResourceUnitName, ResourceUnit> choosenResources = chooseResourcesForExecution(processors, task);
-					if (choosenResources != null) {
-						addToSchedulingPlan(plan, task, choosenResources);
-					} 
-				}
-			}
-
-			break;
-		case RESOURCE_TEMPERATURE_LIMIT_EXCEEDED:
-			System.out.println("tuning fans");
-			ComputingResource cr = resourceManager.getResourceByName(event.getSource());
-			double temp = cr.getThermalInterface().getRecentTemperature().getValue();
-			double prevTemp;
-			if(cr.getThermalInterface().getTemperatureHistory().size() == 1)
-				prevTemp = temp;
-			else {
-				prevTemp = cr.getThermalInterface().getTemperatureHistory().get(cr.getThermalInterface().getTemperatureHistory().size() - 2).getValue();
-			}
-
-			System.out.println(prevTemp+  ";  " + temp);
-			boolean getingHotter = prevTemp < temp;
-			Node n = (Node) cr.getParent();
-			for(Device d: n.getParent().getResourceCharacteristic().getDevices()){
-				if(Integer.valueOf(d.getName().split("_")[1]) == Integer.valueOf(n.getName().split("_")[1])){
-					Fan f = (Fan) d;
-					int speed;
-					try{
-						speed= Integer.valueOf(f.getAirflowInterface().getAirflowState().getLabel().split("_")[1]).intValue();
-					} catch(Exception e){
-						speed = 0;
-					}
-					if(getingHotter){
-						if(temp > EnvironmentConditions.tempLevelLow2Medium && temp < EnvironmentConditions.tempLevelMedium2High){
-							if(speed < 60){
-								System.out.println("+++++++++ low 2 medium");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-							}
-						} else if (temp > EnvironmentConditions.tempLevelMedium2High && temp < EnvironmentConditions.tempLevelHigh2Max) {
-							if(speed < 80){
-								System.out.println("++++++++medium 2 high");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-							}
-						} else if (temp > EnvironmentConditions.tempLevelHigh2Max) {
-							if(speed < 100){
-								System.out.println("++++++++high 2 max");
-								f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_100"));
-							}
-						}					
-					} else {
-						if(temp > EnvironmentConditions.tempLevelHigh2Medium && temp < EnvironmentConditions.tempLevelMax2High){
-							System.out.println("-------- max 2 high");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_80"));
-						} else if(temp > EnvironmentConditions.tempLevelMedium2Low && temp < EnvironmentConditions.tempLevelHigh2Medium){
-							System.out.println("-------- high 2 medium");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_60"));
-						} else if (temp < EnvironmentConditions.tempLevelMedium2Low) {
-							System.out.println("-------- medium 2 low");
-							f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_30"));
-						}
-					}
-				}
-			
-
-				/*AirflowStateName state = f.getAirflowInterface().getAirflowState();
-				try{
-					Integer level = Integer.valueOf(state.getLabel().split("_")[1]);
-					Integer newLevel = level + 10;		
-					if(newLevel <= 100)
-						f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_" + newLevel));			
-				} catch (Exception e){
-					f.getAirflowInterface().setAirflowState(new CustomAirflowStateName("ON_10"));
-				}	*/
-			}
-			//optimizeEnergyUsage(jobRegistry, resourceManager , src);
-			break;
-
-		}	
-
-		return plan;
-	}
-	
-
-	
-	// IRIT
-	private void firstFitConsolidation(JobRegistry jobRegistry, ClusterResourceManager resourceManager, SchedulingEvent event) {
-		Node underLoadedNode = getNodeFromEvent(jobRegistry, (TaskFinishedEvent) event);
-		double remainingLoad = underLoadedNode.getLoadInterface().getRecentUtilization().getValue();
-		if(remainingLoad == 0) { return; }
-
-		PowerUsage pow = underLoadedNode.getPowerInterface().getRecentPowerUsage();
-		System.out.println(" last  : "+pow.getValue());
-		System.out.println(" Estimate  : "+getPowerConsumptionAtLoad(underLoadedNode, remainingLoad));
-	
-		for(Node node: resourceManager.getNodes()) {
-			double destLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			
-			if((node != underLoadedNode) && (destLoad!=0) && (destLoad + remainingLoad <= 100)) {
-				if(destLoad < remainingLoad) {
-					moveAllTask(jobRegistry, node, underLoadedNode);
-				}
-				else {
-					moveAllTask(jobRegistry, underLoadedNode, node);
-				}
-				return;
-			}
-		}
-	}
-	// IRIT
-	private Node getNodeFromEvent(JobRegistry jobRegistry, TaskFinishedEvent event) {
-		ExecTask task = jobRegistry.getTask(event.getJobId(), event.getTaskId());
-		ResourceItem r = task.getAllocatedResources().getLast();
-	    ProcessingElements pe = (ProcessingElements) r.getResourceUnits().get(StandardResourceUnitName.PE);
-	    ComputingResource c = pe.get(0);
-	    return (Node) c.getParent();
-
-	}
-	// IRIT
-	private void moveAllTask(JobRegistry jobRegistry, Node source, Node dest) {
-		double totalLoad = source.getLoadInterface().getRecentUtilization().getValue()+dest.getLoadInterface().getRecentUtilization().getValue();
-		if(totalLoad>100) {return;}
-		
-		JobRegistry srcHostJr = new JobRegistryImpl(source.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		for(int i=runningTasksNumber-1; i>=0; i--) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(dest.getProcessors(), execTask);
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-		}
-	}
-	// IRIT
-	public double getPowerConsumptionAtLoad(Node node, double loadLevel){
-		double powerConsumption = 0;
-		double lowestLoadLevel = 100;
-		double highestLoadLevel = 0;
-
-		System.out.println("ON_" + new Double(loadLevel).intValue());
-		System.out.println(node.getPowerInterface().supportPowerState(new CustomPowerStateName("ON_50")));
-		
-		try{
-			if(node.getPowerInterface().supportPowerState(new CustomPowerStateName("ON_" + new Double(loadLevel).intValue()))){
-				System.out.println("2 ON_" + new Double(loadLevel).intValue());
-
-				powerConsumption = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(loadLevel).intValue()));
-			} else {
-				for(PowerState powerState: node.getPowerInterface().getSupportedPowerStates()){
-					Double load;
-					System.out.println(" getname "+powerState.getName().getLabel());
-					try{
-						load = Double.valueOf(powerState.getName().getLabel().substring(3));
-					}catch (Exception e){
-						continue;
-					}
-					if(lowestLoadLevel > load){
-						lowestLoadLevel = load;
-					}
-					if(highestLoadLevel < load){
-						highestLoadLevel = load;
-					}
-				}
-				if(loadLevel == 0){
-					powerConsumption = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_0"));
-				} else {
-					
-					double lowerLoadLevel = lowestLoadLevel;
-					double higherLoadLevel = highestLoadLevel;
-
-					for(PowerState powerState: node.getPowerInterface().getSupportedPowerStates()){
-						Double load = Double.valueOf(powerState.getName().getLabel().substring(3));
-						if(loadLevel > load){
-							lowerLoadLevel = load;
-						}
-						else if(loadLevel < load){
-							higherLoadLevel = load;
-							break;
-						}
-					}
-					double powerBelow;
-					double powerAbove;
-					double a;
-					double b;
-					if(lowerLoadLevel != higherLoadLevel) {
-						powerBelow = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(lowerLoadLevel).intValue()));
-						powerAbove = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(higherLoadLevel).intValue()));
-						a = (powerAbove - powerBelow)/(higherLoadLevel - lowerLoadLevel);
-						b = powerAbove - a * higherLoadLevel;
-					} else {
-						powerBelow = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(lowestLoadLevel).intValue()));
-						powerAbove = node.getPowerInterface().getPowerConsumption(new CustomPowerStateName("ON_" + new Double(highestLoadLevel).intValue()));
-						a = (powerAbove - powerBelow)/(highestLoadLevel - lowestLoadLevel);
-						b = powerAbove - a * highestLoadLevel;
-					}
-					powerConsumption = a * loadLevel + b;
-				}
-			}
-		} catch (Exception e){
-			
-		}
-	
-		return powerConsumption;
-	}
-
-
-
-	private void globalEnergyOptimizer(JobRegistry jobRegistry, ClusterResourceManager resourceManager, String resName) {
-		
-		Node leastLoadedNode = findLeastLoadedResource(resourceManager.getNodes());
-		Node mostLoadedNode = findMostLoadedResource(resourceManager.getNodes());
-		System.out.println("-------------ALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLERT");
-		System.out.println("             max : "+mostLoadedNode.getLoadInterface().getRecentUtilization().getValue());
-		System.out.println("             min : "+leastLoadedNode.getLoadInterface().getRecentUtilization().getValue());
-
-		
-		
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue() >= mostLoadedNode.getLoadInterface().getRecentUtilization().getValue()){
-			return;
-		}
-		System.out.println("             ALLLLLLLLLLLLLLLL");
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue()  != 0){
-			return;
-		}
-		System.out.println("                              LLLLLLLLLLLLLLLLLLLLERT");
-
-
-		
-		JobRegistry srcHostJr = new JobRegistryImpl(mostLoadedNode.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		System.out.println("           nbtasks source "+runningTasksNumber);
-		if(runningTasksNumber >= 1) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(0);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			System.out.println("           "+destinationResources.toString());
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-		}
-/*for(int i = srcHostJr.getRunningTasks().size() - 1; i >= 0 && runningTasksNumber > 2; i--) {
-			System.out.println("           Migration");
-
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			System.out.println("           "+destinationResources.toString());
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-			runningTasksNumber--;
-		
-		}
-	*/
-
-		
-	}
-	
-	
-	private void optimizeEnergyUsage(JobRegistry jobRegistry, ClusterResourceManager resourceManager, String resName) {
-		Node overLoadedNode = (Node)resourceManager .getResourceByName(resName);
-		Node leastLoadedNode = findLeastLoadedResource(resourceManager.getNodes());
-		
-		if(leastLoadedNode.getLoadInterface().getRecentUtilization().getValue() >= overLoadedNode.getLoadInterface().getRecentUtilization().getValue()){
-			return;
-		}
-
-		JobRegistry srcHostJr = new JobRegistryImpl(overLoadedNode.getFullName());
-		int runningTasksNumber = srcHostJr.getRunningTasks().size();
-		for(int i = srcHostJr.getRunningTasks().size() - 1; i >= 0 && runningTasksNumber > 2; i--) {
-			ExecTask execTask = srcHostJr.getRunningTasks().get(i);
-			Map<ResourceUnitName, ResourceUnit> destinationResources = chooseResourcesForExecution(findLeastLoadedResource(resourceManager.getNodes()).getProcessors(), execTask);
-			jobRegistry.migrateTask(execTask.getJobId(), execTask.getId(), destinationResources);
-			runningTasksNumber--;
-		}
-	}
-
-	private Map<ResourceUnitName, ResourceUnit> chooseResourcesForExecution(
-			List<Processor> processors, TaskInterface<?> task) {
-
-		Map<ResourceUnitName, ResourceUnit> map = new HashMap<ResourceUnitName, ResourceUnit>(1);
-
-		int cpuRequest;
-		try {
-			cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue();
-		} catch (NoSuchFieldException e) {
-			cpuRequest = 0;
-		}
-
-		if (cpuRequest != 0) {
-
-			if (processors.size() < cpuRequest) {
-				return null;
-			}
-
-			List<ComputingResource> choosenResources = new ArrayList<ComputingResource>(cpuRequest);				
-			for (int i = 0; i < processors.size() && cpuRequest > 0; i++) {
-				if (processors.get(i).getStatus() == ResourceStatus.FREE) {
-					choosenResources.add(processors.get(i));
-					cpuRequest--;
-				}
-			}
-			if (cpuRequest > 0) {
-				return null;
-			}
-
-			ProcessingElements pe = new ProcessingElements();
-			pe.addAll(choosenResources);
-			map.put(StandardResourceUnitName.PE, pe);
-			return map;
-		}
-
-		return null;
-	}
-
-	private Node findLeastLoadedResource(List<Node> nodes ){
-		Node leastLoadedNoded = null;
-		double minLoad = Double.MAX_VALUE;
-		
-		for(int i = 0; i < nodes.size(); i++){
-			Node node = nodes.get(i);
-			double totalLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			if(totalLoad < minLoad){
-				leastLoadedNoded= node;
-				minLoad = totalLoad;
-			}
-		}
-		return leastLoadedNoded;
-	}
-	private Node findMostLoadedResource(List<Node> nodes ){
-		Node mostLoadedNoded = null;
-		double minLoad = 0;
-		
-		for(int i = 0; i < nodes.size(); i++){
-			Node node = nodes.get(i);
-			double totalLoad = node.getLoadInterface().getRecentUtilization().getValue();
-			if(totalLoad >= minLoad){
-				mostLoadedNoded= node;
-				minLoad = totalLoad;
-			}
-		}
-		return mostLoadedNoded;
-	}
-}
-
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/RackEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/RackEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,124 +1,0 @@
-package test.simpat.models.recs;
-
-import java.util.List;
-
-import schedframe.resources.CoolEmAllResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.CustomAirflowStateName;
-import schedframe.resources.computing.profiles.energy.power.PState;
-import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import example.energy.BaseEnergyEstimationPlugin;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-import gridsim.dcworms.DCWormsTags;
-
-public class RackEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	double powerCapLevel = -1;
-	double powerUpgradeLevel = -1;
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		if(powerCapLevel == -1 || powerUpgradeLevel == -1){
-			loadThresholds((ComputingResource) resource);
-		}
-		
-		double powerConsumption = 0;
-		Rack rack = (Rack)resource;
-		for(ComputingResource nodeGroup: rack.getChildren()){
-			try{
-				powerConsumption = powerConsumption + nodeGroup.getPowerInterface().getRecentPowerUsage().getValue();
-			} catch (Exception e){
-				
-			}
-		}
-		
-		int nrOfPoweredOffNodes = 0;
-		for(Node node: rack.getNodes()){
-			if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
-				nrOfPoweredOffNodes++;
-			}
-		}
-		if(nrOfPoweredOffNodes != rack.getNodes().size()){
-			powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;			
-		}
-		
-		if(powerConsumption > powerCapLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}
-		else if(powerConsumption < powerUpgradeLevel){
-			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_POWER_LIMIT_EXCEEDED, null);
-		}
-		return powerConsumption;
-	}
-	
-	private void loadThresholds(ComputingResource compResource){
-		
-		Rack rack = (Rack) compResource;
-		double pcLevel = 0;
-		double puLevel = 0;
-		for(Processor proc: rack.getProcessors()){
-			PState highestPState =  proc.getPowerInterface().getHighestPState();
-			PState secondHighestPState =  proc.getPowerInterface().getLowestPState();
-			for(String pStateName: proc.getPowerInterface().getSupportedPStates().keySet()){
-				PState pState = proc.getPowerInterface().getSupportedPStates().get(pStateName);
-				if(pState.getFrequency()  < secondHighestPState.getFrequency() && pState.getFrequency() > highestPState.getFrequency()){
-					secondHighestPState = pState;
-				}
-			}
-			double maxMinPowerUsage = 0;
-			double powerUsage = 0;
-			
-			for(Double load: highestPState.getLoadPowerUsage().keySet()){
-				powerUsage = highestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			pcLevel = pcLevel + maxMinPowerUsage;
-			
-			maxMinPowerUsage = 0;
-			powerUsage = 0;
-			
-			for(Double load: secondHighestPState.getLoadPowerUsage().keySet()){
-				powerUsage = secondHighestPState.getLoadPowerUsage().get(load);
-				if(powerUsage > maxMinPowerUsage){
-					maxMinPowerUsage= powerUsage;				
-				}
-			}
-			puLevel = puLevel + maxMinPowerUsage;
-			
-		}
-		
-		double fpc = 0;
-		for(ComputingResource nodeGroup: rack.getChildren()){
-			for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-				try {
-					fpc = fpc + device.getAirflowInterface().getPowerConsumption(new CustomAirflowStateName("ON_100"));
-				} catch (NoSuchFieldException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-
-		}
-		pcLevel = (pcLevel + fpc) / CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;
-		puLevel = (puLevel + fpc) / CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;
-
-		puLevel = (pcLevel * pcLevel / puLevel);
-
-		powerCapLevel = pcLevel;
-		powerUpgradeLevel = puLevel;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/NodeGroupEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/NodeGroupEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,36 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class NodeGroupEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		NodeGroup nodeGroup = (NodeGroup)resource;
-		for(Node node: nodeGroup.getNodes()){
-			try{
-				powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue();
-			} catch (Exception e){
-			}
-		}
-
-		for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				Fan fan = (Fan) device;
-				powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue();
-			}
-		}
-		return powerConsumption;
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FanEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,76 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import test.simpat.EnvironmentConditions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FanEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	/*private static int PFanMax = 6;
-	private static int TFanLow = 45;
-	private static int TFanHigh = 47;*/
-
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-		Fan fan = (Fan) resource;
-		/*Node node = (Node) fan.getComputingResource();
-		double Tcpu = 0;
-		for(Processor cpu: node.getProcessors()){
-			Tcpu = Tcpu + cpu.getThermalInterface().getRecentTemperature().getValue();
-		}
-		Tcpu = Tcpu/node.getProcessors().size();
-		
-		if (Tcpu < TFanLow) {
-			powerConsumption = 4;
-		} else if (Tcpu > TFanHigh){
-			powerConsumption = PFanMax;
-		}
-		*/
-		
-		try {
-			powerConsumption = fan.getAirflowInterface().getPowerConsumption(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		
-		double airflow = 0;
-		Fan fan = (Fan) resource;
-		
-		/*double fanEfficiency = 0;
-		try{
-			fanEfficiency = Double.valueOf(fan.getPowerInterface().getParameters().get("fanEfficiency").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-
-		double dp = 1013.25;
-		airflow = fan.getPowerInterface().getRecentPowerUsage().getValue() * fanEfficiency /dp;*/
-
-		try {
-			airflow = fan.getAirflowInterface().getAirflow(fan.getAirflowInterface().getAirflowState());
-		} catch (NoSuchFieldException e) {
-			//
-		}
-		return airflow;
-	}
-	
-	public double estimateTemperature (ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double temperature = EnvironmentConditions.ROOM_TEMPERATURE;
-		return temperature;
-	}
-	
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FlowPumpInletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FlowPumpInletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,145 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpInletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		/*********** Pfans_dc ***********/
-		double powerConsumption = 0;
-		double nf = 0.6;
-		
-		double delta_p;//from database, CFD
-		double Vair_total;
-		
-		delta_p = ConfigurationOptions.coolingData.getPressureDrop();
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		
-		if(delta_p != -1 && Vair_total != -1)
-			powerConsumption = delta_p * Vair_total / nf;
-		else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-			
-			double ro = 1.168;//constant
-		
-			double mair_total;
-			
-			//in case of DCworms calculation of Vair_total
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			
-
-			if(delta_p != -1 && Vair_total != -1)
-				powerConsumption = delta_p * Vair_total / nf;
-		}
-		
-		//System.out.println("Flow Pump power: " + powerConsumption);
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/NodeEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,131 +1,0 @@
-package test.simpat.models.recs;
-
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Tidle = 26;
-
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	private boolean fan = false;
-	
-	private double next_timer = -1;
-
-	private static double Pidle = 10;
-	private static double Pfull = 76;
-
-	
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		Node node = (Node) resource;
-		double powerConsumption = 0;
-
-		/*double Pcpu = 0;	
-		for(Processor cpu: node.getProcessors()){
-			Pcpu = Pcpu + cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		}*/
-		
-		powerConsumption = Pidle + (Pfull- Pidle) * node.getLoadInterface().getRecentUtilization().getValue()/100; 
-		return powerConsumption;
-	}
-
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-
-		Node node = (Node) resource;
-		Processor cpu = node.getProcessors().get(0);
-		double Pserv = 0;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double V = 0;
-		
-		for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				if(Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(node.getName().split("_")[1])){
-					Fan fan = (Fan) device;
-					V = fan.getAirflowInterface().getRecentAirflow().getValue();
-					break;
-				}
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		
-		double K = 0;
-		double Cair = EnvironmentConditions.AIR_HEAT_CAPACITY;
-		double ro = EnvironmentConditions.AIR_DENSITY;
-
-		K = V * Cair * ro;
-		//System.out.println("-------K: " + K +  "; V:" + V);
-
-		double delta_t = Sim_system.clock() - timestamp;
-
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		
-		NodeGroup ng = (NodeGroup) node.getParent();
-		for(Node n: ng.getNodes()){
-			if(Integer.valueOf(n.getName().split("_")[1]) - Integer.valueOf(node.getName().split("_")[1]) == EnvironmentConditions.NODES_IN_A_ROW){
-				Tin = n.getThermalInterface().getRecentTemperature().getValue();
-			}
-		}
-		
-		double targetTemp = Pserv/K + Tin; 
-		objective_temperature = targetTemp;
-
-		new_temperature = objective_temperature + (old_temperature - objective_temperature) * Math.exp(-delta_t / (R * C));
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FlowPumpOutletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,81 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Rack;
-import schedframe.resources.computing.coolemall.ComputeBox1;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.ConfigurationOptions;
-import example.energy.BaseEnergyEstimationPlugin;
-
-public class FlowPumpOutletEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		
-		double powerConsumption = 0;
-
-		return powerConsumption;
-	}
-	
-	public double estimateAirflow(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airflow = 0;
-		double Vair_total;
-		
-		Vair_total = ConfigurationOptions.coolingData.getAirflowVolume();
-		if(Vair_total != -1) {
-			airflow = Vair_total;
-		} else {
-			Device flowPump = (Device) resource;
-			ComputingResource room = flowPump.getComputingResource();
-
-			double ro = 1.168;//constant
-			
-			double mair_total;
-			double mair_rack = 0;
-
-			for(ComputingResource cr: room.getChildren()){
-				Rack rack = (Rack)cr;
-				for(ComputingResource nodeGroup: rack.getChildren()){
-					for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-						if(device.getType().equals(StandardResourceType.Outlet)){
-							
-							Fan fan = (Fan) device;
-							double mair_recs = 0;
-							double Vair_recs = 0;
-							
-							double Vair_recs1 = 0;
-
-							Vair_recs1  = fan.getAirflowInterface().getRecentAirflow().getValue();
-
-							double Vair_recs2 = 0;
-							for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-								if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(fan.getFullName().replace("Outlet", "Inlet"))){
-
-									Vair_recs2  = device2.getAirflowInterface().getRecentAirflow().getValue();
-
-									break;
-								}
-							}	
-
-							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
-
-							mair_recs = Vair_recs * ro;
-							mair_rack  = mair_rack + mair_recs;
-						}
-					}
-				}
-			}
-			mair_total = mair_rack;
-			Vair_total = mair_total / ro;
-			airflow = Vair_total;
-		}
-		return airflow;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/models/recs/CpuEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/models/recs/CpuEnergyEstimationPlugin.java	(revision 1469)
+++ 	(revision )
@@ -1,198 +1,0 @@
-package test.simpat.models.recs;
-
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
-import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.coolemall.NodeGroup;
-import schedframe.resources.computing.profiles.energy.ResourceEvent;
-import schedframe.resources.devices.Device;
-import schedframe.resources.devices.Fan;
-import schedframe.resources.devices.PhysicalResource;
-import schedframe.scheduling.manager.tasks.JobRegistry;
-import simulator.DataCenterWorkloadSimulator;
-import test.simpat.EnvironmentConditions;
-import eduni.simjava.Sim_system;
-import example.energy.BaseEnergyEstimationPlugin;
-import gridsim.dcworms.DCWormsTags;
-
-public class CpuEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
-
-	private static double Pidle = 4;
-	private static double Pfull = 50;
-
-	private static int Tidle = 33;
-	
-	private double timestamp = 0;
-	private double old_temperature = Tidle;
-	private double new_temperature = -1;
-	private double objective_temperature = Tidle;
-	
-	private boolean fan = false;
-	
-	private double next_timer = -1;    
-	
-	private int cpu_temp_monitor = 0;
-	public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry,
-			PhysicalResource resource) {
-		double powerConsumption = 0;
-
-		Processor cpu = (Processor)resource;
-		powerConsumption = Pidle + (Pfull- Pidle) * cpu.getLoadInterface().getRecentUtilization().getValue()/100;			
-
-		return powerConsumption;
-	}
-	
-	@Override
-	public double estimateTemperature(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double future = -1;
-
-		Processor cpu = (Processor) resource;
-
-		double R = 0;
-		double Rb = 0;
-		double Rcv = 0;
-		try{
-			Rb = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalResistance").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double k = 0;
-		try{
-			k = Double.valueOf(cpu.getPowerInterface().getParameters().get("k").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		
-		double a = 0;
-		try{
-			a = Double.valueOf(cpu.getPowerInterface().getParameters().get("a").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			a = 1;
-		}
-
-		double V = 0;
-	
-		for(Device device: cpu.getParent().getParent().getResourceCharacteristic().getDevices()){
-			if(device.getType().equals(StandardResourceType.Fan)){
-				if(Integer.valueOf(device.getName().split("_")[1]) == Integer.valueOf(cpu.getParent().getName().split("_")[1])){
-					Fan fan = (Fan) device;
-					V = fan.getAirflowInterface().getRecentAirflow().getValue();
-					break;
-				}
-			}
-		}
-
-		Rcv =  1/ (k * Math.pow(V, a));
-		R = Rb + Rcv; 
-		
-		double C = 0;
-		try{
-			C = Double.valueOf(cpu.getPowerInterface().getParameters().get("thermalCapacity").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			//
-		}
-		// 1) look where we are
-		double delta_t = Sim_system.clock() - timestamp;
-		/***************model1*************/
-		//new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/sink);
-		
-		/***************model2*************/
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		 
-
-		// 2) calculate if fan is needed ?
-		if(new_temperature <= EnvironmentConditions.TFanLow) {
-			fan = false;
-		}
-		if(new_temperature >= EnvironmentConditions.TFanHigh) {
-			fan = true; 
-		}
-		
-		// 3) compute new objective
-		double Tin = EnvironmentConditions.ROOM_TEMPERATURE;
-		double Pcpu = cpu.getPowerInterface().getRecentPowerUsage().getValue();
-		new_temperature = objective_temperature - (objective_temperature - old_temperature) * Math.exp(-delta_t/(R * C));
-		//new_temperature = (Pcpu * R + Tin) - (Pcpu * R + Tin - Tidle) * Math.exp(-Sim_system.clock()/(R * C));;
-		
-		
-		NodeGroup ng = (NodeGroup) cpu.getParent().getParent();
-		for(Node n: ng.getNodes()){
-			if(Integer.valueOf(n.getName().split("_")[1]) - Integer.valueOf(cpu.getParent().getName().split("_")[1]) == EnvironmentConditions.NODES_IN_A_ROW){
-				Tin = n.getThermalInterface().getRecentTemperature().getValue();
-			}
-		}
-		
-		/***************model1 - GEO1*************/
-		//double cpuLoad = cpu.getLoadInterface().getRecentUtilization().getValue();
-		//double targetTemp = Tidle + cpuLoad/100 * dTfull;
-		//if(fan) {
-		//	targetTemp = targetTemp - dTfan;
-		//}
-		
-		
-		/***************model2 - GEO2*************/
-		//Node node = (Node) cpu.getParent();
-		//Pserv = node.getPowerInterface().getRecentPowerUsage().getValue();
-		//double targetTemp = Pcpu * R + Tin; 
-		
-		/***************model3 - GEO1 + GEO2*************/
-		/*double targetTemp = Pcpu * R + Tin; 
-		if(fan) {
-			targetTemp = targetTemp - dTfan;
-		}*/
-	
-		/***************model4 - WP*************/
-		double targetTemp = Pcpu * R + Tin; 
-		
-		// 4) check if we will need to tune fans
-		if(fan && targetTemp < EnvironmentConditions.TFanLow) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanLow));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-		if(!fan && targetTemp > EnvironmentConditions.TFanHigh) {
-			double timer = C * R * Math.log((new_temperature - targetTemp)/(targetTemp - EnvironmentConditions.TFanHigh));
-			if(future == -1 || future > timer) {
-				future = timer;
-			}
-		}
-
-		// 5) save everything
-		timestamp = Sim_system.clock();
-		old_temperature = new_temperature;
-		objective_temperature = targetTemp;
-
-
-		if((future >= 0) && ((next_timer < Sim_system.clock()) || (next_timer >= future + Sim_system.clock()))) {
-			//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(future, DCWormsTags.FANMGT, "Test");
-			next_timer = future + Sim_system.clock() - 0.01;
-		}		
-		
-		if(new_temperature > EnvironmentConditions.tempLevelMedium2Low && new_temperature < EnvironmentConditions.tempLevelLow2Medium){
-			if(cpu_temp_monitor != 1){
-				cpu_temp_monitor = 1;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelLow2Medium && new_temperature < EnvironmentConditions.tempLevelHigh2Medium){
-			if(cpu_temp_monitor != 2){
-				cpu_temp_monitor = 2;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelHigh2Medium && new_temperature < EnvironmentConditions.tempLevelMedium2High){
-			if(cpu_temp_monitor != 3){
-				cpu_temp_monitor = 3;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		} else if(new_temperature > EnvironmentConditions.tempLevelMedium2High){
-			if(cpu_temp_monitor != 4){
-				cpu_temp_monitor = 4;
-				DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-			}
-		}
-		//DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.RESOURCE_TEMPERATURE_LIMIT_EXCEEDED, resource.getFullName());
-
-		return new_temperature;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/RunExperiment.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/RunExperiment.java	(revision 1469)
+++ 	(revision )
@@ -1,19 +1,0 @@
-package test.simpat;
-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/simpat/experiment.properties"
-				};
-		DataCenterWorkloadSimulator.main(args);
-	}
-
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/experiment.properties
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/experiment.properties	(revision 1469)
+++ 	(revision )
@@ -1,38 +1,0 @@
-# Use single *.swf file as workload description.
-
-# Path to xml file which describes resource characteristics.
-resdesc=src/test/simpat/resources/resourcesArticle.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/simpat/workload/workloadOk.swf
-
-# Choose directory where all result files should be placed.
-stats.outputfolder=src/test/simpat_result
-
-# Define the type and content of charts to generate
-
-# Gantt chart
-#creatediagrams.gantt=true
-
-# Shows the execution times of tasks
-#creatediagrams.tasks=true
-
-# Shows the waiting times of tasks
-#creatediagrams.taskswaitingtime=true
-
-# Resource utilization chart - only for processors
-#creatediagrams.resutilization=Processor;Node
-
-#creatediagrams.restemperature=Processor;Node
-
-#creatediagrams.respowerusage=Room
-
-#creatediagrams.resairflow=Fan
-
-pressuredrop=65.337
-outletroomairtemperature=33
-inletroomairtemperature=18
-ambientairtemperature=25
-#airflowvolume=0.0304
-alpha=0.2
Index: DCWoRMS/branches/coolemall/src/test/simpat/EnvironmentConditions.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/EnvironmentConditions.java	(revision 1469)
+++ 	(revision )
@@ -1,39 +1,0 @@
-package test.simpat;
-
-public class EnvironmentConditions {
-	public static int ROOM_TEMPERATURE = 22;
-	public static int AIR_HEAT_CAPACITY = 1024;
-	public static double AIR_PRESSURE = 1013.25;
-	public static double AIR_DENSITY = 1.168;
-	//public static double SYSTEM_UDPATE_INTERVAL = 2.0;
-	
-	public static int TFanLow = 45;
-	public static int TFanHigh = 47;
-	
-	/*public static int tempLevelLow2Medium = 40;
-	public static int tempLevelMedium2Low = 36;
-	public static int tempLevelMedium2High = 54;
-	public static int tempLevelHigh2Medium = 50;*/
-	
-	/*public static int tempLevelLow2Medium = 40;
-	public static int tempLevelMedium2Low = 36;
-	public static int tempLevelMedium2High = 56;
-	public static int tempLevelHigh2Medium = 52;
-	public static int tempLevelHigh2Max = 82;
-	public static int tempLevelMax2High = 78;*/
-	
-	public static int tempLevelLow2Medium = 40;
-	public static int tempLevelMedium2Low = 36;
-	public static int tempLevelMedium2High = 48;
-	public static int tempLevelHigh2Medium = 44;
-	public static int tempLevelHigh2Max = 56;
-	public static int tempLevelMax2High = 52;
-	
-	public static int NODES_IN_A_ROW = 2;
-	public static int NODES_IN_A_COLUMN = 2;
-	
-	
-	public static int powerCapLevel = 196;
-	public static int powerUpgradeLevel = 180;
-	
-}
Index: DCWoRMS/branches/coolemall/src/test/simpat/SimpatMetricsCalculator.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/simpat/SimpatMetricsCalculator.java	(revision 1469)
+++ 	(revision )
@@ -1,470 +1,0 @@
-package test.simpat;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import simulator.stats.AbstractMetricsCalculator;
-import simulator.stats.DCwormsAccumulator;
-import simulator.stats.implementation.MetricsStats;
-import example.energy.coolemall.CoolEmAllTestbedMeasurements;
-
-public class SimpatMetricsCalculator extends AbstractMetricsCalculator{
-	
-	double leakage;
-	public SimpatMetricsCalculator (long startTime, long endTime, long timestamp){
-		super(startTime, endTime, timestamp);
-	}
-	
-	public List<MetricsStats> calulateMetrics(){
-		List<MetricsStats> metrics = new ArrayList<MetricsStats>();
-		/*for(String resourceTypeName: metricsData.keySet()){
-			MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax());
-			metrics.add(metric);}
-		}*/
-		
-		leakage = calculateLeakageEnergyConsumption().getValue();
-		metrics.add(calculateLeakageEnergyConsumption());
-		metrics.add(calculateITComputingEnergyConsumption());
-		metrics.add(calculateITEnergyConsumption());
-		metrics.add(calculateNodeGroupFansEnergyConsumption());
-		
-		metrics.add(calculateRackEnergyConsumption());
-		metrics.add(calculateDataCenterFansEnergyConsumption());
-		metrics.add(calculateCoolingDeviceEnergyConsumption());
-		metrics.add(calculateOtherDevicesEnergyConsumption());
-		
-		metrics.add(calculateTotalEnergyConsumption());
-		
-		metrics.add(calculateMeanRackPower());
-		metrics.add(calculateMeanPower());
-		metrics.add(calculateMaxRackPower());
-		metrics.add(calculateMaxPower());
-		
-		metrics.add(calculatePUE());
-		metrics.add(calculatePUELevel4());
-		metrics.add(calculateEnergyWasteRate());
-		
-		metrics.add(calculateUsefulWork());
-		metrics.add(calculateProductivity());
-
-		return metrics;
-	}
-
-	private MetricsStats calculateLeakageEnergyConsumption() {
-		MetricsStats metric;
-		try{
-
-			double pl = 0;
-			for(String key: metricsData.keySet()){
-				if(key.contains("PowerLeakage")){
-					for(DCwormsAccumulator acc: metricsData.get(key)){
-						pl = pl + acc.getSum();
-					}
-				}
-			}
-
-			metric = new MetricsStats("CoolEmAllTestbed", "Power_Leakage_energy_consumption", (pl/2), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Power_Leakage_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-
-	private MetricsStats calculateTotalEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Room")){
-				roomPower = roomPower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateITComputingEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Processor")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateITEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double totalSitePower = 0; 
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				totalSitePower = totalSitePower + acc.getSum();
-			}
-			double nodeComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){
-				nodeComputingPower = nodeComputingPower+ acc.getSum();
-			}
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Node")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateNodeGroupFansEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double nodeComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){
-				nodeComputingPower = nodeComputingPower+ acc.getSum();
-			}
-			System.out.println("nodeComputingPower " + nodeComputingPower );
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Node")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			System.out.println("itComputingPower  " +itComputingPower  );
-			double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculatePUELevel4(){
-		
-		MetricsStats metric;
-		try{
-			
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Room")){
-				roomPower = roomPower + acc.getSum();
-			}
-			
-			double totalSitePower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				totalSitePower = totalSitePower + acc.getSum();
-			}
-			
-		
-			double nodeComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){
-				nodeComputingPower = nodeComputingPower+ acc.getSum();
-			}
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Node")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
-
-			metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, "");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, "");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculatePUE(){
-		
-		MetricsStats metric;
-		try{
-			
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Room")){
-				roomPower = roomPower + acc.getSum();
-			}
-			
-			double totalSitePower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				totalSitePower = totalSitePower + acc.getSum();
-			}
-
-
-			metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, "");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, "");
-		}
-		return metric;
-	}
-
-	private MetricsStats calculateUsefulWork(){
-		
-		MetricsStats metric;
-		try{
-			double usefulWork = 0;
-			for(String key: metricsData.keySet()){
-				if(key.contains("UW_")){
-					for(DCwormsAccumulator acc: metricsData.get(key)){
-						usefulWork= usefulWork + acc.getSum();
-					}
-				}
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units");
-		}
-		
-		return metric;
-	}
-	
-	private MetricsStats calculateProductivity(){
-		
-		MetricsStats metric;
-		try{
-			double usefulWork = 0;
-			for(String key: metricsData.keySet()){
-				if(key.contains("/")){
-					for(DCwormsAccumulator acc: metricsData.get(key)){
-						usefulWork= usefulWork + acc.getSum();
-					}
-				}
-			}
-			double totalSitePower = 0; 
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				totalSitePower = totalSitePower + acc.getSum();
-			}
-			
-			metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh");
-		}
-		
-		return metric;
-	}
-	
-	
-	private MetricsStats calculateMaxRackPower(){
-		
-		MetricsStats metric;
-		try{
-			double maxPower = 0;
-			
-			for(DCwormsAccumulator acc: metricsData.get("Rack_MAX")){
-				maxPower = maxPower + acc.getSum();
-			}
-
-			metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W");
-		}
-		
-		return metric;
-	}
-	
-	private MetricsStats calculateMaxPower(){
-		
-		MetricsStats metric;
-		try{
-			double maxPower = 0;
-			
-			for(DCwormsAccumulator acc: metricsData.get("Room_MAX")){
-				maxPower = maxPower + acc.getSum();
-			}
-
-			metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W");
-		}
-		
-		return metric;
-	}
-	
-	private MetricsStats calculateDataCenterFansEnergyConsumptionNew(){
-		
-		MetricsStats metric;
-		try{
-			double inletsPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Inlet")){
-				inletsPower = inletsPower + acc.getSum();
-			}
-			
-			double outletsPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Outlet")){
-				outletsPower = outletsPower + acc.getSum();
-			}
-			
-			double nodeComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Node")){
-				nodeComputingPower = nodeComputingPower+ acc.getSum();
-			}
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Processor")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
-			
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateRackEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				roomPower = roomPower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateCoolingDeviceEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double coolingDevicePower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("CoolingDevice")){
-				coolingDevicePower = coolingDevicePower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateDataCenterFansEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-
-			double flowPump = 0;
-			for(String key: metricsData.keySet()){
-				if(key.contains("FlowPump")){
-					for(DCwormsAccumulator acc: metricsData.get(key)){
-						flowPump = flowPump + acc.getSum();
-					}
-				}
-			}
-
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (flowPump), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-	
-	
-	private MetricsStats calculateOtherDevicesEnergyConsumption(){
-		
-		MetricsStats metric;
-		try{
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Room")){
-				roomPower = roomPower + acc.getSum();
-			}
-			
-			double totalSitePower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				totalSitePower = totalSitePower + acc.getSum();
-			}
-			
-			double coolingDevicePower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("CoolingDevice")){
-				coolingDevicePower = coolingDevicePower + acc.getSum();
-			}
-			
-			double inletsPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Inlet")){
-				inletsPower = inletsPower + acc.getSum();
-			}
-			
-			double outletsPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Outlet")){
-				outletsPower = outletsPower + acc.getSum();
-			}
-			
-			double nodeComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){
-				nodeComputingPower = nodeComputingPower+ acc.getSum();
-			}
-			double itComputingPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Node")){
-				itComputingPower = itComputingPower + acc.getSum();
-			}
-			double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower)), timestamp, "Wh");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", -1, timestamp, "Wh");
-		}
-		return metric;
-	}
-
-	
-	private MetricsStats calculateMeanPower(){
-		
-		MetricsStats metric;
-		try{
-			
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Room")){
-				roomPower = roomPower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W");
-		}
-		return metric;
-	}
-	
-	
-	private MetricsStats calculateMeanRackPower(){
-		
-		MetricsStats metric;
-		try{
-			
-			double roomPower = 0;
-			for(DCwormsAccumulator acc: metricsData.get("Rack")){
-				roomPower = roomPower + acc.getSum();
-			}
-			metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W");
-		}
-		return metric;
-	}
-	
-	private MetricsStats calculateEnergyWasteRate(){
-		
-		MetricsStats metric;
-		try{
-			double itComputingEnergy = 0;
-			
-			for(DCwormsAccumulator acc: metricsData.get("Processor_CALC")){
-				itComputingEnergy = itComputingEnergy + acc.getSum();
-			}
-			
-			double itEnergy = calculateITEnergyConsumption().getValue();
-
-			metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%");
-		} catch (Exception e){
-			metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%");
-		}
-		
-		return metric;
-	}
-	
-}
