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

BMS limit emulation #45

Closed
PureComedi opened this issue Feb 22, 2024 · 7 comments
Closed

BMS limit emulation #45

PureComedi opened this issue Feb 22, 2024 · 7 comments
Labels
feature apparently this would improve something low acceptable issue shfw shfw bugs

Comments

@PureComedi
Copy link

Scooterhacking Tool

Firmware (SHFW)

Type of feature

Performance

Priority

medium (upcoming releases)

SHUT Version

2.3.2

SHFW Version

0.3.7

Scooter model

Xiaomi Pro, Pro2, 1s, essential, 3

Description of the new feature

Implementation of a virtual limit that doesn't allow total current draw (including field weakening and acceleration boost) to go above a set limit.
Could be added as a 3rd current limit slider or replace Ld and Lq ideally.

Contact Information

purecomedi

@PureComedi PureComedi added the feature apparently this would improve something label Feb 22, 2024
@github-actions github-actions bot added medium this can wait shfw shfw bugs labels Feb 22, 2024
@paulederbaus paulederbaus added low acceptable issue and removed medium this can wait labels Feb 22, 2024
@paulederbaus
Copy link
Contributor

Technically possible, but this is already available as two sliders and more customisable this way
-> maybe a total current display in shut would be helpful that summarises both sliders

(Changed to low)

@PureComedi
Copy link
Author

Issue is that flux to bms amp conversion can't be just straight up calculated without tests

@paulederbaus
Copy link
Contributor

Issue is that flux to bms amp conversion can't be just straight up calculated without tests

This is not true. There is a very precise formula: I_total = sqrt(Iq² + Id²). This should match the current consumption very close.

@PureComedi
Copy link
Author

PureComedi commented Mar 4, 2024

Today i found out that that formula and the 2 sliders indeed can't be properly used to limit your amps in the way i suggested,

let's take an example, 23A main motor curve, 17kmh field weakening start speed with a 1.5A variable, the scooter travels at 45kmh, aka its drawing 42 A of flux, aka Id

if we plop this into the formula, we get sqrt(23^2+42^2), which is 47.88~ A
there's an issue with that, that's on a 30A BMS limited system!
Iq changes throughout the speeds and draws way less than specified in the motor curve, and so does Id as it's stepping between the given increments, resulting in the formula not being applicable, as in the lower speed curves this also flips around, with the Iq pulling more than the Id.

my proposal is the limiting of this using 1 singular value/slider with which the esc would on the fly perform this calculation to make sure it doesn't go above this limit.

@paulederbaus
Copy link
Contributor

let's take an example, 23A main motor curve, 17kmh field weakening start speed with a 1.5A variable, the scooter travels at 45kmh, aka its drawing 42 A of flux, aka Id

if we plop this into the formula, we get sqrt(23^2+42^2), which is 47.88~

You are using the reference value and not the actual value. We have a current reading for both axes which can be lower or higher than what you request.

my proposal is the limiting of this using 1 singular value/slider with which the esc would on the fly perform this calculation to make sure it doesn't go above this limit.
Are you aware that the prerelease has this option already as two sliders?

@PureComedi
Copy link
Author

Of course im using a reference value, because that's all you can set the 2 sliders to, fixed values

@Nyami11
Copy link

Nyami11 commented Mar 5, 2024

There is a very precise formula: I_total = sqrt(Iq² + Id²).

So we can limit the total current draw by setting the 2 values in a way that the I_total is the max that our BMS can push out, for example we want max 36A, which is 20A on Id and 30A on Iq, but this way until field weakeing turns on we are limiting it to 20A, which is much less than it could handle. If we would have a total power setting, it could work in a way that it lets more power to the d-axis until it starts field weakening, and after that it would reduce the current on the d axis in a way that the I_total would be under out total power limit. For example we could set Iq to 30A, Id to 36A, total to 36A, and then it would draw 36A until field weakening starts, then it would reduces the Id so sqrt(Iq² + Id²) is still less then our set limit.

@lekrsu lekrsu closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature apparently this would improve something low acceptable issue shfw shfw bugs
Projects
None yet
Development

No branches or pull requests

4 participants