PI controller Tuning Data Importing

8 visualizaciones (últimos 30 días)
Eric
Eric el 2 de Sept. de 2024
Comentada: Eric el 2 de Sept. de 2024
It seems difficult to find examples of PID tuning without Simulink, or I am searching for the wrong things. I have Simulink but wanted to use Matlab.
I have an IC engine and am trying to tune the idle via the throttle blade.
I do have all the data for outputs : RPM, and inputs: Throttle Angle, Spark Advance, Desired RPM, Airflow. I also have what the controller adds/subtracts for airflow based off Target RPM error (which is what I am trying to adjust). I don't have how the throttle angle is related to with airflow, but I am sure I can calculate that if needed.
I also know that this is a Discrete PI controller sampled at 12.5 milliseconds.
I would like to convert my data into a response curve and then apply pid tuning. A lot of what I found was an impulse curve. This would align more with sustained load/change.
The airflow adder/subtrator is incremented based off RPM error.

Respuesta aceptada

Ayush
Ayush el 2 de Sept. de 2024
Hi @Eric,
Hi Eric,
To tune a PI controller, you need to create a model using MATLAB first and then tune the controller based on the model requirements.
Now, before directly jumping into designing a PI controller, let me first give insights into how to design a model using MATLAB.
  • Designing a System model
  1. You can use “System identification Toolbox” in MATLAB. You can read more about it here: https://www.mathworks.com/help/ident/index.html. You can use functions like “iddata” to create data objects and “tfest” or “ssest” to estimate transfer functions or state-space models. Here’s the pseudo code for estimating a transfer function using “tfest” function from System identification toolbox.
data = iddata(output_data, input_data, 0.0125); % Assuming 12.5 ms sampling time
sys = tfest(data, 2, 1); % Estimate a transfer function model
  • PI Tuning
  1. Defining PI controller: You can use “pid” function to define a PI controller. Here’s a pseudo code for the same. You can read more about it in the documentation of “pid” function here: https://www.mathworks.com.help/control/ref/pid.html
C = pid(1, 0.1); % Initial PI controller with arbitrary gains
2. Tune controller: You can use the “pidtune function to automatically tune your PI controller based on the identified model. Here’s the pseudo code for the function. You can read more about it here: https://www.mathworks.com/help/control/ref/dynamicsystem.pidtune.html.
[C, info] = pidtune(sys, 'PI');
3. Simulation and validation: You can use lsim or step functions to simulate the closed-loop response with the tuned controller. Here’s the pseudo code for the same. You can read more about it in the “lsim” function documentation here: https://www.mathworks.com/help/control/ref/dynamicsystem.lsim.html .
T = feedback(C*sys, 1);
lsim(T, input_data, time_vector);
4. Testing
  1. Iterate on gains: After initial tuning, you might need to manually adjust gains based on performance criteria like overshoot, settling time, and steady-state error.
  2. Test on engine: Apply the tuned controller to your IC engine and observe its performance. You might need to iterate further based on real-world results.
Attaching relevant links for your reference:
Hope it helps!

Más respuestas (0)

Productos


Versión

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by