Index: DCWoRMS/trunk/build/classes/schedframe/resources/units/ResourceUnit.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/units/ResourceUnit.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/units/ResourceUnit.java	(revision 539)
@@ -23,4 +23,6 @@
 	public void init(Parameters parameters);
 	
+	public Parameters getParameters();
+	
 	public ResourceUnitProvisioner getProvisioner();
 }
Index: DCWoRMS/trunk/build/classes/schedframe/resources/units/AbstractResourceUnit.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/units/AbstractResourceUnit.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/units/AbstractResourceUnit.java	(revision 539)
@@ -78,5 +78,8 @@
 	public ResourceUnitProvisioner getProvisioner() {
         return provisioner;
-
+	}
+	
+	public Parameters getParameters(){
+		return null;
 	}
 
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/AirThroughputInterface.java	(revision 539)
@@ -0,0 +1,21 @@
+package schedframe.resources.computing.profiles.energy.airthroughput.ui;
+
+import java.util.List;
+
+import schedframe.Parameters;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState;
+
+public interface AirThroughputInterface {
+	
+	public String getAirThroughputState();
+	
+	public boolean setAirThroughputState(String airThroughputState);
+	
+	public boolean supportAirThroughputState(String powerState);
+	
+	public List<AirThroughputState> getSupportedAirThroughputStates() throws NoSuchFieldException;
+	
+	public double getPowerConsumption(String state) throws NoSuchFieldException;
+	
+	public Parameters getParameters();
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/DefaultAirThroughputInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/DefaultAirThroughputInterface.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/ui/DefaultAirThroughputInterface.java	(revision 539)
@@ -0,0 +1,74 @@
+package schedframe.resources.computing.profiles.energy.airthroughput.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import schedframe.Parameters;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputState;
+
+public class DefaultAirThroughputInterface implements AirThroughputInterface{
+
+	protected String currentAirThroughputState;
+	protected AirThroughputProfile airThroughputProfile;
+	protected ComputingResource resource;
+	
+	public DefaultAirThroughputInterface(ComputingResource resource, AirThroughputProfile airThroughputProfile){
+		this.resource = resource;
+		this.airThroughputProfile = airThroughputProfile;
+	}
+	
+	public String getAirThroughputState() {
+		return currentAirThroughputState;
+	}
+
+	public boolean setAirThroughputState(String state) {
+		if(supportAirThroughputState(state)){
+			currentAirThroughputState = state;
+			
+			//TO DO - notifications should be called for all resources starting form the lowest layer
+			resource.handleEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, resource.getName()));
+
+			return true;
+		}
+		return false;
+	}
+
+	public boolean supportAirThroughputState(String state) {
+		for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){
+			if(airFlowState.getName().equals(state)){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public List<AirThroughputState> getSupportedAirThroughputStates() throws NoSuchFieldException {
+		List<AirThroughputState> airThroughputStates = new ArrayList<AirThroughputState>();
+		for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){
+			airThroughputStates.add(airFlowState);
+		}
+		return airThroughputStates;
+	}
+
+	public double getPowerConsumption(String state) throws NoSuchFieldException {
+		double powerConsumption = 0;
+		if(supportAirThroughputState(state)){
+			for(AirThroughputState airFlowState: airThroughputProfile.getAirThroughputStates()){
+				if(airFlowState.getName().equals(state)){
+					powerConsumption = airFlowState.getPowerUsage();
+					break;
+				}
+			}
+		}
+		return powerConsumption;
+	}
+
+	public Parameters getParameters() {
+		return airThroughputProfile.getParameters();
+	}
+
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputInterfaceFactory.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputInterfaceFactory.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputInterfaceFactory.java	(revision 539)
@@ -0,0 +1,16 @@
+package schedframe.resources.computing.profiles.energy.airthroughput;
+
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface;
+import schedframe.resources.computing.profiles.energy.airthroughput.ui.DefaultAirThroughputInterface;
+
+public class AirThroughputInterfaceFactory {
+	
+	public static AirThroughputInterface createAirThroughputInterface(ComputingResource resource, AirThroughputProfile atp){
+		if(atp == null)
+			return null;
+		AirThroughputInterface airThroughputInterface = new DefaultAirThroughputInterface(resource, atp);
+
+		return airThroughputInterface;
+	}
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirFlowValue.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirFlowValue.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirFlowValue.java	(revision 539)
@@ -0,0 +1,11 @@
+package schedframe.resources.computing.profiles.energy.airthroughput;
+
+import schedframe.resources.computing.profiles.energy.MeasurementHistory;
+
+public class AirFlowValue extends MeasurementHistory{
+
+	public AirFlowValue(long timestamp, double value){
+		super(timestamp, value);
+	}
+	
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/airthroughput/AirThroughputProfile.java	(revision 539)
@@ -1,5 +1,8 @@
 package schedframe.resources.computing.profiles.energy.airthroughput;
 
+import java.util.ArrayList;
 import java.util.List;
+
+import org.joda.time.DateTimeUtils;
 
 import schedframe.Parameters;
@@ -8,6 +11,9 @@
 public class AirThroughputProfile {
 	
-	AirThroughputEstimationPlugin airThroughputEstimationPlugin;
+	protected List<AirFlowValue> airFlowHistory;
+	
+	protected AirThroughputEstimationPlugin airThroughputEstimationPlugin;
 	protected List <AirThroughputState> airThroughputStates;
+	protected Parameters parameters;
 
 	public AirThroughputProfile(AirThroughputEstimationPlugin airThroughputEstimationPlugin, List<AirThroughputState> airThroughputStates) {
@@ -15,4 +21,5 @@
 		this.airThroughputEstimationPlugin = airThroughputEstimationPlugin;
 		this.airThroughputStates = airThroughputStates;
+		this.airFlowHistory = new ArrayList<AirFlowValue>();
 	}
 
@@ -21,6 +28,38 @@
 	}
 	
-	public void init(Parameters parameters){
-		
+	public void addToPowerUsageHistory(double airFlow) {
+
+		if (airFlowHistory.size() == 0) {
+			AirFlowValue usage = new AirFlowValue(DateTimeUtils.currentTimeMillis(), airFlow);
+			airFlowHistory.add(usage);
+			return;
+		}
+
+		int lastIdx = airFlowHistory.size() - 1;
+		double lastAirFlow = airFlowHistory.get(lastIdx).getValue();
+		if (lastAirFlow != airFlow) {
+			AirFlowValue usage = airFlowHistory.get(lastIdx);
+			long currentTime = DateTimeUtils.currentTimeMillis();
+			if (usage.getTimestamp() == currentTime) {
+				usage.setValue(airFlow);
+				if(lastIdx > 0 && airFlowHistory.get(lastIdx - 1).getValue() == airFlow)
+					airFlowHistory.remove(usage);
+			} else {
+				usage = new AirFlowValue(DateTimeUtils.currentTimeMillis(), airFlow);
+				airFlowHistory.add(usage);
+			}
+		}
+	}
+
+	public List<AirFlowValue> getAirThroughputHistory() {
+		return airFlowHistory;
+	}
+	
+	public void init(Parameters params){
+		this.parameters = params;
+	}
+
+	public Parameters getParameters() {
+		return parameters;
 	}
 }
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java	(revision 539)
@@ -11,9 +11,11 @@
 import schedframe.resources.computing.extensions.ExtensionException;
 import schedframe.resources.computing.extensions.ExtensionType;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile;
+import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface;
 import schedframe.resources.computing.profiles.energy.power.PowerProfile;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 import schedframe.scheduling.manager.tasks.JobRegistryImpl;
 
-public class EnergyExtension implements Extension/*, ResourceVisitor */{
+public class EnergyExtension implements Extension{
 
 	private Log log = LogFactory.getLog(EnergyExtension.class);
@@ -21,5 +23,8 @@
 	protected PowerInterface powerInterface;
 	protected PowerProfile powerProfile;
-
+	
+	protected AirThroughputInterface airFlowInterface;
+	protected AirThroughputProfile airFlowProfile;
+	
   	protected ComputingResource computingResource;
 
@@ -29,10 +34,17 @@
 	}
 
-	@Override
+	public EnergyExtension(PowerInterface powerInterface, PowerProfile powerProfile,
+			AirThroughputInterface airFlowInterface, AirThroughputProfile airFlowProfile) {
+		super();
+		this.powerInterface = powerInterface;
+		this.powerProfile = powerProfile;
+		this.airFlowInterface = airFlowInterface;
+		this.airFlowProfile = airFlowProfile;
+	}
+
 	public boolean supportsEvent(Event event) {
 
 		if(powerProfile == null || powerProfile.getEnergyEstimationPlugin() == null)
 			return false;
-		
 		if(event.getType().getName().equals(EnergyEventType.POWER_STATE_CHANGED.getName()))
 			return true;
@@ -43,10 +55,14 @@
 		else if(event.getType().getName().equals(EnergyEventType.TASK_FINISHED.getName()))
 			return true;
+		
+		if(airFlowProfile == null)
+			return false;	
+		if(event.getType().getName().equals(EnergyEventType.AIRFLOW_STATE_CHANGED.getName()))
+			return true;
+		
 		else return false;
 
 	}
-	
 
-	@Override
 	public void handleEvent(Event event) {
 		EnergyEvent enEvent = (EnergyEvent)event;
@@ -87,15 +103,19 @@
 			//System.out.println(this.resource.getName() + " - ESTIMATED ENERGY:" + power);
 			powerProfile.addToPowerUsageHistory(power);
-
+			break;
+		case AIRFLOW_STATE_CHANGED:
+			System.out.println("=====");
+			double airFlow = powerProfile.getEnergyEstimationPlugin().estimateAirThroughput(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource);
+			airFlowProfile.addToPowerUsageHistory(airFlow);
+			power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource);
+			powerProfile.addToPowerUsageHistory(power);
 			break;
 		}
 	}
-	
-	@Override
+
 	public void init(Properties properties) throws ExtensionException {
 		// TODO Auto-generated method stub
 	}
 
-	@Override
 	public ExtensionType getType() {
 		return ExtensionType.ENERGY_EXTENSION;
@@ -118,4 +138,11 @@
 	}
 
+	public AirThroughputInterface getAirThroughputInterface() {
+		return airFlowInterface;
+	}
+
+	public AirThroughputProfile getAirFlowProfile() {
+		return airFlowProfile;
+	}
 
 }
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/MeasurementHistory.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/MeasurementHistory.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/MeasurementHistory.java	(revision 539)
@@ -0,0 +1,25 @@
+package schedframe.resources.computing.profiles.energy;
+
+public class MeasurementHistory {
+	
+	protected long timestamp;
+	protected double value;
+
+	public MeasurementHistory (long timestamp, double value){
+		this.timestamp = timestamp;
+		this.value = value;
+	}
+	
+	public long getTimestamp() {
+		return timestamp;
+	}
+
+	public double getValue() {
+		return value;
+	}
+	
+	public void setValue(double value) {
+		this.value = value;
+	}
+	
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/DataCenterPowerInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/DataCenterPowerInterface.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/DataCenterPowerInterface.java	(revision 539)
@@ -7,9 +7,6 @@
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 
-public class DataCenterPowerInterface extends AbstractPowerInterface{
+public class DataCenterPowerInterface extends ComputingResourcePowerInterface{
 
-
-
-	
 	public DataCenterPowerInterface(ComputingResource resource, PowerProfile pp){
 		super(resource, pp);
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingNodePowerInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingNodePowerInterface.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingNodePowerInterface.java	(revision 539)
@@ -10,5 +10,5 @@
 import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
 
-public class ComputingNodePowerInterface extends AbstractPowerInterface{
+public class ComputingNodePowerInterface extends ComputingResourcePowerInterface{
 
 	public static long START_TIME = 600000;
@@ -28,13 +28,18 @@
 		currentPowerState = state;
 		ComputingNode computingNode = (ComputingNode) resource;
+		boolean pePowerStateChangeStatus = false;
 		if(computingNode.getProcessors() != null)
 		{
 			for(ComputingResource child:computingNode.getProcessors()){
-				child.getPowerInterface().setPowerState(state);
+				if(child.getPowerInterface() != null){
+					pePowerStateChangeStatus = child.getPowerInterface().setPowerState(state);	
+				}
 			}
-		} else {
+		} 
+		
+		if(!pePowerStateChangeStatus){
 			computingNode.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, computingNode.getName()));
 		}
-		
+
 		if(state == StandardPowerStateName.OFF){
 			computingNode.setStatus(ResourceStatus.UNAVAILABLE);
@@ -46,31 +51,4 @@
 		return true;
 	}
-	
-	/*public double getPowerConsumption(PowerState state) {
-		if(currentPowerState == PowerState.OFF)
-			return 0;
-		else if(currentPowerState == PowerState.ON)
-			return 750;
-		else return 500;
-	}*/
-
-	/*public boolean supportPowerState(PowerState state) {
-		switch(state){
-			case ON: 
-				return true;
-			case OFF: 
-				return true;
-			case SLEEP: 
-				return true;
-			case HIBERNATE: 
-				return true;
-			default: 
-				return false;
-		}
-	}
-
-	public List<PowerState> getSupportedPowerStates() {
-		return Arrays.asList(new PowerState[]{PowerState.ON, PowerState.OFF, PowerState.SLEEP, PowerState.HIBERNATE});
-	}*/
 
 	public void turnOn(){
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ComputingResourcePowerInterface.java	(revision 539)
@@ -0,0 +1,123 @@
+package schedframe.resources.computing.profiles.energy.power.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.joda.time.DateTimeUtils;
+
+import schedframe.Parameters;
+import schedframe.resources.ResourceStatus;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.EnergyEvent;
+import schedframe.resources.computing.profiles.energy.EnergyEventType;
+import schedframe.resources.computing.profiles.energy.power.PowerProfile;
+import schedframe.resources.computing.profiles.energy.power.PowerState;
+import schedframe.resources.computing.profiles.energy.power.PowerStateName;
+import schedframe.resources.computing.profiles.energy.power.PowerUsage;
+import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName;
+
+public class ComputingResourcePowerInterface implements PowerInterface{
+
+	protected PowerStateName currentPowerState;
+	protected PowerProfile powerProfile;
+	protected ComputingResource resource;
+	
+	public ComputingResourcePowerInterface(ComputingResource resource, PowerProfile powerProfile){
+		this.resource = resource;
+		this.powerProfile = powerProfile;
+		this.currentPowerState = StandardPowerStateName.ON;
+	}
+	
+	public boolean setPowerState(PowerStateName state) {
+		if(supportPowerState(state)){
+			currentPowerState = state;
+
+			for(ComputingResource child:resource.getChildren()){
+				if(child.getPowerInterface().supportPowerState(state)){
+					boolean status = child.getPowerInterface().setPowerState(state);
+					if(status == false) {
+						resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource));
+					}
+				}
+			}
+
+			if(state == StandardPowerStateName.OFF){
+				resource.setStatus(ResourceStatus.UNAVAILABLE);
+			}
+			else if(state == StandardPowerStateName.ON){
+				resource.setStatus(ResourceStatus.FREE);
+			}
+			//notifications from all levels
+			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getName()));
+
+			//notification from last level
+			//if (resource.getChildren() == null) resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource));
+			
+			return true;
+		}
+		return false;
+	}
+	
+
+	public PowerStateName getPowerState() {
+		return currentPowerState;
+	}
+
+	public List<PowerState> getSupportedPowerStates() throws NoSuchFieldException {
+		List<PowerState> powerStates = new ArrayList<PowerState>();
+		for(PowerState powerState: powerProfile.getSupportedPowerStates()){
+			powerStates.add(powerState);
+		}
+		return powerStates;
+	}
+
+	public boolean supportPowerState(PowerStateName state) {
+		try {
+			for(PowerState powerState: powerProfile.getSupportedPowerStates()){
+				if(powerState.getName().equals(state)){
+					return true;
+				}
+			}
+		} catch (NoSuchFieldException e) {
+			return false;
+		}
+		return false;
+		
+	}
+	
+	public double getPowerConsumption(PowerStateName state) throws NoSuchFieldException {
+		double powerConsumption = 0;
+		if(supportPowerState(state)){
+			for(PowerState powerState: powerProfile.getSupportedPowerStates()){
+				if(powerState.getName().equals(state)){
+					powerConsumption = powerState.getPowerUsage();
+					break;
+				}
+			}
+		}
+		return powerConsumption;
+	}
+
+	public PowerUsage getRecentPowerUsage() {
+		PowerUsage powerUsage = null;
+		int lastIdx = getPowerUsageHistory().size() - 1;
+		if(lastIdx >= 0)
+			powerUsage = getPowerUsageHistory().get(lastIdx);
+		else {	
+			try {
+				powerUsage = new PowerUsage(DateTimeUtils.currentTimeMillis(), getPowerConsumption(currentPowerState));
+			} catch (NoSuchFieldException e) {
+			}
+		}
+		return powerUsage;
+	}
+	
+	public List<PowerUsage> getPowerUsageHistory(){
+		return powerProfile.getPowerUsageHistory();
+	}
+	
+	public Parameters getParameters() {
+		return powerProfile.getParameters();
+	}
+
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/PowerInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/PowerInterface.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/PowerInterface.java	(revision 539)
@@ -3,4 +3,5 @@
 import java.util.List;
 
+import schedframe.Parameters;
 import schedframe.resources.computing.profiles.energy.power.PowerState;
 import schedframe.resources.computing.profiles.energy.power.PowerStateName;
@@ -25,3 +26,4 @@
 	List<PowerUsage> getPowerUsageHistory();
 	
+	public Parameters getParameters();
 }
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/ui/ProcessorPowerInterface.java	(revision 539)
@@ -1,10 +1,12 @@
 package schedframe.resources.computing.profiles.energy.power.ui;
+
+
+import gridsim.GridSimTags;
+import gridsim.dcworms.DCWormsTags;
 
 import java.util.Map;
 
-import schedframe.events.ResourceEventCommand;
 import schedframe.resources.ResourceStatus;
 import schedframe.resources.computing.ComputingResource;
-import schedframe.resources.computing.Processor;
 import schedframe.resources.computing.profiles.energy.EnergyEvent;
 import schedframe.resources.computing.profiles.energy.EnergyEventType;
@@ -16,5 +18,5 @@
 import schedframe.resources.units.StandardResourceUnitName;
 
-public class ProcessorPowerInterface extends AbstractPowerInterface {
+public class ProcessorPowerInterface extends ComputingResourcePowerInterface {
 
 	protected PState currentPState;
@@ -36,5 +38,4 @@
 		if(powerState != currentPowerState){
 			currentPowerState = powerState;
-			//Processor cpu = (Processor) resource;
 			if(powerState == StandardPowerStateName.OFF){
 				resource.setStatus(ResourceStatus.UNAVAILABLE);
@@ -42,6 +43,5 @@
 				resource.setStatus(ResourceStatus.FREE);
 			}
-			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getName()));
-			//cpu.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, cpu.getName()));			
+			resource.handleEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, resource.getName()));		
 		}
 
