Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4543 - E+ 22.1.0: Wrap SetpointManager:SystemNodeReset:Temperature and SetpointManager:SystemNodeReset:Humidity #4619

Merged
merged 14 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,19 @@ def hppPublicTypedefs()
result = String.new

result << "\n"
result << " typedef detail::" << @className << "_Impl ImplType;\n"
result << " using ImplType = detail::" << @className << "_Impl;\n\n"
if @joinRecord
result << " typedef JoinRecordColumns ColumnsType;\n\n"
result << " using JoinRecordColumns = ColumnsType;\n\n"
else
if @baseClassName == "ObjectRecord"
result << " typedef " << @className << "Columns ColumnsType;\n"
result << " typedef " << @className << " ObjectRecordType;\n\n"
result << " using ColumnsType = " << @className << "Columns;\n"
result << " using ObjectRecordType = " << @className << ";\n\n"
else
result << " // TODO: Check this typedef. The generator script assumes that the hierarchy is only two deep "
result << " // from ObjectRecord.\n"
result << " typedef " << @baseClassName << "Columns ColumnsType;\n"
result << " using ColumnsType = " << @baseClassName << "Columns;\n"
result << " // TODO: Check this typedef too.\n"
result << " typedef " << @baseClassName << " ObjectRecordType;\n\n"
result << " using ObjectRecordType = " << @baseClassName << ";\n\n"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def hppProtectedImpl()
result = String.new

if pImpl
result << " typedef detail::" << className << "_Impl ImplType;\n\n"
result << " using ImplType = detail::" << className << "_Impl;\n\n"
result << " explicit " << className << "(std::shared_ptr<detail::" << className << "_Impl> impl);\n\n"
result << " friend class detail::" << @className << "_Impl;\n"
end
Expand Down Expand Up @@ -277,9 +277,9 @@ def cppPublicClassPrivateMethods()
def hppPostClass()
result = String.new
result << "/** \\relates " << className << "*/\n"
result << "typedef boost::optional<" << className << "> Optional" << className << ";\n\n"
result << "using Optional" << className << " = boost::optional<" << className << ">;\n\n"
result << "/** \\relates " << className << "*/\n"
result << "typedef std::vector<" << className << "> " << className << "Vector;\n\n"
result << "using " << className << "Vector = std::vector<" << className << ">;\n\n"
return result
end

Expand Down
78 changes: 78 additions & 0 deletions resources/model/OpenStudio.idd
Original file line number Diff line number Diff line change
Expand Up @@ -24803,6 +24803,84 @@ OS:SetpointManager:SingleZone:Heating,
\type object-list
\object-list Node

OS:SetpointManager:SystemNodeReset:Temperature,
\memo This Setpoint Manager is used to place a temperature setpoint on a system node according to the reference (e.g., return) temperature using a reset rule.
\memo The temperature setpoint is obtained by retrieving the temperature of the user specified reference system node.
A1 , \field Handle
\type handle
\required-field
A2 , \field Name
\required-field
A3 , \field Control Variable
\required-field
\type choice
\key Temperature
\key MaximumTemperature
\key MinimumTemperature
N1 , \field Setpoint at Low Reference Temperature
\type real
\units C
\required-field
N2 , \field Setpoint at High Reference Temperature
\type real
\units C
\required-field
N3 , \field Low Reference Temperature
\type real
\units C
\required-field
N4 , \field High Reference Temperature
\type real
\units C
\required-field
A4 , \field Reference Node Name
\note The name of an HVAC system node that gets referenced. This is a required field.
\type object-list
\object-list Node
A5 ; \field Setpoint Node or NodeList Name
\note Node(s) at which temperature will be set. This is a required field.
\type object-list
\object-list Node

