Skip to content

TechSource-Ascendas/shortcycle-id-control_system

Repository files navigation

Quickstart on Control System

Table of Contents

Challenges on controlling a hardware

Quick introduction to Control System

  How to design it

Modeling The Plant

Hardware Requirements

Wiring Diagram

Demo Procedure

  (1) Prepare the project

  (2) Run the physical hardware to record input and output

   For estimation

   For validation

  (3) Use System Identification App to estimate plant model

  (4) Simulate and tune

  (5) Test with the hardware

References

Challenges on controlling a hardware

  • 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?

Quick introduction to Control System

Simple closed-loop control system example:

image_0.png

How to design it

  1. Model the plant
  2. Tune the controller
  3. Test & Verify
  4. Deploy

Modeling The Plant

image_1.png

The problem is I don't know the specification of the motor and its driver (the plant)

image_2.png

So, this is where we need System Identification

Hardware Requirements

Wiring Diagram

image_3.png

Demo Procedure

(1) Prepare the project

open system_identification_arduino.prj

(2) Run the physical hardware to record input and output

load_system("record_plant");
set_param("record_plant",SimulationMode="external");

For estimation

start_recording("record_plant");
estimation_iddata = recording_output(yout);
save('Output\estimation.mat', 'estimation_iddata');
plot(estimation_iddata)

figure_0.png

For validation

start_recording("record_plant");
validation_iddata = recording_output(yout);
save('Output\validation.mat', 'validation_iddata');
plot(validation_iddata)

figure_1.png

(3) Use System Identification App to estimate plant model

image_4.png

image_5.png

image_6.png

image_7.png

Use these object names and click import for each of them.

  1. estimation_iddata
  2. validation_iddata

Then click "Close".

You will see "estimation_idddata" and "validation_iddata" in Data Views. Drag and drop accordingly to this illustration.

image_8.png

image_9.png

Configure exactly as below. Feel free to modify if you know what you're doing.

image_10.png

Then click "Estimate" and wait.

Once done, drag the result as below to workspace.

image_11.png

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);

(4) Simulate and tune

open tune_controller.slx

Double click the PID block

image_12.png

Make sure changes applied and tuning method is "Transfer Function Based", then click Tune button

image_13.png

Adjust these sliders below then hit "Update Block" button.

image_14.png

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".

(5) Test with the hardware

open hardware_in_the_loop.slx

References

About

Quickstart on Control System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages