src/energyplus/ForwardTranslator/ForwardTranslateSurfacePropertyConvectionCoefficientsMultipleSurface.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/Model.hpp" | ||
| 9 | #include "../../model/SurfacePropertyConvectionCoefficientsMultipleSurface.hpp" | ||
| 10 | #include "../../model/SurfacePropertyConvectionCoefficientsMultipleSurface_Impl.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | |||
| 13 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/SurfaceProperty_ConvectionCoefficients_MultipleSurface_FieldEnums.hxx> | ||
| 16 | |||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | |||
| 21 | #include "../../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | using namespace openstudio::model; | ||
| 24 | |||
| 25 | using namespace std; | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | |||
| 29 | namespace energyplus { | ||
| 30 | |||
| 31 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateSurfacePropertyConvectionCoefficientsMultipleSurface( | |
| 32 | model::SurfacePropertyConvectionCoefficientsMultipleSurface& modelObject) { | ||
| 33 | ✗ | boost::optional<std::string> surfaceType = modelObject.surfaceType(); | |
| 34 | ✗ | boost::optional<std::string> convectionCoefficient1Location = modelObject.convectionCoefficient1Location(); | |
| 35 | ✗ | boost::optional<std::string> convectionCoefficient1Type = modelObject.convectionCoefficient1Type(); | |
| 36 | ✗ | boost::optional<double> convectionCoefficient1 = modelObject.convectionCoefficient1(); | |
| 37 | ✗ | boost::optional<Schedule> convectionCoefficient1Schedule = modelObject.convectionCoefficient1Schedule(); | |
| 38 | ✗ | boost::optional<std::string> convectionCoefficient2Location = modelObject.convectionCoefficient2Location(); | |
| 39 | ✗ | boost::optional<std::string> convectionCoefficient2Type = modelObject.convectionCoefficient2Type(); | |
| 40 | ✗ | boost::optional<double> convectionCoefficient2 = modelObject.convectionCoefficient2(); | |
| 41 | ✗ | boost::optional<Schedule> convectionCoefficient2Schedule = modelObject.convectionCoefficient2Schedule(); | |
| 42 | |||
| 43 | ✗ | if (!(surfaceType && convectionCoefficient1Location && convectionCoefficient1Type)) { | |
| 44 | ✗ | LOG(Error, "SurfacePropertyConvectionCoefficientsMultipleSurface '" << modelObject.name().get() | |
| 45 | << "' missing required fields, will not be translated"); | ||
| 46 | ✗ | return boost::none; | |
| 47 | } | ||
| 48 | |||
| 49 | IdfObject idfObject = | ||
| 50 | ✗ | createRegisterAndNameIdfObject(openstudio::IddObjectType::SurfaceProperty_ConvectionCoefficients_MultipleSurface, modelObject); | |
| 51 | |||
| 52 | ✗ | if (surfaceType) { | |
| 53 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::SurfaceType, *surfaceType); | |
| 54 | } | ||
| 55 | |||
| 56 | ✗ | if (convectionCoefficient1Location) { | |
| 57 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient1Location, | |
| 58 | ✗ | *convectionCoefficient1Location); | |
| 59 | } | ||
| 60 | |||
| 61 | ✗ | if (convectionCoefficient1Type) { | |
| 62 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient1Type, *convectionCoefficient1Type); | |
| 63 | } | ||
| 64 | |||
| 65 | ✗ | if (convectionCoefficient1) { | |
| 66 | ✗ | idfObject.setDouble(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient1, *convectionCoefficient1); | |
| 67 | } | ||
| 68 | |||
| 69 | ✗ | if (convectionCoefficient1Schedule) { | |
| 70 | ✗ | boost::optional<IdfObject> sch = translateAndMapModelObject(*convectionCoefficient1Schedule); | |
| 71 | ✗ | if (sch && sch->name()) { | |
| 72 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient1ScheduleName, sch->name().get()); | |
| 73 | } | ||
| 74 | ✗ | } | |
| 75 | |||
| 76 | ✗ | if (convectionCoefficient2Location) { | |
| 77 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient2Location, | |
| 78 | ✗ | *convectionCoefficient2Location); | |
| 79 | } | ||
| 80 | |||
| 81 | ✗ | if (convectionCoefficient2Type) { | |
| 82 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient2Type, *convectionCoefficient2Type); | |
| 83 | } | ||
| 84 | |||
| 85 | ✗ | if (convectionCoefficient2) { | |
| 86 | ✗ | idfObject.setDouble(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient2, *convectionCoefficient2); | |
| 87 | } | ||
| 88 | |||
| 89 | ✗ | if (convectionCoefficient2Schedule) { | |
| 90 | ✗ | boost::optional<IdfObject> sch = translateAndMapModelObject(*convectionCoefficient2Schedule); | |
| 91 | ✗ | if (sch && sch->name()) { | |
| 92 | ✗ | idfObject.setString(SurfaceProperty_ConvectionCoefficients_MultipleSurfaceFields::ConvectionCoefficient2ScheduleName, sch->name().get()); | |
| 93 | } | ||
| 94 | ✗ | } | |
| 95 | |||
| 96 | ✗ | return idfObject; | |
| 97 | ✗ | } | |
| 98 | |||
| 99 | } // namespace energyplus | ||
| 100 | |||
| 101 | } // namespace openstudio | ||
| 102 |