|
@@ -48,9 +48,13 @@ public class StorageProductionController {
|
|
|
storagesLeft = storagesLeft - 1;
|
|
|
if(energyLeftToEnabled <= 0){
|
|
|
System.out.println("enabled energy from storage");
|
|
|
+ assessFitness(1,1,1);
|
|
|
return;
|
|
|
- }
|
|
|
+ }else if(storagesLeft <= 0){
|
|
|
+ System.out.println("nicht genug enabled");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void setAllStorageToStandy() {
|
|
@@ -74,4 +78,60 @@ public class StorageProductionController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void assessFitness(float w1, float w2, float w3){
|
|
|
+ float fitness = 0f;
|
|
|
+
|
|
|
+ fitness = w1 * distanceFitness() + w2 * distributionFitness() + w3 * participationFitness();
|
|
|
+ System.out.println(fitness);
|
|
|
+ }
|
|
|
+
|
|
|
+ private float distanceFitness(){
|
|
|
+ int activeStorage = 0;
|
|
|
+ float distance = 0;
|
|
|
+ for (StorageElement ele : storages) {
|
|
|
+ if(ele.getStatus().equals(StorageElement.Mode.EMIT)){
|
|
|
+ distance = (float) (distance + ele.getHighDistance() + ele.getLowDistance());
|
|
|
+ activeStorage++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return distance / activeStorage;
|
|
|
+ }
|
|
|
+
|
|
|
+ private float distributionFitness(){
|
|
|
+ int emptyStorage = 0;
|
|
|
+ int activeStorage = 0;
|
|
|
+ for (StorageElement ele : storages) {
|
|
|
+ if(ele.getStatus().equals(StorageElement.Mode.EMIT)){
|
|
|
+ activeStorage++;
|
|
|
+ }
|
|
|
+ if(ele.chargeDepleted()){
|
|
|
+ emptyStorage++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return storages.size()- emptyStorage - activeStorage;
|
|
|
+ }
|
|
|
+
|
|
|
+ private float participationFitness(){
|
|
|
+ float participation = 0;
|
|
|
+ for (StorageElement ele : storages) {
|
|
|
+ participation = participation +
|
|
|
+ ((storageEnergy(ele)/totalEnergy())*energyRequiredForPowerplantBlackstart-ele.getEnergyPerElement());
|
|
|
+ }
|
|
|
+ return participation;
|
|
|
+ }
|
|
|
+
|
|
|
+ private float storageEnergy(StorageElement ele){
|
|
|
+ return ele.getStateOfCharge();
|
|
|
+ }
|
|
|
+
|
|
|
+ private float totalEnergy(){
|
|
|
+ float energy = 0;
|
|
|
+ for (StorageElement ele : storages) {
|
|
|
+ if(ele.getStatus().equals(StorageElement.Mode.EMIT)){
|
|
|
+ energy = energy + storageEnergy(ele);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return energy;
|
|
|
+ }
|
|
|
}
|