Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to calculate the integral term with anti-windup.
Simulink
integral = integral + [1] * error * dtAttempts:
3 left
💡 Hint
Common Mistakes
Using 'gain' instead of 'integral_gain' causes incorrect scaling.
Multiplying by 'dt_gain' or 'error_gain' is incorrect.
✗ Incorrect
The integral term is updated by adding the product of integral gain, error, and time step.
2fill in blank
mediumComplete the code to limit the integral term to prevent windup.
Simulink
if integral > [1]: integral = [1]
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'min_limit' instead of 'max_limit' causes wrong comparison.
Using 'integral_limit' or 'limit_value' without clear meaning.
✗ Incorrect
The integral term is capped at the maximum limit to prevent excessive accumulation.
3fill in blank
hardFix the error in the anti-windup condition to handle negative limits.
Simulink
if integral < [1]: integral = [1]
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'max_limit' instead of 'min_limit' causes wrong comparison.
Using 'integral_max' or 'limit_min' without consistent naming.
✗ Incorrect
The integral term is limited from below by the minimum limit to prevent windup in the negative direction.
4fill in blank
hardFill both blanks to implement the anti-windup correction when output saturates.
Simulink
if output > [1]: integral -= [2] * (output - [1]) * dt
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'min_output' instead of 'max_output' for upper limit.
Using 'integral_gain' instead of 'anti_windup_gain' for correction.
✗ Incorrect
When output exceeds max_output, the integral term is corrected by subtracting the excess scaled by anti_windup_gain and dt.
5fill in blank
hardFill all three blanks to implement full anti-windup logic for both output limits.
Simulink
if output > [1]: integral -= [2] * (output - [1]) * dt elif output < [3]: integral -= [2] * (output - [3]) * dt
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up max_output and min_output in conditions.
Using integral_limit instead of anti_windup_gain for correction.
✗ Incorrect
The integral term is corrected when output saturates above max_output or below min_output using anti_windup_gain.
