bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::actuators::BLDCMotor Class Reference

The electrical model of a three-phase brushless motor with six-step commutation from three Hall sensors. More...

#include <bldc_motor.h>

Public Member Functions

 BLDCMotor (const BLDCMotorParameters &m, real_t hall_offset=0.0)
real_t phase_emf (int phase, real_t theta_e) const
 The back-EMF of a phase per unit of mechanical speed [V s/rad]. The phases are shifted by 120 electrical degrees.
real_t sensed_angle (real_t theta) const
 The electrical angle the controller sees for the mechanical angle theta [rad].
real_t step (real_t V, real_t theta, real_t w, real_t dt)
 Advance the current by dt [s] for supply voltage V and return the torque [N m]. theta and w are the mechanical angle [rad] and speed [rad/s] of the rotor. The current is taken to move to the new pair at once when the sector changes.
real_t current () const noexcept
const PhasePair & pair () const noexcept
real_t k_line () const noexcept
 The peak of the line-to-line back-EMF per unit of speed: \(\pi K_e / 3\).
const BLDCMotorParameters & parameters () const noexcept

Static Public Member Functions

static int hall_code (real_t theta_e)
 The code of the three Hall sensors, 120 electrical degrees apart, at electrical angle theta_e: h1 + 2 h2 + 4 h3. Each sensor is on for half a turn, so the code tells which of six sectors the rotor is in.
static PhasePair commutation (int hall_code)
 The commutation table: for each Hall code the pair of phases whose back-EMF is largest in that sector. Codes 0 and 7 never happen with working sensors and give {0, 0}.

Detailed Description

The electrical model of a three-phase brushless motor with six-step commutation from three Hall sensors.

The rotor's angle and speed come from outside, so the same model works with a simple rotor model, BLDCRotor, and with a rigid body in a physics engine. Each step works out the sector from the Hall sensors, connects the two phases of the commutation table in series, advances their current and returns the torque. The back-EMF of each phase is sinusoidal, scaled so that its average over a sector matches the DC-equivalent model.

Constructor & Destructor Documentation

◆ BLDCMotor()

bitsim::actuators::BLDCMotor::BLDCMotor ( const BLDCMotorParameters & m,
real_t hall_offset = 0.0 )
explicit
Parameters
mThe motor
hall_offsetHow far the Hall sensors are from where they should be [electrical rad]; a misplaced sensor makes the controller see the wrong sector

Member Function Documentation

◆ commutation()

PhasePair bitsim::actuators::BLDCMotor::commutation ( int hall_code)
static

The commutation table: for each Hall code the pair of phases whose back-EMF is largest in that sector. Codes 0 and 7 never happen with working sensors and give {0, 0}.

◆ current()

real_t bitsim::actuators::BLDCMotor::current ( ) const
inlinenoexcept

◆ hall_code()

int bitsim::actuators::BLDCMotor::hall_code ( real_t theta_e)
static

The code of the three Hall sensors, 120 electrical degrees apart, at electrical angle theta_e: h1 + 2 h2 + 4 h3. Each sensor is on for half a turn, so the code tells which of six sectors the rotor is in.

◆ k_line()

real_t bitsim::actuators::BLDCMotor::k_line ( ) const
inlinenoexcept

The peak of the line-to-line back-EMF per unit of speed: \(\pi K_e / 3\).

◆ pair()

const PhasePair & bitsim::actuators::BLDCMotor::pair ( ) const
inlinenoexcept

◆ parameters()

const BLDCMotorParameters & bitsim::actuators::BLDCMotor::parameters ( ) const
inlinenoexcept

◆ phase_emf()

real_t bitsim::actuators::BLDCMotor::phase_emf ( int phase,
real_t theta_e ) const

The back-EMF of a phase per unit of mechanical speed [V s/rad]. The phases are shifted by 120 electrical degrees.

◆ sensed_angle()

real_t bitsim::actuators::BLDCMotor::sensed_angle ( real_t theta) const

The electrical angle the controller sees for the mechanical angle theta [rad].

◆ step()

real_t bitsim::actuators::BLDCMotor::step ( real_t V,
real_t theta,
real_t w,
real_t dt )

Advance the current by dt [s] for supply voltage V and return the torque [N m]. theta and w are the mechanical angle [rad] and speed [rad/s] of the rotor. The current is taken to move to the new pair at once when the sector changes.


The documentation for this class was generated from the following files: