Motor Simulation and Sin/Cos Encoder Support

A project log for Axiom: 100+kW Motor Controller

High Power, High Performance 400V 300A 100+kW Motor Controller fully compatible with VESC

Marcos ChaparroMarcos Chaparro 04/15/2019 at 00:060 Comments

Today some code we developed for the VESC platform was merged into the master branch, reaching thousands of current VESC users.

Motor simulation inside the firmware is a critical step in our path to having the greatest controller out there.

It runs in cpu time, you can halt the debugger, take a look, and resume operation. Or you can perform  slow code coverage tests to ensure you have exercised all the lines in your code, often required by some industries.

Here is a screenshot of a motor startup being simulated:

The virtual motor is modelled as an IPM machine, and is engaged from the VESC Terminal inside the GUI.

More details in our Pull Request

The other piece of code we authored is Sin/Cos encoder support. These encoders provide absolute rotor angle feedback, no need to wait for indexes. They provide 2 sinewaves in quadrature, and by reading that signal the code can calculate the rotor angle.

Medium power motors are commonly using this kind of feedback. Zero bikes use them for example.

Here is the signal input:

And resulting phase measurement:

Here is the Pull Request, and the line of code that calculates the angle