diff --git a/doc/Icon/Ironbug.HVAC.afdesign b/doc/Icon/Ironbug.HVAC.afdesign index e089bb98..89eae006 100644 Binary files a/doc/Icon/Ironbug.HVAC.afdesign and b/doc/Icon/Ironbug.HVAC.afdesign differ diff --git a/doc/Icon/Ironbug.HVAC/24h/SwimmingPool.png b/doc/Icon/Ironbug.HVAC/24h/SwimmingPool.png new file mode 100644 index 00000000..091a2b1d Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/SwimmingPool.png differ diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SwimmingPoolIndoor.cs b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SwimmingPoolIndoor.cs new file mode 100644 index 00000000..36902b9b --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SwimmingPoolIndoor.cs @@ -0,0 +1,47 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; +using Ironbug.HVAC; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_SwimmingPoolIndoor : Ironbug_HVACWithParamComponent + { + public Ironbug_SwimmingPoolIndoor() + : base("IB_SwimmingPoolIndoor", "SwimmingPool", + "Description", + "Ironbug", "02:LoopComponents", typeof(IB_SwimmingPoolIndoor_FieldSet)) + { + } + + public override GH_Exposure Exposure => GH_Exposure.septenary | GH_Exposure.obscure; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddTextParameter("poolSurfaceID", "_poolSrfId", "This is the name of the surface (floor) where the pool is located. Pools are not allowed on any surfaces other than a floor.", GH_ParamAccess.item); + } + + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("SwimmingPoolIndoor", "Pool", "TODO..", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + string srfId = string.Empty; + if (!DA.GetData(0, ref srfId)) return; + + var obj = new IB_SwimmingPoolIndoor(); + obj.SetWaterSufaceID(srfId); + + this.SetObjParamsTo(obj); + DA.SetData(0, obj); + + } + + protected override System.Drawing.Bitmap Icon => Resources.SwimmingPool; + + public override Guid ComponentGuid => new Guid("{68E45483-E96D-4864-BB3E-A763DA14143A}"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs b/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs index d92a7edf..1a8afcdf 100644 --- a/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs +++ b/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs @@ -1760,6 +1760,16 @@ internal static System.Drawing.Bitmap SPM_WarmestTempFlow { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SwimmingPool { + get { + object obj = ResourceManager.GetObject("SwimmingPool", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/src/Ironbug.Grasshopper/Properties/Resources.resx b/src/Ironbug.Grasshopper/Properties/Resources.resx index a87d4e2d..16c31a9d 100644 --- a/src/Ironbug.Grasshopper/Properties/Resources.resx +++ b/src/Ironbug.Grasshopper/Properties/Resources.resx @@ -712,4 +712,7 @@ ..\Resources\SetpointMxAir.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SwimmingPool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Resources/SwimmingPool.png b/src/Ironbug.Grasshopper/Resources/SwimmingPool.png new file mode 100644 index 00000000..091a2b1d Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/SwimmingPool.png differ diff --git a/src/Ironbug.HVAC/LoopObjs/IB_SwimmingPoolIndoor.cs b/src/Ironbug.HVAC/LoopObjs/IB_SwimmingPoolIndoor.cs new file mode 100644 index 00000000..94dddd60 --- /dev/null +++ b/src/Ironbug.HVAC/LoopObjs/IB_SwimmingPoolIndoor.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_SwimmingPoolIndoor : IB_HVACObject + { + private string _surfaceID { get => this.Get(string.Empty); set => this.Set(value); } + protected override Func IB_InitSelf => () => new IB_SwimmingPoolIndoor(); + + private static SwimmingPoolIndoor NewDefaultOpsObj(Model model) => new SwimmingPoolIndoor(model, new Surface(new Point3dVector(new List() { new Point3d(0,0,0), new Point3d(0,1,0), new Point3d(1,0,0)}), model)); + public IB_SwimmingPoolIndoor() : base(NewDefaultOpsObj(new Model())) + { + } + + public void SetWaterSufaceID(string waterSuface) + { + if (string.IsNullOrEmpty(waterSuface)) + throw new ArgumentException("Invalid water surface ID"); + _surfaceID = waterSuface; + } + + public override HVACComponent ToOS(Model model) + { + var newObj = this.OnNewOpsObj(NewDefaultOpsObj, model); + //var srfs = model.getSurfaces(); + //var nn = srfs.Select(_=>_.nameString(true)).ToList(); + var srf = model.getSurfaceByName(_surfaceID); + if (srf == null || !srf.is_initialized()) + throw new ArgumentException("Failed to find water surface for SwimmingPoolIndoor"); + + newObj.setSurface(srf.get()); + return newObj; + } + } + + public sealed class IB_SwimmingPoolIndoor_FieldSet + : IB_FieldSet + { + private IB_SwimmingPoolIndoor_FieldSet() {} + + } +}