@@ -79,11 +79,11 @@
 
 		if(newPState != currentPState){
-			double factor = newPState.getFrequency()/currentPState.getFrequency();
+			//double factor = newPState.getFrequency()/currentPState.getFrequency();
 			currentPState = newPState;
-			CpuSpeed speed = (CpuSpeed)resource.getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.CPUSPEED).get(0);
-			speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue());
+			//CpuSpeed speed = (CpuSpeed)resource.getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.CPUSPEED).get(0);
+			//speed.setAmount(Double.valueOf(currentPState.getFrequency()).intValue());
 			//new ResourceEventCommand(resource).execute(EnergyEventType.FREQUENCY_CHANGED);
 			resource.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, resource.getName()));
-			//resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, resource.getName());
+			//resource.getScheduler().sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, resource.getName());
 			return true;
 		}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerInterfaceFactory.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerInterfaceFactory.java	(revision 539)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerInterfaceFactory.java	(revision 539)
@@ -0,0 +1,51 @@
+package schedframe.resources.computing.profiles.energy.power;
+
+import schedframe.resources.StandardResourceType;
+import schedframe.resources.computing.ComputingResource;
+import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
+
+public class PowerInterfaceFactory {
+
+
+
+	//new1
+	/*public static PowerInterface createPowerProfile(ResourceType resourceType, List<PowerState> powerStates, List<PState> pStates, String eepn){
+
+		PowerInterface powerProfile;
+
+		switch(resourceType){
+			case DataCenter: powerProfile = new DataCenterPowerInterfaceNew(eepn, powerStates); break;
+			case ComputingNode: powerProfile = new ComputingNodePowerInterfaceNew(eepn, powerStates); break;
+			case Processor: powerProfile = new CPUPowerInterfaceNew(eepn, powerStates, pStates); break;
+			default:
+				throw new IllegalArgumentException("ResourceType " + resourceType + " is not supported.");
+		}
+
+		return powerProfile;
+	}*/
+	
+	public static PowerInterface createPowerInterface(ComputingResource resource, PowerProfile pp){
+		if(pp == null)
+			return null;
+		PowerInterface powerInterface;
+
+		if(resource.getType().getName().equals(StandardResourceType.DataCenter.getName()))
+			powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.DataCenterPowerInterface(resource, pp);
+		else if (resource.getType().getName().equals(StandardResourceType.ComputingNode.getName()))
+			powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface(resource, pp);
+		else if (resource.getType().getName().equals(StandardResourceType.Processor.getName()))
+			powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface(resource, pp);
+		else 
+			powerInterface = new schedframe.resources.computing.profiles.energy.power.ui.ComputingResourcePowerInterface(resource, pp);
+
+		/*switch(resource.getType()){
+			case DataCenter: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.DataCenterPowerInterfaceNew(resource, pp); break;
+			case ComputingNode: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.ComputingNodePowerInterfaceNew(resource, pp); break;
+			case Processor: powerInterface = new test.rewolucja.energy.profile.implementation.alternative2.CPUPowerInterfaceNew(resource, pp); break;
+			default:
+				throw new IllegalArgumentException("ResourceType " + resource.getType() + " is not supported.");
+		}*/
+
+		return powerInterface;
+	}
+}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerProfile.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerProfile.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerProfile.java	(revision 539)
@@ -19,14 +19,16 @@
 	protected Map<String, PState> supportedPStates;
 	
