Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FanEnergyEstimationPlugin.java	(revision 1299)
@@ -2,6 +2,10 @@
 
 import schedframe.events.scheduling.EventReason;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Node;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName;
+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;
@@ -14,32 +18,36 @@
 		
 		double powerConsumption = 0;
-		/*try {
-			powerConsumption = resource.getAirThroughputInterface().getPowerConsumption(resource.getAirThroughputInterface().getAirThroughputState());
+		
+		Fan fan = (Fan) resource;
+		try {
+			powerConsumption = fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState());
 		} catch (NoSuchFieldException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}*/
+		}
 
-		if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){
+		/*if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){
 			powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_POWER_CONSUMPTION;
 		} else {
 			powerConsumption = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;
-		}
-		return powerConsumption;
+		}*/
+		return powerConsumption * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size();
 	}
 	
 	public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		
 		double airThroughput = 0;
-		/*try {
+		Fan fan = (Fan) resource;
+		try {
 			if(event.getReason() == EventReason.SIM_INIT)
-				airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());
+				airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState());
 			else
-				airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());
+				airThroughput = fan.getAirThroughputInterface().getAirFlow(fan.getAirThroughputInterface().getAirThroughputState());
 		} catch (NoSuchFieldException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}*/
+		}
 
-		if(event.getReason() == EventReason.SIM_INIT){
+		/*if(event.getReason() == EventReason.SIM_INIT){
 			if(resource.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){
 				airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW;
@@ -54,8 +62,20 @@
 				airThroughput = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW;
 			}
-		}
+		}*/
 
 		
-		return airThroughput;
+		return airThroughput * getNumberOfWorkingNodes(fan)/(double)fan.getChilledResources().size();
+	}
+	
+	private int getNumberOfWorkingNodes(Device device){
+		int quantity = 0;
+		Fan fan = (Fan) device;
+		for(ComputingResource compRes: device.getComputingResource().getChildren()){
+			Node node = (Node)compRes;
+			if(fan.getChilledResources().contains(node.getFullName()) && node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) ){
+				quantity++;
+			}
+		}
+		return quantity;
 	}
 
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB1EnergyEstimationPlugin.java	(revision 1299)
@@ -1,7 +1,9 @@
 package example.energy.coolemall;
 
+import schedframe.resources.computing.Node;
 import schedframe.resources.computing.coolemall.ComputeBox1;
 import schedframe.resources.computing.coolemall.NodeGroup;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -21,5 +23,14 @@
 			}
 		}
-		powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;
+		
+		int nrOfPoweredOffNodes = 0;
+		for(Node node: computeBox1.getNodes()){
+			if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
+				nrOfPoweredOffNodes++;
+			}
+		}
+		if(nrOfPoweredOffNodes != computeBox1.getNodes().size()){
+			powerConsumption = (powerConsumption + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION)/CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY;			
+		}
 		return powerConsumption;
 	}
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolEmAllTestbedMeasurements.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolEmAllTestbedMeasurements.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolEmAllTestbedMeasurements.java	(revision 1299)
@@ -4,36 +4,14 @@
 
 	//HARDWARE
-	public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112;
-	public static final double SINGLE_FAN_OFF_AIR_FLOW = 0;
+	//public static final double SINGLE_FAN_ON_AIR_FLOW = 0.0112;
+	//public static final double SINGLE_FAN_OFF_AIR_FLOW = 0;
 	
-	public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 6;
-	public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0;
+	//public static final double SINGLE_FAN_ON_POWER_CONSUMPTION = 0;
+	//public static final double SINGLE_FAN_OFF_POWER_CONSUMPTION = 0;
 	
-	public static final double OTHER_DEVICES_POWER_CONSUMPTION = 775;
+	public static final double OTHER_DEVICES_POWER_CONSUMPTION = 0;
 	
 	public static final double POWER_SUPPLY_EFFICIENCY = 0.87;
 	
 
-	public static final int Atom_D510_NR_OF_THREADS = 2;
-	
-	public static final int Atom_N2600_NR_OF_THREADS = 2;
-	
-	public static final int Core_i7_2715QE_NR_OF_THREADS = 4;
-	
-	public static final int Core_i7_3615QE_NR_OF_THREADS = 4;
-	
-	public static final int Fusion_G_T40N_NR_OF_THREADS = 2;
-	
-	//APPLICATIONS
-	public static final double Atom_D510 = 336.3;
-	
-	public static final double Atom_N2600 = 336.3;
-	
-	public static final double Core_i7_2715QE = 3076.4;
-	
-	public static final double Core_i7_3615QE = 3786.0;
-	
-	public static final double Fusion_G_T40N = 649.3;
-	
-
 }
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpInletEnergyEstimationPlugin.java	(revision 1299)
@@ -1,5 +1,11 @@
 package example.energy.coolemall;
 
