Skip to content

Commit

Permalink
Merge pull request #4009 from NREL/4006_SwimmingPool
Browse files Browse the repository at this point in the history
Fix #4006 - Add SwimmingPool:Indoor to SDK
  • Loading branch information
tijcolem authored Jul 16, 2020
2 parents 3bdb275 + b7f242f commit 736ff6a
Show file tree
Hide file tree
Showing 20 changed files with 2,036 additions and 35 deletions.
12 changes: 6 additions & 6 deletions developer/ruby/SubProjectClassGenerators/ModelClassGenerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ def cppIncludes()
end
}
if @hasScheduleFields
result << "#include \"../../model/ScheduleTypeLimits.hpp\"\n"
result << "#include \"../../model/ScheduleTypeRegistry.hpp\"\n"
result << "#include \"ScheduleTypeLimits.hpp\"\n"
result << "#include \"ScheduleTypeRegistry.hpp\"\n"
end

result << "\n" if preamble == ""
Expand Down Expand Up @@ -1267,7 +1267,7 @@ def cppPublicClassPublicMethods()
result << " return getImpl<detail::" << @className << "_Impl>()->" << field.setterName << "(" << field.setterArgumentName << ");\n"
result << "}\n\n"
else
result << "void " << @className << "::" << field.setterName << "(" << field.publicClassSetterType << " " << field.setterArgumentName << ") {\n"
result << "bool " << @className << "::" << field.setterName << "(" << field.publicClassSetterType << " " << field.setterArgumentName << ") {\n"
result << " getImpl<detail::" << @className << "_Impl>()->" << field.setterName << "(" << field.setterArgumentName << ");\n"
result << "}\n\n"
end
Expand Down Expand Up @@ -1429,8 +1429,8 @@ def gtestIncludes()
@nonextensibleFields.each { |field|
if field.isObjectList?
result << preamble
result << "#include \"../model/" << field.objectListClassName << ".hpp\"\n"
result << "#include \"../model/" << field.objectListClassName << "_Impl.hpp\"\n\n"
result << "#include \"../" << field.objectListClassName << ".hpp\"\n"
result << "#include \"../" << field.objectListClassName << "_Impl.hpp\"\n\n"
preamble = ""
end
}
Expand Down Expand Up @@ -1580,7 +1580,7 @@ def gtestGetterSetters
end

if !bad_val.nil?
result << " Bad Value\n";
result << " // Bad Value\n";
result << " EXPECT_FALSE(#{instanceName}." << field.setterName << "(#{bad_val}));\n";

if field.optionalGetter?
Expand Down
32 changes: 4 additions & 28 deletions developer/ruby/SubProjectClassGenerators/TranslatorGenerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,41 +335,17 @@ def generateForwardTranslateFunction()
result << " // " << field.name << ": " << (field.isRequired? ? "Required" : "Optional") << (field.isNode? ? " Node": " Object") << "\n"
if field.optionalGetter?
result << " if (" << field.getterReturnType() << " _" << field.getterName << " = "<< field.getterName() << "()) {\n"
result << " if ( boost::optional<WorkspaceObject> _owo = translateAndMapModelObject(_" << field.getterName << ".get()) ) {\n"
result << " if ( boost::optional<IdfObject> _owo = translateAndMapModelObject(_" << field.getterName << ".get()) ) {\n"
result << " idfObject.setString(" << field.fieldEnum << ", _owo->nameString());\n"
result << " }\n"
result << " }\n"
else
result << " " << field.getterReturnType << " " << field.getterName << " = modelObject." << field.getterName << "();"
result << " if ( boost::optional<WorkspaceObject> _owo = translateAndMapModelObject(" << field.getterName << ") ) {\n"
result << " " << field.getterReturnType << " " << field.getterName << " = modelObject." << field.getterName << "();\n"
result << " if ( boost::optional<IdfObject> _owo = translateAndMapModelObject(" << field.getterName << ") ) {\n"
result << " idfObject.setString(" << field.fieldEnum << ", _owo->nameString());\n"
result << " }\n"
end

result << " if ( (_wo = workspaceObject.getTarget(#{field.fieldEnum})) ) {\n"
result << " if( (_mo = translateAndMapWorkspaceObject(_wo.get())) ) {\n"
result << " // TODO: check return types\n"
result << " if (" << field.getterReturnType(true) << " _"
result << field.getterName << " = _mo->optionalCast<" << field.getterReturnType(false) << ">()) {\n"
result << " modelObject." << field.setterName << "(_" << field.getterName << ".get());\n"
result << " } else {\n"
result << " LOG(Warn, workspaceObject.briefDescription() << \" has a wrong type for '" << field.name << "'\");\n"
result << " }\n"
if field.isRequired?
result << " } else {\n"
result << ' LOG(Error, "For " << workspaceObject.briefDescription()'
result << " << \", cannot reverse translate required object '" << field.name << "'\");" << "\n"
result << " return result;\n"
result << " }\n"
result << " } else {\n"
result << ' LOG(Error, "For " << workspaceObject.briefDescription()'
result << " << \", cannot find required object '" << field.name << "'\");" << "\n"
result << " return result;\n"
result << " }\n"
else
result << " }\n"
result << " }\n"
end
else
prefix = ""
need_closing = false
Expand Down Expand Up @@ -427,7 +403,7 @@ def generateForwardTranslateFunction()
result << " // " << field.name << ": " << (field.isRequired? ? "Required" : "Optional") << " " << cat << "\n"

result << " " << field.getterReturnType << " " << field.getterName << " = modelObject." << field.getterName << "();\n"
result << " idfObject." << field.setterAccessor << "(" << field.fieldEnum << ", " << field.getterName << ")\n\n"
result << " idfObject." << field.setterAccessor << "(" << field.fieldEnum << ", " << field.getterName << ");\n\n"

