Hi,
I recently switched my integration technique on an hourly simulation to RK2Auto. After looking more closely at the impacts on the model, I found significant errors. I understand that the RK methods are basically midpoint Euler steps, but I wonder why they are forcing a delay in integration within Vensim. Here is a very simple stock and flow. When the dimensionless value is above 0.88, then there is no inflow. When the dimensionless value is equal to or less than 0.88, it should immediately take in stock.
Shown:
Current - Euler
Current2 - RK2Auto
Current3 - RK2Fixed
Can someone attempt a brief explanation on why this is impacting the actual behavior at timesteps? I have always thought, much like PDEs, these are supposed to take the midpoint integration at time X and then report the output at time X, rather than performing the midpoint integration at time X then reporting the output at time X+n. It seems I need to switch back to Euler, despite the inaccuracies, just to get the correct behavior at the time conditional statements are meant to integrate different inputs.
Integration techniques: Impacts on Stock behavior
-
- Senior Member
- Posts: 53
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Integration techniques: Impacts on Stock behavior
It's impossible to offer any advice without a model to look at.
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
-
- Senior Member
- Posts: 53
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Integration techniques: Impacts on Stock behavior
I am not sure that this is impossible to answer. I am not asking anything about my model. Rather, why are the different integration techniques not affecting behavior at the same time step? The signal is entirely the same, offering a control which indicates the only problems are the integration techniques.
-
- Senior Member
- Posts: 104
- Joined: Sun Oct 21, 2018 7:09 am
- Vensim version: DSS
Re: Integration techniques: Impacts on Stock behavior
I think RK methods calculate intermediate points and evaluate the function at these points before determining the state at the next timestep. If the threshold condition changes within a timestep, RK might miss the exact point of change because it's looking at the function at intermediate points (not necessarily where the condition changes), which can introduce a delay. RK2Auto shows a different behavior compared to RK2Fixed because the former dynamically adjusts the dt. You could have provided more details to get a more accurate response.
-
- Senior Member
- Posts: 53
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Integration techniques: Impacts on Stock behavior
Thank you for the answer. It seems you understood quite clearly what I was asking.
Re: Integration techniques: Impacts on Stock behavior
I think Aliakhavan89 is on the right track. However, it's impossible to give a precise answer without more information than the chart provides. What are the TIME STEP and SAVEPER? Presumably 12000 hours from eyeballing the chart? What is the equation for end use efficiency? A step * exponential? Or a stock with a pulse input and a first order outflow?
Some functions, like STEP and PULSE and DELAY FIXED, don't change within RK subintervals, which could affect behavior.
Some functions, like STEP and PULSE and DELAY FIXED, don't change within RK subintervals, which could affect behavior.
/*
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
*/