src/energyplus/ForwardTranslator/ForwardTranslateOutputMeter.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 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/OutputMeter.hpp" | ||
| 10 | #include "../../model/OutputMeter_Impl.hpp" | ||
| 11 | |||
| 12 | #include <utilities/idd/Output_Meter_FieldEnums.hxx> | ||
| 13 | #include <utilities/idd/Output_Meter_Cumulative_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/Output_Meter_MeterFileOnly_FieldEnums.hxx> | ||
| 15 | #include <utilities/idd/Output_Meter_Cumulative_MeterFileOnly_FieldEnums.hxx> | ||
| 16 | #include "../../utilities/core/StringHelpers.hpp" | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | |||
| 20 | using namespace openstudio::model; | ||
| 21 | |||
| 22 | using namespace std; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 397 | boost::optional<IdfObject> ForwardTranslator::translateOutputMeter(OutputMeter& modelObject) { | |
| 29 | 397 | boost::optional<IdfObject> idfObject; | |
| 30 | |||
| 31 |
1/1✓ Branch 1 taken 397 times.
|
397 | auto name = modelObject.name(); |
| 32 | |||
| 33 |
8/8✓ Branch 1 taken 397 times.
✓ Branch 3 taken 262 times.
✓ Branch 4 taken 135 times.
✓ Branch 6 taken 262 times.
✓ Branch 8 taken 61 times.
✓ Branch 9 taken 201 times.
✓ Branch 10 taken 61 times.
✓ Branch 11 taken 336 times.
|
397 | if (modelObject.meterFileOnly() && modelObject.cumulative()) { |
| 34 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | idfObject = IdfObject(openstudio::IddObjectType::Output_Meter_Cumulative_MeterFileOnly); |
| 35 |
2/2✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
|
61 | m_idfObjects.push_back(*idfObject); |
| 36 | |||
| 37 |
2/2✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
|
61 | idfObject->setString(Output_Meter_Cumulative_MeterFileOnlyFields::KeyName, name); |
| 38 | |||
| 39 |
2/3✓ Branch 1 taken 61 times.
✓ Branch 3 taken 61 times.
✗ Branch 4 not taken.
|
61 | if (!modelObject.isReportingFrequencyDefaulted()) { |
| 40 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | idfObject->setString(Output_Meter_Cumulative_MeterFileOnlyFields::ReportingFrequency, modelObject.reportingFrequency()); |
| 41 | } | ||
| 42 | |||
| 43 |
3/3✓ Branch 1 taken 336 times.
✓ Branch 3 taken 201 times.
✓ Branch 4 taken 135 times.
|
336 | } else if (modelObject.meterFileOnly()) { |
| 44 |
3/3✓ Branch 1 taken 201 times.
✓ Branch 4 taken 201 times.
✓ Branch 7 taken 201 times.
|
201 | idfObject = IdfObject(openstudio::IddObjectType::Output_Meter_MeterFileOnly); |
| 45 |
2/2✓ Branch 1 taken 201 times.
✓ Branch 4 taken 201 times.
|
201 | m_idfObjects.push_back(*idfObject); |
| 46 | |||
| 47 |
2/2✓ Branch 1 taken 201 times.
✓ Branch 4 taken 201 times.
|
201 | idfObject->setString(Output_Meter_MeterFileOnlyFields::KeyName, name); |
| 48 | |||
| 49 |
3/3✓ Branch 1 taken 201 times.
✓ Branch 3 taken 196 times.
✓ Branch 4 taken 5 times.
|
201 | if (!modelObject.isReportingFrequencyDefaulted()) { |
| 50 |
3/3✓ Branch 1 taken 196 times.
✓ Branch 4 taken 196 times.
✓ Branch 7 taken 196 times.
|
196 | idfObject->setString(Output_Meter_MeterFileOnlyFields::ReportingFrequency, modelObject.reportingFrequency()); |
| 51 | } | ||
| 52 | |||
| 53 |
3/3✓ Branch 1 taken 135 times.
✓ Branch 3 taken 61 times.
✓ Branch 4 taken 74 times.
|
135 | } else if (modelObject.cumulative()) { |
| 54 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | idfObject = IdfObject(openstudio::IddObjectType::Output_Meter_Cumulative); |
| 55 |
2/2✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
|
61 | m_idfObjects.push_back(*idfObject); |
| 56 | |||
| 57 |
2/2✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
|
61 | idfObject->setString(Output_Meter_CumulativeFields::KeyName, name); |
| 58 | |||
| 59 |
2/3✓ Branch 1 taken 61 times.
✓ Branch 3 taken 61 times.
✗ Branch 4 not taken.
|
61 | if (!modelObject.isReportingFrequencyDefaulted()) { |
| 60 |
3/3✓ Branch 1 taken 61 times.
✓ Branch 4 taken 61 times.
✓ Branch 7 taken 61 times.
|
61 | idfObject->setString(Output_Meter_CumulativeFields::ReportingFrequency, modelObject.reportingFrequency()); |
| 61 | } | ||
| 62 | |||
| 63 | } else { | ||
| 64 |
3/3✓ Branch 1 taken 74 times.
✓ Branch 4 taken 74 times.
✓ Branch 7 taken 74 times.
|
74 | idfObject = IdfObject(openstudio::IddObjectType::Output_Meter); |
| 65 |
2/2✓ Branch 1 taken 74 times.
✓ Branch 4 taken 74 times.
|
74 | m_idfObjects.push_back(*idfObject); |
| 66 | |||
| 67 |
2/2✓ Branch 1 taken 74 times.
✓ Branch 4 taken 74 times.
|
74 | idfObject->setString(Output_MeterFields::KeyName, name); |
| 68 | |||
| 69 |
3/3✓ Branch 1 taken 74 times.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 2 times.
|
74 | if (!modelObject.isReportingFrequencyDefaulted()) { |
| 70 |
3/3✓ Branch 1 taken 72 times.
✓ Branch 4 taken 72 times.
✓ Branch 7 taken 72 times.
|
72 | idfObject->setString(Output_MeterFields::ReportingFrequency, modelObject.reportingFrequency()); |
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | 794 | return idfObject; | |
| 75 | 397 | } | |
| 76 | |||
| 77 | } // namespace energyplus | ||
| 78 | |||
| 79 | } // namespace openstudio | ||
| 80 |