-
Notifications
You must be signed in to change notification settings - Fork 25
Fix #792 - Add support for HotWaterEquipment and HotWaterEquipmentDefinition #793
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,220 @@ | ||
| /*********************************************************************************************************************** | ||
| * 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); | ||
|
|
||
| label = | ||
| new QLabel("<i>The object models hot water equipment in the zone which consumes district heating, such as cooking equipment or process loads. " | ||
| "All of the energy consumed by the equipment becomes a heat gain in the zone or is lost (exhausted). " | ||
| "This object consumes district heating energy directly and does not cause a load on a hot water plant loop or water heater. " | ||
| "For domestic hot water uses, such as sinks and showers, see WaterUse:Equipment.</i>"); | ||
| label->setWordWrap(true); | ||
| mainGridLayout->addWidget(label, 9, 0, 1, 4); | ||
macumber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.79 KB
src/openstudio_lib/images/mini_icons/hotwater_equipment_definition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.91 KB
src/openstudio_lib/images/mini_icons/hotwater_equipment_definition@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.