-
Notifications
You must be signed in to change notification settings - Fork 25
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 #792 - Add support for HotWaterEquipment and HotWaterEquipmentDefinition #793
base: develop
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
/*********************************************************************************************************************** | ||
* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors. | ||
* See also https://openstudiocoalition.org/about/software_license/ | ||
***********************************************************************************************************************/ | ||
|
||
#include "HotWaterEquipmentInspectorView.hpp" | ||
#include "../shared_gui_components/OSLineEdit.hpp" | ||
#include "../shared_gui_components/OSQuantityEdit.hpp" | ||
#include "OSDropZone.hpp" | ||
#include <openstudio/model/HotWaterEquipmentDefinition.hpp> | ||
#include <openstudio/model/HotWaterEquipmentDefinition_Impl.hpp> | ||
#include <openstudio/utilities/core/Assert.hpp> | ||
#include <QVBoxLayout> | ||
#include <QHBoxLayout> | ||
#include <QLabel> | ||
#include <QGridLayout> | ||
#include <QScrollArea> | ||
#include <QStackedWidget> | ||
|
||
namespace openstudio { | ||
|
||
HotWaterEquipmentDefinitionInspectorView::HotWaterEquipmentDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget* parent) | ||
: ModelObjectInspectorView(model, true, parent), m_nameEdit(new OSLineEdit2()), m_isIP(isIP) { | ||
|
||
auto* visibleWidget = new QWidget(); | ||
this->stackedWidget()->addWidget(visibleWidget); | ||
|
||
auto* mainGridLayout = new QGridLayout(); | ||
mainGridLayout->setContentsMargins(7, 7, 7, 7); | ||
mainGridLayout->setSpacing(14); | ||
visibleWidget->setLayout(mainGridLayout); | ||
|
||
// Name | ||
|
||
auto* label = new QLabel("Name: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 0, 0); | ||
|
||
mainGridLayout->addWidget(m_nameEdit, 1, 0, 1, 3); | ||
|
||
// Design Level | ||
|
||
label = new QLabel("Design Level: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 2, 0); | ||
|
||
m_designLevelEdit = new OSQuantityEdit2("W", "W", "W", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_designLevelEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_designLevelEdit, 3, 0); | ||
|
||
// Watts Per Space Floor Area | ||
|
||
label = new QLabel("Watts Per Space Floor Area: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 2, 1); | ||
|
||
m_wattsPerSpaceFloorAreaEdit = new OSQuantityEdit2("W/m^2", "W/m^2", "W/ft^2", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_wattsPerSpaceFloorAreaEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_wattsPerSpaceFloorAreaEdit, 3, 1); | ||
|
||
// Watts Per Person | ||
|
||
label = new QLabel("Watts Per Person: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 2, 2); | ||
|
||
m_wattsPerPersonEdit = new OSQuantityEdit2("W/person", "W/person", "W/person", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_wattsPerPersonEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_wattsPerPersonEdit, 3, 2); | ||
|
||
// Fraction Latent | ||
|
||
label = new QLabel("Fraction Latent: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 4, 0); | ||
|
||
m_fractionLatentEdit = new OSQuantityEdit2("", "", "", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_fractionLatentEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_fractionLatentEdit, 5, 0); | ||
|
||
// Fraction Radiant | ||
|
||
label = new QLabel("Fraction Radiant: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 4, 1); | ||
|
||
m_fractionRadiantEdit = new OSQuantityEdit2("", "", "", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_fractionRadiantEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_fractionRadiantEdit, 5, 1); | ||
|
||
// Fraction Lost | ||
|
||
label = new QLabel("Fraction Lost: "); | ||
label->setObjectName("H2"); | ||
mainGridLayout->addWidget(label, 6, 0); | ||
|
||
m_fractionLostEdit = new OSQuantityEdit2("", "", "", m_isIP); | ||
connect(this, &HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked, m_fractionLostEdit, &OSQuantityEdit2::onUnitSystemChange); | ||
mainGridLayout->addWidget(m_fractionLostEdit, 7, 0); | ||
|
||
// Stretch | ||
|
||
mainGridLayout->setRowStretch(8, 100); | ||
|
||
mainGridLayout->setColumnStretch(3, 100); | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::onClearSelection() { | ||
ModelObjectInspectorView::onClearSelection(); // call parent implementation | ||
detach(); | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::onSelectModelObject(const openstudio::model::ModelObject& modelObject) { | ||
detach(); | ||
auto hotwaterEquipmentDefinition = modelObject.cast<model::HotWaterEquipmentDefinition>(); | ||
attach(hotwaterEquipmentDefinition); | ||
refresh(); | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::onUpdate() { | ||
refresh(); | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::attach(const openstudio::model::HotWaterEquipmentDefinition& hotwaterEquipmentDefinition) { | ||
m_hotwaterEquipmentDefinition = hotwaterEquipmentDefinition; | ||
|
||
// m_nameEdit->bind(hotwaterEquipmentDefinition,"name"); | ||
m_nameEdit->bind(*m_hotwaterEquipmentDefinition, | ||
OptionalStringGetter(std::bind(&model::HotWaterEquipmentDefinition::name, m_hotwaterEquipmentDefinition.get_ptr(), true)), | ||
boost::optional<StringSetterOptionalStringReturn>( | ||
std::bind(&model::HotWaterEquipmentDefinition::setName, m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1))); | ||
|
||
// m_designLevelEdit->bind(hotwaterEquipmentDefinition,"designLevel",m_isIP); | ||
m_designLevelEdit->bind(m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::designLevel, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>(std::bind( | ||
static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setDesignLevel), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1))); | ||
|
||
// m_wattsPerSpaceFloorAreaEdit->bind(hotwaterEquipmentDefinition,"wattsperSpaceFloorArea",m_isIP); | ||
m_wattsPerSpaceFloorAreaEdit->bind( | ||
m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::wattsperSpaceFloorArea, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>( | ||
std::bind(static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setWattsperSpaceFloorArea), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1))); | ||
|
||
// m_wattsPerPersonEdit->bind(hotwaterEquipmentDefinition,"wattsperPerson",m_isIP); | ||
m_wattsPerPersonEdit->bind( | ||
m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::wattsperPerson, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>( | ||
std::bind(static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setWattsperPerson), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1))); | ||
|
||
// m_fractionLatentEdit->bind(hotwaterEquipmentDefinition,"fractionLatent",m_isIP); | ||
m_fractionLatentEdit->bind( | ||
m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::fractionLatent, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>( | ||
std::bind(static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setFractionLatent), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1)), | ||
boost::optional<NoFailAction>(std::bind(&model::HotWaterEquipmentDefinition::resetFractionLatent, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::none, boost::none, | ||
boost::optional<BasicQuery>(std::bind(&model::HotWaterEquipmentDefinition::isFractionLatentDefaulted, m_hotwaterEquipmentDefinition.get_ptr()))); | ||
|
||
// m_fractionRadiantEdit->bind(hotwaterEquipmentDefinition,"fractionRadiant",m_isIP); | ||
m_fractionRadiantEdit->bind( | ||
m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::fractionRadiant, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>( | ||
std::bind(static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setFractionRadiant), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1)), | ||
boost::optional<NoFailAction>(std::bind(&model::HotWaterEquipmentDefinition::resetFractionRadiant, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::none, boost::none, | ||
boost::optional<BasicQuery>(std::bind(&model::HotWaterEquipmentDefinition::isFractionRadiantDefaulted, m_hotwaterEquipmentDefinition.get_ptr()))); | ||
|
||
// m_fractionLostEdit->bind(hotwaterEquipmentDefinition,"fractionLost",m_isIP); | ||
m_fractionLostEdit->bind( | ||
m_isIP, *m_hotwaterEquipmentDefinition, | ||
OptionalDoubleGetter(std::bind(&model::HotWaterEquipmentDefinition::fractionLost, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::optional<DoubleSetter>( | ||
std::bind(static_cast<bool (model::HotWaterEquipmentDefinition::*)(double)>(&model::HotWaterEquipmentDefinition::setFractionLost), | ||
m_hotwaterEquipmentDefinition.get_ptr(), std::placeholders::_1)), | ||
boost::optional<NoFailAction>(std::bind(&model::HotWaterEquipmentDefinition::resetFractionLost, m_hotwaterEquipmentDefinition.get_ptr())), | ||
boost::none, boost::none, | ||
boost::optional<BasicQuery>(std::bind(&model::HotWaterEquipmentDefinition::isFractionLostDefaulted, m_hotwaterEquipmentDefinition.get_ptr()))); | ||
|
||
this->stackedWidget()->setCurrentIndex(1); | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::detach() { | ||
this->stackedWidget()->setCurrentIndex(0); | ||
|
||
m_nameEdit->unbind(); | ||
m_designLevelEdit->unbind(); | ||
m_wattsPerSpaceFloorAreaEdit->unbind(); | ||
m_wattsPerPersonEdit->unbind(); | ||
m_fractionLatentEdit->unbind(); | ||
m_fractionRadiantEdit->unbind(); | ||
m_fractionLostEdit->unbind(); | ||
|
||
m_hotwaterEquipmentDefinition = boost::none; | ||
} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::refresh() {} | ||
|
||
void HotWaterEquipmentDefinitionInspectorView::toggleUnits(bool displayIP) { | ||
m_isIP = displayIP; | ||
} | ||
|
||
} // namespace openstudio |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/*********************************************************************************************************************** | ||
* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors. | ||
* See also https://openstudiocoalition.org/about/software_license/ | ||
***********************************************************************************************************************/ | ||
|
||
#ifndef OPENSTUDIO_HOTWATEREQUIPMENTINSPECTORVIEW_HPP | ||
#define OPENSTUDIO_HOTWATEREQUIPMENTINSPECTORVIEW_HPP | ||
|
||
#include "ModelObjectInspectorView.hpp" | ||
#include <openstudio/model/HotWaterEquipmentDefinition.hpp> | ||
|
||
namespace openstudio { | ||
|
||
class OSLineEdit2; | ||
|
||
class OSQuantityEdit2; | ||
|
||
class OSDropZone; | ||
|
||
class HotWaterEquipmentDefinitionInspectorView : public ModelObjectInspectorView | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
HotWaterEquipmentDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget* parent = nullptr); | ||
|
||
virtual ~HotWaterEquipmentDefinitionInspectorView() = default; | ||
|
||
protected: | ||
virtual void onClearSelection() override; | ||
|
||
virtual void onSelectModelObject(const openstudio::model::ModelObject& modelObject) override; | ||
|
||
virtual void onUpdate() override; | ||
|
||
private: | ||
void attach(const openstudio::model::HotWaterEquipmentDefinition& hotwaterEquipmentDefinition); | ||
|
||
void detach(); | ||
|
||
void refresh(); | ||
|
||
OSLineEdit2* m_nameEdit; | ||
|
||
OSQuantityEdit2* m_designLevelEdit; | ||
|
||
OSQuantityEdit2* m_wattsPerSpaceFloorAreaEdit; | ||
|
||
OSQuantityEdit2* m_wattsPerPersonEdit; | ||
|
||
OSQuantityEdit2* m_fractionLatentEdit; | ||
|
||
OSQuantityEdit2* m_fractionRadiantEdit; | ||
|
||
OSQuantityEdit2* m_fractionLostEdit; | ||
|
||
bool m_isIP; | ||
|
||
boost::optional<model::HotWaterEquipmentDefinition> m_hotwaterEquipmentDefinition; | ||
|
||
public slots: | ||
|
||
void toggleUnits(bool displayIP) override; | ||
}; | ||
|
||
} // namespace openstudio | ||
|
||
#endif // OPENSTUDIO_HOTWATEREQUIPMENTINSPECTORVIEW_HPP |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ | |
#include <openstudio/model/WaterUseEquipmentDefinition_Impl.hpp> | ||
#include <openstudio/model/PeopleDefinition.hpp> | ||
#include <openstudio/model/PeopleDefinition_Impl.hpp> | ||
#include <openstudio/model/HotWaterEquipmentDefinition.hpp> | ||
#include <openstudio/model/HotWaterEquipmentDefinition_Impl.hpp> | ||
|
||
#include <openstudio/utilities/core/Assert.hpp> | ||
|
||
|
@@ -73,6 +75,9 @@ void LoadsController::onAddObject(const openstudio::IddObjectType& iddObjectType | |
case IddObjectType::OS_WaterUse_Equipment_Definition: | ||
openstudio::model::WaterUseEquipmentDefinition(this->model()); | ||
break; | ||
case IddObjectType::OS_HotWaterEquipment_Definition: | ||
openstudio::model::HotWaterEquipmentDefinition(this->model()); | ||
break; | ||
Comment on lines
+78
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simple |
||
default: | ||
LOG_FREE(Error, "LoadsController", "Unknown IddObjectType '" << iddObjectType.valueName() << "'"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
#include "SteamEquipmentInspectorView.hpp" | ||
#include "OtherEquipmentInspectorView.hpp" | ||
#include "WaterUseEquipmentInspectorView.hpp" | ||
#include "HotWaterEquipmentInspectorView.hpp" | ||
|
||
#include <openstudio/model/Model_Impl.hpp> | ||
|
||
|
@@ -50,6 +51,7 @@ std::vector<std::pair<IddObjectType, std::string>> LoadsView::modelObjectTypesAn | |
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_OtherEquipment_Definition, "Other Equipment Definitions")); | ||
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_InternalMass_Definition, "Internal Mass Definitions")); | ||
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_WaterUse_Equipment_Definition, "Water Use Equipment Definitions")); | ||
result.push_back(std::make_pair<IddObjectType, std::string>(IddObjectType::OS_HotWaterEquipment_Definition, "Hot Water Equipment Definitions")); | ||
|
||
return result; | ||
} | ||
|
@@ -95,6 +97,9 @@ void LoadsInspectorView::onSelectModelObject(const openstudio::model::ModelObjec | |
case IddObjectType::OS_WaterUse_Equipment_Definition: | ||
this->showWaterUseEquipmentDefinitionsInspector(modelObject); | ||
break; | ||
case IddObjectType::OS_HotWaterEquipment_Definition: | ||
this->showHotWaterEquipmentDefinitionsInspector(modelObject); | ||
break; | ||
default: | ||
showDefaultView(); | ||
} | ||
|
@@ -199,6 +204,16 @@ void LoadsInspectorView::showInternalMassDefinitionsInspector(const openstudio:: | |
this->showInspector(internalMassDefinitionInspectorView); | ||
} | ||
|
||
void LoadsInspectorView::showHotWaterEquipmentDefinitionsInspector(const openstudio::model::ModelObject& modelObject) { | ||
auto* hotWaterEquipmentDefinitionInspectorView = new HotWaterEquipmentDefinitionInspectorView(m_isIP, m_model); | ||
connect(this, &LoadsInspectorView::toggleUnitsClicked, hotWaterEquipmentDefinitionInspectorView, | ||
&HotWaterEquipmentDefinitionInspectorView::toggleUnitsClicked); | ||
|
||
hotWaterEquipmentDefinitionInspectorView->selectModelObject(modelObject); | ||
|
||
showInspector(hotWaterEquipmentDefinitionInspectorView); | ||
} | ||
Comment on lines
+207
to
+215
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easy peasy |
||
|
||
void LoadsInspectorView::showDefaultView() { | ||
if (QWidget* widget = this->stackedWidget()->currentWidget()) { | ||
this->stackedWidget()->removeWidget(widget); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New icons |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -826,6 +826,10 @@ | |
<file>images/mini_icons/[email protected]</file> | ||
<file>images/mini_icons/hightempradiant.png</file> | ||
<file>images/mini_icons/[email protected]</file> | ||
<file>images/mini_icons/hotwater_equipment.png</file> | ||
<file>images/mini_icons/[email protected]</file> | ||
<file>images/mini_icons/hotwater_equipment_definition.png</file> | ||
<file>images/mini_icons/[email protected]</file> | ||
Comment on lines
+829
to
+832
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Icons registered in qrc |
||
<file>images/mini_icons/illuminance_map.png</file> | ||
<file>images/mini_icons/[email protected]</file> | ||
<file>images/mini_icons/indirectEvap.png</file> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really a copy paste from ElectricEquipment it behaves exactly the same.