src/energyplus/ReverseTranslator/ReverseTranslateMaterialPropertyGlazingSpectralData.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ReverseTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../../model/MaterialPropertyGlazingSpectralData.hpp" | ||
| 9 | #include "../../model/MaterialPropertyGlazingSpectralData_Impl.hpp" | ||
| 10 | |||
| 11 | #include "../../utilities/idf/WorkspaceExtensibleGroup.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/MaterialProperty_GlazingSpectralData_FieldEnums.hxx> | ||
| 14 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | #include "../../utilities/core/Assert.hpp" | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | namespace energyplus { | ||
| 23 | |||
| 24 | 4 | boost::optional<ModelObject> ReverseTranslator::translateMaterialPropertyGlazingSpectralData(const WorkspaceObject& workspaceObject) { | |
| 25 | |||
| 26 |
1/1✓ Branch 1 taken 4 times.
|
4 | openstudio::model::MaterialPropertyGlazingSpectralData glazingSpectralData(m_model); |
| 27 | |||
| 28 | // Name | ||
| 29 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<std::string> name_ = workspaceObject.name()) { |
| 30 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | glazingSpectralData.setName(name_.get()); |
| 31 | 4 | } | |
| 32 | |||
| 33 | // get extensible groups for spectral data fields | ||
| 34 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 4 times.
|
4 | for (const IdfExtensibleGroup& idfGroup : workspaceObject.extensibleGroups()) { |
| 35 | ✗ | auto workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>(); | |
| 36 | ✗ | OptionalDouble wavelength = workspaceGroup.getDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::Wavelength); | |
| 37 | ✗ | OptionalDouble transmittance = workspaceGroup.getDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::Transmittance); | |
| 38 | ✗ | OptionalDouble frontReflectance = workspaceGroup.getDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::FrontReflectance); | |
| 39 | ✗ | OptionalDouble backReflectance = workspaceGroup.getDouble(MaterialProperty_GlazingSpectralDataExtensibleFields::BackReflectance); | |
| 40 | |||
| 41 | // add the spectral data field | ||
| 42 | ✗ | glazingSpectralData.addSpectralDataField(*wavelength, *transmittance, *frontReflectance, *backReflectance); | |
| 43 | 4 | } | |
| 44 | |||
| 45 |
1/1✓ Branch 1 taken 4 times.
|
8 | return glazingSpectralData; |
| 46 | 4 | } | |
| 47 | |||
| 48 | } // namespace energyplus | ||
| 49 | |||
| 50 | } // namespace openstudio | ||
| 51 |