diff --git a/.releaserc.json b/.releaserc.json index 180ee0fe..8a67fe5a 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -16,11 +16,6 @@ "name": "ironbug-${nextRelease.version}.zip", "label": "ironbug-${nextRelease.version}.zip" }, - { - "path": "ironbug-net8.zip", - "name": "ironbug-net8-${nextRelease.version}.zip", - "label": "ironbug-net8-${nextRelease.version}.zip" - }, { "path": "ironbug.console.win.zip", "name": "ironbug.console.win-${nextRelease.version}.zip", diff --git a/doc/HVAC_GHTemplates/04_Generators/PVWatts.gh b/doc/HVAC_GHTemplates/04_Generators/PVWatts.gh new file mode 100644 index 00000000..6be5df69 Binary files /dev/null and b/doc/HVAC_GHTemplates/04_Generators/PVWatts.gh differ diff --git a/doc/HVAC_GHTemplates/04_Generators/PVs.gh b/doc/HVAC_GHTemplates/04_Generators/PVs.gh new file mode 100644 index 00000000..3c554475 Binary files /dev/null and b/doc/HVAC_GHTemplates/04_Generators/PVs.gh differ diff --git a/doc/HVAC_GHTemplates/04_Generators/WindTurbine_MicroTurbine_Transformer.gh b/doc/HVAC_GHTemplates/04_Generators/WindTurbine_MicroTurbine_Transformer.gh new file mode 100644 index 00000000..7875418c Binary files /dev/null and b/doc/HVAC_GHTemplates/04_Generators/WindTurbine_MicroTurbine_Transformer.gh differ diff --git a/doc/Icon/Ironbug.HVAC.afdesign b/doc/Icon/Ironbug.HVAC.afdesign index 89eae006..a547a797 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/Converter.png b/doc/Icon/Ironbug.HVAC/24h/Converter.png new file mode 100644 index 00000000..771287d1 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/Converter.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/Inverter.png b/doc/Icon/Ironbug.HVAC/24h/Inverter.png new file mode 100644 index 00000000..335714d0 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/Inverter.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/InverterPVWatts.png b/doc/Icon/Ironbug.HVAC/24h/InverterPVWatts.png new file mode 100644 index 00000000..de374f76 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/InverterPVWatts.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/InverterTable.png b/doc/Icon/Ironbug.HVAC/24h/InverterTable.png new file mode 100644 index 00000000..db2eb363 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/InverterTable.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/MainPanel.png b/doc/Icon/Ironbug.HVAC/24h/MainPanel.png new file mode 100644 index 00000000..c0cbbd6a Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/MainPanel.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/MicroTurbine.png b/doc/Icon/Ironbug.HVAC/24h/MicroTurbine.png new file mode 100644 index 00000000..191805e2 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/MicroTurbine.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/PV.png b/doc/Icon/Ironbug.HVAC/24h/PV.png new file mode 100644 index 00000000..2b6abe18 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/PV.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/PVPerfSDM.png b/doc/Icon/Ironbug.HVAC/24h/PVPerfSDM.png new file mode 100644 index 00000000..671b6ada Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/PVPerfSDM.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/PVPerfSandia.png b/doc/Icon/Ironbug.HVAC/24h/PVPerfSandia.png new file mode 100644 index 00000000..85ca2a49 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/PVPerfSandia.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/PVPerfSimple.png b/doc/Icon/Ironbug.HVAC/24h/PVPerfSimple.png new file mode 100644 index 00000000..a952e274 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/PVPerfSimple.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/PVWatts.png b/doc/Icon/Ironbug.HVAC/24h/PVWatts.png new file mode 100644 index 00000000..11e446ae Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/PVWatts.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/Spine.json b/doc/Icon/Ironbug.HVAC/24h/Spine.json new file mode 100644 index 00000000..b8602034 --- /dev/null +++ b/doc/Icon/Ironbug.HVAC/24h/Spine.json @@ -0,0 +1,42 @@ +{"skeleton":{"images":""}, +"bones":[{"name":"root"}], +"slots":[ + {"name":"MainPanel","bone":"root","attachment":"MainPanel"}, + {"name":"Converter","bone":"root","attachment":"Converter"}, + {"name":"Inverter","bone":"root","attachment":"Inverter"}, + {"name":"InverterPVWatts","bone":"root","attachment":"InverterPVWatts"}, + {"name":"InverterTable","bone":"root","attachment":"InverterTable"}, + {"name":"Transformer","bone":"root","attachment":"Transformer"}, + {"name":"StorageNMCBattery","bone":"root","attachment":"StorageNMCBattery"}, + {"name":"StorageSimple","bone":"root","attachment":"StorageSimple"}, + {"name":"MicroTurbine","bone":"root","attachment":"MicroTurbine"}, + {"name":"WindTurbine","bone":"root","attachment":"WindTurbine"}, + {"name":"PV","bone":"root","attachment":"PV"}, + {"name":"PVWatts","bone":"root","attachment":"PVWatts"}, + {"name":"PVPerfSimple","bone":"root","attachment":"PVPerfSimple"}, + {"name":"PVPerfSandia","bone":"root","attachment":"PVPerfSandia"}, + {"name":"PVPerfSDM","bone":"root","attachment":"PVPerfSDM"}, + {"name":"SubPanel","bone":"root","attachment":"SubPanel"} +], +"skins":{ + "default":{ + "MainPanel":{"MainPanel":{"x":1198.5,"y":4349.5,"width":241,"height":241}}, + "Converter":{"Converter":{"x":923.5,"y":4349.5,"width":241,"height":241}}, + "Inverter":{"Inverter":{"x":923.5,"y":4608.5,"width":241,"height":241}}, + "InverterPVWatts":{"InverterPVWatts":{"x":636.5,"y":4608.5,"width":241,"height":241}}, + "InverterTable":{"InverterTable":{"x":636.5,"y":4880.5,"width":241,"height":241}}, + "Transformer":{"Transformer":{"x":923.5,"y":4086.5,"width":241,"height":241}}, + "StorageNMCBattery":{"StorageNMCBattery":{"x":1197.5,"y":3817.5,"width":241,"height":241}}, + "StorageSimple":{"StorageSimple":{"x":925.5,"y":3817.5,"width":241,"height":241}}, + "MicroTurbine":{"MicroTurbine":{"x":632.5,"y":3817.5,"width":241,"height":241}}, + "WindTurbine":{"WindTurbine":{"x":632.5,"y":4082.5,"width":241,"height":241}}, + "PV":{"PV":{"x":632.5,"y":4352.5,"width":241,"height":241}}, + "PVWatts":{"PVWatts":{"x":381.5,"y":4352.5,"width":241,"height":241}}, + "PVPerfSimple":{"PVPerfSimple":{"x":120,"y":4352.5,"width":240,"height":241}}, + "PVPerfSandia":{"PVPerfSandia":{"x":120,"y":4073.5,"width":240,"height":241}}, + "PVPerfSDM":{"PVPerfSDM":{"x":120,"y":3797.5,"width":240,"height":241}}, + "SubPanel":{"SubPanel":{"x":1198.5,"y":4085.5,"width":241,"height":241}} + } +}, +"animations":{"animation":{}} +} \ No newline at end of file diff --git a/doc/Icon/Ironbug.HVAC/24h/StorageNMCBattery.png b/doc/Icon/Ironbug.HVAC/24h/StorageNMCBattery.png new file mode 100644 index 00000000..861e81bd Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/StorageNMCBattery.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/StorageSimple.png b/doc/Icon/Ironbug.HVAC/24h/StorageSimple.png new file mode 100644 index 00000000..6533949a Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/StorageSimple.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/SubPanel.png b/doc/Icon/Ironbug.HVAC/24h/SubPanel.png new file mode 100644 index 00000000..3545dd06 Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/SubPanel.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/Transformer.png b/doc/Icon/Ironbug.HVAC/24h/Transformer.png new file mode 100644 index 00000000..e915230e Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/Transformer.png differ diff --git a/doc/Icon/Ironbug.HVAC/24h/WindTurbine.png b/doc/Icon/Ironbug.HVAC/24h/WindTurbine.png new file mode 100644 index 00000000..866b733e Binary files /dev/null and b/doc/Icon/Ironbug.HVAC/24h/WindTurbine.png differ diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/BaseClasses/Ironbug_OutputParams.cs b/src/Ironbug.Grasshopper/Component/Ironbug/BaseClasses/Ironbug_OutputParams.cs index 93a2a474..ba25e450 100644 --- a/src/Ironbug.Grasshopper/Component/Ironbug/BaseClasses/Ironbug_OutputParams.cs +++ b/src/Ironbug.Grasshopper/Component/Ironbug/BaseClasses/Ironbug_OutputParams.cs @@ -99,7 +99,8 @@ public IGH_Param CreateParameter(GH_ParameterSide side, int index) public bool DestroyParameter(GH_ParameterSide side, int index) { - throw new NotImplementedException(); + return true; + //throw new NotImplementedException(); } public void VariableParameterMaintenance() diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenter.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenter.cs new file mode 100644 index 00000000..8087fa26 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenter.cs @@ -0,0 +1,66 @@ +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; +using Ironbug.HVAC; +using System; +using System.Collections.Generic; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenter : Ironbug_Component + { + public Ironbug_ElectricLoadCenter() + : base("IB_ElectricLoadCenter", "ELC MainPanel", + "The main panel of the ElectricLoadCenter", + "Ironbug", "08:ElectricLoadCenter" + ) + { + } + + public override GH_Exposure Exposure => GH_Exposure.primary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddGenericParameter("_subPanels", "_subPanels", "A list of ElectricLoadCenters", GH_ParamAccess.list); + pManager.AddGenericParameter("powerInTransformer", "transformerIn", "An optional input for a transformer for transferring electricity from the grid to a building (as distribution transformers) when applicable", GH_ParamAccess.item); + pManager.AddGenericParameter("powerOutTransformer", "transformerOut", "An optional input for a transformer for transferring electricity from onsite generators to the grid when applicable", GH_ParamAccess.item); + + pManager[0].DataMapping = GH_DataMapping.Flatten; + pManager[1].Optional = true; + pManager[2].Optional = true; + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("ElectricLoadCenter", "ELC", "ElectricLoadCenter main panel", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenter(); + + + var subPanels = new List(); + IB_ElectricLoadCenterTransformer inTransformer = null; + IB_ElectricLoadCenterTransformer outTransformer = null; + + DA.GetDataList(0, subPanels); + DA.GetData(1, ref inTransformer); + DA.GetData(2, ref outTransformer); + + obj.SetSubPanels(subPanels); + obj.SetPowerInTransformer(inTransformer); + obj.SetPowerOutTransformer(outTransformer); + + DA.SetData(0, obj); + } + + protected override System.Drawing.Bitmap Icon => Resources.MainPanel; + + public override Guid ComponentGuid => new Guid("EA1FF6A4-A434-4DF0-8885-8C1699D92C02"); + + + } + + +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterDistribution.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterDistribution.cs new file mode 100644 index 00000000..1ae89bb1 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterDistribution.cs @@ -0,0 +1,87 @@ +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; +using Ironbug.HVAC; +using Ironbug.HVAC.BaseClass; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterDistribution : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterDistribution() + : base("IB_ElectricLoadCenterDistribution", "ELC Distribution (SubPanel)", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterDistribution_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddGenericParameter("generators", "generators", "A list of IB_Generator", GH_ParamAccess.list); + pManager.AddGenericParameter("inverter", "inverter", "", GH_ParamAccess.item); + pManager.AddGenericParameter("transformer", "transformer", "", GH_ParamAccess.item); + pManager.AddGenericParameter("electricalStorage", "electricalStorage", "", GH_ParamAccess.item); + pManager.AddGenericParameter("storageConverter", "storageConverter", "", GH_ParamAccess.item); + + pManager[0].Optional = true; + pManager[0].DataMapping = GH_DataMapping.Flatten; + pManager[1].Optional = true; + pManager[2].Optional = true; + pManager[3].Optional = true; + pManager[4].Optional = true; + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("subPanel", "subPanel", "A distribution sub-panel of the ElectricLoadCenter main panel", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterDistribution(); + + var generators = new List(); + IB_ElecInverter inverter = null; + IB_ElectricLoadCenterTransformer transformer = null; + IB_ElecStorage storage = null; + IB_ElectricLoadCenterStorageConverter converter = null; + + DA.GetDataList(0, generators); + DA.GetData(1, ref inverter); + DA.GetData(2, ref transformer); + DA.GetData(3, ref storage); + DA.GetData(4, ref converter); + + if (generators != null && generators.Any()) + obj.SetGenerators(generators); + if (inverter != null) + obj.SetInverter(inverter); + if (transformer != null) + obj.SetTransformer(transformer); + if (storage != null) + obj.SetElectricalStorage(storage); + if (converter != null) + obj.SetStorageConverter(converter); + + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.SubPanel; + + public override Guid ComponentGuid => new Guid("37129A27-30E5-4091-8C0A-491DFAB84AF7"); + + + } + + +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterLookUpTable.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterLookUpTable.cs new file mode 100644 index 00000000..73298a70 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterLookUpTable.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterInverterLookUpTable : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterInverterLookUpTable() + : base("IB_ElectricLoadCenterInverterLookUpTable", "InverterLookUpTable", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterInverterLookUpTable_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.secondary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("inverter", "inverter", "inverter", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterInverterLookUpTable(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.InverterTable; + + public override Guid ComponentGuid => new Guid("A1B2C3D4-E5F6-7890-1234-567890ABCDEF"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterPVWatts.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterPVWatts.cs new file mode 100644 index 00000000..23b9275b --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterPVWatts.cs @@ -0,0 +1,47 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterInverterPVWatts : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterInverterPVWatts() + : base("IB_ElectricLoadCenterInverterPVWatts", "InverterPVWatts", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterInverterPVWatts_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("inverter", "inverter", "inverter", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterInverterPVWatts(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.InverterPVWatts; + + public override Guid ComponentGuid => new Guid("CB67FE63-AEB7-4D95-B50D-AA293F606DDD"); + + + } + + +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterSimple.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterSimple.cs new file mode 100644 index 00000000..f475ce0d --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterInverterSimple.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterInverterSimple : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterInverterSimple() + : base("IB_ElectricLoadCenterInverterSimple", "InverterSimple", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterInverterSimple_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.secondary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("inverter", "inverter", "inverter", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterInverterSimple(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.Inverter; + + public override Guid ComponentGuid => new Guid("B2C3D4E5-F6A7-8901-2345-67890ABCDEF1"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageConverter.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageConverter.cs new file mode 100644 index 00000000..ccba15ac --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageConverter.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterStorageConverter : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterStorageConverter() + : base("IB_ElectricLoadCenterStorageConverter", "StorageConverter", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterStorageConverter_FieldSet)) + { + + } + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("converter", "converter", "Storage Converter", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterStorageConverter(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.Converter; + + public override Guid ComponentGuid => new Guid("C3D4E5F6-A7B8-9012-3456-7890ABCDEF12"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageLiIonNMCBattery.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageLiIonNMCBattery.cs new file mode 100644 index 00000000..6c9a5034 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageLiIonNMCBattery.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterStorageLiIonNMCBattery : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterStorageLiIonNMCBattery() + : base("IB_ElectricLoadCenterStorageLiIonNMCBattery", "LiIonNMCBattery", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterStorageLiIonNMCBattery_FieldSet)) + { + + } + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("storage", "storage", "Electrical Storage", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterStorageLiIonNMCBattery(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.StorageNMCBattery; + + public override Guid ComponentGuid => new Guid("D4E5F6A7-B8C9-0123-4567-890ABCDEF123"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageSimple.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageSimple.cs new file mode 100644 index 00000000..bfce6509 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterStorageSimple.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterStorageSimple : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterStorageSimple() + : base("IB_ElectricLoadCenterStorageSimple", "StorageSimple", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterStorageSimple_FieldSet)) + { + + } + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("storage", "storage", "Electrical Storage", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterStorageSimple(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.StorageSimple; + + public override Guid ComponentGuid => new Guid("E5F6A7B8-C9D0-1234-5678-90ABCDEF1234"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterTransformer.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterTransformer.cs new file mode 100644 index 00000000..3a913522 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_ElectricLoadCenterTransformer.cs @@ -0,0 +1,46 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_ElectricLoadCenterTransformer : Ironbug_HVACWithParamComponent + { + public Ironbug_ElectricLoadCenterTransformer() + : base("IB_ElectricLoadCenterTransformer", "Transformer", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_ElectricLoadCenterTransformer_FieldSet)) + { + + } + public override GH_Exposure Exposure => GH_Exposure.secondary; + + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("transformer", "transformer", "transformer", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_ElectricLoadCenterTransformer(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.Transformer; + + public override Guid ComponentGuid => new Guid("826B1B36-D27A-4096-ACB1-9D9DC56D199C"); + + + } + + +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorMicroTurbine.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorMicroTurbine.cs new file mode 100644 index 00000000..b33e80d0 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorMicroTurbine.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_GeneratorMicroTurbine : Ironbug_HVACWithParamComponent + { + public Ironbug_GeneratorMicroTurbine() + : base("IB_GeneratorMicroTurbine", "MicroTurbine", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_GeneratorMicroTurbine_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("generator", "generator", "generator", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_GeneratorMicroTurbine(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.MicroTurbine; + + public override Guid ComponentGuid => new Guid("F6A7B8C9-D0E1-2345-6789-0ABCDEF12345"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPVWatts.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPVWatts.cs new file mode 100644 index 00000000..27844a47 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPVWatts.cs @@ -0,0 +1,50 @@ +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; +using Ironbug.HVAC.BaseClass; +using System; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_GeneratorPVWatts : Ironbug_HVACWithParamComponent + { + public Ironbug_GeneratorPVWatts() + : base("IB_GeneratorPVWatts", "PVWatts", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_GeneratorPVWatts_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddGenericParameter("ShadeSurface", "_surface", "A Honeybee Shade", GH_ParamAccess.item); + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("generator", "generator", "generator", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_GeneratorPVWatts(); + var surface = (object)null; + if (DA.GetData(0, ref surface)) + { + var shadeID = Helper.GetShadeName(surface); + obj.SetSurface(shadeID); + } + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.PVWatts; + + public override Guid ComponentGuid => new Guid("D0E1F2A3-B4C5-6789-0123-EF1234567890"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPhotovoltaic.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPhotovoltaic.cs new file mode 100644 index 00000000..922a7a66 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorPhotovoltaic.cs @@ -0,0 +1,59 @@ +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; +using Ironbug.HVAC.BaseClass; +using System; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_GeneratorPhotovoltaic : Ironbug_HVACWithParamComponent + { + public Ironbug_GeneratorPhotovoltaic() + : base("IB_GeneratorPhotovoltaic", "Photovoltaic", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_GeneratorPhotovoltaic_FieldSet)) + { + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddGenericParameter("ShadeSurface", "_surface", "A Honeybee Shade", GH_ParamAccess.item); + pManager[pManager.AddGenericParameter("_performance_", "_performance_", "One of PhotovoltaicPerformances", GH_ParamAccess.item)].Optional = true; + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("generator", "generator", "generator", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_GeneratorPhotovoltaic(); + + var surface = (object)null; + var perf = (IB_PhotovoltaicPerformance)null; + + if (DA.GetData(0, ref surface)) + { + var shadeID = Helper.GetShadeName(surface); + obj.SetSurface(shadeID); + } + + if (DA.GetData(1, ref perf)) + { + obj.SetPhotovoltaicPerformance(perf); + } + + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.PV; + + public override Guid ComponentGuid => new Guid("C9D0E1F2-A3B4-5678-9012-DEF123456789"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorWindTurbine.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorWindTurbine.cs new file mode 100644 index 00000000..626f8466 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_GeneratorWindTurbine.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_GeneratorWindTurbine : Ironbug_HVACWithParamComponent + { + public Ironbug_GeneratorWindTurbine() + : base("IB_GeneratorWindTurbine", "WindTurbine", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_GeneratorWindTurbine_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("generator", "generator", "generator", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_GeneratorWindTurbine(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.WindTurbine; + + public override Guid ComponentGuid => new Guid("E1F2A3B4-C5D6-7890-1234-F1234567890A"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceEquivalentOneDiode.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceEquivalentOneDiode.cs new file mode 100644 index 00000000..6f1fe947 --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceEquivalentOneDiode.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_PhotovoltaicPerformanceEquivalentOneDiode : Ironbug_HVACWithParamComponent + { + public Ironbug_PhotovoltaicPerformanceEquivalentOneDiode() + : base("IB_PhotovoltaicPerformanceEquivalentOneDiode", "PvPerfSDM", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_PhotovoltaicPerformanceEquivalentOneDiode_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("PhotovoltaicPerformanceEquivalentOneDiode", "pvPerf", "Connect to IB_GeneratorPhotovoltaic", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_PhotovoltaicPerformanceEquivalentOneDiode(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.PVPerfSDM; + + public override Guid ComponentGuid => new Guid("176AFE0D-7448-4F0B-891D-247C088FCA4A"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSandia.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSandia.cs new file mode 100644 index 00000000..7b9c35ec --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSandia.cs @@ -0,0 +1,42 @@ +using System; +using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_PhotovoltaicPerformanceSandia : Ironbug_HVACWithParamComponent + { + public Ironbug_PhotovoltaicPerformanceSandia() + : base("IB_PhotovoltaicPerformanceSandia", "PvPerfSandia", + "Description", + "Ironbug", "08:ElectricLoadCenter", + typeof(HVAC.IB_PhotovoltaicPerformanceSandia_FieldSet)) + { + + } + + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("PhotovoltaicPerformanceSandia", "pvPerf", "Connect to IB_GeneratorPhotovoltaic", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + var obj = new HVAC.IB_PhotovoltaicPerformanceSandia(); + + this.SetObjParamsTo(obj); + var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); + } + + protected override System.Drawing.Bitmap Icon => Resources.PVPerfSandia; + + public override Guid ComponentGuid => new Guid("A979F80F-7F15-4A82-A4F4-A6D29BBC828B"); + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_PhotovoltaicPerformanceSimple.cs b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSimple.cs similarity index 53% rename from src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_PhotovoltaicPerformanceSimple.cs rename to src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSimple.cs index a81ef374..30035208 100644 --- a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_PhotovoltaicPerformanceSimple.cs +++ b/src/Ironbug.Grasshopper/Component/Ironbug/ElectricLoadCenter/Ironbug_PhotovoltaicPerformanceSimple.cs @@ -1,35 +1,41 @@ -using System; +using System; using Grasshopper.Kernel; +using Ironbug.Grasshopper.Properties; + namespace Ironbug.Grasshopper.Component { - public class Ironbug_PhotovoltaicPerformanceSimple : Ironbug_DuplicableHVACWithParamComponent + public class Ironbug_PhotovoltaicPerformanceSimple : Ironbug_HVACWithParamComponent { public Ironbug_PhotovoltaicPerformanceSimple() - : base("IB_PhotovoltaicPerformanceSimple", "PV", + : base("IB_PhotovoltaicPerformanceSimple", "PvPerfSimple", "Description", - "Ironbug", "02:LoopComponents", + "Ironbug", "08:ElectricLoadCenter", typeof(HVAC.IB_PhotovoltaicPerformanceSimple_FieldSet)) { + } - public override GH_Exposure Exposure => GH_Exposure.quarternary | GH_Exposure.hidden; - - protected override void RegisterInputParams(GH_InputParamManager pManager) + public override GH_Exposure Exposure => GH_Exposure.tertiary; + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { } - protected override void RegisterOutputParams(GH_OutputParamManager pManager) + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { - pManager.AddGenericParameter("PhotovoltaicPerformanceSimple", "PhotovoltaicPerformanceSimple", "Connect to PhotovoltaicPerformance", GH_ParamAccess.item); + pManager.AddGenericParameter("PhotovoltaicPerformanceSimple", "pvPerf", "Connect to IB_GeneratorPhotovoltaic", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { var obj = new HVAC.IB_PhotovoltaicPerformanceSimple(); + this.SetObjParamsTo(obj); var objs = this.SetObjDupParamsTo(obj); + DA.SetDataList(0, objs); } - //protected override System.Drawing.Bitmap Icon => Properties.Resources.WaterHeaterMix; + protected override System.Drawing.Bitmap Icon => Resources.PVPerfSimple; public override Guid ComponentGuid => new Guid("AB4E0B97-78C3-4756-9285-D59F5DDF71A4"); } diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel.cs b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel.cs index 1483cc34..4ca3d1f4 100644 --- a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel.cs +++ b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel.cs @@ -11,7 +11,7 @@ namespace Ironbug.Grasshopper.Component public class Ironbug_SaveOSModel : Ironbug_Component { protected override System.Drawing.Bitmap Icon => Properties.Resources.saveHVAC; - public override Guid ComponentGuid => new Guid("2AA7B0D0-1BC9-49EE-9C5F-4A9999439161"); + public override Guid ComponentGuid => new Guid("D9F1F837-B2D0-41C7-88D8-D20303FB93A8"); bool _overrideMode = false; int _writeMode = 0; @@ -27,10 +27,12 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM pManager.AddTextParameter("NewFilePath", "_OSMpath", "New OSM file path. This file will be deleted first if it is existed when the component is on override mode.", GH_ParamAccess.item); pManager.AddGenericParameter("HVACSystem", "HVAC", "A HVAC system from Ironbug_HVACSystem", GH_ParamAccess.item); pManager.AddGenericParameter("EnergyManagementSystem", "EMS", "EnergyManagementSystem", GH_ParamAccess.item); + pManager.AddGenericParameter("ElectricLoadCenter", "ELC", "ElectricLoadCenter", GH_ParamAccess.item); pManager.AddBooleanParameter("Write", "_write", "Write the OpenStudio file.", GH_ParamAccess.item, false); pManager[1].Optional = true; pManager[2].Optional = true; + pManager[3].Optional = true; } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) @@ -44,12 +46,14 @@ protected override void SolveInstance(IGH_DataAccess DA) string filepath = string.Empty; HVAC.IB_HVACSystem hvac = null; HVAC.IB_EnergyManagementSystem ems = null; + HVAC.IB_ElectricLoadCenter elc = null; bool write = false; DA.GetData(0, ref filepath); DA.GetData(1, ref hvac); DA.GetData(2, ref ems); - DA.GetData(3, ref write); + DA.GetData(3, ref elc); + DA.GetData(4, ref write); if (!write) return; @@ -71,9 +75,11 @@ protected override void SolveInstance(IGH_DataAccess DA) var saved = false; if (hvac != null) - saved = hvac.SaveHVAC(filepath); + saved |= hvac.SaveHVAC(filepath); if (ems != null) - saved = ems.SaveEMS(filepath); + saved |= ems.SaveEMS(filepath); + if (elc != null) + saved |= elc.SaveELC(filepath); if (saved) { diff --git a/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel_Obsolete3.cs b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel_Obsolete3.cs new file mode 100644 index 00000000..13afa1ab --- /dev/null +++ b/src/Ironbug.Grasshopper/Component/Ironbug/Ironbug_SaveOSModel_Obsolete3.cs @@ -0,0 +1,180 @@ +using System; +using Grasshopper.Kernel; +using System.IO; +using System.Windows.Forms; +using GH_IO.Serialization; +using System.Diagnostics; +using System.Linq; + +namespace Ironbug.Grasshopper.Component +{ + public class Ironbug_SaveOSModel_Obsolete3 : Ironbug_Component + { + public override bool Obsolete => true; + public override GH_Exposure Exposure => GH_Exposure.hidden; + protected override System.Drawing.Bitmap Icon => Properties.Resources.saveHVAC; + public override Guid ComponentGuid => new Guid("2AA7B0D0-1BC9-49EE-9C5F-4A9999439161"); + + bool _overrideMode = false; + int _writeMode = 0; + public Ironbug_SaveOSModel_Obsolete3() + : base("IB_SaveToFile", "SaveToFile", + "Save HVACSystem to OpenStudio (.osm) file", + "Ironbug", "HVAC") + { + } + + protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) + { + pManager.AddTextParameter("NewFilePath", "_OSMpath", "New OSM file path. This file will be deleted first if it is existed when the component is on override mode.", GH_ParamAccess.item); + pManager.AddGenericParameter("HVACSystem", "HVAC", "A HVAC system from Ironbug_HVACSystem", GH_ParamAccess.item); + pManager.AddGenericParameter("EnergyManagementSystem", "EMS", "EnergyManagementSystem", GH_ParamAccess.item); + pManager.AddBooleanParameter("Write", "_write", "Write the OpenStudio file.", GH_ParamAccess.item, false); + + pManager[1].Optional = true; + pManager[2].Optional = true; + } + + protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) + { + pManager.AddGenericParameter("FilePath", "path", "file path", GH_ParamAccess.item); + } + + protected override void SolveInstance(IGH_DataAccess DA) + { + this.Message = this._overrideMode ? "Override" : ""; + string filepath = string.Empty; + HVAC.IB_HVACSystem hvac = null; + HVAC.IB_EnergyManagementSystem ems = null; + bool write = false; + + DA.GetData(0, ref filepath); + DA.GetData(1, ref hvac); + DA.GetData(2, ref ems); + DA.GetData(3, ref write); + + if (!write) return; + + if (string.IsNullOrEmpty(filepath)) return; + + if (File.Exists(filepath)) + { + if (this._overrideMode) + { + File.Delete(filepath); + } + else + { + var newfilepath = filepath.Replace(".osm", "_IB.osm"); + File.Copy(filepath, newfilepath, true); + filepath = newfilepath; + } + } + + var saved = false; + if (hvac != null) + saved = hvac.SaveHVAC(filepath); + if (ems != null) + saved = ems.SaveEMS(filepath); + + if (saved) + { + DA.SetData(0, filepath); + } + + if (this._writeMode == 1) + { + try + { + OpenOPS(filepath); + } + catch (Exception) + { + + throw; + } + + } + + void OpenOPS(string FilePath) + { + var OpsPath = OpenStudio.OpenStudioUtilitiesCore.getOpenStudioModuleDirectory().__str__().Remove(20) + @"bin"; + var appPath = Path.Combine(OpsPath, "OpenStudioApp.exe"); + if (File.Exists(appPath)) + { + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.Arguments = " \"" + FilePath + "\""; + startInfo.FileName = appPath; + startInfo.WindowStyle = ProcessWindowStyle.Hidden; + startInfo.UseShellExecute = false; + Process.Start(startInfo); + } + else + { + Process.Start(FilePath); + } + + } + + } + + + protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown menu) + { + + Menu_AppendItem(menu, "Override", ChangeOverrideModel, true, _overrideMode) + .ToolTipText = "This will remove the osm file first if exists."; + Menu_AppendItem(menu, "Write&Open", ChangeWriteMode, true, _writeMode == 1) + .ToolTipText = "Open the OpenStudio App after saved the osm file."; + //Menu_AppendItem(menu, "Write&Run", ChangeOverrideModel, true, _overrideMode) + // .ToolTipText = "This will remove the osm file first if exists."; + Menu_AppendSeparator(menu); + + base.AppendAdditionalComponentMenuItems(menu); + } + + private void ChangeWriteMode(object sender, EventArgs e) + { + var writeParm = this.Params.Input.LastOrDefault(); + if (this._writeMode != 1) + { + this._writeMode = 1; + writeParm.NickName = "_write&Open"; + } + else + { + this._writeMode = 0; + writeParm.NickName = "_write"; + } + this.ExpireSolution(true); + + } + + private void ChangeOverrideModel(object sender, EventArgs e) + { + this._overrideMode = !_overrideMode; + this.ExpireSolution(true); + } + + public override bool Write(GH_IWriter writer) + { + writer.SetBoolean ("OverrideMode", this._overrideMode); + writer.SetInt32("_writeMode", this._writeMode); + return base.Write(writer); + } + + public override bool Read(GH_IReader reader) + { + + if (reader.ItemExists("OverrideMode")) + { + this._overrideMode = reader.GetBoolean("OverrideMode"); + } + if (reader.ItemExists("_writeMode")) + { + this._writeMode = reader.GetInt32("_writeMode"); + } + return base.Read(reader); + } + } +} \ No newline at end of file diff --git a/src/Ironbug.Grasshopper/Ironbug.Grasshopper.csproj b/src/Ironbug.Grasshopper/Ironbug.Grasshopper.csproj index 89791746..9121b80d 100644 --- a/src/Ironbug.Grasshopper/Ironbug.Grasshopper.csproj +++ b/src/Ironbug.Grasshopper/Ironbug.Grasshopper.csproj @@ -8,20 +8,19 @@ 1.0.1 true true - none false - + - + diff --git a/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs b/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs index 1a8afcdf..aa81d981 100644 --- a/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs +++ b/src/Ironbug.Grasshopper/Properties/Resources.Designer.cs @@ -630,6 +630,16 @@ internal static System.Drawing.Bitmap CoilPerformance { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Converter { + get { + object obj = ResourceManager.GetObject("Converter", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1150,6 +1160,36 @@ internal static System.Drawing.Bitmap importOSM { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Inverter { + get { + object obj = ResourceManager.GetObject("Inverter", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap InverterPVWatts { + get { + object obj = ResourceManager.GetObject("InverterPVWatts", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap InverterTable { + get { + object obj = ResourceManager.GetObject("InverterTable", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1170,6 +1210,16 @@ internal static System.Drawing.Bitmap Ladybug { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap MainPanel { + get { + object obj = ResourceManager.GetObject("MainPanel", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1180,6 +1230,16 @@ internal static System.Drawing.Bitmap MechVentCtrl { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap MicroTurbine { + get { + object obj = ResourceManager.GetObject("MicroTurbine", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1430,6 +1490,56 @@ internal static System.Drawing.Bitmap PumpV_Headered { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PV { + get { + object obj = ResourceManager.GetObject("PV", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PVPerfSandia { + get { + object obj = ResourceManager.GetObject("PVPerfSandia", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PVPerfSDM { + get { + object obj = ResourceManager.GetObject("PVPerfSDM", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PVPerfSimple { + get { + object obj = ResourceManager.GetObject("PVPerfSimple", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap PVWatts { + get { + object obj = ResourceManager.GetObject("PVWatts", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1760,6 +1870,36 @@ internal static System.Drawing.Bitmap SPM_WarmestTempFlow { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap StorageNMCBattery { + get { + object obj = ResourceManager.GetObject("StorageNMCBattery", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap StorageSimple { + get { + object obj = ResourceManager.GetObject("StorageSimple", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SubPanel { + get { + object obj = ResourceManager.GetObject("SubPanel", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1790,6 +1930,16 @@ internal static System.Drawing.Bitmap ToJson { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Transformer { + get { + object obj = ResourceManager.GetObject("Transformer", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -2020,6 +2170,16 @@ internal static System.Drawing.Bitmap WHHP { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap WindTurbine { + get { + object obj = ResourceManager.GetObject("WindTurbine", 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 16c31a9d..28445606 100644 --- a/src/Ironbug.Grasshopper/Properties/Resources.resx +++ b/src/Ironbug.Grasshopper/Properties/Resources.resx @@ -715,4 +715,52 @@ ..\Resources\SwimmingPool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\StorageNMCBattery.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\StorageSimple.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Transformer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\WindTurbine.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SubPanel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\MainPanel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Inverter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\InverterPVWatts.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PV.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PVWatts.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Converter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\MicroTurbine.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PVPerfSimple.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PVPerfSandia.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\PVPerfSDM.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\InverterTable.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/Converter.png b/src/Ironbug.Grasshopper/Resources/Converter.png new file mode 100644 index 00000000..e5483b8b Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/Converter.png differ diff --git a/src/Ironbug.Grasshopper/Resources/Inverter.png b/src/Ironbug.Grasshopper/Resources/Inverter.png new file mode 100644 index 00000000..37463529 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/Inverter.png differ diff --git a/src/Ironbug.Grasshopper/Resources/InverterPVWatts.png b/src/Ironbug.Grasshopper/Resources/InverterPVWatts.png new file mode 100644 index 00000000..93bef002 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/InverterPVWatts.png differ diff --git a/src/Ironbug.Grasshopper/Resources/InverterTable.png b/src/Ironbug.Grasshopper/Resources/InverterTable.png new file mode 100644 index 00000000..db2eb363 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/InverterTable.png differ diff --git a/src/Ironbug.Grasshopper/Resources/MainPanel.png b/src/Ironbug.Grasshopper/Resources/MainPanel.png new file mode 100644 index 00000000..6cd56a14 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/MainPanel.png differ diff --git a/src/Ironbug.Grasshopper/Resources/MicroTurbine.png b/src/Ironbug.Grasshopper/Resources/MicroTurbine.png new file mode 100644 index 00000000..e9596ec8 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/MicroTurbine.png differ diff --git a/src/Ironbug.Grasshopper/Resources/PV.png b/src/Ironbug.Grasshopper/Resources/PV.png new file mode 100644 index 00000000..e62b47c6 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/PV.png differ diff --git a/src/Ironbug.Grasshopper/Resources/PVPerfSDM.png b/src/Ironbug.Grasshopper/Resources/PVPerfSDM.png new file mode 100644 index 00000000..671b6ada Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/PVPerfSDM.png differ diff --git a/src/Ironbug.Grasshopper/Resources/PVPerfSandia.png b/src/Ironbug.Grasshopper/Resources/PVPerfSandia.png new file mode 100644 index 00000000..85ca2a49 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/PVPerfSandia.png differ diff --git a/src/Ironbug.Grasshopper/Resources/PVPerfSimple.png b/src/Ironbug.Grasshopper/Resources/PVPerfSimple.png new file mode 100644 index 00000000..a952e274 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/PVPerfSimple.png differ diff --git a/src/Ironbug.Grasshopper/Resources/PVWatts.png b/src/Ironbug.Grasshopper/Resources/PVWatts.png new file mode 100644 index 00000000..d20b2f87 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/PVWatts.png differ diff --git a/src/Ironbug.Grasshopper/Resources/StorageNMCBattery.png b/src/Ironbug.Grasshopper/Resources/StorageNMCBattery.png new file mode 100644 index 00000000..8fc93b57 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/StorageNMCBattery.png differ diff --git a/src/Ironbug.Grasshopper/Resources/StorageSimple.png b/src/Ironbug.Grasshopper/Resources/StorageSimple.png new file mode 100644 index 00000000..e8f2d8d7 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/StorageSimple.png differ diff --git a/src/Ironbug.Grasshopper/Resources/SubPanel.png b/src/Ironbug.Grasshopper/Resources/SubPanel.png new file mode 100644 index 00000000..b49cbb28 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/SubPanel.png differ diff --git a/src/Ironbug.Grasshopper/Resources/Transformer.png b/src/Ironbug.Grasshopper/Resources/Transformer.png new file mode 100644 index 00000000..44136866 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/Transformer.png differ diff --git a/src/Ironbug.Grasshopper/Resources/WindTurbine.png b/src/Ironbug.Grasshopper/Resources/WindTurbine.png new file mode 100644 index 00000000..353759a6 Binary files /dev/null and b/src/Ironbug.Grasshopper/Resources/WindTurbine.png differ diff --git a/src/Ironbug.HVAC/BaseClass/IB_Children.cs b/src/Ironbug.HVAC/BaseClass/IB_Children.cs index 70d3e9c4..a8ac76ff 100644 --- a/src/Ironbug.HVAC/BaseClass/IB_Children.cs +++ b/src/Ironbug.HVAC/BaseClass/IB_Children.cs @@ -14,6 +14,10 @@ public IB_Children() { } + public IB_Children(int capacity):base(capacity) + { + this.AddRange(Enumerable.Repeat(null, capacity)); + } internal void SetChild(T ChildObj) where T : IB_ModelObject { diff --git a/src/Ironbug.HVAC/BaseClass/IB_ElecInverter.cs b/src/Ironbug.HVAC/BaseClass/IB_ElecInverter.cs new file mode 100644 index 00000000..afbffe60 --- /dev/null +++ b/src/Ironbug.HVAC/BaseClass/IB_ElecInverter.cs @@ -0,0 +1,15 @@ +using OpenStudio; +using System; +using System.Collections.Generic; + +namespace Ironbug.HVAC.BaseClass +{ + public abstract class IB_ElecInverter : IB_ModelObject + { + public IB_ElecInverter(Func ghostObjInit) : base(ghostObjInit) + { + } + public abstract Inverter ToOS(Model model); + + } +} diff --git a/src/Ironbug.HVAC/BaseClass/IB_ElecStorage.cs b/src/Ironbug.HVAC/BaseClass/IB_ElecStorage.cs new file mode 100644 index 00000000..c00a825d --- /dev/null +++ b/src/Ironbug.HVAC/BaseClass/IB_ElecStorage.cs @@ -0,0 +1,15 @@ +using OpenStudio; +using System; +using System.Collections.Generic; + +namespace Ironbug.HVAC.BaseClass +{ + public abstract class IB_ElecStorage : IB_ModelObject + { + public IB_ElecStorage(Func ghostObjInit) : base(ghostObjInit) + { + } + public abstract ElectricalStorage ToOS(Model model); + + } +} diff --git a/src/Ironbug.HVAC/BaseClass/IB_Generator.cs b/src/Ironbug.HVAC/BaseClass/IB_Generator.cs new file mode 100644 index 00000000..29c5d69a --- /dev/null +++ b/src/Ironbug.HVAC/BaseClass/IB_Generator.cs @@ -0,0 +1,15 @@ +using OpenStudio; +using System; +using System.Collections.Generic; + +namespace Ironbug.HVAC.BaseClass +{ + public abstract class IB_Generator: IB_ModelObject + { + public IB_Generator(Func ghostObjInit) : base(ghostObjInit) + { + } + public abstract Generator ToOS(Model model); + + } +} diff --git a/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs b/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs index 33caf5c5..c952c03a 100644 --- a/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs +++ b/src/Ironbug.HVAC/BaseClass/IB_ModelObject.cs @@ -24,7 +24,7 @@ public abstract class IB_ModelObject : IIB_ModelObject, IEquatable /// Custom attributes for setting OpenStudio object fields diff --git a/src/Ironbug.HVAC/BaseClass/IB_PhotovoltaicPerformance.cs b/src/Ironbug.HVAC/BaseClass/IB_PhotovoltaicPerformance.cs new file mode 100644 index 00000000..fbc05102 --- /dev/null +++ b/src/Ironbug.HVAC/BaseClass/IB_PhotovoltaicPerformance.cs @@ -0,0 +1,15 @@ +using OpenStudio; +using System; +using System.Collections.Generic; + +namespace Ironbug.HVAC.BaseClass +{ + public abstract class IB_PhotovoltaicPerformance : IB_ModelObject + { + public IB_PhotovoltaicPerformance(Func ghostObjInit) : base(ghostObjInit) + { + } + public abstract PhotovoltaicPerformance ToOS(Model model); + + } +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterDistribution.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterDistribution.cs new file mode 100644 index 00000000..b517c27e --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterDistribution.cs @@ -0,0 +1,95 @@ +using Ironbug.HVAC.BaseClass; +using OpenStudio; +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterDistribution : IB_ModelObject + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterDistribution(); + + private static ElectricLoadCenterDistribution NewDefaultOpsObj(Model model) => new ElectricLoadCenterDistribution(model); + + // DC => AC + private IB_ElecInverter _inverter => this.GetChild(0); + private IB_ElecStorage _electricalStorage => this.GetChild(1); + + // AC => DC + private IB_ElectricLoadCenterStorageConverter _storageConverter => this.GetChild(2); + + private IB_ElectricLoadCenterTransformer _transformer => this.GetChild(3); + + [DataMember] + public List Generators { get; private set; } = new List(); + + public IB_ElectricLoadCenterDistribution() : base(NewDefaultOpsObj) + { + this.Children = new IB_Children(4); + } + + + public void SetInverter(IB_ElecInverter inverter) + { + this.SetChild(0, inverter); + } + + public void SetElectricalStorage(IB_ElecStorage electricalStorage) + { + this.SetChild(1, electricalStorage); + } + + public void SetStorageConverter(IB_ElectricLoadCenterStorageConverter storageConverter) + { + this.SetChild(2, storageConverter); + } + + public void SetTransformer(IB_ElectricLoadCenterTransformer transformer) + { + this.SetChild(3, transformer); + } + + public void SetGenerators(List generators) + { + this.Generators = generators; + } + + + + public ElectricLoadCenterDistribution ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + if (_transformer != null) + obj.setTransformer(this._transformer.ToOS(model)); + if (_storageConverter != null) + obj.setStorageConverter(this._storageConverter.ToOS(model)); + if (_inverter != null) + obj.setInverter(this._inverter.ToOS(model)); + if (_electricalStorage != null) + obj.setElectricalStorage(this._electricalStorage.ToOS(model)); + + foreach (var item in Generators) + { + var g = item.ToOS(model); + obj.addGenerator(g); + } + + + return obj; + } + + + + } + + public sealed class IB_ElectricLoadCenterDistribution_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterDistribution_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterLookUpTable.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterLookUpTable.cs new file mode 100644 index 00000000..8b82e4c0 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterLookUpTable.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterInverterLookUpTable : IB_ElecInverter + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterInverterLookUpTable(); + + private static ElectricLoadCenterInverterLookUpTable NewDefaultOpsObj(Model model) => new ElectricLoadCenterInverterLookUpTable(model); + + public IB_ElectricLoadCenterInverterLookUpTable() : base(NewDefaultOpsObj) + { + } + + public override Inverter ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterInverterLookUpTable_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterInverterLookUpTable_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterPVWatts.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterPVWatts.cs new file mode 100644 index 00000000..109b885c --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterPVWatts.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterInverterPVWatts : IB_ElecInverter + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterInverterPVWatts(); + + private static ElectricLoadCenterInverterPVWatts NewDefaultOpsObj(Model model) => new ElectricLoadCenterInverterPVWatts(model); + + public IB_ElectricLoadCenterInverterPVWatts() : base(NewDefaultOpsObj) + { + } + + public override Inverter ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterInverterPVWatts_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterInverterPVWatts_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterSimple.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterSimple.cs new file mode 100644 index 00000000..a257912b --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterInverterSimple.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterInverterSimple : IB_ElecInverter + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterInverterSimple(); + + private static ElectricLoadCenterInverterSimple NewDefaultOpsObj(Model model) => new ElectricLoadCenterInverterSimple(model); + + public IB_ElectricLoadCenterInverterSimple() : base(NewDefaultOpsObj) + { + } + + public override Inverter ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterInverterSimple_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterInverterSimple_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageConverter.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageConverter.cs new file mode 100644 index 00000000..b78ef32f --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageConverter.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterStorageConverter : IB_ModelObject + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterStorageConverter(); + + private static ElectricLoadCenterStorageConverter NewDefaultOpsObj(Model model) => new ElectricLoadCenterStorageConverter(model); + + public IB_ElectricLoadCenterStorageConverter() : base(NewDefaultOpsObj) + { + } + + public ElectricLoadCenterStorageConverter ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterStorageConverter_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterStorageConverter_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageLiIonNMCBattery.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageLiIonNMCBattery.cs new file mode 100644 index 00000000..57de24c3 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageLiIonNMCBattery.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterStorageLiIonNMCBattery : IB_ElecStorage + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterStorageLiIonNMCBattery(); + + private static ElectricLoadCenterStorageLiIonNMCBattery NewDefaultOpsObj(Model model) => new ElectricLoadCenterStorageLiIonNMCBattery(model); + + public IB_ElectricLoadCenterStorageLiIonNMCBattery() : base(NewDefaultOpsObj) + { + } + + public override ElectricalStorage ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterStorageLiIonNMCBattery_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterStorageLiIonNMCBattery_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageSimple.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageSimple.cs new file mode 100644 index 00000000..45904655 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterStorageSimple.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterStorageSimple : IB_ElecStorage + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterStorageSimple(); + + private static ElectricLoadCenterStorageSimple NewDefaultOpsObj(Model model) => new ElectricLoadCenterStorageSimple(model); + + public IB_ElectricLoadCenterStorageSimple() : base(NewDefaultOpsObj) + { + } + + public override ElectricalStorage ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterStorageSimple_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterStorageSimple_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterTransformer.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterTransformer.cs new file mode 100644 index 00000000..1bc151a4 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_ElectricLoadCenterTransformer.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenterTransformer : IB_ModelObject + { + protected override Func IB_InitSelf => () => new IB_ElectricLoadCenterTransformer(); + + private static ElectricLoadCenterTransformer NewDefaultOpsObj(Model model) => new(model); + + public IB_ElectricLoadCenterTransformer() : base(NewDefaultOpsObj) + { + } + + public ElectricLoadCenterTransformer ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_ElectricLoadCenterTransformer_FieldSet + : IB_FieldSet + { + + private IB_ElectricLoadCenterTransformer_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbine.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbine.cs new file mode 100644 index 00000000..fe2f367d --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbine.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_GeneratorMicroTurbine : IB_Generator + { + protected override Func IB_InitSelf => () => new IB_GeneratorMicroTurbine(); + + private static GeneratorMicroTurbine NewDefaultOpsObj(Model model) => new(model); + + public IB_GeneratorMicroTurbine() : base(NewDefaultOpsObj) + { + } + + public override Generator ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_GeneratorMicroTurbine_FieldSet + : IB_FieldSet + { + + private IB_GeneratorMicroTurbine_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbineHeatRecovery.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbineHeatRecovery.cs new file mode 100644 index 00000000..a4839577 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorMicroTurbineHeatRecovery.cs @@ -0,0 +1,38 @@ +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using Ironbug.HVAC.BaseClass; +//using OpenStudio; + +//namespace Ironbug.HVAC +//{ +// public class IB_GeneratorMicroTurbineHeatRecovery : IB_Generator +// { +// protected override Func IB_InitSelf => () => new IB_GeneratorMicroTurbineHeatRecovery(); + +// private static GeneratorMicroTurbineHeatRecovery NewDefaultOpsObj(Model model) => new(model, new GeneratorMicroTurbine(model)); +// private IB_GeneratorMicroTurbine _microTurbine => this.GetChild(0); + +// public IB_GeneratorMicroTurbineHeatRecovery() : base(NewDefaultOpsObj) +// { +// } + +// public override Generator ToOS(Model model) +// { +// var turbine = _microTurbine.ToOS(model) as GeneratorMicroTurbine; +// var obj = base.OnNewOpsObj((model) => new GeneratorMicroTurbineHeatRecovery(model, turbine), model); +// return obj; +// } + +// } + +// public sealed class IB_GeneratorMicroTurbineHeatRecovery_FieldSet +// : IB_FieldSet +// { + +// private IB_GeneratorMicroTurbineHeatRecovery_FieldSet() { } + +// } + + +//} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPVWatts.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPVWatts.cs new file mode 100644 index 00000000..6c0aad4a --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPVWatts.cs @@ -0,0 +1,55 @@ +using Ironbug.HVAC.BaseClass; +using OpenStudio; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; + +namespace Ironbug.HVAC +{ + public class IB_GeneratorPVWatts : IB_Generator + { + protected override Func IB_InitSelf => () => new IB_GeneratorPVWatts(); + + private static GeneratorPVWatts NewDefaultOpsObj(Model model) => new(model, 10000); + + [DataMember] + private string SurfaceID { get; set; } + public IB_GeneratorPVWatts() : base(NewDefaultOpsObj) + { + } + public void SetSurface(string surfaceID) + { + SurfaceID = surfaceID; + } + public override Generator ToOS(Model model) + { + if (string.IsNullOrEmpty(SurfaceID)) + throw new ArgumentException("Invalid PV surface ID"); + + var oShade = model.getShadingSurfaceByName(SurfaceID); + if (oShade == null || oShade.isNull()) + throw new ArgumentException($"Invalid PV surface ID: {SurfaceID}"); + if (!oShade.is_initialized()) + throw new ArgumentException($"Invalid PV surface ID: {SurfaceID}"); + + var shd = oShade.get(); + var opsObj = base.OnNewOpsObj(NewDefaultOpsObj, model); + opsObj.setSurface(shd); + + + return opsObj; + } + + } + + public sealed class IB_GeneratorPVWatts_FieldSet + : IB_FieldSet + { + + private IB_GeneratorPVWatts_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPhotovoltaic.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPhotovoltaic.cs new file mode 100644 index 00000000..ef9fb4f7 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorPhotovoltaic.cs @@ -0,0 +1,102 @@ +using Ironbug.HVAC.BaseClass; +using Newtonsoft.Json; +using OpenStudio; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; + +namespace Ironbug.HVAC +{ + public class IB_GeneratorPhotovoltaic : IB_Generator + { + protected override Func IB_InitSelf => () => new IB_GeneratorPhotovoltaic(); + + private static GeneratorPhotovoltaic NewDefaultOpsObj(Model model) => GeneratorPhotovoltaic.simple(model); + + [DataMember] + private string SurfaceID { get; set; } + private IB_PhotovoltaicPerformance _performance => this.GetChild(0); + + [JsonConstructor] + private IB_GeneratorPhotovoltaic(bool forDeserialization) : base(null) + { + } + + public IB_GeneratorPhotovoltaic() : base(NewDefaultOpsObj) + { + this.AddChild(null); + } + + public void SetSurface(string surfaceID) + { + SurfaceID = surfaceID; + } + + public void SetPhotovoltaicPerformance(IB_PhotovoltaicPerformance performance) + { + this.SetChild(0, performance); + } + + public override Generator ToOS(Model model) + { + if (string.IsNullOrEmpty(SurfaceID)) + throw new ArgumentException("Invalid shading surface ID"); + + var oShade = model.getShadingSurfaceByName(SurfaceID); + if (oShade == null || oShade.isNull()) + throw new ArgumentException($"Invalid shading surface ID: {SurfaceID}"); + if (!oShade.is_initialized()) + throw new ArgumentException($"Invalid shading surface ID: {SurfaceID}"); + + var shd = oShade.get(); + + GeneratorPhotovoltaic obj = null; + if (_performance == null) + { + obj = base.OnNewOpsObj((m)=> GeneratorPhotovoltaic.simple(m), model); + } + else if (_performance is IB_PhotovoltaicPerformanceSimple simple) + { + obj = base.OnNewOpsObj((m) => GeneratorPhotovoltaic.simple(m), model); + var perf = obj.photovoltaicPerformance()?.to_PhotovoltaicPerformanceSimple(); + if (perf.is_initialized()) + simple.ApplyAttributesToObj(model, perf.get()); + + } + else if(_performance is IB_PhotovoltaicPerformanceSandia sandia) + { + obj = base.OnNewOpsObj((m) => GeneratorPhotovoltaic.sandia(m), model); + var perf = obj.photovoltaicPerformance()?.to_PhotovoltaicPerformanceSandia(); + if (perf.is_initialized()) + sandia.ApplyAttributesToObj(model, perf.get()); + + } + else if (_performance is IB_PhotovoltaicPerformanceEquivalentOneDiode oneDiode) + { + obj = base.OnNewOpsObj((m) => GeneratorPhotovoltaic.equivalentOneDiode(m), model); + var perf = obj.photovoltaicPerformance()?.to_PhotovoltaicPerformanceEquivalentOneDiode(); + if (perf.is_initialized()) + oneDiode.ApplyAttributesToObj(model, perf.get()); + } + else + { + throw new NotImplementedException($"Non-supported PV performance type: {_performance.GetType().Name}"); + } + + obj.setSurface(shd); + return obj; + } + + } + + public sealed class IB_GeneratorPhotovoltaic_FieldSet + : IB_FieldSet + { + + private IB_GeneratorPhotovoltaic_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorWindTurbine.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorWindTurbine.cs new file mode 100644 index 00000000..cfc1ee46 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_GeneratorWindTurbine.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_GeneratorWindTurbine : IB_Generator + { + protected override Func IB_InitSelf => () => new IB_GeneratorWindTurbine(); + + private static GeneratorWindTurbine NewDefaultOpsObj(Model model) => new(model); + + public IB_GeneratorWindTurbine() : base(NewDefaultOpsObj) + { + } + + public override Generator ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_GeneratorWindTurbine_FieldSet + : IB_FieldSet + { + + private IB_GeneratorWindTurbine_FieldSet() { } + + } + + +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceEquivalentOneDiode.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceEquivalentOneDiode.cs new file mode 100644 index 00000000..7968ebb8 --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceEquivalentOneDiode.cs @@ -0,0 +1,29 @@ +using System; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_PhotovoltaicPerformanceEquivalentOneDiode : IB_PhotovoltaicPerformance + { + protected override Func IB_InitSelf => () => new IB_PhotovoltaicPerformanceEquivalentOneDiode(); + + private static PhotovoltaicPerformanceEquivalentOneDiode NewDefaultOpsObj(Model model) => new PhotovoltaicPerformanceEquivalentOneDiode(model); + + public IB_PhotovoltaicPerformanceEquivalentOneDiode() : base(NewDefaultOpsObj) + { + } + + public override PhotovoltaicPerformance ToOS(Model model) + { + var opsObj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return opsObj; + } + } + + public sealed class IB_PhotovoltaicPerformanceEquivalentOneDiode_FieldSet + : IB_FieldSet + { + private IB_PhotovoltaicPerformanceEquivalentOneDiode_FieldSet() { } + } +} diff --git a/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSandia.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSandia.cs new file mode 100644 index 00000000..d6fb966b --- /dev/null +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSandia.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Ironbug.HVAC.BaseClass; +using OpenStudio; + +namespace Ironbug.HVAC +{ + public class IB_PhotovoltaicPerformanceSandia : IB_PhotovoltaicPerformance + { + protected override Func IB_InitSelf => () => new IB_PhotovoltaicPerformanceSandia(); + + private static PhotovoltaicPerformanceSandia NewDefaultOpsObj(Model model) => new PhotovoltaicPerformanceSandia(model); + + public IB_PhotovoltaicPerformanceSandia() : base(NewDefaultOpsObj) + { + } + + public override PhotovoltaicPerformance ToOS(Model model) + { + var obj = base.OnNewOpsObj(NewDefaultOpsObj, model); + return obj; + } + + } + + public sealed class IB_PhotovoltaicPerformanceSandia_FieldSet + : IB_FieldSet + { + private IB_PhotovoltaicPerformanceSandia_FieldSet() { } + } +} diff --git a/src/Ironbug.HVAC/LoopObjs/IB_PhotovoltaicPerformanceSimple.cs b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSimple.cs similarity index 84% rename from src/Ironbug.HVAC/LoopObjs/IB_PhotovoltaicPerformanceSimple.cs rename to src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSimple.cs index 1f25f7d1..106c8e73 100644 --- a/src/Ironbug.HVAC/LoopObjs/IB_PhotovoltaicPerformanceSimple.cs +++ b/src/Ironbug.HVAC/ElectricLoadCenter/IB_PhotovoltaicPerformanceSimple.cs @@ -4,17 +4,17 @@ namespace Ironbug.HVAC { - public class IB_PhotovoltaicPerformanceSimple : IB_ModelObject + public class IB_PhotovoltaicPerformanceSimple : IB_PhotovoltaicPerformance { protected override Func IB_InitSelf => () => new IB_PhotovoltaicPerformanceSimple(); private static PhotovoltaicPerformanceSimple NewDefaultOpsObj(Model model) => new PhotovoltaicPerformanceSimple(model); + public IB_PhotovoltaicPerformanceSimple() : base(NewDefaultOpsObj) { } - - public PhotovoltaicPerformanceSimple ToOS(Model model) + public override PhotovoltaicPerformance ToOS(Model model) { var opsObj = base.OnNewOpsObj(NewDefaultOpsObj, model); return opsObj; diff --git a/src/Ironbug.HVAC/IB_ElectricLoadCenter.cs b/src/Ironbug.HVAC/IB_ElectricLoadCenter.cs new file mode 100644 index 00000000..947e55f8 --- /dev/null +++ b/src/Ironbug.HVAC/IB_ElectricLoadCenter.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Text; + +namespace Ironbug.HVAC +{ + public class IB_ElectricLoadCenter + { + [DataMember] + public List SubPanels { get; private set; } + [DataMember] + public IB_ElectricLoadCenterTransformer PowerInTransformer { get; private set; } + [DataMember] + public IB_ElectricLoadCenterTransformer PowerOutTransformer { get; private set; } + + public IB_ElectricLoadCenter() + { + } + + public void SetSubPanels(List subPanels) + { + SubPanels = subPanels; + } + + public void SetPowerInTransformer(IB_ElectricLoadCenterTransformer transformer) + { + PowerInTransformer = transformer; + } + + public void SetPowerOutTransformer(IB_ElectricLoadCenterTransformer transformer) + { + PowerOutTransformer = transformer; + } + + public bool SaveELC(string filePath) + { + var osmFile = filePath; + + //get Model from file if exists + var model = IB_Utility.GetOrNewModel(osmFile); + + if (SubPanels != null) + { + foreach (var item in SubPanels) + { + var added = item.ToOS(model); + } + } + + if (PowerInTransformer != null) + { + var added = PowerInTransformer.ToOS(model); + } + + if (PowerOutTransformer != null) + { + var added = PowerOutTransformer.ToOS(model); + } + + //save osm file + var osmPath = OpenStudio.OpenStudioUtilitiesCore.toPath(filePath); + return model.save(osmPath, true); + + } + + + } +} diff --git a/src/Ironbug.HVAC/IB_EnergyManagementSystem.cs b/src/Ironbug.HVAC/IB_EnergyManagementSystem.cs index e882a438..1e12b6e2 100644 --- a/src/Ironbug.HVAC/IB_EnergyManagementSystem.cs +++ b/src/Ironbug.HVAC/IB_EnergyManagementSystem.cs @@ -60,7 +60,7 @@ public bool SaveEMS(string filepath) var osmFile = filepath; //get Model from file if exists - var model = GetOrNewModel(osmFile); + var model = IB_Utility.GetOrNewModel(osmFile); var mapper = new Dictionary(); foreach (var item in actuators) @@ -130,34 +130,6 @@ public bool SaveEMS(string filepath) } - - public static OpenStudio.Model GetOrNewModel(string opsModelFilePath) - { - var model = new OpenStudio.Model(); - if (File.Exists(opsModelFilePath)) - { - var osmPath = opsModelFilePath.ToPath(); - CheckIfOldVersion(osmPath); - var optionalModel = OpenStudio.Model.load(osmPath); - - if(optionalModel.is_initialized()) model = optionalModel.get(); - - } - return model; - - bool CheckIfOldVersion(OpenStudio.Path p) - { - var ts = new OpenStudio.VersionTranslator(); - var m = ts.loadModel(p).get(); - var v1 = ts.originalVersion().str(); - var v2 = m.version().str(); - if (v1 != v2) - throw new ArgumentException($"Incompatible OpenStudio file version {v1} which is different than what Ironbug is using ({v2})"); - return true; - } - } - - } }