From d3f319e9ab46f0329e5d5fa01ac3f000bb5201de Mon Sep 17 00:00:00 2001 From: Mingbo Peng Date: Tue, 23 Apr 2024 15:19:15 -0400 Subject: [PATCH 1/3] fix(CentralHeatPumpSystemModule): remove NumberOfChillerHeaterModules limit --- src/Ironbug.HVAC/LoopObjs/IB_CentralHeatPumpSystemModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ironbug.HVAC/LoopObjs/IB_CentralHeatPumpSystemModule.cs b/src/Ironbug.HVAC/LoopObjs/IB_CentralHeatPumpSystemModule.cs index 68ef6bc8..8ec7efc1 100644 --- a/src/Ironbug.HVAC/LoopObjs/IB_CentralHeatPumpSystemModule.cs +++ b/src/Ironbug.HVAC/LoopObjs/IB_CentralHeatPumpSystemModule.cs @@ -14,7 +14,7 @@ public class IB_CentralHeatPumpSystemModule : IB_ModelObject private IB_ChillerHeaterPerformanceElectricEIR _chiller => this.GetChild(); - public int NumberOfChillerHeaterModules { get => Get(1); private set => Set(value, 1); } + //public int NumberOfChillerHeaterModules { get => Get(1); private set => Set(value, 1); } [JsonConstructor] private IB_CentralHeatPumpSystemModule(bool forDeserialization) : base(null) @@ -38,8 +38,8 @@ public ModelObject ToOS(Model model) var chillerHeater = this._chiller.ToOS(model) as ChillerHeaterPerformanceElectricEIR; newObj.setChillerHeaterModulesPerformanceComponent(chillerHeater); - newObj.setNumberofChillerHeaterModules(this.NumberOfChillerHeaterModules); - var count = model.getChillerHeaterPerformanceElectricEIRs().Count; + //newObj.setNumberofChillerHeaterModules(this.NumberOfChillerHeaterModules); + //var count = model.getChillerHeaterPerformanceElectricEIRs().Count; return newObj; } From 9e3f372b624341684190df43e3a745383a2c9bd4 Mon Sep 17 00:00:00 2001 From: Mingbo Peng Date: Tue, 23 Apr 2024 15:20:34 -0400 Subject: [PATCH 2/3] fix(IB_Field): support simple constructor --- src/Ironbug.HVAC/BaseClass/IB_Field.cs | 5 +++++ src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/Ironbug.HVAC/BaseClass/IB_Field.cs b/src/Ironbug.HVAC/BaseClass/IB_Field.cs index b5d82f79..3ae3ba75 100644 --- a/src/Ironbug.HVAC/BaseClass/IB_Field.cs +++ b/src/Ironbug.HVAC/BaseClass/IB_Field.cs @@ -53,6 +53,11 @@ protected IB_Field(IB_Field otherField) this.SetterMethod = otherField.SetterMethod; this.Description = otherField.Description; } + + public IB_Field(string fullName): this(fullName, "") + { + } + public IB_Field(string fullName, string nickName, Type valueType = default) { diff --git a/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs b/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs index fe4854f5..4d5678c8 100644 --- a/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs +++ b/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs @@ -78,6 +78,7 @@ public IB_ModelObject(ModelObject ghostOpsObj) public bool ShouldSerializeCustomActuators() => !this.CustomActuators.IsNullOrEmpty(); public bool ShouldSerializeIBProperties() => !this.IBProperties.IsNullOrEmpty(); #endregion + public void AddCustomAttribute(string fieldName, object value) => this.SetFieldValue(new IB_Field(fieldName), value); /// /// Same as SetFieldValue From 42b21b503399726b4eff9aa6638db61476fc67f2 Mon Sep 17 00:00:00 2001 From: Mingbo Peng Date: Tue, 23 Apr 2024 15:21:04 -0400 Subject: [PATCH 3/3] fix(test): add tests for WaterHeaterHP --- src/Ironbug.HVAC_Tests/HVACComponentsTest.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Ironbug.HVAC_Tests/HVACComponentsTest.cs b/src/Ironbug.HVAC_Tests/HVACComponentsTest.cs index 1b047cd2..3dfce182 100644 --- a/src/Ironbug.HVAC_Tests/HVACComponentsTest.cs +++ b/src/Ironbug.HVAC_Tests/HVACComponentsTest.cs @@ -212,5 +212,25 @@ public void IB_ScheduleType() } + [Test] + public void IB_WaterHeaterHP() + { + + var obj = new HVAC.IB_WaterHeaterHeatPump(); + obj.AddCustomAttribute("InletAirConfiguration", "OutdoorAirOnly"); + obj.AddCustomAttribute("CompressorLocation", "Outdoors"); + + var md1 = new OpenStudio.Model(); + obj.ToOS(md1); + + var osObj = md1.getWaterHeaterHeatPumps().First(); + Assert.AreEqual(osObj.inletAirConfiguration(), "OutdoorAirOnly"); + Assert.AreEqual(osObj.compressorLocation(), "Outdoors"); + + string saveFile = GenFileName; + var saved = md1.Save(saveFile); + Assert.True(saved); + } + } }