Browse Source

refactoring

David Heck 4 years ago
parent
commit
d3740afed2
2 changed files with 9 additions and 19 deletions
  1. 7 17
      src/blackstart/controlAlgorithm.java
  2. 2 2
      src/classes/StorageElement.java

+ 7 - 17
src/blackstart/controlAlgorithm.java

@@ -262,15 +262,11 @@ public class controlAlgorithm implements AddOn {
 			powerplantMaxOutput = Float.parseFloat(powerplantMaxOutputTextfield.getText());
 			blackstartStartTime = Integer.parseInt(blackstartStartTimeTextfield.getText());
 			control.getModel().setIterations(Integer.parseInt(simulationDurationTextfield.getText()));
-			for (StorageElement se :
-					getStorageElements()) {
-				switch (se.getEleName()){
-					case "Storage":
-						se.setStateOfCharge(Float.parseFloat(storageStartCharge.getText()));
-						break;
-					case "Car":
-						se.setStateOfCharge(Float.parseFloat(carStartCharge.getText()));
-						break;
+			for (StorageElement se : getStorageElements()) {
+				if ("Car".equals(se.getEleName())) {
+					se.setStateOfCharge(Float.parseFloat(carStartCharge.getText()));
+				} else {
+					se.setStateOfCharge(Float.parseFloat(storageStartCharge.getText()));
 				}
 			}
 			updateVisual();
@@ -416,12 +412,6 @@ public class controlAlgorithm implements AddOn {
 				}
 			}
 		}
-
-//		if (!SPC.batteriesFull()) {
-//			// TODO: load unused batteries
-//		} else {
-//
-//		}
 	}
 
 	private void enableAllConsumers() {
@@ -557,9 +547,9 @@ public class controlAlgorithm implements AddOn {
 	 * To let the User See the current state without touching the Canvas.
 	 */
 	private void updateVisual() {
-		System.out.println("Start updateVisual in Iteration: " + control.getModel().getCurIteration());
+//		System.out.println("Start updateVisual in Iteration: " + control.getModel().getCurIteration());
 		control.calculateStateAndVisualForCurrentTimeStep();
 		control.updateCanvas();
-		System.out.println("Finish updateVisual in Iteration: " + control.getModel().getCurIteration());
+//		System.out.println("Finish updateVisual in Iteration: " + control.getModel().getCurIteration());
 	}
 }

+ 2 - 2
src/classes/StorageElement.java

@@ -129,7 +129,7 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 	}
 
 	public void stateOfChargeCalculation(){
-		System.out.println("stateofcharge" + getId()+ "before:" + stateOfCharge + " with incomming " + status + " after resi " + getEnergyPerElement() +" before resi "+ chargingRatio);
+//		System.out.println("stateofcharge" + getId()+ "before:" + stateOfCharge + " with incomming " + status + " after resi " + getEnergyPerElement() +" before resi "+ chargingRatio);
 		switch (status){
 			case COLLECT:
 			case EMIT:
@@ -143,7 +143,7 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 			chargingRatio = 0;
 			setEnergyPerElement(0);
 		}
-		System.out.println("stateofcharge after:" + stateOfCharge + " now as " + status + " " + getEnergyPerElement() );
+//		System.out.println("stateofcharge after:" + stateOfCharge + " now as " + status + " " + getEnergyPerElement() );
 	}
 
 	public void setStateOfCharge(float percentage){