Lag-Lead Compensator Design in Python
Lag-Lead Compensator Design in Python
The Ziegler-Nichols method is chosen for PID tuning due to its empirical approach to establishing effective controller settings that stabilizes system response at desired specifications. It involves conducting a closed-loop test to identify the ultimate gain (Ku) where sustained oscillations appear and the corresponding period (Pu). Based on Ku and Pu, the PID parameters such as proportional gain (Kp), integral time (Ti), and derivative time (Td) are calculated to adjust the system accordingly .
To calculate the gain Kc necessary for a lead compensator, determine the existing gain-crossover frequency and ensure the compensator introduces adequate phase margin. In the provided example to achieve a gain Kv of 40, Kc was calculated using the formula Kc = 1440/100 = 14.4 after establishing Kv at this frequency and equating the leads' transfer function to affect the needed phase correction .
Stability in a Nyquist plot is indicated by whether or not the plotted path encircles the critical point (-1,0). If the plot does not encircle this point when different gain values are tested, it suggests the system is stable. Variations in the position and size of the plot with different gains allow assessment of stability under these varied conditions .
Placing the zero of a compensator exactly at an open-loop pole simplifies the system's dynamics by canceling out that pole, which streamlines analysis such as root locus adjustments. This strategy directly influences system stability and transient response improvements, making it a technique to customize system behavior while aligning with specific performance criteria such as a defined overshoot or settling time .
To determine the phase lead angle needed to ensure stability, first calculate the total phase margin increase required, considering any additional margin for uncertainties. For example, in a system needing a static velocity error constant Kv of 40, a 10% extra margin ensures gain crossover frequency adjustments are accounted for. The lead compensator should introduce the necessary phase shift by positioning its phase lead maximum closely to this frequency, using equations like tan(φm/2) = sqrt(ωz.ωp)/ωz for calculation .
Marking Nyquist plots with specific values of K1 and K2 is critical for accurately assessing system stability because these values affect the plot's path relative to the critical point (-1, 0). According to the Nyquist stability criterion, a closed-loop system is stable if the Nyquist plot does not encircle this point. An unstable system can be anticipated if the plot encircles (-1,0) in the clockwise direction for K1K2 > 1, highlighting importance in precise marking for systems analysis .
The phase margin requirement is theoretically linked to the acceptable level of overshoot in a control system. For a peak overshoot of approximately 20%, the damping ratio (ζ) can be calculated, giving a phase margin requirement of approximately 62.87 degrees. This value ensures sufficient relative stability to meet the overshoot criteria within an underdamped response .
The Nyquist plot's trajectory in a system with complex poles and zeros can be determined by evaluating the transfer function's response to varying frequencies, particularly across the Nyquist contour. This requires analysis of how the function's real and imaginary components respond to frequency variations from 0 to infinity, often using numerical simulations to trace the plot path and check for critical point encirclements, identifying its stability characteristics .
Comparing the step responses before and after including a lead compensator reveals its effectiveness by showing changes in transient performance measures such as percent overshoot and peak time. An effectively designed compensator will typically reduce overshoot and peak times, indicating improved response with desired damping and quicker stabilization .
The pole-zero locations of a lag-lead compensator significantly influence the system's transient response characteristics such as overshoot and settling time. By placing the compensator zero at the open-loop pole of -6 and a lag compensator pole at 0.01, the design simplifies the adjustments needed for stability and performance criteria, such as a 20% overshoot and reduced settling time. The proper placement helps satisfy the root locus angle criterion, aiding in achieving a desired tenfold reduction in steady-state error for ramp input .