Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free > Open ReVolt: open source DC motor controller
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 01-25-2011, 05:48 PM   #1 (permalink)
EcoModding Apprentice
 
Join Date: Oct 2009
Location: Jyvaskyla, Finland
Posts: 137

Golfwagen - '89 Volkswagen Golf mk2
90 day: 107.14 mpg (US)
Thanks: 45
Thanked 33 Times in 27 Posts
ReVolt control parameters

Hello,

I thought I'd start this thread because I'm feeling a bit confused about some parameters you can set to ReVolt controller. When setting up/tuning the controller one would like to know what each of these codes do. There might be other ways to set parameters but I'm using RTD Explorer for that purpose.

Let's try explaining all the options available. These settings apply to Cougar controller using ATmega chip, revision 2C.



One important thing about throttle calculation (taken from wiki):

Throttle = throttle_input * t-pos-gain / 8 - PWM * t-pwm-gain / 8

throttle_input is raw throttle. t-pos-gain and t-pwm-gain are variables one can set. PWM is the actual PWM output ratio from the controller. Values range from 0 to 511. 0 is full off and 511 is full on.



Current parameters one can set using RTD Explorer:

kp - KP loop value
ki - KI loop value
possible values: 0-500
Default values: kp 2 and ki 160
adjust how quickly the motor current matches what you are inputting via the accelerator. Different values will affect the response and will cause oscillations and a feeling of jerkiness if they don't match the motor and system voltage. (taken from wiki pages)

t-max-rc - Throttle max count (pedal all the way up)
t-min-rc - Throttle min count (pedal all the way down)
Possible values: 0-1023
Default values: t-max-rc 683 and t-min-rc 413
These adjust the throttle position limits. You should set these so you always get zero throttle and full throttle when needed.

t-pos-gain -
t-pwm-gain -
Possible values: 0-128
Default values: t-pos-gain 8 and t-pwm-gain 0
Variables in throttle equation.

Increasing the value of t-pwm-gain will cause the throttle to decrease as the vehicle speeds up and has the effect of making the throttle less sensitive at higher speeds. This is useful for applications that require high amps at low speed and less sensitive throttle at higher speeds. Settings of 16 and 8 would make the throttle twice as sensitive at low speeds; the throttle will become less sensitive as the vehicle speed (and PWM) increase. If PWM were to go to its max, the throttle would return to normal sensitivity. A setting of 16 and 12 would have a similar effect, but the throttle would be at normal sensitivity at 66% PWM and only half sensitivity at 100% PWM. (taken from wiki)

t-fault-rc - Throttle fault raw counts
Possible values: 0-1023
Default value: 100
Raw ADC counts for throttle fault. Time window is 200ms, so these counts must accumulate within 200ms for throttle fault to latch.

c-rr - Current ramp rate (in amps per millisecond)
Possible values: 0-100
Default value: 6
Defines how quickly the throttle responds to controller input. Higher values create a more responsive feel while lower values are smoother and more gradual. (taken from wiki).

pwm-filter - PWM filter for t-pwm-gain
Possible values: 0-3
Default value: 0
There's a low pass filter for the value of PWM in the throttle equation. This sets the level (speed) of filtering. 0 is slowest and 3 is fastest. Most likely, the default value is fine.

motor-os-th - Motor overspeed threshold
Possible values: 0-9999
Default value: 0
RPM equation used in controller software is RPM = c*pwm_duty/current. C is a constant, which is different for each motor/voltage. So setting motor-os-th to 1000 doesn't mean RPM is limited to 1000. It is good idea to start experimenting with low values and gradually increase this value until satisfying RPM limit is reached. Motor load affects RPM limit, so under load RPM limit is a bit higher.

motor-os-ft - Motor overspeed fault time (ms)
Possible values: 0-9999
Default value: 1000
Time (in ms) for which the controller will cut out if it detects overspeed. Overspeed stuff works only on series-wound motors.

motor-os-dt - Motor overspeed detection time (in ms)
Possible values: 0-99
Default value: 10
Time (in ms) for which a fault has to be detected before causing a overspeed fault - prevents nuisance faults

motor-sc-amps - Motor speed calc amps
Possible values: 0-511
Default value: 0
Sets the motor amps limit below which overspeed sensing is disabled. There was a problem where it would trip if you released the pedal quickly and throttle would be lost for a quarter second or whatever the fault time is. This solved it. For a first guess at a value, place the car in neutral. Depress the pedal until the motor just starts to turn (just enough to overcome friction). Set motor-sc-amps to half the current required to get the motor to just start turning.