+import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.coolemall.ComputeBox1;
+import schedframe.resources.computing.coolemall.NodeGroup;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.devices.Device;
+import schedframe.resources.devices.Fan;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -12,27 +18,68 @@
 			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;
 
-		double nf = 0.6;
+			for(ComputingResource cr: room.getChildren()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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;
 
-		double delta_p;//from database, CFD
-		try{
-			delta_p = ConfigurationOptions.pressureDrop;
-		} catch (Exception e){
-			delta_p = 0;
+							Vair_recs1  = fan.getAirThroughputInterface().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.getAirThroughputInterface().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;
 		}
 		
-		double Vair_total;
-		
-		try{
-			Vair_total = ConfigurationOptions.airFlowVolume;
-		} catch (Exception e){
-			Vair_total = 0;
-		}
-
-		
-		//if data not present in DB than don't take Pfans_dc into account
-		if(delta_p != -1 && Vair_total != -1)
-			powerConsumption = delta_p * Vair_total / nf;
+		//System.out.println("Flow Pump power: " + powerConsumption);
 		
 		return powerConsumption;
@@ -43,12 +90,54 @@
 		double Vair_total;
 		
-		try{
-			Vair_total = ConfigurationOptions.airFlowVolume;
-		} catch (Exception e){
-			Vair_total = 0;
+		Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume();
+		if(Vair_total != -1) {
+			airThroughput = 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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().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;
+			airThroughput = Vair_total;
 		}
-		airThroughput = Vair_total;
 		return airThroughput;
 	}
-
+	
 }
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java	(revision 1253)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/NodeEnergyEstimationPlugin.java	(revision 1299)
@@ -1,4 +1,6 @@
 package example.energy.coolemall;
 
+import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Node;
 import schedframe.resources.computing.Processor;
@@ -6,14 +8,11 @@
 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 test.Node_Fan_Mapping;
 import example.energy.BaseEnergyEstimationPlugin;
 
 public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
-	//private static int OUT_START_ID = 0;
-	//private static int OUT_END_ID = 8;
-	
 	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
@@ -30,86 +29,36 @@
 			//powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;
 			for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-				if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){
-					if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-						powerConsumption = powerConsumption + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;
-					}else
-						powerConsumption = powerConsumption + device.getPowerInterface().getRecentPowerUsage().getValue();
-					break;
+				if(device.getType().equals(StandardResourceType.Fan) || device.getType().equals(StandardResourceType.Inlet) | device.getType().equals(StandardResourceType.Outlet)){
+					Fan fan = (Fan) device;
+					if(fan.getChilledResources().contains(node.getFullName())){
+						if(fan.getPowerInterface().getRecentPowerUsage().getValue() == -1){
+							try {
+								powerConsumption = powerConsumption + fan.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState())/getNumberOfWorkingNodes(fan);
+							} catch (NoSuchFieldException e) {
+								// TODO Auto-generated catch block
+								e.printStackTrace();
+							}
+						}else
+							powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue()/getNumberOfWorkingNodes(fan);
+					}
 				}
 			}
 		} 
 
-
 		return powerConsumption;
 	}
