HPM SDK
HPMicro Software Development Kit
hpm_mcl_physical.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef HPM_MCL_PHYSICAL_H
8 #define HPM_MCL_PHYSICAL_H
9 #include "hpm_common.h"
10 
11 #define MCL_ANALOG_CHN_NUM 10
18 typedef enum {
19  phase_60, /*60*/
20  phase_120 /*120*/
22 
23 typedef enum {
25  motor_dir_back = 2
27 
28 typedef struct {
29  float res;
30  int32_t pole_num;
31  float vbus;
32  float ld;
33  float lq;
34  float ls;
35  float i_max;
36  float i_rated;
37  float power;
38  float inertia;
39  float rpm_max;
40  float flux;
43 
44 typedef struct {
45  int32_t res;
46  int32_t pole_num;
47  int32_t vbus;
48  int32_t ld;
49  int32_t lq;
50  int32_t ls;
51  int32_t i_max;
52  int32_t i_rated;
53  int32_t power;
54  int32_t inertia;
55  int32_t rpm_max;
56  int32_t flux;
59 
60 typedef struct {
61  float sample_res;
63  float opamp_gain;
64  int32_t sample_precision;
66 
67 typedef struct {
68  int32_t sample_res;
69  int32_t opamp_gain;
71  int32_t sample_precision;
73 
74 typedef struct {
77  int32_t pwm_reload;
78  float pwm_frequency;
81 
82 typedef struct {
85  int32_t pwm_reload;
86  int32_t pwm_frequency;
87  int32_t pwm_dead_tick;
89 
90 typedef struct {
91  int32_t pwm_clock_tick;
92  int32_t mcu_clock_tick;
93  float speed_loop_ts;
97  float adc_sample_ts;
99 
100 typedef struct {
101  int32_t pwm_clock_tick;
102  int32_t mcu_clock_tick;
103  int32_t speed_loop_ts;
106  int32_t adc_sample_ts;
108 
109 typedef struct {
114 
115 typedef struct {
120 
121 #endif
hall_phase_t
The mounting angle of the Hall sensor, 60 degrees or 120 degrees, is an inherent property of the moto...
Definition: hpm_mcl_physical.h:18
@ phase_120
Definition: hpm_mcl_physical.h:20
@ phase_60
Definition: hpm_mcl_physical.h:19
#define MCL_ANALOG_CHN_NUM
Definition: hpm_mcl_physical.h:11
mcl_motor_dir_t
Definition: hpm_mcl_physical.h:23
@ motor_dir_back
Definition: hpm_mcl_physical.h:25
@ motor_dir_forward
Definition: hpm_mcl_physical.h:24
Definition: hpm_mcl_physical.h:115
physical_time_q_t time
Definition: hpm_mcl_physical.h:118
physical_motor_q_t motor
Definition: hpm_mcl_physical.h:116
physical_board_q_t board
Definition: hpm_mcl_physical.h:117
Definition: hpm_mcl_physical.h:109
physical_time_t time
Definition: hpm_mcl_physical.h:112
physical_board_t board
Definition: hpm_mcl_physical.h:111
physical_motor_t motor
Definition: hpm_mcl_physical.h:110
Definition: hpm_mcl_physical.h:67
int32_t adc_reference_vol
Definition: hpm_mcl_physical.h:70
int32_t sample_res
Definition: hpm_mcl_physical.h:68
int32_t sample_precision
Definition: hpm_mcl_physical.h:71
int32_t opamp_gain
Definition: hpm_mcl_physical.h:69
Definition: hpm_mcl_physical.h:60
float sample_res
Definition: hpm_mcl_physical.h:61
float adc_reference_vol
Definition: hpm_mcl_physical.h:62
float opamp_gain
Definition: hpm_mcl_physical.h:63
int32_t sample_precision
Definition: hpm_mcl_physical.h:64
Definition: hpm_mcl_physical.h:82
int32_t pwm_frequency
Definition: hpm_mcl_physical.h:86
int32_t pwm_reload
Definition: hpm_mcl_physical.h:85
int32_t num_current_sample_res
Definition: hpm_mcl_physical.h:84
int32_t pwm_dead_tick
Definition: hpm_mcl_physical.h:87
Definition: hpm_mcl_physical.h:74
int32_t pwm_reload
Definition: hpm_mcl_physical.h:77
int32_t num_current_sample_res
Definition: hpm_mcl_physical.h:76
float pwm_frequency
Definition: hpm_mcl_physical.h:78
int32_t pwm_dead_time_tick
Definition: hpm_mcl_physical.h:79
Definition: hpm_mcl_physical.h:44
int32_t ld
Definition: hpm_mcl_physical.h:48
int32_t lq
Definition: hpm_mcl_physical.h:49
int32_t pole_num
Definition: hpm_mcl_physical.h:46
int32_t ls
Definition: hpm_mcl_physical.h:50
int32_t i_rated
Definition: hpm_mcl_physical.h:52
hall_phase_t hall
Definition: hpm_mcl_physical.h:57
int32_t i_max
Definition: hpm_mcl_physical.h:51
int32_t rpm_max
Definition: hpm_mcl_physical.h:55
int32_t power
Definition: hpm_mcl_physical.h:53
int32_t vbus
Definition: hpm_mcl_physical.h:47
int32_t flux
Definition: hpm_mcl_physical.h:56
int32_t inertia
Definition: hpm_mcl_physical.h:54
int32_t res
Definition: hpm_mcl_physical.h:45
Definition: hpm_mcl_physical.h:28
float flux
Definition: hpm_mcl_physical.h:40
float rpm_max
Definition: hpm_mcl_physical.h:39
float power
Definition: hpm_mcl_physical.h:37
float lq
Definition: hpm_mcl_physical.h:33
float vbus
Definition: hpm_mcl_physical.h:31
float res
Definition: hpm_mcl_physical.h:29
hall_phase_t hall
Definition: hpm_mcl_physical.h:41
float ld
Definition: hpm_mcl_physical.h:32
int32_t pole_num
Definition: hpm_mcl_physical.h:30
float i_max
Definition: hpm_mcl_physical.h:35
float ls
Definition: hpm_mcl_physical.h:34
float inertia
Definition: hpm_mcl_physical.h:38
float i_rated
Definition: hpm_mcl_physical.h:36
Definition: hpm_mcl_physical.h:100
int32_t adc_sample_ts
Definition: hpm_mcl_physical.h:106
int32_t pwm_clock_tick
Definition: hpm_mcl_physical.h:101
int32_t position_loop_ts
Definition: hpm_mcl_physical.h:105
int32_t mcu_clock_tick
Definition: hpm_mcl_physical.h:102
int32_t speed_loop_ts
Definition: hpm_mcl_physical.h:103
int32_t current_loop_ts
Definition: hpm_mcl_physical.h:104
Definition: hpm_mcl_physical.h:90
float adc_sample_ts
Definition: hpm_mcl_physical.h:97
float speed_loop_ts
Definition: hpm_mcl_physical.h:93
float position_loop_ts
Definition: hpm_mcl_physical.h:95
float current_loop_ts
Definition: hpm_mcl_physical.h:94
int32_t pwm_clock_tick
Definition: hpm_mcl_physical.h:91
int32_t mcu_clock_tick
Definition: hpm_mcl_physical.h:92
float encoder_process_ts
Definition: hpm_mcl_physical.h:96