src/energyplus/ReverseTranslator/ReverseTranslateSimulationControl.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/SimulationControl.hpp" | ||
| 9 | #include "../../model/SimulationControl_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/SimulationControl_FieldEnums.hxx> | ||
| 12 | |||
| 13 | using namespace openstudio::model; | ||
| 14 | |||
| 15 | namespace openstudio { | ||
| 16 | |||
| 17 | namespace energyplus { | ||
| 18 | |||
| 19 | 50 | OptionalModelObject ReverseTranslator::translateSimulationControl(const WorkspaceObject& workspaceObject) { | |
| 20 | 50 | OptionalModelObject result; | |
| 21 |
1/1✓ Branch 1 taken 50 times.
|
50 | auto simCon = m_model.getUniqueModelObject<model::SimulationControl>(); |
| 22 |
1/1✓ Branch 1 taken 50 times.
|
50 | OptionalString optS = workspaceObject.name(); |
| 23 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
|
50 | if (optS) { |
| 24 | ✗ | simCon.setName(*optS); | |
| 25 | } | ||
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::DoZoneSizingCalculation); |
| 28 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 29 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | std::string temp = *optS; |
| 30 |
1/1✓ Branch 2 taken 50 times.
|
50 | boost::to_lower(temp); |
| 31 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 11 times.
|
50 | if (temp == "no") { |
| 32 |
1/1✓ Branch 1 taken 39 times.
|
39 | simCon.setDoZoneSizingCalculation(false); |
| 33 | } else { | ||
| 34 |
1/1✓ Branch 1 taken 11 times.
|
11 | simCon.setDoZoneSizingCalculation(true); |
| 35 | } | ||
| 36 | 50 | } | |
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::DoSystemSizingCalculation); |
| 39 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 40 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | std::string temp = *optS; |
| 41 |
1/1✓ Branch 2 taken 50 times.
|
50 | boost::to_lower(temp); |
| 42 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 5 times.
|
50 | if (temp == "no") { |
| 43 |
1/1✓ Branch 1 taken 45 times.
|
45 | simCon.setDoSystemSizingCalculation(false); |
| 44 | } else { | ||
| 45 |
1/1✓ Branch 1 taken 5 times.
|
5 | simCon.setDoSystemSizingCalculation(true); |
| 46 | } | ||
| 47 | 50 | } | |
| 48 | |||
| 49 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::DoPlantSizingCalculation); |
| 50 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 51 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | std::string temp = *optS; |
| 52 |
1/1✓ Branch 2 taken 50 times.
|
50 | boost::to_lower(temp); |
| 53 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 4 times.
|
50 | if (temp == "no") { |
| 54 |
1/1✓ Branch 1 taken 46 times.
|
46 | simCon.setDoPlantSizingCalculation(false); |
| 55 | } else { | ||
| 56 |
1/1✓ Branch 1 taken 4 times.
|
4 | simCon.setDoPlantSizingCalculation(true); |
| 57 | } | ||
| 58 | 50 | } | |
| 59 | |||
| 60 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::RunSimulationforSizingPeriods); |
| 61 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 62 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | std::string temp = *optS; |
| 63 |
1/1✓ Branch 2 taken 50 times.
|
50 | boost::to_lower(temp); |
| 64 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 32 times.
|
50 | if (temp == "no") { |
| 65 |
1/1✓ Branch 1 taken 18 times.
|
18 | simCon.setRunSimulationforSizingPeriods(false); |
| 66 | } else { | ||
| 67 |
1/1✓ Branch 1 taken 32 times.
|
32 | simCon.setRunSimulationforSizingPeriods(true); |
| 68 | } | ||
| 69 | 50 | } | |
| 70 | |||
| 71 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::RunSimulationforWeatherFileRunPeriods); |
| 72 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 73 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
|
50 | std::string temp = *optS; |
| 74 |
1/1✓ Branch 2 taken 50 times.
|
50 | boost::to_lower(temp); |
| 75 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 43 times.
|
50 | if (temp == "no") { |
| 76 |
1/1✓ Branch 1 taken 7 times.
|
7 | simCon.setRunSimulationforWeatherFileRunPeriods(false); |
| 77 | } else { | ||
| 78 |
1/1✓ Branch 1 taken 43 times.
|
43 | simCon.setRunSimulationforWeatherFileRunPeriods(true); |
| 79 | } | ||
| 80 | 50 | } | |
| 81 | |||
| 82 |
1/1✓ Branch 1 taken 50 times.
|
50 | optS = workspaceObject.getString(SimulationControlFields::DoHVACSizingSimulationforSizingPeriods); |
| 83 |
1/2✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
|
50 | if (optS) { |
| 84 |
5/5✓ Branch 1 taken 50 times.
✓ Branch 4 taken 50 times.
✓ Branch 7 taken 50 times.
✓ Branch 10 taken 1 time.
✓ Branch 11 taken 49 times.
|
150 | if (openstudio::istringEqual("Yes", optS.get())) { |
| 85 |
1/1✓ Branch 1 taken 1 time.
|
1 | simCon.setDoHVACSizingSimulationforSizingPeriods(true); |
| 86 | } else { | ||
| 87 |
1/1✓ Branch 1 taken 49 times.
|
49 | simCon.setDoHVACSizingSimulationforSizingPeriods(false); |
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | // Don't return default | ||
| 92 |
3/3✓ Branch 1 taken 50 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 32 times.
|
100 | if (boost::optional<int> _i = workspaceObject.getInt(SimulationControlFields::MaximumNumberofHVACSizingSimulationPasses, false)) { |
| 93 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | simCon.setMaximumNumberofHVACSizingSimulationPasses(_i.get()); |
| 94 | } | ||
| 95 | |||
| 96 |
1/1✓ Branch 1 taken 50 times.
|
50 | result = simCon; |
| 97 | 100 | return result; | |
| 98 | 50 | } | |
| 99 | |||
| 100 | } // namespace energyplus | ||
| 101 | |||
| 102 | } // namespace openstudio | ||
| 103 |