src/energyplus/ReverseTranslator/ReverseTranslateSurfacePropertyIncidentSolarMultiplier.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/SurfacePropertyIncidentSolarMultiplier.hpp" | ||
| 9 | |||
| 10 | #include "../../model/SubSurface.hpp" | ||
| 11 | #include "../../model/SubSurface_Impl.hpp" | ||
| 12 | |||
| 13 | #include "../../model/Schedule.hpp" | ||
| 14 | #include "../../model/Schedule_Impl.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/SurfaceProperty_IncidentSolarMultiplier_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | 1 | boost::optional<ModelObject> ReverseTranslator::translateSurfacePropertyIncidentSolarMultiplier(const WorkspaceObject& workspaceObject) { | |
| 26 | |||
| 27 | 1 | boost::optional<SubSurface> subSurface_; | |
| 28 | |||
| 29 | // Surface Name: Required Object | ||
| 30 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto wo_ = workspaceObject.getTarget(SurfaceProperty_IncidentSolarMultiplierFields::SurfaceName)) { |
| 31 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto mo_ = translateAndMapWorkspaceObject(wo_.get())) { |
| 32 | |||
| 33 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto ss_ = mo_->optionalCast<SubSurface>()) { |
| 34 |
1/1✓ Branch 1 taken 1 time.
|
1 | subSurface_ = ss_; |
| 35 | } else { | ||
| 36 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Surface Name', cannot reverse translate."); | |
| 37 | ✗ | return boost::none; | |
| 38 | 1 | } | |
| 39 | } else { | ||
| 40 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot reverse translate required object 'Surface Name'"); | |
| 41 | ✗ | return boost::none; | |
| 42 | 1 | } | |
| 43 | } else { | ||
| 44 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required object 'Surface Name'"); | |
| 45 | ✗ | return boost::none; | |
| 46 | 1 | } | |
| 47 | |||
| 48 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | openstudio::model::SurfacePropertyIncidentSolarMultiplier modelObject(subSurface_.get()); |
| 49 | |||
| 50 | // Incident Solar Multiplier: Optional Double | ||
| 51 | 1 | if (boost::optional<double> _incidentSolarMultiplier = | |
| 52 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplier)) { |
| 53 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setIncidentSolarMultiplier(_incidentSolarMultiplier.get()); |
| 54 | } | ||
| 55 | |||
| 56 | // Incident Solar Multiplier Schedule Name: Optional Object | ||
| 57 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (auto wo_ = workspaceObject.getTarget(SurfaceProperty_IncidentSolarMultiplierFields::IncidentSolarMultiplierScheduleName)) { |
| 58 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (auto mo_ = translateAndMapWorkspaceObject(wo_.get())) { |
| 59 |
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<Schedule> _incidentSolarMultiplierSchedule = mo_->optionalCast<Schedule>()) { |
| 60 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setIncidentSolarMultiplierSchedule(_incidentSolarMultiplierSchedule.get()); |
| 61 | } else { | ||
| 62 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Incident Solar Multiplier Schedule Name'"); | |
| 63 | 1 | } | |
| 64 | 1 | } | |
| 65 | 1 | } | |
| 66 | |||
| 67 |
1/1✓ Branch 1 taken 1 time.
|
1 | return modelObject; |
| 68 | 1 | } // End of translate function | |
| 69 | |||
| 70 | } // end namespace energyplus | ||
| 71 | } // end namespace openstudio | ||
| 72 |