Same here, electrical engineer in field of power electronics. Power conversion is my bread and butter but I haven't done any motor control so have to learn the stuff from scratch.jeanl wrote: ↑Apr 30 2018 5:59pmcasainho, I have no specific knowledge of FOC, but I have Electrical Engineering background with lots of math etc, so perhaps I can help with that. I need to have a bit more background though. I perused through the document that was posted above (the lengthy one with all the details on FOC) but I need to read it a lot more carefully if I want to help.casainho wrote: ↑Apr 30 2018 5:20pmThe original firmware runs the motor very silently compared to the 6 steps/square wave/block commutation I implemented. I saw the PWM signals and are SVM just like used on FOC but I think they are simple doing "FOC" using motor parameters!!
The development is blocked because I don't know how to implement "FOC" using the motor parameters... Let's see if jur can help
What do you mean by " I don't know how to implement "FOC" using the motor parameters"? Can you quickly summarize where you are and what you think is missing?
(and kudos for all you're doing, it's awesome)
BUT @casainho, if your only problem is that floating point math is taking too long, it isn't a problem to use integer math in this case. Our company does digital control of power converters, and floating point isn't used - we simply use integer math and convert at the end. Enough bits and accuracy is not impacted.
For example, duty cycle can be encoded with sufficient resolution using 8 bits (more than enough or even too many, 7 may be enough even with good enough resolution for this application). Voltage, also 7 or 8 bits. To get E, multiply, then right shift keeping the correct MSB. And so on. I am assuming you can do 16 bit operations.
Another question, what PWM frequency are you aiming for? Several issues here: Too high won't work, probably causing magnetising losses in the stator core, and the MOSFET gate drives are also very slow, from a TSDZ2 circuit I saw somewhere. I would measure the existing firmware's frequency and aim for the same, at least as a starting point.