|
@@ -243,12 +243,12 @@ public class controlAlgorithm implements AddOn {
|
|
private void initAlgo() {
|
|
private void initAlgo() {
|
|
try {
|
|
try {
|
|
// init
|
|
// init
|
|
-// SPC = new StorageProductionController(getStorageElements());// DANGER DONT GIVE NULL
|
|
|
|
- control.getModel().setStorageProductionController();
|
|
|
|
- SPC = control.getModel().getStorageProductionController();
|
|
|
|
|
|
+ SPC = new StorageProductionController(getStorageElements());// DANGER DONT GIVE NULL
|
|
|
|
+// control.getModel().setStorageProductionController();
|
|
|
|
+// SPC = control.getModel().getStorageProductionController();
|
|
renewableProducers = getRenewableProducers();
|
|
renewableProducers = getRenewableProducers();
|
|
consumers = getConsumers();
|
|
consumers = getConsumers();
|
|
- powerPlant = getPowerPlant();// DANGER DONT GIVE NULL
|
|
|
|
|
|
+ powerPlant = control.getSimManager().getPowerPlant();// DANGER DONT GIVE NULL
|
|
if(powerPlant == null){
|
|
if(powerPlant == null){
|
|
println("No Power Plant in Model");
|
|
println("No Power Plant in Model");
|
|
return;
|
|
return;
|
|
@@ -262,7 +262,7 @@ public class controlAlgorithm implements AddOn {
|
|
/////////
|
|
/////////
|
|
setPowerplantProduction(0);
|
|
setPowerplantProduction(0);
|
|
enableAllConsumers();
|
|
enableAllConsumers();
|
|
- SPC.disableStorageProduction(-1); //disable all storage production
|
|
|
|
|
|
+ SPC.disableStorageDischarging(-1); //disable all storage production
|
|
|
|
|
|
// StorageElement ele = new StorageElement("Storage", 1, 0, control.getModel());
|
|
// StorageElement ele = new StorageElement("Storage", 1, 0, control.getModel());
|
|
// ele.setStatusAndSetEnergy(Mode.EMIT, 5000);
|
|
// ele.setStatusAndSetEnergy(Mode.EMIT, 5000);
|
|
@@ -285,7 +285,7 @@ public class controlAlgorithm implements AddOn {
|
|
blackstartStartTime = Integer.parseInt(blackstartStartTimeTextfield.getText());
|
|
blackstartStartTime = Integer.parseInt(blackstartStartTimeTextfield.getText());
|
|
control.getModel().setIterations(Integer.parseInt(simulationDurationTextfield.getText()));
|
|
control.getModel().setIterations(Integer.parseInt(simulationDurationTextfield.getText()));
|
|
for (StorageElement se :
|
|
for (StorageElement se :
|
|
- control.getModel().getStorageElements()) {
|
|
|
|
|
|
+ getStorageElements()) {
|
|
se.setStateOfCharge(Integer.parseInt(storageStartCharge.getText()));
|
|
se.setStateOfCharge(Integer.parseInt(storageStartCharge.getText()));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -323,7 +323,7 @@ public class controlAlgorithm implements AddOn {
|
|
blackstartRunningCounter++;
|
|
blackstartRunningCounter++;
|
|
if (blackstartRunningCounter == blackstartSuccessTime) {
|
|
if (blackstartRunningCounter == blackstartSuccessTime) {
|
|
// blackstart was successfull for the needed iterations
|
|
// blackstart was successfull for the needed iterations
|
|
- SPC.disableStorageProduction(-1);
|
|
|
|
|
|
+ SPC.disableStorageDischarging(-1);
|
|
deactivateBlackstart();
|
|
deactivateBlackstart();
|
|
enableAllConsumers();
|
|
enableAllConsumers();
|
|
updateVisual();
|
|
updateVisual();
|
|
@@ -350,9 +350,9 @@ public class controlAlgorithm implements AddOn {
|
|
/**
|
|
/**
|
|
* TODO:HOLEG UNTERVERSORGUNG CHECKEN
|
|
* TODO:HOLEG UNTERVERSORGUNG CHECKEN
|
|
* TODO: storage laden
|
|
* TODO: storage laden
|
|
- * TODO: run houses / elements from storage storage entladen
|
|
|
|
* TODO: storage im GUI hinzufuegen
|
|
* TODO: storage im GUI hinzufuegen
|
|
* TODO: prios fuer elemente anschalten
|
|
* TODO: prios fuer elemente anschalten
|
|
|
|
+ * TODO: elements und amount nachschauen
|
|
*
|
|
*
|
|
* @param curIteration
|
|
* @param curIteration
|
|
* @return true or false depending on whether the blackstart was successful for
|
|
* @return true or false depending on whether the blackstart was successful for
|
|
@@ -363,14 +363,14 @@ public class controlAlgorithm implements AddOn {
|
|
// renewable energy production is not sufficient for the blackstart
|
|
// renewable energy production is not sufficient for the blackstart
|
|
if (SPC.currentPossibleStorageProduction() >= getPowerPlantBlackstartResistance()
|
|
if (SPC.currentPossibleStorageProduction() >= getPowerPlantBlackstartResistance()
|
|
- currentRenewableProduction()) {// is there currently enough power available from storage?
|
|
- currentRenewableProduction()) {// is there currently enough power available from storage?
|
|
- SPC.disableStorageProduction(-1);// emergency fix
|
|
|
|
- SPC.enableStorageProduction(getPowerPlantBlackstartResistance() - currentRenewableProduction());
|
|
|
|
|
|
+ SPC.disableStorageDischarging(-1);// emergency fix
|
|
|
|
+ SPC.enableStorageDischarging(getPowerPlantBlackstartResistance() - currentRenewableProduction());
|
|
rampUpPowerplant();
|
|
rampUpPowerplant();
|
|
enableConsumers(getPowerplantProduction());
|
|
enableConsumers(getPowerplantProduction());
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
// blackstart has failed
|
|
// blackstart has failed
|
|
- SPC.disableStorageProduction(-1);//TODO:disable all
|
|
|
|
|
|
+ SPC.disableStorageDischarging(-1);//TODO:disable all
|
|
println("Not enough storage energy available");
|
|
println("Not enough storage energy available");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -384,16 +384,16 @@ public class controlAlgorithm implements AddOn {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private HolonObject getPowerPlant() {
|
|
|
|
- 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")) {
|
|
|
|
- return (HolonObject) cps;
|
|
|
|
|
|
+ public ArrayList<StorageElement> getStorageElements() {
|
|
|
|
+ ArrayList<StorageElement> storageElements = new ArrayList<StorageElement>();
|
|
|
|
+ for (HolonObject holonObject : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
|
+ for (HolonElement ele : holonObject.getElements()) {
|
|
|
|
+ if(ele instanceof StorageElement){
|
|
|
|
+ storageElements.add((StorageElement) ele);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return null;
|
|
|
|
|
|
+ return storageElements;
|
|
}
|
|
}
|
|
|
|
|
|
private void setDistanceToCalcResistance() {
|
|
private void setDistanceToCalcResistance() {
|
|
@@ -592,16 +592,7 @@ public class controlAlgorithm implements AddOn {
|
|
}
|
|
}
|
|
|
|
|
|
private boolean blackstartRunning() {
|
|
private boolean blackstartRunning() {
|
|
- for (HolonElement ele : powerPlant.getElements()) {
|
|
|
|
- if (ele.getEleName().equals("Blackstart")) {
|
|
|
|
- if (ele.isActive()) {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
|
|
+ return control.getSimManager().blackstartRunning();
|
|
}
|
|
}
|
|
|
|
|
|
private void activateBlackstart() {
|
|
private void activateBlackstart() {
|