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.13k stars 389 forks source link

Surface with "Self intersecting" floor geometry and using Kiva causes access violation exception #10383

Open DaveInCaz opened 9 months ago

DaveInCaz commented 9 months ago

Issue overview

Noticed a case where a particular floor surface causes energyplus.exe to terminate with an access violation exception. This happens when the surface is using a Foundation Kiva boundary condition.

Details

I've attached a sample file to reproduce this issue. I was running it like follows:

d:\EnergyPlusV23-2-0\energyplus.exe -w weather.epw repro.idf

(I didn't attach the weather file because I may not have rights to do so, but any can be used as far as I know.)

The specific geometry which causes the error is in surface Extruded BLD1 \- Building_Basement room_Floor_16_\{00093\} as follows:

    19.07, 63.01, 0,              !- X,Y,Z Vertex 1 {m}
    19.31, 63.25, 0,              !- X,Y,Z Vertex 2 {m}
    19.77, 62.78, 0,              !- X,Y,Z Vertex 3 {m}
    19.54, 62.54, 0,              !- X,Y,Z Vertex 4 {m}
    22.38, 59.7, 0,               !- X,Y,Z Vertex 5 {m}
    22.61, 59.93, 0,              !- X,Y,Z Vertex 6 {m}
    23.03, 59.51, 0,              !- X,Y,Z Vertex 7 {m}
    22.8, 59.28, 0;               !- X,Y,Z Vertex 8 {m}

An exaggerated sketch of this shape is: image

In reality the lines 8..1 and 4..5 overlap and this seems to cause the failure. The polygon self-intersects.

When EnergyPlus terminates on the command line there is actually no visible error message. But I ran it in the Visual Studio debugger while attached to the EXE and it showed this:

Exception thrown at 0x00007FFA7FE10070 (energyplusapi.dll) in energyplus.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

So I guess its a null pointer reference?

The stack trace up to that point is below (may not be useful though since there are no symbols).

Stack trace:

    energyplusapi.dll!00007ffa7fe10070()    Unknown
    energyplusapi.dll!00007ffa7fe0ffdc()    Unknown
    energyplusapi.dll!00007ffa816233d4()    Unknown
    energyplusapi.dll!00007ffa816584c2()    Unknown
    energyplusapi.dll!00007ffa81668649()    Unknown
    energyplusapi.dll!00007ffa8165fb39()    Unknown
    energyplusapi.dll!00007ffa8165f8d4()    Unknown
    energyplusapi.dll!00007ffa80179475()    Unknown
    energyplusapi.dll!00007ffa80176eee()    Unknown
    energyplusapi.dll!00007ffa801783fb()    Unknown
    energyplusapi.dll!00007ffa80180302()    Unknown
    energyplusapi.dll!00007ffa802d7a37()    Unknown
    energyplusapi.dll!00007ffa802e5759()    Unknown
    energyplusapi.dll!00007ffa7ff902fe()    Unknown
    energyplusapi.dll!00007ffa7ff89d76()    Unknown
    energyplusapi.dll!00007ffa7fd4309d()    Unknown
    energyplusapi.dll!00007ffa7fd42fc5()    Unknown
    energyplus.exe!00007ff65afb7ca9()   Unknown
    energyplus.exe!00007ff65afb8850()   Unknown
    kernel32.dll!00007ffb5ca77344() Unknown
    ntdll.dll!00007ffb5d9e26b1()    Unknown

repro.zip

nealkruis commented 9 months ago

@DaveInCaz, thanks for bringing this to our attention! I'll take a look when I next get a chance.

DaveInCaz commented 7 months ago

Thanks @nealkruis .

FWIW I think I have a second example of the same issue. Attachment added. Its a similar IDF file but the surface coordinates have been changed from the first case. Its still the same surface named Extruded BLD1 \- Building_Basement room_Floor_16_\{00093\}. repro2.zip