OS:SetpointManager:SystemNodeReset:Humidity,
\memo This Setpoint Manager is used to place a humidity ratio setpoint on a system node according to the reference (e.g., return) humidity ratio using a reset rule.
\memo The humidity ratio setpoint is obtained by retrieving the humidity ratio of the user specified reference system node.
A1 , \field Handle
\type handle
\required-field
A2 , \field Name
\required-field
A3 , \field Control Variable
\required-field
\type choice
\key HumidityRatio
\key MaximumHumidityRatio
\key MinimumHumidityRatio
N1 , \field Setpoint at Low Reference Humidity Ratio
\type real
\units kgWater/kgDryAir
\required-field
N2 , \field Setpoint at High Reference Humidity Ratio
\type real
\units kgWater/kgDryAir
\required-field
N3 , \field Low Reference Humidity Ratio
\type real
\units kgWater/kgDryAir
\required-field
N4 , \field High Reference Humidity Ratio
\type real
\units kgWater/kgDryAir
\required-field
A4 , \field Reference Node Name
\note The name of an HVAC system node that gets referenced. This is a required field.
\type object-list
\object-list Node
A5 ; \field Setpoint Node or NodeList Name
\note Node(s) at which humidity ratio will be set. This is a required field.
\type object-list
\object-list Node

