Skip to content

Commit

Permalink
[Rotor Estimator] Convert input voltages to alpha beta type
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil-kale committed Jan 1, 2024
1 parent e34f2a3 commit d42fa18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions control_loop/bldc/brushless_control_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ void BrushlessControlLoop::update_rotor_position_estimator(
estimator_inputs.pm_flux_linkage = params_->foc_params.pm_flux_linkage;

// Set the V alpha and V beta
estimator_inputs.V_alpha = V_alpha_beta_.alpha;
estimator_inputs.V_beta = V_alpha_beta_.beta;
estimator_inputs.V_alpha_beta = V_alpha_beta_;

app_hal_status_E status = primary_rotor_position_estimator_.update(estimator_inputs);

Expand Down
4 changes: 2 additions & 2 deletions control_loop/bldc/rotor_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ app_hal_status_E SensorlessRotorFluxObserver::update(const EstimatorInputs& inpu
// Clarke transform the current
math::alpha_beta_t i_ab = math::clarke_transform(inputs.phase_current.u, inputs.phase_current.v, inputs.phase_current.w);
// Get the y_alpha and y_beta values
const float y_alpha = determine_flux_driving_voltage(stator_resistance, inputs.V_alpha, i_ab.alpha);
const float y_beta = determine_flux_driving_voltage(stator_resistance, inputs.V_beta, i_ab.beta);
const float y_alpha = determine_flux_driving_voltage(stator_resistance, inputs.V_alpha_beta.alpha, i_ab.alpha);
const float y_beta = determine_flux_driving_voltage(stator_resistance, inputs.V_alpha_beta.beta, i_ab.beta);

// Get the eta values for the alpha and beta axes
const float eta_alpha = determine_flux_deviation(x_alpha_, stator_inductance, i_ab.alpha);
Expand Down
12 changes: 4 additions & 8 deletions control_loop/bldc/rotor_estimator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "bridge_3phase.hpp"
#include "brushless_6step_commutation.hpp"
#include "hal_clock.hpp"
#include "math_foc.hpp"

namespace bldc_rotor_estimator {

Expand Down Expand Up @@ -43,15 +44,10 @@ class ElectricalRotorPosEstimator {
hwbridge::Bridge3Phase::phase_current_t phase_current;

/**
* @brief The phase voltages in the frame of reference of the rotor
* @todo Convert this to a alpha/beta frame type
* @brief The applied voltage in the alpha-beta frame of the previous control loop iteration fed-forward to the rotor
* position estimator
*/
float V_alpha = 0.0f;
/**
* @brief The phase voltages in the frame of reference of the rotor
* @todo Convert this to a alpha/beta frame type
*/
float V_beta = 0.0f;
math::alpha_beta_t V_alpha_beta;

/**
* @brief The phase resistance of the motor (Ohms)
Expand Down

0 comments on commit d42fa18

Please sign in to comment.