-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange crash when removing Unitheater from thermalzone equipment list #5121
Comments
Oh well well well. The schedule is named exactly (casing aside) like the ZoneVentilationDesignFlowRate object... I found that's the precondition that makes me also reproduce on linux. test_scratch.rb: require 'openstudio'
include OpenStudio::Model
m = Model.new
z = ThermalZone.new(m)
uh = ZoneHVACUnitHeater.new(m, m.alwaysOnDiscreteSchedule, FanOnOff.new(m), CoilHeatingElectric.new(m))
nv = ZoneVentilationDesignFlowRate.new(m)
nv.setName("ZVDFR NaturalVentilation")
nv.setVentilationType("Natural")
nv_sch = ScheduleRuleset.new(m)
nv.setSchedule(nv_sch)
nv_sch.setName(nv.nameString) # <-------- comment out this line and it works fine
exhaust = ZoneVentilationDesignFlowRate.new(m)
exhaust.setVentilationType("Exhaust")
exhaust_sch = ScheduleRuleset.new(m)
exhaust.setSchedule(exhaust_sch)
#exhaust_sch.setName(exhaust.nameString)
uh.addToThermalZone(z)
nv.addToThermalZone(z)
exhaust.addToThermalZone(z)
uh.remove On ubuntu: $ ruby test_scratch.rb
[BOOST_ASSERT] <2> Assertion eg failed on line 346 of bool openstudio::model::detail::ZoneHVACEquipmentList_Impl::removeEquipment(const openstudio::model::ModelObject&) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ZoneHVACEquipmentList.cpp.
[BOOST_ASSERT] <2> Assertion eg failed on line 346 of bool openstudio::model::detail::ZoneHVACEquipmentList_Impl::removeEquipment(const openstudio::model::ModelObject&) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ZoneHVACEquipmentList.cpp.
[BOOST_ASSERT] <2> Assertion eg failed on line 356 of bool openstudio::model::detail::ZoneHVACEquipmentList_Impl::removeEquipment(const openstudio::model::ModelObject&) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ZoneHVACEquipmentList.cpp.
[BOOST_ASSERT] <2> Assertion eg failed on line 356 of bool openstudio::model::detail::ZoneHVACEquipmentList_Impl::removeEquipment(const openstudio::model::ModelObject&) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ZoneHVACEquipmentList.cpp. |
As long as grabbing by name returns the schedule first, I can reproduce the crash m = Model.new
z = ThermalZone.new(m)
bb_delete = ZoneHVACBaseboardConvectiveElectric.new(m)
bb = ZoneHVACBaseboardConvectiveElectric.new(m)
bb_sch = ScheduleConstant.new(m)
bb.setName("Baseboard")
bb_sch.setName(bb.nameString)
bb.setAvailabilitySchedule(bb_sch)
bb_delete.addToThermalZone(z)
bb.addToThermalZone(z)
puts "Objects named #{bb.nameString}"
puts m.objects.select{|o| o.nameString == bb.nameString}.map(&:iddObject).map(&:type)
raise unless m.getObjectsByName(bb.nameString).first.iddObject.type == "OS_Schedule_Constant".to_IddObjectType
bb_delete.remove |
jmarrec
added a commit
that referenced
this issue
Mar 25, 2024
Seems like the problem is that ModelObject, via WorkspaceObject resolves any handle field to the name the target, and during eraseExtensibleGroup, that goes nuclear, and if the Schedule is named like the object, and the schedule is found first in the workspace, then you end up with the Schedule being on the ZoneHVACEquipmentList.
19 tasks
The explanation of why this happens (along with the fix) is in #5122 (comment) |
jmarrec
added a commit
that referenced
this issue
Mar 27, 2024
Seems like the problem is that ModelObject, via WorkspaceObject resolves any handle field to the name the target, and during eraseExtensibleGroup, that goes nuclear, and if the Schedule is named like the object, and the schedule is found first in the workspace, then you end up with the Schedule being on the ZoneHVACEquipmentList.
kbenne
added a commit
that referenced
this issue
Apr 9, 2024
…name_is_same #5121 - Extensible Groups problems in ModelObject/WorkspaceObject
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue overview
I am extremely puzzled about what's happening but I can reproduce a crash originally reported at openstudiocoalition/OpenStudioApplication#686 on windows (it works on Ubuntu).
Current Behavior
It seems that when the extensible group corresponding to the UH is deleted, something very strange happens.
In the following group, which points correctly to a ZoneVentilationDesignFlowRate object to begin with, the handle is changed to be the handle of that object's Schedule Name (?!)
Expected Behavior
Steps to Reproduce
I'll provide a shortened file asap: edit: Here is a mcve.osm:
mcve.osm.txt
test2:
On Linux, everything is fine. Comparing the mcve.osm and the mcve_after_erase.osm, I get what's expected:
Adding the WIndows one to the right, we see something weird happened, the handle for former second group and now first group is actually pointing to a Schedule
Possible Solution
Details
Environment
Some additional details about your environment for this issue (if relevant):
Context
openstudiocoalition/OpenStudioApplication#686
The text was updated successfully, but these errors were encountered: