MotorWare f2806x Module API Documentation
float/ctrl.c
Go to the documentation of this file.
1 
6 
7 // **************************************************************************
8 // the includes
9 
10 #if !defined(__TMS320C28XX_CLA__)
11 #include <math.h>
12 #endif
13 
14 
15 // drivers
16 
17 
18 // modules
21 
22 
23 // solutions
24 
25 
26 // **************************************************************************
27 // the defines
28 
29 #ifdef FLASH
30 #pragma CODE_SECTION(CTRL_computePhasor,"ramfuncs");
31 #pragma CODE_SECTION(CTRL_getCount_isr,"ramfuncs");
32 #pragma CODE_SECTION(CTRL_getNumIsrTicksPerCtrlTick,"ramfuncs");
33 #pragma CODE_SECTION(CTRL_incrCounter_isr,"ramfuncs");
34 #pragma CODE_SECTION(CTRL_isEnabled,"ramfuncs");
35 #pragma CODE_SECTION(CTRL_resetCounter_isr,"ramfuncs");
36 #pragma CODE_SECTION(CTRL_setup,"ramfuncs");
37 #pragma CODE_SECTION(CTRL_run,"ramfuncs");
38 #endif
39 
40 #ifdef __TMS320C28XX_CLA__
41 #pragma CODE_SECTION(CTRL_getVersion,"Cla1Prog2");
42 #pragma CODE_SECTION(CTRL_getWaitTimes,"Cla1Prog2");
43 #pragma CODE_SECTION(CTRL_init,"Cla1Prog2");
44 #pragma CODE_SECTION(CTRL_reset,"Cla1Prog2");
45 #pragma CODE_SECTION(CTRL_setParams,"Cla1Prog2");
46 #pragma CODE_SECTION(CTRL_setVersion,"Cla1Prog2");
47 #pragma CODE_SECTION(CTRL_setWaitTimes,"Cla1Prog2");
48 #pragma CODE_SECTION(CTRL_updateState,"Cla1Prog2");
49 #endif
50 
51 // **************************************************************************
52 // the globals
53 
54 
55 // **************************************************************************
56 // the function prototypes
57 
59 {
60  CTRL_Obj *obj = (CTRL_Obj *)handle;
61 
62  pVersion->rsvd = obj->version.rsvd;
63  pVersion->targetProc = obj->version.targetProc;
64  pVersion->major = obj->version.major;
65  pVersion->minor = obj->version.minor;
66 
67  return;
68 } // end of CTRL_getVersion() function
69 
70 
71 void CTRL_getWaitTimes(CTRL_Handle handle,int_least32_t *pWaitTimes)
72 {
73  CTRL_Obj *obj = (CTRL_Obj *)handle;
74  uint_least16_t stateCnt;
75 
76  for(stateCnt=0;stateCnt<CTRL_numStates;stateCnt++)
77  {
78  pWaitTimes[stateCnt] = obj->waitTimes[stateCnt];
79  }
80 
81  return;
82 } // end of CTRL_getWaitTimes() function
83 
84 
85 CTRL_Handle CTRL_init(void *pMemory,const size_t numBytes)
86 {
87  CTRL_Handle handle;
88  CTRL_Obj *obj;
89 
90 
91  if((int16_t)numBytes < (int16_t)sizeof(CTRL_Obj))
92  {
93  /*LDRA_INSPECTED 95 S MR12 11.3 "Below typecasting to NULL has no issues"*/
94  return((CTRL_Handle)NULL);
95  }
96 
97  // assign the handle
98  /*LDRA_INSPECTED 94 S MR12 11.3 "Below typecasting to void * has no issues"*/
99  /*LDRA_INSPECTED 95 S MR12 11.3 "Below typecasting to void *has no issues"*/
100  handle = (CTRL_Handle)pMemory;
101 
102 
103  // set the version
104  /*LDRA_INSPECTED 45 D MR12 D.4.1 "handle points to static object, further '0' is also a valid address;So no need to check for NULL"*/
107 
108 
109  // assign the object
110  obj = (CTRL_Obj *)handle;
111 
112 
113  // initialize the Id PI controller module
114  /*LDRA_INSPECTED 45 D MR12 D.4.1 "handle points to static object, further '0' is also a valid address;So no need to check for NULL"*/
115  obj->piHandle_Id = PI_init(&obj->pi_Id,sizeof(obj->pi_Id));
116 
117 
118  // initialize the Iq PI controller module
119  obj->piHandle_Iq = PI_init(&obj->pi_Iq,sizeof(obj->pi_Iq));
120 
121 
122  // initialize the speed PI controller module
123  obj->piHandle_spd = PI_init(&obj->pi_spd,sizeof(obj->pi_spd));
124 
125  /*LDRA_INSPECTED 71 S MR12 11.3 "Always, address of a static object is passed, so ok for wider scope"*/
126  return(handle);
127 } // end of CTRL_init() function
128 
129 
131 {
132  CTRL_Obj *obj = (CTRL_Obj *)handle;
133  MATH_vec2 null = {{(float_t)0.0,(float_t)0.0}};
134 
135  // reset the integrators
136  PI_setUi(obj->piHandle_spd,(float_t)0.0);
137  PI_setUi(obj->piHandle_Id,(float_t)0.0);
138  PI_setUi(obj->piHandle_Iq,(float_t)0.0);
139 
140  // zero internal values
141  CTRL_setSpeed_fb_Hz(handle,(float_t)0.0);
142  CTRL_setSpeed_ref_Hz(handle,(float_t)0.0);
143  CTRL_setSpeed_out_A(handle,(float_t)0.0);
144 
145  CTRL_setIdq_A(handle,&null);
146  CTRL_setIdq_offset_A(handle,&null);
147  CTRL_setVdq_offset_V(handle,&null);
148 
149  CTRL_setVdq_V(handle,&null);
150 
151  return;
152 } // end of CTRL_reset() function
153 
154 
155 void CTRL_setParams(CTRL_Handle handle,USER_Params *pUserParams)
156 {
157  CTRL_Obj *obj = (CTRL_Obj *)handle;
158 
159  MATH_vec2 null = {{(float_t)0.0,(float_t)0.0}};
160 
161  float_t Ki,Kp;
162  float_t outMin,outMax;
163 
164  float_t Rs_d_Ohm = pUserParams->motor_Rs_d_Ohm;
165  float_t Rs_q_Ohm = pUserParams->motor_Rs_q_Ohm;
166  float_t Rr_d_Ohm = pUserParams->motor_Rr_d_Ohm;
167  float_t Rr_q_Ohm = pUserParams->motor_Rr_q_Ohm;
168  float_t Ls_d_H = pUserParams->motor_Ls_d_H;
169  float_t Ls_q_H = pUserParams->motor_Ls_q_H;
170  float_t RoverL_rps;
171  float_t BWc_rps = pUserParams->BWc_rps;
172  float_t BWdelta = pUserParams->BWdelta;
173  float_t Kctrl_Wb_p_kgm2 = pUserParams->Kctrl_Wb_p_kgm2;
174  float_t currentCtrlPeriod_sec = (float_t)pUserParams->numCtrlTicksPerCurrentTick / pUserParams->ctrlFreq_Hz;
175  float_t speedCtrlPeriod_sec = (float_t)pUserParams->numCtrlTicksPerSpeedTick / pUserParams->ctrlFreq_Hz;
176 
177 
178  // assign the motor type
179  CTRL_setMotorParams(handle,pUserParams->motor_type,
180  pUserParams->motor_numPolePairs,
181  pUserParams->motor_ratedFlux_Wb,
182  Ls_d_H,Ls_q_H,
183  Rs_d_Ohm,Rs_q_Ohm,
184  Rr_d_Ohm,Rr_q_Ohm);
185 
186 
187  // assign other controller parameters
191 
192  CTRL_setCtrlFreq_Hz(handle,pUserParams->ctrlFreq_Hz);
193  CTRL_setCtrlPeriod_sec(handle,pUserParams->ctrlPeriod_sec);
194  CTRL_setCurrentCtrlPeriod_sec(handle,currentCtrlPeriod_sec);
195  CTRL_setSpeedCtrlPeriod_sec(handle,speedCtrlPeriod_sec);
196 
197  CTRL_setIdq_A(handle,&null);
198  CTRL_setIdq_offset_A(handle,&null);
199  CTRL_setIdq_ref_A(handle,&null);
200 
201  CTRL_setVdq_V(handle,&null);
202  CTRL_setVdq_offset_V(handle,&null);
203 
204  CTRL_setVd_sf(handle,pUserParams->Vd_sf);
205 
206  CTRL_setMaxVsMag_V(handle,pUserParams->maxVsMag_V);
207 
208 
209  // set the speed reference
210  CTRL_setSpeed_fb_Hz(handle,(float_t)0.0);
211  CTRL_setSpeed_out_A(handle,(float_t)0.0);
212  CTRL_setSpeed_outMax_A(handle,pUserParams->maxCurrent_A);
213  CTRL_setSpeed_outMin_A(handle,-pUserParams->maxCurrent_A);
214  CTRL_setSpeed_ref_Hz(handle,(float_t)0.0);
215 
216 
217  // reset the counters
219  CTRL_resetCounter_isr(handle);
220  CTRL_resetCounter_speed(handle);
221  CTRL_resetCounter_state(handle);
222 
223 
224  // set the wait times for each state
225  CTRL_setWaitTimes(handle,&pUserParams->ctrlWaitTime[0]);
226 
227 
228  // set flags
229  CTRL_setFlag_enable(handle,false);
230  CTRL_setFlag_enableCurrentCtrl(handle,false);
231  CTRL_setFlag_enableSpeedCtrl(handle,true);
232  CTRL_setFlag_resetInt_Id(handle,false);
233  CTRL_setFlag_resetInt_Iq(handle,false);
234  CTRL_setFlag_resetInt_spd(handle,false);
235  CTRL_setFlag_useZeroIq_ref(handle,false);
236 
237 
238  // initialize the controller error code
240 
241 
242  // set the default controller state
244 
245  CTRL_setBWc_rps(handle,BWc_rps);
246  CTRL_setBWdelta(handle,BWdelta);
247  CTRL_setKctrl_Wb_p_kgm2(handle,Kctrl_Wb_p_kgm2);
248 
249  // configure the default speed controller gains
250  Kp = MATH_TWO_PI * BWc_rps / (BWdelta * Kctrl_Wb_p_kgm2);
251  Ki = BWc_rps * speedCtrlPeriod_sec / (BWdelta * BWdelta);
252 
253  // set the default speed controller gains
254  CTRL_setGains(handle,CTRL_Type_PI_spd,Kp,Ki);
255 
256 
257  // configure the default speed controller output minimum/maximum values
258  outMax = pUserParams->maxCurrent_A;
259  outMin = -outMax;
260 
261  // set the default speed controller output minimum/maximum values
262  PI_setMinMax(obj->piHandle_spd,outMin,outMax);
263 
264 
265  // set the Id current controller gain
266  Kp = Ls_d_H * pUserParams->BWc_rps;
267  RoverL_rps = Rs_d_Ohm / Ls_d_H;
268  Ki = RoverL_rps * currentCtrlPeriod_sec;
269  CTRL_setGains(handle,CTRL_Type_PI_Id,Kp,Ki);
270 
271 
272  // set the Id current controller gain
273  Kp = Ls_q_H * pUserParams->BWc_rps;
274  RoverL_rps = Rs_q_Ohm / Ls_q_H;
275  CTRL_setGains(handle,CTRL_Type_PI_Iq,Kp,Ki);
276 
277 
278  // configure the default current controller output minimum/maximum values
279  outMax = pUserParams->dcBus_nominal_V;
280  outMin = -outMax;
281 
282  // set the default current controller output minimum/maximum values
283  PI_setMinMax(obj->piHandle_Id,outMin,outMax);
284  PI_setMinMax(obj->piHandle_Iq,outMin,outMax);
285 
286 
287  // reset the integrators
288  CTRL_setUi(handle,CTRL_Type_PI_spd,(float_t)0.0);
289  CTRL_setUi(handle,CTRL_Type_PI_Id,(float_t)0.0);
290  CTRL_setUi(handle,CTRL_Type_PI_Iq,(float_t)0.0);
291 
292  return;
293 } // end of CTRL_setParams() function
294 
295 
296 void CTRL_setVersion(CTRL_Handle handle,const CTRL_TargetProc_e targetProc,
297  const uint16_t majorReleaseNumber,const uint16_t minorReleaseNumber)
298 {
299  CTRL_Obj *obj = (CTRL_Obj *)handle;
300 
301  obj->version.rsvd = 107;
302  obj->version.targetProc = (uint16_t)targetProc;
303  obj->version.major = (uint16_t)majorReleaseNumber;
304  obj->version.minor = (uint16_t)minorReleaseNumber;
305 
306  return;
307 } // end of CTRL_setVersion() function
308 
309 
310 void CTRL_setWaitTimes(CTRL_Handle handle,const int_least32_t *pWaitTimes)
311 {
312  CTRL_Obj *obj = (CTRL_Obj *)handle;
313  uint_least16_t stateCnt;
314 
315  for(stateCnt=0;stateCnt<CTRL_numStates;stateCnt++)
316  {
317  obj->waitTimes[stateCnt] = pWaitTimes[stateCnt];
318  }
319 
320  return;
321 } // end of CTRL_setWaitTimes() function
322 
323 
325 {
326  CTRL_State_e state = CTRL_getState(handle);
327  bool flag_enable = CTRL_getFlag_enable(handle);
328  bool stateChanged = false;
329 
330 
331  if(flag_enable)
332  {
333  int_least32_t counter_state = CTRL_getCount_state(handle);
334  int_least32_t waitTime = CTRL_getWaitTime(handle,state);
335 
336 
337  // check for errors
338  CTRL_checkForErrors(handle);
339 
340 
341  if(counter_state >= waitTime)
342  {
343  // reset the counter
344  CTRL_resetCounter_state(handle);
345 
346 
347  if(state == CTRL_State_Idle)
348  {
349  // set the next controller state
351  }
352  } // if(counter_state >= waitTime) loop
353  }
354  else
355  {
356  if(state != CTRL_State_Error)
357  {
358  if(CTRL_isNotIdle(handle))
359  {
360  // reset the controller
361  CTRL_reset(handle);
362 
363  // set the next controller state
365  }
366  }
367  }
368 
369 
370  // check to see if the state changed
371  if(state != CTRL_getState(handle))
372  {
373  stateChanged = true;
374  }
375 
376  return(stateChanged);
377 } // end of CTRL_updateState() function
378 
379 
380 // end of file
381 
PI Speed controller.
Defines the controller (CTRL) version number.
Definition: 32b/ctrl_obj.h:131
the controller error state
Definition: ctrl_states.h:35
#define CTRL_MAJOR_RELEASE_NUMBER
Defines the major release number.
void CTRL_resetCounter_state(CTRL_Handle handle)
Resets the state counter.
Definition: 32b/ctrl.h:1107
void CTRL_setWaitTimes(CTRL_Handle handle, const int_least32_t *pWaitTimes)
Sets the wait times for the controller states.
Definition: float/ctrl.c:310
float_t motor_Rs_d_Ohm
Defines the direct stator resistance, Ohm.
void CTRL_setMotorParams(CTRL_Handle handle, const MOTOR_Type_e motorType, const uint_least16_t numPolePairs, const float_t ratedFlux, const float_t Ls_d, const float_t Ls_q, const float_t Rr, const float_t Rs)
Sets the parameters for the motor in the controller.
Definition: 32b/ctrl.h:1581
PI_Handle piHandle_Id
the handle for the Id PI controller
static void CTRL_setVdq_offset_V(CTRL_Handle handle, const MATH_vec2 *pVdq_offset_V)
Sets the direct/quadrature offset voltage (Vdq_offset) vector values in the controller.
Definition: float/ctrl.h:1868
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
#define MATH_TWO_PI
Defines 2*pi.
Definition: 32b/math.h:109
float_t BWc_rps
Defines the bandwidth of the current controllers, rad/sec.
uint16_t major
the major release number
Definition: 32b/ctrl_obj.h:135
float_t ctrlPeriod_sec
Defines the controller execution period, sec.
float_t maxCurrent_A
Defines the maximum current value, A.
void CTRL_getWaitTimes(CTRL_Handle handle, int_least32_t *pWaitTimes)
Gets the wait times from the controller.
Definition: float/ctrl.c:71
static void PI_setUi(PI_Handle handle, const _iq Ui)
Sets the integrator start value in the PI controller.
Definition: 32b/pi.h:348
static void CTRL_setBWdelta(CTRL_Handle handle, const float_t BWdelta)
Sets the bandwidth scale factor used to maximize phase margin.
Definition: float/ctrl.h:1250
the controller idle state
Definition: ctrl_states.h:36
uint_least32_t ctrlWaitTime[CTRL_numStates]
Defines the wait times for each controller state, estimator ticks.
float_t motor_Rs_q_Ohm
Defines the quadrature stator resistance, Ohm.
static void CTRL_setSpeed_outMax_A(CTRL_Handle handle, const float_t speed_outMax_A)
Sets the maximum output value for the speed controller.
Definition: float/ctrl.h:1739
Defines the controller (CTRL) object.
Definition: 32b/ctrl_obj.h:144
Defines a structure for the user parameters.
PI_Obj pi_Id
the Id PI controller object
PI_Handle piHandle_Iq
the handle for the Iq PI controller
static void CTRL_setBWc_rps(CTRL_Handle handle, const float_t BWc_rps)
Sets the current controller bandwidth.
Definition: float/ctrl.h:1237
static void CTRL_setSpeed_ref_Hz(CTRL_Handle handle, const float_t speed_ref_Hz)
Sets the output speed reference value in the controller.
Definition: float/ctrl.h:1765
CTRL_TargetProc_e
Enumeration for the target processors.
Definition: 32b/ctrl_obj.h:109
static void CTRL_setIdq_ref_A(CTRL_Handle handle, const MATH_vec2 *pIdq_ref_A)
Sets the direct/quadrature current (Idq) reference vector values in the controller.
Definition: float/ctrl.h:1473
void CTRL_setFlag_enableSpeedCtrl(CTRL_Handle handle, const bool state)
Sets the enable speed control value in the estimator.
Definition: 32b/ctrl.h:1284
uint_least32_t CTRL_getWaitTime(CTRL_Handle handle, const CTRL_State_e ctrlState)
Gets the wait time for a given state.
Definition: 32b/ctrl.h:933
void CTRL_reset(CTRL_Handle handle)
Resets the controller.
Definition: float/ctrl.c:130
uint_least16_t numCtrlTicksPerCurrentTick
Defines the number of controller clock ticks per current controller clock tick.
void CTRL_resetCounter_current(CTRL_Handle handle)
Resets the current counter.
Definition: 32b/ctrl.h:1071
static void CTRL_setFlag_enableCurrentCtrl(CTRL_Handle handle, const bool state)
Sets the enable current controllers flag value in the controller.
Definition: 32b/ctrl.h:1227
void CTRL_setGains(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kp, const _iq Ki, const _iq Kd)
Sets the gain values for the specified controller.
Definition: 32b/ctrl.c:262
static void CTRL_setSpeed_fb_Hz(CTRL_Handle handle, const float_t speed_fb_Hz)
Sets the feedback speed value in the controller.
Definition: float/ctrl.h:1713
void CTRL_setState(CTRL_Handle handle, const CTRL_State_e state)
Sets the controller state.
Definition: 32b/ctrl.h:1774
CTRL_Handle CTRL_init(void *pMemory, const size_t numBytes)
Initializes the controller.
Definition: float/ctrl.c:85
float_t maxVsMag_V
Defines the maximum stator voltage magnitude, V.
static void CTRL_setFlag_resetInt_Id(CTRL_Handle handle, const bool state)
Sets the reset Id integrator flag value in the controller.
Definition: float/ctrl.h:1354
static void CTRL_setIdq_offset_A(CTRL_Handle handle, const MATH_vec2 *pIdq_offset_A)
Sets the direct/quadrature current (Idq) offset vector values in the controller.
Definition: float/ctrl.h:1459
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
Sets the controller parameters.
Definition: float/ctrl.c:155
MOTOR_Type_e motor_type
Defines the motor type.
PI Iq controller.
void CTRL_resetCounter_isr(CTRL_Handle handle)
Resets the isr counter.
Definition: 32b/ctrl.h:1083
uint16_t rsvd
reserved value
Definition: 32b/ctrl_obj.h:133
float_t BWdelta
Defines the bandwidth scaling to maximize phase margin.
PI_Handle PI_init(void *pMemory, const size_t numBytes)
Initializes the PI controller.
Definition: 32b/pi.c:56
static void CTRL_setFlag_enable(CTRL_Handle handle, const bool state)
Sets the enable controller flag value in the controller.
Definition: float/ctrl.h:1315
float_t Vd_sf
Defines the Vd scale factor to prevent a Vd only component for the Vdq vector.
CTRL_State_e CTRL_getState(CTRL_Handle handle)
Gets the controller state.
Definition: 32b/ctrl.h:767
static void CTRL_setSpeed_out_A(CTRL_Handle handle, const float_t speed_out_A)
Sets the maximum output value for the speed controller.
Definition: float/ctrl.h:1726
void CTRL_setCtrlPeriod_sec(CTRL_Handle handle, const float_t ctrlPeriod_sec)
Sets the controller execution period.
Definition: 32b/ctrl.h:1176
static void CTRL_setFlag_resetInt_Iq(CTRL_Handle handle, const bool state)
Sets the reset Iq integrator flag value in the controller.
Definition: float/ctrl.h:1367
uint_least32_t waitTimes[CTRL_numStates]
an array of wait times for each state, estimator clock counts
Definition: 32b/ctrl_obj.h:191
void CTRL_setNumCtrlTicksPerCurrentTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerCurrentTick)
Sets the number of controller clock ticks per current controller clock tick.
Definition: 32b/ctrl.h:1615
static void CTRL_setFlag_useZeroIq_ref(CTRL_Handle handle, const bool state)
Sets the use zero Iq reference flag value in the controller.
Definition: float/ctrl.h:1393
CTRL_State_e
Enumeration for the controller states.
Definition: ctrl_states.h:34
the controller online state
Definition: ctrl_states.h:38
float_t Kctrl_Wb_p_kgm2
Defines the speed controller constant, Wb/(kg*m^2)
void CTRL_setErrorCode(CTRL_Handle handle, const CTRL_ErrorCode_e errorCode)
Sets the error code in the controller.
Definition: 32b/ctrl.h:1189
CTRL_Version version
the controller version
Definition: 32b/ctrl_obj.h:146
uint_least16_t numCtrlTicksPerSpeedTick
Defines the number of controller clock ticks per speed controller clock tick.
static bool CTRL_getFlag_enable(CTRL_Handle handle)
Gets the enable controller flag value from the controller.
Definition: float/ctrl.h:302
static bool CTRL_isNotIdle(CTRL_Handle handle)
Determines if the controller is not in the idle state.
Definition: float/ctrl.h:1167
#define CTRL_MINOR_RELEASE_NUMBER
Defines the major release number.
no error error code
Definition: 32b/ctrl_obj.h:100
bool CTRL_updateState(CTRL_Handle handle)
Updates the controller state.
Definition: float/ctrl.c:324
PI_Obj pi_spd
the speed PI controller object
static void CTRL_setIdq_A(CTRL_Handle handle, const MATH_vec2 *pIdq_A)
Sets the direct/quadrature current (Idq) vector values in the controller.
Definition: float/ctrl.h:1445
CTRL_TargetProc_e targetProc
the target processor
Definition: 32b/ctrl_obj.h:134
uint_least16_t numIsrTicksPerCtrlTick
Defines the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
static void CTRL_setVdq_V(CTRL_Handle handle, const MATH_vec2 *pVdq_V)
Sets the direct/quadrature voltage (Vdq) vector values in the controller.
Definition: float/ctrl.h:1854
float_t motor_Rr_q_Ohm
Defines the quadrature rotor resistance, Ohm.
float_t motor_ratedFlux_Wb
Defines the rated flux of the motor, Wb.
static void CTRL_setSpeed_outMin_A(CTRL_Handle handle, const float_t speed_outMin_A)
Sets the minimum output value for the speed controller.
Definition: float/ctrl.h:1752
static void CTRL_setFlag_resetInt_spd(CTRL_Handle handle, const bool state)
Sets the reset speed integrator flag value in the controller.
Definition: float/ctrl.h:1380
uint_least32_t ctrlFreq_Hz
Defines the controller frequency, Hz.
float_t motor_Rr_d_Ohm
Defines the direct rotor resistance, Ohm.
static void PI_setMinMax(PI_Handle handle, const _iq outMin, const _iq outMax)
Sets the minimum and maximum output value allowed in the PI controller.
Definition: 32b/pi.h:295
void CTRL_setCtrlFreq_Hz(CTRL_Handle handle, const uint_least32_t ctrlFreq_Hz)
Sets the controller frequency.
Definition: 32b/ctrl.h:1163
float_t dcBus_nominal_V
Defines the nominal DC bus voltage, V.
uint_least16_t motor_numPolePairs
Defines the number of pole pairs for the motor.
void CTRL_resetCounter_speed(CTRL_Handle handle)
Resets the speed counter.
Definition: 32b/ctrl.h:1095
static void CTRL_setCurrentCtrlPeriod_sec(CTRL_Handle handle, const float_t currentCtrlPeriod_sec)
Sets the current controller period value.
Definition: float/ctrl.h:1289
void CTRL_checkForErrors(CTRL_Handle handle)
Checks for any controller errors and, if found, sets the controller state to the error state...
Definition: 32b/ctrl.h:1982
void CTRL_setNumCtrlTicksPerSpeedTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerSpeedTick)
Sets the number of controller clock ticks per speed controller clock tick.
Definition: 32b/ctrl.h:1629
void CTRL_getVersion(CTRL_Handle handle, CTRL_Version *pVersion)
Gets the controller version number.
Definition: float/ctrl.c:58
uint16_t minor
the minor release number
Definition: 32b/ctrl_obj.h:136
static void CTRL_setMaxVsMag_V(CTRL_Handle handle, const float_t maxVsMag_V)
Sets the maximum stator voltage magnitude value.
Definition: float/ctrl.h:1614
void CTRL_setVersion(CTRL_Handle handle, const CTRL_TargetProc_e targetProc, const uint16_t majorReleaseNumber, const uint16_t minorReleaseNumber)
Sets the controller version.
Definition: float/ctrl.c:296
uint_least32_t CTRL_getCount_state(CTRL_Handle handle)
Gets the state count.
Definition: 32b/ctrl.h:128
PI_Handle piHandle_spd
the handle for the speed PI controller
Contains public interface to various functions related to the controller (CTRL) object.
static void CTRL_setSpeedCtrlPeriod_sec(CTRL_Handle handle, const float_t speedCtrlPeriod_sec)
Sets the speed controller period value.
Definition: float/ctrl.h:1778
PI_Obj pi_Iq
the Iq PI controller object
2806x processor
Definition: 32b/ctrl_obj.h:111
struct _CTRL_Obj_ * CTRL_Handle
Defines the CTRL handle.
Definition: 32b/ctrl_obj.h:283
float_t motor_Ls_d_H
Defines the direct stator inductance, H.
static void CTRL_setVd_sf(CTRL_Handle handle, const float_t Vd_sf)
Sets the direct voltage scale factor.
Definition: float/ctrl.h:1841
float_t motor_Ls_q_H
Defines the quadrature stator inductance, H.
void CTRL_setUi(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Ui)
Sets the integrator (Ui) value in the specified controller.
Definition: 32b/ctrl.h:1815
static void CTRL_setKctrl_Wb_p_kgm2(CTRL_Handle handle, const float_t Kctrl_Wb_p_kgm2)
Sets the speed controller constant.
Definition: float/ctrl.h:1526
void CTRL_setNumIsrTicksPerCtrlTick(CTRL_Handle handle, const uint_least16_t numIsrTicksPerCtrlTick)
Sets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
Definition: 32b/ctrl.h:1657
PI Id controller.
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121