pwm-deadzone - How many PWM counts the mosfets begin to conduct
Possible values: 0-99
Default value: 5
The default should work for most people - this makes the overspeed trip more reliable. Value is estimate of the minimum PWM setting where the drivers start to turn on. It's only used in the overspeed calculation.

bat-amps-lim - Battery amp limit
Possible values: 0-511
Default value: 0
If you want to limit amp draw from your batteries you can set this parameter. Setting value to 0 means there is no limit for maximum battery amps drawn. However there is a hardware amp limiter on control board. This hardware limit controls max motor amps which can't be lower than battery amps. So it essentially limits battery amps too. Hardware amp limiter is adjustable but not via software. Hardware amp limit defaults at around 500A.

pc-time - Pre-charge delay time (1/10th second)
Possible values: 0-999
Default value: 0
Controller's pre-charge circuit starts outputting +12V to J1 connector pin #3 after this time passes. Setting this value to 20 will result in +12V coming out of pin #3 after 2 seconds. 30 means 3 seconds etc. Zero value means no +12V to pin #3 at all.


Last edited by mora; 05-29-2013 at 09:51 AM..
  Reply With Quote
The Following User Says Thank You to mora For This Useful Post:
Brose (09-09-2011)
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 01-31-2011, 11:46 AM   #2 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 41 Times in 34 Posts
Quote:
One important thing about throttle calculation (taken from wiki):

Throttle = throttle_input * t-pos-gain / 8 - PWM * t-pwm-gain / 8

throttle_input is raw throttle. t-pos-gain and t-pwm-gain are variables one can set. PWM is ?
PWM is the actual PWM output ratio from the controller as a value from 0-511. 0 is full off and 511 is full on.

the PWM ratio is analogous to the voltage that the controller is outputting. The output voltage is also roughly correlated to the rpms of the motor. So, if t-pwm-gain is greater than zero, the equation above will subtract more and more from the throttle input as the vehicle speeds up.

When testing the software, I was able to use this feature to make it easier to maintain a constant current draw from the batteries while accelerating. It'll probably vary widely on the motor/gearing selection though.

Quote:
pwm-filter -
Possible values: 0-3
There's a low pass filter for the value of PWM in the throttle equation above. This sets the level of filtering. Most likely, the default value is fine.

Quote:
t-max-rc - Throttle max count (pedal all the way up)
Possible values: 0-1023

t-min-rc - Throttle min count (pedal all the way down)
Possible values: 0-1023
These adjust the throttle position limits in case you have a weird pot that doesn't close or open all the way. Mine worked with the default settings...

Quote:
motor-os-ft - Motor overspeed fault time
Possible values: 0-9999

motor-os-dt - Motor overspeed detection time (in ms)
Possible values: 0-99

motor-sc-amps - Motor speed calc amps
Possible values: 0-??

pwm-deadzone - How many PWM counts the mosfets begin to conduct
Possible values: 0-99
motor-os-ft: the number of ms for which the controller will cut out if it detects overspeed. (all the overspeed stuff works only on series-wound motors, btw).

motor-os-dt: number of ms for which a fault has to be detected before the fault causes a shutdown - prevents nuisance faults

motor-sc-amps: sets the motor amps limit below which overspeed sensing is disabled. There was a problem where it would trip if you released the pedal quickly and throttle would be lost for a quarter second or whatever the fault time is. This solved it. For a first guess at a value, place the car in neutral. Depress the pedal until the motor just starts to turn (just enough to overcome friction). Set motor-sc-amps to half the current required to get the motor to just start turning.

pwm-deadzone: as decribed above - the default should work for most people - this makes the overspeed trip more reliable.
__________________
ReVolt AZ testing thread:

http://ecomodder.com/forum/showthrea...ting-9325.html
  Reply With Quote
Old 01-31-2011, 12:50 PM   #3 (permalink)
EcoModding Apprentice
 
Join Date: Nov 2010
Location: Annapolis
Posts: 159
Thanks: 0
Thanked 29 Times in 24 Posts
Hmmm, is there a wiki page for this yet? I've read the Cougar code pretty carefully and could likely add some useful info.

The comment about "a weird pot that doesn't close or open all the way" is a little off the mark.

The throttle input is deliberately set up to not span the full 0-5V range. This is so that the throttle "fails safe". With a good physical design, there is no wire or trace break that could result in a valid, non-zero throttle input. And no persistent short should result in a valid input. Part of the reason for HPL / High Pedal Lockout is that a internally shorted throttle position sensor (TPS) shouldn't result in half-throttle operation.