+	protected Parameters parameters;
+	
 
-	public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<schedframe.resources.computing.profiles.energy.power.PowerState> supportedPowerStates) {
+	public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates) {
 		this.energyEstimationPlugin = energyEstimationPlugin;
 		this.powerUsage = new ArrayList<PowerUsage>();
-		this.supportedPowerStates = supportedPowerStates;
+		this.supportedPowerStates = powerStates;
 	}
 	
-	public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<schedframe.resources.computing.profiles.energy.power.PowerState> supportedPowerStates,  List<schedframe.resources.computing.profiles.energy.power.PState> pStates) {
+	public PowerProfile(EnergyEstimationPlugin energyEstimationPlugin, List<PowerState> powerStates,  List<PState> pStates) {
 		this.energyEstimationPlugin = energyEstimationPlugin;
-		this.supportedPowerStates = supportedPowerStates;
+		this.supportedPowerStates = powerStates;
 		this.powerUsage = new ArrayList<PowerUsage>();
 		if(pStates.size() > 0)
@@ -98,7 +100,12 @@
 	}
 
-	public void init(Parameters parameters){
-		
+	public void init(Parameters params){
+		this.parameters = params;
+	}
+	
+	public Parameters getParameters() {
+		return parameters;
 	}
 
+
 }
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/plugin/EnergyEstimationPlugin.java	(revision 539)
@@ -10,5 +10,5 @@
 	public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);
 
