Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #107

Merged
merged 16 commits into from
Nov 7, 2023
Merged

Dev #107

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file modified doc/Icon/Ironbug.HVAC.afdesign
Binary file not shown.
9 changes: 8 additions & 1 deletion src/Ironbug.Grasshopper/Classes/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ public static string GetRoomName(object HBObj)
}
else if (HBObj is GH_ObjectWrapper wrapper)
{
// LBT Room

var pyObj = wrapper.Value;
if (pyObj is Ironbug.HVAC.BaseClass.IB_ThermalZone ibZone)
{
ibZone.CustomAttributes.TryGetValue(Ironbug.HVAC.BaseClass.IB_ThermalZone_FieldSet.Value.Name, out var ibName);
return ibName?.ToString();
}

// LBT Room
var isPythonObj = pyObj.GetType().ToString().StartsWith("IronPython.");
if (!isPythonObj)
throw new System.ArgumentException("Invalid Room object!");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerDifferentialThermostat : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerDifferentialThermostat()
: base("IB_AvailabilityManagerDifferentialThermostat", "AM_Diff",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerDifferentialThermostat_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Cold Probe", "_coldProbe", $"Add a IB_NodeProbe (cold) to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
pManager.AddGenericParameter("Hot Probe", "_hotProbe", "Add a IB_NodeProbe (hot) to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
IB_NodeProbe cold = null;
IB_NodeProbe hot = null;
if (!DA.GetData(0, ref cold)) return;
if (!DA.GetData(0, ref hot)) return;

var coldID = cold.GetTrackingID();
var hotID = hot.GetTrackingID();

var obj = new IB_AvailabilityManagerDifferentialThermostat();
obj.SetSensorNode(coldID, hotID);

this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_Dif;

public override Guid ComponentGuid => new Guid("F1E8995C-953F-44BF-88DD-076B1F8CBC73");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerHighTemperatureTurnOff : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerHighTemperatureTurnOff()
: base("IB_AvailabilityManagerHighTemperatureTurnOff", "AM_HighOff",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerHighTemperatureTurnOff_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary | GH_Exposure.obscure;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Sensor Probe", "_probe", "Add a IB_NodeProbe to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
IB_NodeProbe probe = null;
if (!DA.GetData(0, ref probe)) return;

var nodeID = probe.GetTrackingID();
var obj = new IB_AvailabilityManagerHighTemperatureTurnOff();
obj.SetSensorNode(nodeID);

this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_Off;

public override Guid ComponentGuid => new Guid("3C8F8AEF-426B-43BD-AFDB-397BC8B000FB");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerHighTemperatureTurnOn : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerHighTemperatureTurnOn()
: base("IB_AvailabilityManagerHighTemperatureTurnOn", "AM_HighOn",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerHighTemperatureTurnOn_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary | GH_Exposure.obscure;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Sensor Probe", "_probe", "Add a IB_NodeProbe to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
IB_NodeProbe probe = null;
if (!DA.GetData(0, ref probe)) return;

var nodeID = probe.GetTrackingID();
var obj = new IB_AvailabilityManagerHighTemperatureTurnOn();
obj.SetSensorNode(nodeID);

this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_On;

public override Guid ComponentGuid => new Guid("6FEFF3D5-F37B-4989-8FC9-16545DADA803");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public Ironbug_AvailabilityManagerHybridVentilation()
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary;
public override GH_Exposure Exposure => GH_Exposure.secondary | GH_Exposure.obscure;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddTextParameter("controlZone", "_ctrlZone", "A controlled zone served by the air loop defined. The air conditions in this zone are used to determine if natural ventilation should be provided.", GH_ParamAccess.item);
pManager.AddGenericParameter("controlZone", "_ctrlZone", "A controlled zone served by the air loop defined. The air conditions in this zone are used to determine if natural ventilation should be provided.", GH_ParamAccess.item);
pManager[0].Optional = true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using Grasshopper.Kernel;
using Ironbug.HVAC.BaseClass;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_Ironbug_AvailabilityManagerList : Ironbug_Component
{

public override GH_Exposure Exposure => GH_Exposure.secondary;

public Ironbug_Ironbug_AvailabilityManagerList()
: base("IB_AvailabilityManagerList", "AMList",
"Use AvailabilityManagerList if you have more than one availability managers (from highest precedence to lowest) for one loop",
"Ironbug", "05:SetpointManager & AvailabilityManager")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Availability managers", "managers", "A list of availability managers (from highest precedence to lowest) that will be grouped.", GH_ParamAccess.list);
pManager[0].Optional = true;
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManagerList", "AMList", "A list of availability managers that will be added to each loop. Connect to loop's AvailabilityManager", GH_ParamAccess.item);
pManager[0].DataMapping = GH_DataMapping.Flatten;
}

protected override void SolveInstance(IGH_DataAccess DA)
{
var managers = new List<IB_AvailabilityManager>();
DA.GetDataList(0, managers);

var group = new IB_AvailabilityManagerList();
group.SetManagers(managers);
DA.SetData(0, group);
}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_Group;

public override Guid ComponentGuid => new Guid("6E86EBFB-28E6-45F7-BDB4-7FDA4D560354");
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerLowTemperatureTurnOff : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerLowTemperatureTurnOff()
: base("IB_AvailabilityManagerLowTemperatureTurnOff", "AM_LowOff",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerLowTemperatureTurnOff_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary | GH_Exposure.obscure;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Sensor Probe", "_probe", "Add a IB_NodeProbe to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
IB_NodeProbe probe = null;
if (!DA.GetData(0, ref probe)) return;

var nodeID = probe.GetTrackingID();
var obj = new IB_AvailabilityManagerLowTemperatureTurnOff();
obj.SetSensorNode(nodeID);

this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_Off;

public override Guid ComponentGuid => new Guid("D5717D6F-B3B3-4AD5-B32C-2F8460AC76F0");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerLowTemperatureTurnOn : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerLowTemperatureTurnOn()
: base("IB_AvailabilityManagerLowTemperatureTurnOn", "AM_LowOn",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerLowTemperatureTurnOn_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary | GH_Exposure.obscure;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("Sensor Probe", "_probe", "Add a IB_NodeProbe to a loop first, and then connect the probe to here for availability manager to use.", GH_ParamAccess.item);
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
IB_NodeProbe probe = null;
if (!DA.GetData(0, ref probe)) return;

var nodeID = probe.GetTrackingID();
var obj = new IB_AvailabilityManagerLowTemperatureTurnOn();
obj.SetSensorNode(nodeID);

this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_On;

public override Guid ComponentGuid => new Guid("C9A99554-BF69-48C2-A77A-418319D7DEFA");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public Ironbug_AvailabilityManagerNightVentilation()

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddTextParameter("controlZone", "_ctrlZone", "A controlled zone served by the air loop defined. The air conditions in this zone are used to determine if natural ventilation should be provided.", GH_ParamAccess.item);
pManager.AddGenericParameter("controlZone", "_ctrlZone", "A controlled zone served by the air loop defined. The air conditions in this zone are used to determine if natural ventilation should be provided.", GH_ParamAccess.item);
pManager[0].Optional = true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using Grasshopper.Kernel;
using Ironbug.HVAC.AvailabilityManager;

namespace Ironbug.Grasshopper.Component
{
public class Ironbug_AvailabilityManagerOptimumStart : Ironbug_HVACWithParamComponent
{
public Ironbug_AvailabilityManagerOptimumStart()
: base("IB_AvailabilityManagerOptimumStart", "AM_OptimumStart",
"Description",
"Ironbug", "05:SetpointManager & AvailabilityManager", typeof(IB_AvailabilityManagerOptimumStart_FieldSet))
{
}

public override GH_Exposure Exposure => GH_Exposure.secondary;

protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddGenericParameter("controlZone", "_ctrlZone", "A controlled zone served by the air loop defined. The air conditions in this zone are used to determine if natural ventilation should be provided.", GH_ParamAccess.item);
pManager[0].Optional = true;
}


protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("AvailabilityManager", "AM", "TODO..", GH_ParamAccess.item);
}

protected override void SolveInstance(IGH_DataAccess DA)
{
object zone = null;
if (!DA.GetData(0, ref zone)) return;

var zoneName = Helper.GetRoomName(zone);
var obj = new IB_AvailabilityManagerOptimumStart();
obj.SetControlZone(zoneName);
this.SetObjParamsTo(obj);
DA.SetData(0, obj);

}

protected override System.Drawing.Bitmap Icon => Properties.Resources.AM_Opt;

public override Guid ComponentGuid => new Guid("FF1B3CB5-54F7-4EB7-BE62-4DFC0BFCB6ED");
}
}
Loading
Loading