Browse Source

battery discharge efficiency according to soc

David Heck 4 years ago
parent
commit
d43c8030bf

+ 5 - 1
src/blackstart/controlAlgorithm.java

@@ -534,12 +534,16 @@ public class controlAlgorithm implements AddOn {
 	}
 
 	private void printCurrentEnergyState(){
+		println("CURRENT ALGORITHM ITERATION: "+ control.getModel().getCurIteration());
 		println("blackstart resi: " + getEnergyRequiredForPowerplantBlackstart());
 		println("currenctrenewable: " + currentRenewableProduction());
 		println("currenctpossiblestorage: " + SPC.currentPossibleStorageProduction());
 		for (StorageElement ele :
 				getStorageElements()) {
-			println(ele.getEleName() + " " + ele.getId() + ", soc: " + (ele.getStateOfCharge()/60)/1000 + "kWh,"  + " maxpower: " + ele.getMaxOutRatio()/1000 + " kW, distance: " + (ele.getLowDistance()+ele.getHighDistance()));
+			println(ele.getEleName() + " " + ele.getId() + ", soc: " + (ele.getStateOfCharge()/60)/1000 + "kWh, "
+					+ "nominal power: " + ele.getNominalOutRatio()/1000 + " kW, "
+					+ "currentMaxOutPower: "+ ele.getCurrentMaxOutRatio()/1000 + " kW, "
+					+ "distance: " + (ele.getLowDistance()+ele.getHighDistance()));
 		}
 	}
 

+ 46 - 11
src/classes/StorageElement.java

@@ -18,7 +18,10 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 	private float maxInRatio;
 	
 	@Expose
-	private float maxOutRatio;
+	private float nominalOutRatio;
+
+	@Expose
+	private float currentMaxOutRatio;
 
 	@Expose
 	private float chargingRatio;
@@ -26,11 +29,11 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 	@Expose
 	private resistanceCalculator resistanceCalculator;
 
-	public StorageElement(String eleName, int amount, float energy, Model model, float capacity, float maxInRatio, float maxOutRatio) {
+	public StorageElement(String eleName, int amount, float energy, Model model, float capacity, float maxInRatio, float nominalOutRatio) {
 		super(eleName, amount, energy, model);
 		this.stateOfCharge = 0;
 		this.maxInRatio = maxInRatio;
-		this.maxOutRatio = maxOutRatio;
+		this.nominalOutRatio = nominalOutRatio;
 		this.capacity = capacity * 60;// we save in watts per minute for ease of use
 		this.status = Mode.STANDBY;
 		this.chargingRatio = 0;
@@ -46,8 +49,8 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 
 	public float getPossibleProduction(float energyRequiredForPowerplantBlackstart) {
 		if (stateOfCharge > 0) {
-			if (stateOfCharge >= maxOutRatio) {
-				return energyAfterResistance(maxOutRatio, energyRequiredForPowerplantBlackstart);
+			if (stateOfCharge >= nominalOutRatio) {
+				return energyAfterResistance(nominalOutRatio, energyRequiredForPowerplantBlackstart);
 			} else {
 				return energyAfterResistance(stateOfCharge, energyRequiredForPowerplantBlackstart);
 			}
@@ -56,6 +59,18 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 		}
 	}
 
+	private float getPossiblePower(){
+		if (stateOfCharge > 0) {
+			if (stateOfCharge >= nominalOutRatio) {
+				return nominalOutRatio;
+			} else {
+				return stateOfCharge;
+			}
+		} else {
+			return 0;
+		}
+	}
+
 	private float energyAfterResistance(float energy, float energyRequiredForPowerplantBlackstart){
 		return resistanceCalculator.calcEnergyAfterResistance(energy, getLowDistance(), getHighDistance(), energyRequiredForPowerplantBlackstart);
 	}
@@ -76,9 +91,9 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 			chargingRatio = 0;
 			return 0;
 		case EMIT:
-			if (energyNeed >= maxOutRatio) { // more energy wanted than can be giving
-				if (stateOfCharge >= maxOutRatio) { // more energy wanted than can be given
-					return emitWantedEnergy(maxOutRatio, energyRequiredForPowerplantBlackstart);
+			if (energyNeed >= currentMaxOutRatio) { // more energy wanted than can be giving
+				if (stateOfCharge >= currentMaxOutRatio) { // more energy wanted than can be given
+					return emitWantedEnergy(currentMaxOutRatio, energyRequiredForPowerplantBlackstart);
 				}
 			} else {// less wanted than what can be max be given
 				if(stateOfCharge >= energyNeed){
@@ -134,6 +149,7 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 			case COLLECT:
 			case EMIT:
 				stateOfCharge = stateOfCharge - chargingRatio;
+				setCurrentMaxOutRatio();
 				break;
 			default:
 		}
@@ -148,6 +164,17 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 
 	public void setStateOfCharge(float percentage){
 		this.stateOfCharge = capacity * (percentage / 100);
+		setCurrentMaxOutRatio();
+	}
+
+	private void setCurrentMaxOutRatio(){
+		if(stateOfCharge > capacity * 0.8){
+			currentMaxOutRatio = (float) (nominalOutRatio * 1.1);
+		}else if(stateOfCharge < capacity * 0.2){
+			currentMaxOutRatio = (float) (nominalOutRatio * 0.8);
+		}else{
+			currentMaxOutRatio = nominalOutRatio;
+		}
 	}
 
 	private float notEnoughChargedToEmitWantedEnergy(float energyRequiredForPowerplantBlackstart){
@@ -171,8 +198,12 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 		return stateOfCharge;
 	}
 
-	public float getMaxOutRatio() {
-		return maxOutRatio;
+	public float getNominalOutRatio() {
+		return nominalOutRatio;
+	}
+
+	public float getCurrentMaxOutRatio() {
+		return currentMaxOutRatio;
 	}
 
 	public boolean chargeDepleted(){
@@ -185,7 +216,11 @@ public class StorageElement extends HolonElement implements Comparable<StorageEl
 
 	@Override
 	public int compareTo(StorageElement storageElement) {
-		if(this.stateOfCharge < storageElement.getStateOfCharge()){
+		if(this.getPossiblePower() < storageElement.getPossiblePower()){
+			return -1;
+		}else if(this.getPossiblePower() > storageElement.getPossiblePower()){
+			return  1;
+		}else if(this.stateOfCharge < storageElement.getStateOfCharge()){
 			return -1;
 		}else if(this.stateOfCharge > storageElement.getStateOfCharge()){
 			return 1;

+ 1 - 1
src/ui/view/AddStorageElementPopUp.java

@@ -120,7 +120,7 @@ public class AddStorageElementPopUp extends JDialog {
         maxInRatio.setBounds(130, 90, 110, 20);
         contentPanel.add(maxInRatio);
 
-        JLabel lbloutRatio = new JLabel("maxOutRatio in kW");
+        JLabel lbloutRatio = new JLabel("nominal OutRatio in kW");
         lbloutRatio.setBounds(10, 130, 100, 20);
         contentPanel.add(lbloutRatio);