-
-	/*public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-
-		double airThroughput = 0;
-		try {
-			if(event.getReason() == EventReason.SIM_INIT)
-				return airThroughput;
-				//airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF);
-			else {
-				airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());
-				//airThroughput = computingResource.getResourceCharacteristic().getDevices().get(0).getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());
-				//airThroughput = 0.28;
-			}
-		} catch (NoSuchFieldException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-		//Integer resId = Integer.parseInt(resource.getName().split("_")[1]);
-		//ComputingResource computingResource = (ComputingResource) resource;
-		//we estimate the air flow related to the outlets (nodes placed in the outlet row of RECS)
-		//if(resId >= OUT_START_ID  && resId <= OUT_END_ID){
-		//	for(ComputingResource compResource: computingResource.getParent().getChildren()){
-		//		Integer id = Integer.parseInt(compResource.getName().split("_")[1]);
-		//		//we take into account the inlet air flow (nodes placed "behind" the given node)
-		//		if(id - resId == 9 || id - resId == -9){
-		//			try {
-		//				airThroughput = airThroughput + compResource.getAirThroughputInterface().getAirFlow(compResource.getAirThroughputInterface().getAirThroughputState())/2;
-		//			} catch (NoSuchFieldException e) {
-		//
-		//			}
-		//		}
-		//	}
-		//}
-
-		return airThroughput;
-	}*/
-
-	/*public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double tout = 0;
-		double tin = 21.3;
-		double Q = 0.0056085;
-		double C = 1004;
-		double delta1 = 1.780594389/2;
-		double delta2 = 2.162043729/2;
-		double ro = 1.168;
-		double power1 = 0;
-		double power2 = 0;
-		
-		Integer resId = Integer.parseInt(resource.getName().split("_")[1]);
-		
-		ComputingResource computingResource = (ComputingResource) resource;
-		
-		//we estimate outlet temperature (related to the temperature of the nodes placed in outlet row)
-		for(ComputingResource compResource: computingResource.getParent().getChildren()){
-			Integer id = Integer.parseInt(compResource.getName().split("_")[1]);
-			//we take into account the power of nodes placed "behind" the given nodes
-			if(id - resId == 9){
-				power1 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
-				power2 = resource.getPowerInterface().getRecentPowerUsage().getValue();
-			} else if(id - resId == -9){
-				power1 = resource.getPowerInterface().getRecentPowerUsage().getValue();
-				power2 = compResource.getPowerInterface().getRecentPowerUsage().getValue();
+	
+	
+	private int getNumberOfWorkingNodes(Device device){
+		int quantity = 0;
+		Fan fan = (Fan) device;
+		for(ComputingResource compRes: device.getComputingResource().getChildren()){
+			Node node = (Node)compRes;
+			if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.ON) && fan.getChilledResources().contains(node.getFullName())){
+				quantity++;
 			}
 		}
-		
-		tout = tin + delta1 * (power1/(Q * C * ro)) +  delta2 * (power2/(Q * C * ro));;
-		return tout;
-	}*/
-	
+		return quantity;
+	}
+
 }
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java	(revision 1253)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CB2EnergyEstimationPlugin.java	(revision 1299)
@@ -9,18 +9,16 @@
 import schedframe.resources.computing.coolemall.NodeGroup;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
