package memap.main;

import akka.timeManagement.CurrentTimeStepSubscriber;

/**
 * Tracks the progress of the simulation progress, considering both global and
 * per building optimization
 */
public class SimulationProgress implements CurrentTimeStepSubscriber {
	private static final SimulationProgress sp = new SimulationProgress();

	private double progress = 0;
	private final int max = (TopologyConfig.getInstance().getNrDays()
			* TopologyConfig.getInstance().getTimeStepsPerDay()) - 1;

	public void restart() {
		progress = 0;
	}
	
	public static SimulationProgress getInstance() {
		return sp;
	}

	public double getProgress() {
		return progress;
	}

	@Override
	public void update(int currentTimeStep) {
		if (currentTimeStep > progress) {
			progress = currentTimeStep * 100 / max;
		}
	}

}

@@ -91,24 +91,8 @@
 the 
-progress of the 
 simu
@@ -469,12 +469,8 @@
 y())
- - 1
 ;%0A%0A%09
@@ -629,16 +629,28 @@
 progress
+ * 100 / max
 ;%0A%09%7D%0A%0A%09@
@@ -766,28 +766,16 @@
 TimeStep
- * 100 / max
 ;%0A%09%09%7D%0A%09%7D

Fix simulation progress calculation