The controller typically has resistors to a 0-5V supply, so that a connected variable resistor (TPS or "pot box") ends up with a 1V-4V reference range. That way most breaks or shorts will report 0V or 5V (or even 12V) -- clearly outside the valid range. Further, the TPS is often set up with physical limits to never use the full range, perhaps only 1.25V to 3.75V. That way the controller can localize a failure -- a 1V input suggests the failure is internal to the TPS or wiring rather than on the controller or an external short.

Yes, reducing the input voltage range like this reduces the resolution of the throttle input. But the ability to detect a very slight movement of the gas pedal isn't nearly as important as being able to detect a failure.
  Reply With Quote
The Following User Says Thank You to DJBecker For This Useful Post:
Nevyn (05-12-2011)
Old 01-31-2011, 03:48 PM   #4 (permalink)
EcoModding Apprentice
 
Join Date: Oct 2009
Location: Jyvaskyla, Finland
Posts: 137

Golfwagen - '89 Volkswagen Golf mk2
90 day: 107.14 mpg (US)
Thanks: 45
Thanked 33 Times in 27 Posts
Thanks for the input. Good info. Is pwm-deadzone only related to overspeed detection and doesn't affect other things?

I'll throw a guess about t-fault-rc: throttle fault raw-count. Number of times/cycles in main program loop that throttle is allowed to have faulty reading. If so this number should remain low, but might help with bad pots (which need replacing). I don't know how long it takes to sample one throttle value, but even with full t-fault-rc value it is less than second.

Last edited by mora; 03-04-2011 at 09:54 AM..
  Reply With Quote
Old 02-02-2011, 11:24 AM   #5 (permalink)
EcoModding Apprentice
 
Join Date: Nov 2010
Location: Annapolis
Posts: 159
Thanks: 0
Thanked 29 Times in 24 Posts
The pwm_deadzone value is the estimate of the minimum PWM setting where the drivers start to turn on. It's only used in the overspeed calculation.

Very short PWM pulses to the MOSFET gates provide minimal motor current and just generate heat. Older IGBTs are even worse, taking a long time to fully turn on. Plus the Cougar uses an optoisolator, which both delays and shortens the gate drive signal.

In my notes I have that the default setting of 5 corresponding to 1.2usec. My early-morning calculation puts it at 600ns (9 cycles at 16MHz). Either is a reasonable estimate.

I'm a little surprised that the Cougar code doesn't have a similar parameter for setting the PWM register, rather than only compensating for it in the overspeed check. The code should enforce a minimum PWM on time, not turning on at all if there would only be a very short output pulse. It doesn't preclude low speed operation. If you continue to accumulate the error, eventually the difference builds up enough that the MOSFETs are turned on for a few cycles. Add a little randomness (A/D converter noise seems to be enough) and you get low speed dithering for free.

The Cougar firmware might also do a better job with minimum off time. If the motor controller is estimating 98%+ PWM, it should just turn on 100%. It should specifically not clamp at 510! Switching off for a few cycles is just generating heat without adding control.

Plus my still-in-progress experiment with stand-alone SR gate drive works better when there are not very short off / freewheel phases. A stand-alone SR circuit drives a MOSFET to emulate a diode by switching the gate on when negative drain-source voltage is detected. To avoid false turn off from ringing, the drain-source voltage detection is ignored (really "heavily biased to stay on") for a bit, the minimum on time (MOT). If the MOT requirement isn't met, the result is some shoot-through current, which generates lots of heat.
  Reply With Quote
Old 03-28-2011, 11:09 AM   #6 (permalink)
EcoModding Apprentice
 
Join Date: Oct 2009
Location: Jyvaskyla, Finland
Posts: 137

Golfwagen - '89 Volkswagen Golf mk2
90 day: 107.14 mpg (US)
Thanks: 45
Thanked 33 Times in 27 Posts
Are t-max-rc and t-min-rc auto-adjusting? I thought I'd check my potbox range from controller but RTD explorer showed me same values I was going to input. Pot is definitely not full 0-5k ohm, but something like 4.7k ohm.
  Reply With Quote
Old 03-28-2011, 11:34 AM   #7 (permalink)
EcoModding Apprentice
 
Join Date: Nov 2010
Location: Annapolis
Posts: 159
Thanks: 0
Thanked 29 Times in 24 Posts
Quote:
Originally Posted by mora View Post
Are t-max-rc and t-min-rc auto-adjusting? I thought I'd check my potbox range from controller but RTD explorer showed me same values I was going to input. Pot is definitely not full 0-5k ohm, but something like 4.7k ohm.
The t-max-rc and t-min-rc serial port commands set the internal variables

