src/energyplus/ReverseTranslator/ReverseTranslateSolarCollectorPerformancePhotovoltaicThermalBIPVT.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/SolarCollectorPerformancePhotovoltaicThermalBIPVT.hpp" | ||
| 9 | |||
| 10 | #include "../../model/SurfacePropertyOtherSideConditionsModel.hpp" | ||
| 11 | #include "../../model/SurfacePropertyOtherSideConditionsModel_Impl.hpp" | ||
| 12 | |||
| 13 | #include "../../model/Schedule.hpp" | ||
| 14 | #include "../../model/Schedule_Impl.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/SolarCollectorPerformance_PhotovoltaicThermal_BIPVT_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | 1 | boost::optional<ModelObject> ReverseTranslator::translateSolarCollectorPerformancePhotovoltaicThermalBIPVT(const WorkspaceObject& workspaceObject) { | |
| 26 | |||
| 27 |
1/1✓ Branch 1 taken 1 time.
|
1 | openstudio::model::SolarCollectorPerformancePhotovoltaicThermalBIPVT modelObject(m_model); |
| 28 | |||
| 29 | // Name | ||
| 30 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | if (boost::optional<std::string> name_ = workspaceObject.name()) { |
| 31 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setName(name_.get()); |
| 32 | 1 | } | |
| 33 | |||
| 34 | // Boundary Conditions Model Name: Required Object | ||
| 35 | 1 | if (boost::optional<WorkspaceObject> wo_ = | |
| 36 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getTarget(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::BoundaryConditionsModelName)) { |
| 37 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) { |
| 38 | // TODO: check return types | ||
| 39 | 1 | if (boost::optional<SurfacePropertyOtherSideConditionsModel> boundaryConditionsModel_ = | |
| 40 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | mo_->optionalCast<SurfacePropertyOtherSideConditionsModel>()) { |
| 41 | // The Ctor creates a BoundaryConditionsModel for us, so we can remove it now that we found the right one | ||
| 42 |
1/1✓ Branch 1 taken 1 time.
|
1 | auto defaultOSCM = modelObject.boundaryConditionsModel(); |
| 43 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setBoundaryConditionsModel(boundaryConditionsModel_.get()); |
| 44 |
1/1✓ Branch 1 taken 1 time.
|
1 | defaultOSCM.remove(); |
| 45 | 1 | } else { | |
| 46 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Boundary Conditions Model Name'"); | |
| 47 | 1 | } | |
| 48 | } else { | ||
| 49 | ✗ | LOG(Error, "For " << workspaceObject.briefDescription() | |
| 50 | << ", cannot reverse translate required object 'Boundary Conditions Model Name'. Using defaulted one."); | ||
| 51 | 1 | } | |
| 52 |
8/8✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 17 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
|
1 | LOG(Warn, |
| 53 | "For " << workspaceObject.briefDescription() << ", cannot find required object 'Boundary Conditions Model Name'. Using defaulted one."); | ||
| 54 | 1 | } | |
| 55 | // Availability Schedule Name: Optional Object | ||
| 56 | 1 | if (boost::optional<WorkspaceObject> wo_ = | |
| 57 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getTarget(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::AvailabilityScheduleName)) { |
| 58 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<ModelObject> mo_ = translateAndMapWorkspaceObject(wo_.get())) { |
| 59 | // TODO: check return types | ||
| 60 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (boost::optional<Schedule> availabilitySchedule_ = mo_->optionalCast<Schedule>()) { |
| 61 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setAvailabilitySchedule(availabilitySchedule_.get()); |
| 62 | } else { | ||
| 63 | ✗ | LOG(Warn, workspaceObject.briefDescription() << " has a wrong type for 'Availability Schedule Name'"); | |
| 64 | 1 | } | |
| 65 | 1 | } | |
| 66 | 1 | } | |
| 67 | // Effective Plenum Gap Thickness Behind PV Modules: Required Double | ||
| 68 | 1 | if (boost::optional<double> effectivePlenumGapThicknessBehindPVModules_ = | |
| 69 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::EffectivePlenumGapThicknessBehindPVModules)) { |
| 70 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setEffectivePlenumGapThicknessBehindPVModules(effectivePlenumGapThicknessBehindPVModules_.get()); |
| 71 | } else { | ||
| 72 | ✗ | LOG(Error, | |
| 73 | "For " << workspaceObject.briefDescription() << ", cannot find required property 'Effective Plenum Gap Thickness Behind PV Modules'"); | ||
| 74 | ✗ | return boost::none; | |
| 75 | } | ||
| 76 | |||
| 77 | // PV Cell Normal Transmittance-Absorptance Product: Optional Double | ||
| 78 | 1 | if (boost::optional<double> pVCellNormalTransmittanceAbsorptanceProduct_ = | |
| 79 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::PVCellNormalTransmittanceAbsorptanceProduct)) { |
| 80 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setPVCellNormalTransmittanceAbsorptanceProduct(pVCellNormalTransmittanceAbsorptanceProduct_.get()); |
| 81 | } | ||
| 82 | |||
| 83 | // Backing Material Normal Transmittance-Absorptance Product: Optional Double | ||
| 84 |
1/1✓ Branch 1 taken 1 time.
|
1 | if (boost::optional<double> backingMaterialNormalTransmittanceAbsorptanceProduct_ = workspaceObject.getDouble( |
| 85 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::BackingMaterialNormalTransmittanceAbsorptanceProduct)) { |
| 86 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setBackingMaterialNormalTransmittanceAbsorptanceProduct(backingMaterialNormalTransmittanceAbsorptanceProduct_.get()); |
| 87 | } | ||
| 88 | |||
| 89 | // Cladding Normal Transmittance-Absorptance Product: Optional Double | ||
| 90 | 1 | if (boost::optional<double> claddingNormalTransmittanceAbsorptanceProduct_ = | |
| 91 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::CladdingNormalTransmittanceAbsorptanceProduct)) { |
| 92 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setCladdingNormalTransmittanceAbsorptanceProduct(claddingNormalTransmittanceAbsorptanceProduct_.get()); |
| 93 | } | ||
| 94 | |||
| 95 | // Fraction of Collector Gross Area Covered by PV Module: Optional Double | ||
| 96 | 1 | if (boost::optional<double> fractionofCollectorGrossAreaCoveredbyPVModule_ = | |
| 97 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::FractionofCollectorGrossAreaCoveredbyPVModule)) { |
| 98 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setFractionofCollectorGrossAreaCoveredbyPVModule(fractionofCollectorGrossAreaCoveredbyPVModule_.get()); |
| 99 | } | ||
| 100 | |||
| 101 | // Fraction of PV Cell Area to PV Module Area: Optional Double | ||
| 102 | 1 | if (boost::optional<double> fractionofPVCellAreatoPVModuleArea_ = | |
| 103 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::FractionofPVCellAreatoPVModuleArea)) { |
| 104 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setFractionofPVCellAreatoPVModuleArea(fractionofPVCellAreatoPVModuleArea_.get()); |
| 105 | } | ||
| 106 | |||
| 107 | // PV Module Top Thermal Resistance: Optional Double | ||
| 108 | 1 | if (boost::optional<double> pVModuleTopThermalResistance_ = | |
| 109 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::PVModuleTopThermalResistance)) { |
| 110 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setPVModuleTopThermalResistance(pVModuleTopThermalResistance_.get()); |
| 111 | } | ||
| 112 | |||
| 113 | // PV Module Bottom Thermal Resistance: Optional Double | ||
| 114 | 1 | if (boost::optional<double> pVModuleBottomThermalResistance_ = | |
| 115 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::PVModuleBottomThermalResistance)) { |
| 116 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setPVModuleBottomThermalResistance(pVModuleBottomThermalResistance_.get()); |
| 117 | } | ||
| 118 | |||
| 119 | // PV Module Front Longwave Emissivity: Optional Double | ||
| 120 | 1 | if (boost::optional<double> pVModuleFrontLongwaveEmissivity_ = | |
| 121 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::PVModuleFrontLongwaveEmissivity)) { |
| 122 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setPVModuleFrontLongwaveEmissivity(pVModuleFrontLongwaveEmissivity_.get()); |
| 123 | } | ||
| 124 | |||
| 125 | // PV Module Back Longwave Emissivity: Optional Double | ||
| 126 | 1 | if (boost::optional<double> pVModuleBackLongwaveEmissivity_ = | |
| 127 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::PVModuleBackLongwaveEmissivity)) { |
| 128 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setPVModuleBackLongwaveEmissivity(pVModuleBackLongwaveEmissivity_.get()); |
| 129 | } | ||
| 130 | |||
| 131 | // Glass Thickness: Optional Double | ||
| 132 | 1 | if (boost::optional<double> glassThickness_ = | |
| 133 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::GlassThickness)) { |
| 134 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setGlassThickness(glassThickness_.get()); |
| 135 | } | ||
| 136 | |||
| 137 | // Glass Refraction Index: Optional Double | ||
| 138 | 1 | if (boost::optional<double> glassRefractionIndex_ = | |
| 139 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::GlassRefractionIndex)) { |
| 140 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setGlassRefractionIndex(glassRefractionIndex_.get()); |
| 141 | } | ||
| 142 | |||
| 143 | // Glass Extinction Coefficient: Optional Double | ||
| 144 | 1 | if (boost::optional<double> glassExtinctionCoefficient_ = | |
| 145 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | workspaceObject.getDouble(SolarCollectorPerformance_PhotovoltaicThermal_BIPVTFields::GlassExtinctionCoefficient)) { |
| 146 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | modelObject.setGlassExtinctionCoefficient(glassExtinctionCoefficient_.get()); |
| 147 | } | ||
| 148 | |||
| 149 |
1/1✓ Branch 1 taken 1 time.
|
1 | return modelObject; |
| 150 | 1 | } // End of translate function | |
| 151 | |||
| 152 | } // end namespace energyplus | ||
| 153 | } // end namespace openstudio | ||
| 154 |