NREL / EnergyPlus

EnergyPlus™ is a whole building energy simulation program that engineers, architects, and researchers use to model both energy consumption and water use in buildings.
https://energyplus.net
Other
1.15k stars 392 forks source link

Requesting the same Meter Key Name at several reporting frequencies reports wrong "Interval" in "Time" #7922

Open jmarrec opened 4 years ago

jmarrec commented 4 years ago

Issue overview

If I add this meter:

  Output:Meter:MeterFileOnly,
    Electricity:Facility,                   !- Key Name
    Daily;                                  !- Reporting Frequency

Then in the Time SQL table, I can find the TimeIndexes corresponding to the meter, and they all have an Interval value of 1440 (24 hr * 60 minute), as expected.

Now if I ALSO add the same Meter with a Reporting Frequency of "Timestep" (and assuming my Timestep is 1"), suddenly the Interval becomes 60 minutes (Timestep of 1 = 60 minutes)

Example based on 1ZoneUncontrolled.idf, added this at the end:

! Note: I also changed the Timestep to 1;

  Output:SQLite,
    SimpleAndTabular;

  ! out-ori
  Output:Meter:MeterFileOnly,
    Electricity:Facility,                   !- Key Name
    Daily;                                  !- Reporting Frequency

! UNTIL NOW, it works, fine, "Interval" is reported at 1440 (24*60 minutes) for all TimeIndex concerning this meter

! ==============================================================
! Now, if I also add this: it stops working correctly, "Interval" is reported at 60 (Timestep of 1 = 60 minutes)

  ! out-several
  Output:Meter,
    Electricity:Facility,                   !- Key Name
    Timestep;                               !- Reporting Frequency

Sql query used:

SELECT Interval FROM Time
WHERE TimeIndex IN (SELECT TimeIndex FROM ReportMeterData
        WHERE ReportMeterDataDictionaryIndex IN (SELECT ReportMeterDataDictionaryIndex FROM ReportMeterDataDictionary
                            WHERE ReportingFrequency = "Daily"
                            AND   VariableName = "Electricity:Facility"))
LIMIT 10

Is this the expected behavior? (I was assuming no, but maybe it is)

Context

I'm investigating an issue with a Calibration reporting measure in OpenStudio 3.0.0. It worked fine on 2.9.1 (E+ 9.2.0), and it's failing on 3.0.0 (E+ 9.3.0)

Similar to https://github.com/NREL/OpenStudio/issues/1692 which led to ttps://github.com/NREL/EnergyPlus/issues/4979

I have tested the above in 9.3.0, but also on 9.2.0, and 9.2.0 behaves the same way, so it's not a regression per say.

Details

Some additional details for this issue (if relevant):

Checklist

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

jmarrec commented 4 years ago

This can be better seen querying the ReportVariableWithTime for eg:

SELECT ReportDataIndex, TimeIndex, ReportDataDictionaryIndex, Value, Month, Day, Hour, Minute, Interval, Name, ReportingFrequency From ReportVariableWithTime

image

See line 25, the Daily one is correct for everything, except it uses the same TimeIndex as the Timestep one that reports for 24:00, and therefore 'Interval' is 60

jmarrec commented 4 years ago

Output:Variable do it correctly:

I added these two:

Output:Variable,*,Site Outdoor Air Drybulb Temperature,Timestep;
Output:Variable,*,Site Outdoor Air Drybulb Temperature,Daily;
SELECT ReportDataIndex, TimeIndex, ReportDataDictionaryIndex, Value, Month, Day, Hour, Minute, Interval, Name, ReportingFrequency From ReportVariableWithTime
WHERE Name='Site Outdoor Air Drybulb Temperature'

image

jmarrec commented 4 years ago

Interestingly, adding the Output:Variables makes the Output:Meter ones use the added TimeIndex so they report correctly too.

In my file with runs for an annual run (non leap) + 2 design days:

jmarrec commented 4 years ago

Found the reason I think:

https://github.com/NREL/EnergyPlus/blob/185e20e71c38982ae12f355ab950587cc20caa7f/src/EnergyPlus/OutputProcessor.cc#L7248

https://github.com/NREL/EnergyPlus/blob/185e20e71c38982ae12f355ab950587cc20caa7f/src/EnergyPlus/OutputProcessor.cc#L6528-L6549