Browse Source

readme more detail, fix error handeling when no blackstart element is available

David Heck 4 years ago
parent
commit
49c22b7d6e
2 changed files with 17 additions and 6 deletions
  1. 14 6
      src/blackstart/ControlAlgorithm.java
  2. 3 0
      src/blackstart/README

+ 14 - 6
src/blackstart/ControlAlgorithm.java

@@ -282,11 +282,20 @@ public class ControlAlgorithm implements AddOn {
 //			addCertainKindOfBatteries(Integer.parseInt(addBatteryTextfield.getText()),addBatteryTypeTextfield.getText());
 //			removeCertainKindOfBatteries(Integer.parseInt(removeBatteryTextfield.getText()), removeBatteryTypeTextfield.getText());
 			totalNumberOfHouses = consumers.size();
-			powerplant = control.getSimManager().getPowerplant();// DANGER DONT GIVE NULL
+			lines = new ArrayList<String>();
+			lines.add(fileNameTextfield.getText());
+			if(control.getSimManager().getPowerplant() != null){
+				powerplant = control.getSimManager().getPowerplant();// DANGER DONT GIVE NULL
+			}else{
+				println("No Power plant in model");
+				return;
+			}
 			setPowerPlantBlackstartResistance(-Float.parseFloat(blackstartEnergyrequierementTextfield.getText()));
-			SPC = new StorageProductionController(getStorageElements(), getEnergyRequiredForPowerplantBlackstart());// DANGER DONT GIVE NULL
-			if(powerplant == null){
-				println("No Power Plant in Model");
+			if(getEnergyRequiredForPowerplantBlackstart() != 0){
+				SPC = new StorageProductionController(getStorageElements(), getEnergyRequiredForPowerplantBlackstart());// DANGER DONT GIVE NULL
+
+			}else{
+				println("No blackstart Power Plant in Model");
 				return;
 			}
 			control.getModel().setResistanceCalculator(new ResistanceCalculator(
@@ -322,8 +331,7 @@ public class ControlAlgorithm implements AddOn {
 					se.setStateOfCharge(Float.parseFloat(storageStartCharge.getText()));
 				}
 			}
-			lines = new ArrayList<String>();
-			lines.add(fileNameTextfield.getText());
+
 			file = Paths.get(fileNameTextfield.getText());
 			updateVisual();
 			if (blackstartStartTime + blackstartSuccessTime > control.getModel().getIterations() - 1) {

+ 3 - 0
src/blackstart/README

@@ -1,5 +1,8 @@
 To reproduce the results of the thesis the following steps are required:
 
+
+IMPORTANT: If you want to create your own scenario and not use one I already created you need a power plant object that has a HolonElement with the name Blackstart, otherwise it will not work.
+
 1. Start up HOLEG as usual.
 2. Open a modeled scenario. They are in folder praktikum-holons/src/blackstart/EvalModelsAndResults.
 3. Open the HOLEG algorithm window (ctrl+n)