MotorWare f2806x Module API Documentation
ctrlQEP.c
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2012, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 
33 
34 
39 
40 
41 // **************************************************************************
42 // the includes
43 
44 #include <math.h>
45 
46 
47 // drivers
48 
49 
50 // modules
53 
54 
55 // platforms
56 #include "ctrlQEP.h"
57 #include "hal.h"
58 #include "user.h"
59 
60 
61 #ifdef FLASH
62 #pragma CODE_SECTION(CTRL_run,"ramfuncs");
63 #pragma CODE_SECTION(CTRL_setup,"ramfuncs");
64 #endif
65 
66 
67 // **************************************************************************
68 // the defines
69 
70 
71 // **************************************************************************
72 // the globals
73 
74 
75 // **************************************************************************
76 // the function prototypes
77 
78 void CTRL_getGains(CTRL_Handle handle,const CTRL_Type_e ctrlType,
79  _iq *pKp,_iq *pKi,_iq *pKd)
80 {
81 
82  *pKp = CTRL_getKp(handle,ctrlType);
83  *pKi = CTRL_getKi(handle,ctrlType);
84  *pKd = CTRL_getKd(handle,ctrlType);
85 
86  return;
87 } // end of CTRL_getGains() function
88 
89 
90 void CTRL_getIab_filt_pu(CTRL_Handle handle,MATH_vec2 *pIab_filt_pu)
91 {
92  CTRL_Obj *obj = (CTRL_Obj *)handle;
93 
94  pIab_filt_pu->value[0] = obj->Iab_filt.value[0];
95  pIab_filt_pu->value[1] = obj->Iab_filt.value[1];
96 
97  return;
98 } // end of CTRL_getIab_filt_pu() function
99 
100 
101 void CTRL_getIab_in_pu(CTRL_Handle handle,MATH_vec2 *pIab_in_pu)
102 {
103  CTRL_Obj *obj = (CTRL_Obj *)handle;
104 
105  pIab_in_pu->value[0] = obj->Iab_in.value[0];
106  pIab_in_pu->value[1] = obj->Iab_in.value[1];
107 
108  return;
109 } // end of CTRL_getIab_in_pu() function
110 
111 
112 void CTRL_getIdq_in_pu(CTRL_Handle handle,MATH_vec2 *pIdq_in_pu)
113 {
114  CTRL_Obj *obj = (CTRL_Obj *)handle;
115 
116  pIdq_in_pu->value[0] = obj->Idq_in.value[0];
117  pIdq_in_pu->value[1] = obj->Idq_in.value[1];
118 
119  return;
120 } // end of CTRL_getIdq_in_pu() function
121 
122 
123 void CTRL_getIdq_ref_pu(CTRL_Handle handle,MATH_vec2 *pIdq_ref_pu)
124 {
125  CTRL_Obj *obj = (CTRL_Obj *)handle;
126 
127  pIdq_ref_pu->value[0] = obj->Idq_ref.value[0];
128  pIdq_ref_pu->value[1] = obj->Idq_ref.value[1];
129 
130  return;
131 } // end of CTRL_getIdq_ref_pu() function
132 
133 
135 {
136 
137  return(CTRL_getIdRated_pu(handle));
138 } // end of CTRL_getMagCurrent_pu() function
139 
140 
142 {
143 
144  return(CTRL_getSpd_max_pu(handle));
145 } // end of CTRL_getMaximumSpeed_pu() function
146 
147 
148 void CTRL_getVab_in_pu(CTRL_Handle handle,MATH_vec2 *pVab_in_pu)
149 {
150  CTRL_Obj *obj = (CTRL_Obj *)handle;
151 
152  pVab_in_pu->value[0] = obj->Vab_in.value[0];
153  pVab_in_pu->value[1] = obj->Vab_in.value[1];
154 
155  return;
156 } // end of CTRL_getVab_in_pu() function
157 
158 
159 void CTRL_getVab_out_pu(CTRL_Handle handle,MATH_vec2 *pVab_out_pu)
160 {
161  CTRL_Obj *obj = (CTRL_Obj *)handle;
162 
163  pVab_out_pu->value[0] = obj->Vab_out.value[0];
164  pVab_out_pu->value[1] = obj->Vab_out.value[1];
165 
166  return;
167 } // end of CTRL_getVab_out_pu() function
168 
169 
170 void CTRL_getVdq_out_pu(CTRL_Handle handle,MATH_vec2 *pVdq_out_pu)
171 {
172  CTRL_Obj *obj = (CTRL_Obj *)handle;
173 
174  pVdq_out_pu->value[0] = obj->Vdq_out.value[0];
175  pVdq_out_pu->value[1] = obj->Vdq_out.value[1];
176 
177  return;
178 } // end of CTRL_getVdq_out_pu() function
179 
180 
181 void CTRL_getWaitTimes(CTRL_Handle handle,uint_least32_t *pWaitTimes)
182 {
183  CTRL_Obj *obj = (CTRL_Obj *)handle;
184  uint_least16_t stateCnt;
185 
186  for(stateCnt=0;stateCnt<CTRL_numStates;stateCnt++)
187  {
188  pWaitTimes[stateCnt] = obj->waitTimes[stateCnt];
189  }
190 
191  return;
192 } // end of CTRL_getWaitTimes() function
193 
194 
195 void CTRL_run(CTRL_Handle handle,HAL_Handle halHandle,
196  const HAL_AdcData_t *pAdcData,
197  HAL_PwmData_t *pPwmData,
198  uint32_t electricalAngle)
199 {
200  uint_least16_t count_isr = CTRL_getCount_isr(handle);
202 
203 
204  // if needed, run the controller
205  if(count_isr >= numIsrTicksPerCtrlTick)
206  {
207  CTRL_State_e ctrlState = CTRL_getState(handle);
208 
209  // reset the isr count
210  CTRL_resetCounter_isr(handle);
211 
212  // increment the state counter
213  CTRL_incrCounter_state(handle);
214 
215  // increment the trajectory count
216  CTRL_incrCounter_traj(handle);
217 
218  // run the appropriate controller
219  if(ctrlState == CTRL_State_OnLine)
220  {
221  CTRL_Obj *obj = (CTRL_Obj *)handle;
222 
223  // increment the current count
224  CTRL_incrCounter_current(handle);
225 
226  // increment the speed count
227  CTRL_incrCounter_speed(handle);
228 
230  {
231  // run the online controller
232  CTRL_runOnLine_User(handle,pAdcData,pPwmData,electricalAngle);
233  }
234  else
235  {
236  // run the online controller
237  CTRL_runOnLine(handle,pAdcData,pPwmData);
238  }
239  }
240  else if(ctrlState == CTRL_State_OffLine)
241  {
242  // run the offline controller
243  CTRL_runOffLine(handle,halHandle,pAdcData,pPwmData);
244  }
245  else if(ctrlState == CTRL_State_Idle)
246  {
247  // set all pwm outputs to zero
248  pPwmData->Tabc.value[0] = _IQ(0.0);
249  pPwmData->Tabc.value[1] = _IQ(0.0);
250  pPwmData->Tabc.value[2] = _IQ(0.0);
251  }
252  }
253  else
254  {
255  // increment the isr count
256  CTRL_incrCounter_isr(handle);
257  }
258 
259  return;
260 } // end of CTRL_run() function
261 
262 
263 void CTRL_setGains(CTRL_Handle handle,const CTRL_Type_e ctrlType,
264  const _iq Kp,const _iq Ki,const _iq Kd)
265 {
266 
267  CTRL_setKp(handle,ctrlType,Kp);
268  CTRL_setKi(handle,ctrlType,Ki);
269  CTRL_setKd(handle,ctrlType,Kd);
270 
271  return;
272 } // end of CTRL_setGains() function
273 
274 
275 void CTRL_setMagCurrent_pu(CTRL_Handle handle,const _iq magCurrent_pu)
276 {
277 
278  CTRL_setIdRated_pu(handle,magCurrent_pu);
279 
280  return;
281 } // end of CTRL_setMagCurrent_pu() function
282 
283 
284 void CTRL_setMaximumSpeed_pu(CTRL_Handle handle,const _iq maxSpeed_pu)
285 {
286 
287  CTRL_setSpd_max_pu(handle,maxSpeed_pu);
288 
289  return;
290 } // end of CTRL_setMaximumSpeed_pu() function
291 
292 
293 void CTRL_setParams(CTRL_Handle handle,USER_Params *pUserParams)
294 {
295  CTRL_Obj *obj = (CTRL_Obj *)handle;
296 
297  _iq Kp,Ki,Kd;
298  _iq outMin,outMax;
299  _iq maxModulation;
300 
301  MATH_vec2 Iab_out_pu = {_IQ(0.0),_IQ(0.0)};
302  MATH_vec2 Idq_out_pu = {_IQ(0.0),_IQ(0.0)};
303  MATH_vec2 Idq_ref_pu = {_IQ(0.0),_IQ(0.0)};
304  MATH_vec2 Vab_in_pu = {_IQ(0.0),_IQ(0.0)};
305  MATH_vec2 Vab_out_pu = {_IQ(0.0),_IQ(0.0)};
306  MATH_vec2 Vdq_out_pu = {_IQ(0.0),_IQ(0.0)};
307 
308 
309  // assign the motor type
310  CTRL_setMotorParams(handle,pUserParams->motor_type,
311  pUserParams->motor_numPolePairs,
312  pUserParams->motor_ratedFlux,
313  pUserParams->motor_Ls_d,
314  pUserParams->motor_Ls_q,
315  pUserParams->motor_Rr,
316  pUserParams->motor_Rs);
317 
318 
319  // assign other controller parameters
324 
325  CTRL_setCtrlFreq_Hz(handle,pUserParams->ctrlFreq_Hz);
326  CTRL_setTrajFreq_Hz(handle,pUserParams->trajFreq_Hz);
327  CTRL_setTrajPeriod_sec(handle,_IQ(1.0/pUserParams->trajFreq_Hz));
328 
329  CTRL_setCtrlPeriod_sec(handle,pUserParams->ctrlPeriod_sec);
330 
331  CTRL_setMaxVsMag_pu(handle,_IQ(pUserParams->maxVsMag_pu));
332 
333  CTRL_setIab_in_pu(handle,&Iab_out_pu);
334  CTRL_setIdq_in_pu(handle,&Idq_out_pu);
335  CTRL_setIdq_ref_pu(handle,&Idq_ref_pu);
336 
337  CTRL_setIdRated_pu(handle,_IQ(pUserParams->IdRated/pUserParams->iqFullScaleCurrent_A));
338 
339  CTRL_setVab_in_pu(handle,&Vab_in_pu);
340  CTRL_setVab_out_pu(handle,&Vab_out_pu);
341  CTRL_setVdq_out_pu(handle,&Vdq_out_pu);
342 
343  CTRL_setSpd_out_pu(handle,_IQ(0.0));
344 
345  CTRL_setRhf(handle,0.0);
346  CTRL_setLhf(handle,0.0);
347  CTRL_setRoverL(handle,0.0);
348 
349 
350  // reset the counters
352  CTRL_resetCounter_isr(handle);
353  CTRL_resetCounter_speed(handle);
354  CTRL_resetCounter_state(handle);
355  CTRL_resetCounter_traj(handle);
356 
357 
358  // set the wait times for each state
359  CTRL_setWaitTimes(handle,&pUserParams->ctrlWaitTime[0]);
360 
361 
362  // set flags
363  CTRL_setFlag_enablePowerWarp(handle,false);
364  CTRL_setFlag_enableCtrl(handle,false);
365  CTRL_setFlag_enableOffset(handle,true);
366  CTRL_setFlag_enableSpeedCtrl(handle,true);
368  CTRL_setFlag_enableDcBusComp(handle,true);
369 
370 
371  // initialize the controller error code
373 
374 
375  // set the default controller state
377 
378 
379  // set the number of current sensors
380  CTRL_setupClarke_I(handle,pUserParams->numCurrentSensors);
381 
382 
383  // set the number of voltage sensors
384  CTRL_setupClarke_V(handle,pUserParams->numVoltageSensors);
385 
386 
387  // set the default Id PID controller parameters
388  Kp = _IQ(0.1);
389  Ki = _IQ(pUserParams->ctrlPeriod_sec/0.004);
390  Kd = _IQ(0.0);
391  outMin = _IQ(-0.95);
392  outMax = _IQ(0.95);
393 
394  PID_setGains(obj->pidHandle_Id,Kp,Ki,Kd);
395  PID_setUi(obj->pidHandle_Id,_IQ(0.0));
396  PID_setMinMax(obj->pidHandle_Id,outMin,outMax);
397  CTRL_setGains(handle,CTRL_Type_PID_Id,Kp,Ki,Kd);
398 
399 
400  // set the default the Iq PID controller parameters
401  Kp = _IQ(0.1);
402  Ki = _IQ(pUserParams->ctrlPeriod_sec/0.004);
403  Kd = _IQ(0.0);
404  outMin = _IQ(-0.95);
405  outMax = _IQ(0.95);
406 
407  PID_setGains(obj->pidHandle_Iq,Kp,Ki,Kd);
408  PID_setUi(obj->pidHandle_Iq,_IQ(0.0));
409  PID_setMinMax(obj->pidHandle_Iq,outMin,outMax);
410  CTRL_setGains(handle,CTRL_Type_PID_Iq,Kp,Ki,Kd);
411 
412 
413  // set the default speed PID controller parameters
414  Kp = _IQ(0.02*pUserParams->maxCurrent*pUserParams->iqFullScaleFreq_Hz/pUserParams->iqFullScaleCurrent_A);
415  Ki = _IQ(2.0*pUserParams->maxCurrent*pUserParams->iqFullScaleFreq_Hz*pUserParams->ctrlPeriod_sec/pUserParams->iqFullScaleCurrent_A);
416  Kd = _IQ(0.0);
417  outMin = _IQ(-1.0);
418  outMax = _IQ(1.0);
419 
420  PID_setGains(obj->pidHandle_spd,Kp,Ki,Kd);
421  PID_setUi(obj->pidHandle_spd,_IQ(0.0));
422  PID_setMinMax(obj->pidHandle_spd,outMin,outMax);
423  CTRL_setGains(handle,CTRL_Type_PID_spd,Kp,Ki,Kd);
424 
425 
426  // set the speed reference
427  CTRL_setSpd_ref_pu(handle,_IQ(0.0));
428 
429 
430  // set the default Id current trajectory module parameters
436 
437 
438  // set the default the speed trajectory module parameters
444 
445 
446  // set the default maximum speed trajectory module parameters
449  TRAJ_setMinValue(obj->trajHandle_spdMax,_IQ(0.0)); // not used
450  TRAJ_setMaxValue(obj->trajHandle_spdMax,_IQ(0.0)); // not used
451  TRAJ_setMaxDelta(obj->trajHandle_spdMax,_IQ(0.0)); // not used
452 
453 
454  // set the default estimator parameters
455  CTRL_setEstParams(obj->estHandle,pUserParams);
456 
457 
458  // set the maximum modulation for the SVGEN module
459  maxModulation = _IQ(MATH_TWO_OVER_THREE);
460  SVGEN_setMaxModulation(obj->svgenHandle,maxModulation);
461 
462  return;
463 } // end of CTRL_setParams() function
464 
465 
466 void CTRL_setSpd_ref_pu(CTRL_Handle handle,const _iq spd_ref_pu)
467 {
468  CTRL_Obj *obj = (CTRL_Obj *)handle;
469 
470  obj->spd_ref = spd_ref_pu;
471 
472  return;
473 } // end of CTRL_setSpd_ref_pu() function
474 
475 
476 void CTRL_setSpd_ref_krpm(CTRL_Handle handle,const _iq spd_ref_krpm)
477 {
478  CTRL_Obj *obj = (CTRL_Obj *)handle;
479 
480  _iq krpm_to_pu_sf = EST_get_krpm_to_pu_sf(obj->estHandle);
481 
482  _iq spd_ref_pu = _IQmpy(spd_ref_krpm,krpm_to_pu_sf);
483 
484  obj->spd_ref = spd_ref_pu;
485 
486  return;
487 } // end of CTRL_setSpd_ref_krpm() function
488 
489 
491 {
492  CTRL_Obj *obj = (CTRL_Obj *)handle;
493 
494  uint_least16_t count_traj = CTRL_getCount_traj(handle);
496 
497 
498  // as needed, update the trajectory
499  if(count_traj >= numCtrlTicksPerTrajTick)
500  {
501  _iq intValue_Id = TRAJ_getIntValue(obj->trajHandle_Id);
502 
503  // reset the trajectory count
504  CTRL_resetCounter_traj(handle);
505 
506  // run the trajectories
507  CTRL_runTraj(handle);
508  } // end of if(gFlag_traj) block
509 
510  return;
511 } // end of CTRL_setup() function
512 
513 
514 void CTRL_setupClarke_I(CTRL_Handle handle,uint_least8_t numCurrentSensors)
515 {
516  CTRL_Obj *obj = (CTRL_Obj *)handle;
517  _iq alpha_sf,beta_sf;
518 
519 
520  // initialize the Clarke transform module for current
521  if(numCurrentSensors == 3)
522  {
523  alpha_sf = _IQ(MATH_ONE_OVER_THREE);
524  beta_sf = _IQ(MATH_ONE_OVER_SQRT_THREE);
525  }
526  else if(numCurrentSensors == 2)
527  {
528  alpha_sf = _IQ(1.0);
529  beta_sf = _IQ(MATH_ONE_OVER_SQRT_THREE);
530  }
531  else
532  {
533  alpha_sf = _IQ(0.0);
534  beta_sf = _IQ(0.0);
535  }
536 
537  // set the parameters
538  CLARKE_setScaleFactors(obj->clarkeHandle_I,alpha_sf,beta_sf);
539  CLARKE_setNumSensors(obj->clarkeHandle_I,numCurrentSensors);
540 
541  return;
542 } // end of CTRL_setupClarke_I() function
543 
544 
545 void CTRL_setupClarke_V(CTRL_Handle handle,uint_least8_t numVoltageSensors)
546 {
547  CTRL_Obj *obj = (CTRL_Obj *)handle;
548  _iq alpha_sf,beta_sf;
549 
550 
551  // initialize the Clarke transform module for current
552  if(numVoltageSensors == 3)
553  {
554  alpha_sf = _IQ(MATH_ONE_OVER_THREE);
555  beta_sf = _IQ(MATH_ONE_OVER_SQRT_THREE);
556  }
557  else
558  {
559  alpha_sf = _IQ(0.0);
560  beta_sf = _IQ(0.0);
561  }
562 
563  // set the parameters
564  CLARKE_setScaleFactors(obj->clarkeHandle_V,alpha_sf,beta_sf);
565  CLARKE_setNumSensors(obj->clarkeHandle_V,numVoltageSensors);
566 
567  return;
568 } // end of CTRL_setupClarke_V() function
569 
570 
571 void CTRL_setWaitTimes(CTRL_Handle handle,const uint_least32_t *pWaitTimes)
572 {
573  CTRL_Obj *obj = (CTRL_Obj *)handle;
574  uint_least16_t stateCnt;
575 
576  for(stateCnt=0;stateCnt<CTRL_numStates;stateCnt++)
577  {
578  obj->waitTimes[stateCnt] = pWaitTimes[stateCnt];
579  }
580 
581  return;
582 } // end of CTRL_setWaitTimes() function
583 
584 
586 {
587  CTRL_State_e ctrlState = CTRL_getState(handle);
589  bool stateChanged = false;
590 
591 
592  if(flag_enableCtrl)
593  {
594  uint_least32_t waitTime = CTRL_getWaitTime(handle,ctrlState);
595  uint_least32_t counter_ctrlState = CTRL_getCount_state(handle);
596 
597 
598  // check for errors
599  CTRL_checkForErrors(handle);
600 
601 
602  if(counter_ctrlState >= waitTime)
603  {
604  // reset the counter
605  CTRL_resetCounter_state(handle);
606 
607 
608  if(ctrlState == CTRL_State_OnLine)
609  {
610  CTRL_Obj *obj = (CTRL_Obj *)handle;
611  _iq Id_target = TRAJ_getTargetValue(obj->trajHandle_Id);
612 
613  // update the estimator state
614  bool flag_estStateChanged = EST_updateState(obj->estHandle,Id_target);
615 
616  if(flag_estStateChanged)
617  {
618  // setup the controller
619  CTRL_setupCtrl(handle);
620 
621  // setup the trajectory
622  CTRL_setupTraj(handle);
623  }
624 
625  if(EST_isOnLine(obj->estHandle))
626  {
627  // setup the estimator for online state
628  CTRL_setupEstOnLineState(handle);
629  }
630 
631  if(EST_isLockRotor(obj->estHandle) ||
633  {
634  // set the enable controller flag to false
635  CTRL_setFlag_enableCtrl(handle,false);
636 
637  // set the next controller state
639  }
640  }
641  else if(ctrlState == CTRL_State_OffLine)
642  {
643  // set the next controller state
645  }
646  else if(ctrlState == CTRL_State_Idle)
647  {
648  CTRL_Obj *obj = (CTRL_Obj *)handle;
650 
651  if(flag_enableUserMotorParams)
652  {
653  // initialize the motor parameters using values from the user.h file
654  CTRL_setUserMotorParams(handle);
655  }
656 
657  if(EST_isIdle(obj->estHandle))
658  {
659  // setup the estimator for idle state
660  CTRL_setupEstIdleState(handle);
661 
663  {
664  if(CTRL_getFlag_enableOffset(handle))
665  {
666  // set the next controller state
668  }
669  else
670  {
671  // set the next controller state
673  }
674  }
675  else
676  {
677  // set the next controller state
679  }
680  }
681  else if(EST_isLockRotor(obj->estHandle))
682  {
683  // set the next controller state
685  }
686  }
687  } // if(counter_ctrlState >= waitTime) loop
688  }
689  else
690  {
691  CTRL_Obj *obj = (CTRL_Obj *)handle;
692 
693  // set the next controller state
695 
696  // set the estimator to idle
697  if(!EST_isLockRotor(obj->estHandle))
698  {
700  {
701  EST_setIdle(obj->estHandle);
702  }
703  else
704  {
706 
707  EST_setRs_pu(obj->estHandle,_IQ30(0.0));
708  }
709  }
710  }
711 
712 
713  // check to see if the state changed
714  if(ctrlState != CTRL_getState(handle))
715  {
716  stateChanged = true;
717  }
718 
719  return(stateChanged);
720 } // end of CTRL_updateState() function
721 
722 // end of file
PID Speed controller.
Definition: 32b/ctrl_obj.h:123
void CTRL_getGains(CTRL_Handle handle, const CTRL_Type_e ctrlType, _iq *pKp, _iq *pKi, _iq *pKd)
Gets the gain values for the specified controller.
Definition: ctrlQEP.c:78
void CTRL_incrCounter_isr(CTRL_Handle handle)
Increments the isr counter.
Definition: 32b/ctrl.h:967
static void TRAJ_setTargetValue(TRAJ_Handle handle, const _iq targetValue)
Sets the target value for the trajectory.
Definition: 32b/traj.h:206
float_t motor_Ls_q
Defines the quadrature stator inductance, H.
void CTRL_setupEstOnLineState(CTRL_Handle handle)
Sets up the controller and trajectory generator for the estimator online state.
void CTRL_getIdq_ref_pu(CTRL_Handle handle, MATH_vec2 *pIdq_ref_pu)
Gets the direct/quadrature current reference vector values from the controller.
Definition: ctrlQEP.c:123
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
void CTRL_getIab_filt_pu(CTRL_Handle handle, MATH_vec2 *pIab_filt_pu)
Gets the alpha/beta filtered current vector values from the controller.
Definition: ctrlQEP.c:90
CLARKE_Handle clarkeHandle_I
the handle for the current Clarke transform
Definition: 32b/ctrl_obj.h:154
#define _IQ(A)
static void TRAJ_setMaxDelta(TRAJ_Handle handle, const _iq maxDelta)
Sets the maximum delta value for the trajectory.
Definition: 32b/traj.h:167
void CTRL_resetCounter_state(CTRL_Handle handle)
Resets the state counter.
Definition: 32b/ctrl.h:1107
float_t iqFullScaleCurrent_A
Defines the full scale current for the IQ variables, A.
float_t IdRated
Defines the Id rated current value, A.
motor identified state
Definition: est_states.h:68
static void PID_setUi(PID_Handle handle, const _iq Ui)
Sets the integrator start value in the PID controller.
Definition: 32b/pid.h:409
void CTRL_setupClarke_V(CTRL_Handle handle, uint_least8_t numVoltageSensors)
Sets the number of voltage sensors.
Definition: ctrlQEP.c:545
void CTRL_setEstParams(EST_Handle estHandle, USER_Params *pUserParams)
Sets the default estimator parameters.
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
#define MATH_TWO_OVER_THREE
Defines 2/3.
Definition: 32b/math.h:77
static _iq TRAJ_getIntValue(TRAJ_Handle handle)
Gets the intermediate value for the trajectory.
Definition: 32b/traj.h:92
void CTRL_setIab_in_pu(CTRL_Handle handle, const MATH_vec2 *pIab_in_pu)
Sets the alpha/beta current (Iab) input vector values in the controller.
Definition: 32b/ctrl.h:1323
_iq spd_ref
the speed reference, pu
Definition: 32b/ctrl_obj.h:251
void CTRL_getVdq_out_pu(CTRL_Handle handle, MATH_vec2 *pVdq_out_pu)
Gets the direct/quadrature voltage output vector values from the controller.
Definition: ctrlQEP.c:170
uint_least16_t numCtrlTicksPerTrajTick
Defines the number of controller clock ticks per trajectory clock tick.
Definition: 32b/ctrl_obj.h:201
float_t motor_Rr
Defines the rotor resistance, ohm.
Defines a two element vector.
Definition: 32b/math.h:248
the number of controller states
Definition: ctrl_states.h:39
bool EST_isOnLine(EST_Handle handle)
Determines if the estimator is ready for online control.
_iq CTRL_getKd(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the derivative gain (Kd) value from the specified controller.
Definition: 32b/ctrl.h:473
_iq value[3]
Definition: 32b/math.h:261
void CTRL_incrCounter_current(CTRL_Handle handle)
Increments the current counter.
Definition: 32b/ctrl.h:949
float_t ctrlPeriod_sec
Defines the controller execution period, sec.
TRAJ_Handle trajHandle_Id
the handle for the Id trajectory generator
Definition: 32b/ctrl_obj.h:180
void EST_setIdle(EST_Handle handle)
Sets the estimator to idle.
uint_least16_t CTRL_getNumCtrlTicksPerTrajTick(CTRL_Handle handle)
Gets the number of controller clock ticks per trajectory clock tick.
Definition: 32b/ctrl.h:602
uint_least16_t CTRL_getNumIsrTicksPerCtrlTick(CTRL_Handle handle)
Gets the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
Definition: 32b/ctrl.h:613
TRAJ_Handle trajHandle_spd
the handle for the speed trajectory generator
Definition: 32b/ctrl_obj.h:183
void CTRL_setVab_in_pu(CTRL_Handle handle, const MATH_vec2 *pVab_in_pu)
Sets the alpha/beta voltage input vector values in the controller.
Definition: 32b/ctrl.h:1882
void CTRL_setSpd_max_pu(CTRL_Handle handle, const _iq maxSpd_pu)
Sets the maximum speed value in the controller.
Definition: 32b/ctrl.h:1710
MATH_vec2 Vab_out
the Vab output values
Definition: 32b/ctrl_obj.h:223
the controller idle state
Definition: ctrl_states.h:36
PID_Handle pidHandle_Id
the handle for the Id PID controller
Definition: 32b/ctrl_obj.h:165
uint_least32_t ctrlWaitTime[CTRL_numStates]
Defines the wait times for each controller state, estimator ticks.
Defines the controller (CTRL) object.
Definition: 32b/ctrl_obj.h:144
void CTRL_setTrajPeriod_sec(CTRL_Handle handle, const _iq trajPeriod_sec)
Sets the trajectory execution period.
Definition: 32b/ctrl.h:1801
void CTRL_setMagCurrent_pu(CTRL_Handle handle, const _iq magCurrent_pu)
Sets the magnetizing current value in the controller.
Definition: ctrlQEP.c:275
Defines a structure for the user parameters.
uint_least8_t numCurrentSensors
Defines the number of current sensors.
uint_least16_t CTRL_getCount_traj(CTRL_Handle handle)
Gets the trajectory loop count.
Definition: 32b/ctrl.h:139
EST_Handle estHandle
the handle for the parameter estimator
Definition: 32b/ctrl_obj.h:160
void CTRL_setKi(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Ki)
Sets the integral gain (Ki) value for the specified controller.
Definition: 32b/ctrl.h:1474
static void PID_setMinMax(PID_Handle handle, const _iq outMin, const _iq outMax)
Sets the minimum and maximum output value allowed in the PID controller.
Definition: 32b/pid.h:356
void CTRL_setFlag_enableCtrl(CTRL_Handle handle, const bool state)
Sets the enable controller flag value in the estimator.
Definition: 32b/ctrl.h:1214
void CTRL_setFlag_enableSpeedCtrl(CTRL_Handle handle, const bool state)
Sets the enable speed control value in the estimator.
Definition: 32b/ctrl.h:1284
void CTRL_getIab_in_pu(CTRL_Handle handle, MATH_vec2 *pIab_in_pu)
Gets the alpha/beta current input vector values from the controller.
Definition: ctrlQEP.c:101
float_t maxCurrent
Defines the maximum current value, A.
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_runTraj(CTRL_Handle handle)
Runs the trajectory.
void CTRL_setIdq_ref_pu(CTRL_Handle handle, const MATH_vec2 *pIdq_ref_pu)
Sets the direct/quadrature current (Idq) reference vector values in the controller.
Definition: 32b/ctrl.h:1384
long _iq
uint_least16_t numCtrlTicksPerCurrentTick
Defines the number of controller clock ticks per current controller clock tick.
#define MATH_ONE_OVER_THREE
Defines 1/3.
Definition: 32b/math.h:81
void CTRL_resetCounter_current(CTRL_Handle handle)
Resets the current counter.
Definition: 32b/ctrl.h:1071
uint_least16_t CTRL_getCount_isr(CTRL_Handle handle)
Gets the isr count.
Definition: 32b/ctrl.h:106
TRAJ_Handle trajHandle_spdMax
the handle for the maximum speed trajectory generator
Definition: 32b/ctrl_obj.h:186
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: ctrlQEP.c:263
static void CLARKE_setScaleFactors(CLARKE_Handle handle, const _iq alpha_sf, const _iq beta_sf)
Sets the scale factors.
Definition: 32b/clarke.h:180
void CTRL_setupTraj(CTRL_Handle handle)
Sets up the trajectory (TRAJ) object.
void CTRL_setState(CTRL_Handle handle, const CTRL_State_e state)
Sets the controller state.
Definition: 32b/ctrl.h:1774
static _iq TRAJ_getTargetValue(TRAJ_Handle handle)
Gets the target value for the trajectory.
Definition: 32b/traj.h:136
static void TRAJ_setIntValue(TRAJ_Handle handle, const _iq intValue)
Sets the intermediate value for the trajectory.
Definition: 32b/traj.h:154
MATH_vec3 Tabc
the PWM time-durations for each motor phase
static void PID_setGains(PID_Handle handle, const _iq Kp, const _iq Ki, const _iq Kd)
Sets the gains in the PID controller.
Definition: 32b/pid.h:301
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
Sets the controller parameters.
Definition: ctrlQEP.c:293
MOTOR_Type_e motor_type
Defines the motor type.
#define _IQmpy(A, B)
void CTRL_getIdq_in_pu(CTRL_Handle handle, MATH_vec2 *pIdq_in_pu)
Gets the direct/quadrature current input vector values from the controller.
Definition: ctrlQEP.c:112
void CTRL_setWaitTimes(CTRL_Handle handle, const uint_least32_t *pWaitTimes)
Sets the wait times for the controller states.
Definition: ctrlQEP.c:571
_iq CTRL_getSpd_max_pu(CTRL_Handle handle)
Gets the maximum speed value from the controller.
Definition: 32b/ctrl.h:701
void CTRL_setVdq_out_pu(CTRL_Handle handle, const MATH_vec2 *pVdq_out_pu)
Sets the direct/quadrature voltage output vector values in the controller.
Definition: 32b/ctrl.h:1924
void CTRL_incrCounter_speed(CTRL_Handle handle)
Increments the speed counter.
Definition: 32b/ctrl.h:985
void CTRL_resetCounter_isr(CTRL_Handle handle)
Resets the isr counter.
Definition: 32b/ctrl.h:1083
_iq value[2]
Definition: 32b/math.h:251
void CTRL_runOnLine_User(CTRL_Handle handle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
Runs the online user controller.
Definition: 32b/ctrl.h:2343
void CTRL_setNumCtrlTicksPerTrajTick(CTRL_Handle handle, const uint_least16_t numCtrlTicksPerTrajTick)
Sets the number of controller clock ticks per trajectory clock tick.
Definition: 32b/ctrl.h:1643
MATH_vec2 Idq_in
the Idq input values
Definition: 32b/ctrl_obj.h:217
PID_Handle pidHandle_spd
the handle for the speed PID controller
Definition: 32b/ctrl_obj.h:171
void CTRL_setIdq_in_pu(CTRL_Handle handle, const MATH_vec2 *pIdq_in_pu)
Sets the direct/quadrature current (Idq) input vector values in the controller.
Definition: 32b/ctrl.h:1356
uint_least32_t trajFreq_Hz
Defines the trajectory frequency, Hz.
void CTRL_setSpd_out_pu(CTRL_Handle handle, const _iq spd_out_pu)
Sets the output speed value in the controller.
Definition: 32b/ctrl.h:1723
uint_least8_t numVoltageSensors
Defines the number of voltage sensors.
bool CTRL_getFlag_enableUserMotorParams(CTRL_Handle handle)
Gets the enable user motor parameters flag value from the controller.
Definition: 32b/ctrl.h:270
void CTRL_incrCounter_state(CTRL_Handle handle)
Increments the state counter.
Definition: 32b/ctrl.h:1003
void CTRL_setupEstIdleState(CTRL_Handle handle)
Sets up the controller and trajectory generator for the estimator idle state.
CTRL_State_e CTRL_getState(CTRL_Handle handle)
Gets the controller state.
Definition: 32b/ctrl.h:767
void CTRL_setUserMotorParams(CTRL_Handle handle)
Sets the controller and estimator with motor parameters from the user.h file.
void CTRL_setLhf(CTRL_Handle handle, const float_t Lhf)
Sets the high frequency inductance (Lhf) value in the controller.
Definition: 32b/ctrl.h:1523
Contains the public interface to the math (MATH) module routines.
void CTRL_setCtrlPeriod_sec(CTRL_Handle handle, const float_t ctrlPeriod_sec)
Sets the controller execution period.
Definition: 32b/ctrl.h:1176
static void SVGEN_setMaxModulation(SVGEN_Handle handle, const _iq maxModulation)
Sets the maximum modulation in the space vector generator module.
Definition: 32b/svgen.h:174
EST_State_e EST_getState(EST_Handle handle)
Gets the state of the estimator.
_iq CTRL_getMaximumSpeed_pu(CTRL_Handle handle)
Gets the maximum speed value from the controller.
Definition: ctrlQEP.c:141
MATH_vec2 Iab_filt
the Iab filtered values
Definition: 32b/ctrl_obj.h:215
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
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
_iq CTRL_getKp(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the proportional gain (Kp) value from the specified controller.
Definition: 32b/ctrl.h:499
void CTRL_setup(CTRL_Handle handle)
Sets up the controller (CTRL) object and all of the subordinate objects.
Definition: ctrlQEP.c:490
void CTRL_getVab_out_pu(CTRL_Handle handle, MATH_vec2 *pVab_out_pu)
Gets the alpha/beta voltage output vector values from the controller.
Definition: ctrlQEP.c:159
void CTRL_setSpd_ref_pu(CTRL_Handle handle, const _iq spd_ref_pu)
Sets the output speed reference value in the controller.
Definition: ctrlQEP.c:466
CTRL_State_e
Enumeration for the controller states.
Definition: ctrl_states.h:34
the controller online state
Definition: ctrl_states.h:38
CLARKE_Handle clarkeHandle_V
the handle for the voltage Clarke transform
Definition: 32b/ctrl_obj.h:157
void CTRL_setTrajFreq_Hz(CTRL_Handle handle, const uint_least32_t trajFreq_Hz)
Sets the trajectory execution frequency.
Definition: 32b/ctrl.h:1788
void CTRL_runOffLine(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
Runs the offline controller.
Definition: 32b/ctrl.h:2089
void CTRL_setErrorCode(CTRL_Handle handle, const CTRL_ErrorCode_e errorCode)
Sets the error code in the controller.
Definition: 32b/ctrl.h:1189
static void CLARKE_setNumSensors(CLARKE_Handle handle, const uint_least8_t numSensors)
Sets the number of sensors.
Definition: 32b/clarke.h:166
void CTRL_setVab_out_pu(CTRL_Handle handle, const MATH_vec2 *pVab_out_pu)
Sets the alpha/beta current output vector values in the controller.
Definition: 32b/ctrl.h:1896
void CTRL_setMaxVsMag_pu(CTRL_Handle handle, const _iq maxVsMag)
Sets the maximum voltage vector in the controller.
Definition: 32b/ctrl.h:1542
void CTRL_resetCounter_traj(CTRL_Handle handle)
Resets the trajectory counter.
Definition: 32b/ctrl.h:1119
#define _IQ30(A)
uint_least16_t numCtrlTicksPerTrajTick
Defines the number of controller clock ticks per trajectory clock tick.
PID_Handle pidHandle_Iq
the handle for the Iq PID controller
Definition: 32b/ctrl_obj.h:168
uint_least16_t numCtrlTicksPerSpeedTick
Defines the number of controller clock ticks per speed controller clock tick.
_iq CTRL_getIdRated_pu(CTRL_Handle handle)
Gets the Id rated current value from the controller.
Definition: 32b/ctrl.h:381
void CTRL_setFlag_enablePowerWarp(CTRL_Handle handle, const bool state)
Sets the PowerWarp enable flag value in the estimator.
Definition: 32b/ctrl.h:1258
no error error code
Definition: 32b/ctrl_obj.h:100
bool CTRL_updateState(CTRL_Handle handle)
Updates the controller state.
Definition: ctrlQEP.c:585
CTRL_Type_e
Enumeration for the controller (CTRL) types.
Definition: 32b/ctrl_obj.h:121
_iq CTRL_getKi(CTRL_Handle handle, const CTRL_Type_e ctrlType)
Gets the integral gain (Ki) value from the specified controller.
Definition: 32b/ctrl.h:447
void CTRL_getWaitTimes(CTRL_Handle handle, uint_least32_t *pWaitTimes)
Gets the wait times from the estimator.
Definition: ctrlQEP.c:181
static void TRAJ_setMaxValue(TRAJ_Handle handle, const _iq maxValue)
Sets the maximum value for the trajectory.
Definition: 32b/traj.h:180
bool CTRL_getFlag_enableCtrl(CTRL_Handle handle)
Gets the enable controller flag value from the estimator.
Definition: 32b/ctrl.h:204
bool EST_isMotorIdentified(EST_Handle handle)
Determines if the motor has been identified.
bool flag_enableCtrl
a flag to enable the controller
Definition: 32b/ctrl_obj.h:263
void CTRL_setRhf(CTRL_Handle handle, const float_t Rhf)
Sets the high frequency resistance (Rhf) value in the controller.
Definition: 32b/ctrl.h:1671
void CTRL_setFlag_enableOffset(CTRL_Handle handle, const bool state)
Sets the enable offset flag value in the estimator.
Definition: 32b/ctrl.h:1271
float_t motor_Rs
Defines the stator resistance, ohm.
bool EST_isLockRotor(EST_Handle handle)
Determines if the estimator is waiting for the rotor to be locked.
uint_least16_t numIsrTicksPerCtrlTick
Defines the number of Interrupt Service Routine (ISR) clock ticks per controller clock tick...
void CTRL_setFlag_enableDcBusComp(CTRL_Handle handle, const bool state)
Sets the enable DC bus compensation flag value in the estimator.
Definition: 32b/ctrl.h:1242
void EST_setRs_pu(EST_Handle handle, const _iq Rs_pu)
Sets the stator resistance value used in the estimator in per unit (pu), IQ30.
PID Iq controller.
Definition: 32b/ctrl_obj.h:125
void CTRL_setFlag_enableUserMotorParams(CTRL_Handle handle, const bool state)
Sets the enable user motor parameters flag value in the estimator.
Definition: 32b/ctrl.h:1300
void CTRL_setKd(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kd)
Sets the derivative gain (Kd) value for the specified controller.
Definition: 32b/ctrl.h:1449
_iq CTRL_getMagCurrent_pu(CTRL_Handle handle)
Gets the magnetizing current value from the controller.
Definition: ctrlQEP.c:134
uint_least32_t ctrlFreq_Hz
Defines the controller frequency, Hz.
void CTRL_setIdRated_pu(CTRL_Handle handle, const _iq IdRated_pu)
Sets the Id rated current value in the controller.
Definition: 32b/ctrl.h:1398
bool flag_enableUserMotorParams
a flag to use known motor parameters from user.h file
Definition: 32b/ctrl_obj.h:268
_iq EST_get_krpm_to_pu_sf(EST_Handle handle)
Gets the krpm to pu scale factor in per unit (pu), IQ24.
bool EST_isIdle(EST_Handle handle)
Determines if the estimator is idle.
void CTRL_setCtrlFreq_Hz(CTRL_Handle handle, const uint_least32_t ctrlFreq_Hz)
Sets the controller frequency.
Definition: 32b/ctrl.h:1163
PID Id controller.
Definition: 32b/ctrl_obj.h:124
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
#define MATH_ONE_OVER_SQRT_THREE
Defines 1/sqrt(3)
Definition: 32b/math.h:89
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_getVab_in_pu(CTRL_Handle handle, MATH_vec2 *pVab_in_pu)
Gets the alpha/beta voltage input vector values from the controller.
Definition: ctrlQEP.c:148
void CTRL_setMaximumSpeed_pu(CTRL_Handle handle, const _iq maxSpeed_pu)
Sets the maximum speed value in the controller.
Definition: ctrlQEP.c:284
void EST_setIdle_all(EST_Handle handle)
Sets the estimator and all of the subordinate estimators to idle.
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
MATH_vec2 Iab_in
the Iab input values
Definition: 32b/ctrl_obj.h:213
uint_least32_t CTRL_getCount_state(CTRL_Handle handle)
Gets the state count.
Definition: 32b/ctrl.h:128
bool EST_updateState(EST_Handle handle, const _iq Id_target_pu)
Updates the estimator state.
uint_least16_t numIsrTicksPerCtrlTick
Defines the number of isr clock ticks per controller clock tick.
Definition: 32b/ctrl_obj.h:195
Contains the public interface to the data logging (DLOG) module routines.
void CTRL_setRoverL(CTRL_Handle handle, const float_t RoverL)
Sets the R/L value in the controller.
Definition: 32b/ctrl.h:1684
void CTRL_run(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData, uint32_t electricalAngle)
Runs the controller.
Definition: ctrlQEP.c:195
the controller offline state
Definition: ctrl_states.h:37
void CTRL_incrCounter_traj(CTRL_Handle handle)
Increments the trajectory counter.
Definition: 32b/ctrl.h:1021
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
float_t iqFullScaleFreq_Hz
Defines the full scale frequency for IQ variable, Hz.
void CTRL_setSpd_ref_krpm(CTRL_Handle handle, const _iq spd_ref_krpm)
Sets the output speed reference value in the controller.
Definition: ctrlQEP.c:476
void CTRL_setupClarke_I(CTRL_Handle handle, uint_least8_t numCurrentSensors)
Sets the number of current sensors.
Definition: ctrlQEP.c:514
void CTRL_setKp(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kp)
Sets the proportional gain (Kp) value for the specified controller.
Definition: 32b/ctrl.h:1499
void CTRL_setupCtrl(CTRL_Handle handle)
Sets up the controllers.
float_t motor_Ls_d
Defines the direct stator inductance, H.
Defines the hardware abstraction layer (HAL) data.
float_t motor_ratedFlux
Defines the rated flux of the motor, V/Hz.
void CTRL_runOnLine(CTRL_Handle handle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
Runs the online controller.
Definition: 32b/ctrl.h:2158
static void TRAJ_setMinValue(TRAJ_Handle handle, const _iq minValue)
Sets the minimum value for the trajectory.
Definition: 32b/traj.h:193
SVGEN_Handle svgenHandle
the handle for the space vector generator
Definition: 32b/ctrl_obj.h:177
float_t maxVsMag_pu
Defines the maximum voltage magnitude, pu.
bool CTRL_getFlag_enableOffset(CTRL_Handle handle)
Gets the enable offset flag value from the controller.
Definition: 32b/ctrl.h:248