View Single Post
Old 02-10-2009, 10:16 AM   #374 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
Quote:
Originally Posted by MazdaMatt View Post
Paul,

generally i try to design PI control in excel... but you may have better luck with a simple circuit to test it. Doing it "quickly" in excel is best for linear systems - yours is not.

Make a circuit that has a button and does a sudden switch from 0v to 1v. Have this output go to your throttle input. Tie your scope "trigger" lead to the button and the other lead to the current sensor. Push the button, see what happens.

If you wanted to get fancy about it, make your code examine itself. Instead of reading the throttle line, read a variable. On startup, make a 1 second timer, when it expires, set your variable to the equivalent of half throttle or full throttle and set a flag. When the PI loop sees the flag is set, have it start storing its output and input values in an array. Copy that array to the computer and you can examine your system response. With that, you could even tune your P and I values in excel without trial an error.

too much? Sorry, just brainstorming solutions...
These are wonderful ideas! Not too much! Thank you! Hmm... Store results in an array, and copy it to the computer. I love that idea. I've never tried that. Is that what the EEProm is for? If I stored the array in standard memory, is it lost when the power is cut? I bet it is. I need to figure out how to use the PROM.

-Paul
__________________
kits and boards
  Reply With Quote