end

Expand Down
89 changes: 89 additions & 0 deletions resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -28184,6 +28184,95 @@ OS:Pipe:Outdoor,
\units m
\minimum> 0.0

OS:SwimmingPool:Indoor,
\memo Specifies an indoor swimming pools linked to a floor surface.
\memo The pool is assumed to cover the entire floor to which it is linked.
\min-fields 17
A1, \field Handle
\type handle
\required-field
A2, \field Name
\required-field
\type alpha
\reference ConnectionObject
A3, \field Surface Name
\required-field
\note Name of the floor surface where the pool is located.
\type object-list
\object-list FloorSurfaceNames
N1, \field Average Depth
\required-field
\type real
\units m
A4, \field Activity Factor Schedule Name
\required-field
\type object-list
\object-list ScheduleNames
A5, \field Make-up Water Supply Schedule Name
\required-field
\type object-list
\object-list ScheduleNames
A6, \field Cover Schedule Name
\required-field
\type object-list
\object-list ScheduleNames
N2, \field Cover Evaporation Factor
\type real
\minimum 0.0
\maximum 1.0
\required-field
N3, \field Cover Convection Factor
\type real
\minimum 0.0
\maximum 1.0
\required-field
N4, \field Cover Short-Wavelength Radiation Factor
\type real
\minimum 0.0
\maximum 1.0
\required-field
N5, \field Cover Long-Wavelength Radiation Factor
\type real
\minimum 0.0
\maximum 1.0
\required-field
A7, \field Pool Water Inlet Node
\required-field
\type object-list
\object-list ConnectionNames
A8, \field Pool Water Outlet Node
\required-field
\type object-list
\object-list ConnectionNames
N6, \field Pool Heating System Maximum Water Flow Rate
\type real
\units m3/s
\ip-units gal/min
\minimum 0.0
\required-field
N7, \field Pool Miscellaneous Equipment Power
\note Power input per pool water flow rate
\units W-s/m3
\ip-units W-min/gal
\type real
\minimum 0.0
\required-field
A9, \field Setpoint Temperature Schedule
\required-field
\type object-list
\object-list ScheduleNames
N8, \field Maximum Number of People
\required-field
\minimum 0.0
A10, \field People Schedule
\type object-list
\object-list ScheduleNames
\required-field
A11; \field People Heat Gain Schedule
\type object-list
\object-list ScheduleNames
\required-field

\group Solar Collectors

OS:SolarCollectorPerformance:FlatPlate,
Expand Down
3 changes: 3 additions & 0 deletions src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateSurfacePropertyExposedFoundationPerimeter.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyOtherSideCoefficients.cpp
ForwardTranslator/ForwardTranslateSurfacePropertyOtherSideConditionsModel.cpp
ForwardTranslator/ForwardTranslateSwimmingPoolIndoor.cpp
ForwardTranslator/ForwardTranslateTableMultiVariableLookup.cpp
ForwardTranslator/ForwardTranslateTemperingValve.cpp
ForwardTranslator/ForwardTranslateThermalStorageIceDetailed.cpp
Expand Down Expand Up @@ -531,6 +532,7 @@ set(${target_name}_src
ReverseTranslator/ReverseTranslateSurfaceConvectionAlgorithmInside.cpp
ReverseTranslator/ReverseTranslateSurfaceConvectionAlgorithmOutside.cpp
ReverseTranslator/ReverseTranslateSurfacePropertyExposedFoundationPerimeter.cpp
ReverseTranslator/ReverseTranslateSwimmingPoolIndoor.cpp
ReverseTranslator/ReverseTranslateThermostatSetpointDualSetpoint.cpp
ReverseTranslator/ReverseTranslateTimestep.cpp
ReverseTranslator/ReverseTranslateVersion.cpp
Expand Down Expand Up @@ -654,6 +656,7 @@ set(${target_name}_test_src
Test/Surface_GTest.cpp
Test/SurfaceControlMovableInsulation_GTest.cpp
Test/SurfacePropertyConvectionCoefficients_GTest.cpp
Test/SwimmingPoolIndoor_GTest.cpp
Test/TableMultiVariableLookup_GTest.cpp
Test/ThermalStorageChilledWaterStratified_GTest.cpp
Test/ThermalZone_GTest.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3083,6 +3083,12 @@ boost::optional<IdfObject> ForwardTranslator::translateAndMapModelObject(ModelOb
retVal = translateSubSurface(subSurface);
break;
}
case openstudio::IddObjectType::OS_SwimmingPool_Indoor:
{
model::SwimmingPoolIndoor obj = modelObject.cast<SwimmingPoolIndoor>();
retVal = translateSwimmingPoolIndoor(obj);
break;
}
case openstudio::IddObjectType::OS_Table_MultiVariableLookup :
{
model::TableMultiVariableLookup table = modelObject.cast<TableMultiVariableLookup>();
Expand Down
3 changes: 3 additions & 0 deletions src/energyplus/ForwardTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ class SurfacePropertyConvectionCoefficientsMultipleSurface;
class SurfacePropertyExposedFoundationPerimeter;
class SurfacePropertyOtherSideCoefficients;
class SurfacePropertyOtherSideConditionsModel;
class SwimmingPoolIndoor;
class TableMultiVariableLookup;
class TemperingValve;
class ThermalZone;
Expand Down Expand Up @@ -1265,6 +1266,8 @@ class ENERGYPLUS_API ForwardTranslator {

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

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

boost::optional<IdfObject> translateTableMultiVariableLookup( model::TableMultiVariableLookup & modelObject );

boost::optional<IdfObject> translateTemperingValve( model::TemperingValve & modelObject );
Expand Down
Loading

0 comments on commit 736ff6a

Please sign in to comment.