大家好!
我将使用 DCL_runDF22_C2和 DCL_runDF22_C3以及 DCL_runClamp_C1来控制我的 PSFB。 我注意到 DCL_runClamp_C1 的一些内容。
// Clamping and saturation
float32_t PSFB_cntlMax, PSFB_cntlMin;
uint16_t PSFB_saturation_flag;
float32_t PSFB_icommand_Set_pu, PSFB_irampmax_Set_pu;
PSFB_saturation_flag = DCL_runClamp_C1(&PSFB_icommand_Set_pu, PSFB_cntlMax, PSFB_cntlMin); //clamp
q1)为何无法将 PSFB_cntlMax、 PSFB_cntlMin 和 PSFB_ICommand_SET_PU 等参数定义为 volatile? 如果定义这些参数、我会在构建代码后收到警告。
问题2) 在我开发的电路板中: 在我的软件中、我需要调整输出电流、在缓慢的任务中、我需要更新 PSFB_cntlMax 参数。 如果我 在线更新 PSFB_cntlMax、则运行正常并限制我的电流。 但是、如果我还要更新输出设置电压、即 DF22的输入、我的控制器会发生中断、并且无法调节输出电压。 我的 psfb 在电流限制模式下始终有效、尽管误差输出变为负值、但钳位输出始终保持为 Umax
Q2.a )它怎么可能是?
Q2.b)如果我使用演示板 F280039C,它不会卡在同一状态?
Q3)我修复了上述问题、将 PSFB_cntlMax 作为常数1.0f、并且我不再更改它。 我使用以下函数更改钳位最大值和最小值。
慢速任务中更新的参数为 PSFB_PCMC_PSB Cset_Slewed。
//钳位最大值/最小值
PSFB_ICommand_SET_PU =(PSFB_ICommand_SET_PU > PSFB_PCMC_PSFB Cset_Slewed)?
PSFB_PCMC_PSFB_ICommand_Set_pu Cset_Slewed;
PSFB_vLVBus_sensed_pu = ((float32_t)(Measurements.V_LVBat)) * PSFB_ADC_PU_SCALE_FACTOR; //yk pu
PSFB_vcommand_Set_pu = PSFB_LV_Vset_Slewed / (PSFB_VLVBUS_MAX_SENSE_VOLTS); //rk
PSFB_error_vLVBus_pu = PSFB_vcommand_Set_pu - PSFB_vLVBus_sensed_pu; //error
PSFB_icommand_Set_pu = DCL_runDF22_C2 (&PSFB_gv, PSFB_error_vLVBus_pu); //run compensator
PSFB_saturation_flag = DCL_runClamp_C1(&PSFB_icommand_Set_pu, PSFB_cntlMax, PSFB_cntlMin); //clamp
if(PSFB_saturation_flag == 0)
{
DCL_runDF22_C3(&PSFB_gv, PSFB_error_vLVBus_pu, PSFB_icommand_Set_pu);
}
// Clamp max/min
PSFB_icommand_Set_pu = (PSFB_icommand_Set_pu > PSFB_PCMC_Cset_Slewed)?
PSFB_PCMC_Cset_Slewed:PSFB_icommand_Set_pu;
PSFB_icommand_Set_pu = (PSFB_icommand_Set_pu < PSFB_cntlMin)?
PSFB_cntlMin:PSFB_icommand_Set_pu;
Q3.a)该解决方案如何解决我的问题?