|
@@ -636,11 +636,8 @@ void mot_contrl_set_dccurr_limit(mot_contrl_t *ctrl, float ibusLimit) {
|
|
|
ibusLimit = min(ibusLimit, ctrl->protlim.dc_curr);
|
|
ibusLimit = min(ibusLimit, ctrl->protlim.dc_curr);
|
|
|
}
|
|
}
|
|
|
ctrl->userlim.dc_curr = ibusLimit;
|
|
ctrl->userlim.dc_curr = ibusLimit;
|
|
|
- if (ABS(ctrl->dc_curr_filted) <= ibusLimit){
|
|
|
|
|
- line_ramp_reset(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
|
|
- }else {
|
|
|
|
|
- line_ramp_set_target(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ line_ramp_reset(&ctrl->ramp_dc_curr_lim, ctrl->dc_curr_filted);//从当前实际母线电流开始做ramp
|
|
|
|
|
+ line_ramp_set_target(&ctrl->ramp_dc_curr_lim, ctrl->userlim.dc_curr);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void mot_contrl_set_vel_limit(mot_contrl_t *ctrl, float vel) {
|
|
void mot_contrl_set_vel_limit(mot_contrl_t *ctrl, float vel) {
|
|
@@ -648,11 +645,8 @@ void mot_contrl_set_vel_limit(mot_contrl_t *ctrl, float vel) {
|
|
|
vel = ctrl->hwlim.mot_vel;
|
|
vel = ctrl->hwlim.mot_vel;
|
|
|
}
|
|
}
|
|
|
ctrl->userlim.mot_vel = vel;
|
|
ctrl->userlim.mot_vel = vel;
|
|
|
- if (ABS(ctrl->foc.in.mot_velocity) <= vel) {
|
|
|
|
|
- line_ramp_reset(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
|
|
- }else {
|
|
|
|
|
- line_ramp_set_target(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ line_ramp_reset(&ctrl->ramp_vel_lim, ctrl->foc.in.mot_velocity);//从当前实际转速做ramp
|
|
|
|
|
+ line_ramp_set_target(&ctrl->ramp_vel_lim, ctrl->userlim.mot_vel);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void mot_contrl_set_vel_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|
|
void mot_contrl_set_vel_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|
|
@@ -669,11 +663,8 @@ void mot_contrl_set_torque_limit(mot_contrl_t *ctrl, float torque) {
|
|
|
torque = min(torque, ctrl->protlim.torque);
|
|
torque = min(torque, ctrl->protlim.torque);
|
|
|
}
|
|
}
|
|
|
ctrl->userlim.torque = torque;
|
|
ctrl->userlim.torque = torque;
|
|
|
- if (ABS(ctrl->target_torque) <= torque){
|
|
|
|
|
- line_ramp_reset(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
|
|
- }else {
|
|
|
|
|
- line_ramp_set_target(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ line_ramp_reset(&ctrl->ramp_torque_lim, ctrl->target_torque_raw);//从当前给定的torque做ramp
|
|
|
|
|
+ line_ramp_set_target(&ctrl->ramp_torque_lim, ctrl->userlim.torque);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void mot_contrl_set_torque_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|
|
void mot_contrl_set_torque_limit_rttime(mot_contrl_t *ctrl, u32 time) {
|