Skip to content

Commit

Permalink
Merge pull request #4535 from NREL/4533_SurfacePropertySurroundingSur…
Browse files Browse the repository at this point in the history
…faces

Fix #4533 - Wrap SurfaceProperty:LocalEnvironment and SurfaceProperty:SurroundingSurfaces
  • Loading branch information
tijcolem committed Feb 18, 2022
2 parents e7ec8d4 + 3285797 commit 2f385d4
Show file tree
Hide file tree
Showing 34 changed files with 2,926 additions and 5 deletions.
4 changes: 1 addition & 3 deletions resources/energyplus/ProposedEnergy+.idd
Original file line number Diff line number Diff line change
Expand Up @@ -9649,7 +9649,7 @@ SurfaceProperty:LocalEnvironment,
\reference SurfaceLocalEnvironmentNames
A2, \field Exterior Surface Name
\type object-list
\object-list SurfaceNames
\object-list AllHeatTranSurfNames
\note Enter the name of an exterior surface object
A3, \field External Shading Fraction Schedule Name
\type object-list
Expand Down Expand Up @@ -9692,7 +9692,6 @@ SurfaceProperty:SurroundingSurfaces,
N1, \field Sky View Factor
\minimum 0.0
\maximum 1.0
\default 0.5
\note optional
A2, \field Sky Temperature Schedule Name
\type object-list
Expand All @@ -9702,7 +9701,6 @@ SurfaceProperty:SurroundingSurfaces,
N2, \field Ground View Factor
\minimum 0.0
\maximum 1.0
\default 0.5
\note optional
A3, \field Ground Temperature Schedule Name
\type object-list
Expand Down
78 changes: 78 additions & 0 deletions resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -6503,6 +6503,84 @@ OS:ZoneProperty:UserViewFactors:BySurfaceName,
\type real
\maximum 1.0

OS:SurfaceProperty:SurroundingSurfaces,
\min-fields 9
\memo This object defines a list of surrounding surfaces for an exterior surface.
\memo The sum of all defined view factors should not exceed 1.0.
\memo If only sky view is defined in this object, the ground view factor to this surface will be 1.0 subtracted with the ground view factor and all other defined surface view factors.
\memo If only ground view is defined in this object, the sky view factor to this surface will be 1.0 subtracted with the sky view factor and all other defined surface view factors.
\memo If neither of the sky and ground view factors are explicitly declared here, the sum of the sky and ground view factor would be 1.0 subtracted with all other defined surface view factors and the proportion will be set as the same with the global setting
\extensible:3
A1, \field Handle
\type handle
\required-field
A2, \field Name
\required-field
\type alpha
\reference SurroundingSurfacesNames
N1, \field Sky View Factor
\minimum 0.0
\maximum 1.0
\autocalculatable
A3, \field Sky Temperature Schedule Name
\type object-list
\object-list ScheduleNames
\note Schedule values are real numbers, -100.0 to 100.0, units C
\note If the field is left blank the global sky temperature is be used
N2, \field Ground View Factor
\minimum 0.0
\maximum 1.0
\autocalculatable
\note optional
A4, \field Ground Temperature Schedule Name
\type object-list
\object-list ScheduleNames
\note Schedule values are real numbers, -100.0 to 100.0, units C
\note If the field is left blank the global ground temperature is used
A5, \field Surrounding Surface 1 Name
\begin-extensible
\required-field
\type alpha
\note This is the name of the surrounding surface, NOT an actual surface in your model
N3, \field Surrounding Surface 1 View Factor
\required-field
\minimum 0.0
\maximum 1.0
A6; \field Surrounding Surface 1 Temperature Schedule Name
\required-field
\type object-list
\object-list ScheduleNames
\note Schedule values are real numbers, -100.0 to 100.0, units C

OS:SurfaceProperty:LocalEnvironment,
\min-fields 4
\memo This object defines the local environment properties of an exterior surface.
\memo One or more environment properties have to be defined and linked to the exterior surface.
A1, \field Handle
\type handle
\required-field
A2, \field Name
\required-field
\type alpha
\reference SurfaceLocalEnvironmentNames
A3, \field Exterior Surface Name
\required-field
\type object-list
\object-list AllHeatTranSurfNames
\note Enter the name of an exterior surface object
A4, \field External Shading Fraction Schedule Name
\type object-list
\object-list ScheduleNames
\note Enter the name of a Schedule object
A5, \field Surrounding Surfaces Object Name
\type object-list
\object-list SurroundingSurfacesNames
\note Enter the name of a SurfaceProperty:SurroundingSurfaces object
A6; \field Outdoor Air Node Name
\type object-list
\object-list OutdoorAirNodeNames
\note Enter the name of an OutdoorAir:Node object

\group OpenStudio Space Loads

