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

In summary, Mike found that he could successfully model a PID(z) controller using the MATLAB PID block and ZOH feedback loop, but is looking for a way to add a PWM block between the controller and motor. He also suggests that the loop look something like:Vref(t) ----(Diff)----------> [PI(z)] ------> ZOH ------> PWM --------> Motor -------------> to Diff, already in continuous time due to previous ZOH.
  • #1
bsodmike
82
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
  • #2
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?
 
  • #3
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" ?
 

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

What is a discrete-time PI controller?

A discrete-time PI (proportional-integral) controller is a digital control system that uses a combination of proportional and integral control to regulate a system's output based on its error from a desired setpoint. It is used in discrete-time systems where inputs and outputs are sampled at regular intervals.

How does a discrete-time PI controller work?

A discrete-time PI controller works by continuously measuring the error between the desired setpoint and the actual output, and then using a proportional term to adjust the output in proportion to the error, and an integral term to sum up the past errors and adjust the output accordingly. This process is repeated at each sampling interval to continuously regulate the system's output.

What is a plant in SIMULINK?

In SIMULINK, a plant refers to the physical system or process that is being controlled. It can be represented by a mathematical model that describes its behavior, such as a transfer function or state-space model. The plant is the input to the PI controller, and its output is the input to the controller's feedback loop.

How do I simulate a custom discrete-time PI controller and plant in SIMULINK?

To simulate a custom discrete-time PI controller and plant in SIMULINK, you will need to first design and implement the controller and plant models using appropriate blocks and functions. Then, you can use the simulation tools in SIMULINK to run the model and observe its behavior. You can also adjust the controller and plant parameters to fine-tune the system's performance.

What are the benefits of using SIMULINK for simulating a discrete-time PI controller and plant?

SIMULINK offers a user-friendly and intuitive interface for designing, simulating, and analyzing control systems. It also provides a wide range of built-in blocks and functions for modeling various types of systems. Additionally, SIMULINK allows for easy visualization of the system's behavior through plots and animations, making it a useful tool for testing and optimizing control systems.

Similar threads

Replies
1
Views
2K
  • Electrical Engineering
Replies
10
Views
2K
Back
Top