-	public double estimateEnergyDissipation(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);
+	public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);
 
 	public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource);
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerUsage.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerUsage.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/power/PowerUsage.java	(revision 539)
@@ -1,24 +1,10 @@
 package schedframe.resources.computing.profiles.energy.power;
 
-public class PowerUsage {
+import schedframe.resources.computing.profiles.energy.MeasurementHistory;
 
-	protected long timestamp;
-	protected double value;
+public class PowerUsage extends MeasurementHistory{
 
 	public PowerUsage(long timestamp, double value){
-		this.timestamp = timestamp;
-		this.value = value;
-	}
-	
-	public long getTimestamp() {
-		return timestamp;
-	}
-
-	public double getValue() {
-		return value;
-	}
-	
-	public void setValue(double value) {
-		this.value = value;
+		super(timestamp, value);
 	}
 	
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyEventType.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyEventType.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyEventType.java	(revision 539)
@@ -15,5 +15,8 @@
 	FREQUENCY_CHANGED(64),
 	VOLTAGE_CHANGED(128),
-	RESOURCE_FAILED(256)
+	
+	AIRFLOW_STATE_CHANGED(256),
+	
+	RESOURCE_FAILED(512)
 	;
 
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/DataCenter.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/DataCenter.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/DataCenter.java	(revision 539)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.description.ComputingResourceDescription;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
-import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory;
+import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 
@@ -11,5 +11,5 @@
 		super(resDesc);
 		//extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin()));
-		PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile());
+		PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile());
 		accept(new EnergyExtension(pi, resDesc.getPowerProfile()));
 	}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingNode.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingNode.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingNode.java	(revision 539)
