Hey all,
I'm trying to determine how to set a configurable limit on the setpoint current from the speed PI(D) regulator in instaspin-FOC. In ctrl.c, the CTRL_setParams() function has one section that seems somewhat relevant (line 407 - 417);
// set the default speed PID controller parameters
Kp = _IQ(0.02*pUserParams->maxCurrent*pUserParams->iqFullScaleFreq_Hz/pUserParams->iqFullScaleCurrent_A);
Ki = _IQ(2.0*pUserParams->maxCurrent*pUserParams->iqFullScaleFreq_Hz*pUserParams->ctrlPeriod_sec/pUserParams->iqFullScaleCurrent_A);
Kd = _IQ(0.0);
outMin = _IQ(-1.0);
outMax = _IQ(1.0);
PID_setGains(obj->pidHandle_spd,Kp,Ki,Kd);
PID_setUi(obj->pidHandle_spd,_IQ(0.0));
PID_setMinMax(obj->pidHandle_spd,outMin,outMax);
CTRL_setGains(handle,CTRL_Type_PID_spd,Kp,Ki,Kd);
From what I can see here the output is limited to a constant value of +-1, and only the Kp and Ki terms are affected by the maxCurrent parameter. I'm guessing that I'd want to modify the outMin and outMax parameters as well and call PID_setGains(), PID_setMinMax(), and CTRL_setGains() when changing/setting the maximum motor current.
Question 1: What units are the outMin and outMax parameters expresses as? USER_CURRENT_SF? Something else?
Question 2: Should I be careful when calling the PID_setGains(), PID_setMinMax(), and CTRL_setGains() functions? Both in terms of context (interrupt vs. main) and calling frequency; should I only call them when insta-spin is disabled or would they be safe to call during operation as well?






