AM263x Motor Control SDK  09.02.00
userParams.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef USERPARAMS_H
34 #define USERPARAMS_H
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
51 #include <stdbool.h>
52 
53 #include "math_types.h"
54 #include "motor.h"
55 
56 // **************************************************************************
57 // the defines
58 
59 
62 typedef enum
63 {
64  MTR_1 = 0,
65  MTR_2 = 1,
66  MTR_3 = 2,
67 } MotorNum_e;
68 
69 //*****************************************************************************
70 //
72 //
73 //*****************************************************************************
74 typedef struct _USER_Params_
75 {
77  int_least16_t numIsrTicksPerCtrlTick;
82  int_least16_t numIsrTicksPerEstTick;
86  int_least16_t numIsrTicksPerTrajTick;
94  int_least16_t numCtrlTicksPerSpeedTick;
98  uint_least8_t numCurrentSensors;
99  uint_least8_t numVoltageSensors;
101  float32_t systemFreq_MHz;
103  float32_t pwmPeriod_usec;
105  float32_t voltage_sf;
107  float32_t current_sf;
109  float32_t dcBusPole_rps;
111  float32_t speedPole_rps;
113  float32_t voltageFilterPole_rps;
115  float32_t maxVsMag_pu;
117  MOTOR_Type_e motor_type;
120  uint16_t motor_numEncSlots;
122  float32_t motor_ratedFlux_Wb;
125  float32_t motor_Rr_Ohm;
127  float32_t motor_Rs_Ohm;
129  float32_t motor_Ls_d_H;
131  float32_t motor_Ls_q_H;
133  float32_t maxCurrent_A;
135  float32_t IdRated_A;
137  float32_t Vd_sf;
139  float32_t maxVsMag_V;
142  float32_t BWc_rps;
144  float32_t BWdelta;
146  float32_t Kctrl_Wb_p_kgm2;
148  float32_t angleDelayed_sf_sec;
150  float32_t fluxExcFreq_Hz;
153  float32_t ctrlFreq_Hz;
155  float32_t estFreq_Hz;
157  float32_t RoverL_excFreq_Hz;
159  float32_t trajFreq_Hz;
161  float32_t ctrlPeriod_sec;
163  float32_t maxAccel_Hzps;
165  float32_t maxCurrent_resEst_A;
167  float32_t maxCurrent_indEst_A;
169  float32_t maxCurrentDelta_A;
171  float32_t maxCurrentDelta_pw_A;
173  float32_t IdRated_delta_A;
176  float32_t forceAngleFreq_Hz;
178  float32_t forceAngleAccel_Hzps;
180  //<! acceleration. Hzps
182  float32_t IdRatedFraction_indEst;
185  float32_t pwGain;
188  float32_t Kp_min_VpA;
190  float32_t Kp_max_VpA;
192  float32_t RoverL_Kp_sf;
194  float32_t RoverL_min_rps;
196  float32_t RoverL_max_rps;
198  float32_t oneOverDcBus_min_invV;
200  float32_t oneOverDcBus_max_invV;
202  float32_t Ls_d_H;
204  float32_t Ls_q_H;
207  float32_t Ls_coarseDelta_H;
210  float32_t Ls_fineDelta_H;
213  float32_t Ls_min_H;
216  float32_t Ls_max_H;
218  float32_t Rr_Ohm;
220  float32_t Rr_coarseDelta_Ohm;
222  float32_t Rr_fineDelta_Ohm;
225  float32_t Rr_min_Ohm;
228  float32_t Rr_max_Ohm;
230  float32_t Rs_Ohm;
232  float32_t Rs_coarseDelta_Ohm;
234  float32_t Rs_fineDelta_Ohm;
237  float32_t Rs_min_Ohm;
240  float32_t Rs_max_Ohm;
242  float32_t RsOnLine_DeltaInc_Ohm;
244  float32_t RsOnLine_DeltaDec_Ohm;
247  float32_t RsOnLine_min_Ohm;
250  float32_t RsOnLine_max_Ohm;
252  float32_t RsOnLine_angleDelta_rad;
254  float32_t RsOnLine_pole_rps;
257  bool flag_bypassMotorId;
260  // *******************************************************************************************************
263  // BELOW IS RESERVED
270 
274 
279 
280  // BELOW can be added with user's own varaibles
282 } USER_Params, *userParams_Handle;
284 
285 //*****************************************************************************
286 //
287 // Close the Doxygen group.
289 //
290 //*****************************************************************************
291 
292 //*****************************************************************************
293 //
294 // Mark the end of the C bindings section for C++ compilers.
295 //
296 //*****************************************************************************
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif // end of USERPARAMS_H definition
USER_Params::RoverLPole_rps
float32_t RoverLPole_rps
Definition: userParams.h:268
USER_Params::Dir_fe_max_Hz
float32_t Dir_fe_max_Hz
Definition: userParams.h:278
USER_Params::numCtrlTicksPerCurrentTick
int_least16_t numCtrlTicksPerCurrentTick
Definition: userParams.h:90
USER_Params::oneOverFlux_min_sf
float32_t oneOverFlux_min_sf
Definition: userParams.h:275
USER_Params::Dir_fe_min_Hz
float32_t Dir_fe_min_Hz
Definition: userParams.h:277
USER_Params::numIsrTicksPerEstTick
int_least16_t numIsrTicksPerEstTick
Definition: userParams.h:82
USER_Params::freqNearZeroSpeedLimit_Hz
float32_t freqNearZeroSpeedLimit_Hz
Definition: userParams.h:264
USER_Params::estKappa
float32_t estKappa
Definition: userParams.h:269
USER_Params
Defines a structure for the user parameters.
Definition: userParams.h:75
USER_Params::motor_numPolePairs
uint16_t motor_numPolePairs
for the motor
Definition: userParams.h:119
USER_Params::numCtrlTicksPerSpeedTick
int_least16_t numCtrlTicksPerSpeedTick
Definition: userParams.h:94
MotorNum_e
MotorNum_e
Enumeration for the Motor numbers.
Definition: userParams.h:63
USER_Params::flux_max_Wb
float32_t flux_max_Wb
Definition: userParams.h:273
USER_Params::numIsrTicksPerTrajTick
int_least16_t numIsrTicksPerTrajTick
Definition: userParams.h:86
MOTOR_Type_e
MOTOR_Type_e
Enumeration for the motor types.
Definition: motor.h:67
motor.h
Contains motor-specific enum and structs.
USER_Params::numCurrentSensors
uint_least8_t numCurrentSensors
Definition: userParams.h:98
MTR_1
@ MTR_1
Definition: userParams.h:64
USER_Params::oneOverFlux_max_sf
float32_t oneOverFlux_max_sf
Definition: userParams.h:276
MTR_3
@ MTR_3
Definition: userParams.h:66
MTR_2
@ MTR_2
Definition: userParams.h:65
USER_Params::directionPole_2_rps
float32_t directionPole_2_rps
Definition: userParams.h:266
USER_Params::flux_Wb
float32_t flux_Wb
Definition: userParams.h:271
USER_Params::flux_min_Wb
float32_t flux_min_Wb
Definition: userParams.h:272
USER_Params::fluxPole_rps
float32_t fluxPole_rps
Definition: userParams.h:267
USER_Params::indEst_speedMaxFraction
float32_t indEst_speedMaxFraction
Definition: userParams.h:181
USER_Params::directionPole_rps
float32_t directionPole_rps
Definition: userParams.h:265
float32_t
float float32_t
Definition: dcl_common.h:58
USER_Params::dcBus_nominal_V
float32_t dcBus_nominal_V
voltage, V
Definition: userParams.h:76
USER_Params::maxFrequency_Hz
float32_t maxFrequency_Hz
Definition: userParams.h:281