View Single Post
  #12   Spotlight this post!  
Unread 15-01-2013, 09:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Keep the engine speed

Quote:
Originally Posted by Tom Line View Post
A bang-bang controller tends to be limited in situations where your rotational inertia is not high. The result is an unstable speed that oscillates approximately just above your set point.

If you are using pneumatic wheels or something else with a reasonably high moment of inertia (I haven't done calculations to determine the cross over) then bang-bang is fine
You can make it work with lower inertia wheels with just a few extra lines of code.

Instead of banging between 0% and 100% when you're near the setpoint, reduce the amplitude of the banging.

To do this, you need to have an idea of what the nominal required voltage is at each setpoint speed you want to control.

For a simple example, let's say you want to control the speed at 3000 rpm and you've found it takes approx 60% of full voltage to do that.

Change your bang-bang code from this:
Code:
if (speed > 3000) bang 0%

else bang 100%
...to this:
Code:
if (speed > 3000 + 200) bang 0%

else if (speed > 3000) bang 60% - 20%

else if (speed > 3000 - 200) bang 60% + 20%

else bang 100%
The numbers above in bold black are your setpoint and your estimated voltage% at setpoint.

The numbers above in red are "tuning parameters".

Making the 20% number larger improves spinup recovery time. Making it smaller reduces the amplitude of oscillations. Don't make it too small or you'll have essentially open-loop operation.

Making the "200" number smaller improves spinup recovery time. If you make it too small the extra lines of code have no effect - you've essentially got 0-100% bang-bang.




Last edited by Ether : 15-01-2013 at 11:03. Reason: replaced narrative with pseudocode