|
@@ -242,9 +242,10 @@ public class controlAlgorithm implements AddOn {
|
|
|
*/
|
|
|
private void initAlgo() {
|
|
|
try {
|
|
|
-
|
|
|
// init
|
|
|
- SPC = new StorageProductionController(getStorageElements());// DANGER DONT GIVE NULL
|
|
|
+// SPC = new StorageProductionController(getStorageElements());// DANGER DONT GIVE NULL
|
|
|
+ control.getModel().setStorageProductionController();
|
|
|
+ SPC = control.getModel().getStorageProductionController();
|
|
|
renewableProducers = getRenewableProducers();
|
|
|
consumers = getConsumers();
|
|
|
powerPlant = getPowerPlant();// DANGER DONT GIVE NULL
|
|
@@ -284,7 +285,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
blackstartStartTime = Integer.parseInt(blackstartStartTimeTextfield.getText());
|
|
|
control.getModel().setIterations(Integer.parseInt(simulationDurationTextfield.getText()));
|
|
|
for (StorageElement se :
|
|
|
- getStorageElements()) {
|
|
|
+ control.getModel().getStorageElements()) {
|
|
|
se.setStateOfCharge(Integer.parseInt(storageStartCharge.getText()));
|
|
|
}
|
|
|
|
|
@@ -349,7 +350,9 @@ public class controlAlgorithm implements AddOn {
|
|
|
/**
|
|
|
* TODO:HOLEG UNTERVERSORGUNG CHECKEN
|
|
|
* TODO: storage laden
|
|
|
- * TODO: run houses / elements from storage
|
|
|
+ * TODO: run houses / elements from storage storage entladen
|
|
|
+ * TODO: storage im GUI hinzufuegen
|
|
|
+ * TODO: prios fuer elemente anschalten
|
|
|
*
|
|
|
* @param curIteration
|
|
|
* @return true or false depending on whether the blackstart was successful for
|
|
@@ -382,7 +385,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
|
|
|
private HolonObject getPowerPlant() {
|
|
|
- for (AbstractCpsObject cps : control.getModel().getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
// geht nur wenn nur ein power plant vorhanden ist
|
|
|
if (cps instanceof HolonObject) {
|
|
|
if (cps.getObjName().equals("Power Plant")) {
|
|
@@ -393,27 +396,6 @@ public class controlAlgorithm implements AddOn {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private ArrayList<StorageElement> getStorageElements() {
|
|
|
- ArrayList<StorageElement> storageElements = new ArrayList<StorageElement>();
|
|
|
- for (HolonObject holonObject : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
-// if(holonObject.getName().contentEquals("House")) {
|
|
|
-// holonObject.addElement(new StorageElement("Storage", 1, 0, control.getModel()));
|
|
|
-// }
|
|
|
- for (HolonElement ele : holonObject.getElements()) {
|
|
|
- if(ele instanceof StorageElement){
|
|
|
- storageElements.add((StorageElement) ele);
|
|
|
- }
|
|
|
-// if (ele.getEleName().equals("Storage")) {
|
|
|
-// println(ele.getEleName() + "is : " + ele.getClass());
|
|
|
-// if (ele instanceof StorageElement) {
|
|
|
-// println("boomboomboomboom");
|
|
|
-// }
|
|
|
-// }
|
|
|
- }
|
|
|
- }
|
|
|
- return storageElements;
|
|
|
- }
|
|
|
-
|
|
|
private void setDistanceToCalcResistance() {
|
|
|
|
|
|
if (powerPlant != null) {
|