advanced
hardware
tuning
control-loop

System Tuning

Current, PLL, speed, and acceleration control loop tuning for ASI BAC motor controllers

Levy Fleets Team12 janvier 202515 min read

System Tuning

This guide covers the control loop tuning parameters for optimizing ASI BAC motor controller performance.

Control Loop Overview

ASI BAC controllers use multiple control loops to regulate motor operation:

Control LoopFunction
Current RegulationControls phase current feedback (FOC)
PLL RegulationTracks sensorless angular position
Speed RegulationControls output current based on speed setpoint
Acceleration ControlShapes acceleration and deceleration behavior

Current Regulation Control Loop

The phase current control loop manages current feedback for Field-Oriented Control (FOC). Adjusting current regulation affects overall acceleration and current overshoot behavior.

Bandwidth Tuning

Current Regulator bandwidth calculates the feedback gains:

  • Current regulator Kp (Proportional gain)
  • Current regulator Ki (Integral gain)
Bandwidth EffectResult
Higher bandwidthFaster current correction, less overshoot, less integrator windup
Too highInstability, audible noise, overcurrent faults
Too lowPoor acceleration performance
Motor TypeCurrent Regulator Bandwidth
Higher speed motors3000-5000
Lower speed motors1500+

General Guideline

Maintain sufficiently high Current Regulator bandwidth for desirable acceleration and performance while avoiding instability.

Manual Tuning

If Current Regulator bandwidth is set to 0, you can manually set individual PI gains:

ParameterRise TimeOvershootSettling TimeSteady-State ErrorStability
Increase KpDecreaseIncreaseSmall changeDecreaseDegrade
Increase KiDecreaseIncreaseIncreaseEliminateDegrade

Manual Tuning

Manual PI tuning is not recommended. Use bandwidth tuning when possible.

PLL Regulation Control Loop

The Phase-Locked Loop (PLL) tracks sensorless angular position for motor flux frequency calculation and controls output frequency.

Bandwidth Effects

PLL bandwidth calculates:

  • PLL Kp (Proportional gain)
  • PLL Ki (Integral gain)
Bandwidth EffectResult
Higher bandwidthFaster lock time, faster frequency adjustment
Too highInstability, output noise, audible noise, vibrations, jitter amplification
Too lowJitter removed from reference clock

Tuning Guidelines

Motor TypePLL Bandwidth
Higher electrical frequency motors300+
Geared hubs, mid-drive motors300+ (prevents instantaneous phase overcurrent faults)
Lower electrical frequency motorsLower values tolerable
Direct drive hubsLower values tolerable

Adjustment approach: If experiencing jitter, adjust by increments of 100 (up/down), up to 500.

PLL Damping

PLL damping affects the auto-calculated PLL Kp factor. Increasing damping increases the Kp component.

Manual Tuning

If both PLL bandwidth and PLL damping are set to 0, you can manually set:

  • PLL Kp old
  • PLL Ki old
ParameterRise TimeOvershootSettling TimeSteady-State ErrorStability
Increase KpDecreaseIncreaseSmall changeDecreaseDegrade
Increase KiDecreaseIncreaseIncreaseEliminateDegrade

Speed Regulation Control Loop

The speed regulation loop controls output current based on measured speed to achieve the target speed setpoint.

Key Parameters

ParameterFunction
Speed regulator KpProportional gain for speed error
Speed regulator KiIntegral gain for speed error

Tuning Effects

ParameterRise TimeOvershootSettling TimeSteady-State ErrorStability
Increase KpDecreaseIncreaseSmall changeDecreaseDegrade
Increase KiDecreaseIncreaseIncreaseEliminateDegrade

Step-by-Step Tuning Procedure

1

Initialize Values

Set Speed regulator Ki to 0 and Speed regulator Kp to 1.

2

Test Step Response

Under intended operating conditions/load, induce a step response:

  • Command full throttle from 0 speed
  • Observe system acceleration
3

Adjust Kp

  • Too fast/aggressive or oscillating: Reduce Kp by 25%
  • Too slow: Double Kp (up to less than 8)
  • Repeat until proportional response is satisfactory
4

Add Integral Gain

Set Speed regulator Ki to 1 and test at target speed setpoint.

5

