Dear All,
i have a question about how can i calculate the result of simulation by numbers of week. for example, in sample model (as attached), i simulate the model resulting rainfall pattern over 1000 weeks. what i want to do is to calculate the number of weeks for the rainfall which has more than 0.02. i expect that it should be some weeks out of 1000 weeks (total weeks on simulation).
is there any mechanism on the model to get this result? or do i have to do it manually? let's say, i export the result to the excel and calculate it in excel rather than in vensim.
thanks,
calculating number of weeks on the model's results
calculating number of weeks on the model's results
- Attachments
-
- sample.mdl
- (1.19 KiB) Downloaded 533 times
-
- Super Administrator
- Posts: 4844
- Joined: Wed Mar 05, 2003 3:10 am
Re: calculating number of weeks on the model's results
Use the Integ function, see the attached model.
- Attachments
-
- sample.mdl
- (1.91 KiB) Downloaded 650 times
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: calculating number of weeks on the model's results
Note that INTEG lags by one TIME STEP, so if there's a (rainfall>threshold) event in the last time step, it won't be counted. Normally this is not a problem. However, if you need to count the last time step too, you can modify the model to report the stock, plus the current value of the flag.
It may be convenient to put this in a macro, e.g.
:MACRO: COUNTEVENTS( flag )
cumCount = INTEG(flag/TIME STEP$,0) ~flag~|
COUNTEVENTS = cumCount+flag ~flag~|
:END OF MACRO:
It may be convenient to put this in a macro, e.g.
:MACRO: COUNTEVENTS( flag )
cumCount = INTEG(flag/TIME STEP$,0) ~flag~|
COUNTEVENTS = cumCount+flag ~flag~|
:END OF MACRO:
/*
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: calculating number of weeks on the model's results
Thanks tony and tom for your suggestion.
i apply tony's mechanism in my model. it is working. and i think, the mechanism also count the last time step.
But, i still have no idea in applying tom's suggestion in my model. i tried to look for :MACRO: function in vensim, but i did not find it. can you give me more explanation?
many thanks,
i apply tony's mechanism in my model. it is working. and i think, the mechanism also count the last time step.
But, i still have no idea in applying tom's suggestion in my model. i tried to look for :MACRO: function in vensim, but i did not find it. can you give me more explanation?
many thanks,
Re: calculating number of weeks on the model's results
Macros are defined in the text editor - see the help system, e.g. http://www.vensim.com/documentation/ind ... ?22145.htm
No macros in PLE.
Tom
No macros in PLE.
Tom
/*
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
*/