-import schedframe.resources.computing.profiles.energy.airthroughput.UserAirThroughputStateName;
+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 test.Node_Fan_Mapping;
 import example.energy.BaseEnergyEstimationPlugin;
 
 public class CB2EnergyEstimationPlugin extends BaseEnergyEstimationPlugin{
 
-	
 	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry,
 			PhysicalResource resource) {
-		
 		
 		double Pdc;
@@ -36,9 +34,6 @@
 		
 		/*********** Pload_dc ***********/
-		for(ComputingResource cr: room.getChildren()){
-			ComputeBox1 cb1 = (ComputeBox1)cr;
-			Pload_dc = Pload_dc + cb1.getPowerInterface().getRecentPowerUsage().getValue();
-		}
-		
+		Pload_dc = calculatePit(room);
+
 		
 		
@@ -46,21 +41,15 @@
 		
 		/*********** Pothers ***********/		
-		double a;//experiment
-		try{
-			a = ConfigurationOptions.alpha;
-		} catch (Exception e){
-			a = 0.02;
-		}
-		
-		//if not defined assume alpha = 0.02
-		if(a == -1)
-			a = 0.02;
-		
-		Pothers = a * Pload_dc; 
+		Pothers = calculatePothers(Pload_dc);
 		
 		
 		
 		/************* COOLING PART *************/
-		
+
+		
+		/*********** Pfans_dc ***********/
+		Pfans_dc = calculatePfans(room);
+		
+		/************ Pcooling_device ************/
 		Device coolingDevice = null;
 		for(Device device: room.getResourceCharacteristic().getDevices()){
@@ -72,94 +61,190 @@
 
 		
-		/*********** Pfans_dc ***********/
-		double ro = 1.168;//constant
-		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
-		try{
-			delta_p = ConfigurationOptions.pressureDrop;
-		} catch (Exception e){
-			delta_p = -1;
-		}
-		
-		double Vair_total;
-		double mair_total;
-		
-		//in case of DCworms calculation of Vair_total
-		double mair_rack = 0;
-
+		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()){
 			ComputeBox1 cb1 = (ComputeBox1)cr;
-			for(NodeGroup nodeGroup: cb1.getNodesGroups()){
-				for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){
-					if(device.getType().equals(StandardResourceType.Outlet)){
-						double mair_recs = 0;
-						double Vair_recs = 0;
-						
-						double Vair_recs1 = 0;
-						/*try {
-							Vair_recs1  = device.getAirThroughputInterface().getAirFlow(device.getAirThroughputInterface().getAirThroughputState());
-						} catch (NoSuchFieldException e) {
+			Pload_dc = Pload_dc + cb1.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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().getRecentAirFlow().getValue();
+
+									break;
+								}
+							}	
+
+							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
+
+							mair_recs = Vair_recs * ro;
+							mair_rack  = mair_rack + mair_recs;
 						}
-						*/
-						if(device.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){
-							Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW;
-						} else {
-							Vair_recs1 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW;
-						}
-						double Vair_recs2 = 0;
-						for(Device device2: nodeGroup.getResourceCharacteristic().getDevices()){
-							if(device2.getType().equals(StandardResourceType.Inlet) && device2.getFullName().equals(device.getFullName().replace("Outlet", "Inlet"))){
-								/*try {
-									Vair_recs2  = device2.getAirThroughputInterface().getAirFlow(device2.getAirThroughputInterface().getAirThroughputState());
-								} catch (NoSuchFieldException e) {
-								}
-								*/
-								if(device2.getAirThroughputInterface().getAirThroughputState().getName().equals(new UserAirThroughputStateName("1").getName())){
-									Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_OFF_AIR_FLOW;
-								} else {
-									Vair_recs2 = CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_AIR_FLOW;
-								}
-								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;
-		
-		//in case of CFD calculation of Vair_total
-		try{
-			Vair_total = ConfigurationOptions.airFlowVolume;
-		} catch (Exception e){
-			Vair_total = 0;
-		}
-		mair_total = Vair_total * ro;
-		
-		//if data not present in DB than don't take Pfans_dc into account
-		if(delta_p != -1 && Vair_total != -1)
-			Pfans_dc = delta_p * Vair_total / nf;
-		
-		
-		
-		/************ Pcooling_device ************/
-		
+			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;
-		double Pdry_cooler;
-		
-		/*********** Pchiller ***********/
-		double Cp = 1004;//constant
+		
+		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
@@ -174,5 +259,5 @@
 			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
 		} catch (Exception e){
-			Qcooling_rated = 3000;
+			Qcooling_rated = 80000;
 		}
 		
@@ -183,11 +268,4 @@
 			EERrated = 5;
 		}
-		
-		double Tco;//DEBB
-		try{
-			Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Tco = 30;
-		}
 
 		double delta_Th_ex;//DEBB
@@ -197,21 +275,12 @@
 			delta_Th_ex = 10;
 		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.outletRoomAirTempeature;
-		} catch (Exception e){
-			Tr_out = -1;
-		}
 		
 		double Tr_in;//experiment
 		try{
-			Tr_in = ConfigurationOptions.inletRoomAirTempeature;
+			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
 		} catch (Exception e){
 			Tr_in = -1;
 		}
-		
-		double Qdc;
-		double Qcooling;
+
 		
 		double Tev;		
@@ -228,9 +297,12 @@
 		
 		
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		Qcooling = Qdc / ncc;
+		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;
@@ -247,45 +319,61 @@
 		Pchiller = Qcooling/EER;
 
-			
-		
-
-		/*********** Pdry_cooler ***********/
-		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.ambientAirTempeature;
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		Pdry_cooler = 0.02 * Qcooling;
-		
-		
-		//if data not present in DB than don't take Pchiller into account
-		if(Vair_total != -1 && 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);
-		
-		
-		
-		
+		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 Qdc2;
 		
 		double Qload_dc = 0;
@@ -306,40 +394,120 @@
 						Qcpu = Qcpu + proc.getPowerInterface().getRecentPowerUsage().getValue();
 					}
-					double Qfan = 0;
-					for(Device device: node.getParent().getResourceCharacteristic().getDevices()){
-						if(device.getFullName().equals(Node_Fan_Mapping.getNode_fan().get(node.getFullName()))){
-							if(device.getPowerInterface().getRecentPowerUsage().getValue() == -1){
-								Qfan = Qfan + CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;
-							}else
-								Qfan = Qfan + device.getPowerInterface().getRecentPowerUsage().getValue();
-							break;
+					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.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState());
+						} 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: cb1.getNodes()){
+				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
+					nrOfPoweredOffNodes++;
+				}
+			}
+			if(nrOfPoweredOffNodes != cb1.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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().getRecentAirFlow().getValue();
+
+									break;
+								}
+							}	
+
+							Vair_recs  = Math.max(Vair_recs1, Vair_recs2);
+
+							mair_recs = Vair_recs * ro;
+							mair_rack  = mair_rack + mair_recs;
 						}
 					}
