Vehicle speed calculation
Lynx offers two possible methods for vehicle speed evaluation.
If Bafang display is used, then the system is sending to the display only information about one wheel revolution. Appropriate settings are made in the display then. (wheel diameter, units). ie. conversion from wheel revolutions to speed is done in the display.
Motor speed
Information from the driver is used for speed determining. It does not need to install any external sensor. But this option requires correctly set parameters of the drive train (motor pole pairs - driver/motor/pp
, gear ratio - /gearthr
and driver wheel size - /odothr
).
/gearthr
. Its value is in "motor shaft revolutions per one-wheel revolution"./odothr
. Its value is the number of wheel revolutions per kilometer.
If you set these parameters correctly, you can later set the speed limitation in km/h. The current speed reading is located in /speed
state.
If you leave /gearthr
and /odothr
in default values, the speed reading will be in [motor RPM]. This also means, that the speed limit kph
in maps will be in [motor RPM].
This solution is not working when a motor with a freewheel clutch is used. Then the external speed sensor is needed.
Speed limiter response tuning
It is necessary to tune these parameters. Wrong settings can cause oscillation or slow reaction.
If you have oscillation, try to decrease the rdec
parameter - i.e. slow limiter response. Or increase the rdec
.
These values are good starting point for tuning:
"/driver/limiter/rdec" : "100.0" # '[RPM] speed limiter decrement rate'
"/driver/limiter/rgain" : "100.0" # 'speed limiter gain'
The rpos
treshold is calculated from the map speed limit kph
.
The rpos
, rdec
are in [motor RPM]. The kph
in maps is in [kph].
External speed sensor
Pulses from the external speed sensor are used for speed evaluation. All the necessary settings are made in Tachospeed block (output is wheel rotation speed). Vehicle speed is computed using wheel size information (odothr
) then.
The external speed sensor is activated if in_speed
is mapped to a valid physical input
Settings for external speed sensors (like number of pulses per revolution) are located in /tachospd
folder. More about tacho block
By default, speed is always limited from motor speed reading. If you want to use the external speed sensor for speed limitation, you need to set the speedopts
parameter.
speedopts
This parameter is located in
/misc
folder.
Bit | Description |
---|---|
0 | Enables aditional speed limiter from external sensor. Speed input will be used from motor and from the external speed sensor, for redundancy. |
1 | Set aditional speed sensor only to global speed limiter.(kphlimit) |
7 | Disables primary speed limiter (from motor) |
rdec
and rgain
are used for the external speed sensor too. Use them to tune the speed limiter response.