Skip to content

Commit

Permalink
Fix #303 - Add ZoneHVACCoolingPanelRadiantConvectiveWater to OpenStud…
Browse files Browse the repository at this point in the history
…ioApplication
  • Loading branch information
jmarrec committed Feb 3, 2021
1 parent 3beb6f7 commit c1052b5
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# p = File.join(ENV["HOME"], "Software/Others/OSApp-build-release/OpenStudio-3.1.1/OpenStudio-3.1.1-alpha+3d83fc2b65-Linux/usr/local/openstudio-3.1.1-alpha/Ruby/openstudio.rb")
# require p
require 'openstudio'

include OpenStudio::Model

# Helper to load a model in one line
# It will raise if the path (or the model) isn't valid
#
# @param path [String] The path to the osm
# @return [OpenStudio::Model::Model] the resulting model.
def osload(path)
translator = OpenStudio::OSVersion::VersionTranslator.new
ospath = OpenStudio::Path.new(path)
model = translator.loadModel(ospath)
if model.empty?
raise "Path '#{path}' is not a valid path to an OpenStudio Model"
else
model = model.get
end
return model
end

m = osload('hvac_library.osm')

alwaysOn = m.getScheduleConstantByName("Always On Discrete hvac_library").get

panel = ZoneHVACCoolingPanelRadiantConvectiveWater.new(m)
panel.setAvailabilitySchedule(alwaysOn)
panel.setName("Zone HVAC Cooling Panel Radiant Convective Water")

cc = panel.coolingCoil.to_CoilCoolingWaterPanelRadiant.get
cc.setName("Coil Cooling Water Panel Radiant")

# Remove the alwaysOn it created by default, and the schedule type lim
sch = m.getScheduleConstantByName("Always On Discrete").get
sch_lim = sch.scheduleTypeLimits.get
sch_lim.remove()
sch.remove()

