View Single Post
Old 09-13-2017, 06:08 PM   #7204 (permalink)
thingstodo
Master EcoModder
 
Join Date: Sep 2010
Location: Saskatoon, canada
Posts: 1,488

Ford Prefect - '18 Ford F150 XLT XTR

Tess - '22 Tesla Y LR
Thanks: 749
Thanked 565 Times in 447 Posts
??

Quote:
Originally Posted by fasset View Post
I'm trying to write soft for Field Oriented Control of induction motor. I have finished 3ph 3kW inverter, controled by STM32F4, and V/F open loop algorithm to control ACIM - it works. Now I'm trying to implement FOC algorithm rewriting code from this project using float variables.
I think that maybe this should be moved to the AC controller thread? Do you need to be a moderator to do that?

As for the translation of the code, you should be able to run the code as Paul wrote it. The floating point variables should work as written. It appears to be ansi standard C with no goofy library calls.

If you want to optimize the math to make better use of your floating point math library, I'd suggest doing that after you have Paul's math running. Just my opinion. That way you can run through a test set for your math before your changes and after your changes to make sure it still works!

As for the range on degrees, you should be able to use the modulo or mod() function on your angle to bring it back to the range 0 - 360. It won't matter for the intermediate calculations. Sin(0) = sin(360) = sin(720). It is only convention that shows the angle between 0 and 360 degrees.

Hope this helps
__________________
In THEORY there is no difference between Theory and Practice
In PRACTICE there IS!
  Reply With Quote
The Following User Says Thank You to thingstodo For This Useful Post:
MPaulHolmes (11-21-2017)