Smooth and initial value

Use this forum to post Vensim related questions.
Post Reply
Sandra
Junior Member
Posts: 9
Joined: Mon Aug 29, 2016 12:41 pm
Vensim version: DSS

Smooth and initial value

Post by Sandra »

Hi,
I have an auxiliary variable in my Vensim (DSS 7.2.) model named demand product.
My aim was to generate following variable:

smooth demand product = SMOOTH(demand product, 1)

I also tried:

smooth demand product = INTEG((demand product - smooth demand product), demand product)

The problem with both expressions is, that the initial value of smooth demand product is different from demand product (see figure).
vensimproblem.png
vensimproblem.png (20.98 KiB) Viewed 3342 times

Why does the level variable smooth demand product not use the initial value?

I hope you can help me.
Thanks!
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Smooth and initial value

Post by Administrator »

Can you upload an example? My quick test here works exactly as I expect it to.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Sandra
Junior Member
Posts: 9
Joined: Mon Aug 29, 2016 12:41 pm
Vensim version: DSS

Re: Smooth and initial value

Post by Sandra »

Small examples like the attached one works also fine. But when doing the same in my huge simulation model, the wrong calculations occur.
SmallExample.mdl
(3.58 KiB) Downloaded 230 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Smooth and initial value

Post by Administrator »

I need an example that doesn't work in order to help you.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Sandra
Junior Member
Posts: 9
Joined: Mon Aug 29, 2016 12:41 pm
Vensim version: DSS

Re: Smooth and initial value

Post by Sandra »

Oh, I think I found the problematic variable.
In the huge model, I used "demand per capita" as an auxiliary with initial.
I did the same now in the small example (attached). Indicated demand and desired demand show the problem described in the first post.
SmallExampleProblemFound.mdl
(4.25 KiB) Downloaded 238 times
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Smooth and initial value

Post by Administrator »

ok. The active initial is causing the smooth to initialize with the "1", which is working correctly but very misleading.I'll raise this as a bug.

If you use the following, does it give you the answers you need?

Code: Select all

demand per capita = if then else ( Time = INITIAL TIME  , 1 , 
MIN( max per capita demand , 

   constant term * 
   power( GDP,income elasticity )  * 
   power( price, price elasticity )
) )
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Smooth and initial value

Post by tomfid »

This doesn't seem like a bug to me; it's just that ACTIVE INITIAL is potentially treacherous. A fix would have to defeat the purpose of the function.

One thing you can do to debug things like this is to switch to the Diff integration method, which stores the initialization step. Then you can see the discontinuity:

Code: Select all

Time (Month)	0	0.03125	0.0625	0.09375	0.125	
"demand per capita" and its causes Runs:	Current	
demand per capita	1	.05419	.05413	.05407	.05402	
constant term	.01871	
GDP	--	4442	4443	4444	4444	
income elasticity	.2145	
max per capita demand	.06	
price	--	200	201.6	203.1	204.7	
price elasticity	-.1393	
Also, be sure to show warnings (Tools>Options>Settings>Show Warnings). The issue is being flagged here:

Code: Select all

WARNING:     ACTIVE INITIAL differences found.  Use Options>Setting to control reporting.    
WARNING:     -demand per capita- Initial=1 Active=0.0541873 has changed in value.    
WARNING:     -indicated demand- Initial=1.62e+08 Active=8.77834e+06 has changed in value.    
Post Reply