Simulating a custom discrete-time PI controller and plant in SIMULINK

Click For Summary
SUMMARY

This discussion focuses on simulating a custom discrete-time PI controller and a DC motor model in SIMULINK. The user, Mike, successfully utilized SIMULINK's PID(z) block and a zero-order hold (ZOH) for feedback but seeks to replace these with a custom PI controller. He also considers the integration of a PWM block and discusses the complexities of modeling multiple controllers for an omni-directional robot. Key resources include MATLAB's documentation and external links for further exploration of system stability and custom block coding.

PREREQUISITES
  • Familiarity with SIMULINK and its block library
  • Understanding of discrete-time control systems and PI controllers
  • Knowledge of PWM (Pulse Width Modulation) techniques
  • Basic concepts of motor control and feedback systems
NEXT STEPS
  • Research how to create custom blocks in SIMULINK for specific control algorithms
  • Explore MATLAB's documentation on implementing PWM in control systems
  • Learn about system stability analysis using transfer functions
  • Investigate the use of s-functions in SIMULINK for advanced modeling
USEFUL FOR

Control engineers, robotics developers, and students in electrical engineering who are working on simulations of control systems in MATLAB and SIMULINK.

bsodmike
Messages
82
Reaction score
0
Hi!

I've been looking to simulate a PI controller in SIMULINK without much success. You will be able to find a description of the above in the images located here: https://picasaweb.google.com/102197309611185157885/PIControlWithMatlabAndSIMULINK?authkey=Gv1sRgCOCnzvbm5PuNJA&feat=directlink.

I was able to use some of the SIMULINK supplied blocks to get started in simulating a PID(z) controller attached to a similar model of a DC motor with the feedback of dtheta (angular velocity in rad/s) passed to a zero-order-hold block. The input I used a speed reference (in rad/s again). I want to, however, replace the SIMULINK supplied block with a custom PI controller - see below:

Screen%20shot%202011-05-15%20at%2019.53.27.png


Another approach would be to consider the freq. domain analysis of this model by considering the system's transfer function. This approach is taken here: http://www.library.cmu.edu/ctms/ctms/examples/motor/digital.htm However, it seems they are far more interested in the system stability-analysis. Is this the only approach?

Would really appreciate any assistance you may have to offer!

Thanks,
Mike.
 
Last edited by a moderator:
Physics news on Phys.org
As made apparent by the high-level system diagram (available via the link above) the purpose here is to simulate an omni-directional robot in MATLAB. Those assisting will be credited in the journal paper that is currently being written.

Here are some further points to consider:

(A) The first stage would involve modelling the above PI controller and my DC motor model. I tried a test today using MATLAB's supplied PID(z) block and with the ZOH on the d_theta feedback loop - it worked like a charm.

(B) once A is completed I'm wondering how I can add a PWM block between the controller and motor - again, I'd prefer if I could supply a model for the PWM controller itself rather than relying on the SIMULINK block - or should I not bother?

In this case, would the loop look something like:

Vref(t) ----(Diff)----------> [ PI(z) ] ------> ZOH ------> PWM --------> Motor -------------> to Diff, already in continuous time due to previous ZOH.

or

Vref(t) ----(Diff)----------> [ PI(z) ] ---------> PWM --------> Motor --------ZOH -----> to Diff

To make the simulation less boring I can connect a variable torque load to Kt inside the motor model by using one of the repeating sequence blocks - this will ensure the error signal has some serious work to do :)

**edit** - I tried this today and it failed miserably. I believe the whole PWM part could be avoided since it's just a linear representation of the control signal. It's just d_theta but expressed in terms of duty-ratio.

(C) This will be much more complicated where I'd need a custom block to process

Pose^T -----> [IK] ----> [w1,w2, w3]^T

The above will include three controllers and three motors. By applying the FK solution, the feedback path can be constructed. This resulting pose will need to be subjected to R(z) - rotating about the z-axis - to align the robot's local co-ordinates with world co-ordinates.

Suggestions?
 
I found some s-function alternatives; you can find the code here:
https://gist.github.com/978493

I tried to simulate the first one (same as the last) in SIMULINK, but got a rather strange "flag==3 call must be a real vector of length 1" ?
 

Similar threads

Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K