Challenges on controlling a hardware
Quick introduction to Control System
(2) Run the physical hardware to record input and output
(3) Use System Identification App to estimate plant model
- How to get started with available hardware on market?
- What to learn and how to quickly implement physically?
- Can I create a controller without knowing much about the "plant"?
- Any fast way of tuning PID parameters?
Simple closed-loop control system example:
The problem is I don't know the specification of the motor and its driver (the plant)
So, this is where we need System Identification
- Arduino Uno R3
- Type-B USB Cable
- L293D
- 12VDC brushed motor (or similar)
- 12V power supply
- 12V barrel jack power socket
open system_identification_arduino.prjload_system("record_plant");
set_param("record_plant",SimulationMode="external");start_recording("record_plant");
estimation_iddata = recording_output(yout);
save('Output\estimation.mat', 'estimation_iddata');
plot(estimation_iddata)start_recording("record_plant");
validation_iddata = recording_output(yout);
save('Output\validation.mat', 'validation_iddata');
plot(validation_iddata)Use these object names and click import for each of them.
- estimation_iddata
- validation_iddata
Then click "Close".
You will see "estimation_idddata" and "validation_iddata" in Data Views. Drag and drop accordingly to this illustration.
Configure exactly as below. Feel free to modify if you know what you're doing.
Then click "Estimate" and wait.
Once done, drag the result as below to workspace.
Done! Now you have "plant_model" variable in Workspace, which represents your motor and tachometer as a plant.
If you want instant result, here's the custom function:
plant_model = identify_the_plant(estimation_iddata, validation_iddata);open tune_controller.slxDouble click the PID block
Make sure changes applied and tuning method is "Transfer Function Based", then click Tune button
Adjust these sliders below then hit "Update Block" button.
Click OK on Block Parameter dialog. Your PID parameters (Kp, Ki, Kd, and Kn) are now synced to other models via "Data\tuning_parameters.sldd".
open hardware_in_the_loop.slx















