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

AI Thread Summary
The discussion revolves around simulating a custom discrete-time PI controller and a DC motor model in SIMULINK. The user successfully implemented a PID controller but seeks to replace it with a custom PI controller and is exploring the integration of a PWM block. They express concerns about the complexity of adding a custom block for processing multiple controllers and motors, as well as issues encountered with an S-function alternative. The user is looking for assistance and suggestions to improve their simulation, particularly regarding the PWM implementation and the overall control structure. The goal is to develop a simulation for an omni-directional robot, with contributors credited in an upcoming journal paper.
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" ?
 
Back
Top