Fehler im Cycle Controller?

Ich habe - meiner Meinung nach einen Fehler in io.openems.edge.controller.ess.cycle gefunden. Mit folgenden Parametern sitzt der Controller im Charging fest:

context.config.maxSoc() == 100
context.maxChargePower != 0

Hier die Methode runAndGetNextState in class ContinueWithChargeHandler der ess.cycle.statemachine

if (context.config.maxSoc() > 99) {
	if (context.maxChargePower == 0) {
		// hier würde der state-Wechsel erfolgen, 
		// wird aber nie erreicht
		return State.COMPLETED_CYCLE;
	}
}
else if (ess.getSoc().orElse(0) >= context.config.maxSoc()) {
	// hier würde der state-Wechsel erfolgen, 
	// wird aber nie erreicht
}

/* ... */
// Das passiert immer
return State.CONTINUE_WITH_CHARGE;

Das gleiche Problem tritt in class StartChargeHandler auf. Hier wird das Problem verursacht durch:

if (context.config.maxSoc() == 100) {
	// hier kein state-Wechsel
}
else if (ess.getSoc().orElse(0) >= context.config.maxSoc()) {
	// hier state-Wechsel, 
	// wird aber nie erreicht
}

Durch den Spezialfall (context.config.maxSoc() == 100) und das Fortfahren mit else if, wird niemals gegen den SOC getestet.

Hi,
vielen Dank für deine Bemerkung. Was meinst du genau mit Fehler? Die Zeile if (context.waitForChangeState ... verzögert den Zustandswechsel. Sobald die Hysterese abgelaufen ist, wird der Zustand in State.COMPLETED_CYCLE gewechselt.

if (context.config.maxSoc() > 99) {
	if (context.maxChargePower == 0) {
		// Wait for hysteresis
		if (context.waitForChangeState(State.CONTINUE_WITH_CHARGE, State.COMPLETED_CYCLE)) {
			return State.COMPLETED_CYCLE;
		}
		return State.CONTINUE_WITH_CHARGE;
	}
}

Könntest du bitte Beispielparameter angeben, die zu einem “Festsitzen” des Zustandsautomates führen?
Viele Grüße

Hallo Lóránt
Diese Bedinung ist nie erfüllt,

daher wird State.COMPLETED_CYCLE niemals zurückgegeben.

Ich habe meine Frage umformuliert und Ursache für das Problem besser erklärt

Hi SBartel,

I appreciate your comments.
I agree that this controller had a few weaknesses.
I’m now working on it, and I’ll make some changes and refactoring.
If you have any other points, feel free to share them.
Thanks a lot.

BR,
Huseyin Sahutoglu

Hello Huseyin

Let’s continue this conversation in english.
The problem - as I see it - is this.

Given the upper SOC limit is set to 100 and the charging power is non-zerro, hence

context.config.maxSoc() == 100
context.maxChargePower != 0

Then the parts A and B of this conditional are never reached

if (context.config.maxSoc() > 99) {
	if (context.maxChargePower == 0) {
		// Part A, never executed
	}
}
else if (ess.getSoc().orElse(0) >= context.config.maxSoc()) {
	// Part B, never executed
}

/* ... */
// Default
return State.CONTINUE_WITH_CHARGE;

Hi,

The expectation was here actually, the maximum allowed charge power to become 0 when the battery fully charged. Thats why we wanted to keep charging until AllowedChargePower is 0.

and else (Part B);
lets assume getSoc return 50 and the config.maxSoc is 70.
Until getSoc 69 returns, battery should be charged. Then If greater and equals than 70 shoud be executed.

So, as a result if config max Soc selected as 100, we check AllowedChargePower == 0 becuase then we can understand whether battery fully charged or not.
If its not we make the decision based on given config.maxSoc value.

What was your approach and/or, in which case wanted to use cycle Controller?
How would you suggest to make the decisions ?

LG,
Huseyin Sahutoglu

1 Like

Hi SBartel,

I wanted to inform you about the changes I made.
Please check this out: Improvement: Controller ESS Cycle by huseyinsaht · Pull Request #2252 · OpenEMS/openems · GitHub
Our colleagues are reviewing the code currently.
Please let me know if there are any unclear points.

BR,
Huseyin