Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simulink transfer function

24 views
Skip to first unread message

jeremy...@gmail.com

unread,
Nov 5, 2008, 4:50:53 PM11/5/08
to
What is it about simulink transfer function block, not permitting me
to have (s^2+s+1) / s ? Is it simulink or is it something about the
TF??

Freelance Embedded Systems Engineer

unread,
Nov 5, 2008, 5:27:13 PM11/5/08
to jeremy...@gmail.com

It's not causal.

It requires information in the future
in the same way a derivative transfer function "s"
would (this won't work either).

You can get around it by adding a fast term
to the denominator. Make it second order if
you want to avoid a direct feedthrough term.

Multiple it by something like: (wn^2)/(s^2+2*zeta*wn+wn^2)
where zeta is 0.707 and wn is greater than or equal to 10.

pnachtwey

unread,
Nov 5, 2008, 9:14:01 PM11/5/08
to
On Nov 5, 2:27 pm, Freelance Embedded Systems Engineer
<g9u5d...@yahoo.com> wrote:

> jeremysce...@gmail.com wrote:
> > What is it about simulink transfer function block, not permitting me
> > to have (s^2+s+1) / s ? Is it simulink or is it something about the
> > TF??
>
> It's not causal.
???
(s^2+s+1) / s is a PID where Kp=1 Ki=1 and Kd=1

Kp+Ki/s+Kd*s

Are you saying simulink will not allow one to enter a PID?

>
> It requires information in the future

What information does a PID require from the future?

> in the same way a derivative transfer function "s"
> would (this won't work either).

This seems to be the real problem.

>
> You can get around it by adding a fast term
> to the denominator.  Make it second order if
> you want to avoid a direct feedthrough term.
>

That may work but it is a kludge.

> Multiple it by something like: (wn^2)/(s^2+2*zeta*wn+wn^2)
> where zeta is 0.707 and wn is greater than or equal to 10.

??
Wouldn't a simpler a/(s+a) work? I don't use simulink but I find it
hard to imagine that one can't enter a PID.

Peter Nachtwey

JCH

unread,
Nov 6, 2008, 8:05:37 AM11/6/08
to

<jeremy...@gmail.com> schrieb im Newsbeitrag
news:9b4c7599-6cbe-43ee...@f37g2000pri.googlegroups.com...

> What is it about simulink transfer function block, not permitting me
> to have (s^2+s+1) / s ? Is it simulink or is it something about the
> TF??


It is a PID controller C = 1 + 1/s + s. [P+I+D]


--
Regards/Grüße http://home.arcor.de/janch/janch/menue.htm
Jan C. Hoffmann eMail aktuell: ja...@nospam.arcornews.de
Microsoft-kompatibel/optimiert für IE7+OE7

mat

unread,
Nov 6, 2008, 1:15:04 PM11/6/08
to
pnachtwey a écrit :

> On Nov 5, 2:27 pm, Freelance Embedded Systems Engineer
> <g9u5d...@yahoo.com> wrote:
>> jeremysce...@gmail.com wrote:
>>> What is it about simulink transfer function block, not permitting me
>>> to have (s^2+s+1) / s ? Is it simulink or is it something about the
>>> TF??
>> It's not causal.

It would not be causal if it was a discrete TF with z instead of s.

Causality is not the problem with continous TF. This TF is simply not
"proper", wich means that its impulse response has infinite energy (L2
norm is not bounded).


> ???
> (s^2+s+1) / s is a PID where Kp=1 Ki=1 and Kd=1
>
> Kp+Ki/s+Kd*s
>
> Are you saying simulink will not allow one to enter a PID?
>
>> It requires information in the future
>
> What information does a PID require from the future?
>
>> in the same way a derivative transfer function "s"
>> would (this won't work either).
>
> This seems to be the real problem.
>
>> You can get around it by adding a fast term
>> to the denominator. Make it second order if
>> you want to avoid a direct feedthrough term.
>>
> That may work but it is a kludge.
>
>> Multiple it by something like: (wn^2)/(s^2+2*zeta*wn+wn^2)
>> where zeta is 0.707 and wn is greater than or equal to 10.
> ??
> Wouldn't a simpler a/(s+a) work? I don't use simulink but I find it
> hard to imagine that one can't enter a PID.

I usually write PID in the form:
G(s)= K. (1+s/w_i)/(s/w_i) . (1+s.a/w_m)/(1+s/(a.w_m)),
where a>1 and w_i<w_m/a.

I may augment this with a low pass filter s.t. G_filtered(s)= G(s) .
1/(1+s/w_f),
where w_f>a.w_m.

This form avoids the problem.

Matt

>
> Peter Nachtwey

jeremy...@gmail.com

unread,
Nov 6, 2008, 4:56:00 PM11/6/08
to

Infact (s^2+s+1) / s is a PID controller. I managed to implement the
PID using an integrator and a derivate block from the continous block
set in simulink but I found it strange that I couldn't do it using the
'transfer function' block. This transfer function block accepts TF's
having denominators having higher powers than numeratos only. Now
since I implemented the PID by summing the P, I and D and I had no
problems with the simulation I cannot understand why there is a
'causality' issue with using the TF block and place (s^2+s+1) / s in
it.

Matt, I would appreciate you elaborate on the impulse response having
infinite energy and the TF not being 'proper', I don't get it.

>
> I usually write PID in the form:
> G(s)= K. (1+s/w_i)/(s/w_i) . (1+s.a/w_m)/(1+s/(a.w_m)),
> where a>1 and w_i<w_m/a.
>
> I may augment this with a low pass filter s.t. G_filtered(s)= G(s) .
> 1/(1+s/w_f),
> where w_f>a.w_m.

I juggled a bit with this form and I could get to three terms, two of
which I could tell they were the P and I, while the D term had the
form s^2+s.a.w_m in denominator. Is this the derivative term? Any more
information on this expression would be very helpful.


Thanks
Jeremy

mat

unread,
Nov 6, 2008, 9:08:30 PM11/6/08
to
jeremy...@gmail.com a écrit :

The form I use is well suited for frequency design. I am not able to
design a PID with the form usually used (Kp+Ki/s+Kd*s) as I do not fully
understand it (or only with Ziegler Nichols tuning rules).
This approach is mainly due to Bode.

The method I use is (very basically):
- fix an open loop cross gain frequency w_cg. This frequency is related
with the rapidity (plot step response for different values).
- w_i is related with static behaviour. The integral part (in both
forms) permits to annulate static error: you thus only need this part at
low frequencies! (plot (1+s/w_i)/(s/w_i) Bode diagrams). The higher w_i,
the better disturbance rejection you obtain (e.g. step response of
1/(1+OpenLoop). The problem is that using such an integrator will lead
to a lower phase margin M_p (M_p=arg(OpenLoop(w_cg)+180deg). This phase
margin is related with stability and overshoot (for a given overshoot,
report the phase margin of a second order system). This problem can be
handled using a lead-lag.
- Fix w_m = w_cg and calculate "a" such that "(1+s/w_i)/(s/w_i) .
(1+s.a/w_m)/(1+s/(a.w_m)) . Plant(s)" has the desired phase at w_cg.
- Finally calculate K such that the open loop gain is 1 at w_cg.

You should obtain at desired frequency w_cg: open loop gain = 1, open
loop phase = desired M_p - 180, and open loop phase at low frequency =
-90 deg.

The problem with simulink may comes from the way simulink deals with
transfer functions. It may convert them (I do not know) into state space
form and this form does not exist for non proper systems. Here is what
they say about this problem:
http://www.mathworks.com/support/solutions/data/1-VPJDU.html?product=CT&solution=1-VPJDU

Considering non proper system, you would obtain for discrete TF:
o_k= o_(k-m)+...+o_(k-1) + i_(k-n)+...+i_(k)+ i_(k+1)
o_k being output at time k.T (T being the sampling period) and i_k being
input at time k.T. The term i_(k+1) refers to the future (present time +
T) which means the system is non causal (in real world, output is due
to past or present inputs ONLY).
For continous TF, causality is not the problem, whereas constraint on
numerator and denominator orders is the same in both cases. "A system
with TF G(s) is proper" means that gain(G(jw))<inf when w tends to inf.

Matt


>
>
> Thanks
> Jeremy

mat

unread,
Nov 7, 2008, 11:27:32 AM11/7/08
to
mat a écrit :

(* sorry for this *)
o_k= a_(k-m).o_(k-m)+...+a_(k-1).o_(k-1) +
b_(k-n).i_(k-n)+...+b_(k).i_(k)+ b_(k+1).i_(k+1)
a_ and b_ being associated coefficients,

fred....@gmail.com

unread,
Nov 7, 2008, 5:39:11 PM11/7/08
to
On Nov 7, 9:27 am, mat <mat.newsgr...@gmail.com> wrote:
> mat a écrit :
>
>
>
> > jeremysce...@gmail.com a écrit :
> >http://www.mathworks.com/support/solutions/data/1-VPJDU.html?product=...

>
> > Considering non proper system, you would obtain for discrete TF:
>
> (* sorry for this *)
> o_k= a_(k-m).o_(k-m)+...+a_(k-1).o_(k-1) +
> b_(k-n).i_(k-n)+...+b_(k).i_(k)+ b_(k+1).i_(k+1)
> a_ and b_ being associated coefficients,
>
> > o_k being output at time k.T (T being the sampling period) and i_k being
> > input at time k.T. The term i_(k+1) refers to the future (present time +
> >   T) which means the system is non causal (in real world, output is due
> > to past or present inputs ONLY).
> > For continous TF, causality is not the problem, whereas constraint on
> > numerator and denominator orders is the same in both cases. "A system
> > with TF G(s) is proper" means that gain(G(jw))<inf when w tends to inf.
>
> > Matt
>
> >> Thanks
> >> Jeremy

The "pole excess" is negative, which means that if you draw the Bode
plot it keeps climbing with frequency, so such a system is not
physically realisable (it's not strictly proper, for example) and it
can only be approximated over a range of frequencies. All physical
sytems have a pole excess otherwise infinite energy will be involved

fred

qfuf...@gmail.com

unread,
Nov 11, 2008, 3:46:07 PM11/11/08
to

In your case, omega is 1, zeta is 0.5 in the numerator. If you add an
extra pole at a very small time constant 0.0001 for example (high
frequency), you can simulate it. But... the system will go unstable.

This is related to the PID problem and its noisy nature I talk about
in the following application note:

http://www.simapp.com/simulation-tutorials.php

Peter Way

0 new messages