instaspin_foc
proj_lab03c.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--*/
37 
39 
40 
45 
46 // **************************************************************************
47 // the includes
48 
49 // system includes
50 #include <math.h>
51 #include "main.h"
52 
53 #ifdef FLASH
54 #pragma CODE_SECTION(mainISR,"ramfuncs");
55 #endif
56 
57 // Include header files used in the main function
58 
59 
60 // **************************************************************************
61 // the defines
62 
63 #define LED_BLINK_FREQ_Hz 5
64 
65 
66 // **************************************************************************
67 // the globals
68 
69 uint_least16_t gCounter_updateGlobals = 0;
70 
72 
74 
76 
78 
79 HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)};
80 
82 
84 
85 #ifdef FAST_ROM_V1p6
87 #else
88 CTRL_Obj ctrl; //v1p7 format
89 #endif
90 
91 uint16_t gLEDcnt = 0;
92 
94 
95 #ifdef FLASH
96 // Used for running BackGround in flash, and ISR in RAM
97 extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;
98 #endif
99 
100 
101 #ifdef DRV8301_SPI
102 // Watch window interface to the 8301 SPI
103 DRV_SPI_8301_Vars_t gDrvSpi8301Vars;
104 #endif
105 
107 
109 
111 
113 
114 // **************************************************************************
115 // the functions
116 
117 void main(void)
118 {
119  uint_least8_t estNumber = 0;
120 
121 #ifdef FAST_ROM_V1p6
122  uint_least8_t ctrlNumber = 0;
123 #endif
124 
125  // Only used if running from FLASH
126  // Note that the variable FLASH is defined by the project
127  #ifdef FLASH
128  // Copy time critical code and Flash setup code to RAM
129  // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
130  // symbols are created by the linker. Refer to the linker files.
131  memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);
132  #endif
133 
134  // initialize the hardware abstraction layer
135  halHandle = HAL_init(&hal,sizeof(hal));
136 
137 
138  // check for errors in user parameters
139  USER_checkForErrors(&gUserParams);
140 
141 
142  // store user parameter error in global variable
143  gMotorVars.UserErrorCode = USER_getErrorCode(&gUserParams);
144 
145 
146  // do not allow code execution if there is a user parameter error
147  if(gMotorVars.UserErrorCode != USER_ErrorCode_NoError)
148  {
149  for(;;)
150  {
151  gMotorVars.Flag_enableSys = false;
152  }
153  }
154 
155 
156  // initialize the user parameters
157  USER_setParams(&gUserParams);
158 
159 
160  // set the hardware abstraction layer parameters
161  HAL_setParams(halHandle,&gUserParams);
162 
163 
164  // initialize the controller
165 #ifdef FAST_ROM_V1p6
166  ctrlHandle = CTRL_initCtrl(ctrlNumber, estNumber); //v1p6 format (06xF and 06xM devices)
167  controller_obj = (CTRL_Obj *)ctrlHandle;
168 #else
169  ctrlHandle = CTRL_initCtrl(estNumber,&ctrl,sizeof(ctrl)); //v1p7 format default
170 #endif
171 
172 
173  {
174  CTRL_Version version;
175 
176  // get the version number
177  CTRL_getVersion(ctrlHandle,&version);
178 
179  gMotorVars.CtrlVersion = version;
180  }
181 
182 
183  // set the default controller parameters
184  CTRL_setParams(ctrlHandle,&gUserParams);
185 
186 
187  // setup faults
188  HAL_setupFaults(halHandle);
189 
190 
191  // initialize the interrupt vector table
192  HAL_initIntVectorTable(halHandle);
193 
194 
195  // enable the ADC interrupts
196  HAL_enableAdcInts(halHandle);
197 
198 
199  // enable global interrupts
200  HAL_enableGlobalInts(halHandle);
201 
202 
203  // enable debug interrupts
204  HAL_enableDebugInt(halHandle);
205 
206 
207  // disable the PWM
208  HAL_disablePwm(halHandle);
209 
210 
211 #ifdef DRV8301_SPI
212  // turn on the DRV8301 if present
213  HAL_enableDrv(halHandle);
214  // initialize the DRV8301 interface
215  HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars);
216 #endif
217 
218 
219  // enable DC bus compensation
220  CTRL_setFlag_enableDcBusComp(ctrlHandle, true);
221 
222 
223  // compute scaling factors for flux and torque calculations
228 
229 
230  // disable offsets recalibration by default
231  gMotorVars.Flag_enableOffsetcalc = false;
232 
233 
234  for(;;)
235  {
236  // Waiting for enable system flag to be set
237  while(!(gMotorVars.Flag_enableSys));
238 
239  // loop while the enable system flag is true
240  while(gMotorVars.Flag_enableSys)
241  {
242  CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle;
243 
244  // increment counters
246 
247  // enable/disable the use of motor parameters being loaded from user.h
249 
250  // enable/disable Rs recalibration during motor startup
252 
253  // enable/disable automatic calculation of bias values
254  CTRL_setFlag_enableOffset(ctrlHandle,gMotorVars.Flag_enableOffsetcalc);
255 
256 
257  if(CTRL_isError(ctrlHandle))
258  {
259  // set the enable controller flag to false
260  CTRL_setFlag_enableCtrl(ctrlHandle,false);
261 
262  // set the enable system flag to false
263  gMotorVars.Flag_enableSys = false;
264 
265  // disable the PWM
266  HAL_disablePwm(halHandle);
267  }
268  else
269  {
270  // update the controller state
271  bool flag_ctrlStateChanged = CTRL_updateState(ctrlHandle);
272 
273  // enable or disable the control
274  CTRL_setFlag_enableCtrl(ctrlHandle, gMotorVars.Flag_Run_Identify);
275 
276  if(flag_ctrlStateChanged)
277  {
278  CTRL_State_e ctrlState = CTRL_getState(ctrlHandle);
279 
280  if(ctrlState == CTRL_State_OffLine)
281  {
282  // enable the PWM
283  HAL_enablePwm(halHandle);
284  }
285  else if(ctrlState == CTRL_State_OnLine)
286  {
287  if(gMotorVars.Flag_enableOffsetcalc == true)
288  {
289  // update the ADC bias values
290  HAL_updateAdcBias(halHandle);
291  }
292  else
293  {
294  // set the current bias
295  HAL_setBias(halHandle,HAL_SensorType_Current,0,_IQ(I_A_offset));
296  HAL_setBias(halHandle,HAL_SensorType_Current,1,_IQ(I_B_offset));
297  HAL_setBias(halHandle,HAL_SensorType_Current,2,_IQ(I_C_offset));
298 
299  // set the voltage bias
300  HAL_setBias(halHandle,HAL_SensorType_Voltage,0,_IQ(V_A_offset));
301  HAL_setBias(halHandle,HAL_SensorType_Voltage,1,_IQ(V_B_offset));
302  HAL_setBias(halHandle,HAL_SensorType_Voltage,2,_IQ(V_C_offset));
303  }
304 
305  // Return the bias value for currents
306  gMotorVars.I_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Current,0);
307  gMotorVars.I_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Current,1);
308  gMotorVars.I_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Current,2);
309 
310  // Return the bias value for voltages
311  gMotorVars.V_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Voltage,0);
312  gMotorVars.V_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Voltage,1);
313  gMotorVars.V_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Voltage,2);
314 
315  // enable the PWM
316  HAL_enablePwm(halHandle);
317  }
318  else if(ctrlState == CTRL_State_Idle)
319  {
320  // disable the PWM
321  HAL_disablePwm(halHandle);
322  gMotorVars.Flag_Run_Identify = false;
323  }
324 
325  if((CTRL_getFlag_enableUserMotorParams(ctrlHandle) == true) &&
326  (ctrlState > CTRL_State_Idle) &&
327  (gMotorVars.CtrlVersion.minor == 6))
328  {
329  // call this function to fix 1p6
330  USER_softwareUpdate1p6(ctrlHandle);
331  }
332 
333  }
334  }
335 
336 
338  {
339  // set the current ramp
341  gMotorVars.Flag_MotorIdentified = true;
342 
343  // set the speed reference
344  CTRL_setSpd_ref_krpm(ctrlHandle,gMotorVars.SpeedRef_krpm);
345 
346  // set the speed acceleration
348 
350  {
352 
353  USER_calcPIgains(ctrlHandle);
354  }
355 
356  }
357  else
358  {
360 
361  // the estimator sets the maximum current slope during identification
363  }
364 
365 
366  // when appropriate, update the global variables
368  {
369  // reset the counter
371 
372  updateGlobalVariables_motor(ctrlHandle);
373  }
374 
375  // enable/disable the forced angle
377 
378  // enable or disable power warp
379  CTRL_setFlag_enablePowerWarp(ctrlHandle,gMotorVars.Flag_enablePowerWarp);
380 
381 #ifdef DRV8301_SPI
382  HAL_writeDrvData(halHandle,&gDrvSpi8301Vars);
383 
384  HAL_readDrvData(halHandle,&gDrvSpi8301Vars);
385 #endif
386 
387  } // end of while(gFlag_enableSys) loop
388 
389 
390  // disable the PWM
391  HAL_disablePwm(halHandle);
392 
393  // set the default controller parameters (Reset the control to re-identify the motor)
394  CTRL_setParams(ctrlHandle,&gUserParams);
395  gMotorVars.Flag_Run_Identify = false;
396 
397  } // end of for(;;) loop
398 
399 } // end of main() function
400 
401 
402 interrupt void mainISR(void)
403 {
404  // toggle status LED
405  if(gLEDcnt++ > (uint_least32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))
406  {
407  HAL_toggleLed(halHandle,(GPIO_Number_e)HAL_Gpio_LED2);
408  gLEDcnt = 0;
409  }
410 
411 
412  // acknowledge the ADC interrupt
413  HAL_acqAdcInt(halHandle,ADC_IntNumber_1);
414 
415 
416  // convert the ADC data
417  HAL_readAdcData(halHandle,&gAdcData);
418 
419 
420  // run the controller
421  CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData);
422 
423 
424  // write the PWM compare values
425  HAL_writePwmData(halHandle,&gPwmData);
426 
427 
428  // setup the controller
429  CTRL_setup(ctrlHandle);
430 
431 
432  return;
433 } // end of mainISR() function
434 
435 
437 {
438  CTRL_Obj *obj = (CTRL_Obj *)handle;
439  int32_t tmp;
440 
441  // get the speed estimate
442  gMotorVars.Speed_krpm = EST_getSpeed_krpm(obj->estHandle);
443 
444  // get the real time speed reference coming out of the speed trajectory generator
446 
447  // get the torque estimate
449 
450  // when calling EST_ functions that return a float, and fpu32 is enabled, an integer is needed as a return
451  // so that the compiler reads the returned value from the accumulator instead of fpu32 registers
452  // get the magnetizing current
453  tmp = EST_getIdRated(obj->estHandle);
454  gMotorVars.MagnCurr_A = *((float_t *)&tmp);
455 
456  // get the rotor resistance
457  tmp = EST_getRr_Ohm(obj->estHandle);
458  gMotorVars.Rr_Ohm = *((float_t *)&tmp);
459 
460  // get the stator resistance
461  tmp = EST_getRs_Ohm(obj->estHandle);
462  gMotorVars.Rs_Ohm = *((float_t *)&tmp);
463 
464  // get the stator inductance in the direct coordinate direction
465  tmp = EST_getLs_d_H(obj->estHandle);
466  gMotorVars.Lsd_H = *((float_t *)&tmp);
467 
468  // get the stator inductance in the quadrature coordinate direction
469  tmp = EST_getLs_q_H(obj->estHandle);
470  gMotorVars.Lsq_H = *((float_t *)&tmp);
471 
472  // get the flux in V/Hz in floating point
473  tmp = EST_getFlux_VpHz(obj->estHandle);
474  gMotorVars.Flux_VpHz = *((float_t *)&tmp);
475 
476  // get the flux in Wb in fixed point
477  gMotorVars.Flux_Wb = USER_computeFlux(handle, gFlux_pu_to_Wb_sf);
478 
479  // get the controller state
480  gMotorVars.CtrlState = CTRL_getState(handle);
481 
482  // get the estimator state
483  gMotorVars.EstState = EST_getState(obj->estHandle);
484 
485  // Get the DC buss voltage
486  gMotorVars.VdcBus_kV = _IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0));
487 
488  return;
489 } // end of updateGlobalVariables_motor() function
490 
491 
493 // end of file
494 
495 
496 
float_t EST_getFlux_VpHz(EST_Handle handle)
void EST_setFlag_enableForceAngle(EST_Handle handle, const bool state)
_iq gMaxCurrentSlope
Definition: proj_lab03c.c:83
#define MAX_ACCEL_KRPMPS_SF
Defines the speed acceleration scale factor.
Definition: float/main.h:37
void HAL_enableGlobalInts(HAL_Handle handle)
void HAL_enableAdcInts(HAL_Handle handle)
USER_ErrorCode_e UserErrorCode
Definition: main.h:150
bool Flag_MotorIdentified
Definition: main.h:138
void CTRL_run(CTRL_Handle handle, HAL_Handle halHandle, const HAL_AdcData_t *pAdcData, HAL_PwmData_t *pPwmData)
float_t Lsq_H
Definition: main.h:172
_iq USER_computeFlux_pu_to_VpHz_sf(void)
Computes the scale factor needed to convert from per unit to V/Hz.
#define _IQ(A)
HAL_PwmData_t gPwmData
Defines the PWM data.
Definition: proj_lab03c.c:79
bool Flag_Run_Identify
Definition: main.h:137
_iq EST_getSpeed_krpm(EST_Handle handle)
volatile MOTOR_Vars_t gMotorVars
Definition: proj_lab03c.c:93
_iq gTorque_Ls_Id_Iq_pu_to_Nm_sf
Definition: proj_lab03c.c:110
void USER_calcPIgains(CTRL_Handle handle)
Updates Id and Iq PI gains.
CTRL_State_e CtrlState
Definition: main.h:147
bool Flag_enablePowerWarp
Definition: main.h:144
static void HAL_writePwmData(HAL_Handle handle, HAL_PwmData_t *pPwmData)
void EST_setMaxCurrentSlope_pu(EST_Handle handle, const _iq maxCurrentSlope_pu)
_iq value[3]
#define NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE
Defines the number of main iterations before global variables are updated.
Definition: float/main.h:48
void HAL_writeDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
bool CTRL_isError(CTRL_Handle handle)
void USER_softwareUpdate1p6(CTRL_Handle handle)
Recalculates Inductances with the correct Q Format.
static void HAL_acqAdcInt(HAL_Handle handle, const ADC_IntNumber_e intNumber)
_iq EST_get_pu_to_krpm_sf(EST_Handle handle)
#define USER_IQ_FULL_SCALE_VOLTAGE_V
Defines full scale value for the IQ30 variable of Voltage inside the system.
Definition: user.h:88
CTRL_Handle ctrlHandle
The controller handle.
Definition: proj_lab03c.c:73
void memCopy(uint16_t *srcStartAddr, uint16_t *srcEndAddr, uint16_t *dstAddr)
EST_Handle estHandle
bool Flag_enableForceAngle
Definition: main.h:139
void CTRL_setFlag_enableCtrl(CTRL_Handle handle, const bool state)
#define LED_BLINK_FREQ_Hz
Definition: proj_lab03c.c:63
#define V_B_offset
Definition: user.h:133
long _iq
void USER_setParams(USER_Params *pUserParams)
Sets the user parameter values.
EST_State_e EstState
Definition: main.h:148
float_t Rs_Ohm
Definition: main.h:169
#define HAL_toggleLed
#define V_A_offset
ADC voltage offsets for A, B, and C phases.
Definition: user.h:132
#define I_A_offset
ADC current offsets for A, B, and C phases.
Definition: user.h:125
Defines the structures, global initialization, and functions used in MAIN.
void CTRL_setMaxAccel_pu(CTRL_Handle handle, const _iq maxAccel_pu)
_iq USER_computeFlux(CTRL_Handle handle, const _iq sf)
Computes Flux in Wb or V/Hz depending on the scale factor sent as parameter.
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)
static void HAL_enablePwm(HAL_Handle handle)
void updateGlobalVariables_motor(CTRL_Handle handle)
Updates the global motor variables.
Definition: proj_lab03c.c:436
void CTRL_setParams(CTRL_Handle handle, USER_Params *pUserParams)
#define _IQmpy(A, B)
_iq gFlux_pu_to_Wb_sf
Definition: proj_lab03c.c:106
USER_ErrorCode_e USER_getErrorCode(USER_Params *pUserParams)
Gets the error code in the user parameters.
void HAL_enableDrv(HAL_Handle handle)
_iq VdcBus_kV
Definition: main.h:192
_iq Torque_Nm
Definition: main.h:165
HAL_AdcData_t gAdcData
Defines the ADC data.
Definition: proj_lab03c.c:81
_iq SpeedRef_krpm
Definition: main.h:157
CTRL_Obj ctrl
Defines the CTRL object.
Definition: proj_lab03c.c:88
void HAL_setupDrvSpi(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
float_t EST_getLs_q_H(EST_Handle handle)
bool CTRL_getFlag_enableUserMotorParams(CTRL_Handle handle)
void HAL_enableDebugInt(HAL_Handle handle)
CTRL_State_e CTRL_getState(CTRL_Handle handle)
#define I_C_offset
Definition: user.h:127
float_t Flux_VpHz
Definition: main.h:173
bool Flag_enableUserParams
Definition: main.h:142
EST_State_e EST_getState(EST_Handle handle)
bool Flag_enableOffsetcalc
Definition: main.h:143
#define I_B_offset
Definition: user.h:126
void CTRL_setup(CTRL_Handle handle)
MATH_vec3 V_bias
Definition: main.h:199
#define MOTOR_Vars_INIT
Initialization values of global variables.
Definition: main.h:76
CTRL_State_e
#define V_C_offset
Definition: user.h:134
_iq USER_computeTorque_Flux_Iq_pu_to_Nm_sf(void)
Computes the scale factor needed to convert from torque created by flux and Iq, from per unit to Nm...
_iq Speed_krpm
Definition: main.h:160
float_t EST_getIdRated(EST_Handle handle)
bool Flag_Latch_softwareUpdate
Definition: proj_lab03c.c:71
float_t Rr_Ohm
Definition: main.h:168
float_t EST_getRs_Ohm(EST_Handle handle)
CTRL_Handle CTRL_initCtrl(const uint_least8_t estNumber, void *pMemory, const size_t numBytes)
float_t Lsd_H
Definition: main.h:171
void CTRL_setFlag_enablePowerWarp(CTRL_Handle handle, const bool state)
#define USER_ISR_FREQ_Hz
Defines the Interrupt Service Routine (ISR) frequency, Hz.
Definition: user.h:173
bool CTRL_updateState(CTRL_Handle handle)
static void HAL_disablePwm(HAL_Handle handle)
bool EST_isMotorIdentified(EST_Handle handle)
_iq USER_computeTorque_Nm(CTRL_Handle handle, const _iq torque_Flux_sf, const _iq torque_Ls_sf)
Computes Torque in Nm.
void CTRL_setFlag_enableOffset(CTRL_Handle handle, const bool state)
HAL_Handle HAL_init(void *pMemory, const size_t numBytes)
_iq gTorque_Flux_Iq_pu_to_Nm_sf
Definition: proj_lab03c.c:112
void CTRL_setFlag_enableDcBusComp(CTRL_Handle handle, const bool state)
_iq EST_getMaxCurrentSlope_pu(EST_Handle handle)
void CTRL_setFlag_enableUserMotorParams(CTRL_Handle handle, const bool state)
_iq SpeedTraj_krpm
Definition: main.h:158
float_t MagnCurr_A
Definition: main.h:167
static void HAL_readAdcData(HAL_Handle handle, HAL_AdcData_t *pAdcData)
HAL_Obj hal
uint_least16_t gCounter_updateGlobals
A counter that is denotes when to update the global variables.
Definition: proj_lab03c.c:69
static _iq HAL_getBias(HAL_Handle handle, const HAL_SensorType_e sensorType, uint_least8_t sensorNumber)
bool Flag_enableSys
Definition: main.h:136
uint16_t gLEDcnt
Definition: proj_lab03c.c:91
_iq MaxAccel_krpmps
Definition: main.h:159
_iq CTRL_getSpd_int_ref_pu(CTRL_Handle handle)
MATH_vec3 I_bias
Definition: main.h:198
bool Flag_enableRsRecalc
Definition: main.h:141
static void HAL_initIntVectorTable(HAL_Handle handle)
static void HAL_setBias(HAL_Handle handle, const HAL_SensorType_e sensorType, uint_least8_t sensorNumber, const _iq bias)
static void HAL_updateAdcBias(HAL_Handle handle)
void CTRL_getVersion(CTRL_Handle handle, CTRL_Version *pVersion)
uint16_t minor
CTRL_Version CtrlVersion
Definition: main.h:152
HAL_Handle halHandle
The hal handle.
Definition: proj_lab03c.c:75
interrupt void mainISR(void)
The main interrupt service (ISR) routine.
Definition: proj_lab03c.c:402
float_t EST_getRr_Ohm(EST_Handle handle)
USER_Params gUserParams
The user parameters.
Definition: proj_lab03c.c:77
void HAL_setParams(HAL_Handle handle, const USER_Params *pUserParams)
void HAL_readDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
void main(void)
Definition: proj_lab03c.c:117
void USER_checkForErrors(USER_Params *pUserParams)
Checks for errors in the user parameter values.
CTRL_Obj * controller_obj
Definition: proj_lab10c.c:84
_iq Flux_Wb
Definition: main.h:164
GPIO_Number_e
_iq USER_computeTorque_Ls_Id_Iq_pu_to_Nm_sf(void)
Computes the scale factor needed to convert from torque created by Ld, Lq, Id and Iq...
void CTRL_setSpd_ref_krpm(CTRL_Handle handle, const _iq spd_ref_krpm)
_iq USER_computeFlux_pu_to_Wb_sf(void)
Computes the scale factor needed to convert from per unit to Wb.
_iq gFlux_pu_to_VpHz_sf
Definition: proj_lab03c.c:108
float float_t