On 09/05/2013 13:30, Alexis EidelMan wrote:
> Just a point about duration.
> I think an user can want two different things,
> - to know the duration of a expression beeing true
> - to know duration of consecutive period the expression was true
> before the period.
> If I understand well only the latter is implemented in "duration" function.
Indeed, it is the number of consecutive periods the expression was true.
I will just add that if for some period there is no value, but there is
one in an earlier period, the expression is assumed to keep the
"earlier" value for the missing data point.
> The first one could be interesting.
Indeed, but see below.
> The documentation could also be more explicit on that point. It ;ay be a
> translation issue in my case but I still confused reading the doc.
The documentation is incomplete, but the current implementation is
rather dumb too. In fact, we do not use it ourselves for performance
reasons (it goes back in time until the expression evaluates to False
for all individuals -- which means that for most expressions, it will
get slower with each simulated period). What we do instead in our model
is to simply store the duration in a field and increment it at each
period. This way, the modellers has full control over what is being
counted (consecutive or not, etc.).
In fact, duration should really only be used in the init section when
you have historic data. Using duration during the simulation (at least
in its current implementation does not make much sense).
At some point, I might rewrite duration to add an hidden field
automatically and simply increment the value of the last period, but
that is not a top priority at the moment.
Ga�tan
----------------------------------------------------------------------------
Disclaimer: please see "
www.plan.be/disclaimer.html"
Please consider your environmental responsibility before printing this email
----------------------------------------------------------------------------