Hi,
I have a variable in my vensim model , “Range”, that changes over time according to the “Fuel efficiency” value. The equations defined for the involved variables are:
Range t=1200+(1200*Fuel efficiency t)*(Time-2013)
Fuel efficiency t=IF THEN ELSE (“DIF final diesel price t”>0 :OR: “DIF final gasoline price t”>0,0.021,0.0021)
“DIF final diesel price t”=”final diesel price t”-“final diesel price t-1”
“DIF final gasoline price t”=”final gasoline price t”-“final gasoline pricet-1”
With “final diesel price t-1” and “final gasoline pricet-1” being delay variables (DELAY1)
The problem is that when the fuel efficiency value changes (for instance from 0.021 to 0.0021) the model does not compute the range over the last range value but over the value in the first year of simulation, namely 1200.
How can I change the equation of range so the model computes the range values over the “range t-1” value and not over range in the first year?
Thanks!
G
Equation definition
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Equation definition
Can you upload the model rather than give the equations? To see what is going on, we'll need to create the model from your equations (which will take time and likely not be the same as your model).
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
Modeling vehicle range - equations definiton
Hi,
I have a variable in my model , “Range”, that changes over time according to the “Fuel efficiency” value. The equations defined for the involved variables are:
Range t=1200+(1200*Fuel efficiency t)*(Time-2013)
Fuel efficiency t=IF THEN ELSE (“DIF final diesel price t”>0 :OR: “DIF final gasoline price t”>0,0.021,0.0021)
“DIF final diesel price t”=”final diesel price t”-“final diesel price t-1”
“DIF final gasoline price t”=”final gasoline price t”-“final gasoline pricet-1”
With “final diesel price t-1” and “final gasoline pricet-1” being delay variables (DELAY1)
The problem is that when the fuel efficiency value changes (for instance from 0.021 to 0.0021) the model does not compute the range over the last range value but over the value in the first year of simulation, namely 1200. How can I change the equation of range so the model computes the range values over the “range t-1” value and not over range in the first year?
Thanks!
G
I have a variable in my model , “Range”, that changes over time according to the “Fuel efficiency” value. The equations defined for the involved variables are:
Range t=1200+(1200*Fuel efficiency t)*(Time-2013)
Fuel efficiency t=IF THEN ELSE (“DIF final diesel price t”>0 :OR: “DIF final gasoline price t”>0,0.021,0.0021)
“DIF final diesel price t”=”final diesel price t”-“final diesel price t-1”
“DIF final gasoline price t”=”final gasoline price t”-“final gasoline pricet-1”
With “final diesel price t-1” and “final gasoline pricet-1” being delay variables (DELAY1)
The problem is that when the fuel efficiency value changes (for instance from 0.021 to 0.0021) the model does not compute the range over the last range value but over the value in the first year of simulation, namely 1200. How can I change the equation of range so the model computes the range values over the “range t-1” value and not over range in the first year?
Thanks!
G
Re: Equation definition
What do you mean by "compute the range over the last range value" - range is an instantaneous function of efficiency the way this is written?
There seem to be some reality check violations here. If efficiency is 0, shouldn't range be 0? Can range really change instantly by a factor of 10 based on price?
Defining units would be helpful here. Embedded coefficients (like 1200, .0021) should be pulled out of the equations and made into separate constants.
Also, http://metasd.com/2017/11/discrete-time-stinks/
There seem to be some reality check violations here. If efficiency is 0, shouldn't range be 0? Can range really change instantly by a factor of 10 based on price?
Defining units would be helpful here. Embedded coefficients (like 1200, .0021) should be pulled out of the equations and made into separate constants.
Also, http://metasd.com/2017/11/discrete-time-stinks/
/*
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
*/
Re: Equation definition
Hi,
For more clarity of the problem I am sending the model attached.
G
For more clarity of the problem I am sending the model attached.
G
- Attachments
-
- System dynamics model_vehicles diffusion.mdl
- (55.9 KiB) Downloaded 162 times
Re: Equation definition
I find this pretty challenging to interpret. For example:
1. There are lots of embedded parameters - times and apparently ranges - that should be exposed as parameters and assigned units.
2. The discrete logic is hard to interpret - there are lots of hard nonlinearities from the MIN and IF functions.
3. It's very hard to tell whether the BEV ranges are continuous over time.
4. Why is the range improvement sometimes ^2 or ^10?
I'd start by banishing the discrete logic where it isn't absolutely needed. I'd guess that what you really mean here is that range is a stock that increases at a time-varying rate. Something like:
Range = INTEG( range improvement rate, initial range ) ~ Km
Range improvement rate = Range * Fractional improvement rate ~ Km/year
Fractional improvement rate = IF THEN ELSE( Time < Time 1, rate 1, IF THEN ELSE( Time < Time 2, rate 2, ... etc. ~ fraction/year
Then get your units to balance for the full model. Currently there are 76 errors.
Code: Select all
Range i[BEV]=
IF THEN ELSE (Time<=2015,160+160*Improvement of range performance 1*(Time-2013),
IF THEN ELSE(Time>2015:AND:Time<=2025,(160*(1+Improvement of range performance 1\
)^2)*(1+Improvement of range performance 2*(Time-2015)),(160*(1+Improvement of range performance 1\
)^2)*((1+Improvement of range performance 2)^10)*(1+Improvement of range performance 3\
*(Time-2025)))) ~~|
Range i[PHEV]=
Min(1400+(1400*Fuel efficiency)*(Time-2013),2200) ~~|
Range i[HEV]=
Min(1200+(1200*Fuel efficiency)*(Time-2013),1700) ~~|
Range i[Diesel]=
Min(1200+(1200*Fuel efficiency)*(Time-2013),1700) ~~|
Range i[Gasoline]=
Min(800+(800*Fuel efficiency)*(Time-2013),1200)
~ Km
~ Definition of range: range of a vehicle at a given battery size (justifying that the \
price of batteries does not increase as the range increases)
See calculation for the range improvements in excel file (based on \
Gerssen-Gondelach 2012)
2. The discrete logic is hard to interpret - there are lots of hard nonlinearities from the MIN and IF functions.
3. It's very hard to tell whether the BEV ranges are continuous over time.
4. Why is the range improvement sometimes ^2 or ^10?
I'd start by banishing the discrete logic where it isn't absolutely needed. I'd guess that what you really mean here is that range is a stock that increases at a time-varying rate. Something like:
Range = INTEG( range improvement rate, initial range ) ~ Km
Range improvement rate = Range * Fractional improvement rate ~ Km/year
Fractional improvement rate = IF THEN ELSE( Time < Time 1, rate 1, IF THEN ELSE( Time < Time 2, rate 2, ... etc. ~ fraction/year
Then get your units to balance for the full model. Currently there are 76 errors.
/*
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
*/
Re: Equation definition
Hi,
Thanks for the suggestion! It worked! This model is not finished, I still have to work on it a little bit in order to correct some problems to add the missing unit specifications.
Anyway your help was precious so thanks one more time!
G
Thanks for the suggestion! It worked! This model is not finished, I still have to work on it a little bit in order to correct some problems to add the missing unit specifications.
Anyway your help was precious so thanks one more time!
G