src/energyplus/ReverseTranslator/ReverseTranslateCurveCubic.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/CurveCubic.hpp" | ||
| 9 | #include "../../model/CurveCubic_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Curve_Cubic_FieldEnums.hxx> | ||
| 12 | |||
| 13 | using namespace openstudio::model; | ||
| 14 | |||
| 15 | namespace openstudio { | ||
| 16 | namespace energyplus { | ||
| 17 | |||
| 18 | ✗ | boost::optional<ModelObject> ReverseTranslator::translateCurveCubic(const WorkspaceObject& workspaceObject) { | |
| 19 | ✗ | CurveCubic curve(m_model); | |
| 20 | |||
| 21 | ✗ | OptionalString s; | |
| 22 | ✗ | OptionalDouble d; | |
| 23 | |||
| 24 | ✗ | if ((s = workspaceObject.name())) { | |
| 25 | ✗ | curve.setName(*s); | |
| 26 | } | ||
| 27 | |||
| 28 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::Coefficient1Constant))) { | |
| 29 | ✗ | curve.setCoefficient1Constant(*d); | |
| 30 | } | ||
| 31 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::Coefficient2x))) { | |
| 32 | ✗ | curve.setCoefficient2x(*d); | |
| 33 | } | ||
| 34 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::Coefficient3x_POW_2))) { | |
| 35 | ✗ | curve.setCoefficient3xPOW2(*d); | |
| 36 | } | ||
| 37 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::Coefficient4x_POW_3))) { | |
| 38 | ✗ | curve.setCoefficient4xPOW3(*d); | |
| 39 | } | ||
| 40 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::MinimumValueofx))) { | |
| 41 | ✗ | curve.setMinimumValueofx(*d); | |
| 42 | } | ||
| 43 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::MaximumValueofx))) { | |
| 44 | ✗ | curve.setMaximumValueofx(*d); | |
| 45 | } | ||
| 46 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::MinimumCurveOutput))) { | |
| 47 | ✗ | curve.setMinimumCurveOutput(*d); | |
| 48 | } | ||
| 49 | ✗ | if ((d = workspaceObject.getDouble(Curve_CubicFields::MaximumCurveOutput))) { | |
| 50 | ✗ | curve.setMaximumCurveOutput(*d); | |
| 51 | } | ||
| 52 | ✗ | if ((s = workspaceObject.getString(Curve_CubicFields::InputUnitTypeforX, false, true))) { | |
| 53 | ✗ | curve.setInputUnitTypeforX(*s); | |
| 54 | } | ||
| 55 | ✗ | if ((s = workspaceObject.getString(Curve_CubicFields::OutputUnitType, false, true))) { | |
| 56 | ✗ | curve.setOutputUnitType(*s); | |
| 57 | } | ||
| 58 | |||
| 59 | ✗ | return curve; | |
| 60 | ✗ | } | |
| 61 | |||
| 62 | } // namespace energyplus | ||
| 63 | } // namespace openstudio | ||
| 64 |