NatLabRockies / NatLabRockies/OpenStudio
BCLXML doesn't handle AttributeVector
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 646
- Forks
- 237
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 10
Description
Issue overview
OpenStudio::Attribute has an AttributeVector value type, but it is not supported by BCLXML.
Current Behavior
No warning is issued, but it is not serialized in saving. Nor would it be read.
Expected Behavior
We should implement support for it, or warn when you try to add an AttributeVector in BCLXML::addAttribute.
Steps to Reproduce
bclXML = OpenStudio::BCLXML.new('measure.xml')
consideration1 = OpenStudio::Attribute.new("consideration", "Check transformer capacity when installing a heat pump.")
consideration2 = OpenStudio::Attribute.new("consideration", "Verify wiring compliance with local electrical codes before installation.")
implementation_considerations = OpenStudio::Attribute.new("implementation_considerations", [consideration1, consideration2])
n = bclXML.attributes.size
# The bclXML has the new attribute, but it will NOT be serialized to measure.xml when you save, nor in puts
bclXML.addAttribute(implementation_considerations)
raise unless bclXML.attributes.size == n + 1
puts bclXML
<attributes>
<attribute>
<name>Measure Type</name>
<value>ModelMeasure</value>
<datatype>string</datatype>
</attribute>
<attribute>
<name>Measure Language</name>
<value>Ruby</value>
<datatype>string</datatype>
</attribute>
- <attribute>
- <name>string_attribute</name>
- <datatype>AttributeVector<datatype>
- <value>
- <attributes>...</attributes>
- </value>
- </attribute>
</attributes>
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.10.0-alpha
Context
Just realized this after trying to add nested attributes in measure.xml
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/utilities/bcl/BCLXML.cpp around lines 687-690 and inspect BCLXML::addAttribute, using the Ruby reproduction with measure.xml as the first check. Trace how existing attribute types are serialized and read. Done means AttributeVector is handled consistently, or addAttribute clearly warns when it is unsupported, with the reproduction no longer silently losing the attribute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100