MotorWare f2806x Module API Documentation
float/ctrl_obj.h
Go to the documentation of this file.
1 #ifndef _CTRL_OBJ_H_
2 #define _CTRL_OBJ_H_
3 
8 
9 // **************************************************************************
10 // the includes
11 
12 // drivers
13 
14 
15 // modules
21 
22 
23 // solutions
24 
25 
30 
31 
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 // **************************************************************************
39 // the defines
40 
41 
44 #define CTRL_MAJOR_RELEASE_NUMBER (2u)
45 
46 
49 #define CTRL_MINOR_RELEASE_NUMBER (0u)
50 
51 
54 #define CTRL_NUM_CONTROLLERS (2)
55 
56 
57 // **************************************************************************
58 // the typedefs
59 
62 typedef enum
63 {
69 
70 
73 typedef enum
74 {
80 
81 
84 typedef enum
85 {
89 } CTRL_Type_e;
90 
91 
94 typedef struct _CTRL_Version_
95 {
96  uint16_t rsvd;
97  uint16_t targetProc;
98  uint16_t major;
99  uint16_t minor;
100 } CTRL_Version;
101 
102 
105 typedef struct _CTRL_Obj_
106 {
108 
110 
112 
114 
117 
120 
123 
125 
126  int_least32_t waitTimes[CTRL_numStates];
127 
128  int_least32_t counter_state;
129 
130  int_least16_t numIsrTicksPerCtrlTick;
131 
133 
134  int_least16_t numCtrlTicksPerSpeedTick;
135 
137 
141 
143 
145 
147 
149 
151 
153 
155 
159 
163 
167 
171 
173 
175 
179 
180  int_least16_t counter_isr;
181  int_least16_t counter_current;
182  int_least16_t counter_speed;
183 
184  bool flag_enable;
186  bool flag_enableSpeedCtrl;
187 
191 
193 } CTRL_Obj;
194 
195 
198 typedef struct _CTRL_Obj_ *CTRL_Handle;
199 
200 
201 // **************************************************************************
202 // the globals
203 
204 
205 // **************************************************************************
206 // the function prototypes
207 
208 
209 #ifdef __cplusplus
210 }
211 #endif // extern "C"
212 
214 
215 #endif // end of _CTRL_OBJ_H_ definition
216 
PI Speed controller.
float_t speed_outMin_A
the minimum output value for the speed controller, A
Defines the controller (CTRL) version number.
Definition: 32b/ctrl_obj.h:131
CTRL_ErrorCode_e errorCode
the error code for the controller
Definition: 32b/ctrl_obj.h:152
float_t speedCtrlPeriod_sec
the period at which the speed controller runs, sec
Contains the public interface to the types definitions.
bool flag_enable
a flag to enable the controller
MATH_vec2 Idq_offset_A
the Idq offset values, A
int_least16_t counter_isr
the isr counter
float_t maxVsMag_V
the maximum stator voltage magnitude value, V
int_least16_t counter_speed
the speed counter
float_t currentCtrlPeriod_sec
the period at which the current controller runs, sec
int_least16_t numCtrlTicksPerCurrentTick
Defines the number of controller clock ticks per current controller clock tick.
Defines the PI controller object.
Definition: 32b/pi.h:74
PI_Handle piHandle_Id
the handle for the Id PI controller
float_t Ui_spd_A
the start integrator value for the speed controller, A
float_t Ki_spd_ApHz
the desired Ki_spd value, A/Hz
Contains the public interface to the math (MATH) module routines.
Defines a two element vector.
Definition: 32b/math.h:248
the number of controller states
Definition: ctrl_states.h:39
float_t Vd_sf
the Vd scale factor
float_t Ui_Id_V
the start integrator value for the Id controller, V
uint16_t major
the major release number
Definition: 32b/ctrl_obj.h:135
float_t Kctrl_Wb_p_kgm2
the controller constant, Wb/(kg*m^2)
bool flag_resetInt_Id
a flag to reset the Id integrator
2803x processor
CTRL_ErrorCode_e
Enumeration for the error codes.
float_t ctrlPeriod_sec
Defines the controller period, sec.
Definition: 32b/ctrl_obj.h:209
Defines the controller (CTRL) object.
Definition: 32b/ctrl_obj.h:144
bool flag_resetInt_spd
a flag to reset the speed integrator
PI_Obj pi_Id
the Id PI controller object
estimator error code
PI_Handle piHandle_Iq
the handle for the Iq PI controller
CTRL_TargetProc_e
Enumeration for the target processors.
struct _CTRL_Version_ CTRL_Version
Defines the controller (CTRL) version number.
bool flag_resetInt_Iq
a flag to reset the Iq integrator
bool flag_enableCurrentCtrl
a flag to enable the current controllers
Definition: 32b/ctrl_obj.h:277
struct _CTRL_Obj_ CTRL_Obj
Defines the controller (CTRL) object.
int_least16_t counter_current
the isr counter
float_t speed_out_A
the output value from the speed controller, A
float_t ctrlFreq_Hz
Defines the controller frequency, Hz.
PI Iq controller.
CTRL_State_e state
the current state of the controller
Definition: 32b/ctrl_obj.h:148
uint16_t rsvd
reserved value
Definition: 32b/ctrl_obj.h:133
the number of controller error codes
CTRL_State_e prevState
the previous state of the controller
Definition: 32b/ctrl_obj.h:150
float_t Kp_Id_VpA
the desired Kp_Id value, V/A
float_t BWdelta
the bandwidth scaling to maximize phase margin
int_least16_t numIsrTicksPerCtrlTick
Defines the number of isr clock ticks per controller clock tick.
MATH_vec2 Vdq_offset_V
the Vdq offset values, V
uint_least32_t waitTimes[CTRL_numStates]
an array of wait times for each state, estimator clock counts
Definition: 32b/ctrl_obj.h:191
CTRL_State_e
Enumeration for the controller states.
Definition: ctrl_states.h:34
float_t speed_outMax_A
the maximum output value for the speed controller, A
MOTOR_Params motorParams
the motor parameters
Definition: 32b/ctrl_obj.h:189
float_t speed_fb_Hz
the feedback speed value, Hz
CTRL_Version version
the controller version
Definition: 32b/ctrl_obj.h:146
Id clip error code.
no error error code
float_t Ui_Iq_V
the start integrator value for the Iq controller, V
CTRL_Type_e
Enumeration for the controller (CTRL) types.
bool flag_useZeroIq_ref
a flag to force a Iq = 0 reference value
PI_Obj pi_spd
the speed PI controller object
float_t Kp_spd_ApHz
the desired Kp_spd value, A/Hz
float_t speed_ref_Hz
the reference speed value, Hz
float_t Ki_Id
the desired Ki_Id value, unitless
MATH_vec2 Vdq_V
the Vdq values, V
2805x processor
int_least32_t counter_state
the state counter
2802x processor
MATH_vec2 Idq_A
the Idq values, A
float_t BWc_rps
the bandwidth of the current controllers, rad/sec
uint16_t targetProc
the target processor
uint16_t minor
the minor release number
Definition: 32b/ctrl_obj.h:136
Contains the public interface to the Proportional-Integral (PI) controller module routines...
Defines the motor parameters.
Definition: 32b/motor.h:80
PI_Handle piHandle_spd
the handle for the speed PI controller
PI_Obj pi_Iq
the Iq PI controller object
2806x processor
float_t Kp_Iq_VpA
the desired Kp_Iq value, V/A
struct _CTRL_Obj_ * CTRL_Handle
Defines the CTRL handle.
float_t Ki_Iq
the desired Ki_Iq value, unitless
bool flag_enableSpeedCtrl
a flag to enable the speed controller
Definition: 32b/ctrl_obj.h:267
PI Id controller.
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121
int_least16_t numCtrlTicksPerSpeedTick
Defines the number of controller clock ticks per speed controller clock tick.
MATH_vec2 Idq_ref_A
the Idq reference values, A