|
|
@@ -572,7 +572,8 @@ void PMSM_FOC_idqCalc(void) {
|
|
|
PMSM_FOC_idq_Assign();
|
|
|
}
|
|
|
|
|
|
-void PMSM_FOC_RunTime_Limit(void) {
|
|
|
+bool PMSM_FOC_RunTime_Limit(void) {
|
|
|
+ bool changed = false;
|
|
|
float dclim = (float)vbus_current_vol_lower_limit();
|
|
|
float phaselim = (float)phase_current_temp_high_limit();
|
|
|
|
|
|
@@ -585,8 +586,12 @@ void PMSM_FOC_RunTime_Limit(void) {
|
|
|
if (dclim < gFoc_Ctrl.rtLim.DCCurrLimRamp.target) {
|
|
|
eRamp_set_step_target(&gFoc_Ctrl.rtLim.DCCurrLimRamp, dclim, CONFIG_eCTRL_STEP_TS);
|
|
|
}
|
|
|
- gFoc_Ctrl.protLim.s_iDCLim = dclim;
|
|
|
- gFoc_Ctrl.protLim.s_PhaseCurrLim = phaselim;
|
|
|
+ if (gFoc_Ctrl.protLim.s_iDCLim != dclim || gFoc_Ctrl.protLim.s_PhaseCurrLim != phaselim) {
|
|
|
+ gFoc_Ctrl.protLim.s_iDCLim = dclim;
|
|
|
+ gFoc_Ctrl.protLim.s_PhaseCurrLim = phaselim;
|
|
|
+ changed = true;
|
|
|
+ }
|
|
|
+ return changed;
|
|
|
}
|
|
|
|
|
|
void PMSM_FOC_Slow_Task(void) {
|
|
|
@@ -703,6 +708,12 @@ void PMSM_FOC_TorqueLimit(float torqueLimit) {
|
|
|
torqueLimit = gFoc_Ctrl.hwLim.s_torqueMax;
|
|
|
}
|
|
|
gFoc_Ctrl.userLim.s_torqueLim = torqueLimit;
|
|
|
+
|
|
|
+ if (ABS(gFoc_Ctrl.in.s_motRPM) < 10){
|
|
|
+ eRamp_reset_target(&gFoc_Ctrl.rtLim.phaseCurrLimRamp, torqueLimit);
|
|
|
+ }else {
|
|
|
+ eRamp_set_step_target(&gFoc_Ctrl.rtLim.phaseCurrLimRamp, torqueLimit, CONFIG_eCTRL_STEP_TS);
|
|
|
+ }
|
|
|
}
|
|
|
float PMSM_FOC_GetTorqueLimit(void) {
|
|
|
return gFoc_Ctrl.userLim.s_torqueLim;
|