src/energyplus/ReverseTranslator/ReverseTranslateOutputDebuggingData.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/OutputDebuggingData.hpp" | ||
| 9 | #include "../../model/OutputDebuggingData_Impl.hpp" | ||
| 10 | |||
| 11 | #include "../../utilities/math/FloatCompare.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/Output_DebuggingData_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | |||
| 16 | using namespace openstudio::model; | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | |||
| 20 | namespace energyplus { | ||
| 21 | |||
| 22 | 2 | boost::optional<ModelObject> ReverseTranslator::translateOutputDebuggingData(const WorkspaceObject& wo) { | |
| 23 | 2 | boost::optional<ModelObject> result; | |
| 24 | |||
| 25 | // Check whether we have either field set to True before we bother instantiating the object... | ||
| 26 | 2 | bool reportDebuggingData = false; | |
| 27 | 2 | bool reportDuringWarmup = false; | |
| 28 | |||
| 29 | // Note: E+ is wrong here: IDD uses numeric fields to store what is really a boolean. If 1 = true, else false. | ||
| 30 | |||
| 31 | // Report Debugging Data: Optional Boolean | ||
| 32 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<std::string> _reportDebuggingData = wo.getString(Output_DebuggingDataFields::ReportDebuggingData, true)) { |
| 33 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
|
6 | if (istringEqual("Yes", _reportDebuggingData.get())) { |
| 34 | 1 | reportDebuggingData = true; | |
| 35 | } | ||
| 36 | 2 | } | |
| 37 | |||
| 38 | // Report During Warmup: Optional Boolean | ||
| 39 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
4 | if (boost::optional<std::string> _reportDuringWarmup = wo.getString(Output_DebuggingDataFields::ReportDuringWarmup, true)) { |
| 40 |
5/5✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 1 time.
|
6 | if (istringEqual("Yes", _reportDuringWarmup.get())) { |
| 41 | 1 | reportDuringWarmup = true; | |
| 42 | } | ||
| 43 | 2 | } | |
| 44 | |||
| 45 |
3/4✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
2 | if (reportDebuggingData || reportDuringWarmup) { |
| 46 | // This is a Unique ModelObject | ||
| 47 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto modelObject = m_model.getUniqueModelObject<OutputDebuggingData>(); |
| 48 |
1/1✓ Branch 1 taken 2 times.
|
2 | modelObject.setReportDebuggingData(reportDebuggingData); |
| 49 |
1/1✓ Branch 1 taken 2 times.
|
2 | modelObject.setReportDuringWarmup(reportDuringWarmup); |
| 50 |
1/1✓ Branch 1 taken 2 times.
|
2 | result = modelObject; |
| 51 | 2 | } | |
| 52 | |||
| 53 | 2 | return result; | |
| 54 | |||
| 55 | ✗ | } // End of translate function | |
| 56 | |||
| 57 | } // end namespace energyplus | ||
| 58 | } // end namespace openstudio | ||
| 59 |