|
@@ -165,7 +165,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
buttonPanel.add(resetButton);
|
|
|
JButton runButton = new JButton("Run");
|
|
|
runButton.addActionListener(actionEvent -> {
|
|
|
- Runnable task = () -> run();
|
|
|
+ Runnable task = this::run;
|
|
|
runThread = new Thread(task);
|
|
|
runThread.start();
|
|
|
});
|
|
@@ -220,10 +220,6 @@ public class controlAlgorithm implements AddOn {
|
|
|
textArea.setText("");
|
|
|
}
|
|
|
|
|
|
- private void print(String message) {
|
|
|
- textArea.append(message);
|
|
|
- }
|
|
|
-
|
|
|
private void println(String message) {
|
|
|
textArea.append(message + "\n");
|
|
|
}
|
|
@@ -349,10 +345,9 @@ public class controlAlgorithm implements AddOn {
|
|
|
|
|
|
/**
|
|
|
* TODO: HOLEG UNTERVERSORGUNG CHECKEN
|
|
|
- * TODO: storage im GUI hinzufuegen koennen
|
|
|
* TODO: prios fuer elemente anschalten
|
|
|
* TODO: elements und amount nachschauen
|
|
|
- * TODO: batterie status wechesel fuehrt zu unterversorgung in GUI
|
|
|
+ * TODO: batterie status wechesel fuehrt zu unterversorgung in GUI FIX?: in storage if bei charge auskommentieren
|
|
|
* TODO: wie soll ich unter / ueberversorgung handeln vorm blackstart
|
|
|
* TODO: batterie modes wo nicht passiert? obwohl laden / entladen moeglich waere?
|
|
|
* TODO: batterie laden prios? entfernung?
|
|
@@ -388,8 +383,8 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
|
|
|
//TODO: das ist ja eigentlich doppelt
|
|
|
- public ArrayList<StorageElement> getStorageElements() {
|
|
|
- ArrayList<StorageElement> storageElements = new ArrayList<StorageElement>();
|
|
|
+ private ArrayList<StorageElement> getStorageElements() {
|
|
|
+ ArrayList<StorageElement> storageElements = new ArrayList<>();
|
|
|
for (HolonObject holonObject : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
for (HolonElement ele : holonObject.getElements()) {
|
|
|
if(ele instanceof StorageElement){
|
|
@@ -438,22 +433,12 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
}
|
|
|
} else { // at leaf
|
|
|
-// println("Distance to " + currentObject.getId() + ": " + distance);
|
|
|
-// ((HolonObject) currentObject).addElement(new StorageElement("Storage", 1, 0, control.getModel(), 10000, 5000 ,5000));
|
|
|
for (HolonElement ele : ((HolonObject) currentObject).getElements()) {
|
|
|
ele.setDistance(distance);
|
|
|
- if (ele.getEleName() == "Solar Panels") {// TODO: das wollen wir ja so nicht
|
|
|
- ele.setEnergyPerElement(5000);
|
|
|
-// println("Energy: " + ele.getEnergyPerElement());
|
|
|
- // set how much energy is left after resistance22
|
|
|
- ele.setEnergyPerElement(calcEnergyAfterResistance(ele.getEnergyPerElement(), distance));// TODO: das
|
|
|
- // wollen
|
|
|
- // wir ja so
|
|
|
- // auch
|
|
|
- // nicht
|
|
|
-// println("Energy after resistance: " + ele.getEnergyPerElement());
|
|
|
- }
|
|
|
-// println(ele.getId() + " distance to pp " + ele.getDistance());
|
|
|
+// if (ele.getEleName().equals("Solar Panels")) {// TODO: das wollen wir ja so nicht
|
|
|
+// ele.setEnergyPerElement(5000);
|
|
|
+// ele.setEnergyPerElement(calcEnergyAfterResistance(ele.getEnergyPerElement(), distance));
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -568,14 +553,12 @@ public class controlAlgorithm implements AddOn {
|
|
|
return totalProduction;
|
|
|
}
|
|
|
|
|
|
- private float setPowerplantProduction(float power) {
|
|
|
- float totalProduction = 0;
|
|
|
+ private void setPowerplantProduction(float power) {
|
|
|
for (HolonElement ele : powerPlant.getElements()) {
|
|
|
if (ele.getEleName().equals("Power")) {
|
|
|
ele.setEnergyPerElement(power);
|
|
|
}
|
|
|
}
|
|
|
- return totalProduction;
|
|
|
}
|
|
|
|
|
|
private float getPowerPlantBlackstartResistance() {
|
|
@@ -612,7 +595,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
|
|
|
private LinkedList<HolonObject> getRenewableProducers() {
|
|
|
- LinkedList<HolonObject> list = new LinkedList<HolonObject>();
|
|
|
+ LinkedList<HolonObject> list = new LinkedList<>();
|
|
|
for (HolonObject holonObject : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
if (holonObject.getObjName().contentEquals("House")) {// TODO: das reicht so nicht da muss noch gecheckt
|
|
|
// werden ob es renewables gibt
|
|
@@ -623,7 +606,7 @@ public class controlAlgorithm implements AddOn {
|
|
|
}
|
|
|
|
|
|
private LinkedList<HolonObject> getConsumers() {
|
|
|
- LinkedList<HolonObject> list = new LinkedList<HolonObject>();
|
|
|
+ LinkedList<HolonObject> list = new LinkedList<>();
|
|
|
for (HolonObject holonObject : control.getModel().getAllHolonObjectsOnCanvas()) {
|
|
|
if (holonObject.getObjName().contentEquals("House")) {// TODO: das reicht so nicht da muss noch gecheckt
|
|
|
// werden ob es consumer gibt
|