NatLabRockies / NatLabRockies/OpenStudio

CoilCoolingDX::clone crashes when called with another model

Open
#4,544 3 comments 0 reactions 2 assignees View on GitHub

@wenyikuang is already working on this.

Since Jul 14, 2023.

component - HVAC severity - Normal Bug
Dominant language
C++
Stars
646
Forks
237
Avg merge
3d 11h
Merged PRs (30d)
10

Description

Issue overview

Cloning a CoilCoolingDX crashes when it's cloned to another model.

Steps to Reproduce


m = Model.new
spd_1 = CoilCoolingDXCurveFitSpeed.new(m)
op_mode_base = CoilCoolingDXCurveFitOperatingMode.new(m)
performance_base = CoilCoolingDXCurveFitPerformance.new(m, op_mode_base)
cooling_coil_dx_1 = CoilCoolingDX.new(m, performance_base)

# Ok
cooling_coil_dx_1.clone(m)

m2 = Model.new
# Crash
cooling_coil_dx_1.clone(m2)
[utilities.idf.Workspace] <-1> Unable to add cloned objects to Workspace. The validity report is: 
The collection is INVALID at strictness level 'Draft', because of the errors:
Object     level data error of type NameConflict      .
Error pertains to an object of type 'OS:Coil:Cooling:DX:CurveFit:OperatingMode', named 'Coil Cooling DX Curve Fit Operating Mode 1'.
Additional information about the error type: two objects of the same type or with overlapping references also have the same name.
[utilities.idf.Workspace] <1> Unable to add objectsToAdd and objectsToInsert to their own Workspace as an intermediate step.
[BOOST_ASSERT] <2> Assertion result.size() > 0u failed on line 602 of virtual openstudio::model::ModelObject openstudio::model::detail::ModelObject_Impl::clone(openstudio::model::Model) const in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ModelObject.cpp.
[BOOST_ASSERT] <2> Assertion result.size() > 0u failed on line 602 of virtual openstudio::model::ModelObject openstudio::model::detail::ModelObject_Impl::clone(openstudio::model::Model) const in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/src/model/ModelObject.cpp.
(pry):8: [BUG] Segmentation fault at 0x0000000000000008
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0026 p:---- s:0136 e:000135 CFUNC  :clone
c:0025 p:0007 s:0131 e:000130 EVAL   (pry):8 [FINISH]
c:0024 p:---- s:0128 e:000127 CFUNC  :eval
c:0023 p:0042 s:0121 e:000120 METHOD /usr/share/rvm/gems/ruby-2.7.2/gems/pry-0.14.1/lib/pry/pry_instance.rb:290
c:0022 p:0240 s:0115 e:000114 METHOD /usr/share/rvm/gems/ruby-2.7.2/gems/pry-0.14.1/lib/pry/pry_instance.rb:659
c:0021 p:0010 s:0104 e:000103 BLOCK  /usr/share/rvm/gems/ruby-2.7.2/gems/pry-0.14.1/lib/pry/pry_instance.rb:261 [FINISH]

Possible Solution

A double clone or mishandling of a required children is the likely cause.

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): all
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.3.0, current develop as well d75af8b9309517294089066e6a5b3c0373d43d9e
Context

Reported by @j-lorrey

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.