Difference integration
Difference integration
I'm trying to understand why there is a difference in Levels using difference integration in 'Simulate' and 'Game' modes.
I have these two variables set as a rate and a level,
If I run the model with the 'Simulate' command, I get these results,
And if I run the same decisions in 'Game' mode, I get these results,
You can see that, in Game mode, the level results are displaced by one week (the same as using Euler integration)
But then I made the simplest model I could to test this, which has exactly the same model settings as my full model, and this doesn't happen. In this simple test model, the outputs are the same in Simulate and Game modes.
What could cause the outputs to differ in the main model simply when the mode is changed from 'Simulate' to 'Game' but not in the simple test model?
Phill
I have these two variables set as a rate and a level,
If I run the model with the 'Simulate' command, I get these results,
And if I run the same decisions in 'Game' mode, I get these results,
You can see that, in Game mode, the level results are displaced by one week (the same as using Euler integration)
But then I made the simplest model I could to test this, which has exactly the same model settings as my full model, and this doesn't happen. In this simple test model, the outputs are the same in Simulate and Game modes.
What could cause the outputs to differ in the main model simply when the mode is changed from 'Simulate' to 'Game' but not in the simple test model?
Phill
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Difference integration
Does this explain the difference?
http://vensim.com/documentation/diff.html?q=difference
http://vensim.com/documentation/diff.html?q=difference
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: Difference integration
I ran my very basic test model in Game mode, with the same model settings, using difference integration and the results show the rate inputs and level totals in the same time period,
Re: Difference integration
Yes, I had read the documentation. There are two things I don't understand though.
1. Why are the results different in Simulate and Game modes, even though nothing else has changed.
2. Why doesn't my basic test model show the same displacement between the rate and level results, even though it uses the same model settings and rate/level structure?
1. Why are the results different in Simulate and Game modes, even though nothing else has changed.
2. Why doesn't my basic test model show the same displacement between the rate and level results, even though it uses the same model settings and rate/level structure?
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Difference integration
Game mode is different to normal simulations as the rates/levels are calculated twice at points where decisions are made (once when you stop the simulation, then again when you re-start which overwrites the end of previous turn results).
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: Difference integration
OK, thank you for your help, I did not understand that difference between Simulate and Game modes. I've set a second rate variable with a DELAY FIXED of one time step and that gives me outputs I can display that are in line with the level outputs per time step.
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Difference integration
Games are different. If you run up to say time=5, the results are stored. Make a change, and this will now potentially change the rates that the change influences (which are then stored at time=5).
Hope that makes sense.
Hope that makes sense.
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: Difference integration
Yes, that makes sense and helps a lot, thank you.
Re: Difference integration
I'm sorry to go back to this again, but using the DELAY function is throwing out my results at the end of the simulation, so it isn't a good solution.
I'm using the Vensim Linux DLL with a javascript interface to present a model of ticket sales for a event, influenced by price, price sensitivity and fluctuating demand as time passes and weather forecasts and other variables change. The user inputs price changes over time, so the model needs to run in GAME mode. My problem is, as I described before, the level values showing the cumulative ticket sales are out of step with the rate values showing ticket sales weekly. here, for example, is my output screen of values for week 3, The left-hand table shows this week's sales, from the rate variables, and the right-hand columns show the cumulative sales, but are one time step behind.
Is it possible to use a command like 'vensim_get_value' in the interface to extract the updated value of the level? From the documentation here, https://www.vensim.com/documentation/26215.html it doesn't seem likely, but I'm not completely clear.
Phill
I'm using the Vensim Linux DLL with a javascript interface to present a model of ticket sales for a event, influenced by price, price sensitivity and fluctuating demand as time passes and weather forecasts and other variables change. The user inputs price changes over time, so the model needs to run in GAME mode. My problem is, as I described before, the level values showing the cumulative ticket sales are out of step with the rate values showing ticket sales weekly. here, for example, is my output screen of values for week 3, The left-hand table shows this week's sales, from the rate variables, and the right-hand columns show the cumulative sales, but are one time step behind.
Is it possible to use a command like 'vensim_get_value' in the interface to extract the updated value of the level? From the documentation here, https://www.vensim.com/documentation/26215.html it doesn't seem likely, but I'm not completely clear.
Phill
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Difference integration
An accumulation is always delayed by a time step in Vensim. For example, today I sell x tickets, the cumulative sales will not update until the end of that time period (which will be tomorrow).
If you want to incorporate the sales at time = x into a cumulative figure, you will need to add on the rate multiplied by the time step to the actual accumulation, and report that instead.
Does this make sense?
If you want to incorporate the sales at time = x into a cumulative figure, you will need to add on the rate multiplied by the time step to the actual accumulation, and report that instead.
Does this make sense?
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: Difference integration
Do you mean in the model, or in the interface? Adding the rate to the accumulation in the interface was our fall-back solution, but I thought I ought to be able to this in the model itself.
-
- Super Administrator
- Posts: 4613
- Joined: Wed Mar 05, 2003 3:10 am
Re: Difference integration
Yes, you can do it in the model. It's better to do it in the model so you can check the units are correct.
Use something like
accumulation for reporting = accumulation + sum of rates in and out of accumulation * time step
Use something like
accumulation for reporting = accumulation + sum of rates in and out of accumulation * time step
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: Difference integration
Well, that works and solves the problem, thank you. And that welcome message, 'Units are O.K.' appears!!