# MATLAB Simulation model

A

#### ash

This is a problem i came across in chosing the fixed time step while running the mathematical model in simulation...

Actually in the real time system the controlled input can be send only at every .15 sec, but the lowest time constant of the system is about
.01 So if i choose a time step less than the smallest time constant then my simulation will be changing the controlled input at each time
step (I am using a PI controller). Any suggestions??

Thanks
ash

J

#### Johan Bengtsson

What are you trying to do? I am not sure I understand your question completely.

If you are trying to simulate a PI controller and a process with a time step of 0.15s?
And does this process contain time constants as low as 0.01s?

Well, first of all: it isn't really possible to simulate something with a time constant less than the time step and get a result that actually means anything.
The controller (in reality) will never se this small time constants anyway, if you have a lot of them you might see some additional dead time but I really doubt it.

The input to a controller does normally change every time it calculates (except at steady state) otherwise there would not be any reason for
doing a new calculation, so I really don't understand the problem.

Do you really need to simulate the process faster than the controller? The answer might be yes, and if that is the case I don't know how that is solved (running different parts with different time step).

/Johan Bengtsson

Do you need education in the area of automation?
----------------------------------------
P&L, Innovation in training
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------

X

#### Xin Liu

Try to use Zero-Order Hold and Unit Delay to change the output sample rate of your PI controller.

Xin

D

#### Dr. Igor Boiko

3. One of the problems you mention is the presence of a small time constant in the process dynamics (or process model ?). This is typical for a slow process controlled by a fast actuator. When integrating those differential equations we come to a necessity to have a time step sufficiently small to be able to correctly integrate the actuator DEs and large enough to have an acceptable total integration time. This is usually done by application of variable-step
methods. There are a number of respective subroutines in Matlab. Some of them are ode113 for the Adams' method, ede15s, ode23s (Rosenbrock's). If you need to have a fixed step time, please explain.

Regards,
Igor Boiko
[email protected]

D

#### Dr ir Gerrit M. van der Molen

Hi Ash,

You can do two things:

1. Insert a 'zero-order hold' block with a time constant of 0.15 s in the input of your controller (i.e. before processing the plant output or error signal in your continuous-time PI algorithm).

2. Implement your PI control in a formal 'industrial' discrete-time form, with your actual sample time of 0.15 s. There are many articles on the implementation of such controllers in the archive (search for PID, etc.).

Good luck!,
Gerrit.