Hello,
I'd like to ask a few questons about data types of Kp and Ki parameters for PI Control.
1.
I think the Kp and Ki have been specified to have fixed point format of Q16.16 and those registers are 32-bit.
I saw FocDevice.cpp file (from line 157) describes TORQUE_KP_REG, TORQUE_KP_REG, etc., as below.
add_parameter_value(config->init, parameterRegisters, TORQUE_KP_REG, 5000); // Torque Kp = 1.0
add_parameter_value(config->init, parameterRegisters, TORQUE_KI_REG, 0); // Torque Ki = 0
add_parameter_value(config->init, parameterRegisters, RPM_KP_REG, -200); // Speed Kp = 2.88
add_parameter_value(config->init, parameterRegisters, RPM_KI_REG, -5); // Speed Ki
Could you tell me why "TORQUE_KP_REG, 5000" is "Torque Kp = 1.0" and "RPM_KP_REG, -200" is "Speed Kp = 2.88"?
For RPM_KI_REG, TORQUE_KP_REG and TORQUE_KI_REG, what do the -5, -20000 and -5000 represent?
add_parameter_value(config->torque, parameterRegisters, TORQUE_KP_REG, -20000);
add_parameter_value(config->torque, parameterRegisters, TORQUE_KI_REG, -5000);
2.
PI_Control function specifies int16_t Kp and int16_t Ki, but above registers are 32-bit.
How does the PI_Control function in foc.cpp calculate above the fixed point format of Q16.16?
Thanks