This project is meant to serve as a library for implementing the Back EMF observer for Permanent Magnet Synchronous Machine (PMSM) motors. This can also be used for BLDC motors they have similar dynamics with a different back EMF waveform.
Field Oriented Control (FOC) of PMSM machine takes advantage of Clarke and Park frame transforms to convert our AC (ABC frame) system dynamics to rotor angle independent DC (DQ frame) dynamics where the tradition PI control techniques for DC motors can work. The control variables are transformed back via inverse transform for generating voltage duties.
The knowledge of the rotor angle is important for transforming in and out of DQ and ABC frames. This is traditionally achieved by using Hall effect sensors for magnetic sensing.
Field Oriented Control of PMSM
In high speed applications, where Hall sensor accuracy might not be enough or they might fail due to high temperatures of the machine stator, the rotor angle can be estimated by numerically solving the system dynamics with the available state variables (currents and voltages) for the Back EMF generated by the rotor magnets. This is done by "observing" (see State Observer) the variables used to reconstruct the lost state, which is effectively just reducing the error between the actual observed state and estimated state. This is done by tuning PI controllers to reduce estimation error in back EMFs.
Back EMF Observer Block Diagram
The back EMFs can be used to estimate the error in the rotor angle, which is an input to another PID controller called the tracker which outputs the speed and rotor angle used for FOC.
Examples on how to use the library can be taken from the tests present in the tests
folder.
- C++ 17 compiler (GCC)
- cmake 3.15
- pre-commit
- clang-format-14
- Open a shell and navigate to project root folder
- Run the build bash script. This calls the underlying cmake command and runs tests. You can also run the build script with the
--release
or--debug
flags.
./build.sh
- Binaries are made in the bin folder. Run any executable from the bin folder.
./bin/bemf_observer_test
- To clean the build and bin files, pass
--clean
flag to the build script.
./build.sh --clean