OS:Sizing:Plant,
A1, \field Handle
\type handle
Expand Down
6 changes: 6 additions & 0 deletions src/energyplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ set(${target_name}_src
ForwardTranslator/ForwardTranslateSetpointManagerSingleZoneReheat.cpp
ForwardTranslator/ForwardTranslateSetpointManagerWarmest.cpp
ForwardTranslator/ForwardTranslateSetpointManagerWarmestTemperatureFlow.cpp
ForwardTranslator/ForwardTranslateSetpointManagerSystemNodeResetHumidity.cpp
ForwardTranslator/ForwardTranslateSetpointManagerSystemNodeResetTemperature.cpp
ForwardTranslator/ForwardTranslateShade.cpp
ForwardTranslator/ForwardTranslateShadowCalculation.cpp
ForwardTranslator/ForwardTranslateShadingControl.cpp
Expand Down Expand Up @@ -552,6 +554,8 @@ set(${target_name}_src
ReverseTranslator/ReverseTranslateSetpointManagerMixedAir.cpp
ReverseTranslator/ReverseTranslateSetpointManagerScheduled.cpp
ReverseTranslator/ReverseTranslateSetpointManagerSingleZoneReheat.cpp
ReverseTranslator/ReverseTranslateSetpointManagerSystemNodeResetHumidity.cpp
ReverseTranslator/ReverseTranslateSetpointManagerSystemNodeResetTemperature.cpp
jmarrec marked this conversation as resolved.
Show resolved Hide resolved
ReverseTranslator/ReverseTranslateShadingBuildingDetailed.cpp
ReverseTranslator/ReverseTranslateShadingSiteDetailed.cpp
ReverseTranslator/ReverseTranslateShadingZoneDetailed.cpp
Expand Down Expand Up @@ -717,6 +721,8 @@ set(${target_name}_test_src
Test/ScheduleInterval_GTest.cpp
Test/ScheduleRuleset_GTest.cpp
Test/SetpointManagerFollowGroundTemperature_GTest.cpp
Test/SetpointManagerSystemNodeResetHumidity_GTest.cpp
Test/SetpointManagerSystemNodeResetTemperature_GTest.cpp
Test/ShadingControl_GTest.cpp
Test/ShadingSurface_GTest.cpp
Test/ShadowCalculation_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 @@ -2658,6 +2658,16 @@ namespace energyplus {
retVal = translateSetpointManagerWarmestTemperatureFlow(spm);
break;
}
case openstudio::IddObjectType::OS_SetpointManager_SystemNodeReset_Humidity: {
auto spm = modelObject.cast<SetpointManagerSystemNodeResetHumidity>();
retVal = translateSetpointManagerSystemNodeResetHumidity(spm);
break;
}
case openstudio::IddObjectType::OS_SetpointManager_SystemNodeReset_Temperature: {
auto spm = modelObject.cast<SetpointManagerSystemNodeResetTemperature>();
retVal = translateSetpointManagerSystemNodeResetTemperature(spm);
break;
}
case openstudio::IddObjectType::OS_ShadingControl: {
model::ShadingControl shadingControl = modelObject.cast<ShadingControl>();
retVal = translateShadingControl(shadingControl);
Expand Down
6 changes: 6 additions & 0 deletions src/energyplus/ForwardTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ namespace model {
class SetpointManagerSingleZoneReheat;
class SetpointManagerWarmest;
class SetpointManagerWarmestTemperatureFlow;
class SetpointManagerSystemNodeResetHumidity;
class SetpointManagerSystemNodeResetTemperature;
class ShadowCalculation;
class Shade;
class SimulationControl;
Expand Down Expand Up @@ -1308,6 +1310,10 @@ namespace energyplus {

boost::optional<IdfObject> translateSetpointManagerWarmestTemperatureFlow(model::SetpointManagerWarmestTemperatureFlow& modelObject);

boost::optional<IdfObject> translateSetpointManagerSystemNodeResetHumidity(model::SetpointManagerSystemNodeResetHumidity& modelObject);

boost::optional<IdfObject> translateSetpointManagerSystemNodeResetTemperature(model::SetpointManagerSystemNodeResetTemperature& modelObject);

boost::optional<IdfObject> translateShade(model::Shade& modelObject);

boost::optional<IdfObject> translateShadingControl(model::ShadingControl& modelObject);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/***********************************************************************************************************************
* 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/SetpointManagerSystemNodeResetHumidity.hpp"

#include "../../model/Node.hpp"

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

using namespace openstudio::model;

namespace openstudio {

namespace energyplus {

boost::optional<IdfObject>
ForwardTranslator::translateSetpointManagerSystemNodeResetHumidity(model::SetpointManagerSystemNodeResetHumidity& modelObject) {

// Translation is triggered via the setpointNode already, so no need to check
if (!modelObject.referenceNode()) {
LOG(Error, modelObject.briefDescription() << " does not have a Reference Node attached, it will be not be translated.");
return boost::none;
}

// Instantiate an IdfObject of the class to store the values,
jmarrec marked this conversation as resolved.
Show resolved Hide resolved
IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::SetpointManager_SystemNodeReset_Humidity, modelObject);

// Control Variable: Required String
std::string controlVariable = modelObject.controlVariable();
idfObject.setString(SetpointManager_SystemNodeReset_HumidityFields::ControlVariable, controlVariable);

// Setpoint at Low Reference Humidity Ratio: Required Double
double setpointatLowReferenceHumidityRatio = modelObject.setpointatLowReferenceHumidityRatio();
idfObject.setDouble(SetpointManager_SystemNodeReset_HumidityFields::SetpointatLowReferenceHumidityRatio, setpointatLowReferenceHumidityRatio);

// Setpoint at High Reference Humidity Ratio: Required Double
double setpointatHighReferenceHumidityRatio = modelObject.setpointatHighReferenceHumidityRatio();
idfObject.setDouble(SetpointManager_SystemNodeReset_HumidityFields::SetpointatHighReferenceHumidityRatio, setpointatHighReferenceHumidityRatio);

// Low Reference Humidity Ratio: Required Double
double lowReferenceHumidityRatio = modelObject.lowReferenceHumidityRatio();
idfObject.setDouble(SetpointManager_SystemNodeReset_HumidityFields::LowReferenceHumidityRatio, lowReferenceHumidityRatio);

// High Reference Humidity Ratio: Required Double
double highReferenceHumidityRatio = modelObject.highReferenceHumidityRatio();
idfObject.setDouble(SetpointManager_SystemNodeReset_HumidityFields::HighReferenceHumidityRatio, highReferenceHumidityRatio);

// Reference Node Name: Required Node
if (auto node = modelObject.referenceNode()) {
jmarrec marked this conversation as resolved.
Show resolved Hide resolved
idfObject.setString(SetpointManager_SystemNodeReset_HumidityFields::ReferenceNodeName, node->nameString());
}

// Setpoint Node or NodeList Name: Required Node
if (auto node = modelObject.setpointNode()) {
idfObject.setString(SetpointManager_SystemNodeReset_HumidityFields::SetpointNodeorNodeListName, node->nameString());
}

return idfObject;
} // End of translate function

} // end namespace energyplus
} // end namespace openstudio
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/***********************************************************************************************************************
* 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/SetpointManagerSystemNodeResetTemperature.hpp"

#include "../../model/Node.hpp"

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

using namespace openstudio::model;

namespace openstudio {

namespace energyplus {

boost::optional<IdfObject>
ForwardTranslator::translateSetpointManagerSystemNodeResetTemperature(model::SetpointManagerSystemNodeResetTemperature& modelObject) {

// Translation is triggered via the setpointNode already, so no need to check
if (!modelObject.referenceNode()) {
LOG(Error, modelObject.briefDescription() << " does not have a Reference Node attached, it will be not be translated.");
return boost::none;
}

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

// Control Variable: Required String
std::string controlVariable = modelObject.controlVariable();
idfObject.setString(SetpointManager_SystemNodeReset_TemperatureFields::ControlVariable, controlVariable);

// Setpoint at Low Reference Temperature: Required Double
double setpointatLowReferenceTemperature = modelObject.setpointatLowReferenceTemperature();
idfObject.setDouble(SetpointManager_SystemNodeReset_TemperatureFields::SetpointatLowReferenceTemperature, setpointatLowReferenceTemperature);

// Setpoint at High Reference Temperature: Required Double
double setpointatHighReferenceTemperature = modelObject.setpointatHighReferenceTemperature();
idfObject.setDouble(SetpointManager_SystemNodeReset_TemperatureFields::SetpointatHighReferenceTemperature, setpointatHighReferenceTemperature);

// Low Reference Temperature: Required Double
double lowReferenceTemperature = modelObject.lowReferenceTemperature();
idfObject.setDouble(SetpointManager_SystemNodeReset_TemperatureFields::LowReferenceTemperature, lowReferenceTemperature);

// High Reference Temperature: Required Double
double highReferenceTemperature = modelObject.highReferenceTemperature();
idfObject.setDouble(SetpointManager_SystemNodeReset_TemperatureFields::HighReferenceTemperature, highReferenceTemperature);

// Reference Node Name: Required Node
if (auto node = modelObject.referenceNode()) {
idfObject.setString(SetpointManager_SystemNodeReset_TemperatureFields::ReferenceNodeName, node->nameString());
}

// Setpoint Node or NodeList Name: Required Node
if (auto node = modelObject.setpointNode()) {
idfObject.setString(SetpointManager_SystemNodeReset_TemperatureFields::SetpointNodeorNodeListName, node->nameString());
}

return idfObject;
} // End of translate function

} // end namespace energyplus
} // end namespace openstudio
8 changes: 8 additions & 0 deletions src/energyplus/ReverseTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,14 @@ namespace energyplus {
//modelObject = translateSetpointManagerSingleZoneReheat(workspaceObject);
break;
}
case openstudio::IddObjectType::SetpointManager_SystemNodeReset_Humidity: {
//modelObject = translateSetpointManagerSystemNodeResetHumidity(workspaceObject);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you are just stubbing these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we invest into the effort of ReverseTranslating Loops (which we don't currently), I must leave it disabled yes

break;
}
case openstudio::IddObjectType::SetpointManager_SystemNodeReset_Temperature: {
//modelObject = translateSetpointManagerSystemNodeResetTemperature(workspaceObject);
break;
}
case openstudio::IddObjectType::Shading_Building_Detailed: {
modelObject = translateShadingBuildingDetailed(workspaceObject);
break;
Expand Down