HPM SDK
HPMicro Software Development Kit
hpm_mcl_loop.h File Reference
#include "hpm_mcl_common.h"
#include "hpm_mcl_encoder.h"
#include "hpm_mcl_analog.h"
#include "hpm_mcl_control.h"
#include "hpm_mcl_drivers.h"
#include "hpm_mcl_path_plan.h"
#include "hpm_mcl_debug.h"

Go to the source code of this file.

Data Structures

struct  mcl_loop_cfg_t
 Loop Configuration. More...
 
struct  mcl_hardware_clc_cfg_t
 Hardware configuration for CLC. More...
 
struct  mcl_offline_param_detection_rundata_t
 
struct  mcl_loop_t
 Loop operation data. More...
 

Enumerations

enum  mcl_loop_status_t { loop_status_null = 0 , loop_status_init = 1 , loop_status_run = 2 , loop_status_fail = 3 }
 
enum  mcl_loop_mode_t {
  mcl_mode_foc = 1 , mcl_mode_block = 2 , mcl_mode_hardware_foc = 3 , mcl_mode_step_foc = 4 ,
  mcl_mode_offline_param_detection = 5
}
 Algorithms used in loops. More...
 
enum  mcl_loop_chn_t { loop_chn_id = 0 , loop_chn_iq = 1 }
 CLC channel. More...
 
enum  mcl_offline_param_detection_mode_t {
  offline_param_detection_mode_init = 0 , offline_param_detection_mode_rs = 1 , offline_param_detection_mode_ld = 2 , offline_param_detection_mode_lq = 3 ,
  offline_param_detection_mode_ls = 4 , offline_param_detection_mode_flux = 5 , offline_param_detection_mode_wait = 6 , offline_param_detection_mode_end = 7 ,
  offline_param_detection_mode_error = 8
}
 Internal use, process control in the process. More...
 

Functions

hpm_mcl_stat_t hpm_mcl_loop_init (mcl_loop_t *loop, mcl_loop_cfg_t *cfg, mcl_cfg_t *mcl_cfg, mcl_encoder_t *encoder, mcl_analog_t *analog, mcl_control_t *control, mcl_drivers_t *drivers, mcl_path_plan_t *path)
 Initialisation loop data. More...
 
hpm_mcl_stat_t hpm_mcl_loop_set_current_d (mcl_loop_t *loop, mcl_user_value_t id)
 Setting the d-axis current. More...
 
hpm_mcl_stat_t hpm_mcl_loop_set_current_q (mcl_loop_t *loop, mcl_user_value_t iq)
 Setting the q-axis current. More...
 
hpm_mcl_stat_t hpm_mcl_loop_set_speed (mcl_loop_t *loop, mcl_user_value_t speed)
 Setting the speed loop speed feed. More...
 
hpm_mcl_stat_t hpm_mcl_loop_set_position (mcl_loop_t *loop, mcl_user_value_t position)
 Setting the position parameters. More...
 
hpm_mcl_stat_t hpm_mcl_loop_disable_all_user_set_value (mcl_loop_t *loop)
 Invalid user-set values in all loops. More...
 
hpm_mcl_stat_t hpm_mcl_loop (mcl_loop_t *loop)
 Motor Loop, Periodic Recall. More...
 
hpm_mcl_stat_t hpm_mcl_loop_refresh_block (mcl_loop_t *loop)
 Call this function in the interrupt function to update the motor's sector. More...
 
hpm_mcl_stat_t hpm_mcl_loop_start_block (mcl_loop_t *loop)
 Call this function in the interrupt function to start the motor's sector. More...
 
static void hpm_mcl_loop_enable (mcl_loop_t *loop)
 Enable Loop. More...
 
static void hpm_mcl_loop_disable (mcl_loop_t *loop)
 Disable Loop. More...
 
static void hpm_mcl_loop_enable_offline_param_detecion (mcl_loop_t *loop)
 Enables the loop's offline parameter detection. More...
 
static bool hpm_mcl_loop_offline_param_detection_is_done (mcl_loop_t *loop)
 Get offline parameter is done. More...
 
static bool hpm_mcl_loop_offline_param_detection_is_error (mcl_loop_t *loop)
 Get offline parameter is error. More...
 
static void hpm_mcl_loop_offline_param_detection_get_result (mcl_loop_t *loop, mcl_offline_param_detection_result_t *result)
 Get offline parameter detection result. More...
 