-					Qnodes = Qnodes + Qcpu + (1 - delta_2) * Qfan;
 				}
-				QnodeGroup = QnodeGroup + Qnodes;
-			}
-			Qload_dc  = Qload_dc + QnodeGroup;
-		}
-		
-		Qload_dc = Qload_dc + CoolEmAllTestbedMeasurements.OTHER_DEVICES_POWER_CONSUMPTION;
-		
-		Qothers = Pothers;
-		
-		Qfans_dc = (1 - nf) * Pfans_dc;
-		
-		Qdc2 = Qload_dc + Qothers + Qfans_dc;
-		
-		double Qdc2v2 = 0;
-		
-		if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1)
-			Qdc2v2 = mair_total * Cp * (Tr_out - Tr_in);
-
-		//System.out.println("Qdc2: " + Qdc2 + " Qdc2v2: " + Qdc2v2 + "diff: " + (Qdc2v2 - Qdc2));
-
-		
-		return Pdc;
-	}
-	
-
+			}
+			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/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/FlowPumpOutletEnergyEstimationPlugin.java	(revision 1299)
@@ -1,5 +1,11 @@
 package example.energy.coolemall;
 
+import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.coolemall.ComputeBox1;
+import schedframe.resources.computing.coolemall.NodeGroup;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.devices.Device;
+import schedframe.resources.devices.Fan;
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
@@ -21,12 +27,53 @@
 		double Vair_total;
 		
-		try{
-			Vair_total = ConfigurationOptions.airFlowVolume;
-		} catch (Exception e){
-			Vair_total = 0;
+		Vair_total = ConfigurationOptions.coolingData.getAirFlowVolume();
+		if(Vair_total != -1) {
+			airThroughput = 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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().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;
+			airThroughput = Vair_total;
 		}
-		airThroughput = Vair_total;
 		return airThroughput;
 	}
-
 }
Index: DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/CoolingDeviceEnergyEstimationPlugin.java	(revision 1299)
@@ -1,7 +1,14 @@
 package example.energy.coolemall;
 
-import schedframe.events.scheduling.EventReason;
+import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.Node;
+import schedframe.resources.computing.Processor;
+import schedframe.resources.computing.coolemall.ComputeBox1;
+import schedframe.resources.computing.coolemall.NodeGroup;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
+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;
@@ -11,16 +18,205 @@
 public class CoolingDeviceEnergyEstimationPlugin extends BaseEnergyEstimationPlugin {
 
+	public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
+		double airThroughput = 0;
+		return airThroughput;
+	}
+
 	public double estimatePowerConsumption(EnergyEvent 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()){
+			ComputeBox1 cb1 = (ComputeBox1)cr;
+			Pload_dc = Pload_dc + cb1.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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().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;
-		double Pdry_cooler;
-		
-		/*********** Pchiller ***********/
-		double Cp = 1004;//constant
+		
+		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
@@ -35,5 +231,5 @@
 			Qcooling_rated = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("coolingCapacityRated").get(0).getContent()).doubleValue();
 		} catch (Exception e){
-			Qcooling_rated = 3000;
+			Qcooling_rated = 80000;
 		}
 		
@@ -44,11 +240,4 @@
 			EERrated = 5;
 		}
-		
-		double Tco;//DEBB
-		try{
-			Tco = Double.valueOf(coolingDevice.getResourceCharacteristic().getParameters().get("CWT").get(0).getContent()).doubleValue();
-		} catch (Exception e){
-			Tco = 30;
-		}
 
 		double delta_Th_ex;//DEBB
@@ -58,34 +247,12 @@
 			delta_Th_ex = 10;
 		}
