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