I decided to set up a circuit with a peicewise linear input which is an input that is defined to have 0 volts from time t = 0 to time t = 1ms, and have for example an input of 2 volts for time t > 1ms. There is a sudden change of input voltage between 0 volts and 2 volts for this specific peicewise linear input.
Initially, the circuit will calculate the difference between the output and the input, and the PID control will allow the output to soon approach to 2 volts which is the desired value.

After I set up the circuit, I found that debugging the resistance, capacitance and other components and other parameters was a big problem. This is because I found that once the coefficient is not adjusted properly, the system will oscillate, but this is not what we want. PID The coefficients of the three paths need to be adjusted according to certain steps. At the beginning, derivative does not play a leading role, but helps to increase the speed of convergence, so Kd can be set to 0 first. Proportional and Integral path can be adjusted first. Here, the Integral path is adjusted first to make its loop work steadily. Then adjust the proportional path so that the actual voltage rises faster and faster. Finally, derivative is added to make the voltage approach the target value at a very fast speed at the beginning. So, basically, this process is a trail and error.
Output
The blue line represents my target voltage, and the green line represents the output voltage of the circuit.
Integral Control only:

Proportional Control + Integral Control Together:

PID Control:
