SDXorg / pysd

System Dynamics Modeling in Python
http://pysd.readthedocs.org/
MIT License
376 stars 88 forks source link

Inconsistency by using return_timestamps on model.run(...) #354

Closed lagamura closed 2 years ago

lagamura commented 2 years ago

Description of issue: using of model.run(..., return_timestamps = (0, X) ) returns results only for X time value, instead running model.run(...) without any timestamps returns a dataframe with the zero interval

Expected behavior: model.run(..., return_timestamps = (0, X) ) returns also the zero interval

enekomartinmartinez commented 2 years ago

Hi @lagamura I am checking with the test models we have in the repository and 0 is returned

>>> import pysd
>>> model = pysd.read_vensim("teacup.mdl")
>>> model.run(return_timestamps=(0, 3))
   FINAL TIME  INITIAL TIME  SAVEPER  ...  Heat Loss to Room  Room Temperature  Teacup Temperature
0           3             0    0.125  ...          11.000000                70          180.000000
3           3             0    0.125  ...           8.133607                70          151.336071

Note that if the initial time of your model is bigger than 0 then 0 could not be in the return timestamps. Can you please provide an example model where this happens?

lagamura commented 2 years ago

Thanks for the quick reply, unfortunately i was passing wrongly the values.

enekomartinmartinez commented 2 years ago

You are welcome! :)