fixed step solver vs. system time constant

Translate This Thread From English to

Threaded View


All,

I'm trying to implement a PID control scheme for a plant that has an
extremely slow time constant (1.25 seconds).  I'm running the
simulation using Simulink's "fixed step" solver with a "fixed step
size" of 1ms to mimic the 1 kHz processing speed of the digital
controller.

The strange thing is that I cannot get the system to stabilize by
tuning the PID gains at a step size of 1ms...however, when I slow down
the controller loop time by increasing the fixed step size to 8ms, I
can easiy maintain system stability with PID control.  Am I doing
something wrong...the faster step size should make controlling the
system easier??  Any help/suggestions is appreciated.

Thanks in advance,
-weg

Re: fixed step solver vs. system time constant



weg22@drexel.edu wrote:

Unless the tuning constants are proportional to the update
time (with 8ms update tuning multiplying all time constants
by 8, compared to 1ms update time), the only factor I can
think of that might have this effect is rounding errors from
too few bits representing the PID process (especially the
integral term).

--
Regards,

John Popelish

Re: fixed step solver vs. system time constant



John Popelish wrote:

Ditto.  If you're doing the simulation all in double-precision floating
point it's hard to imagine that this would happen, but if you're doing
the simulation with 16-bit integers you're probably losing 10 bits just
to the itty bitty integrator gain.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html

Re: fixed step solver vs. system time constant




You're saying that the tuning constants SHOULD BE PROPORTIONAL to the
update rate in order to get the same effect, right?  That's how I have
it...so in other words if:

1ms deltaT, error rate=1/ms => error=1...[Kp=8; Ki=0; Kd=0;]...=
then
output will be 8.
8ms deltaT, error rate=1/ms => error=8...[Kp=1; Ki=0; Kd=0;]...=
then
output will be 8.

therefore, it must be a rounding error.  How do I specify double
precision in Simulink?

Re: fixed step solver vs. system time constant



On Jul 17, 3:43 pm, we...@drexel.edu wrote:


Sorry, no.  Only the time dependent constants are corrected for sample
interval.  The proportional term is time independent, so it is
unchanged as you change sample time.

--
Regards,

John Popelish

Re: fixed step solver vs. system time constant



On Jul 17, 12:43 pm, we...@drexel.edu wrote:

No,  The sample interval T does not affect the proportional gain
significantly when sampling at these rates but you can see that Ki*T
could very small and get rounded down to 0.

CO(n)=CO(n-1)+Ki*T*error(n)+Kp*(error(n)-error(n-1);

The sample interval T also affects derivative gain term but usually
this term tends to saturate or overflow.

Peter Nachtwey

Re: fixed step solver vs. system time constant



On Jul 17, 3:43 pm, we...@drexel.edu wrote:

double precision is the default

In any case, you probably shouldn't be using a fixed step solver.  Use
a variable step solver to better represent an analog plant.  Then use
a discrete controller with zero order holds.

When you use your discrete controller the simulink blocks show their
sample time dependence as the variable T.

Re: fixed step solver vs. system time constant



wrote:

If that is so I can't see why there would be a problem.


What about the PID that runs at fixed intervals?

Peter Nachtwey

Re: fixed step solver vs. system time constant




I am missing your question.  You quote where I suggest using a
discrete controller in combination with zero order holds.  Then you
ask about using a discrete PID???

Re: fixed step solver vs. system time constant



wrote:

It makes sense to calculate the system response and the PID
synchronously using fixed intervals.  If you update the system
response with variable step solver the system response will not be
updated at the same time as the PID.  What values to you use then for
the PID?  Most variable step ODE solvers that use variable steps use
cubic interpolation to find the points in between.  This can't be done
when a PID is also affecting response of the system.   One could
combine the PID and the system and solve for the closed loop system
together but then things like input resolution, output resolution and
output saturation are ignored.  Not good.

Peter Nachtwey

Re: fixed step solver vs. system time constant




I don't know the specifics, but you can find out for yourself on
Simulink's webpage I am sure.

Variable step solvers are better for analog plants because higher
order dynamics are represented to your desired level of accuracy.  If
there is any aliasing or other effects, it would likely show up.

A discrete controller is better because you are actually implementing
a discrete controller.

When I run a SIMULINK model that contains both an analog plant and
discrete controller with a variable step solver, both are generally
represented sufficiently with no additional user input.  Your question
of which ODE solver is in use will be in the simulink help files.  The
default solver is ode45 (Dormand-Prince).

All signals are solved for at the sample times.  Also, the system
response updates several times in between the sample times.
(Actually, the discrete controller also updates throughout each sample
time, but it is the same value throughout each sample time.)

Site Timeline