instaspin_foc
proj_fast.c
Go to the documentation of this file.
1 
7 
8 // **************************************************************************
9 // the includes
10 
11 // system includes
12 #include <math.h>
13 
14 // drivers
15 
16 
17 // modules
18 #include "sw/modules/cal/src/float/cal.h"
19 #include "sw/modules/ipark/src/float/ipark.h"
20 #include "sw/modules/park/src/float/park.h"
22 #include "sw/modules/svgen/src/float/svgen.h"
23 
25 
26 
27 // solutions
28 #include "main.h"
29 
30 
31 // **************************************************************************
32 // the defines
33 #undef ENABLE_QUEUE
34 
35 
36 // **************************************************************************
37 // the globals
38 
39 int_least32_t gCounter_enableSys = 0;
40 
41 int_least32_t gCounter_isr = 0;
42 
43 int_least32_t gCounter_main = 0;
44 
45 CAL_State_e gCalState = CAL_State_Idle;
46 
47 CTRL_State_e gCtrlState = CTRL_State_Idle;
48 
49 EST_State_e gEstState = EST_State_Idle;
50 
51 EST_Traj_State_e gTrajState = EST_Traj_State_Idle;
52 
53 volatile bool gFlag_bypassLockRotor = false;
54 
55 volatile bool gFlag_enableSys = false;
56 
57 volatile bool gFlag_runCal = false;
58 
59 volatile bool gFlag_runIdentAndOnLine = false;
60 
61 volatile bool gFlag_enableForceAngle = true;
62 
63 volatile bool gFlag_enablePowerWarp = false;
64 
65 volatile bool gFlag_enableRsOnLine = false;
66 
67 volatile bool gFlag_enableRsRecalc = true;
68 
69 volatile bool gFlag_updateRs = false;
70 
71 uint_least16_t gBufferIndex_est = 0;
72 
73 uint_least16_t gBufferIndex_setup = 0;
74 
76 
78 
80 
82 
84 
86 
88 
90 
92 
94 
96 
98 
100 
102 
104 
106 
108 
109 volatile float_t gSpeed_Kp = 0.1;
110 
111 volatile float_t gSpeed_Ki = 0.01;
112 
114 
116 
118 
120 
122 
123 volatile float_t gRsOnLineFreq_Hz = 0.2;
124 
125 volatile float_t gRsOnLineId_mag_A = 0.5;
126 
127 volatile float_t gRsOnLinePole_Hz = 0.2;
128 
130 
132 
134 
136 
139 
142 
145 
148 
151 
154 
156 
159 
162 
165 
168 
169 
170 #ifdef DRV8301_SPI
171 // Watch window interface to the 8301 SPI
172 DRV_SPI_8301_Vars_t gDrvSpi8301Vars;
173 #endif
174 
175 
181 
182 
183 // **************************************************************************
184 // the functions
185 
186 void main(void)
187 {
188  uint_least8_t ctrlNumber = 0;
189  uint_least8_t estNumber = 0;
190 
191 
192  // initialize the user parameters
193  USER_setParams(&gUserParams);
194 
195 
196  // initialize the user parameters
197  USER_setParams_priv(&gUserParams);
198 
199 
200  // initialize the driver
201  halHandle = HAL_init(&hal,sizeof(hal));
202 
203 
204  // set the driver parameters
205  HAL_setParams(halHandle,&gUserParams);
206 
207 
208  // initialize the angle generator
209  angleHandle = ANGLE_init(&angle,sizeof(angle));
210 
211 
212  // set the default angle generator parameters
213  ANGLE_setParams(angleHandle,gUserParams.ctrlPeriod_sec,gUserParams.angleDelayed_sf_sec);
214 
215 
216  // initialize the calibrator
217  calHandle = CAL_init(&cal,sizeof(cal));
218 
219 
220  // set the default calibrator parameters
221  CAL_setParams(calHandle,&gUserParams);
222 
223 
224  // initialize the Clarke modules
225  clarkeHandle_I = CLARKE_init(&clarke_I,sizeof(clarke_I));
226  clarkeHandle_V = CLARKE_init(&clarke_V,sizeof(clarke_V));
227 
228 
229  // set the Clarke parameters
230  setupClarke_I(clarkeHandle_I,gUserParams.numCurrentSensors);
231  setupClarke_V(clarkeHandle_V,gUserParams.numVoltageSensors);
232 
233 
234  // initialize the controller
235  ctrlHandle = CTRL_init(&(ctrl[ctrlNumber]),sizeof(ctrl[ctrlNumber]));
236 
237 
238  // get the version number
239  CTRL_getVersion(ctrlHandle,&gVersion);
240 
241 
242  // set the default controller parameters
243  CTRL_setParams(ctrlHandle,&gUserParams);
244 
245 
246  // initialize the estimator
247  estHandle = EST_initEst(estNumber);
248 
249 
250  // set the default estimator parameters
251  EST_setParams(estHandle,&gUserParams);
258 
259 
260  // if motor type is an induction motor, configure default state of PowerWarp
261  if(gUserParams.motor_type == MOTOR_Type_Induction)
262  {
265  }
266 
267 
268  // initialize the inverse Park module
269  iparkHandle = IPARK_init(&ipark,sizeof(ipark));
270 
271 
272  // initialize the Park module
273  parkHandle = PARK_init(&park,sizeof(park));
274 
275 
276  // initialize the queue
277  queueHandle = QUEUE_init(&queue,sizeof(queue));
278 
279 
280  // initialize the space vector generator module
281  svgenHandle = SVGEN_init(&svgen,sizeof(svgen));
282 
283 
284  // initialize the CPU usage module
285  cpu_usageHandle = CPU_USAGE_init(&cpu_usage,sizeof(cpu_usage));
286  CPU_USAGE_setParams(cpu_usageHandle,
287  (uint32_t)USER_SYSTEM_FREQ_MHz * 1000000, // timer period, cnts
288  (uint32_t)USER_ISR_FREQ_Hz); // average over 1 second of ISRs
289 
290 
291  // setup faults
292  HAL_setupFaults(halHandle);
293 
294 
295  // initialize the interrupt vector table
296  HAL_initIntVectorTable(halHandle);
297 
298 
299  // enable the ADC interrupts
300  HAL_enableAdcInts(halHandle);
301 
302 
303  // enable global interrupts
304  HAL_enableGlobalInts(halHandle);
305 
306 
307  // enable debug interrupts
308  HAL_enableDebugInt(halHandle);
309 
310 
311  // disable the PWM
312  HAL_disablePwm(halHandle);
313 
314 
315 #ifdef DRV8301_SPI
316  // turn on the DRV8301 if present
317  HAL_enableDrv(halHandle);
318  // initialize the DRV8301 interface
319  HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars);
320 #endif
321 
322 
323  // Waiting for enable system flag to be set
324  while(!gFlag_enableSys)
325  {
327  }
328 
329 
330  // loop while the enable system flag is true
331  while(gFlag_enableSys)
332  {
333 
334  // increment counters
335  gCounter_main++;
336 
337  // enable or disable bypassLockRotor flag
338  if(gUserParams.motor_type == MOTOR_Type_Induction)
339  {
341  }
342 
344  {
345  // set custom speed controller gains
346  CTRL_setGains(ctrlHandle,CTRL_Type_PI_spd,gSpeed_Kp,gSpeed_Ki);
347 
348  // enable or disable force angle
350 
351  // enable or disable PowerWarp
352  if(gUserParams.motor_type == MOTOR_Type_Induction)
353  {
355  }
356 
357  // enable or disable RsOnLine
359 
360  // set slow rotating frequency for RsOnLine
362 
363  // set current amplitude for RsOnLine
365 
366  // set RsOnLine beta based on the desired filter pole
368 
369  // enable or disable Rs recalibration
371 
372  // set flag that updates Rs from RsOnLine value
374 
375  // set maximum acceleration
377  }
378 
380  {
381  // disable the calibrator
382  CAL_disable(calHandle);
383 
384  // disable the controller
385  CTRL_disable(ctrlHandle);
386 
387  // disable the estimator
389 
390  // disable the trajectory generator
392 
393  // disable the PWM
394  HAL_disablePwm(halHandle);
395  }
396  else if(gFlag_runCal)
397  {
398  // enable the calibrator
399  CAL_setFlag_enableAdcOffset(calHandle,true);
400 
401  // enable the calibrator
402  CAL_enable(calHandle);
403 
404  // disable the controller
405  CTRL_disable(ctrlHandle);
406 
407  // disable the estimator
409 
410  // disable the trajectory generator
412 
413  // enable the PWM
414  HAL_enablePwm(halHandle);
415  }
416  else if(gFlag_runIdentAndOnLine)
417  {
418  // disable the calibrator
419  CAL_disable(calHandle);
420 
421  // enable the controller
422  CTRL_enable(ctrlHandle);
423 
424  // enable the estimator
426 
427  // enable the trajectory generator
429 
430  // enable the PWM
431  HAL_enablePwm(halHandle);
432  }
433 
434 
435  // check the calibrator
436  if(CAL_isError(calHandle))
437  {
438  // disable the PWM
439  HAL_disablePwm(halHandle);
440 
441  // set the enable system flag to false
442  gFlag_enableSys = false;
443  }
444  else
445  {
446  // update the calibrator state
447  bool flag_calStateChanged = CAL_updateState(calHandle);
448 
449  if(flag_calStateChanged)
450  {
451  CAL_State_e calState = CAL_getState(calHandle);
452 
453  if(calState == CAL_State_Done)
454  {
455  // update the ADC bias values
456  HAL_updateAdcBias(halHandle,
457  CAL_getOffsetHandleAddr_I(calHandle),
458  CAL_getOffsetHandleAddr_V(calHandle));
459 
460  // clear the flag
461  gFlag_runCal = false;
462  }
463  }
464  }
465 
466 
467  // check the trajectory generator
469  {
470  // disable the PWM
471  HAL_disablePwm(halHandle);
472 
473  // set the enable system flag to false
474  gFlag_enableSys = false;
475  }
476  else
477  {
478  // update the trajectory generator state
479  bool flag_trajStateChanged = EST_updateTrajState(estHandle);
480 
481  if(flag_trajStateChanged)
482  {
484 
486  (state == EST_Traj_State_OnLine))
487  {
488  float_t spd_min_Hz = -1000.0;
489  float_t spd_max_Hz = 1000.0;
490  float_t spd_maxDelta_Hz = gSpeed_ref_traj / (float_t)gUserParams.trajFreq_Hz; //20.0 / (float_t)gUserParams.trajFreq_Hz;
491 
492  // setup the spd trajectory
493  EST_setMinValue_spd_Hz(estHandle,spd_min_Hz);
494  EST_setMaxValue_spd_Hz(estHandle,spd_max_Hz);
495  EST_setMaxDelta_spd_Hz(estHandle,spd_maxDelta_Hz);
496  }
497  }
498  }
499 
500 
501  // check the estimator
503  {
504  // disable the PWM
505  HAL_disablePwm(halHandle);
506 
507  // set the enable system flag to false
508  gFlag_enableSys = false;
509  }
510  else
511  {
512  // update the estimator state
513  float_t Id_target_A = EST_getIntValue_Id_A(estHandle);
514  bool flag_estStateChanged = EST_updateState(estHandle,Id_target_A);
515 
516  if(flag_estStateChanged)
517  {
518  // configure the controller
519  EST_configureCtrl(estHandle,ctrlHandle);
520 
521  // configure the trajectory generator
523 
524  if(EST_isLockRotor(estHandle) ||
526  {
527  // clear the flag
528  gFlag_runIdentAndOnLine = false;
529 
530  // clear RsOnLine enable flag
531  gFlag_enableRsOnLine = false;
532 
533  // clear PowerWarp enable flag
534  gFlag_enablePowerWarp = false;
535 
536  // clear Rs update flag
537  gFlag_updateRs = false;
538 
539  // reset the Id trajectory target value
540  gId_trajTarget_A = 0.0;
541  }
542  else if(EST_isOnLine(estHandle))
543  {
544  if(gUserParams.motor_type == MOTOR_Type_Induction)
545  {
546  // set the Id trajectory target value
548  }
549  }
550  }
551  }
552 
553 
554  // check the controller
555  if(CTRL_isError(ctrlHandle))
556  {
557  // disable the PWM
558  HAL_disablePwm(halHandle);
559 
560  // set the enable system flag to false
561  gFlag_enableSys = false;
562  }
563 
564 
565 #ifdef ENABLE_QUEUE
566  // check the queue
567  while(QUEUE_isEvent(queueHandle))
568  {
569  // execute event
570  QUEUE_executeEvent(queueHandle);
571  }
572 #endif
573 
574 
575  // update the global variables
577 
578  // update CPU usage
579  updateCPUusage(ctrlHandle);
580 
581 #ifdef DRV8301_SPI
582  HAL_writeDrvData(halHandle,&gDrvSpi8301Vars);
583 
584  HAL_readDrvData(halHandle,&gDrvSpi8301Vars);
585 #endif
586 
587  } // end of while() loop
588 
589 
590  // disable the PWM
591  HAL_disablePwm(halHandle);
592 
593 } // end of main() function
594 
595 
597 {
598  float_t Ls_d_H = EST_getLs_d_H(estHandle);
599  float_t Ls_q_H = EST_getLs_q_H(estHandle);
600  float_t Rs_Ohm = EST_getRs_Ohm(estHandle);
601  float_t RoverLd_rps = Rs_Ohm / Ls_d_H;
602  float_t RoverLq_rps = Rs_Ohm / Ls_q_H;
603  float_t BWc_rps = CTRL_getBWc_rps(handle);
604 
605  float_t currentCtrlPeriod_sec = CTRL_getCurrentCtrlPeriod_sec(handle);
606  float_t Kp_Id = Ls_d_H * BWc_rps;
607  float_t Ki_Id = RoverLd_rps * currentCtrlPeriod_sec;
608 
609  float_t Kp_Iq = Ls_q_H * BWc_rps;
610  float_t Ki_Iq = RoverLq_rps * currentCtrlPeriod_sec;
611 
612 
613  // set the Id controller gains
614  CTRL_setGains(handle,CTRL_Type_PI_Id,Kp_Id,Ki_Id);
615 
616  // set the Iq controller gains
617  CTRL_setGains(handle,CTRL_Type_PI_Iq,Kp_Iq,Ki_Iq);
618 
619  return;
620 } // end of calcGains() function
621 
622 
623 interrupt void mainISR(void)
624 {
625  uint32_t timer1Cnt;
626  MATH_vec2 Iab_in_A;
627  MATH_vec2 Vab_in_V;
628 
629 
630  // read the timer 1 value and update the CPU usage module
631  timer1Cnt = HAL_readTimerCnt(halHandle,1);
632  CPU_USAGE_updateCnts(cpu_usageHandle,timer1Cnt);
633 
634 
635  // turn LED 3 on
636  HAL_turnLedOn(halHandle,(GPIO_Number_e)HAL_Gpio_LED3);
637 
638 
639  // acknowledge the ADC interrupt
640  HAL_acqAdcInt(halHandle,ADC_IntNumber_6);
641 
642 
643  // increment the ISR counter
644  incrCount_isr();
645 
646 
647  // increment the isr counters
648  CTRL_incrCounter_isr(ctrlHandle);
651 
652 
653  // convert the ADC data
654  HAL_readAdcData(halHandle,&gAdcData);
655 
656 
657  // run Clarke transform on current
658  CLARKE_run(clarkeHandle_I,&gAdcData.I_A,&Iab_in_A);
659 
660 
661  // run Clarke transform on voltage
662  CLARKE_run(clarkeHandle_V,&gAdcData.V_V,&Vab_in_V);
663 
664 
665  // if enabled, run the calibrator
666  if(CAL_isEnabled(calHandle))
667  {
668  // run the calibrator
669  CAL_run(calHandle,&gAdcData);
670  }
671 
672 
673  // if enabled, run the trajectory generator
675  {
676  int_least16_t count_traj = EST_getTrajCount_isr(estHandle);
677  int_least16_t numIsrTicksPerTrajTick = EST_getNumIsrTicksPerTrajTick(estHandle);
678 
679 
680  // as needed, run the trajectory generator
681  if(count_traj >= numIsrTicksPerTrajTick)
682  {
683  // reset the trajectory count
685 
686  // setup the trajectory generator
688  ctrlHandle,
691 
692  // run the trajectories
694  } // end of if(gFlag_traj) block
695  }
696 
697 
698  // if enabled, run the estimator
700  {
701  int_least16_t count_est = EST_getCount_isr(estHandle);
702  int_least16_t numIsrTicksPerEstTick = EST_getNumIsrTicksPerEstTick(estHandle);
703 
704 
705  // as needed, run the estimator
706  if(count_est >= numIsrTicksPerEstTick)
707  {
708  // reset the estimator count
710 
711  // store the input data into a buffer
712  gEstInputData[gBufferIndex_est].timeStamp = gCounter_isr;
713  gEstInputData[gBufferIndex_est].Iab_A.value[0] = Iab_in_A.value[0];
714  gEstInputData[gBufferIndex_est].Iab_A.value[1] = Iab_in_A.value[1];
715  gEstInputData[gBufferIndex_est].Vab_V.value[0] = Vab_in_V.value[0];
716  gEstInputData[gBufferIndex_est].Vab_V.value[1] = Vab_in_V.value[1];
717  gEstInputData[gBufferIndex_est].dcBus_V = gAdcData.dcBus_V;
719 
720 #ifdef ENABLE_QUEUE
721  {
722  EVENT_ArgList argList;
723 
724  // post the estimator to the queue
725  argList.arg[0] = estHandle;
726  argList.arg[1] = &gEstInputData[gBufferIndex_est];
727  argList.arg[2] = &gEstOutputData[gBufferIndex_est];
728  argList.arg[3] = NULL;
729  QUEUE_postEventLast(queueHandle,(EVENT_Fxn)EST_run,&argList,3);
730  }
731 #else
732  {
733  // run the estimator
735  &gEstInputData[gBufferIndex_est],
736  &gEstOutputData[gBufferIndex_est]);
737  }
738 #endif
739 
740  // increment the estimator buffer index
742  }
743 
744 
745  // setup the angle module
747  {
748  ANGLE_setup(angleHandle,
749  gEstOutputData[gBufferIndex_setup].timeStamp,
750  gEstOutputData[gBufferIndex_setup].angle_rad,
751  gEstOutputData[gBufferIndex_setup].fm_lp_rps,
752  gEstOutputData[gBufferIndex_setup].fmDot_rps2);
753 
754  // increment the estimator buffer index
756 
757  // clear the flag
759  }
760  }
761  else
762  {
763  // reset the angle module but keep the angle fixed
764  ANGLE_setup(angleHandle,
765  gCounter_isr,
766  gEstOutputData[gBufferIndex_setup].angle_rad,
767  (float_t)0.0, // speed_rps
768  (float_t)0.0); // accel_rps2
769  }
770 
771 
772  // run the angle module
773  ANGLE_run(angleHandle,gCounter_isr);
774 
775 
776  // if enabled, run the controller
777  if(CTRL_isEnabled(ctrlHandle))
778  {
779  int_least16_t count_ctrl = CTRL_getCount_isr(ctrlHandle);
780  int_least16_t numIsrTicksPerCtrlTick = CTRL_getNumIsrTicksPerCtrlTick(ctrlHandle);
781 
782 
783  // as needed, run the controller
784  if(count_ctrl >= numIsrTicksPerCtrlTick)
785  {
786  bool flag_doSpeedCtrl= EST_doSpeedCtrl(estHandle);
787  bool flag_doCurrentCtrl = EST_doCurrentCtrl(estHandle);
788  bool flag_useZeroIq_ref = false;
789  float_t oneOverDcBus_invV = EST_getOneOverDcBus_invV(estHandle);
790  float_t speed_ref_Hz = EST_getIntValue_spd_Hz(estHandle);
791  float_t speed_Hz = EST_getFm_lp_Hz(estHandle);
792  float_t angle_rad;
793  float_t angleWithDelay_rad;
794 
795  MATH_vec2 Idq_A;
796  MATH_vec2 Vdq_out_V;
797  MATH_vec2 Vab_out_V;
798  MATH_vec2 phasor;
799 
800  MATH_vec2 Idq_offset_A;
801  MATH_vec2 Vdq_offset_V;
802 
803 
804  // reset the isr count
805  CTRL_resetCounter_isr(ctrlHandle);
806 
807 
808  // get the angle for t = n+1
809  angle_rad = ANGLE_getAngle_rad(angleHandle);
810 
811 
812  // compute the sin/cos phasor
813  CTRL_computePhasor(angle_rad,&phasor);
814 
815 
816  // set the phasor in the Park transform
817  PARK_setPhasor(parkHandle,&phasor);
818 
819 
820  // run the Park transform
821  PARK_run(parkHandle,&Iab_in_A,&Idq_A);
822 
823 
824  // set the Idq offset values
825  Idq_offset_A.value[0] = EST_getIntValue_Id_A(estHandle);
826  Idq_offset_A.value[1] = EST_getIntValue_Iq_A(estHandle);
827 
828 
829  // update Id reference for Rs OnLine
830  EST_updateId_ref_A(estHandle,&Idq_offset_A.value[0]);
831 
832 
833  // set the Vdq offset values
834  Vdq_offset_V.value[0] = 0.0;
835  Vdq_offset_V.value[1] = 0.0;
836 
837 
838  // setup the controller
839  CTRL_setup(ctrlHandle,
840  speed_ref_Hz,
841  speed_Hz,
842  &Idq_A,
843  &Idq_offset_A,
844  &Vdq_offset_V,
845  flag_doSpeedCtrl,
846  flag_doCurrentCtrl,
847  flag_useZeroIq_ref);
848 
849 
850  // run the controller
851  CTRL_run(ctrlHandle,&Vdq_out_V);
852 
853 
854  // store the Idq reference values used by the controller
856 
857 
858  // get the angle estimate for time t = n+1+delay
859  angleWithDelay_rad = ANGLE_getAngleWithDelay_rad(angleHandle);
860 
861 
862  // compute the sin/cos phasor
863  CTRL_computePhasor(angleWithDelay_rad,&phasor);
864 
865 
866  // set the phasor in the inverse Park transform
867  IPARK_setPhasor(iparkHandle,&phasor);
868 
869 
870  // run the inverse Park module
871  IPARK_run(iparkHandle,&Vdq_out_V,&Vab_out_V);
872 
873 
874  // setup the space vector generator (SVGEN) module
875  SVGEN_setup(svgenHandle,oneOverDcBus_invV);
876 
877 
878  // run the space vector generator (SVGEN) module
879  SVGEN_run(svgenHandle,&Vab_out_V,&(gPwmData.Vabc_pu));
880 
881  }
882  }
883  else
884  {
885  // create PWM data
886  gPwmData.Vabc_pu.value[0] = 0.0;
887  gPwmData.Vabc_pu.value[1] = 0.0;
888  gPwmData.Vabc_pu.value[2] = 0.0;
889  }
890 
891 
892  // write the PWM compare values
893  HAL_writePwmData(halHandle,&gPwmData);
894 
895 
896  // write the DAC data
897  HAL_writeDacData(halHandle,&gDacData);
898 
899 
900  // turn LED 3 off
901  HAL_turnLedOff(halHandle,(GPIO_Number_e)HAL_Gpio_LED3);
902 
903 
904  // read the timer 1 value and update the CPU usage module
905  timer1Cnt = HAL_readTimerCnt(halHandle,1);
906  CPU_USAGE_updateCnts(cpu_usageHandle,timer1Cnt);
907 
908 
909  // run the CPU usage module
910  CPU_USAGE_run(cpu_usageHandle);
911 
912 
913  return;
914 } // end of mainISR() function
915 
916 
917 void setupClarke_I(CLARKE_Handle handle,const uint_least8_t numCurrentSensors)
918 {
919  float_t alpha_sf,beta_sf;
920 
921 
922  // initialize the Clarke transform module for current
923  if(numCurrentSensors == 3)
924  {
925  alpha_sf = MATH_ONE_OVER_THREE;
926  beta_sf = MATH_ONE_OVER_SQRT_THREE;
927  }
928  else if(numCurrentSensors == 2)
929  {
930  alpha_sf = 1.0;
931  beta_sf = MATH_ONE_OVER_SQRT_THREE;
932  }
933  else
934  {
935  alpha_sf = 0.0;
936  beta_sf = 0.0;
937  }
938 
939  // set the parameters
940  CLARKE_setScaleFactors(handle,alpha_sf,beta_sf);
941  CLARKE_setNumSensors(handle,numCurrentSensors);
942 
943  return;
944 } // end of setupClarke_I() function
945 
946 
947 void setupClarke_V(CLARKE_Handle handle,const uint_least8_t numVoltageSensors)
948 {
949  float_t alpha_sf,beta_sf;
950 
951 
952  // initialize the Clarke transform module for voltage
953  if(numVoltageSensors == 3)
954  {
955  alpha_sf = MATH_ONE_OVER_THREE;
956  beta_sf = MATH_ONE_OVER_SQRT_THREE;
957  }
958  else
959  {
960  alpha_sf = 0.0;
961  beta_sf = 0.0;
962  }
963 
964  // set the parameters
965  CLARKE_setScaleFactors(handle,alpha_sf,beta_sf);
966  CLARKE_setNumSensors(handle,numVoltageSensors);
967 
968  return;
969 } // end of setupClarke_V() function
970 
971 
973 {
974  float_t IdRated_indEst_A = EST_getIdRated_indEst_A(estHandle);
975 
976  // get the states
977  gCalState = CAL_getState(calHandle);
978  gCtrlState = CTRL_getState(ctrlHandle);
979  gEstState = EST_getState(estHandle);
980  gTrajState = EST_getTrajState(estHandle);
981 
982  // get R/L
983  gRoverL_rps = EST_getRoverL_rps(estHandle);
984 
985  // get the speed estimate
986  gSpeed_Hz = EST_getFe_Hz(estHandle);
987 
988  // get the torque estimate
989  gTorque_Nm = EST_computeTorque_Nm(estHandle);
990 
991  // get the stator resistance estimate from RsOnLine
992  gRsOnLine_Ohm = EST_getRsOnLine_Ohm(estHandle);
993 
994  // get the alpha stator resistance
995  gRs_a_Ohm = EST_getRs_a_Ohm(estHandle);
996 
997  // get the beta stator resistance
998  gRs_b_Ohm = EST_getRs_b_Ohm(estHandle);
999 
1000  // get the direct stator resistance
1001  gRs_d_Ohm = EST_getRs_d_Ohm(estHandle);
1002 
1003  // get the quadrature stator resistance
1004  gRs_q_Ohm = EST_getRs_q_Ohm(estHandle);
1005 
1006  // get the direct rotor resistance
1007  gRr_d_Ohm = EST_getRr_d_Ohm(estHandle);
1008 
1009  // get the quadrature rotor resistance
1010  gRr_q_Ohm = EST_getRr_q_Ohm(estHandle);
1011 
1012  // get the stator inductance in the direct coordinate direction
1013  gLs_d_H = EST_getLs_d_H(estHandle);
1014 
1015  // get the stator inductance in the quadrature coordinate direction
1016  gLs_q_H = EST_getLs_q_H(estHandle);
1017 
1018  // get the magnetizing inductance
1019  gLmag_H = EST_computeLmag_H(estHandle,IdRated_indEst_A);
1020 
1021  // get the IdRated value
1022  gIdRated_A = EST_getIdRated_A(estHandle);
1023 
1024  // get the flux, Wb
1025  gFlux_Wb = EST_getFlux_Wb(estHandle);
1026 
1027  return;
1028 } // end of updateGlobalVariables_motor() function
1029 
1030 
1032 {
1033  uint32_t minDeltaCntObserved = CPU_USAGE_getMinDeltaCntObserved(cpu_usageHandle);
1034  uint32_t avgDeltaCntObserved = CPU_USAGE_getAvgDeltaCntObserved(cpu_usageHandle);
1035  uint32_t maxDeltaCntObserved = CPU_USAGE_getMaxDeltaCntObserved(cpu_usageHandle);
1036  uint16_t pwmPeriod = HAL_readPwmPeriod(halHandle,PWM_Number_1);
1037  float_t cpu_usage_den = (float_t)pwmPeriod * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK * 2.0;
1038 
1039  // calculate the minimum cpu usage percentage
1040  gCpuUsagePercentageMin = (float_t)minDeltaCntObserved / cpu_usage_den * 100.0;
1041 
1042  // calculate the average cpu usage percentage
1043  gCpuUsagePercentageAvg = (float_t)avgDeltaCntObserved / cpu_usage_den * 100.0;
1044 
1045  // calculate the maximum cpu usage percentage
1046  gCpuUsagePercentageMax = (float_t)maxDeltaCntObserved / cpu_usage_den * 100.0;
1047 
1048  return;
1049 } // end of updateCPUusage() function
1050 
1051 
1052 // end of file
1053 
1054 
1055 
#define USER_SYSTEM_FREQ_MHz
CLOCKS & TIMERS.
Definition: user.h:140
bool EST_isError(EST_Handle handle)
float_t EST_getRsOnLine_Ohm(EST_Handle handle)
void EST_enableTraj(EST_Handle handle)
void ANGLE_setup(ANGLE_Handle handle, const int_least32_t timeStamp, const float_t angle_rad, const float_t speed_rps, const float_t accel_rps2)
EST_State_e gEstState
Global variable for the estimator state.
Definition: proj_fast.c:49
float_t angleDelayed_sf_sec
void EST_setFlag_enableForceAngle(EST_Handle handle, const bool state)
ANGLE_Obj angle
the angle object
Definition: proj_fast.c:138
static void CAL_enable(CAL_Handle handle)
IPARK_Handle IPARK_init(void *pMemory, const size_t numBytes)
void EST_resetTrajCounter_isr(EST_Handle handle)
void CTRL_incrCounter_isr(CTRL_Handle handle)
void HAL_enableGlobalInts(HAL_Handle handle)
void HAL_enableAdcInts(HAL_Handle handle)
bool EST_getFlag_estComplete(EST_Handle handle)
float_t EST_getFlux_Wb(EST_Handle handle)
static float_t CTRL_getCurrentCtrlPeriod_sec(CTRL_Handle handle)
void EST_incrTrajCounter_isr(EST_Handle handle)
void EST_setRsOnLineId_mag_A(EST_Handle handle, const float_t Id_mag_A)
void CTRL_run(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
volatile bool gFlag_enableRsRecalc
Definition: proj_fast.c:67
MATH_vec3 Vabc_pu
void calcGains(CTRL_Handle handle, EST_Handle estHandle)
Calculates controller gains.
Definition: proj_fast.c:596
float_t EST_getRr_q_Ohm(EST_Handle handle)
static void CAL_run(CAL_Handle handle, const HAL_AdcData_t *pAdcData)
CLARKE_Handle clarkeHandle_V
the handle for the voltage Clarke transform
Definition: proj_fast.c:146
float_t EST_getOneOverDcBus_invV(EST_Handle handle)
float_t gLs_d_H
Global variable for the stator inductance in the direct coordinate direction, Henry.
Definition: proj_fast.c:81
EST_InputData_t gEstInputData[NUM_EST_DATA_BUFFERS]
Definition: proj_fast.c:119
static void PARK_setPhasor(PARK_Handle handle, const MATH_vec2 *pPhasor)
QUEUE_Handle QUEUE_init(void *pMemory, const size_t numBytes)
float_t gRs_b_Ohm
Global variable for the stator resistance in the beta coordinate direction, Ohm.
Definition: proj_fast.c:93
int_least32_t timeStamp
IPARK_Handle iparkHandle
the handle for the inverse Park transform
Definition: proj_fast.c:157
float_t EST_getRoverL_rps(EST_Handle handle)
float_t gIdRated_A
Global variable for the rated Id current current, A.
Definition: proj_fast.c:79
volatile bool gFlag_runIdentAndOnLine
Definition: proj_fast.c:59
void ANGLE_run(ANGLE_Handle handle, const int_least32_t timeStamp)
float_t gRoverL_rps
Global variable for the R/L value used for the current controller.
Definition: proj_fast.c:87
float_t EST_getIntValue_Iq_A(EST_Handle handle)
#define USER_EST_FREQ_Hz
Defines the estimator frequency, Hz.
Definition: user.h:219
int_least16_t EST_getCount_isr(EST_Handle handle)
static void HAL_writePwmData(HAL_Handle handle, HAL_PwmData_t *pPwmData)
void EST_setMinValue_spd_Hz(EST_Handle handle, const float_t minValue_Hz)
bool EST_isOnLine(EST_Handle handle)
#define MATH_TWO_PI
static float_t CTRL_getBWc_rps(CTRL_Handle handle)
_iq value[3]
float_t ctrlPeriod_sec
struct _EST_Obj_ * EST_Handle
void HAL_writeDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
bool CTRL_isError(CTRL_Handle handle)
CTRL_Obj ctrl[CTRL_NUM_CONTROLLERS]
the controller object
Definition: proj_fast.c:150
uint_least16_t CTRL_getNumIsrTicksPerCtrlTick(CTRL_Handle handle)
void EST_incrCounter_isr(EST_Handle handle)
PARK_Handle parkHandle
the handle for the Park object
Definition: proj_fast.c:160
float_t gRs_d_Ohm
Global variable for the stator resistance in the direct coordinate direction, Ohm.
Definition: proj_fast.c:95
static void HAL_acqAdcInt(HAL_Handle handle, const ADC_IntNumber_e intNumber)
float_t EST_getRr_d_Ohm(EST_Handle handle)
void * arg[EVENT_MAX_NUM_ARGS]
volatile float_t gSpeed_Kp
Definition: proj_fast.c:109
static void CAL_setFlag_enableAdcOffset(CAL_Handle handle, const bool value)
uint_least8_t numCurrentSensors
bool EST_isEnabled(EST_Handle handle)
float_t gMaxCurrentSlope
Definition: proj_fast.c:129
volatile bool gFlag_bypassLockRotor
Definition: proj_fast.c:53
void EST_setupTraj(EST_Handle handle, CTRL_Handle ctrlHandle, const float_t targetValue_spd_Hz, const float_t targetValue_Id_A)
void EST_setMaxDelta_spd_Hz(EST_Handle handle, const float_t maxDelta_Hz)
void CAL_setParams(CAL_Handle handle, const USER_Params *pUserParams)
void EST_setParams(EST_Handle handle, USER_Params *pUserParams)
static void SVGEN_run(SVGEN_Handle handle, const MATH_vec2 *pVab, MATH_vec3 *pT)
volatile float_t gSpeed_Ki
Definition: proj_fast.c:111
static uint32_t CPU_USAGE_getAvgDeltaCntObserved(CPU_USAGE_Handle handle)
static MATH_vec2 * CTRL_getIdq_ref_A_addr(CTRL_Handle handle)
static status QUEUE_postEventLast(QUEUE_Handle handle, const EVENT_Fxn eventFxn, const EVENT_ArgList *pArgList, const uint_least8_t numArgs)
void EST_configureTraj(EST_Handle handle)
#define MATH_ONE_OVER_THREE
QUEUE_Handle queueHandle
the handle for the queue
Definition: proj_fast.c:163
volatile bool gFlag_runCal
Definition: proj_fast.c:57
void USER_setParams(USER_Params *pUserParams)
Sets the user parameter values.
uint_least16_t CTRL_getCount_isr(CTRL_Handle handle)
void setupClarke_V(CLARKE_Handle handle, const uint_least8_t numVoltageSensors)
Sets the number of voltage sensors.
Definition: proj_fast.c:947
void EST_setFlag_updateRs(EST_Handle handle, const bool state)
float_t EST_computeTorque_Nm(EST_Handle handle)
bool EST_isTrajEnabled(EST_Handle handle)
void CTRL_setGains(CTRL_Handle handle, const CTRL_Type_e ctrlType, const _iq Kp, const _iq Ki, const _iq Kd)
float_t speed_ref_Hz
float_t EST_getIntValue_Id_A(EST_Handle handle)
static void CLARKE_setScaleFactors(CLARKE_Handle handle, const _iq alpha_sf, const _iq beta_sf)
float_t EST_getFm_lp_Hz(EST_Handle handle)
PARK_Obj park
the Park transform object
Definition: proj_fast.c:161
CAL_State_e
void EST_enable(EST_Handle handle)
CTRL_Handle CTRL_init(void *pMemory, const size_t numBytes)
float_t gSpeed_Hz
Definition: proj_fast.c:103
static void incrCount_isr(void)
Increments the ISR counter.
Definition: float/main.h:214
void HAL_setupFaults(HAL_Handle handle)
float_t EST_getLs_d_H(EST_Handle handle)
void EST_setFlag_enableRsRecalc(EST_Handle handle, const bool state)
volatile bool gFlag_enableRsOnLine
Definition: proj_fast.c:65
USER_Params gUserParams
The user parameters.
Definition: proj_fast.c:135
void updateCPUusage(CTRL_Handle handle)
Updates CPU usage.
Definition: proj_fast.c:1031
static void incrBufferIndex_est(void)
Increments the estimation buffer index.
Definition: float/main.h:232
static void HAL_enablePwm(HAL_Handle handle)
void EST_configureCtrl(EST_Handle handle, CTRL_Handle ctrlHandle)
CTRL_Version gVersion
Global variable for the controller version.
Definition: proj_fast.c:133
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
void EST_setFlag_enablePowerWarp(EST_Handle handle, const bool state)
MOTOR_Type_e motor_type
EST_OutputData_t gEstOutputData[NUM_EST_DATA_BUFFERS]
Definition: proj_fast.c:121
EST_State_e
CLARKE_Obj clarke_I
the current Clarke transform object
Definition: proj_fast.c:144
int_least32_t gCounter_isr
A counter that is incremented by each call to the mainISR() function.
Definition: proj_fast.c:41
void HAL_enableDrv(HAL_Handle handle)
void CTRL_resetCounter_isr(CTRL_Handle handle)
_iq value[2]
bool EST_doSpeedCtrl(EST_Handle handle)
volatile bool gFlag_enablePowerWarp
Definition: proj_fast.c:63
EST_Handle EST_initEst(const uint_least8_t estNumber)
IPARK_Obj ipark
the inverse Park transform object
Definition: proj_fast.c:158
float_t gCpuUsagePercentageMax
Definition: proj_fast.c:180
ANGLE_Handle ANGLE_init(void *pMemory, const size_t numBytes)
uint_least32_t trajFreq_Hz
float_t EST_getIdRated_A(EST_Handle handle)
void HAL_setupDrvSpi(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
uint_least8_t numVoltageSensors
float_t EST_getLs_q_H(EST_Handle handle)
EST_Traj_State_e
void HAL_enableDebugInt(HAL_Handle handle)
CLARKE_Handle CLARKE_init(void *pMemory, const size_t numBytes)
int_least32_t gCounter_main
A counter that is incremented by each iteration of the main() function.
Definition: proj_fast.c:43
void EST_disableTraj(EST_Handle handle)
CTRL_State_e CTRL_getState(CTRL_Handle handle)
uint_least16_t gBufferIndex_setup
A counter that to denote the buffer index for the setup.
Definition: proj_fast.c:73
static void IPARK_run(IPARK_Handle handle, const MATH_vec2 *pInVec, MATH_vec2 *pOutVec)
float_t EST_getRs_b_Ohm(EST_Handle handle)
EST_State_e EST_getState(EST_Handle handle)
static void CAL_disable(CAL_Handle handle)
void setupClarke_I(CLARKE_Handle handle, const uint_least8_t numCurrentSensors)
Sets the number of current sensors.
Definition: proj_fast.c:917
volatile bool gFlag_enableForceAngle
Definition: proj_fast.c:61
void EST_updateId_ref_A(EST_Handle handle, float_t *pId_ref_A)
void CTRL_setup(CTRL_Handle handle)
void EST_setFlag_estComplete(EST_Handle handle, const bool state)
CLARKE_Obj clarke_V
the voltage Clarke transform object
Definition: proj_fast.c:147
HAL_DacData_t gDacData
Defines the DAC data.
Definition: proj_fast.c:115
CTRL_State_e
float_t gLs_q_H
Global variable for the stator inductance in the quadrature coordinate direction, Henry...
Definition: proj_fast.c:83
float_t gRs_a_Ohm
Global variable for the stator resistance in the alpha coordinate direction, Ohm. ...
Definition: proj_fast.c:91
float_t EST_getRs_a_Ohm(EST_Handle handle)
static bool CTRL_isEnabled(CTRL_Handle handle)
void EST_setFlag_enableRsOnLine(EST_Handle handle, const bool state)
interrupt void mainISR(void)
The main interrupt service (ISR) routine.
Definition: proj_fast.c:623
int_least16_t EST_getNumIsrTicksPerEstTick(EST_Handle handle)
float_t gId_trajTarget_A
Definition: proj_fast.c:77
static OFFSET_Handle * CAL_getOffsetHandleAddr_I(CAL_Handle handle)
static uint32_t HAL_readTimerCnt(HAL_Handle handle, const uint_least8_t timerNumber)
void EST_setIdq_ref_A(EST_Handle handle, const MATH_vec2 *pIdq_ref_A)
static void CLARKE_setNumSensors(CLARKE_Handle handle, const uint_least8_t numSensors)
float_t EST_getRs_Ohm(EST_Handle handle)
float_t EST_computeLmag_H(EST_Handle handle, const float_t current_A)
float_t gRr_d_Ohm
Global variable for the rotor resistance in the direct coordinate direction, Ohm. ...
Definition: proj_fast.c:99
void EST_setMaxValue_spd_Hz(EST_Handle handle, const float_t maxValue_Hz)
CPU_USAGE_Handle cpu_usageHandle
Definition: proj_fast.c:176
bool EST_doCurrentCtrl(EST_Handle handle)
float_t EST_getRs_q_Ohm(EST_Handle handle)
void updateGlobalVariables_motor(CTRL_Handle ctrlHandle, EST_Handle estHandle)
Updates the global motor variables.
Definition: proj_fast.c:972
void ANGLE_setParams(ANGLE_Handle handle, const float_t timeStampPeriod_sec, const float_t angleDelayed_sf_sec)
void CPU_USAGE_setParams(CPU_USAGE_Handle handle, const uint32_t timerPeriod_cnts, const uint32_t numDeltaCntsAvg)
void EST_runTraj(EST_Handle handle)
static bool CAL_isError(CAL_Handle handle)
#define USER_ISR_FREQ_Hz
Defines the Interrupt Service Routine (ISR) frequency, Hz.
Definition: user.h:173
static void IPARK_setPhasor(IPARK_Handle handle, const MATH_vec2 *pPhasor)
CPU_USAGE_Handle CPU_USAGE_init(void *pMemory, const size_t numBytes)
float_t gRs_q_Ohm
Global variable for the stator resistance in the quadrature coordinate direction, Ohm...
Definition: proj_fast.c:97
static void HAL_disablePwm(HAL_Handle handle)
void main(void)
Definition: proj_fast.c:186
void EST_setRsOnLineAngleDelta_rad(EST_Handle handle, const float_t angleDelta_rad)
float_t gCpuUsagePercentageAvg
Definition: proj_fast.c:179
bool EST_isMotorIdentified(EST_Handle handle)
CAL_Handle calHandle
the handle for the calibrator
Definition: proj_fast.c:140
CLARKE_Handle clarkeHandle_I
the handle for the current Clarke transform
Definition: proj_fast.c:143
float_t gSpeed_ref_Hz
Definition: proj_fast.c:105
float_t EST_getRs_d_Ohm(EST_Handle handle)
HAL_Handle HAL_init(void *pMemory, const size_t numBytes)
bool EST_isLockRotor(EST_Handle handle)
float_t gRsOnLine_Ohm
Definition: proj_fast.c:89
static void CLARKE_run(CLARKE_Handle handle, const MATH_vec3 *pInVec, MATH_vec2 *pOutVec)
static uint32_t CPU_USAGE_getMaxDeltaCntObserved(CPU_USAGE_Handle handle)
HAL_Handle halHandle
the handle for the hardware abstraction layer
Definition: proj_fast.c:152
void EST_setRsOnLine_beta_rad(EST_Handle handle, const float_t beta_rad)
static void PARK_run(PARK_Handle handle, const MATH_vec2 *pInVec, MATH_vec2 *pOutVec)
volatile float_t gRsOnLineFreq_Hz
Definition: proj_fast.c:123
static CAL_State_e CAL_getState(CAL_Handle handle)
HAL_Obj hal
the hardware abstraction layer object
Definition: proj_fast.c:153
float_t gFlux_Wb
Global variable for the rotor flux estimate, Wb.
Definition: proj_fast.c:75
#define NUM_EST_DATA_BUFFERS
Defines the number of estimator data buffers NOTE: Must be a multiple of two.
Definition: float/main.h:43
volatile bool gFlag_updateRs
Definition: proj_fast.c:69
MATH_vec2 Iab_A
void(* EVENT_Fxn)()
SVGEN_Handle svgenHandle
the handle for the space vector generator
Definition: proj_fast.c:166
static void HAL_readAdcData(HAL_Handle handle, HAL_AdcData_t *pAdcData)
CAL_Handle CAL_init(void *pMemory, const size_t numBytes)
#define USER_TRAJ_FREQ_Hz
Defines the trajectory frequency, Hz.
Definition: user.h:223
void SVGEN_setup(SVGEN_Handle svgenHandle)
uint_least16_t gBufferIndex_est
A counter that to denote the buffer index for the estimation.
Definition: proj_fast.c:71
CTRL_Handle ctrlHandle
the handle for the controller
Definition: proj_fast.c:149
bool EST_isIdle(EST_Handle handle)
static void CPU_USAGE_updateCnts(CPU_USAGE_Handle handle, const uint32_t cnt)
volatile bool gFlag_enableSys
Global flag to enable/disable the system.
Definition: proj_fast.c:55
ANGLE_Handle angleHandle
the handle for the angle generator
Definition: proj_fast.c:137
SVGEN_Obj svgen
the space vector generator object
Definition: proj_fast.c:167
CPU_USAGE_Obj cpu_usage
Definition: proj_fast.c:177
MATH_vec2 Vab_V
static uint32_t CPU_USAGE_getMinDeltaCntObserved(CPU_USAGE_Handle handle)
#define MATH_ONE_OVER_SQRT_THREE
bool EST_isTrajError(EST_Handle handle)
EST_Handle estHandle
the handle for the estimator
Definition: proj_fast.c:155
EST_Traj_State_e gTrajState
Definition: proj_fast.c:51
EST_Traj_State_e EST_getTrajState(EST_Handle handle)
float_t gLmag_H
Global variable for the magnetizing inductance, Henry.
Definition: proj_fast.c:85
static void HAL_initIntVectorTable(HAL_Handle handle)
#define HAL_turnLedOff
static float_t ANGLE_getAngleWithDelay_rad(ANGLE_Handle handle)
volatile float_t gRsOnLinePole_Hz
Definition: proj_fast.c:127
static void QUEUE_executeEvent(QUEUE_Handle handle)
static void HAL_updateAdcBias(HAL_Handle handle)
PARK_Handle PARK_init(void *pMemory, const size_t numBytes)
float_t EST_getIdRated_indEst_A(EST_Handle handle)
void CTRL_getVersion(CTRL_Handle handle, CTRL_Version *pVersion)
volatile float_t gRsOnLineId_mag_A
Definition: proj_fast.c:125
static uint16_t HAL_readPwmPeriod(HAL_Handle handle, const PWM_Number_e pwmNumber)
HAL_PwmData_t gPwmData
Defines the PWM data.
Definition: proj_fast.c:117
static bool QUEUE_isEvent(QUEUE_Handle handle)
static void CTRL_enable(CTRL_Handle handle)
bool EST_updateState(EST_Handle handle, const _iq Id_target_pu)
static void CTRL_disable(CTRL_Handle handle)
void CTRL_computePhasor(const _iq angle_pu, MATH_vec2 *pPhasor)
#define CTRL_NUM_CONTROLLERS
#define HAL_turnLedOn
void EST_disable(EST_Handle handle)
void HAL_setParams(HAL_Handle handle, const USER_Params *pUserParams)
static void CPU_USAGE_run(CPU_USAGE_Handle handle)
bool CAL_updateState(CAL_Handle handle)
HAL_AdcData_t gAdcData
Defines the ADC data.
Definition: proj_fast.c:113
CTRL_State_e gCtrlState
Global variable for the controller state.
Definition: proj_fast.c:47
float_t EST_getFe_Hz(EST_Handle handle)
CAL_Obj cal
the calibrator object
Definition: proj_fast.c:141
void HAL_readDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
static bool CAL_isEnabled(CAL_Handle handle)
static float_t ANGLE_getAngle_rad(ANGLE_Handle handle)
float_t gTorque_Nm
Global variable for the estimated torque, N*m.
Definition: proj_fast.c:131
static void incrBufferIndex_setup(void)
Increments the setup buffer index.
Definition: float/main.h:243
float_t EST_getIntValue_spd_Hz(EST_Handle handle)
static void HAL_writeDacData(HAL_Handle handle, HAL_DacData_t *pDacData)
float_t gSpeed_ref_traj
Definition: proj_fast.c:107
float_t gRr_q_Ohm
Definition: proj_fast.c:101
void EST_resetCounter_isr(EST_Handle handle)
CAL_State_e gCalState
Definition: proj_fast.c:45
SVGEN_Handle SVGEN_init(void *pMemory, const size_t numBytes)
bool EST_updateTrajState(EST_Handle handle)
GPIO_Number_e
int_least32_t gCounter_enableSys
A counter that is incremented while waiting for the enable system flag to be set. ...
Definition: proj_fast.c:39
void EST_setFlag_bypassLockRotor(EST_Handle handle, const bool state)
float float_t
static OFFSET_Handle * CAL_getOffsetHandleAddr_V(CAL_Handle handle)
int_least16_t EST_getNumIsrTicksPerTrajTick(EST_Handle handle)
float_t gCpuUsagePercentageMin
Definition: proj_fast.c:178
void EST_run(EST_Handle handle, const MATH_vec2 *pIab_pu, const MATH_vec2 *pVab_pu, const _iq dcBus_pu, const _iq speed_ref_pu)
#define USER_NUM_PWM_TICKS_PER_ISR_TICK
DECIMATION.
Definition: user.h:184
int_least16_t EST_getTrajCount_isr(EST_Handle handle)
QUEUE_Obj queue
the queue object
Definition: proj_fast.c:164