m.save('hvac_library.osm', true)
6 changes: 6 additions & 0 deletions src/openstudio_lib/IconLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ IconLibrary::IconLibrary() {
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_WaterToAirHeatPump_VariableSpeedEquationFit).value()] =
new QPixmap(":images/Coil_Cooling_WaterToAirHeatPump_VariableSpeedEquationFit.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_Water).value()] = new QPixmap(":images/cool_coil.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_Water_Panel_Radiant).value()] = new QPixmap(":images/coilcooling_water_panel_radiant.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Heating_DX_SingleSpeed).value()] =
new QPixmap(":images/coil_ht_dx_singlespeed.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Heating_DX_VariableSpeed).value()] =
Expand Down Expand Up @@ -241,6 +242,8 @@ IconLibrary::IconLibrary() {
new QPixmap(":images/baseboard_electric.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_Baseboard_Convective_Water).value()] =
new QPixmap(":images/baseboard_water.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water).value()] =
new QPixmap(":images/zonehvac_coolingpanel_radiantconvective_water.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_Dehumidifier_DX).value()] = new QPixmap(":images/dehumidifier_dx.png");
m_icons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_EnergyRecoveryVentilator).value()] =
new QPixmap(":images/energy_recov_vent.png");
Expand Down Expand Up @@ -572,6 +575,7 @@ IconLibrary::IconLibrary() {
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_LowTemperatureRadiant_VariableFlow).value()] =
new QPixmap(":images/mini_icons/coilcoolinglowtemprad_varflow.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_Water).value()] = new QPixmap(":images/mini_icons/cool_coil.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_Water_Panel_Radiant).value()] = new QPixmap(":images/mini_icons/coilcooling_water_panel_radiant.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_WaterToAirHeatPump_EquationFit).value()] =
new QPixmap(":images/mini_icons/wahpDXCC_mini.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_Coil_Cooling_WaterToAirHeatPump_VariableSpeedEquationFit).value()] =
Expand Down Expand Up @@ -690,6 +694,8 @@ IconLibrary::IconLibrary() {
new QPixmap(":images/mini_icons/baseboard_electric.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_Baseboard_Convective_Water).value()] =
new QPixmap(":images/mini_icons/baseboard_water.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water).value()] =
new QPixmap(":images/mini_icons/zonehvac_coolingpanel_radiantconvective_water.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_Dehumidifier_DX).value()] =
new QPixmap(":images/mini_icons/mini_dehumidifier_dx.png");
m_miniIcons[openstudio::IddObjectType(openstudio::IddObjectType::OS_ZoneHVAC_EnergyRecoveryVentilator).value()] =
Expand Down
78 changes: 77 additions & 1 deletion src/openstudio_lib/InspectorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@
#include <openstudio/model/CoilHeatingLowTempRadiantVarFlow.hpp>
#include <openstudio/model/CoilHeatingLowTempRadiantVarFlow_Impl.hpp>
#include <openstudio/model/CoilHeatingWater.hpp>
#include <openstudio/model/CoilHeatingWater_Impl.hpp>
#include <openstudio/model/CoilHeatingWaterBaseboard.hpp>
#include <openstudio/model/CoilHeatingWaterBaseboard_Impl.hpp>
#include <openstudio/model/CoilHeatingWater_Impl.hpp>
#include <openstudio/model/CoilCoolingWaterPanelRadiant.hpp>
#include <openstudio/model/CoilCoolingWaterPanelRadiant_Impl.hpp>
#include <openstudio/model/ConnectorMixer.hpp>
#include <openstudio/model/ConnectorMixer_Impl.hpp>
#include <openstudio/model/ConnectorSplitter.hpp>
Expand Down Expand Up @@ -116,6 +118,8 @@
#include <openstudio/model/ZoneHVACBaseboardConvectiveWater_Impl.hpp>
#include <openstudio/model/ZoneHVACBaseboardRadiantConvectiveWater.hpp>
#include <openstudio/model/ZoneHVACBaseboardRadiantConvectiveWater_Impl.hpp>
#include <openstudio/model/ZoneHVACCoolingPanelRadiantConvectiveWater.hpp>
#include <openstudio/model/ZoneHVACCoolingPanelRadiantConvectiveWater_Impl.hpp>
#include <openstudio/model/ZoneHVACFourPipeFanCoil.hpp>
#include <openstudio/model/ZoneHVACFourPipeFanCoil_Impl.hpp>
#include <openstudio/model/ZoneHVACLowTempRadiantConstFlow.hpp>
Expand Down Expand Up @@ -461,6 +465,24 @@ void InspectorView::layoutModelObject(openstudio::model::OptionalModelObject& mo

connect(static_cast<ZoneHVACBaseboardRadiantConvectiveWaterInspectorView*>(m_currentView),
&ZoneHVACBaseboardRadiantConvectiveWaterInspectorView::removeFromLoopClicked, this, &InspectorView::removeFromLoopClicked);
} else if (boost::optional<model::ZoneHVACCoolingPanelRadiantConvectiveWater> component =
modelObject->optionalCast<model::ZoneHVACCoolingPanelRadiantConvectiveWater>()) {
if (m_currentView) {
delete m_currentView;
}

m_currentView = new ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView();
connect(this, &InspectorView::toggleUnitsClicked, m_currentView, &BaseInspectorView::toggleUnitsClicked);

m_currentView->layoutModelObject(component.get(), readOnly, displayIP);

m_vLayout->addWidget(m_currentView);

connect(static_cast<ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView*>(m_currentView),
&ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::addToLoopClicked, this, &InspectorView::addToLoopClicked);

connect(static_cast<ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView*>(m_currentView),
&ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::removeFromLoopClicked, this, &InspectorView::removeFromLoopClicked);
} else if (boost::optional<model::ZoneHVACFourPipeFanCoil> component = modelObject->optionalCast<model::ZoneHVACFourPipeFanCoil>()) {
if (m_currentView) {
delete m_currentView;
Expand Down Expand Up @@ -1598,6 +1620,60 @@ void ZoneHVACBaseboardRadiantConvectiveWaterInspectorView::layoutModelObject(mod
}
}

ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView(QWidget* parent)
: BaseInspectorView(parent) {
m_inspectorGadget = new InspectorGadget();
connect(this, &ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::toggleUnitsClicked, m_inspectorGadget, &InspectorGadget::toggleUnitsClicked);
connect(m_inspectorGadget, &InspectorGadget::workspaceObjectRemoved, this, &BaseInspectorView::workspaceObjectRemoved);

m_coolingLoopChooserView = new LoopChooserView();

m_libraryTabWidget->addTab(m_inspectorGadget, ":images/properties_icon_on.png", ":images/properties_icon_off.png");

m_libraryTabWidget->addTab(m_coolingLoopChooserView, ":images/link_icon_on.png", ":images/link_icon_off.png");

m_libraryTabWidget->setCurrentIndex(0);

connect(m_coolingLoopChooserView, &LoopChooserView::addToLoopClicked, this,
&ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::addToLoopClicked);

connect(m_coolingLoopChooserView, &LoopChooserView::removeFromLoopClicked, this,
&ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::removeFromLoopClicked);
}

void ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView::layoutModelObject(model::ModelObject& modelObject, bool readOnly, bool displayIP) {
m_modelObject = modelObject;

bool force = false;
bool recursive = true;
bool locked = readOnly;
bool hideChildren = false;
if (displayIP) {
m_inspectorGadget->setUnitSystem(InspectorGadget::IP);
} else {
m_inspectorGadget->setUnitSystem(InspectorGadget::SI);
}
m_inspectorGadget->layoutModelObj(modelObject, force, recursive, locked, hideChildren);

bool waterCoolingCoil = false;

//check if the object is a zone baseboard
boost::optional<model::ZoneHVACCoolingPanelRadiantConvectiveWater> baseboardConvtest =
modelObject.optionalCast<model::ZoneHVACCoolingPanelRadiantConvectiveWater>();

if (baseboardConvtest) {
// if it is, check if has a heating coil (but optional needed)
boost::optional<model::ModelObject> coilcoolingpanel = baseboardConvtest->coolingCoil();
m_coolingLoopChooserView->layoutModelObject(coilcoolingpanel);
waterCoolingCoil = true;
}

if (!waterCoolingCoil) {
// Hide the tab (by hiding the button)
m_libraryTabWidget->hideTab(m_coolingLoopChooserView, true);
}
}

ZoneHVACFourPipeFanCoilInspectorView::ZoneHVACFourPipeFanCoilInspectorView(QWidget* parent) : BaseInspectorView(parent) {
m_inspectorGadget = new InspectorGadget();
connect(this, &ZoneHVACFourPipeFanCoilInspectorView::toggleUnitsClicked, m_inspectorGadget, &InspectorGadget::toggleUnitsClicked);
Expand Down
25 changes: 25 additions & 0 deletions src/openstudio_lib/InspectorView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,31 @@ class ZoneHVACBaseboardRadiantConvectiveWaterInspectorView : public BaseInspecto
LoopChooserView* m_heatingLoopChooserView;
};

class ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView : public BaseInspectorView
{
Q_OBJECT;

public:
ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView(QWidget* parent = nullptr);

virtual ~ZoneHVACCoolingPanelRadiantConvectiveWaterInspectorView() {}

void layoutModelObject(model::ModelObject&, bool readOnly, bool displayIP) override;

signals:

void addToLoopClicked(model::Loop&, boost::optional<model::HVACComponent>&);

void removeFromLoopClicked(model::Loop&, boost::optional<model::HVACComponent>&);

private:
boost::optional<model::ModelObject> m_modelObject;

InspectorGadget* m_inspectorGadget;

LoopChooserView* m_coolingLoopChooserView;
};

class ZoneHVACUnitHeaterInspectorView : public BaseInspectorView
{
Q_OBJECT;
Expand Down
1 change: 1 addition & 0 deletions src/openstudio_lib/MainRightColumnController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ void MainRightColumnController::configureForThermalZonesSubTab(int subTabID) {
libraryWidget->setShowFilterLayout(true);

libraryWidget->addModelObjectType(IddObjectType::OS_AirLoopHVAC_UnitarySystem, "Unitary System");
libraryWidget->addModelObjectType(IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water, "Cooling Panel Radiant Convective Water");
libraryWidget->addModelObjectType(IddObjectType::OS_ZoneHVAC_Baseboard_Convective_Electric, "Baseboard Convective Electric");
libraryWidget->addModelObjectType(IddObjectType::OS_ZoneHVAC_Baseboard_Convective_Water, "Baseboard Convective Water");
libraryWidget->addModelObjectType(IddObjectType::OS_ZoneHVAC_Baseboard_RadiantConvective_Electric, "Baseboard Radiant Convective Electric");
Expand Down
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.
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.
7 changes: 7 additions & 0 deletions src/openstudio_lib/library/OpenStudioPolicy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,13 @@
<rule IddField="Inlet Node Name" Access="HIDDEN"/>
<rule IddField="Outlet Node Name" Access="HIDDEN"/>
</POLICY>
<POLICY IddObjectType="OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water">
<rule IddField="Cooling Coil Name" Access="LOCKED"/>
</POLICY>
<POLICY IddObjectType="OS_Coil_Cooling_Water_Panel_Radiant">
<rule IddField="Water Inlet Node Name" Access="HIDDEN"/>
<rule IddField="Water Outlet Node Name" Access="HIDDEN"/>
</POLICY>
<POLICY IddObjectType="OS_SolarCollectorPerformance_FlatPlate">
</POLICY>
<POLICY IddObjectType="OS_SolarCollectorPerformance_IntegralCollectorStorage">
Expand Down
4 changes: 4 additions & 0 deletions src/openstudio_lib/openstudio.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<file>images/coilheatinglowtemprad_constflow.png</file>
<file>images/coilheatinglowtemprad_varflow.png</file>
<file>images/coilheatingwater_baseboard.png</file>
<file>images/coilcooling_water_panel_radiant.png</file>
<file>images/Coil_Heating_Water_Baseboard_Radiant.png</file>
<file>images/coilsystem_cooling_dx.png</file>
<file>images/cool_coil_dx_vari_speed.png</file>
Expand Down Expand Up @@ -331,6 +332,7 @@
<file>images/zone_icon_off.png</file>
<file>images/zone_icon_pressed.png</file>
<file>images/zonehvac_low_temperature_radiant_electric.png</file>
<file>images/zonehvac_coolingpanel_radiantconvective_water.png</file>
<file>images/zoom-in-over.png</file>
<file>images/zoom-in-press.png</file>
<file>images/zoom-in.png</file>
Expand Down Expand Up @@ -366,6 +368,7 @@
<file>images/mini_icons/coilheatinglowtemprad_varflow.png</file>
<file>images/mini_icons/coilheatingwater_baseboard_mini.png</file>
<file>images/mini_icons/Coil_Heating_Water_Baseboard_Radiant.png</file>
<file>images/mini_icons/coilcooling_water_panel_radiant.png</file>
<file>images/mini_icons/mini_ht_coil_dx_vari.png</file>
<file>images/mini_icons/construct_inter_source.png</file>
<file>images/mini_icons/construction.png</file>
Expand Down Expand Up @@ -559,6 +562,7 @@
<file>images/mini_icons/window_material_gasmixture.png</file>
<file>images/mini_icons/window_material_glazing.png</file>
<file>images/mini_icons/zonehvac_low_temperature_radiant_electric.png</file>
<file>images/mini_icons/zonehvac_coolingpanel_radiantconvective_water.png</file>
<file>images/mini_icons/heatpump_watertowater_equationfit_cooling.png</file>
<file>images/mini_icons/heatpump_watertowater_equationfit_heating.png</file>

Expand Down
4 changes: 4 additions & 0 deletions src/openstudio_lib/test/IconLibrary_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ TEST_F(OpenStudioLibFixture, IconLibrary_Icon) {
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Electric);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Gas);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Water);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Cooling_Water_Panel_Radiant);
//iddObjectTypes.push_back(IddObjectType::OS_Construction);
//iddObjectTypes.push_back(IddObjectType::OS_Construction_AirBoundary);
//iddObjectTypes.push_back(IddObjectType::OS_Construction_CfactorUndergroundWall);
Expand Down Expand Up @@ -120,6 +121,7 @@ TEST_F(OpenStudioLibFixture, IconLibrary_Icon) {
//iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_Screen);
//iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_Shade);
//iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_SimpleGlazingSystem);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_PackagedTerminalAirConditioner);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_PackagedTerminalHeatPump);

Expand All @@ -144,6 +146,7 @@ TEST_F(OpenStudioLibFixture, IconLibrary_MiniIcon) {
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Electric);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Gas);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Heating_Water);
iddObjectTypes.push_back(IddObjectType::OS_Coil_Cooling_Water_Panel_Radiant);
iddObjectTypes.push_back(IddObjectType::OS_Construction);
iddObjectTypes.push_back(IddObjectType::OS_Construction_AirBoundary);
iddObjectTypes.push_back(IddObjectType::OS_Construction_CfactorUndergroundWall);
Expand Down Expand Up @@ -211,6 +214,7 @@ TEST_F(OpenStudioLibFixture, IconLibrary_MiniIcon) {
iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_Screen);
iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_Shade);
iddObjectTypes.push_back(IddObjectType::OS_WindowMaterial_SimpleGlazingSystem);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_CoolingPanel_RadiantConvective_Water);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_PackagedTerminalAirConditioner);
iddObjectTypes.push_back(IddObjectType::OS_ZoneHVAC_PackagedTerminalHeatPump);

Expand Down

0 comments on commit c1052b5

Please sign in to comment.