static void hpm_mcl_loop_mode_set (mcl_loop_t *loop, mcl_loop_mode_t mode)
 Set loop mode. More...
 
static void hpm_mcl_enable_position_loop (mcl_loop_t *loop)
 Enable position loop. More...
 
static void hpm_mcl_disable_position_loop (mcl_loop_t *loop)
 Disable position loop. More...
 
static void hpm_mcl_enable_speed_loop (mcl_loop_t *loop)
 Enable speed loop. More...
 
static void hpm_mcl_disable_speed_loop (mcl_loop_t *loop)
 Disable speed loop. More...
 
static hpm_mcl_stat_t hpm_mcl_disable_dead_area_compensation (mcl_loop_t *loop)
 disable dead area compensation More...
 
static hpm_mcl_stat_t hpm_mcl_enable_dead_area_compensation (mcl_loop_t *loop)
 enable dead area compensation More...
 
static hpm_mcl_stat_t hpm_mcl_disable_dq_axis_decoupling (mcl_loop_t *loop)
 disable dq axis decoupling More...
 
static hpm_mcl_stat_t hpm_mcl_enable_dq_axis_decoupling (mcl_loop_t *loop)
 enable dq axis decoupling More...
 
static uint32_t hpm_mcl_get_current_loop_run_tick (mcl_loop_t *loop)
 Get current loop run tick. More...
 

Enumeration Type Documentation

◆ mcl_loop_chn_t

CLC channel.

Enumerator
loop_chn_id 
loop_chn_iq 

◆ mcl_loop_mode_t

Algorithms used in loops.

Enumerator
mcl_mode_foc 
mcl_mode_block 
mcl_mode_hardware_foc 
mcl_mode_step_foc 
mcl_mode_offline_param_detection 

◆ mcl_loop_status_t

Enumerator
loop_status_null 
loop_status_init 
loop_status_run 
loop_status_fail 

◆ mcl_offline_param_detection_mode_t

Internal use, process control in the process.

Enumerator
offline_param_detection_mode_init 
offline_param_detection_mode_rs 
offline_param_detection_mode_ld 
offline_param_detection_mode_lq 
offline_param_detection_mode_ls 
offline_param_detection_mode_flux 
offline_param_detection_mode_wait 
offline_param_detection_mode_end 
offline_param_detection_mode_error 

Function Documentation

◆ hpm_mcl_disable_dead_area_compensation()

static hpm_mcl_stat_t hpm_mcl_disable_dead_area_compensation ( mcl_loop_t loop)
inlinestatic

disable dead area compensation

Parameters
loopmcl_loop_t

◆ hpm_mcl_disable_dq_axis_decoupling()

static hpm_mcl_stat_t hpm_mcl_disable_dq_axis_decoupling ( mcl_loop_t loop)
inlinestatic

disable dq axis decoupling

Parameters
loopmcl_loop_t

◆ hpm_mcl_disable_position_loop()

static void hpm_mcl_disable_position_loop ( mcl_loop_t loop)
inlinestatic

Disable position loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_disable_speed_loop()

static void hpm_mcl_disable_speed_loop ( mcl_loop_t loop)
inlinestatic

Disable speed loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_enable_dead_area_compensation()

static hpm_mcl_stat_t hpm_mcl_enable_dead_area_compensation ( mcl_loop_t loop)
inlinestatic

enable dead area compensation

Parameters
loopmcl_loop_t

◆ hpm_mcl_enable_dq_axis_decoupling()

static hpm_mcl_stat_t hpm_mcl_enable_dq_axis_decoupling ( mcl_loop_t loop)
inlinestatic

enable dq axis decoupling

Parameters
loopmcl_loop_t

◆ hpm_mcl_enable_position_loop()

static void hpm_mcl_enable_position_loop ( mcl_loop_t loop)
inlinestatic

Enable position loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_enable_speed_loop()

static void hpm_mcl_enable_speed_loop ( mcl_loop_t loop)
inlinestatic

Enable speed loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_get_current_loop_run_tick()

static uint32_t hpm_mcl_get_current_loop_run_tick ( mcl_loop_t loop)
inlinestatic

Get current loop run tick.

Parameters
loopmcl_loop_t
Returns
uint32_t tick

