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

[FEATURE] Foc_current mode and Current feed forward #317

Open
Candas1 opened this issue Sep 23, 2023 · 5 comments
Open

[FEATURE] Foc_current mode and Current feed forward #317

Candas1 opened this issue Sep 23, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Candas1
Copy link
Collaborator

Candas1 commented Sep 23, 2023

At the moment in voltage mode, if information like phase_resistance, phase_inductance and KV_rating are provided, q and d currents are used as target and the q and d voltages are estimated.

The foc_current could benefit from that and use those values as feedforward for the q and d PI controllers.
The q and d voltage estimation could be made a separate function not to duplicate the code.

That would probably improve the dynamics of the foc current control.

@Candas1 Candas1 added the enhancement New feature or request label Sep 23, 2023
@Candas1
Copy link
Collaborator Author

Candas1 commented Sep 27, 2023

This estimation function can also be reused in angle mode and velocity mode

Now it looks like that:
Vq = phase_resistance * Iq + BEMF
Vd = - SPEED * L * Iq

It could be later updated for field weakening in this way:
Vq = phase_resistance * Iq + BEMF + SPEED * L * Id
Vd = phase_resistance * Id - SPEED * L * Iq

Later, for salient motors like IPMSM, it could be updated to handle Ld and Lq:
Vq = phase_resistance * Iq + BEMF + SPEED * Ld * Id
Vd = phase_resistance * Id - SPEED * Lq * Iq

@Candas1
Copy link
Collaborator Author

Candas1 commented Oct 1, 2023

I think I am wrong about the feedforward:
image

Only those values are being added as feedforward term after the PI output:

  • Vq += BEMF + SPEED * Ld * Id
  • Vd -= SPEED * Lq * Iq
    That could be added before the PID output ramp limiting.

That technique is called decoupling.
Vesc seems to give different options.

  • only BEMF decoupling : Vq += BEMF
  • cross decoupling : Vq += SPEED * Ld * Id and Vd -= SPEED * Lq * Iq
  • both : Vq += BEMF + SPEED * Ld * Id and Vd -= SPEED * Lq * Iq

phase_resistance * Iq and phase_resistance * Id might be already covered by the PI controller.

@Candas1
Copy link
Collaborator Author

Candas1 commented Oct 1, 2023

So something like that could be done.
In move() function for voltage mode

  • if phase_resistance is available, Vq = phase_resistance * Iq and Vd = phase_resistance * Id

In loopfoc() function for all modes:

  • if phase_inductance is available Vq += SPEED * Ld * Id
  • if KV_rating is available Vq += BEMF
  • if phase_inductance is available Vd -= SPEED * Lq * Iq

@Candas1
Copy link
Collaborator Author

Candas1 commented Oct 2, 2023

Nice video about the cross decoupling:
https://www.youtube.com/watch?v=bOr_EgJUakI

@Candas1
Copy link
Collaborator Author

Candas1 commented Oct 6, 2023

Nice article, and the benefit we could expect:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant