src/energyplus/ForwardTranslator/ForwardTranslateOutputTableAnnual.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/OutputTableAnnual.hpp" | ||
| 10 | |||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 13 | |||
| 14 | #include <utilities/idd/Output_Table_Annual_FieldEnums.hxx> | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | |||
| 21 | namespace energyplus { | ||
| 22 | |||
| 23 | 2 | boost::optional<IdfObject> ForwardTranslator::translateOutputTableAnnual(model::OutputTableAnnual& modelObject) { | |
| 24 | |||
| 25 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | if (modelObject.numberofAnnualVariableGroups() == 0) { |
| 26 | 1 | return boost::none; | |
| 27 | } | ||
| 28 | |||
| 29 | // Instantiate an IdfObject of the class to store the values | ||
| 30 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Output_Table_Annual, modelObject); |
| 31 | |||
| 32 | // Filter: boost::optional<std::string> | ||
| 33 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> filter_ = modelObject.filter()) { |
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(Output_Table_AnnualFields::Filter, filter_.get()); |
| 35 | 1 | } | |
| 36 | |||
| 37 | // Schedule Name: Optional Object | ||
| 38 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<Schedule> schedule_ = modelObject.schedule()) { |
| 39 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(schedule_.get())) { |
| 40 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(Output_Table_AnnualFields::ScheduleName, wo_->nameString()); |
| 41 | 1 | } | |
| 42 | 1 | } | |
| 43 | |||
| 44 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 1 time.
|
3 | for (const auto& group : modelObject.annualVariableGroups()) { |
| 45 |
1/1✓ Branch 1 taken 2 times.
|
2 | IdfExtensibleGroup eg = idfObject.pushExtensibleGroup(); |
| 46 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | eg.setString(Output_Table_AnnualExtensibleFields::VariableorMeterorEMSVariableorFieldName, group.variableorMeterorEMSVariableorField()); |
| 47 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | eg.setString(Output_Table_AnnualExtensibleFields::AggregationTypeforVariableorMeter, group.aggregationType()); |
| 48 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | eg.setInt(Output_Table_AnnualExtensibleFields::DigitsAfterDecimal, group.digitsAfterDecimal()); |
| 49 | 3 | } | |
| 50 | |||
| 51 |
1/1✓ Branch 1 taken 1 time.
|
1 | return idfObject; |
| 52 | 1 | } // End of translate function | |
| 53 | |||
| 54 | } // end namespace energyplus | ||
| 55 | } // end namespace openstudio | ||
| 56 |