src/energyplus/ReverseTranslator/ReverseTranslateTableIndependentVariable.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/TableIndependentVariable.hpp" | ||
| 9 | |||
| 10 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 11 | |||
| 12 | #include <utilities/idd/Table_IndependentVariable_FieldEnums.hxx> | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 1 | boost::optional<ModelObject> ReverseTranslator::translateTableIndependentVariable(const WorkspaceObject& workspaceObject) { | |
| 22 | |||
| 23 | // External File Name: Optional String | ||
| 24 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | if (boost::optional<std::string> _externalFileName = workspaceObject.getString(Table_IndependentVariableFields::ExternalFileName, false, true)) { |
| 25 | ✗ | LOG(Error, workspaceObject.briefDescription() << " is referencing an External File, which is not supported"); | |
| 26 | ✗ | return boost::none; | |
| 27 | 1 | } | |
| 28 | |||
| 29 | // Instantiate an object of the class to store the values, | ||
| 30 |
1/1✓ Branch 1 taken 1 time.
|
1 | openstudio::model::TableIndependentVariable modelObject(m_model); |
| 31 | |||
| 32 | // Name | ||
| 33 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> _name = workspaceObject.name()) { |
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setName(_name.get()); |
| 35 | 1 | } | |
| 36 | |||
| 37 | // Interpolation Method: Optional String | ||
| 38 | 1 | if (boost::optional<std::string> _interpolationMethod = | |
| 39 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getString(Table_IndependentVariableFields::InterpolationMethod, false, true)) { |
| 40 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setInterpolationMethod(_interpolationMethod.get()); |
| 41 | 1 | } | |
| 42 | |||
| 43 | // Extrapolation Method: Optional String | ||
| 44 | 1 | if (boost::optional<std::string> _extrapolationMethod = | |
| 45 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getString(Table_IndependentVariableFields::ExtrapolationMethod, false, true)) { |
| 46 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setExtrapolationMethod(_extrapolationMethod.get()); |
| 47 | 1 | } | |
| 48 | |||
| 49 | // Minimum Value: Optional Double | ||
| 50 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _minimumValue = workspaceObject.getDouble(Table_IndependentVariableFields::MinimumValue)) { |
| 51 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setMinimumValue(_minimumValue.get()); |
| 52 | } | ||
| 53 | |||
| 54 | // Maximum Value: Optional Double | ||
| 55 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<double> _maximumValue = workspaceObject.getDouble(Table_IndependentVariableFields::MaximumValue)) { |
| 56 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setMaximumValue(_maximumValue.get()); |
| 57 | } | ||
| 58 | |||
| 59 | // Normalization Reference Value: Optional Double | ||
| 60 | 1 | if (boost::optional<double> _normalizationReferenceValue = | |
| 61 |
2/3✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
|
2 | workspaceObject.getDouble(Table_IndependentVariableFields::NormalizationReferenceValue)) { |
| 62 | ✗ | modelObject.setNormalizationReferenceValue(_normalizationReferenceValue.get()); | |
| 63 | } | ||
| 64 | |||
| 65 | // Unit Type: Optional String | ||
| 66 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> _unitType = workspaceObject.getString(Table_IndependentVariableFields::UnitType, false, true)) { |
| 67 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setUnitType(_unitType.get()); |
| 68 | 1 | } | |
| 69 | |||
| 70 | // // External File Column Number: Optional Integer | ||
| 71 | // if (boost::optional<int> _externalFileColumnNumber = workspaceObject.getInt(Table_IndependentVariableFields::ExternalFileColumnNumber)) { | ||
| 72 | // modelObject.setExternalFileColumnNumber(_externalFileColumnNumber.get()); | ||
| 73 | // } | ||
| 74 | |||
| 75 | // // External File Starting Row Number: Optional Integer | ||
| 76 | // if (boost::optional<int> _externalFileStartingRowNumber = workspaceObject.getInt(Table_IndependentVariableFields::ExternalFileStartingRowNumber)) { | ||
| 77 | // modelObject.setExternalFileStartingRowNumber(_externalFileStartingRowNumber.get()); | ||
| 78 | // } | ||
| 79 | |||
| 80 | // Extensible Values | ||
| 81 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 1 time.
|
4 | for (const IdfExtensibleGroup& eg : workspaceObject.extensibleGroups()) { |
| 82 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (boost::optional<double> value = eg.getDouble(Table_IndependentVariableExtensibleFields::Value)) { |
| 83 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | modelObject.addValue(value.get()); |
| 84 | } | ||
| 85 | 1 | } | |
| 86 | |||
| 87 |
1/1✓ Branch 1 taken 1 time.
|
1 | return modelObject; |
| 88 | 1 | } // End of translate function | |
| 89 | |||
| 90 | } // end namespace energyplus | ||
| 91 | } // end namespace openstudio | ||
| 92 |