OS:InternalMass,
Expand Down
6 changes: 6 additions & 0 deletions src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateSurfacePropertyConvectionCoefficients.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyConvectionCoefficientsMultipleSurface.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyExposedFoundationPerimeter.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyLocalEnvironment.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyOtherSideCoefficients.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyOtherSideConditionsModel.cpp
ForwardTranslator/ForwardTranslateSurfacePropertySurroundingSurfaces.cpp
ForwardTranslator/ForwardTranslateSwimmingPoolIndoor.cpp
ForwardTranslator/ForwardTranslateTableMultiVariableLookup.cpp
ForwardTranslator/ForwardTranslateTemperingValve.cpp
Expand Down Expand Up @@ -568,6 +570,8 @@ set(${target_name}_src
ReverseTranslator/ReverseTranslateSurfaceConvectionAlgorithmInside.cpp
ReverseTranslator/ReverseTranslateSurfaceConvectionAlgorithmOutside.cpp
ReverseTranslator/ReverseTranslateSurfacePropertyExposedFoundationPerimeter.cpp
ReverseTranslator/ReverseTranslateSurfacePropertyLocalEnvironment.cpp
ReverseTranslator/ReverseTranslateSurfacePropertySurroundingSurfaces.cpp
ReverseTranslator/ReverseTranslateSwimmingPoolIndoor.cpp
ReverseTranslator/ReverseTranslateThermostatSetpointDualSetpoint.cpp
ReverseTranslator/ReverseTranslateTimestep.cpp
Expand Down Expand Up @@ -728,6 +732,8 @@ set(${target_name}_test_src
Test/Surface_GTest.cpp
Test/SurfaceControlMovableInsulation_GTest.cpp
Test/SurfacePropertyConvectionCoefficients_GTest.cpp
Test/SurfacePropertyLocalEnvironment_GTest.cpp
Test/SurfacePropertySurroundingSurfaces_GTest.cpp
Test/SwimmingPoolIndoor_GTest.cpp
Test/TableMultiVariableLookup_GTest.cpp
Test/ThermalStorageChilledWaterStratified_GTest.cpp
Expand Down
10 changes: 10 additions & 0 deletions src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2824,6 +2824,11 @@ namespace energyplus {
retVal = translateSurfacePropertyConvectionCoefficientsMultipleSurface(obj);
break;
}
case openstudio::IddObjectType::OS_SurfaceProperty_LocalEnvironment: {
model::SurfacePropertyLocalEnvironment obj = modelObject.cast<SurfacePropertyLocalEnvironment>();
retVal = translateSurfacePropertyLocalEnvironment(obj);
break;
}
case openstudio::IddObjectType::OS_SurfaceProperty_ExposedFoundationPerimeter: {
model::SurfacePropertyExposedFoundationPerimeter obj = modelObject.cast<SurfacePropertyExposedFoundationPerimeter>();
retVal = translateSurfacePropertyExposedFoundationPerimeter(obj);
Expand All @@ -2839,6 +2844,11 @@ namespace energyplus {
retVal = translateSurfacePropertyOtherSideConditionsModel(obj);
break;
}
case openstudio::IddObjectType::OS_SurfaceProperty_SurroundingSurfaces: {
model::SurfacePropertySurroundingSurfaces obj = modelObject.cast<SurfacePropertySurroundingSurfaces>();
retVal = translateSurfacePropertySurroundingSurfaces(obj);
break;
}
case openstudio::IddObjectType::OS_SubSurface: {
model::SubSurface subSurface = modelObject.cast<SubSurface>();
retVal = translateSubSurface(subSurface);
Expand Down
6 changes: 6 additions & 0 deletions src/energyplus/ForwardTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,11 @@ namespace model {
class SurfaceControlMovableInsulation;
class SurfacePropertyConvectionCoefficients;
class SurfacePropertyConvectionCoefficientsMultipleSurface;
class SurfacePropertyLocalEnvironment;
class SurfacePropertyExposedFoundationPerimeter;
class SurfacePropertyOtherSideCoefficients;
class SurfacePropertyOtherSideConditionsModel;
class SurfacePropertySurroundingSurfaces;
class SwimmingPoolIndoor;
class TableMultiVariableLookup;
class TemperingValve;
Expand Down Expand Up @@ -1392,6 +1394,10 @@ namespace energyplus {

boost::optional<IdfObject> translateSurfacePropertyOtherSideConditionsModel(model::SurfacePropertyOtherSideConditionsModel& modelObject);

boost::optional<IdfObject> translateSurfacePropertyLocalEnvironment(model::SurfacePropertyLocalEnvironment& modelObject);

boost::optional<IdfObject> translateSurfacePropertySurroundingSurfaces(model::SurfacePropertySurroundingSurfaces& modelObject);

boost::optional<IdfObject> translateSwimmingPoolIndoor(model::SwimmingPoolIndoor& modelObject);

boost::optional<IdfObject> translateTableMultiVariableLookup(model::TableMultiVariableLookup& modelObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "../../model/SurfacePropertyOtherSideCoefficients.hpp"
#include "../../model/SurfacePropertyOtherSideConditionsModel.hpp"
#include "../../model/SurfacePropertyConvectionCoefficients.hpp"
#include "../../model/SurfacePropertyLocalEnvironment.hpp"

#include "../../utilities/idf/IdfExtensibleGroup.hpp"

Expand Down Expand Up @@ -129,6 +130,10 @@ namespace energyplus {
translateAndMapModelObject(_sCoefs.get());
}

if (boost::optional<SurfacePropertyLocalEnvironment> localEnv_ = modelObject.surfacePropertyLocalEnvironment()) {
translateAndMapModelObject(localEnv_.get());
}

boost::optional<double> viewFactortoGround = modelObject.viewFactortoGround();
if (viewFactortoGround) {
idfObject.setDouble(FenestrationSurface_DetailedFields::ViewFactortoGround, *viewFactortoGround);
Expand Down
5 changes: 5 additions & 0 deletions src/energyplus/ForwardTranslator/ForwardTranslateSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "../../model/SurfacePropertyOtherSideCoefficients.hpp"
#include "../../model/SurfacePropertyOtherSideConditionsModel.hpp"
#include "../../model/SurfacePropertyConvectionCoefficients.hpp"
#include "../../model/SurfacePropertyLocalEnvironment.hpp"
#include "../../model/PlanarSurface.hpp"
#include "../../model/FoundationKiva.hpp"
#include "../../model/FoundationKiva_Impl.hpp"
Expand Down Expand Up @@ -211,6 +212,10 @@ namespace energyplus {
translateAndMapModelObject(_sCoefs.get());
}

if (boost::optional<SurfacePropertyLocalEnvironment> localEnv_ = modelObject.surfacePropertyLocalEnvironment()) {
translateAndMapModelObject(localEnv_.get());
}

if (boost::optional<SurfacePropertyExposedFoundationPerimeter> _sProps = modelObject.surfacePropertyExposedFoundationPerimeter()) {
translateAndMapModelObject(_sProps.get());
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/***********************************************************************************************************************
* OpenStudio(R), Copyright (c) 2008-2022, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
* derived from this software without specific prior written permission from the respective party.
*
* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
* written permission from Alliance for Sustainable Energy, LLC.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

#include "../ForwardTranslator.hpp"
#include "../../model/Model.hpp"

#include "../../model/SurfacePropertyLocalEnvironment.hpp"

#include "../../model/PlanarSurface.hpp"

#include "../../model/SurfacePropertySurroundingSurfaces.hpp"
#include "../../model/SurfacePropertySurroundingSurfaces_Impl.hpp"

//#include "../../model/OutdoorAirNode.hpp"
//#include "../../model/OutdoorAirNode_Impl.hpp"

#include <utilities/idd/SurfaceProperty_LocalEnvironment_FieldEnums.hxx>
#include <utilities/idd/IddEnums.hxx>

using namespace openstudio::model;

namespace openstudio {

namespace energyplus {

boost::optional<IdfObject> ForwardTranslator::translateSurfacePropertyLocalEnvironment(model::SurfacePropertyLocalEnvironment& modelObject) {

// Instantiate an IdfObject of the class to store the values,
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::SurfaceProperty_LocalEnvironment, modelObject);

// Exterior Surface Name: Optional Object
if (boost::optional<PlanarSurface> _exteriorSurface = modelObject.exteriorSurface()) {
if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_exteriorSurface.get())) {
idfObject.setString(SurfaceProperty_LocalEnvironmentFields::ExteriorSurfaceName, _owo->nameString());
}
}

// External Shading Fraction Schedule Name: Optional Object
if (boost::optional<Schedule> _externalShadingFractionSchedule = modelObject.externalShadingFractionSchedule()) {
if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_externalShadingFractionSchedule.get())) {
idfObject.setString(SurfaceProperty_LocalEnvironmentFields::ExternalShadingFractionScheduleName, _owo->nameString());
}
}

// Surrounding Surfaces Object Name: Optional Object
if (boost::optional<SurfacePropertySurroundingSurfaces> sp_ = modelObject.surfacePropertySurroundingSurfaces()) {
if (boost::optional<IdfObject> _owo = translateAndMapModelObject(sp_.get())) {
idfObject.setString(SurfaceProperty_LocalEnvironmentFields::SurroundingSurfacesObjectName, _owo->nameString());
}
}

// Outdoor Air Node Name: Optional Object
// if (boost::optional<OutdoorAirNode> _outdoorAirNode = modelObject.outdoorAirNode()) {
// if (boost::optional<IdfObject> _owo = translateAndMapModelObject(_outdoorAirNode.get())) {
// idfObject.setString(SurfaceProperty_LocalEnvironmentFields::OutdoorAirNodeName, _owo->nameString());
// }
// }

return idfObject;
} // End of translate function

} // end namespace energyplus
} // end namespace openstudio

0 comments on commit 2f385d4

Please sign in to comment.