Skip to content

owntech-foundation/motor_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

motor_control

motor_control provides a calculation-only C++ control block for the Ownverter FOC examples.

Boundary

The library computes:

  • current reconstruction from measured phase currents
  • d/q current control
  • optional outer speed PI with decimation
  • optional open-loop electrical angle generation
  • Vdq, Vabc, and PWM duties

The application keeps ownership of:

  • board APIs (ShieldAPI, TaskAPI, ScopeMimicry, PositionAPI)
  • current offset calibration and signal filtering
  • startup, idle, error, and overcurrent handling
  • PWM enable/disable and all state-machine decisions

Public API

  • int8_t init(const MotorControlConfig& config)
  • void reset()
  • void setMode(MotorControlMode mode)
  • void setCurrentReference(const dqo_t& current_reference)
  • void setSpeedReference(float32_t speed_reference)
  • void setOpenLoopVoltageQ(float32_t open_loop_voltage_q)
  • void setOpenLoopSpeed(float32_t open_loop_speed)
  • void setOpenLoopAngle(float32_t open_loop_angle)
  • MotorControlOutput step(const MotorControlInput& input)

Application Contract

The application must provide, at every control tick:

  • calibrated ia and ib
  • measured DC bus voltage
  • electrical angle and speed when using closed-loop modes
  • a valid position_valid flag for closed-loop modes

The library returns only calculations. It does not latch faults, stop PWM, or change operating state.

Migration From The Example

The current Ownverter example keeps its state machine in src/main.cpp. The inline FOC math has been replaced by MotorControl::step(), while startup sequencing, protections, and serial commands stay in the application.

About

A library for motor control applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages