Modeling Question on 1st & 3rd order exponential smooth

This forum is for discussion of topics related to System Dynamics. You must be logged in to post but anyone who has registered on the System Dynamics web submission system may post. Note that there may be a delay of a working day or two after registering before you can post anything.

Modeling Question on 1st & 3rd order exponential smooth

Postby Sangdon Lee » Tue Aug 02, 2011 10:19 am

Dear All,

I developed a very simple SD model (using iThink) to demonstrate how perception delay combined with quick action cause instability in a feedback system: i.e., long perception delay (“time to perceive”) coupled with quick action (“time to adjust”) cause instability.

I found that the model (“output) is either stable or unstable whether the first or third order exponential smoothing functions are used for the perceived output. If the “perceived output” is modeled using the first order exponential smoothing, the output is stable (SMTH1). However, the output is unstable if the third order exponential smoothing (SMTH3) is used.

I appreciate any comments about the model below. I'm sorry I could not attach the model below because this forum doesn't allow ithink file attached. I believe that this model is very simple and it won't take more than 1 minute to build.

Thanks.

Sangdon Lee, Ph.D.,
GM Tech. Center,

Here is the model in iThink:

Output(t) = Output(t - dt) + (Adjust_Output) * dt
INIT Output = 0

INFLOWS:
Adjust_Output = Error/Time_to_adjust
Desired_Output = STEP(5,1)
Error = Desired_Output-Perceived_Output
Perceived_Output = SMTHN(Output, Time_to_perceive, SMTH_Nth, 0)

SMTH_Nth = 3 {3=for third order delay}
Time_to_adjust = 1
Time_to_perceive = 4

Comments:
- Simulation duration: 0 to 40 days, 4th order Runge-Kutta method.
- SMTHN is an iThink command for the n-th order exponential smoothing, which is specified by the value of “SMTH_Nth” in the model above. The value of one or three for “SMTH_Nth” is for first order or third order exponential smoothing, respectively.
-
Sangdon Lee
 
Posts: 9
Joined: Wed Jul 22, 2009 7:28 am

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Thomas Fiddaman » Tue Aug 02, 2011 3:20 pm

For Euler integration, this should not be unstable unless the combination of time step (DT) and delay order and duration is such that the duration of an individual delay stage (=time_to_perceive/SMTH_Nth) is shorter than the time step. For RK4, you can get away with more, though it's probably still reasonable to observe the Euler rule of thumb (that time step should be less than half the shortest delay). So, without replicating your exact model, it's not immediately clear to me what the problem is.

This model may provide some useful input:
http://models.metasd.com/delay-sandbox/

Tom
Thomas Fiddaman
 
Posts: 145
Joined: Thu Jan 15, 2009 6:55 pm
Location: Bozeman, MT

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Robert Eberlein » Wed Aug 03, 2011 5:32 am

Hi Sangdon,

the easiest way to think about this is probably to look at a pure harmonic oscillator. The equations for this are

dy/dt = -x*K1
dx/dt = y*K2

If you use a first order smooth your equations are

dy/dt = -x*K1
dx/dt = (y-x) *K2 = y*K2 - x*K2

That is, you have a pure harmonic oscillator, with a K2 as a drag coefficient. Such a system will always converge unless the drag coefficient is negative or you have integration issues such as Tom described.

When you add two additional levels between y and x you increase what, in engineering terms, is called the phase lag. The larger the phase lag, the greater the instability in this type of system. For some parameter values (K1 and K2 above both positive) a third order delay will indeed lead to sustained or growing oscillations.

I am actually not completely sure what your question was, but hopefully that is helpful in understanding the difference in behavior.
Robert Eberlein
Site Admin
 
Posts: 176
Joined: Sat Dec 27, 2008 8:09 pm

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Sangdon Lee » Wed Aug 03, 2011 10:06 am

Hi Tom and Robert,

Thanks for your reply.

I checked my model with various delta times and the instability was not caused by DT. I used RK4 with time step of 0.015625.

My problem was that if the first order exponential smoothing function (SMTH1) is used, the “output” is stable: the output oscillates but reaches to a steady state eventually. However, if the 3rd order exponential smoothing function (SMTH3) is used, the output shows “growing” oscillation and thus unstable. A choice of smoothing fuctions, SMTH1 or SMTH3, causes completely different behavior.

I was quite surprised to see that there are considerable differences in behaviour between the first and third order smoothing functions: either a system reaches to a steady state or blows up. From now on, I guess I have to make sure that the behaviour of a system is not caused by a choice of either smth1 or smth3 functions.

Thanks again,

Sangdon Lee
Sangdon Lee
 
