Difference between revisions of "Using FOC Software"

From openinverter.org wiki
Jump to navigation Jump to search
(Software setup)
(Software setup)
 
Line 30: Line 30:
 
# If motor spins, change syncofs in 1000 digit increments until it stops spinning. If you need to go below 0, like -1000 enter 64536 (=65536-1000)
 
# If motor spins, change syncofs in 1000 digit increments until it stops spinning. If you need to go below 0, like -1000 enter 64536 (=65536-1000)
 
# If manualid is less than about max_motor_current/2 go back to 4. When approaching rated_motor_current/2 make your increments/decrements smaller, like down to 300 digits
 
# If manualid is less than about max_motor_current/2 go back to 4. When approaching rated_motor_current/2 make your increments/decrements smaller, like down to 300 digits
# You have found 1 of 2 possible offsets. Now you can enter a small value for "manualiq" and reset "manualid" to 0. The motor should spin clockwise.
+
# You have found 1 of 2 possible offsets. Now you can enter a small value for "manualiq" and set "manualid" to 0.1. The motor should spin clockwise.
 
# If its spins counter-clockwise, add 32768 to syncofs. If the resulting value is > 65535, subtract 32768 instead (or do modulo addition in the first place)
 
# If its spins counter-clockwise, add 32768 to syncofs. If the resulting value is > 65535, subtract 32768 instead (or do modulo addition in the first place)
 
Congratulations, the most difficult step is done. The default values or curkp and curki can usually stay untouched, I don't know a good tuning procedure anyway. Higher curki means faster reaction but also tends to oscillate at low speed. Next set up the "throtcur" parameter. It defines how many motor amps are produced per % of throttle travel.
 
Congratulations, the most difficult step is done. The default values or curkp and curki can usually stay untouched, I don't know a good tuning procedure anyway. Higher curki means faster reaction but also tends to oscillate at low speed. Next set up the "throtcur" parameter. It defines how many motor amps are produced per % of throttle travel.
  
 
Internally, this is split into a so-called direct and a quadrature current by means of the "Most Torque Per Amp" algorithm (MTPA). MTPA usually needs setup for the motor that your working with. Right now some typical constants are hard coded in the software. This might be replaced by auto-tuning in the future. But the deviation from optimal should not be too large with most IPM motors out there.
 
Internally, this is split into a so-called direct and a quadrature current by means of the "Most Torque Per Amp" algorithm (MTPA). MTPA usually needs setup for the motor that your working with. Right now some typical constants are hard coded in the software. This might be replaced by auto-tuning in the future. But the deviation from optimal should not be too large with most IPM motors out there.

Latest revision as of 20:24, 22 March 2020

Synchronous motors have turned out only to be well drivable when their stator current is controlled by means of a feedback current loop. Due to this, the existing feed forward control used for induction motors could not be extended for use with synchronous motors. Therefor the well known field oriented control approach was implemented in a separate software.

Hardware requirements

Field oriented control is only implemented for permanent magnet motors. Moreover it is optimized for IPM motors (interior permanent magnet). So it will not drive PMSM or BLDC motors in an efficient manner. It will yield no movement at all with induction motors.

Since the absolute rotor position is a key factor with synchronous motors, said software requires an absolute position feedback device. This can be a resolver or a sin/cos chip on top of a small magnet. Resolvers will need a so-called excitation. That is a high frequency (4.4kHz in our case) sine wave. Only V3 main boards generate this excitation signal. sin/cos chips do not need excitation and can also be run with V2 main boards.

Most of Damiens Toyota Designs implement V3 main board circuitry.

So to sum up

  • IPM (Interior Permanent Magnet Synchronous Motor)
  • Resolver or sin/cos chip
  • V3 Mainboard

Software setup

First of all you need to flash your board with preferable the latest FOC version (stm32_foc.bin or hex). It will identify itself with the version value of "X.YY.R-foc".

If not using a pretuned kit (like Leaf dropin board) do the usual current and voltage calibration.

Find out the number of stator pole pairs. Resolver polepairs are either the same as stator pole pairs or 1. sin/cos is always respolepairs=1. Set "encmode" to "Resolver" or "sin/cos", respectively. Set syncadv=10.

Next step is to find out your motors "syncofs". That is the offset between what the resolver reports as 0° and what actually is 0° alignment between the stator and the rotor magnetic field. To do this, a test mode has been implemented. First start your inverter with the "start" input, then switch to manual mode with the corresponding button on the web interface. Warning: manual mode does not implement any rotor speed limit! When used carelessly you might overspeed your motor to the point were it looses structural integrity - it explodes. So have means to brake your motor externally e.g. by doing this tuning with an already mounted motor and jacked up wheels. Then you can use your cars friction brakes.

Tuning Process:

  1. Go into manual mode -> start input, then button on web interface
  2. Observe value "angle" and turn rotor by hand -> you should see angle changes between 0 to 360°. If not, check resolver connection and excitation signal.
  3. Start with syncofs=0
  4. enter a positive value for "manualid". Start low, with respect to motor rating. E.g. 5% of rated current
  5. Keep increasing the value until you notice that the motor starts to spin
  6. If motor spins, change syncofs in 1000 digit increments until it stops spinning. If you need to go below 0, like -1000 enter 64536 (=65536-1000)
  7. If manualid is less than about max_motor_current/2 go back to 4. When approaching rated_motor_current/2 make your increments/decrements smaller, like down to 300 digits
  8. You have found 1 of 2 possible offsets. Now you can enter a small value for "manualiq" and set "manualid" to 0.1. The motor should spin clockwise.
  9. If its spins counter-clockwise, add 32768 to syncofs. If the resulting value is > 65535, subtract 32768 instead (or do modulo addition in the first place)

Congratulations, the most difficult step is done. The default values or curkp and curki can usually stay untouched, I don't know a good tuning procedure anyway. Higher curki means faster reaction but also tends to oscillate at low speed. Next set up the "throtcur" parameter. It defines how many motor amps are produced per % of throttle travel.

Internally, this is split into a so-called direct and a quadrature current by means of the "Most Torque Per Amp" algorithm (MTPA). MTPA usually needs setup for the motor that your working with. Right now some typical constants are hard coded in the software. This might be replaced by auto-tuning in the future. But the deviation from optimal should not be too large with most IPM motors out there.