I am working on a project where the motor controller needs to be rewritten because it's not behaving properly (the motor is vibrating too much and tuning its parameters is close to impossible). The person responsible for the controller is not able to work on it so I am left to fix the problem.
To be noted: In feedforward the motor works perfectly fine.
We are using a modified 3 phase BLDC motor with a custom power drive with 6 MOSFET's driven by a DVR8301. The PWM generation code-side works fine (FF works). The feedback loop is broken, however.
For the encoder we are using a RM08 encoder by Renishaw. It's a 12 bit absolute magnetic encoder.
My question is what the fastest way is to get this motor controlled with a closed loop. I want to use a velocity control.
The motor is controlled using a Zynq SoC with code written in C++ running at 20kHz interrupts. However, I have everything hooked up to a speedgoat over EtherCAT so I can read and write data at 10kHz over simulink real time as well. If I can get a working principle in Simulink I can translate that to code easily.
The PWM is calculated based on the magnitude. The angle is what we are using in the feedforward controller. We increment the angle by 0.9 units and subtract 360 from it if it gets over that value (to prevent overflow).
My idea was to use a simple p-gain controller where the velocity setpoint is by how much the angle is being incremented and the output of the system would be the magnitude. The magnitude will have to increase to accommodate load on the motor, hence the velocity controller.
So in conclusion, I would appreciate some guidance on how to create this motor controller