MotorWare f2806x Module API Documentation
32b/ctrl_obj.h
Go to the documentation of this file.
1 #ifndef _CTRL_OBJ_H_
2 #define _CTRL_OBJ_H_
3 /* --COPYRIGHT--,BSD
4  * Copyright (c) 2012, Texas Instruments Incorporated
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * * Neither the name of Texas Instruments Incorporated nor the names of
19  * its contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  * --/COPYRIGHT--*/
34 
39 
40 
41 // **************************************************************************
42 // the includes
43 
46 
57 
58 
59 
64 
65 
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 
72 // **************************************************************************
73 // the defines
74 
75 
79 #define CTRL_NUM_CONTROLLERS (2)
80 
81 
82 // **************************************************************************
83 // the typedefs
84 
87 //typedef enum {
88 // CTRL_State_Error=0, //!< the controller error state
89 // CTRL_State_Idle, //!< the controller idle state
90 // CTRL_State_OffLine, //!< the controller offline state
91 // CTRL_State_OnLine, //!< the controller online state
92 // CTRL_numStates //!< the number of controller states
93 //} CTRL_State_e;
94 
95 
98 typedef enum
99 {
105 
106 
109 typedef enum
110 {
117 
118 
121 typedef enum
122 {
126 } CTRL_Type_e;
127 
128 
131 typedef struct _CTRL_Version_
132 {
133  uint16_t rsvd;
135  uint16_t major;
136  uint16_t minor;
137 } CTRL_Version;
138 
139 
144 typedef struct _CTRL_Obj_
145 {
147 
149 
151 
153 
156 
159 
161 
164 
167 
170 
173 
176 
179 
182 
185 
188 
190 
191  uint_least32_t waitTimes[CTRL_numStates];
192 
193  uint_least32_t counter_state;
194 
195  uint_least16_t numIsrTicksPerCtrlTick;
196 
197  uint_least16_t numCtrlTicksPerCurrentTick;
198 
199  uint_least16_t numCtrlTicksPerSpeedTick;
200 
201  uint_least16_t numCtrlTicksPerTrajTick;
202 
203  uint_least32_t ctrlFreq_Hz;
204 
205  uint_least32_t trajFreq_Hz;
206 
208 
210 
212 
214 
216 
218 
220 
222 
224 
226 
230 
234 
238 
242 
246 
248 
250 
252 
254 
255  uint_least16_t counter_current;
256 
257  uint_least16_t counter_isr;
258 
259  uint_least16_t counter_speed;
260 
261  uint_least16_t counter_traj;
262 
269 
270  // NOTE: APPENDING ONLY WORKS BECAUSE WE HAVE ALLOCATED TWO CONTROLLERS IN PROTECTED RAM AND WE ARE ONLY USING THE FIRST ONE
278 } CTRL_Obj;
279 
280 
283 typedef struct _CTRL_Obj_ *CTRL_Handle;
284 
285 
286 #ifdef __cplusplus
287 }
288 #endif // extern "C"
289 
291 #endif // end of _CTRL_OBJ_H_ definition
292 
MATH_vec2 Vdq_offset_pu
the Vdq offset values, pu
Definition: 32b/ctrl_obj.h:272
PID Speed controller.
Definition: 32b/ctrl_obj.h:123
PID_Obj pid_Iq
the Iq PID controller object
Definition: 32b/ctrl_obj.h:169
_iq maxVsMag_pu
the maximum voltage vector that is allowed, pu
Definition: 32b/ctrl_obj.h:211
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
IPARK_Obj ipark
the inverse Park transform object
Definition: 32b/ctrl_obj.h:175
IPARK_Handle iparkHandle
the handle for the inverse Park transform
Definition: 32b/ctrl_obj.h:174
TRAJ_Obj traj_Id
the Id trajectory generator object
Definition: 32b/ctrl_obj.h:181
Contains the public interface to the types definitions.
MATH_vec2 Vab_in
the Vab input values
Definition: 32b/ctrl_obj.h:219
MATH_vec2 Idq_ref
the Idq reference values, pu
Definition: 32b/ctrl_obj.h:247
uint_least16_t numCtrlTicksPerSpeedTick
Defines the number of controller clock ticks per speed controller clock tick.
Definition: 32b/ctrl_obj.h:199
_iq Kd_Id
the desired Kd_Id value
Definition: 32b/ctrl_obj.h:239
float_t RoverL
the R/L value
Definition: 32b/ctrl_obj.h:229
_iq Ki_Iq
the desired Ki_Iq value
Definition: 32b/ctrl_obj.h:236
Defines the CLARKE object.
Definition: 32b/clarke.h:75
CLARKE_Handle clarkeHandle_I
the handle for the current Clarke transform
Definition: 32b/ctrl_obj.h:154
_iq speed_ref_pu
the speed reference, pu
Definition: 32b/ctrl_obj.h:274
_iq Ki_Id
the desired Ki_Id value
Definition: 32b/ctrl_obj.h:235
_iq spd_ref
the speed reference, pu
Definition: 32b/ctrl_obj.h:251
uint_least16_t numCtrlTicksPerTrajTick
Defines the number of controller clock ticks per trajectory clock tick.
Definition: 32b/ctrl_obj.h:201
Defines a two element vector.
Definition: 32b/math.h:248
the number of controller states
Definition: ctrl_states.h:39
Contains the public interface to the offset (OFFSET) module routines.
_iq angle_pu
the angle value, pu
Definition: 32b/ctrl_obj.h:273
_iq Kp_spd
the desired Kp_spd value
Definition: 32b/ctrl_obj.h:233
uint16_t major
the major release number
Definition: 32b/ctrl_obj.h:135
_iq spd_max
the maximum speed, pu
Definition: 32b/ctrl_obj.h:253
struct _EST_Obj_ * EST_Handle
Defines the estimator (EST) handle.
Definition: 32b/est.h:52
TRAJ_Handle trajHandle_Id
the handle for the Id trajectory generator
Definition: 32b/ctrl_obj.h:180
Contains the public interface to the Proportional-Integral-Derivative (PID) controller module routine...
TRAJ_Handle trajHandle_spd
the handle for the speed trajectory generator
Definition: 32b/ctrl_obj.h:183
MATH_vec2 Vab_out
the Vab output values
Definition: 32b/ctrl_obj.h:223
PID_Handle pidHandle_Id
the handle for the Id PID controller
Definition: 32b/ctrl_obj.h:165
2803x processor
Definition: 32b/ctrl_obj.h:113
CTRL_ErrorCode_e
Enumeration for the error codes.
Definition: 32b/ctrl_obj.h:98
Defines the Space Vector Generator object.
Definition: 32b/svgen.h:88
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
_iq Kp_Id
the desired Kp_Id value
Definition: 32b/ctrl_obj.h:231
estimator error code
Definition: 32b/ctrl_obj.h:102
Contains the public interface to the estimator (EST) module routines.
EST_Handle estHandle
the handle for the parameter estimator
Definition: 32b/ctrl_obj.h:160
MATH_vec2 Idq_offset_pu
the Idq offset values, pu
Definition: 32b/ctrl_obj.h:271
CTRL_TargetProc_e
Enumeration for the target processors.
Definition: 32b/ctrl_obj.h:109
Defines the IPARK object.
Definition: 32b/ipark.h:73
bool flag_enableDcBusComp
a flag to enable the DC bus compensation in the controller
Definition: 32b/ctrl_obj.h:264
long _iq
struct _CTRL_Version_ CTRL_Version
Defines the controller (CTRL) version number.
_iq Kd_Iq
the desired Kd_Iq value
Definition: 32b/ctrl_obj.h:240
bool flag_enableOffset
a flag to enable offset estimation after idle state
Definition: 32b/ctrl_obj.h:266
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.
TRAJ_Handle trajHandle_spdMax
the handle for the maximum speed trajectory generator
Definition: 32b/ctrl_obj.h:186
_iq speed_fb_pu
the feedback speed value, pu
Definition: 32b/ctrl_obj.h:275
_iq Ui_spd
the desired Ui_spd value
Definition: 32b/ctrl_obj.h:245
TRAJ_Obj traj_spdMax
the maximum speed trajectory generator object
Definition: 32b/ctrl_obj.h:187
uint_least32_t counter_state
the state counter
Definition: 32b/ctrl_obj.h:193
CTRL_State_e state
the current state of the controller
Definition: 32b/ctrl_obj.h:148
CLARKE_Obj clarke_V
the voltage Clarke transform object
Definition: 32b/ctrl_obj.h:158
uint_least16_t counter_isr
the isr counter
Definition: 32b/ctrl_obj.h:257
_iq Kd_spd
the desired Kd_spd value
Definition: 32b/ctrl_obj.h:241
uint16_t rsvd
reserved value
Definition: 32b/ctrl_obj.h:133
MATH_vec2 Idq_in
the Idq input values
Definition: 32b/ctrl_obj.h:217
bool flag_enablePowerWarp
a flag to enable PowerWarp
Definition: 32b/ctrl_obj.h:265
_iq speed_outMax_pu
the maximum output of the speed PI control, pu
Definition: 32b/ctrl_obj.h:276
PID_Handle pidHandle_spd
the handle for the speed PID controller
Definition: 32b/ctrl_obj.h:171
_iq trajPeriod_sec
Defines the trajectory period, sec.
Definition: 32b/ctrl_obj.h:207
PID_Obj pid_Id
the Id PID controller object
Definition: 32b/ctrl_obj.h:166
the number of controller error codes
Definition: 32b/ctrl_obj.h:103
Defines the PARK object.
Definition: 32b/park.h:73
PARK_Obj park
the Park transform object
Definition: 32b/ctrl_obj.h:163
CTRL_State_e prevState
the previous state of the controller
Definition: 32b/ctrl_obj.h:150
PID_Obj pid_spd
the speed PID controller object
Definition: 32b/ctrl_obj.h:172
_iq Kp_Iq
the desired Kp_Iq value
Definition: 32b/ctrl_obj.h:232
PARK_Handle parkHandle
the handle for the Park object
Definition: 32b/ctrl_obj.h:162
MATH_vec2 Iab_filt
the Iab filtered values
Definition: 32b/ctrl_obj.h:215
uint_least16_t counter_current
the isr counter
Definition: 32b/ctrl_obj.h:255
MATH_vec2 Vdq_out
the Vdq output values
Definition: 32b/ctrl_obj.h:225
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
Defines the trajectory (TRAJ) object.
Definition: 32b/traj.h:67
_iq spd_out
the speed output value
Definition: 32b/ctrl_obj.h:221
CLARKE_Handle clarkeHandle_V
the handle for the voltage Clarke transform
Definition: 32b/ctrl_obj.h:157
uint_least16_t counter_traj
the traj counter
Definition: 32b/ctrl_obj.h:261
MOTOR_Params motorParams
the motor parameters
Definition: 32b/ctrl_obj.h:189
uint_least16_t counter_speed
the speed counter
Definition: 32b/ctrl_obj.h:259
PID_Handle pidHandle_Iq
the handle for the Iq PID controller
Definition: 32b/ctrl_obj.h:168
CTRL_Version version
the controller version
Definition: 32b/ctrl_obj.h:146
_iq IdRated
the Id rated current, pu
Definition: 32b/ctrl_obj.h:249
Id clip error code.
Definition: 32b/ctrl_obj.h:101
Contains public interface to various functions related to the trajectory (TRAJ) object.
no error error code
Definition: 32b/ctrl_obj.h:100
CTRL_Type_e
Enumeration for the controller (CTRL) types.
Definition: 32b/ctrl_obj.h:121
bool flag_enableCtrl
a flag to enable the controller
Definition: 32b/ctrl_obj.h:263
_iq Ui_Iq
the desired Ui_Iq value
Definition: 32b/ctrl_obj.h:244
CTRL_TargetProc_e targetProc
the target processor
Definition: 32b/ctrl_obj.h:134
uint_least32_t ctrlFreq_Hz
Defines the controller frequency, Hz.
Definition: 32b/ctrl_obj.h:203
PID Iq controller.
Definition: 32b/ctrl_obj.h:125
Contains the public interface to the Park transform module routines.
bool flag_enableUserMotorParams
a flag to use known motor parameters from user.h file
Definition: 32b/ctrl_obj.h:268
2805x processor
Definition: 32b/ctrl_obj.h:112
PID Id controller.
Definition: 32b/ctrl_obj.h:124
uint_least32_t trajFreq_Hz
Defines the trajectory frequency, Hz.
Definition: 32b/ctrl_obj.h:205
SVGEN_Obj svgen
the space vector generator object
Definition: 32b/ctrl_obj.h:178
2802x processor
Definition: 32b/ctrl_obj.h:114
Contains the public interface to the Clarke transform (CLARKE) module routines.
Contains the public interface to the inverse Park transform (IPARK) module routines.
Contains the public interface to the Space Vector Generator (SVGEN) module routines.
uint16_t minor
the minor release number
Definition: 32b/ctrl_obj.h:136
MATH_vec2 Iab_in
the Iab input values
Definition: 32b/ctrl_obj.h:213
uint_least16_t numCtrlTicksPerCurrentTick
Defines the number of controller clock ticks per current controller clock tick.
Definition: 32b/ctrl_obj.h:197
Defines the motor parameters.
Definition: 32b/motor.h:80
Defines the PID controller object.
Definition: 32b/pid.h:74
uint_least16_t numIsrTicksPerCtrlTick
Defines the number of isr clock ticks per controller clock tick.
Definition: 32b/ctrl_obj.h:195
float_t Rhf
the Rhf value
Definition: 32b/ctrl_obj.h:227
CLARKE_Obj clarke_I
the current Clarke transform object
Definition: 32b/ctrl_obj.h:155
_iq Ki_spd
the desired Ki_spd value
Definition: 32b/ctrl_obj.h:237
Unknown processor.
Definition: 32b/ctrl_obj.h:115
TRAJ_Obj traj_spd
the speed trajectory generator object
Definition: 32b/ctrl_obj.h:184
2806x processor
Definition: 32b/ctrl_obj.h:111
float_t Lhf
the Lhf value
Definition: 32b/ctrl_obj.h:228
struct _CTRL_Obj_ * CTRL_Handle
Defines the CTRL handle.
Definition: 32b/ctrl_obj.h:283
_iq Ui_Id
the desired Ui_Id value
Definition: 32b/ctrl_obj.h:243
bool flag_enableSpeedCtrl
a flag to enable the speed controller
Definition: 32b/ctrl_obj.h:267
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121
SVGEN_Handle svgenHandle
the handle for the space vector generator
Definition: 32b/ctrl_obj.h:177