Adjust Ki

  • Still undershooting: Double Ki (up to less than 128)
  • Overshooting: Reduce Ki by 25%
  • Repeat until steady-state is satisfactory
6

Final Balance

Test response from various speeds. If system became too aggressive with Ki, reduce both Kp and Ki proportionally.

Tuning Goals

  • Kp goal: Set as low as tolerable for desired response without overshooting target speed
  • Ki goal: System settles at setpoint without oscillating above/below

Acceleration Control

Acceleration is primarily affected by:

  1. Available torque-producing current
  2. Imposed power limits
  3. Acceleration ramp limits
  4. Current regulation control loop
  5. Speed regulation control loop (for speed-limited modes)

Motor Limitations

If acceleration is insufficient despite tuning, the application may need a motor with better torque constant (Kt in Nm/A) or more current than the controller can output.

Speed Regulator Modes

ModeValueRamp Rates Used
Speed mode0Speed mode ramps
Torque mode1Torque mode ramps
Torque with speed limiting2Torque mode ramps

Torque Mode Ramp Rates

Acceleration Ramps

ParameterFunction
Positive motoring torque rampCurrent ramp-up when commanding (throttle on)
Negative motoring torque rampCurrent ramp-down when reducing (throttle off)
Pedalec positive motoring torque rampPedal sensor current ramp-up
Pedalec negative motoring torque rampPedal sensor current ramp-down

Guidelines:

  • Too low: Acceleration becomes jarring, may damage mechanical components
  • Too high: Acceleration seems slow (positive ramp) or continues too long (negative ramp)
  • To disable: Set values to 1 ms

The ramp is linear and specifies the time (in ms) to reach peak current from zero (positive) or zero from peak (negative).

Speed Limit Ramp Time

For Speed regulator mode 1 (Torque with speed limiting):

Speed limit ramp time limits acceleration relative to speed limit by limiting current output.

Use cases:

  • Improve engagement in geared hub drives
  • Reduce clutch wear
  • Take up slack in chain drive systems
  • Reduce instantaneous overcurrents when accelerating with drivetrain slack

Note: Linear ramp only takes effect from 0 RPM. Set to 0 to disable.

Braking Ramps

ParameterFunction
Positive braking torque rampRegen current ramp-up
Negative braking torque rampRegen current ramp-down

Wheel Lock Prevention

Setting Positive braking torque ramp too low can cause wheel lock-up. Recommended: 200 ms or longer.

Speed Mode Ramp Rates

For Speed regulator mode 0 (Speed mode):

ParameterFunction
Speed mode positive accelerationTarget acceleration rate
Speed mode Regen rampTarget deceleration rate

Value interpretation:

ValueMeaning
161× rated RPM in 1 second
320.5× rated RPM in 1 second
82× rated RPM in 1 second

Recommended values:

  • Speed mode Regen ramp: 48 (good default)
  • Speed mode positive acceleration: 4, 8, or 16 (starting points)

Speed Mode Requirements

  • Speed mode positive acceleration should be less than Speed mode Regen ramp
  • Regeneration battery current limit must be > 0% for regen ramp to function
  • Features bit 13 (engine braking) must be enabled when Control command source ≠ 0

Key Parameters Reference

Current Regulation

AddressParameterFunction
110Current Regulator bandwidthBandwidth for auto-calculation (Hz)
111Current regulator KpProportional gain
112Current regulator KiIntegral gain

PLL Regulation

AddressParameterFunction
113PLL bandwidthBandwidth for auto-calculation (Hz)
114PLL dampingDamping factor for Kp
115PLL KpProportional gain
116PLL KiIntegral gain

Speed Regulation

AddressParameterFunction
117Speed regulator KpProportional gain
118Speed regulator KiIntegral gain
119Speed regulator mode0=Speed, 1=Torque, 2=Torque+Limit

Acceleration Ramps

AddressParameterFunction
120Positive motoring torque rampAcceleration ramp (ms)
121Negative motoring torque rampDeceleration ramp (ms)
122Positive braking torque rampRegen ramp-up (ms)
123Negative braking torque rampRegen ramp-down (ms)
124Speed limit ramp timeSpeed-based current limit (ms)
125Speed mode positive accelerationSpeed mode accel rate
126Speed mode Regen rampSpeed mode decel rate

Next Steps