src/energyplus/ForwardTranslator/ForwardTranslateSurfacePropertyConvectionCoefficients.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 | |||
| 8 | #include "../../model/SurfacePropertyConvectionCoefficients.hpp" | ||
| 9 | #include "../../model/SurfacePropertyConvectionCoefficients_Impl.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | |||
| 12 | #include <utilities/idd/SurfaceProperty_ConvectionCoefficients_FieldEnums.hxx> | ||
| 13 | |||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | #include <utilities/idd/IddFactory.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | using namespace std; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | boost::optional<IdfObject> | ||
| 26 | 2 | ForwardTranslator::translateSurfacePropertyConvectionCoefficients(model::SurfacePropertyConvectionCoefficients& modelObject) { | |
| 27 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | boost::optional<ModelObject> convectionCoefficientSurface = modelObject.surfaceAsModelObject(); |
| 28 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> convectionCoefficient1Location = modelObject.convectionCoefficient1Location(); |
| 29 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> convectionCoefficient1Type = modelObject.convectionCoefficient1Type(); |
| 30 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<double> convectionCoefficient1 = modelObject.convectionCoefficient1(); |
| 31 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<Schedule> convectionCoefficient1Schedule = modelObject.convectionCoefficient1Schedule(); |
| 32 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> convectionCoefficient2Location = modelObject.convectionCoefficient2Location(); |
| 33 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<std::string> convectionCoefficient2Type = modelObject.convectionCoefficient2Type(); |
| 34 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<double> convectionCoefficient2 = modelObject.convectionCoefficient2(); |
| 35 |
1/1✓ Branch 1 taken 2 times.
|
2 | boost::optional<Schedule> convectionCoefficient2Schedule = modelObject.convectionCoefficient2Schedule(); |
| 36 | |||
| 37 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
6 | if (!(convectionCoefficientSurface && convectionCoefficient1Location && convectionCoefficient1Type)) { |
| 38 | ✗ | if (convectionCoefficientSurface) { | |
| 39 | ✗ | LOG(Error, "SurfacePropertyConvectionCoefficients for Surface '" << convectionCoefficientSurface->nameString() | |
| 40 | << "' missing required fields, will not be translated"); | ||
| 41 | } else { | ||
| 42 | ✗ | LOG(Error, "SurfacePropertyConvectionCoefficients does not reference a surface, it will not be translated."); | |
| 43 | } | ||
| 44 | ✗ | return boost::none; | |
| 45 | } | ||
| 46 | |||
| 47 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::SurfaceProperty_ConvectionCoefficients, modelObject); |
| 48 | |||
| 49 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficientSurface) { |
| 50 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | boost::optional<IdfObject> surface = translateAndMapModelObject(*convectionCoefficientSurface); |
| 51 |
6/12✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
6 | if (surface && surface->name()) { |
| 52 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::SurfaceName, surface->name().get()); |
| 53 | } | ||
| 54 | 2 | } | |
| 55 | |||
| 56 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient1Location) { |
| 57 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient1Location, *convectionCoefficient1Location); |
| 58 | } | ||
| 59 | |||
| 60 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient1Type) { |
| 61 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient1Type, *convectionCoefficient1Type); |
| 62 | } | ||
| 63 | |||
| 64 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient1) { |
| 65 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setDouble(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient1, *convectionCoefficient1); |
| 66 | } | ||
| 67 | |||
| 68 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (convectionCoefficient1Schedule) { |
| 69 | ✗ | boost::optional<IdfObject> sch = translateAndMapModelObject(*convectionCoefficient1Schedule); | |
| 70 | ✗ | if (sch && sch->name()) { | |
| 71 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient1ScheduleName, sch->name().get()); | |
| 72 | } | ||
| 73 | ✗ | } | |
| 74 | |||
| 75 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient2Location) { |
| 76 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient2Location, *convectionCoefficient2Location); |
| 77 | } | ||
| 78 | |||
| 79 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient2Type) { |
| 80 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient2Type, *convectionCoefficient2Type); |
| 81 | } | ||
| 82 | |||
| 83 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (convectionCoefficient2) { |
| 84 | ✗ | idfObject.setDouble(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient2, *convectionCoefficient2); | |
| 85 | } | ||
| 86 | |||
| 87 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (convectionCoefficient2Schedule) { |
| 88 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | boost::optional<IdfObject> sch = translateAndMapModelObject(*convectionCoefficient2Schedule); |
| 89 |
6/12✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
6 | if (sch && sch->name()) { |
| 90 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | idfObject.setString(SurfaceProperty_ConvectionCoefficientsFields::ConvectionCoefficient2ScheduleName, sch->name().get()); |
| 91 | } | ||
| 92 | 2 | } | |
| 93 | |||
| 94 |
1/1✓ Branch 1 taken 2 times.
|
2 | return idfObject; |
| 95 | 2 | } | |
| 96 | |||
| 97 | } // namespace energyplus | ||
| 98 | |||
| 99 | } // namespace openstudio | ||
| 100 |