Quote:
Originally Posted by fasset
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