Closed yuwash closed 6 years ago
The timer in pyCity only counts the number of hours (if you use timeDescretization = 3600). In https://github.com/RWTH-EBC/CloudEM/blob/master/cloudem/functions/fmu_handling/FMUHandling.py I wrote a function ('timer_to_datetime(timer=None):') to convert the current_timestep to a datetime object (Year is hard coded in this function to 2016). Maybe this helps you?
Thanks, that's great, I was using timedelta(seconds=timer.currentTimestep*3600/timer.timeDiscretization)
not knowing you can set non-integers as days like that.
EDIT: it probably should've been timedelta(seconds=timer.currentTimestep*timer.timeDiscretization)
For the general case then it's then probably:
timedelta(timer.currentTimestep*timer.timeDiscretization/24./3600.)
I guess this issue can be closed. Otherwise, please reopen it.
For day, you can just use the
currentDay
attribute that is set on every update, but for the time one needs to interpret thecurrentTimestep
. When looking at howcurrentDay
is updated at Timer.py#L72:Though
timeDiscretization
is described as "A value of 3600 corresponds to one hour.", so it seems to be the length of timesteps measured in seconds, this calculation rather looks like it is the number of timesteps within an hour. I'd appreciate any clarification of it.It would be probably very useful if it had a method to get elapsed seconds (either total or within the day).