|
AM263x Motor Control SDK
09.02.00
|
|
Go to the documentation of this file.
33 #ifndef SVGEN_CURRENT_H
34 #define SVGEN_CURRENT_H
54 #include "math_types.h"
88 typedef struct _SVGENCURRENT_Obj_
138 const int16_t minwidth)
224 static inline int16_t
294 static __attribute__((always_inline))
296 uint16_t cmp1, uint16_t cmp2, uint16_t cmp3,
297 uint16_t cmpM1, uint16_t cmpM2, uint16_t cmpM3)
304 uint16_t nextPulse1 = (cmp1 + cmpM1)>>1;
305 uint16_t nextPulse2 = (cmp2 + cmpM2)>>1;
306 uint16_t nextPulse3 = (cmp3 + cmpM3)>>1;
308 if(nextPulse1 < minWidth)
310 if((nextPulse2 < minWidth) || ((cmp2 - cmp1) < minWidth))
314 else if((nextPulse3 < minWidth) || ((cmp3 - cmp1) < minWidth))
323 else if(nextPulse2 < minWidth)
325 if((nextPulse1 < minWidth) || ((cmp1 - cmp2) < minWidth))
329 else if((nextPulse3 < minWidth) || ((cmp3 - cmp2) < minWidth))
338 else if(nextPulse3 < minWidth)
340 if((nextPulse1 < minWidth) || ((cmp1 - cmp3) < minWidth))
344 else if((nextPulse2 < minWidth) || ((cmp2 - cmp3) < minWidth))
370 static __attribute__((always_inline))
372 MATH_Vec3 *pADCData, MATH_Vec3 *pADCDataPrev)
412 pADCData->value[0] = Ia;
413 pADCData->value[1] = Ib;
414 pADCData->value[2] = Ic;
416 pADCDataPrev->value[0] += (pADCData->value[0] - pADCDataPrev->value[0]) * 0.5f;
417 pADCDataPrev->value[1] += (pADCData->value[1] - pADCDataPrev->value[1]) * 0.5f;
418 pADCDataPrev->value[2] += (pADCData->value[2] - pADCDataPrev->value[2]) * 0.5f;
422 pADCData->value[0] = pADCDataPrev->value[0];
423 pADCData->value[1] = pADCDataPrev->value[1];
424 pADCData->value[2] = pADCDataPrev->value[2];
438 static __attribute__((always_inline))
440 MATH_Vec3 *pPWMData, MATH_Vec3 *pPWMData_prev)
444 float32_t Va_avg = (pPWMData->value[0] + pPWMData_prev->value[0]) * 0.5f;
445 float32_t Vb_avg = (pPWMData->value[1] + pPWMData_prev->value[1]) * 0.5f;
446 float32_t Vc_avg = (pPWMData->value[2] + pPWMData_prev->value[2]) * 0.5f;
461 Vmid = pPWMData->value[1];
462 Vmid_prev = pPWMData_prev->value[1];
467 Vmid = pPWMData->value[0];
468 Vmid_prev = pPWMData_prev->value[0];
471 else if(Vc_avg > Vlimit)
478 Vmid = pPWMData->value[2];
479 Vmid_prev = pPWMData_prev->value[2];
484 Vmid = pPWMData->value[0];
485 Vmid_prev = pPWMData_prev->value[0];
513 Vmid = pPWMData->value[2];
514 Vmid_prev = pPWMData_prev->value[2];
519 Vmid = pPWMData->value[1];
520 Vmid_prev = pPWMData_prev->value[1];
537 else if(Vc_avg > Vlimit)
560 Voffset = (Vmid + Vmid_prev) * 0.5f - Vlimit;
562 if(pPWMData->value[0] > -0.50f)
564 pPWMData->value[0] -= Voffset;
567 if(pPWMData->value[1] > -0.50f)
569 pPWMData->value[1] -= Voffset;
572 if(pPWMData->value[2] > -0.50f)
574 pPWMData->value[2] -= Voffset;
581 if(((pPWMData->value[0] + pPWMData_prev->value[0]) * 0.5f) > Vlimit)
585 else if(((pPWMData->value[1] + pPWMData_prev->value[1]) * 0.5f) > Vlimit)
589 else if(((pPWMData->value[2] + pPWMData_prev->value[2]) * 0.5f) > Vlimit)
599 pPWMData_prev->value[0] = pPWMData->value[0];
600 pPWMData_prev->value[1] = pPWMData->value[1];
601 pPWMData_prev->value[2] = pPWMData->value[2];
623 #endif // end of SVGEN_CURRENT_H definition
int16_t minWidth
The maximum width where a valid measurement cannot be taken.
Definition: svgen_current.h:90
SVGENCURRENT_VmidShunt_e Vmid
The middle amplitude voltage among the three phase voltages.
Definition: svgen_current.h:93
Defines the Svgen Current object.
Definition: svgen_current.h:89
float32_t Vlimit
The maximum output voltage duty that current can be sampled.
Definition: svgen_current.h:94
SVGENCURRENT_IgnoreShunt_e ignoreShunt
Output of what shunt or shunts to ignore.
Definition: svgen_current.h:91
SVGENCURRENT_MeasureShunt_e compMode
Output phase compensation mode.
Definition: svgen_current.h:92
float float32_t
Definition: dcl_common.h:58
int16_t Voffset
The offset.
Definition: svgen_current.h:95