src/energyplus/ForwardTranslator/ForwardTranslateShadowCalculation.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/ShadowCalculation.hpp" | ||
| 8 | |||
| 9 | #include "../../model/ThermalZone.hpp" | ||
| 10 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 11 | #include <utilities/idd/ShadowCalculation_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/ZoneList_FieldEnums.hxx> | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 52 | boost::optional<IdfObject> ForwardTranslator::translateShadowCalculation(ShadowCalculation& modelObject) { | |
| 22 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | IdfObject idfObject(openstudio::IddObjectType::ShadowCalculation); |
| 23 | |||
| 24 | // Shading Calculation Method | ||
| 25 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setString(ShadowCalculationFields::ShadingCalculationMethod, modelObject.shadingCalculationMethod()); |
| 26 | |||
| 27 | // Shading Calculation Update Frequency Method | ||
| 28 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setString(ShadowCalculationFields::ShadingCalculationUpdateFrequencyMethod, modelObject.shadingCalculationUpdateFrequencyMethod()); |
| 29 | |||
| 30 | // Shading Calculation Update Frequency | ||
| 31 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setInt(ShadowCalculationFields::ShadingCalculationUpdateFrequency, modelObject.shadingCalculationUpdateFrequency()); |
| 32 | |||
| 33 | // Maximum Figures in Shadow Overlap Calculations | ||
| 34 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setInt(ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations, modelObject.maximumFiguresInShadowOverlapCalculations()); |
| 35 | |||
| 36 | // Polygon Clipping Algorithm | ||
| 37 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setString(ShadowCalculationFields::PolygonClippingAlgorithm, modelObject.polygonClippingAlgorithm()); |
| 38 | |||
| 39 | // Sky Diffuse Modeling Algorithm | ||
| 40 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setString(ShadowCalculationFields::SkyDiffuseModelingAlgorithm, modelObject.skyDiffuseModelingAlgorithm()); |
| 41 | |||
| 42 | // Pixel Counting Resolution | ||
| 43 |
2/2✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
|
52 | idfObject.setInt(ShadowCalculationFields::PixelCountingResolution, modelObject.pixelCountingResolution()); |
| 44 | |||
| 45 | // Output External Shading Calculation Results | ||
| 46 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 48 times.
|
52 | if (modelObject.outputExternalShadingCalculationResults()) { |
| 47 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | idfObject.setString(ShadowCalculationFields::OutputExternalShadingCalculationResults, "Yes"); |
| 48 | } else { | ||
| 49 |
2/2✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
|
96 | idfObject.setString(ShadowCalculationFields::OutputExternalShadingCalculationResults, "No"); |
| 50 | } | ||
| 51 | |||
| 52 | // Disable Self-Shading Within Shading Zone Groups | ||
| 53 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 51 times.
|
52 | if (modelObject.disableSelfShadingWithinShadingZoneGroups()) { |
| 54 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(ShadowCalculationFields::DisableSelfShadingWithinShadingZoneGroups, "Yes"); |
| 55 | } else { | ||
| 56 |
2/2✓ Branch 1 taken 51 times.
✓ Branch 4 taken 51 times.
|
102 | idfObject.setString(ShadowCalculationFields::DisableSelfShadingWithinShadingZoneGroups, "No"); |
| 57 | } | ||
| 58 | |||
| 59 | // Disable Self-Shading From Shading Zone Groups to Other Zones | ||
| 60 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 48 times.
|
52 | if (modelObject.disableSelfShadingFromShadingZoneGroupstoOtherZones()) { |
| 61 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | idfObject.setString(ShadowCalculationFields::DisableSelfShadingFromShadingZoneGroupstoOtherZones, "Yes"); |
| 62 | } else { | ||
| 63 |
2/2✓ Branch 1 taken 48 times.
✓ Branch 4 taken 48 times.
|
96 | idfObject.setString(ShadowCalculationFields::DisableSelfShadingFromShadingZoneGroupstoOtherZones, "No"); |
| 64 | } | ||
| 65 | |||
| 66 | // Shading Zone Group (E+: Shading Zone Group 1 ZoneList Name) | ||
| 67 | // **Extensible** for ZoneLists | ||
| 68 |
3/3✓ Branch 1 taken 54 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 52 times.
|
54 | for (unsigned i = 0; i < modelObject.numberofShadingZoneGroups(); ++i) { |
| 69 | |||
| 70 |
1/1✓ Branch 1 taken 2 times.
|
2 | std::vector<ThermalZone> thermalZones = modelObject.getShadingZoneGroup(i); |
| 71 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | if (!thermalZones.empty()) { |
| 72 | |||
| 73 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | IdfObject zoneList(IddObjectType::ZoneList); |
| 74 |
1/1✓ Branch 2 taken 2 times.
|
2 | std::string zoneListName = "ShadowCalculation Shading Zone Group" + std::to_string(i + 1); |
| 75 |
1/1✓ Branch 1 taken 2 times.
|
2 | zoneList.setName(zoneListName); |
| 76 | // Register it | ||
| 77 |
1/1✓ Branch 1 taken 2 times.
|
2 | m_idfObjects.push_back(zoneList); |
| 78 | |||
| 79 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 2 times.
|
5 | for (const ThermalZone& tz : thermalZones) { |
| 80 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto eg = zoneList.pushExtensibleGroup(); |
| 81 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | eg.setString(ZoneListExtensibleFields::ZoneName, tz.name().get()); |
| 82 | 3 | } | |
| 83 | |||
| 84 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto eg = idfObject.pushExtensibleGroup(); |
| 85 |
1/1✓ Branch 1 taken 2 times.
|
2 | eg.setString(ShadowCalculationExtensibleFields::ShadingZoneGroupZoneListName, zoneListName); |
| 86 | 2 | } | |
| 87 | 2 | } | |
| 88 | |||
| 89 |
1/1✓ Branch 1 taken 52 times.
|
52 | m_idfObjects.push_back(idfObject); |
| 90 | |||
| 91 |
1/1✓ Branch 1 taken 52 times.
|
104 | return boost::optional<IdfObject>(idfObject); |
| 92 | 52 | } | |
| 93 | |||
| 94 | } // namespace energyplus | ||
| 95 | |||
| 96 | } // namespace openstudio | ||
| 97 |