又给我来了一段
- /*
- * Program to illustrate Incremental PID control
- */
- # include <stdio.h>
- int main()
- {
- double Kp, Ki, Kd; // Proportional, Integral, Derivative constants
- int i;
-
- // Get the user input
- printf("Enter the Proportional(Kp), Integral(Ki), and Derivative(Kd) values:");
- scanf("%lf %lf %lf", &Kp, &Ki, &Kd);
-
- // Compute the incremental PID output
- double increment = Kp + Ki + Kd;
-
- // Apply the incremental PID output
- for (i=0; i<1000; i++) {
- printf("Incremental PID Output at Timestep %d = %f\n", i, increment);
-
- }
- // Exit gracefully
- return 0;
- }
|