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).
Why does the level variable smooth demand product not use the initial value?
I hope you can help me.
Thanks!
Smooth and initial value
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Smooth and initial value
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Smooth and initial value
Small examples like the attached one works also fine. But when doing the same in my huge simulation model, the wrong calculations occur.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Smooth and initial value
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Smooth and initial value
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.
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.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Smooth and initial value
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?
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Smooth and initial value
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:
Also, be sure to show warnings (Tools>Options>Settings>Show Warnings). The issue is being flagged here:
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
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.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/