src/energyplus/ForwardTranslator/ForwardTranslateCurveQuintLinear.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 | |||
| 9 | #include "../../model/CurveQuintLinear.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Curve_QuintLinear_FieldEnums.hxx> | ||
| 12 | // #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 10 | boost::optional<IdfObject> ForwardTranslator::translateCurveQuintLinear(model::CurveQuintLinear& modelObject) { | |
| 22 | 10 | boost::optional<WorkspaceObject> result; | |
| 23 | |||
| 24 | // Instantiate an IdfObject of the class to store the values, | ||
| 25 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Curve_QuintLinear, modelObject); |
| 26 | // If it doesn't have a name, or if you aren't sure you are going to want to return it | ||
| 27 | // IdfObject idfObject( openstudio::IddObjectType::Curve_QuintLinear ); | ||
| 28 | // m_idfObjects.push_back(idfObject); | ||
| 29 | |||
| 30 | // TODO: Note JM 2018-10-17 | ||
| 31 | // You are responsible for implementing any additional logic based on choice fields, etc. | ||
| 32 | // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way | ||
| 33 | |||
| 34 | // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this. | ||
| 35 | // But in some cases, you'll want to handle failure without pushing to the map | ||
| 36 | // Name | ||
| 37 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
20 | if (boost::optional<std::string> moName = modelObject.name()) { |
| 38 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | idfObject.setName(*moName); |
| 39 | 10 | } | |
| 40 | |||
| 41 | // Coefficient1 Constant: Required Double | ||
| 42 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient1Constant = modelObject.coefficient1Constant(); |
| 43 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient1Constant, coefficient1Constant); |
| 44 | |||
| 45 | // Coefficient2 v: Required Double | ||
| 46 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient2v = modelObject.coefficient2v(); |
| 47 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient2v, coefficient2v); |
| 48 | |||
| 49 | // Coefficient3 w: Required Double | ||
| 50 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient3w = modelObject.coefficient3w(); |
| 51 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient3w, coefficient3w); |
| 52 | |||
| 53 | // Coefficient4 x: Required Double | ||
| 54 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient4x = modelObject.coefficient4x(); |
| 55 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient4x, coefficient4x); |
| 56 | |||
| 57 | // Coefficient5 y: Required Double | ||
| 58 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient5y = modelObject.coefficient5y(); |
| 59 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient5y, coefficient5y); |
| 60 | |||
| 61 | // Coefficient6 z: Required Double | ||
| 62 |
1/1✓ Branch 1 taken 10 times.
|
10 | double coefficient6z = modelObject.coefficient6z(); |
| 63 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::Coefficient6z, coefficient6z); |
| 64 | |||
| 65 | // Minimum Value of v: Required Double | ||
| 66 |
1/1✓ Branch 1 taken 10 times.
|
10 | double minimumValueofv = modelObject.minimumValueofv(); |
| 67 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MinimumValueofv, minimumValueofv); |
| 68 | |||
| 69 | // Maximum Value of v: Required Double | ||
| 70 |
1/1✓ Branch 1 taken 10 times.
|
10 | double maximumValueofv = modelObject.maximumValueofv(); |
| 71 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MaximumValueofv, maximumValueofv); |
| 72 | |||
| 73 | // Minimum Value of w: Required Double | ||
| 74 |
1/1✓ Branch 1 taken 10 times.
|
10 | double minimumValueofw = modelObject.minimumValueofw(); |
| 75 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MinimumValueofw, minimumValueofw); |
| 76 | |||
| 77 | // Maximum Value of w: Required Double | ||
| 78 |
1/1✓ Branch 1 taken 10 times.
|
10 | double maximumValueofw = modelObject.maximumValueofw(); |
| 79 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MaximumValueofw, maximumValueofw); |
| 80 | |||
| 81 | // Minimum Value of x: Required Double | ||
| 82 |
1/1✓ Branch 1 taken 10 times.
|
10 | double minimumValueofx = modelObject.minimumValueofx(); |
| 83 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MinimumValueofx, minimumValueofx); |
| 84 | |||
| 85 | // Maximum Value of x: Required Double | ||
| 86 |
1/1✓ Branch 1 taken 10 times.
|
10 | double maximumValueofx = modelObject.maximumValueofx(); |
| 87 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MaximumValueofx, maximumValueofx); |
| 88 | |||
| 89 | // Minimum Value of y: Required Double | ||
| 90 |
1/1✓ Branch 1 taken 10 times.
|
10 | double minimumValueofy = modelObject.minimumValueofy(); |
| 91 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MinimumValueofy, minimumValueofy); |
| 92 | |||
| 93 | // Maximum Value of y: Required Double | ||
| 94 |
1/1✓ Branch 1 taken 10 times.
|
10 | double maximumValueofy = modelObject.maximumValueofy(); |
| 95 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MaximumValueofy, maximumValueofy); |
| 96 | |||
| 97 | // Minimum Value of z: Required Double | ||
| 98 |
1/1✓ Branch 1 taken 10 times.
|
10 | double minimumValueofz = modelObject.minimumValueofz(); |
| 99 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MinimumValueofz, minimumValueofz); |
| 100 | |||
| 101 | // Maximum Value of z: Required Double | ||
| 102 |
1/1✓ Branch 1 taken 10 times.
|
10 | double maximumValueofz = modelObject.maximumValueofz(); |
| 103 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setDouble(Curve_QuintLinearFields::MaximumValueofz, maximumValueofz); |
| 104 | |||
| 105 | // Minimum Curve Output: boost::optional<double> | ||
| 106 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 9 times.
|
20 | if (boost::optional<double> _minimumCurveOutput = modelObject.minimumCurveOutput()) { |
| 107 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Curve_QuintLinearFields::MinimumCurveOutput, _minimumCurveOutput.get()); |
| 108 | } | ||
| 109 | |||
| 110 | // Maximum Curve Output: boost::optional<double> | ||
| 111 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 9 times.
|
20 | if (boost::optional<double> _maximumCurveOutput = modelObject.maximumCurveOutput()) { |
| 112 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Curve_QuintLinearFields::MaximumCurveOutput, _maximumCurveOutput.get()); |
| 113 | } | ||
| 114 | |||
| 115 | // Input Unit Type for v: Optional String | ||
| 116 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::string inputUnitTypeforv = modelObject.inputUnitTypeforv(); |
| 117 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setString(Curve_QuintLinearFields::InputUnitTypeforv, inputUnitTypeforv); |
| 118 | |||
| 119 | // Input Unit Type for w: Optional String | ||
| 120 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::string inputUnitTypeforw = modelObject.inputUnitTypeforw(); |
| 121 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setString(Curve_QuintLinearFields::InputUnitTypeforw, inputUnitTypeforw); |
| 122 | |||
| 123 | // Input Unit Type for x: Optional String | ||
| 124 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::string inputUnitTypeforx = modelObject.inputUnitTypeforx(); |
| 125 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setString(Curve_QuintLinearFields::InputUnitTypeforx, inputUnitTypeforx); |
| 126 | |||
| 127 | // Input Unit Type for y: Optional String | ||
| 128 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::string inputUnitTypefory = modelObject.inputUnitTypefory(); |
| 129 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setString(Curve_QuintLinearFields::InputUnitTypefory, inputUnitTypefory); |
| 130 | |||
| 131 | // Input Unit Type for z: Optional String | ||
| 132 |
1/1✓ Branch 1 taken 10 times.
|
10 | std::string inputUnitTypeforz = modelObject.inputUnitTypeforz(); |
| 133 |
1/1✓ Branch 1 taken 10 times.
|
10 | idfObject.setString(Curve_QuintLinearFields::InputUnitTypeforz, inputUnitTypeforz); |
| 134 | |||
| 135 |
1/1✓ Branch 1 taken 10 times.
|
20 | return idfObject; |
| 136 | 10 | } // End of translate function | |
| 137 | |||
| 138 | } // end namespace energyplus | ||
| 139 | } // end namespace openstudio | ||
| 140 |