src/energyplus/ForwardTranslator/ForwardTranslateSolarCollectorFlatPlateWater.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 | #include "../../model/PlanarSurface.hpp" | ||
| 9 | #include "../../model/PlanarSurface_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/SolarCollectorFlatPlateWater.hpp" | ||
| 13 | #include "../../model/SolarCollectorFlatPlateWater_Impl.hpp" | ||
| 14 | #include "../../model/SolarCollectorPerformanceFlatPlate.hpp" | ||
| 15 | #include "../../utilities/core/Logger.hpp" | ||
| 16 | #include "../../utilities/core/Assert.hpp" | ||
| 17 | #include <utilities/idd/SolarCollector_FlatPlate_Water_FieldEnums.hxx> | ||
| 18 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | #include <utilities/idd/IddFactory.hxx> | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | using namespace std; | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | |||
| 28 | namespace energyplus { | ||
| 29 | |||
| 30 | 1 | boost::optional<IdfObject> ForwardTranslator::translateSolarCollectorFlatPlateWater(SolarCollectorFlatPlateWater& modelObject) { | |
| 31 | 1 | boost::optional<std::string> s; | |
| 32 | 1 | boost::optional<double> value; | |
| 33 | |||
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(IddObjectType::SolarCollector_FlatPlate_Water); |
| 35 | |||
| 36 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 37 | |||
| 38 | // Name | ||
| 39 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | std::string name = modelObject.name().get(); |
| 40 |
1/1✓ Branch 1 taken 1 time.
|
1 | idfObject.setName(name); |
| 41 | |||
| 42 | // SolarCollectorPerformanceFlatPlate | ||
| 43 | { | ||
| 44 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto mo = modelObject.solarCollectorPerformance(); |
| 45 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | IdfObject performance = translateAndMapModelObject(mo).get(); |
| 46 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(SolarCollector_FlatPlate_WaterFields::SolarCollectorPerformanceName, performance.name().get()); |
| 47 | 1 | } | |
| 48 | |||
| 49 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalPlanarSurface surface = modelObject.surface(); |
| 50 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (surface) { |
| 51 | ✗ | IdfObject surf = translateAndMapModelObject(*surface).get(); | |
| 52 | ✗ | idfObject.setString(SolarCollector_FlatPlate_WaterFields::SurfaceName, surf.name().get()); | |
| 53 | ✗ | } else { | |
| 54 |
7/7✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
|
1 | LOG(Error, "SolarCollector:FlatPlate:Water '" << name << "' does not reference a surface."); |
| 55 | } | ||
| 56 | |||
| 57 | // InletNodeName | ||
| 58 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> mo = modelObject.inletModelObject()) { |
| 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<Node> node = mo->optionalCast<Node>()) { |
| 60 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(SolarCollector_FlatPlate_WaterFields::InletNodeName, node->name().get()); |
| 61 | 1 | } | |
| 62 | 1 | } | |
| 63 | |||
| 64 | // OutletNodeName | ||
| 65 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<ModelObject> mo = modelObject.outletModelObject()) { |
| 66 |
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<Node> node = mo->optionalCast<Node>()) { |
| 67 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(SolarCollector_FlatPlate_WaterFields::OutletNodeName, node->name().get()); |
| 68 | 1 | } | |
| 69 | 1 | } | |
| 70 | |||
| 71 | // MaximumFlowRate | ||
| 72 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> maximumFlowRate = modelObject.maximumFlowRate(); |
| 73 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | if (maximumFlowRate) { |
| 74 | ✗ | idfObject.setDouble(SolarCollector_FlatPlate_WaterFields::MaximumFlowRate, *maximumFlowRate); | |
| 75 | } | ||
| 76 | |||
| 77 |
1/1✓ Branch 1 taken 1 time.
|
2 | return boost::optional<IdfObject>(idfObject); |
| 78 | 1 | } | |
| 79 | |||
| 80 | } // namespace energyplus | ||
| 81 | |||
| 82 | } // namespace openstudio | ||
| 83 |