src/energyplus/ForwardTranslator/ForwardTranslateSimulationControl.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/SimulationControl.hpp" | ||
| 9 | |||
| 10 | #include "../../model/PlantLoop.hpp" | ||
| 11 | #include "../../model/PlantLoop_Impl.hpp" | ||
| 12 | #include "../../model/SizingPeriod.hpp" | ||
| 13 | #include "../../model/SizingPeriod_Impl.hpp" | ||
| 14 | #include "../../model/SizingPlant.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/SimulationControl_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | using namespace std; | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | 856 | boost::optional<IdfObject> ForwardTranslator::translateSimulationControl(SimulationControl& modelObject) { | |
| 28 | |||
| 29 |
2/2✓ Branch 1 taken 856 times.
✓ Branch 4 taken 856 times.
|
856 | IdfObject simCon = createAndRegisterIdfObject(openstudio::IddObjectType::SimulationControl, modelObject); |
| 30 | |||
| 31 |
2/2✓ Branch 0 taken 1772 times.
✓ Branch 1 taken 2518 times.
|
4290 | auto boolToString = [](bool b) { return b ? "Yes" : "No"; }; |
| 32 | |||
| 33 | // NOTE: the logic for these three where it's defaulted is inside the model object: | ||
| 34 | // it checks if you have Design Days + (Zonal equipment / AirLoopHVAC / PlantLoop) | ||
| 35 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 5 taken 856 times.
✓ Branch 8 taken 856 times.
|
1712 | simCon.setString(openstudio::SimulationControlFields::DoZoneSizingCalculation, boolToString(modelObject.doZoneSizingCalculation())); |
| 36 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 5 taken 856 times.
✓ Branch 8 taken 856 times.
|
1712 | simCon.setString(openstudio::SimulationControlFields::DoSystemSizingCalculation, boolToString(modelObject.doSystemSizingCalculation())); |
| 37 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 5 taken 856 times.
✓ Branch 8 taken 856 times.
|
1712 | simCon.setString(openstudio::SimulationControlFields::DoPlantSizingCalculation, boolToString(modelObject.doPlantSizingCalculation())); |
| 38 | |||
| 39 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 5 taken 856 times.
✓ Branch 8 taken 856 times.
|
1712 | simCon.setString(openstudio::SimulationControlFields::RunSimulationforSizingPeriods, boolToString(modelObject.runSimulationforSizingPeriods())); |
| 40 | |||
| 41 | // DLM: might want to check for weather file object? | ||
| 42 |
2/2✓ Branch 1 taken 856 times.
✓ Branch 4 taken 856 times.
|
856 | simCon.setString(openstudio::SimulationControlFields::RunSimulationforWeatherFileRunPeriods, |
| 43 |
1/1✓ Branch 1 taken 856 times.
|
856 | boolToString(modelObject.runSimulationforWeatherFileRunPeriods())); |
| 44 | |||
| 45 | // The logic when defaulted is inside the model object | ||
| 46 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 846 times.
|
856 | if (!modelObject.isDoHVACSizingSimulationforSizingPeriodsDefaulted()) { |
| 47 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | simCon.setString(openstudio::SimulationControlFields::DoHVACSizingSimulationforSizingPeriods, |
| 48 |
1/1✓ Branch 1 taken 10 times.
|
10 | boolToString(modelObject.doHVACSizingSimulationforSizingPeriods())); |
| 49 |
3/3✓ Branch 1 taken 846 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 844 times.
|
846 | } else if (modelObject.doHVACSizingSimulationforSizingPeriods()) { |
| 50 | // We only write it if it's not the IDD default of "No", so we don't want to pollute the IDF with advanced fields that people aren't used to. | ||
| 51 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | simCon.setString(openstudio::SimulationControlFields::DoHVACSizingSimulationforSizingPeriods, "Yes"); |
| 52 | } | ||
| 53 | |||
| 54 |
3/3✓ Branch 1 taken 856 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 851 times.
|
856 | if (!modelObject.isMaximumNumberofHVACSizingSimulationPassesDefaulted()) { |
| 55 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | simCon.setInt(openstudio::SimulationControlFields::MaximumNumberofHVACSizingSimulationPasses, |
| 56 | modelObject.maximumNumberofHVACSizingSimulationPasses()); | ||
| 57 | } | ||
| 58 | |||
| 59 | // other fields mapped to Building | ||
| 60 | |||
| 61 |
1/1✓ Branch 1 taken 856 times.
|
1712 | return simCon; |
| 62 | 856 | } | |
| 63 | |||
| 64 | } // namespace energyplus | ||
| 65 | |||
| 66 | } // namespace openstudio | ||
| 67 |