@@ -10,5 +10,5 @@
 import schedframe.resources.computing.extensions.ExtensionType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
-import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory;
+import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.ui.ComputingNodePowerInterface;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
@@ -26,5 +26,5 @@
 		
 		//extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin()));
-		PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile());
+		PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile());
 		accept(new EnergyExtension(pi, resDesc.getPowerProfile()));	
 	}
@@ -39,10 +39,10 @@
 	
 	public ComputingNodePowerInterface getPowerInterface(){
-		ComputingNodePowerInterface powerProfile = null;
+		ComputingNodePowerInterface powerInterface = null;
 		if(extensionList.isExtensionAvailable(ExtensionType.ENERGY_EXTENSION)){
 			EnergyExtension ee = (EnergyExtension)extensionList.getExtension(ExtensionType.ENERGY_EXTENSION);
-			powerProfile = (ComputingNodePowerInterface)ee.getPowerInterface();
+			powerInterface = (ComputingNodePowerInterface)ee.getPowerInterface();
 		}
-		return powerProfile;
+		return powerInterface;
 	}
 
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingResource.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingResource.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/ComputingResource.java	(revision 539)
@@ -2,5 +2,5 @@
 
 import gridsim.GridSimTags;
-import gridsim.gssim.WormsTags;
+import gridsim.dcworms.DCWormsTags;
 
 import java.util.ArrayList;
