Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Peblar #16451

Merged
merged 19 commits into from
Nov 6, 2024
Merged

Add Peblar #16451

merged 19 commits into from
Nov 6, 2024

Conversation

PieVo
Copy link
Contributor

@PieVo PieVo commented Oct 2, 2024

Hey EVCC team,

Here is a charger implementation for the Peblar chargers (https://peblar.com/products/ev-charging). Developer info on the modbus API is located at developer.peblar.com.

I've been using this implementation for a while and tested it for the 1p3p switchover to work. This switchover won't work on all variants due to relay configurations (and 1 phase connected systems ofc).

I've checked the doc build to run fine and cleaned out some lint errors. Can you review this code?

Fix #15406

@andig andig self-assigned this Oct 2, 2024
@andig andig added the devices Specific device support label Oct 2, 2024
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
charger/peblar.go Outdated Show resolved Hide resolved
@PieVo
Copy link
Contributor Author

PieVo commented Oct 3, 2024

Hmm, something bad happens to the currents, I'm getting a lot of these:

"Garage: charger logic error: current mismatch (got 15.1A measured, expected 12.2A)"

Need to find out if it is related to the recent changes.

@andig
Copy link
Member

andig commented Oct 3, 2024

There is a 1A difference between set current and max phase current observed:

		// use measured phase currents as fallback if charger does not provide max current or does not currently relay from vehicle (TWC3)
		if !isCg || errors.Is(err, api.ErrNotAvailable) {
			// validate if current too high by more than 1A (https://github.com/evcc-io/evcc/issues/14731)
			if current := lp.GetMaxPhaseCurrent(); current > lp.chargeCurrent+1.0 {
				if shouldBeConsistent {
					lp.log.WARN.Printf("charger logic error: current mismatch (got %.3gA measured, expected %.3gA)", current, lp.chargeCurrent)
				}
				lp.chargeCurrent = current
				lp.bus.Publish(evChargeCurrent, lp.chargeCurrent)
			}
		}

@andig andig changed the title charger: add peblar support Add Peblar Oct 3, 2024
@PieVo
Copy link
Contributor Author

PieVo commented Oct 7, 2024

Hmm, something bad happens to the currents, I'm getting a lot of these:

"Garage: charger logic error: current mismatch (got 15.1A measured, expected 12.2A)"

Need to find out if it is related to the recent changes.

I've seen this happen on 2 different vehicles, it is not vehicle related..

  • I assume the new current is set the end of the loop (pv charge current: x = y + z)
  • The vehicle has plenty of time to set this new current (in my case 20s)
  • The loadpoint charge currents used in lp.GetMaxPhaseCurrent are gathered in the start of the next loop.

Still need to dig into this further where this mismatch is coming from. Right now I can only say it happens on "changing" conditions such as cloud-sun-cloud.

@andig
Copy link
Member

andig commented Oct 7, 2024

I've seen this happen on 2 different vehicles, it is not vehicle related..

Mhhm. And the version before the brushing did not show this?

@PieVo
Copy link
Contributor Author

PieVo commented Oct 7, 2024

current-mismatch_debug.txt

I've seen this happen on 2 different vehicles, it is not vehicle related..

Mhhm. And the version before the brushing did not show this?
I don't remember seeing this on my initial fork of about 2 months ago but the check seems added afterwards. I'll place some low level debug to see if this comes from the charger API.

Update: The charger input/current response of the EV seems ok to me. The charge logic seems to expect a value from 2 loops before...

@andig
Copy link
Member

andig commented Oct 15, 2024

Did you find out whats wrong?

@@ -84,9 +84,6 @@ func NewPeblar(uri string, id uint8) (api.Charger, error) {
return nil, err
}

log := util.NewLogger("peblar")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger still makes sende to see whats going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger still makes sende to see whats going on.

You mean for future debugging? I can revert it, but currently there is not any logging line in the code so this would be un-used.

@PieVo
Copy link
Contributor Author

PieVo commented Oct 15, 2024

Did you find out whats wrong?

Not really.. I'm trying to see what happens in the "charger logic error". For that, I added logging to the setCurrent & getPhaseValues functions. Here is what I get during a charger logic error:

image

In loop "n-1" the current is set to 15631mA via modbus to the charger. That current is applied in at most 5 seconds by the EV. (This EV always draws 0.8A less than the advertised limit).

In loop "n" the current is read back and is according to (my) expectation (14.9A). However the expectation from the charger logic error is another value, namely, a value mentioned as "max charge current" mentioned in loop n-1, being 13.4A.

At the end of loop "n" this "max charge current" of 13427mA is eventually set towards the charger.

My conclusion would be that the expectation of the charger logic error is actually 1 iteration too soon. What do you think?

@andig
Copy link
Member

andig commented Oct 15, 2024

Didn‘t check the code yet, but why does the actual setCurrent only happen with one cycle delay? It is using the wrong value imho.

return fmt.Errorf("invalid current %.1f", current)
}

err := wb.setCurrent(wb.curr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh :O

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that resulted in unexpected behavior..

charger/peblar.go Outdated Show resolved Hide resolved
Co-authored-by: andig <cpuidle@gmail.com>
@github-actions github-actions bot added the stale Outdated and ready to close label Oct 22, 2024
@github-actions github-actions bot closed this Oct 27, 2024
@PieVo
Copy link
Contributor Author

PieVo commented Nov 4, 2024

Hi @andig, I've been testing this branch for the past weeks and have not seen more warnings regarding the current sanity check.
Is there anything you would like to see changed? Otherwise this could be merged.

@andig andig reopened this Nov 6, 2024
@andig andig merged commit b6c0dde into evcc-io:master Nov 6, 2024
mabunixda added a commit to mabunixda/evcc that referenced this pull request Nov 22, 2024
* master: (102 commits)
  Smart Cost: better option steps (evcc-io#17117)
  Add Peblar (evcc-io#16451)
  Smart Cost: higher precision limit via slot click (evcc-io#17099)
  Tariffs: add formulas (evcc-io#17002)
  Volvo2mqtt: remove broken status (evcc-io#17089)
  chore: generalise handlers
  chore: clean error handling
  Mqtt: fix panic
  Ui: restore semi-legacy browser support (evcc-io#17061)
  chore: assert plugin getters (evcc-io#17052)
  Revert "Allow meters for pv usage (evcc-io#17006)"
  Em2Go: work around current being reset (evcc-io#17050)
  Upgrade telegram api (evcc-io#17049)
  chore: use cast.ToBoolE (evcc-io#17030)
  chore: deduplicate getter implementations (evcc-io#17031)
  Plugins: make script plugin use pipeline (evcc-io#17029)
  chore: fix test
  Site: don't modify battery mode unless battery configured (evcc-io#17027)
  chore: rebuild mocks
  chore: upgrade libraries
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support stale Outdated and ready to close
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Peblar / ProDrive WLAC Wallbox
2 participants