config.throttle_max_raw_counts
config.throttle_min_raw_counts

They are in raw A/D converter units, where the range is 0..1023 corresponding to 0-5V.

Note that Cougar uses a 5V-0V throttle, where a 5V (A/D reading of 1023) is "foot off the pedal" and 0V is "go very fast". That's less common than a 0-5V throttle, but not unique.

These settings are not auto-adjusting. The user must manually set the values, test them out and explicitly write them to the EEPROM.

It would only be a little more code to make them auto-adjusting, but that might not be code that should be written. If some part of the throttle circuit is slowly degrading, you want someone to check it out rather than hiding it with automatic compensation.

That's a bit different than having a setup and calibrate mode, where the throttle range is detected once and written. That would be useful.
  Reply With Quote
Old 05-11-2011, 10:56 PM   #8 (permalink)
AC-DC enthusiast
 
mrbigh's Avatar
 
Join Date: Nov 2009
Location: Long Island, NY
Posts: 280

Dual-PWR PHEV - '04 Toyota Prius

Kopper - '79 Bradley Bradley GT-II
Thanks: 119
Thanked 50 Times in 35 Posts
RTD Explorer crash course

Hi, finaly I have the latest controller board assembled and working thanks to Paul's preprogrammed Atmega.
The 1kAmp controller is connected and runuing with RTD Explorer but I encounter that the momentary speed control, a 5K potentiometer, it has a 1/2" excursion on the RTD Expl. screen an it start ploting at Value 35 not exceeding 40.
How do I change parameters in temporary mode for testing and them into the Atmega.
Is it there a programming manual or guide?
At the bottom of the RTD screen I have a red Throtte Fault and V-Ref Fault, Green precharging and a blue High Pedal Lockout.
thank you
__________________
. .. .. . .......
Prius Absolutum Dominium . ..........KOPPER
PHEV conversion since Dec 2006.. . .... .Future EV
. . . . . . . .CALCars # 27. . . . . . . . . . ..on the works now !!
. . . . . . . . . . . . . . . . .. . ........
  Reply With Quote
Old 05-12-2011, 02:30 AM   #9 (permalink)
EcoModding Apprentice
 
Join Date: Oct 2009
Location: Jyvaskyla, Finland
Posts: 137

Golfwagen - '89 Volkswagen Golf mk2
90 day: 107.14 mpg (US)
Thanks: 45
Thanked 33 Times in 27 Posts
You can input commands by typing them into a text field at lower right corner. First type the parameter you want to change, hit space and then type the value;

pc-time 20

This sets precharge time to 2 seconds. Should be easy. Parameters can be set temporary if you don't save the changes. Restarting the controller makes changes disappear then.

I haven't build 1k amp controller board yet so I have no idea how it behaves with RTD explorer. Maybe Paul can confirm if it works the same way like 500A version?
  Reply With Quote
Old 05-12-2011, 10:30 AM   #10 (permalink)
AC-DC enthusiast
 
mrbigh's Avatar
 
Join Date: Nov 2009
Location: Long Island, NY
Posts: 280

Dual-PWR PHEV - '04 Toyota Prius

Kopper - '79 Bradley Bradley GT-II
Thanks: 119
Thanked 50 Times in 35 Posts
Quote:
Originally Posted by mora View Post
You can input commands by typing them into a text field at lower right corner. First type the parameter you want to change, hit space and then type the value;

pc-time 20

This sets precharge time to 2 seconds. Should be easy. Parameters can be set temporary if you don't save the changes. Restarting the controller makes changes disappear then.

I haven't build 1k amp controller board yet so I have no idea how it behaves with RTD explorer. Maybe Paul can confirm if it works the same way like 500A version?
MORA, thank you for replaying.
Both 500 and 1KAmp board should be similar in principle of operation, the latest with some more features than the other.
I did try to change "throttle_min_raw_counts=xxxx" and "throttle_max_raw_counts=xxxx" by the example you presented but no changes were accepted.
How do I do the save the changes made to be permanently?
I including a picture of the assembled board

Attached Thumbnails
Click image for larger version

Name:	IGBT driver watermarked.JPG
Views:	81
Size:	114.4 KB
ID:	8330  
__________________
. .. .. . .......
Prius Absolutum Dominium . ..........KOPPER
PHEV conversion since Dec 2006.. . .... .Future EV
. . . . . . . .CALCars # 27. . . . . . . . . . ..on the works now !!
. . . . . . . . . . . . . . . . .. . ........
  Reply With Quote
Reply  Post New Thread


Thread Tools




Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com