src/energyplus/ForwardTranslator/ForwardTranslateOutputDiagnostics.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/OutputDiagnostics.hpp" | ||
| 10 | |||
| 11 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/Output_Diagnostics_FieldEnums.hxx> | ||
| 14 | // #include "../../utilities/idd/IddEnums.hpp" | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | |||
| 21 | namespace energyplus { | ||
| 22 | |||
| 23 | 3 | boost::optional<IdfObject> ForwardTranslator::translateOutputDiagnostics(model::OutputDiagnostics& modelObject) { | |
| 24 | // If nothing to write, don't | ||
| 25 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto keys = modelObject.keys(); |
| 26 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2 times.
|
3 | if (keys.empty()) { |
| 27 | 1 | return boost::none; | |
| 28 | } | ||
| 29 | |||
| 30 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject idfObject = createAndRegisterIdfObject(openstudio::IddObjectType::Output_Diagnostics, modelObject); |
| 31 | |||
| 32 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 8 taken 5 times.
✓ Branch 9 taken 2 times.
|
7 | for (const std::string& key : modelObject.keys()) { |
| 33 |
1/1✓ Branch 1 taken 5 times.
|
5 | IdfExtensibleGroup eg = idfObject.pushExtensibleGroup(); |
| 34 |
1/1✓ Branch 1 taken 5 times.
|
5 | eg.setString(Output_DiagnosticsExtensibleFields::Key, key); |
| 35 | 7 | } | |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 2 times.
|
2 | return idfObject; |
| 38 | 3 | } // End of translate function | |
| 39 | |||
| 40 | } // end namespace energyplus | ||
| 41 | } // end namespace openstudio | ||
| 42 |