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 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; } 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); + } + } }