Is energyplus not respecting time delta in this step-by-step simulation?

asked 2021-05-10 09:42:58 -0500

cgr's avatar

updated 2021-05-10 10:21:14 -0500


I'm trying to run a step by step simulation in energyplus using pyFMI with some input and output variables, using the EnergyplusToFMU export tool. In order to debug my code I added the variables below to check the datetimes in the simulation. I have set a time delta of 10 min for synchronization, both in the idf file and in the pyFMI model - 600 seconds.

Current Time,
Averaged, ! Type of Data in Variable
ZoneTimeStep; ! Update Frequency

Current Time,

After calling initialize(), I see that the first value of CurrentTime is 0, which makes sense because it starts at midnight, but then the next timestep - after calling doStep() - I get that CurrentTime is 24.0 - the end of the day in one step? Then subsequent calls to doStep() return: 0.183333333, 0.35714285, 0.52380952 ... it looks like the 10 min delta is not respected. Meanwhile, if I check the model.time it does work as expected: initial time is 00:00, then it increases by 10 min on each call.

For reference, I'm using energyplus 8.9, and ran the FMU export as Co-Simulation v20. According to, I understand that the CurrentTime EMS variable should match the result from modulus(model.time, 24*3600) / 3600, that is, the seconds in a given day expressed as hours.

Is it possible that the variable is not reported correctly? Or is energyplus really doing those variable steps? I'm a bit confused about this. I also added logging for the direct normal radiation, month, day, hour and minute coming from energyplus and it seems like energyplus is really doing those steps - those variables seem to agree with the info from the weather file.

Thank you beforehand!

Update: It seems that not only the CurrentTime is wrong, this is a log of the model.time, Month, DayOfMonth, Hour, Minute (EMS variables), Diffuse Horizontal Radiation, and Direct Normal Radiation (regular Output variables), respectively, as reported by the model:

DEBUG:07-23 10:40:00 [7.]-[23.] [10.]:[31.42857143], diffuse: [330.66666667], direct: [276.83333333]
DEBUG:07-23 10:50:00 [7.]-[23.] [10.]:[41.11111111], diffuse: [322.33333333], direct: [316.66666667]
DEBUG:07-23 11:00:00 [7.]-[23.] [10.]:[51.], diffuse: [314.], direct: [356.5]
DEBUG:07-23 11:10:00 [7.]-[23.] [11.]:[1.], diffuse: [305.66666667], direct: [396.33333333]
DEBUG:07-23 11:20:00 [7.]-[23.] [11.]:[11.42857143], diffuse: [297.33333333], direct: [436.16666667]
DEBUG:07-23 11:30:00 [7.]-[23.] [11.]:[21.42857143], diffuse: [289.], direct: [476.]
DEBUG:07-23 11:40:00 [7.]-[23.] [11.]:[31.11111111], diffuse: [286.], direct: [495.33333333]
DEBUG:07-23 11:50:00 [7.]-[23.] [11.]:[41.11111111], diffuse: [283.], direct: [514.66666667]
DEBUG:07-23 12:00:00 [7.]-[23.] [11.]:[51.42857143], diffuse: [280.], direct: [534.]
DEBUG:07-23 12:10:00 [7.]-[23.] [11.]:[51.42857143], diffuse: [280.], direct: [534.]
DEBUG:07-23 12:20:00 [7.]-[23.] [11.]:[51.42857143], diffuse ...
edit retag flag offensive close merge delete


Could you share the python code you are using to drive the FMU? Also, did you look at the csv results file generated by the EnergyPlus FMU? Are the reported times/values incorrect as well?

Thierry Nouidui's avatar Thierry Nouidui  ( 2021-05-17 06:29:15 -0500 )edit

Thank your for the response! I looked at the csv results for the CurrentTime variable and it seems to be reporting always 0, it's a bit confusing. I decided not to rely on this value, and instead I use the timesteps from the FMU, which seem correct.

Other than that, I realized another error was causing the simulation to fail, and I was caching the results at each timestep, so that's why I was seeing repeated values from a certain point on.

cgr's avatar cgr  ( 2021-06-02 07:46:51 -0500 )edit