src/energyplus/ForwardTranslator/ForwardTranslateSurfacePropertySurroundingSurfaces.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 "../ForwardTranslator.hpp" | ||
| 7 | #include "../../model/Model.hpp" | ||
| 8 | |||
| 9 | #include "../../model/SurfacePropertySurroundingSurfaces.hpp" | ||
| 10 | |||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | |||
| 13 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/SurfaceProperty_SurroundingSurfaces_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/IddEnums.hxx> | ||
| 17 | |||
| 18 | using namespace openstudio::model; | ||
| 19 | |||
| 20 | namespace openstudio { | ||
| 21 | |||
| 22 | namespace energyplus { | ||
| 23 | |||
| 24 | 4 | boost::optional<IdfObject> ForwardTranslator::translateSurfacePropertySurroundingSurfaces(model::SurfacePropertySurroundingSurfaces& modelObject) { | |
| 25 | |||
| 26 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (modelObject.numberofSurroundingSurfaceGroups() == 0) { |
| 27 | ✗ | return boost::none; | |
| 28 | } | ||
| 29 | |||
| 30 | // Instantiate an IdfObject of the class to store the values, | ||
| 31 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::SurfaceProperty_SurroundingSurfaces, modelObject); |
| 32 | |||
| 33 | // Sky View Factor: Optional Double | ||
| 34 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
|
8 | if (boost::optional<double> skyViewFactor_ = modelObject.skyViewFactor()) { |
| 35 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_SurroundingSurfacesFields::SkyViewFactor, skyViewFactor_.get()); |
| 36 | } | ||
| 37 | |||
| 38 | // Sky Temperature Schedule Name: Optional Object | ||
| 39 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
|
8 | if (boost::optional<Schedule> _skyTemperatureSchedule = modelObject.skyTemperatureSchedule()) { |
| 40 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_skyTemperatureSchedule.get())) { |
| 41 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(SurfaceProperty_SurroundingSurfacesFields::SkyTemperatureScheduleName, _owo->nameString()); |
| 42 | 1 | } | |
| 43 | 4 | } | |
| 44 | |||
| 45 | // Ground View Factor: Optional Double | ||
| 46 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
|
8 | if (boost::optional<double> groundViewFactor_ = modelObject.groundViewFactor()) { |
| 47 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(SurfaceProperty_SurroundingSurfacesFields::GroundViewFactor, groundViewFactor_.get()); |
| 48 | } | ||
| 49 | |||
| 50 | // Ground Temperature Schedule Name: Optional Object | ||
| 51 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 3 times.
|
8 | if (boost::optional<Schedule> _groundTemperatureSchedule = modelObject.groundTemperatureSchedule()) { |
| 52 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_groundTemperatureSchedule.get())) { |
| 53 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(SurfaceProperty_SurroundingSurfacesFields::GroundTemperatureScheduleName, _owo->nameString()); |
| 54 | 1 | } | |
| 55 | 4 | } | |
| 56 | |||
| 57 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 8 taken 12 times.
✓ Branch 9 taken 4 times.
|
16 | for (const auto& group : modelObject.surroundingSurfaceGroups()) { |
| 58 | |||
| 59 |
1/1✓ Branch 1 taken 12 times.
|
12 | IdfExtensibleGroup eg = idfObject.pushExtensibleGroup(); |
| 60 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | eg.setString(SurfaceProperty_SurroundingSurfacesExtensibleFields::SurroundingSurfaceName, group.surroundingSurfaceName()); |
| 61 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | eg.setDouble(SurfaceProperty_SurroundingSurfacesExtensibleFields::SurroundingSurfaceViewFactor, group.viewFactor()); |
| 62 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto sch = group.temperatureSchedule(); |
| 63 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (boost::optional<IdfObject> _owo = translateAndMapModelObject(sch)) { |
| 64 |
3/3✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
|
12 | eg.setString(SurfaceProperty_SurroundingSurfacesExtensibleFields::SurroundingSurfaceTemperatureScheduleName, _owo->nameString()); |
| 65 | 12 | } // TODO: handle failure? | |
| 66 | 16 | } | |
| 67 | |||
| 68 |
1/1✓ Branch 1 taken 4 times.
|
4 | return idfObject; |
| 69 | 4 | } // End of translate function | |
| 70 | |||
| 71 | } // end namespace energyplus | ||
| 72 | } // end namespace openstudio | ||
| 73 |