Posts: 9
Joined: Wed Jul 22, 2009 7:28 am

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Robert Eberlein » Thu Aug 04, 2011 5:36 am

Just to clarify a first order exponential smooth corresponds to the second set of equations I gave, and the drag coefficient is 1/Time_to_perceive in this case. This is why the shorter the time to perceive the more damped the system is.

A SMOOTH3 introduces two additional levels for the perception delay and the rule of thumb is that the higher order the delay the less stable the system. You should definitely take this to heart.

To get intuition for this consider a discrete delay which is the same as the limit to adding more and more levels to the smooth process (limit as SMTH_Nth approaches infinity in your notation). In this case the perception will always be the way the system was some time ago. If that perception is above target things will be pushed down till a future time when the perception hits target. At that point the actual system will be well below target since, outside of the equilibrium point, we will always be pushing down till after the system state has passed the target. This means that no matter how short the time to perceive is you will get diverging oscillations.

Order matters!
Robert Eberlein
Site Admin
 
Posts: 176
Joined: Sat Dec 27, 2008 8:09 pm

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Robert Eberlein » Fri Aug 05, 2011 5:18 am

A correction on my previous post. Even with an infinite order delay you will still see areas of diverging and converging oscillation. And my argument about why you would see diverging oscillation really only leads to the conclusion that you will see oscillation.

What is true is that the higher order the delay, the shorter the perception time needs to be relative to the action time to prevent growing oscillation.
Robert Eberlein
Site Admin
 
Posts: 176
Joined: Sat Dec 27, 2008 8:09 pm

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Thomas Fiddaman » Fri Aug 05, 2011 12:19 pm

In reading the equations, I missed the outer feedback loop correcting output, so I assumed that this was essentially a chain of delays driven by a step, which wouldn't oscillate except as an artifact of integration error. I see now that that's not the case, so Bob's explanation is more useful. This seems like a good argument for graphical representation of equations.

I think of this kind of situation as analogous to taking a shower in an unfamiliar hotel. The SMOOTHN is the high-order delay between the shower valve and the temperature perceived by the showerer. Instinct says to adjust the temperature towards a comfortable goal as fast as possible (short time_to_adjust), but if one is too aggressive, oscillations result - step in; water's too cold; crank up the hot water; after a few seconds it's too cold; turn it back down ... Adjusting a shower is harder than adjusting a sink, because the pipeline delay is longer.
Thomas Fiddaman
 
Posts: 145
Joined: Thu Jan 15, 2009 6:55 pm
Location: Bozeman, MT

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Sangdon Lee » Fri Aug 05, 2011 2:42 pm

Tom and Robert,

Thanks for your comments.

When I re-modeled the SMTHN function as a “stock” and “flow” diagram, I immediately realize that the SMTHN is an n-th order ordinary differential equation (SMTH1 is a first order ODE and SMTH3 is a third order ODE). Thus, the posted SD model above is a second order ODE if SMTH1 is used (there are two stocks: “output” and “perceived output”). If SMTH3 is used, then the posted SD model is a fourth order ODE. Certainly, second order and fourth order SD models will behave differently! As Robert said, “Order matters!”

I also realize that the posted SD model is very similar in structure as a spring-mass-damper system (2nd order ODE) if SMTH1 is expressed as a stock and flow. By the way, I'm assembling three SD models to demonstrate "structure determines behavior" Prey & predator model, spring-mass-damper model, & love dynamics model between Romeo and Juliet are all second order ODE and show similar "structure". The SD model above, (I call the perception and action model), will be another example. Do you know any other examples?

Thanks again.

Sangdon Lee
Sangdon Lee
 
Posts: 9
Joined: Wed Jul 22, 2009 7:28 am

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Thomas Fiddaman » Fri Aug 05, 2011 3:11 pm

Dennis Meadows' commodity models are another example of oscillators: http://models.metasd.com/the-dynamics-of-commodity-production-cycles/

Tom
Thomas Fiddaman
 
Posts: 145
Joined: Thu Jan 15, 2009 6:55 pm
Location: Bozeman, MT

Re: Modeling Question on 1st & 3rd order exponential smooth

Postby Eliot Rich » Sun Aug 07, 2011 9:30 am

Following Tom's observation I've modeled the problem in Vensim (attached). Synthsim may be used to see the effects of higher order smooths and changes in time constants. It certainly helped me understand your ideas.

Thank you for this discussion thread and your review of its implications.

Regards,



Eliot
Attachments
smoothNTest.rar
(9.39 KiB) Downloaded 115 times
Eliot Rich
 
Posts: 18
Joined: Mon Jan 12, 2009 3:39 pm
Location: University at Albany, SUNY

Next

Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron