src/energyplus/ForwardTranslator/ForwardTranslateRunPeriodControlSpecialDays.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/RunPeriodControlSpecialDays.hpp" | ||
| 8 | #include <utilities/idd/RunPeriodControl_SpecialDays_FieldEnums.hxx> | ||
| 9 | #include <utilities/idd/OS_RunPeriodControl_SpecialDays_FieldEnums.hxx> | ||
| 10 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 11 | #include "../../utilities/core/StringHelpers.hpp" | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | using namespace openstudio::model; | ||
| 15 | |||
| 16 | namespace openstudio { | ||
| 17 | |||
| 18 | namespace energyplus { | ||
| 19 | |||
| 20 | 13 | boost::optional<IdfObject> ForwardTranslator::translateRunPeriodControlSpecialDays(RunPeriodControlSpecialDays& modelObject) { | |
| 21 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | IdfObject idfObject(openstudio::IddObjectType::RunPeriodControl_SpecialDays); |
| 22 | |||
| 23 |
1/1✓ Branch 1 taken 13 times.
|
13 | m_idfObjects.push_back(idfObject); |
| 24 | |||
| 25 | 13 | boost::optional<std::string> s; | |
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 13 times.
|
13 | s = modelObject.name(); |
| 28 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 29 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setName(*s); |
| 30 | } | ||
| 31 | |||
| 32 |
1/1✓ Branch 1 taken 13 times.
|
13 | s = modelObject.getString(OS_RunPeriodControl_SpecialDaysFields::StartDate); |
| 33 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 34 |
5/5✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
✓ Branch 13 taken 13 times.
|
39 | const auto temp = openstudio::replace(s.get(), "5th", "Last"); |
| 35 |
1/1✓ Branch 1 taken 13 times.
|
13 | idfObject.setString(RunPeriodControl_SpecialDaysFields::StartDate, temp); |
| 36 | 13 | } | |
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 13 times.
|
13 | s = modelObject.getString(OS_RunPeriodControl_SpecialDaysFields::Duration); |
| 39 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 40 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setString(RunPeriodControl_SpecialDaysFields::Duration, s.get()); |
| 41 | } | ||
| 42 | |||
| 43 |
1/1✓ Branch 1 taken 13 times.
|
13 | s = modelObject.getString(OS_RunPeriodControl_SpecialDaysFields::SpecialDayType); |
| 44 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 45 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setString(RunPeriodControl_SpecialDaysFields::SpecialDayType, s.get()); |
| 46 | } | ||
| 47 | |||
| 48 |
1/1✓ Branch 1 taken 13 times.
|
26 | return boost::optional<IdfObject>(idfObject); |
| 49 | 13 | } | |
| 50 | |||
| 51 | } // namespace energyplus | ||
| 52 | |||
| 53 | } // namespace openstudio | ||
| 54 |