Index: DCWoRMS/trunk/src/simulator/stats/implementation/out/StringSerializer.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/out/StringSerializer.java	(revision 477)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/out/StringSerializer.java	(revision 495)
@@ -11,4 +11,5 @@
 import simulator.stats.implementation.GSSAccumulatorsStats;
 import simulator.stats.implementation.JobStats;
+import simulator.stats.implementation.ResourceAirFlowStats;
 import simulator.stats.implementation.ResourceEnergyStats;
 import simulator.stats.implementation.ResourceStats;
@@ -258,5 +259,5 @@
 
 	public Object visit(ResourceUsageStats resourceUsageStats) {
-		Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage();
+		Map<Long, Double> resourceUsage = resourceUsageStats.getUsage();
 		
 		int mapSize = resourceUsage.size();
@@ -297,5 +298,5 @@
 			buffer.append(resourceUsageStats.getResourceName());
 			buffer.append(fieldSeparator);
-			Integer value = resourceUsage.get(timestamp);
+			Double value = resourceUsage.get(timestamp);
 			buffer.append(timestamp);
 			buffer.append(fieldSeparator);
@@ -371,4 +372,62 @@
 	}
 
+	public Object visit(ResourceAirFlowStats resourceAirFlowStats) {
+		Map<Long, Double> resourceAirFlow = resourceAirFlowStats.getAirFlow();
+		
+		int mapSize = resourceAirFlow.size();
+		/*
+		 * FIXME:
+		 * Integer.MAX_VALUE = 2147483647. We assume, that each line contains 
+		 * max 30 signs - this gives max 71582788 lines. If resourceUsage map
+		 * contains more elements then we have a problem, because content of
+		 * resourceUsage map will not fit in the buffer.
+		 * This will need further attention in the future.
+		 */
+		int maxSize = (Integer.MAX_VALUE / 30 ) - 1;
+		if(mapSize >= maxSize){
+			log.error("Resource usage data is to long to fit in the buffer.");
+			return null;
+		}
+		
+		int size = 30 * resourceAirFlow.size();
+		
+		StringBuffer buffer = null;
+
+		if(printedHeaders.add(resourceAirFlowStats.getUsageType())) {
+			buffer = new StringBuffer(size + 42);
+			String[] headers = resourceAirFlowStats.getHeaders();
+			for(int i = 0; i < headers.length; i++)
+			{
+				buffer.append(headers[i]);
+				buffer.append(fieldSeparator);
+			}
+			buffer.append(System.getProperty("line.separator"));
+		} else {
+			buffer = new StringBuffer(size);
+		}
+		
+		
+		for (Long timestamp : resourceAirFlow.keySet()) {
+			
+			buffer.append(resourceAirFlowStats.getResourceName());
+			buffer.append(fieldSeparator);
+			Double value = resourceAirFlow.get(timestamp);
+			buffer.append(timestamp);
+			buffer.append(fieldSeparator);
+			buffer.append(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT
+					.format(value));
+			buffer.append(fieldSeparator);
+			buffer.append(System.getProperty("line.separator"));
+
+		}
+		
+		if(resourceAirFlow.size() > 0) {
+			buffer.append("mean: "+resourceAirFlowStats.getMeanUsage() + " sum: " +resourceAirFlowStats.getSumUsage());
+			buffer.append(System.getProperty("line.separator"));	
+		}
+
+		return buffer.toString();
+	}
+
 	public Object visit(GSSAccumulatorsStats accStats) {
 
Index: DCWoRMS/trunk/src/simulator/stats/implementation/out/StatsSerializer.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/out/StatsSerializer.java	(revision 477)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/out/StatsSerializer.java	(revision 495)
@@ -4,4 +4,5 @@
 import simulator.stats.implementation.GSSAccumulatorsStats;
 import simulator.stats.implementation.JobStats;
+import simulator.stats.implementation.ResourceAirFlowStats;
 import simulator.stats.implementation.ResourceEnergyStats;
 import simulator.stats.implementation.ResourceStats;
@@ -28,4 +29,5 @@
 	public Object visit(ResourceEnergyStats arg);
 
+	public Object visit(ResourceAirFlowStats arg);
 	
 	public Object visit(GSSAccumulatorsStats arg);
Index: DCWoRMS/trunk/src/simulator/stats/implementation/out/FormatedStringSerializer.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/out/FormatedStringSerializer.java	(revision 477)
+++ 	(revision )
@@ -1,570 +1,0 @@
-package simulator.stats.implementation.out;
-
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import simulator.DataCenterWorkloadSimulator;
-import simulator.stats.implementation.AccumulatedResourceStats;
-import simulator.stats.implementation.GSSAccumulatorsStats;
-import simulator.stats.implementation.JobStats;
-import simulator.stats.implementation.ResourceEnergyStats;
-import simulator.stats.implementation.ResourceStats;
-import simulator.stats.implementation.ResourceUsageStats;
-import simulator.stats.implementation.TaskStats;
-
-/**
- * 
- * @author Marcin Krystek, Jarek Szymczak
- * 
- *         This serializer needs correct implementation. Now it works as simple
- *         StringSerializer.
- * 
- */
-
-public class FormatedStringSerializer extends AbstractStringSerializer {
-
-	private Log log = LogFactory.getLog(FormatedStringSerializer.class);
-	
-	private String fieldSeparator = "; ";
-
-	public String visit(TaskStats taskStats) {
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add("taskStats")) {
-			buffer = new StringBuffer(520);
-			String[] headers = taskStats.getHeaders();
-			if (headers.length == 23) {
-
-				buffer.append(String.format("%5s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%7s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%7s", headers[2]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%14s", headers[3]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%7s", headers[4]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%14s", headers[5]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%15s", headers[6]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%13s", headers[7]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%13s", headers[8]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%13s", headers[9]));
-				buffer.append(fieldSeparator);
-
-				if (this.useExtended) {
-					buffer.append(String.format("%15s", headers[10]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%14s", headers[11]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%14s", headers[12]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%10s", headers[13]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%10s", headers[14]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%9s", headers[15]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%12s", headers[16]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%15s", headers[17]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%9s", headers[18]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%10s", headers[19]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%16s", headers[20]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%17s", headers[21]));
-					buffer.append(fieldSeparator);
-					buffer.append(String.format("%-17s", headers[22]));
-					buffer.append(fieldSeparator);
-				}
-
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(260);
-		}
-
-		buffer.append(String.format("%5s", taskStats.getJobID()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%7s", taskStats.getTaskID()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%7s", taskStats.getUserDN()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%14s", taskStats.getResName()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%7d", taskStats.getCpuCnt()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%14d",
-				Double.valueOf(taskStats.getExecStartDate()).longValue()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%15d",
-				Double.valueOf(taskStats.getExecFinishDate()).longValue()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%13d",
-				Double.valueOf(taskStats.getExecEndDate()).longValue()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%13d",
-				Double.valueOf(taskStats.getGB_SubDate()).longValue()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%13d",
-				Double.valueOf(taskStats.getLB_SubDate()).longValue()));
-		buffer.append(fieldSeparator);
-
-		if (this.useExtended) {
-			buffer.append(String.format("%15d",
-					Double.valueOf(taskStats.getCompletionTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%14d",
-					Double.valueOf(taskStats.getExecStartTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%14d",
-					Double.valueOf(taskStats.getExecutionTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%10d",
-					Double.valueOf(taskStats.getReadyTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%10d",
-					Double.valueOf(taskStats.getStartTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%9d",
-					Double.valueOf(taskStats.getFlowTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%12d",
-					Double.valueOf(taskStats.getWaitingTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%15d",
-					Double.valueOf(taskStats.getGQ_WaitingTime()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%9d",
-					Double.valueOf(taskStats.getLateness()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%10d",
-					Double.valueOf(taskStats.getTardiness()).longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%16d",
-					Double.valueOf(taskStats.getReservationStartDate())
-							.longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%17d",
-					Double.valueOf(taskStats.getReservationFinishDate())
-							.longValue()));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%-17s", taskStats.getProcessorsName()));
-			buffer.append(fieldSeparator);
-
-		}
-
-		return buffer.toString();
-	}
-
-	public String visit(JobStats jobStats) {
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add("jobStats")) {
-			buffer = new StringBuffer(200);
-			String[] headers = jobStats.getHeaders();
-			if (headers.length == 10) {
-
-				buffer.append(String.format("%5s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%23s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%22s", headers[2]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%18s", headers[3]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%17s", headers[4]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%20s", headers[5]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%23s", headers[6]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%9s", headers[7]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%10s", headers[8]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%9s", headers[9]));
-				buffer.append(fieldSeparator);
-
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(100);
-		}
-
-		buffer.append(String.format("%5s", jobStats.getJobID()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%23s", defaultNumberFormat.format(jobStats
-				.getMeanTaskCompletionTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%22s", defaultNumberFormat.format(jobStats
-				.getMeanTaskExecutionTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%18s", defaultNumberFormat.format(jobStats
-				.getMeanTaskStartTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%17s", defaultNumberFormat.format(jobStats
-				.getMeanTaskFlowTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%20s", defaultNumberFormat.format(jobStats
-				.getMeanTaskWaitingTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%23s", defaultNumberFormat.format(jobStats
-				.getMeanTaskGQ_WaitingTime().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%9s",
-				defaultNumberFormat.format(jobStats.getTardiness().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%10s",
-				defaultNumberFormat.format(jobStats.getLateness().getMean())));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%9s",
-				defaultNumberFormat.format(jobStats.getMakespan().getMean())));
-		buffer.append(fieldSeparator);
-
-		return buffer.toString();
-	}
-
-	public String visit(ResourceStats resourceStats) {
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add("resourceStats")) {
-			buffer = new StringBuffer(600);
-			String[] headers = resourceStats.getHeaders();
-			if (headers.length == 7) {
-
-				buffer.append(String.format("%-20s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%6s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%3s", headers[2]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%9s", headers[3]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%12s", headers[4]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%-120s", headers[5]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%-120s", headers[6]));
-				buffer.append(fieldSeparator);
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(300);
-		}
-
-		buffer.append(String.format("%-20s", resourceStats.getResourceName()));
-		buffer.append(fieldSeparator);
-
-		buffer.append(String.format("%6d", resourceStats.getMemory()));
-		buffer.append(fieldSeparator);
-
-		buffer.append(String.format("%3d", resourceStats.getCpucnt()));
-		buffer.append(fieldSeparator);
-
-		buffer.append(String.format("%9d", resourceStats.getCpuspeed()));
-		buffer.append(fieldSeparator);
-
-		buffer.append(String.format("%-12s",
-				DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT
-						.format(resourceStats.getQueueLength())));
-		buffer.append(fieldSeparator);
-
-		StringBuffer tempBuffer = new StringBuffer();
-		
-		/*Map<String, Double> processorsLoad = resourceStats.getProcessorsLoad();
-		for (String processorName : processorsLoad.keySet()) {
-
-			Double load = processorsLoad.get(processorName);
-			tempBuffer.append(String.format("%-12s", processorName));
-			tempBuffer.append(" ");
-			tempBuffer.append(String.format("%-5s", GridSchedulingSimulator.DFAULT_NUMBER_FORMAT
-					.format(load)));
-			tempBuffer.append(": ");
-
-		}*/
-		
-		buffer.append(String.format("%-120s", tempBuffer.toString()));
-		buffer.append(fieldSeparator);
-		
-		tempBuffer = new StringBuffer();
-		
-		Map<String, Double> processorsReservationLoad = resourceStats
-				.getProcessorsReservationLoad();
-		for (String processorName : processorsReservationLoad.keySet()) {
-
-			Double reservationLoad = processorsReservationLoad
-					.get(processorName);
-			tempBuffer.append(String.format("%-12s", processorName));
-			tempBuffer.append(" ");
-			tempBuffer.append(String.format("%-5s", DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT
-					.format(reservationLoad)));
-			tempBuffer.append(": ");
-		}
-		buffer.append(String.format("%-120s", tempBuffer.toString()));
-		buffer.append(fieldSeparator);
-		return buffer.toString();
-	}
-
-	public String visit(AccumulatedResourceStats accResStats) {
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add("accResStats")) {
-			buffer = new StringBuffer(340);
-			String[] headers = accResStats.getHeaders();
-			if (headers.length == 9) {
-
-				buffer.append(String.format("%-27s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%-27s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[2]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[3]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[4]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[5]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[6]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[7]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[8]));
-				buffer.append(fieldSeparator);
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(170);
-		}
-
-		buffer.append(String.format("%-27s", accResStats.getResourceName()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%-27s", "load"));
-		buffer.append(accResStats.getResourceLoad().toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-27s", accResStats.getResourceName()));
-		buffer.append(fieldSeparator);
-		buffer.append(String.format("%-27s", "reservationload"));
-		buffer.append(accResStats.getResourceReservationLoad()
-				.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-
-		return buffer.toString();
-	}
-
-	public Object visit(ResourceUsageStats resourceUsageStats) {
-		Map<Long, Integer> resourceUsage = resourceUsageStats.getUsage();
-
-		int mapSize = resourceUsage.size();
-		/*
-		 * FIXME: Integer.MAX_VALUE = 2147483647. We assume, that each line
-		 * contains max 30 signs - this gives max 71582788 lines. If
-		 * resourceUsage map contains more elements then we have a problem,
-		 * because content of resourceUsage map will not fit in the buffer. This
-		 * will need further attention in the future.
-		 */
-		int maxSize = (Integer.MAX_VALUE / 30) - 1;
-		if (mapSize >= maxSize) {
-			log.error("Resource usage data is to long to fit in the buffer.");
-			return null;
-		}
-
-		int size = 30 * resourceUsage.size();
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add(resourceUsageStats.getResourceType().getName())) {
-			buffer = new StringBuffer(size + 42);
-			String[] headers = resourceUsageStats.getHeaders();
-			if (headers.length == 3) {
-
-				buffer.append(String.format("%-20s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%15s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%5s", headers[2]));
-				buffer.append(fieldSeparator);
-
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(size);
-		}
-
-		for (Long timestamp : resourceUsage.keySet()) {
-
-			buffer.append(String.format("%-20s",
-					resourceUsageStats.getResourceName()));
-			buffer.append(fieldSeparator);
-			Integer value = resourceUsage.get(timestamp);
-			buffer.append(String.format("%15d", timestamp));
-			buffer.append(fieldSeparator);
-			buffer.append(String.format("%5s",
-					DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT.format(value)));
-			buffer.append(fieldSeparator);
-			buffer.append(System.getProperty("line.separator"));
-
-		}
-
-		return buffer.toString();
-	}
-
-	
-	public Object visit(GSSAccumulatorsStats accStats) {
-
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add("accStats")) {
-			buffer = new StringBuffer(2800);
-			String[] headers = accStats.getHeaders();
-			if (headers.length == 8) {
-
-				buffer.append(String.format("%-26s", headers[0]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[1]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[2]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[3]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[4]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[5]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[6]));
-				buffer.append(fieldSeparator);
-				buffer.append(String.format("%16s", headers[7]));
-				buffer.append(fieldSeparator);
-			} else {
-				buffer.append(headers.toString());
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(1400);
-		}
-
-		buffer.append(String.format("%-26s", "Delayed tasks"));
-		buffer.append(accStats.delayedTasks.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Failed requests (tasks)"));
-		buffer.append(accStats.failedRequests.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Makespan"));
-		buffer.append(accStats.makespan.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Resources queue length"));
-		buffer.append(accStats.meanQueueLength.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Resources total load"));
-		buffer.append(accStats.meanTotalLoad.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Resources reservation load"));
-		buffer.append(accStats.meanReservationLoad.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Energy usage"));
-		buffer.append(accStats.meanEnergyUsage.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task completion time"));
-		buffer.append(accStats.meanTaskCompletionTime.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task execution time"));
-		buffer.append(accStats.meanTaskExecutionTime.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task start time"));
-		buffer.append(accStats.meanTaskStartTime.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task flow time"));
-		buffer.append(accStats.meanTaskFlowTime.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task waiting time"));
-		buffer.append(accStats.meanTaskWaitingTime.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task lateness"));
-		buffer.append(accStats.lateness.toFormatedString());
-		buffer.append(System.getProperty("line.separator"));
-		buffer.append(String.format("%-26s", "Task tardiness"));
-		buffer.append(accStats.tardiness.toFormatedString());
-
-		return buffer.toString();
-
-	}
-
-	public Object visit(ResourceEnergyStats resourceEnergyStats) {
-		Map<Long, Double> resourceEnergy = resourceEnergyStats.getEnergy();
-		
-		int mapSize = resourceEnergy.size();
-		/*
-		 * FIXME:
-		 * Integer.MAX_VALUE = 2147483647. We assume, that each line contains 
-		 * max 30 signs - this gives max 71582788 lines. If resourceUsage map
-		 * contains more elements then we have a problem, because content of
-		 * resourceUsage map will not fit in the buffer.
-		 * This will need further attention in the future.
-		 */
-		int maxSize = (Integer.MAX_VALUE / 30 ) - 1;
-		if(mapSize >= maxSize){
-			log.error("Resource usage data is to long to fit in the buffer.");
-			return null;
-		}
-		
-		int size = 30 * resourceEnergy.size();
-		
-		StringBuffer buffer = null;
-
-		if(printedHeaders.add(resourceEnergyStats.getUsageType())) {
-			buffer = new StringBuffer(size + 42);
-			String[] headers = resourceEnergyStats.getHeaders();
-			for(int i = 0; i < headers.length; i++)
-			{
-				buffer.append(headers[i]);
-				buffer.append(fieldSeparator);
-			}
-			buffer.append(System.getProperty("line.separator"));
-		} else {
-			buffer = new StringBuffer(size);
-		}
-		
-		
-		for (Long timestamp : resourceEnergy.keySet()) {
-			
-			buffer.append(resourceEnergyStats.getResourceName());
-			buffer.append(fieldSeparator);
-			Double value = resourceEnergy.get(timestamp);
-			buffer.append(timestamp);
-			buffer.append(fieldSeparator);
-			buffer.append(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT
-					.format(value));
-			buffer.append(fieldSeparator);
-			buffer.append(System.getProperty("line.separator"));
-
-		}
-		buffer.append("mean: "+resourceEnergyStats.getMeanUsage() + " sum: " +resourceEnergyStats.getSumUsage());
-		buffer.append(System.getProperty("line.separator"));
-
-		return buffer.toString();
-	}
-}
Index: DCWoRMS/trunk/src/simulator/stats/implementation/DCWormsStatistics.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 494)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 495)
@@ -62,4 +62,5 @@
 import schedframe.resources.computing.extensions.ExtensionType;
 import schedframe.resources.computing.profiles.energy.EnergyExtension;
+import schedframe.resources.computing.profiles.energy.airthroughput.AirFlowValue;
 import schedframe.resources.computing.profiles.energy.power.PowerUsage;
 import schedframe.resources.units.PEUnit;
@@ -81,5 +82,4 @@
 import simulator.stats.SimulationStatistics;
 import simulator.stats.implementation.out.AbstractStringSerializer;
-import simulator.stats.implementation.out.FormatedStringSerializer;
 import simulator.stats.implementation.out.StringSerializer;
 import csiro.mit.utils.jfreechart.timetablechart.TimetableChartFactory;
@@ -98,6 +98,5 @@
 	protected static float ALPHA = 0.5f;
 	protected static int GANTT_WIDTH = 1200;
-
-	//protected static final int BITS = 8;
+	
 	protected static final int MILLI_SEC = 1000;
 
@@ -106,6 +105,7 @@
 
 	protected static final String SIMULATION_STATISTICS_OUTPUT_FILE_NAME = "Simulation.txt";
-	protected static final String ENERGYUSAGE_STATISTICS_OUTPUT_FILE_NAME = "Energy.txt";
-	protected static final String RESOURCEUSAGE_STATISTICS_OUTPUT_FILE_NAME = "ResourceUtilization.txt";
+	protected static final String RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME = "ResourceUtilization.txt";
+	protected static final String ENERGYUSAGE_STATISTICS_OUTPUT_FILE_NAME = "EnergyUsage.txt";
+	protected static final String AIRFLOW_STATISTICS_OUTPUT_FILE_NAME = "AirThroughput.txt";
 
 	protected static final String DIAGRAMS_FILE_NAME_PREFIX = "Chart_";
@@ -123,5 +123,5 @@
 	protected Map<String, GSSAccumulator> statsData;
 	
-	private GenericUser users;
+	protected GenericUser users;
 	protected ResourceController resourceController;
 	protected boolean generateDiagrams = true;
@@ -132,5 +132,6 @@
 	//RESOURCES
 	protected Timetable ganttDiagramPeTimetable;
-	protected Map<ResourceType, List<XYDataset>> resourceEnergyDiagrams;
+	protected Map<ResourceType, List<XYDataset>> resourcePowerUsageDiagrams;
+	protected Map<ResourceType, List<XYDataset>> resourceAirFlowDiagrams;
 	protected Map<ResourceType, List<XYDataset>> resourceLoadDiagrams;
 	protected Map<String,List<ResStat>> basicResStats;
@@ -161,11 +162,9 @@
 		this.outputFolderName = outputFolderName;
 
-
 		this.serializer = new StringSerializer();
-
 		this.serializer.setDefaultNumberFormat(DataCenterWorkloadSimulator.DFAULT_NUMBER_FORMAT);
 
 		this.resourceController = resourceController;
-		jr = new JobRegistryImpl("");
+		this.jr = new JobRegistryImpl("");
 		init();
 	}
@@ -174,5 +173,4 @@
 
 		this.startSimulationTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis();
-
 		this.endSimulationTime = DateTimeUtilsExt.currentTimeMillis();
 
@@ -235,7 +233,4 @@
 	private void gatherResourceStatistics() {
 		
-		
-		//TEMPORARY CONFIGURATION SECTION
-		
 		HashMap<String, List<Stats>> type_stats = new HashMap<String, List<Stats>>();
 		
@@ -248,13 +243,16 @@
 			if(ArrayUtils.contains(configuration.resForEnergyChart, resourceName))
 				cStats.add(Stats.chartEnergy);
+			cStats.add(Stats.textAirFlow);
+			if(ArrayUtils.contains(configuration.resForAirFlowChart, resourceName))
+				cStats.add(Stats.chartAirFlow);
 			type_stats.put(resourceName, cStats);
 		}		
 		
 		peGanttMap = new HashMap<String, TimetableEventSource>();
-		taskGanttMap = new HashMap<String, TimetableEventGroup>();
-		
+		taskGanttMap = new HashMap<String, TimetableEventGroup>();		
 		
 		resourceLoadDiagrams = new HashMap<ResourceType, List<XYDataset>>();
-		resourceEnergyDiagrams = new HashMap<ResourceType, List<XYDataset>>();
+		resourcePowerUsageDiagrams = new HashMap<ResourceType, List<XYDataset>>();
+		resourceAirFlowDiagrams = new HashMap<ResourceType, List<XYDataset>>();
 		
 		ganttDiagramPeTimetable = new Timetable(new FixedMillisecond(
@@ -265,5 +263,5 @@
 			File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX
 					+ simulationIdentifier + "_"
-					+ RESOURCEUSAGE_STATISTICS_OUTPUT_FILE_NAME);
+					+ RESOURCEUTILIZATION_STATISTICS_OUTPUT_FILE_NAME);
 			resourceLoadStatsFile = new PrintStream(new FileOutputStream(file));
 		} catch (IOException e) {
@@ -280,5 +278,15 @@
 			energyStatsFile = null;
 		}
-		JobRegistry jr = new JobRegistryImpl("stats");
+		
+		PrintStream airFlowStatsFile = null;
+		try {
+			File file = new File(outputFolderName + STATS_FILE_NAME_PREFIX
+					+ simulationIdentifier + "_"
+					+ AIRFLOW_STATISTICS_OUTPUT_FILE_NAME);
+			airFlowStatsFile = new PrintStream(new FileOutputStream(file));
+		} catch (IOException e) {
+			airFlowStatsFile = null;
+		}
+
 		basicResStats = gatherPEStats(jr.getExecutableTasks());
 		peStatsPostProcessing(basicResStats);
@@ -291,20 +299,17 @@
 		for(String resourceName: resourceController.getComputingResourceLayers()){
 			List<ComputingResource> resources = null;
-			try {
-				resources = new ArrayList<ComputingResource>();
-				for(ComputingResource compRes: resourceController.getComputingResources() ){
-					resources.addAll(compRes.getDescendantsByType(new UserResourceType(resourceName)));
-				}
-				if(resourceController.getComputingResources().get(0).getType().getName().equals(resourceName))
-					resources.addAll(resourceController.getComputingResources());
-			} catch (Exception e) {
-				continue;
-			}
+
+			resources = new ArrayList<ComputingResource>();
+			for(ComputingResource compRes: resourceController.getComputingResources() ){
+				resources.addAll(compRes.getDescendantsByType(new UserResourceType(resourceName)));
+			}
+			if(resourceController.getComputingResources().get(0).getType().getName().equals(resourceName))
+				resources.addAll(resourceController.getComputingResources());
+		
 			if(type_stats.containsKey(resourceName)){
-				Map<String, GSSAccumulator> energyCategoryStats = new TreeMap<String, GSSAccumulator>();
-				Map<String, GSSAccumulator> loadCategoryStats = new TreeMap<String, GSSAccumulator>();
 				for(ComputingResource resource: resources){
 					ResourceUsageStats resourceUsage = null;
 					ResourceEnergyStats energyUsage = null;
+					ResourceAirFlowStats airFlow = null;
 					if(type_stats.get(resourceName).contains(Stats.textLoad)){
 						resourceUsage = gatherResourceLoadStats(resource, basicResStats);
@@ -358,67 +363,41 @@
 					}
 					
-					/*if(resType == ResourceType.ComputingNode){
-						ComputingNode compNode = (ComputingNode) resource;
-						if(energyCategoryStats.containsKey(resType+"#"+compNode.getCategory().getName())){
-							GSSAccumulator acc = energyCategoryStats.get(resType+"#"+compNode.getCategory().getName());
-							acc.add(energyUsage.meanUsage);
-							energyCategoryStats.put(resType+"#"+compNode.getCategory().getName(), acc);
-						} else{
-							GSSAccumulator acc = new GSSAccumulator();
-							acc.add(energyUsage.meanUsage);
-							energyCategoryStats.put(resType+"#"+compNode.getCategory().getName(), acc);
+					if(type_stats.get(resourceName).contains(Stats.textAirFlow)){
+						airFlow = gatherResourceAirFlowStats(resource);
+						airFlow.setMeanUsage(calculateAirFlowLoad(airFlow));
+						airFlow.setSumUsage(airFlow.getMeanUsage() * (endSimulationTime - startSimulationTime) / (3600 * MILLI_SEC));
+						
+						EnergyExtension een = (EnergyExtension)(resource.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION));
+						if(resourceController.getComputingResources().contains(resource)) {
+							if( een != null /*&& een.getPp() != null*/ ){
+								accStats.meanAirFlow.add(airFlow.meanValue);
+							}
+
+						} else if( een != null && een.getAirFlowProfile() != null ){
+							ComputingResource parent = resource.getParent();
+							een = (EnergyExtension)(parent.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION));
+							boolean top = true;
+							while(parent != null){
+								if(een != null &&  een.getAirFlowProfile() != null) {
+									top = false;
+									break;
+								}
+								parent = parent.getParent();
+							}
+							if(top == true){
+								accStats.meanAirFlow.add(airFlow.meanValue);
+							}
 						}
-						
-						if(loadCategoryStats.containsKey(resType+"#"+compNode.getCategory().getName())){
-							GSSAccumulator acc = loadCategoryStats.get(resType+"#"+compNode.getCategory().getName());
-							acc.add(resourceUsage.meanUsage);
-							loadCategoryStats.put(resType+"#"+compNode.getCategory().getName(), acc);
-						} else{
-							GSSAccumulator acc = new GSSAccumulator();
-							acc.add(resourceUsage.meanUsage);
-							loadCategoryStats.put(resType+"#"+compNode.getCategory().getName(), acc);
+						if (airFlowStatsFile != null) {
+							Object txt = airFlow.serialize(serializer);
+							airFlowStatsFile.println(txt);
 						}
-					} else if(resType == ResourceType.Processor){
-						Processor proc = (Processor)resource;
-						if(energyCategoryStats.containsKey(resType+"#"+proc.getComputingNode().getCategory().getName())){
-							GSSAccumulator acc = energyCategoryStats.get(resType+"#"+proc.getComputingNode().getCategory().getName());
-							acc.add(energyUsage.meanUsage);
-							energyCategoryStats.put(resType+"#"+proc.getComputingNode().getCategory().getName(), acc);
-						} else{
-							GSSAccumulator acc = new GSSAccumulator();
-							acc.add(energyUsage.meanUsage);
-							energyCategoryStats.put(resType+"#"+proc.getComputingNode().getCategory().getName(), acc);
+					}
+					if(type_stats.get(resourceName).contains(Stats.chartAirFlow)){
+
+						if (configuration.creatediagrams_airflow) {
+							createResourceAirFlowGanttDiagram(airFlow);
 						}
-						
-						if(loadCategoryStats.containsKey(resType+"#"+proc.getComputingNode().getCategory().getName())){
-							GSSAccumulator acc = loadCategoryStats.get(resType+"#"+proc.getComputingNode().getCategory().getName());
-							acc.add(resourceUsage.meanUsage);
-							loadCategoryStats.put(resType+"#"+proc.getComputingNode().getCategory().getName(), acc);
-						} else{
-							GSSAccumulator acc = new GSSAccumulator();
-							acc.add(resourceUsage.meanUsage);
-							loadCategoryStats.put(resType+"#"+proc.getComputingNode().getCategory().getName(), acc);
-						}
-					}*/
-				}
-				
-				if(energyCategoryStats.size() > 0)
-				{
-					energyStatsFile.println("\n=========BY CATEGORY===========");
-					for(String key: energyCategoryStats.keySet()){
-						GSSAccumulator acc = energyCategoryStats.get(key);
-						energyStatsFile.println(key + "- mean: "  + acc.getMean()+ " sum: " +acc.getMean() * (endSimulationTime-startSimulationTime) / (3600 * MILLI_SEC) * acc.getCount());
 					}
-					energyStatsFile.println("\n\n");
-				}
-				
-				if(loadCategoryStats.size() > 0)
-				{
-					resourceLoadStatsFile.println("\n=========BY CATEGORY===========");
-					for(String key: loadCategoryStats.keySet()){
-						GSSAccumulator acc = loadCategoryStats.get(key);
-						resourceLoadStatsFile.println(key + "- mean: "  + acc.getMean());
-					}
-					resourceLoadStatsFile.println("\n\n");
 				}
 			}
@@ -427,4 +406,7 @@
 		saveResourceGanttDiagrams();
 		createAccumulatedResourceSimulationStatistic();
+		if (airFlowStatsFile != null) {
+			airFlowStatsFile.close();
+		}
 		if (energyStatsFile != null) {
 			energyStatsFile.close();
@@ -472,10 +454,9 @@
 		}
 	}
+	
 	private Map<String, List<ResStat>> gatherPEStats( ExecutablesList executables) {
-
 		
 		Map<String, List<ResStat>> basicResStats = new TreeMap<String, List<ResStat>>(new MapPEIdComparator());
-		//Map<Integer, Map<String, Object>> history
-		
+
 		for (ExecTask execTask:executables) {
 			Executable exec = (Executable) execTask;
@@ -485,5 +466,5 @@
 			ResourceUnit resUnit = res.get(StandardResourceUnitName.PE);
 			//ProcessingElements pes = (ProcessingElements) resUnit ;
-			if(resUnit instanceof ProcessingElements ){
+			if(resUnit instanceof ProcessingElements){
 				ProcessingElements pes = (ProcessingElements) resUnit;
 				for(ComputingResource pe: pes){
@@ -491,5 +472,4 @@
 					long startDate = Double.valueOf(exec.getExecStartTime()).longValue() * MILLI_SEC;
 					long endDate = Double.valueOf(exec.getFinishTime()).longValue() * MILLI_SEC;
-
 
 					String uniqueTaskID = execTask.getJobId() + "_" + execTask.getId();
@@ -525,7 +505,9 @@
 	private ResourceUsageStats gatherResourceLoadStats(ComputingResource resource, Map<String,List<ResStat>> basicStats) {
 		ResourceUsageStats usageStats = new ResourceUsageStats(resource.getName(), resource.getType(), "resourceLoadStats");
+		int cnt =0;
 		for(String resName: basicStats.keySet()){
 			try {
 				if(resource.getDescendantByName(resName) != null || resource.getName().compareTo(resName) == 0){
+					cnt++;
 					createResourceLoadData(usageStats, basicStats.get(resName));
 				}
@@ -535,10 +517,15 @@
 			}
 		}
+		for(Long key: usageStats.getUsage().keySet()){
+			Double value = usageStats.getUsage().get(key)/cnt;
+			usageStats.getUsage().put(key, value);
+		}
+
 		return usageStats;
 	}
 	
-	private TreeMap<Long, Integer> createResourceLoadData(ResourceUsageStats usageStats, List<ResStat> resStats) {
-
-		TreeMap<Long, Integer> ganttData = (TreeMap)usageStats.getUsage();
+	private TreeMap<Long, Double> createResourceLoadData(ResourceUsageStats usageStats, List<ResStat> resStats) {
+
+		TreeMap<Long, Double> ganttData = (TreeMap<Long, Double>)usageStats.getUsage();
 		for (ResStat resStat : resStats) {
 			
@@ -546,38 +533,39 @@
 			long end_time = resStat.getEndDate();
 			if (end_time > start_time) {
-				Integer end = ganttData.get(end_time);
+				Double end = ganttData.get(end_time);
 				if (end == null) {
-					ganttData.put(end_time, 0);
+					ganttData.put(end_time, 0.0);
 					Long left = getLeftKey(ganttData, end_time);
 					if (left != null) {
-						Integer leftValue = ganttData.get(left);
+						Double leftValue = ganttData.get(left);
 						ganttData.put(end_time, leftValue);
 					}
 				}
 
-				Integer start = ganttData.get(start_time);
+				Double start = ganttData.get(start_time);
 				if (start == null) {
-					ganttData.put(start_time, 0);
+					ganttData.put(start_time, 0.0);
 					Long left = getLeftKey(ganttData, start_time);
 					if (left != null) {
-						Integer leftValue = ganttData.get(left);
+						Double leftValue = ganttData.get(left);
 						ganttData.put(start_time, leftValue);
 					}
 				}
 
-				SortedMap<Long, Integer> sm = ganttData.subMap(start_time,
+				SortedMap<Long, Double> sm = ganttData.subMap(start_time,
 						end_time);
 				for (Long key : sm.keySet()) {
-					Integer keyVal = ganttData.get(key);
+					Double keyVal = ganttData.get(key);
 					ganttData.put(key, keyVal + 1);
 				}
 			}
 		}
+
 		return ganttData;
 	}
 
-	private Long getLeftKey(TreeMap<Long, Integer> ganttData, Long toKey) {
-
-		SortedMap<Long, Integer> sm = ganttData.headMap(toKey);
+	private Long getLeftKey(TreeMap<Long, Double> ganttData, Long toKey) {
+
+		SortedMap<Long, Double> sm = ganttData.headMap(toKey);
 		if (sm.isEmpty()) {
 			return null;
@@ -621,14 +609,46 @@
 	}
 	
-	private void createResourceEnergyGanttDiagram(ResourceEnergyStats energyUsage) {
-
-		XYDataset dataset = createResourceEnergyGanttDataSet(energyUsage,
+	
+	private ResourceAirFlowStats gatherResourceAirFlowStats(ComputingResource resource) {
+
+		ResourceAirFlowStats resAirFlow = new ResourceAirFlowStats(resource.getName(), resource.getType(), "resourceAirFlowStats");
+		Map<Long, Double> airFlow = resAirFlow.getAirFlow();
+		
+		ExtensionList extensionList = resource.getExtensionList();
+		if(extensionList != null){
+			for (Extension extension : extensionList) {
+				if (extension.getType() == ExtensionType.ENERGY_EXTENSION) {
+					EnergyExtension ee = (EnergyExtension)extension;
+					if(ee.getAirFlowProfile() == null)
+						break;
+					List<AirFlowValue> airFlowHistory = ee.getAirFlowProfile().getAirThroughputHistory();
+					if(airFlowHistory.size() == 0)
+						break;
+					long lastTime = DateTimeUtilsExt.getOffsetTime().getTimeInMillis();
+					long endSimulationTime = DateTimeUtilsExt.currentTimeMillis();
+					double lastAirFlow = 0;
+					airFlowHistory.add(new AirFlowValue(endSimulationTime, ee.getAirFlowProfile().getAirThroughputHistory().get(ee.getAirFlowProfile().getAirThroughputHistory().size()-1).getValue()));
+					for(AirFlowValue af:airFlowHistory){
+						airFlow.put(af.getTimestamp(), af.getValue());
+
+						lastAirFlow = af.getValue();
+						lastTime = af.getTimestamp();
+					}
+				}
+			}
+		}
+		return resAirFlow;
+	}
+	
+	private void createResourceEnergyGanttDiagram(ResourceEnergyStats powerUsage) {
+
+		XYDataset dataset = createResourceEnergyGanttDataSet(powerUsage,
 				startSimulationTime, endSimulationTime);
 		
-		List<XYDataset> energyDiagram = resourceEnergyDiagrams.get(energyUsage.getResourceType());
+		List<XYDataset> energyDiagram = resourcePowerUsageDiagrams.get(powerUsage.getResourceType());
 		if(energyDiagram == null){
 			energyDiagram = new ArrayList<XYDataset>();
 			energyDiagram.add(dataset);
-			resourceEnergyDiagrams.put(energyUsage.getResourceType(), energyDiagram);
+			resourcePowerUsageDiagrams.put(powerUsage.getResourceType(), energyDiagram);
 		} else {
 			energyDiagram.add(dataset);
@@ -637,4 +657,20 @@
 	}
 
+	private void createResourceAirFlowGanttDiagram(ResourceAirFlowStats airFlow) {
+
+		XYDataset dataset = createResourceAirFlowGanttDataSet(airFlow,
+				startSimulationTime, endSimulationTime);
+		
+		List<XYDataset> airFlowDiagram = resourceAirFlowDiagrams.get(airFlow.getResourceType());
+		if(airFlowDiagram == null){
+			airFlowDiagram = new ArrayList<XYDataset>();
+			airFlowDiagram.add(dataset);
+			resourceAirFlowDiagrams.put(airFlow.getResourceType(), airFlowDiagram);
+		} else {
+			airFlowDiagram.add(dataset);
+		}
+
+	}
+	
 	private XYDataset createResourceEnergyGanttDataSet(
 			ResourceEnergyStats energyUsage, long start, long end) {
@@ -665,4 +701,30 @@
 	}
 
+	private XYDataset createResourceAirFlowGanttDataSet(
+			ResourceAirFlowStats airFlowStats, long start, long end) {
+
+		TreeMap<Long, Double> ganttdata = createResourceAirFlowGanttData(airFlowStats);
+		XYSeriesCollection dataset = new XYSeriesCollection();
+		XYSeries data = new XYSeries(airFlowStats.getResourceName(), false, true);
+		//data.add(start, 0);
+		for (Long key : ganttdata.keySet()) {
+			Double val = ganttdata.get(key);
+			data.add(key, val);
+		}
+		data.add(end, 0);
+		dataset.addSeries(data);
+		return dataset;
+	}
+
+	private TreeMap<Long, Double> createResourceAirFlowGanttData(
+			ResourceAirFlowStats airFlowStats) {
+
+		Map<Long, Double> airFlow = airFlowStats.getAirFlow();
+		TreeMap<Long, Double> ganttData = new TreeMap<Long, Double>();
+		for (Long afKey : airFlow.keySet()) {
+			ganttData.put(afKey, airFlow.get(afKey));
+		}
+		return ganttData;
+	}
 
 	private boolean saveResourceGanttDiagrams() {
@@ -670,4 +732,5 @@
 		JFreeChart peDiagram = null;
 		JFreeChart resourceEnergyDiagram = null;
+		JFreeChart resourceAirFlowDiagram = null;
 		if (!generateDiagrams)
 			return false;
@@ -701,5 +764,5 @@
 		}
 		if (configuration.creatediagrams_energyusage) {
-			for(ResourceType resType: resourceEnergyDiagrams.keySet()){
+			for(ResourceType resType: resourcePowerUsageDiagrams.keySet()){
 				resourceEnergyDiagram = getResourcesEnergyDiagram(resType, chartName,
 						subtitle, simulationTime);
@@ -708,4 +771,14 @@
 			}
 		}
+		
+		
+		if (configuration.creatediagrams_airflow) {
+			for(ResourceType resType: resourceAirFlowDiagrams.keySet()){
+				resourceAirFlowDiagram = getResourcesAirFlowDiagram(resType, chartName,
+						subtitle, simulationTime);
+				if (!saveXYPlotChart(resourceAirFlowDiagram, fileName + "AirThroughput - "+resType))
+					return false;
+			}
+		}
 		return true;
 	}
@@ -713,5 +786,5 @@
 	private JFreeChart getResourcesLoadDiagram(ResourceType resType, String chartName, Title subtitle,
 			String simulationTime) {
-		String cpu = "CPU";
+		String cpu = "UTILIZATION [%]";
 		boolean urls = false;
 		boolean tooltip = true;
@@ -750,5 +823,5 @@
 		DateAxis xAxis = new DateAxis(simulationTime);
 
-		List<XYDataset> energyDiagram = resourceEnergyDiagrams.get(resType);
+		List<XYDataset> energyDiagram = resourcePowerUsageDiagrams.get(resType);
 		for (XYDataset dataset : energyDiagram) {
 
@@ -759,4 +832,35 @@
 			XYPlot tPlot = tChart.getXYPlot();
 			NumberAxis yAxis = new NumberAxis(energy);
+			yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+			tPlot.setRangeAxis(yAxis);
+			XYStepAreaRenderer rend = (XYStepAreaRenderer) tPlot.getRenderer();
+			rend.setShapesVisible(false);
+			cPlot.add(tPlot);
+		}
+		cPlot.setDomainAxis(xAxis);
+		cPlot.setDomainAxisLocation(AxisLocation.TOP_OR_LEFT);
+		JFreeChart chart = new JFreeChart(chartName, cPlot);
+		chart.addSubtitle(subtitle);
+		return chart;
+	}
+	
+	private JFreeChart getResourcesAirFlowDiagram(ResourceType resType, String chartName,
+			Title subtitle, String simulationTime) {
+		String airFlow = "AIR FLOW [m^3/min]";
+		boolean urls = false;
+		boolean tooltip = true;
+		boolean legend = true;
+		CombinedDomainXYPlot cPlot = new CombinedDomainXYPlot();
+		DateAxis xAxis = new DateAxis(simulationTime);
+
+		List<XYDataset> airFlowDiagram = resourceAirFlowDiagrams.get(resType);
+		for (XYDataset dataset : airFlowDiagram) {
+
+			JFreeChart tChart = ChartFactory.createXYStepAreaChart("", "",
+					null, dataset, PlotOrientation.VERTICAL, legend, tooltip,
+					urls);
+
+			XYPlot tPlot = tChart.getXYPlot();
+			NumberAxis yAxis = new NumberAxis(airFlow);
 			yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
 			tPlot.setRangeAxis(yAxis);
@@ -870,11 +974,11 @@
 		XYSeriesCollection dataset = new XYSeriesCollection();
 		XYSeries data = new XYSeries(resStats.resourceName, false, true);
-		Map<Long, Integer> usage = resStats.getUsage();
+		Map<Long, Double> usage = resStats.getUsage();
 		
 		for (Long key : usage.keySet()) {
-			Integer val = usage.get(key);
-			double newv =100*val/basicResStats.size();
-			int newinv = (int)newv;
-			data.add(key, new Integer(newinv));
+			Double val = usage.get(key);
+			double newv = 100 * val;
+			//System.out.println(newv+":"+val+";"+basicResStats.size());
+			data.add(key, new Double(newv));
 		}
 		dataset.addSeries(data);
@@ -950,4 +1054,25 @@
 	}
 	
+	private double calculateAirFlowLoad(ResourceAirFlowStats resAirFlowStats ){
+		double meanAirFlow = 0;
+		long time = 0;
+		double usage = 0;
+		Map<Long, Double> airFlow = resAirFlowStats.getAirFlow();
+		for (Long key : airFlow.keySet()) {
+			
+			if (time != 0) {
+				meanAirFlow += (usage * (key - time))
+						/ (endSimulationTime - startSimulationTime);
+
+				time = key;
+			} else {
+				time = key;
+			}
+			usage = (double) airFlow.get(key);
+		}
+		return meanAirFlow;
+	}
+	
+	
 	/*private void createPEGanttDiagram(String peName,
 			String uniqueTaskID, Map<String, Object> historyItem) {
@@ -1006,5 +1131,4 @@
 			Job job = (Job) jobs.get(i);
 
-			//List<TaskInterface> execList = JobRegistry.getInstance("COMPUTING_GRID_0#BROKER").getAllSubmittedTasks();
 			List<Executable> execList = jr.getExecutableTasks().getJobExecutables(job.getId());
 			List<TaskStats> taskStatsList = new ArrayList<TaskStats>();
@@ -1346,5 +1470,4 @@
 		statsData.put(RESOURCES_RESERVATION_LOAD, accStats.meanEnergyUsage);
 		statsData.put(RESOURCES_QUEUE_LENGTH, accStats.meanQueueLength);
-
 	}
 
@@ -1417,4 +1540,6 @@
 	chartLoad,
 	textEnergy,
-	chartEnergy;
+	chartEnergy,
+	textAirFlow,
+	chartAirFlow;
 }
Index: DCWoRMS/trunk/src/simulator/stats/implementation/ResourceAirFlowStats.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/ResourceAirFlowStats.java	(revision 495)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/ResourceAirFlowStats.java	(revision 495)
@@ -0,0 +1,66 @@
+package simulator.stats.implementation;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import schedframe.resources.ResourceType;
+import simulator.stats.implementation.out.StatsSerializer;
+
+public class ResourceAirFlowStats {
+	protected Map<Long, Double> airFlow;
+	protected String resourceName;
+	protected String usageType;
+	protected ResourceType resourceType;
+	protected double meanValue;
+	protected double sumValue;
+	
+	public void setSumUsage(double sumUsage) {
+		this.sumValue = sumUsage;
+	}
+
+	public double getSumUsage() {
+		return sumValue;
+	}
+	public void setMeanUsage(double meanUsage) {
+		this.meanValue = meanUsage;
+	}
+	
+	public double getMeanUsage() {
+		return meanValue;
+	}
+	
+	private String[] headers = { "resourceName", "timestamp", "value" };
+	
+	public ResourceAirFlowStats (String resourceName, ResourceType resourceType, String usageType) {
+		this.resourceName = resourceName;
+		this.resourceType = resourceType;
+		this.usageType = usageType;
+		this.airFlow = new TreeMap<Long, Double>();
+		this.meanValue = 0;
+	}
+
+	public String getResourceName() {
+		return this.resourceName;
+	}
+	
+	public ResourceType getResourceType() {
+		return resourceType;
+	}
+
+	public String getUsageType() {
+		return this.usageType;
+	}	
+
+	public Map<Long, Double> getAirFlow() {
+		return this.airFlow;
+	}
+
+	public Object serialize(StatsSerializer serializer) {
+		return serializer.visit(this);
+	}
+
+	public String[] getHeaders() {
+		return headers;
+	}
+
+}
Index: DCWoRMS/trunk/src/simulator/stats/implementation/ResourceUsageStats.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/ResourceUsageStats.java	(revision 477)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/ResourceUsageStats.java	(revision 495)
@@ -15,5 +15,5 @@
 public class ResourceUsageStats implements StatsInterface {
 
-	protected Map<Long, Integer> usage;
+	protected Map<Long, Double> usage;
 	protected String resourceName;
 	protected String usageType;
@@ -31,5 +31,5 @@
 		this.resourceType = resourceType;
 		this.usageType = usageType;
-		this.usage = new TreeMap<Long, Integer>();
+		this.usage = new TreeMap<Long, Double>();
 		this.meanUsage = 0;
 	}
@@ -51,5 +51,5 @@
 	}	
 
-	public Map<Long, Integer> getUsage() {
+	public Map<Long, Double> getUsage() {
 		return this.usage;
 	}
Index: DCWoRMS/trunk/src/simulator/stats/implementation/GSSAccumulatorsStats.java
===================================================================
--- DCWoRMS/trunk/src/simulator/stats/implementation/GSSAccumulatorsStats.java	(revision 477)
+++ DCWoRMS/trunk/src/simulator/stats/implementation/GSSAccumulatorsStats.java	(revision 495)
@@ -10,4 +10,5 @@
 	public GSSAccumulator meanQueueLength;
 	public GSSAccumulator meanEnergyUsage;
+	public GSSAccumulator meanAirFlow;
 
 	public GSSAccumulator meanTaskStartTime;
@@ -29,5 +30,6 @@
 		meanReservationLoad = new GSSAccumulator();
 		meanQueueLength = new GSSAccumulator();
-		meanEnergyUsage = new GSSAccumulator();
+		meanEnergyUsage = new GSSAccumulator(); 
+		meanAirFlow = new GSSAccumulator(); 
 
 		meanTaskStartTime = new GSSAccumulator();