@@ -28,4 +28,5 @@
 import schedframe.resources.computing.profiles.energy.EnergyEventType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
+import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 import schedframe.resources.computing.properties.DefaultPropertiesBuilder;
@@ -68,5 +69,5 @@
 	}
 
-	//TODO remove if possible (check if all scenarios can be realized - statistics issue) , since it's temporary method
+	//TODO remove if possible (check if all scenarios can be realized - statistics issue), since it's a temporary method
 	private void addFakeProcessors() {
 		if(getResourceCharacteristic().getResourceUnits().get(StandardResourceUnitName.PE) != null){
@@ -145,5 +146,4 @@
 		sec.execute(event);
 
-		
 		//old, correctly working method
 		/*if (extensionList != null) {
@@ -157,5 +157,5 @@
 		//if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){
 		//	String src = event.getSource() != null ? event.getSource() : name;
-		//	scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, src);
+		//	scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, src);
 		//}
 		//triggerEventUp(event);
@@ -188,5 +188,5 @@
 	}
 	
-	protected List<? extends ComputingResource> searchDescendants(List<ResourceValidator> validators, boolean cutoff) {
+	protected List<? extends ComputingResource> searchDescendants(List<ResourceValidator> validators, boolean cutOff) {
 
 		List<ComputingResource> descendants = new ArrayList<ComputingResource>();
@@ -198,6 +198,4 @@
 				ComputingResource resource = toExamine.pop();
 				List<ComputingResource> resources = resource.getChildren();
-				/*if (resources == null)
-					continue;*/
 				int numberOfRes = resources.size();
 				for (int i = 0; i < numberOfRes; i++) {
@@ -205,5 +203,5 @@
 					if (resourceChild.match(validators)) {
 						descendants.add(resourceChild);
-						if(cutoff == false) {
+						if(cutOff == false) {
 							toExamine.addLast(resourceChild);
 						}
@@ -243,4 +241,16 @@
 		return null;
 	}
+	
+	public AirThroughputInterface getAirThroughputInterface(){
+		if (extensionList != null) {
+			for (Extension extension : extensionList) {
+				if (extension.getType() == ExtensionType.ENERGY_EXTENSION) {
+					EnergyExtension ee = (EnergyExtension)extension;
+					return ee.getAirThroughputInterface();
+				}
+			}
+		}
+		return null;
+	}
 
 	public Scheduler getScheduler() {
@@ -257,5 +267,5 @@
 	}
 
-	class SimpleEventHandler implements EventHandler{
+	class ComputingResourceEventHandler implements EventHandler{
 		
 		public void handleResourceEvent(Event event){
@@ -275,5 +285,5 @@
 			if(scheduler != null && (parent != null && scheduler != parent.getScheduler())/*scheduler.getResources().contains(this)*/){
 				String src = event.getSource() != null ? event.getSource() : name;
-				scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, WormsTags.UPDATE, src);
+				scheduler.sendInternal(GridSimTags.SCHEDULE_NOW, DCWormsTags.UPDATE, src);
 			} else if(parent != null)
 				parent.getEventHandler().handleSchedulingEvent(event);
@@ -282,13 +292,21 @@
 	
 	public EventHandler getEventHandler(){
-		return new SimpleEventHandler();
+		return new ComputingResourceEventHandler();
 	}
 	
 	public void initiate(){
+		
 		ResourceEventCommand rec = new ResourceEventCommand(this);
-		EnergyEvent event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller");
+		EnergyEvent event = new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller");
 		event.setReason(EventReason.SIM_INIT);
 		rec.execute(event);
+		
+		rec = new ResourceEventCommand(this);
+		event = new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller");
+		event.setReason(EventReason.SIM_INIT);
+		rec.execute(event);
+		
 		//alternative way
+		//getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.AIRFLOW_STATE_CHANGED, "Resource controller"));
 		//getEventHandler().handleResourceEvent(new EnergyEvent(EnergyEventType.POWER_STATE_CHANGED, "Resource controller"));
 	}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/ResourceFactory.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/ResourceFactory.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/ResourceFactory.java	(revision 539)
@@ -11,5 +11,5 @@
 import schedframe.scheduling.policy.local.LocalManagementSystem;
 import schedframe.scheduling.queue.TaskQueueList;
-import simulator.WormsConstants;
+import simulator.DCWormsConstants;
 
 
@@ -20,4 +20,6 @@
 		if (resDesc.getType().equals(StandardResourceType.DataCenter))
 			return new DataCenter(resDesc);
+		else if (resDesc.getType().equals(StandardResourceType.Rack))
+			return  new Rack(resDesc);
 		else if (resDesc.getType().equals(StandardResourceType.ComputingNode))
 			return  new ComputingNode(resDesc);
@@ -46,5 +48,5 @@
 			}
 			case LS: {
-				ms = new LocalManagementSystem(id, WormsConstants.MANAGEMENT_SYSTEM,
+				ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM,
 						schedulingPlugin, execTimeEstimationPlugin, queues);
 				return new Scheduler(ms, type, managedResources);
@@ -52,5 +54,5 @@
 
 		default:{
-				ms = new LocalManagementSystem(id, WormsConstants.MANAGEMENT_SYSTEM,
+				ms = new LocalManagementSystem(id, DCWormsConstants.MANAGEMENT_SYSTEM,
 						schedulingPlugin, execTimeEstimationPlugin, queues);
 				return new Scheduler(ms, type, managedResources);
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/Processor.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/Processor.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/Processor.java	(revision 539)
@@ -8,5 +8,5 @@
 import schedframe.resources.computing.extensions.ExtensionType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
-import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory;
+import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 import schedframe.resources.computing.profiles.energy.power.ui.ProcessorPowerInterface;
@@ -22,5 +22,5 @@
 		super(resDesc);
 		//extensionList.add(new EnergyExtension(this, resDesc.getPowerInterface(), resDesc.getEnergyEstimationPlugin()));
-		PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile());
+		PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile());
 		accept(new EnergyExtension(pi, resDesc.getPowerProfile()));	
 	}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/Rack.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/Rack.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/Rack.java	(revision 539)
@@ -6,5 +6,5 @@
 import schedframe.resources.computing.description.ComputingResourceDescription;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
-import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory;
+import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 
@@ -14,5 +14,5 @@
 	public Rack (ComputingResourceDescription resDesc) {
 		super(resDesc);
-		PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile());
+		PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile());
 		accept(new EnergyExtension(pi, resDesc.getPowerProfile()));	
 	}
Index: DCWoRMS/trunk/build/classes/schedframe/resources/computing/Core.java
===================================================================
--- DCWoRMS/trunk/build/classes/schedframe/resources/computing/Core.java	(revision 477)
+++ DCWoRMS/trunk/build/classes/schedframe/resources/computing/Core.java	(revision 539)
@@ -3,5 +3,5 @@
 import schedframe.resources.computing.description.ComputingResourceDescription;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
-import schedframe.resources.computing.profiles.energy.power.PowerProfileFactory;
+import schedframe.resources.computing.profiles.energy.power.PowerInterfaceFactory;
 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface;
 import schedframe.resources.units.CpuSpeed;
@@ -13,5 +13,5 @@
 	public Core (ComputingResourceDescription resDesc) {
 		super(resDesc);
-		PowerInterface pi = PowerProfileFactory.createPowerInterface(this, resDesc.getPowerProfile());
+		PowerInterface pi = PowerInterfaceFactory.createPowerInterface(this, resDesc.getPowerProfile());
 		accept(new EnergyExtension(pi, resDesc.getPowerProfile()));	
 	}