-
-		double Tr_out;//from database, CFD
-		try{
-			Tr_out = ConfigurationOptions.outletRoomAirTempeature;
-		} catch (Exception e){
-			Tr_out = -1;
-		}
 		
 		double Tr_in;//experiment
 		try{
-			Tr_in = ConfigurationOptions.inletRoomAirTempeature;
+			Tr_in = ConfigurationOptions.coolingData.getInletRoomAirTempeature();
 		} catch (Exception e){
 			Tr_in = -1;
 		}
 
-		
-		
-		double ro = 1.168;//cosntant
-		double	Vair_total;
-		double mair_total;
-		try{
-			Vair_total = ConfigurationOptions.airFlowVolume;
-		} catch (Exception e){
-			Vair_total = 0;
-		}
-		mair_total = Vair_total * ro;
-		
-		
-		double Qdc;
-		double Qcooling;
 		
 		double Tev;		
@@ -102,9 +269,12 @@
 		
 		
-		Qdc = mair_total * Cp * (Tr_out - Tr_in);
-		Qcooling = Qdc / ncc;
+		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;
@@ -121,54 +291,194 @@
 		Pchiller = Qcooling/EER;
 
-			
-		
-
-		/*********** Pdry_cooler ***********/
-		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.ambientAirTempeature;
-		} catch (Exception e){
-			Tamb = -1;
-		}
-		
-		Pdry_cooler = 0.02 * Qcooling;
-		
-		
-		//if data not present in DB than don't take Pchiller into account
-		if(Vair_total != -1 && Tr_in != -1 && Tr_out != -1) {
-			if(Tamb != -1 && Tev - Tamb > 0 && delta_Th_dry_cooler > Tev - Tamb)
-				powerConsumption = Pdry_cooler;
-			else
-				powerConsumption = Pchiller;	
-		}
-		
-		
-
-		
-		return powerConsumption;
-	}
-	
-	public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, PhysicalResource resource) {
-		double airThroughput = 0;
-		try {
-			if(event.getReason() == EventReason.SIM_INIT)
-				return airThroughput;
-				//airThroughput = resource.getAirThroughputInterface().getAirFlow(StandardAirThroughputStateName.FAN_OFF);
-			else
-				airThroughput = resource.getAirThroughputInterface().getAirFlow(resource.getAirThroughputInterface().getAirThroughputState());
-		} catch (NoSuchFieldException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-		return airThroughput;
-	}
-
+		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()){
+			ComputeBox1 cb1 = (ComputeBox1)cr;
+			double QnodeGroup = 0;
+			for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+				double Qnodes = 0;
+				for(Node node: nodeGroup.getNodes()){
+					double Qcpu = 0;
+					for(Processor proc: node.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.getAirThroughputInterface().getPowerConsumption(fan.getAirThroughputInterface().getAirThroughputState());
+						} 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: cb1.getNodes()){
+				if(node.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)){
+					nrOfPoweredOffNodes++;
+				}
+			}
+			if(nrOfPoweredOffNodes != cb1.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()){
+				ComputeBox1 cb1 = (ComputeBox1)cr;
+				for(NodeGroup nodeGroup: cb1.getNodesGroups()){
+					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.getAirThroughputInterface().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.getAirThroughputInterface().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/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/example/energy/coolemall/ProcessorEnergyEstimationPlugin.java	(revision 1299)
@@ -1,7 +1,4 @@
 package example.energy.coolemall;
 
-import dcworms.schedframe.scheduling.ExecTask;
-import schedframe.resources.ResourceStatus;
-import schedframe.resources.computing.Core;
 import schedframe.resources.computing.Processor;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
@@ -9,6 +6,4 @@
 import schedframe.resources.devices.PhysicalResource;
 import schedframe.scheduling.manager.tasks.JobRegistry;
-import schedframe.scheduling.manager.tasks.JobRegistryImpl;
-import schedframe.scheduling.tasks.phases.PhaseBehaviour;
 import example.energy.BaseEnergyEstimationPlugin;
 
@@ -18,29 +13,5 @@
 			PhysicalResource resource) {
 		
-		/*double powerConsumption = 0;
-		Processor cpu = (Processor)resource;
-		if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF))
-			powerConsumption = 0;
-		else {
-			if(resource.getStatus() == ResourceStatus.BUSY){
-				try {
-					powerConsumption = cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState());
-				} catch (NoSuchFieldException e) {
-					Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower");
-					if(param != null)
-						powerConsumption = Double.valueOf(param.get(0).getContent());
-				}
-			}
-			else {
-				try {
-					powerConsumption = cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON);
-				} catch (NoSuchFieldException e) {
-					Parameter param = cpu.getResourceCharacteristic().getParameters().get("maxPower");
-					if(param != null)
-						powerConsumption = 0.7 * Double.valueOf(param.get(0).getContent());
-				}
-			}
-		}
-		return powerConsumption;*/
+		double processorLoad = 0;
 		double powerConsumption = 0;
 		Processor proc = (Processor)resource;
@@ -48,44 +19,24 @@
 			return 0;
 		else {
-			double processorLoad;
-			double sumCoresLoad = 0;
-			
-			int nrOfThreadsOnCpu = 1;
-			
-			if(proc.getResourceCharacteristic().getParameters().get("product") != null){
-				String productName = proc.getResourceCharacteristic().getParameters().get("product").get(0).getContent();
-				if(productName.equals("Fusion G - T40N"))
-					nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Fusion_G_T40N_NR_OF_THREADS;
-				else if(productName.equals("Atom - D510"))
-					nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_D510_NR_OF_THREADS;
-				else if(productName.equals("Atom - N2600"))
-					nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Atom_N2600_NR_OF_THREADS;
-				else if(productName.equals("Core i7 - 2715QE"))
-					nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_2715QE_NR_OF_THREADS;
-				else if(productName.equals("Core i7 - 3615QE"))
-					nrOfThreadsOnCpu = CoolEmAllTestbedMeasurements.Core_i7_3615QE_NR_OF_THREADS;
-			}
 
-			for(Core core: proc.getCores()){
-				
-				if(core.getStatus().equals(ResourceStatus.BUSY)){
-					JobRegistry jr = new JobRegistryImpl(core.getFullName());
-					for(ExecTask task: jr.getRunningTasks()){
-						double cpuUsage = 100;
-						double nrOfThreadsOfApplciation = 1;
-						for(PhaseBehaviour pb: task.getCurrentResourceConsumption().getBehaviourList()){
-							if(pb.getResouceName().equals("PM_CPU_Usage")){
-								cpuUsage = pb.getUtilization();
-							}
-							if(pb.getResouceName().equals("PM_Threads")){
-								nrOfThreadsOfApplciation = pb.getUtilization();
-								break;
-							}
-						}
-						sumCoresLoad = sumCoresLoad + cpuUsage * (nrOfThreadsOnCpu / nrOfThreadsOfApplciation);
-					}
+			/*double usedFreq = proc.getPowerInterface().getHighestPState().getFrequency();
+
+			JobRegistry jr = new JobRegistryImpl(proc.getFullName());
+			for(ExecTask task: jr.getRunningTasks()){
+				String taskFreqString = task.getCurrentResourceConsumption().getReferenceHardware().get("cpu_maxfreq");
+				double taskFreq = Double.valueOf(taskFreqString);
+				if(taskFreq > usedFreq){
+					usedFreq = taskFreq;
 				}
 			}
-			processorLoad = 100 * sumCoresLoad/proc.getCores().size();
+			
+			processorLoad = proc.getLoadInterface().getRecentUtilization().getValue();
+			//System.out.println(proc.getFullName() + "processorLoad v2: " +  processorLoad);
+			
+			if(processorLoad != 0 && proc.getPowerInterface().getFrequency() != usedFreq) {
+				proc.getPowerInterface().setFrequency(usedFreq);
+			}*/
+			
+			processorLoad = proc.getLoadInterface().getRecentUtilization().getValue();
 			double lowestLoadLevel = 100;
 			double highestLoadLevel = 0;
@@ -130,6 +81,5 @@
 						double a;
 						double b;
-						if(lowerLoadLevel != higherLoadLevel)
-						{
+						if(lowerLoadLevel != higherLoadLevel) {
 							powerBelow = proc.getPowerInterface().getPState().getLoadPowerUsage().get(lowerLoadLevel);
 							powerAbove = proc.getPowerInterface().getPState().getLoadPowerUsage().get(higherLoadLevel);
@@ -155,7 +105,4 @@
 			}
 		}
-			
-
-		powerConsumption = powerConsumption - CoolEmAllTestbedMeasurements.SINGLE_FAN_ON_POWER_CONSUMPTION;
 		//System.out.println("estiamted power consumption: " + powerConsumption);
 		return powerConsumption;