◆ hpm_mcl_loop()

hpm_mcl_stat_t hpm_mcl_loop ( mcl_loop_t loop)

Motor Loop, Periodic Recall.

Parameters
loopmcl_loop_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_disable()

static void hpm_mcl_loop_disable ( mcl_loop_t loop)
inlinestatic

Disable Loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_loop_disable_all_user_set_value()

hpm_mcl_stat_t hpm_mcl_loop_disable_all_user_set_value ( mcl_loop_t loop)

Invalid user-set values in all loops.

Parameters
loopmcl_loop_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_enable()

static void hpm_mcl_loop_enable ( mcl_loop_t loop)
inlinestatic

Enable Loop.

Parameters
loopmcl_loop_t

◆ hpm_mcl_loop_enable_offline_param_detecion()

static void hpm_mcl_loop_enable_offline_param_detecion ( mcl_loop_t loop)
inlinestatic

Enables the loop's offline parameter detection.

Parameters
loopmcl_loop_t

◆ hpm_mcl_loop_init()

hpm_mcl_stat_t hpm_mcl_loop_init ( mcl_loop_t loop,
mcl_loop_cfg_t cfg,
mcl_cfg_t mcl_cfg,
mcl_encoder_t encoder,
mcl_analog_t analog,
mcl_control_t control,
mcl_drivers_t drivers,
mcl_path_plan_t path 
)

Initialisation loop data.

Parameters
loopmcl_loop_t
cfgmcl_loop_cfg_t
mcl_cfgmcl_cfg_t
encodermcl_encoder_t
analogmcl_analog_t
controlmcl_control_t
driversmcl_drivers_t
pathmcl_path_plan_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_mode_set()

static void hpm_mcl_loop_mode_set ( mcl_loop_t loop,
mcl_loop_mode_t  mode 
)
inlinestatic

Set loop mode.

Parameters
loopmcl_loop_t
modemcl_loop_mode_t

◆ hpm_mcl_loop_offline_param_detection_get_result()

static void hpm_mcl_loop_offline_param_detection_get_result ( mcl_loop_t loop,
mcl_offline_param_detection_result_t result 
)
inlinestatic

Get offline parameter detection result.

Parameters
loopmcl_loop_t
resultmcl_offline_param_detection_result_t

◆ hpm_mcl_loop_offline_param_detection_is_done()

static bool hpm_mcl_loop_offline_param_detection_is_done ( mcl_loop_t loop)
inlinestatic

Get offline parameter is done.

Parameters
loopmcl_loop_t
Returns
bool

◆ hpm_mcl_loop_offline_param_detection_is_error()

static bool hpm_mcl_loop_offline_param_detection_is_error ( mcl_loop_t loop)
inlinestatic

Get offline parameter is error.

Parameters
loopmcl_loop_t
Returns
true or false

◆ hpm_mcl_loop_refresh_block()

hpm_mcl_stat_t hpm_mcl_loop_refresh_block ( mcl_loop_t loop)

Call this function in the interrupt function to update the motor's sector.

Parameters
loopmcl_loop_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_set_current_d()

hpm_mcl_stat_t hpm_mcl_loop_set_current_d ( mcl_loop_t loop,
mcl_user_value_t  id 
)

Setting the d-axis current.

Parameters
loopmcl_loop_t
idmcl_user_value_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_set_current_q()

hpm_mcl_stat_t hpm_mcl_loop_set_current_q ( mcl_loop_t loop,
mcl_user_value_t  iq 
)

Setting the q-axis current.

Parameters
loopmcl_loop_t
iqmcl_user_value_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_set_position()

hpm_mcl_stat_t hpm_mcl_loop_set_position ( mcl_loop_t loop,
mcl_user_value_t  position 
)

Setting the position parameters.

Parameters
loopmcl_loop_t
positionmcl_user_value_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_set_speed()

hpm_mcl_stat_t hpm_mcl_loop_set_speed ( mcl_loop_t loop,
mcl_user_value_t  speed 
)

Setting the speed loop speed feed.

Parameters
loopmcl_loop_t
speedmcl_user_value_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_loop_start_block()

hpm_mcl_stat_t hpm_mcl_loop_start_block ( mcl_loop_t loop)

Call this function in the interrupt function to start the motor's sector.

Parameters
loopmcl_loop_t
Returns
hpm_mcl_stat_t