Skip to content

ElectricLoadCenter#152

Merged
MingboPeng merged 15 commits intomasterfrom
ElectricLoadCenter
Oct 6, 2025
Merged

ElectricLoadCenter#152
MingboPeng merged 15 commits intomasterfrom
ElectricLoadCenter

Conversation

@MingboPeng
Copy link
Owner

  • Add PVWatts.gh for photovoltaic power generation
  • Add PVs.gh for photovoltaic systems
  • Add WindTurbine_MicroTurbine_Transformer.gh for wind power generation

- Add new base classes for electric inverters, storage, and generators
- Update ElectricLoadCenterDistribution to support new components
- Modify existing generator classes to inherit from new base class
- Implement serialization for ElectricLoadCenter
- Move model loading utility to IB_Utility class
…e saving functionality

- Add Ironbug_ElectricLoadCenter component for main panel of ElectricLoadCenter
- Extend Ironbug_ElectricLoadCenterDistribution for sub-panel components
- Update Ironbug_SaveOSModel to include ElectricLoadCenter saving functionality
- Obsolete Ironbug_SaveOSModel_Obsolete3 due to updated saving process
- Add new components for ElectricLoadCenterInverter, ElectricLoadCenterStorage, and Generator
- Update exposure levels for existing ElectricLoadCenter components
- Refactor component names and descriptions for consistency
- Remove Ironbug_GeneratorPhotovoltaicEquivalentOneDiode, Ironbug_GeneratorPhotovoltaicSandia, and Ironbug_GeneratorPhotovoltaicSimple components
- Add new Ironbug_GeneratorPhotovoltaic component that can handle different photovoltaic performances
- Update Ironbug_GeneratorPVWatts to use a ShadeSurface input instead of SurfaceID
- Refactor IB_GeneratorPhotovoltaicSimple to IB_GeneratorPhotovoltaic and remove unused code
- Remove unused IB_PhotovoltaicPerformanceSimple class
- Remove unnecessary whitespace and blank lines
- Update version numbers for Grasshopper and NREL.OpenStudio packages
- Adjust indentation for better readability
- Removed the configuration for ironbug-net8.zip from .releaserc.json
- This change simplifies the release process and reduces the number of assets generated
- Replace HVAC icon in .afdesign file
- Replace default icons with custom-designed images for various ElectricLoadCenter components
- Update Resources.resx and Resources.Designer.cs to include new icon resources
- Modify individual component files to use new icons
…eter method

- Changed the implementation of DestroyParameter method in Ironbug_OutputParams class
- Replaced NotImplementedException with a simple return true statement
- This allows the method to compile and run without throwing an exception
- Commented out the NotImplementedException line for future reference
… improve generator

- Add Ironbug_PhotovoltaicPerformanceEquivalentOneDiode, Ironbug_PhotovoltaicPerformanceSandia, and Ironbug_PhotovoltaicPerformanceSimple components
- Rename Ironbug_GeneratorPhotovoltaicSimple to Ironbug_GeneratorPhotovoltaic
- Update photovoltaic performance handling in IB_GeneratorPhotovoltaic
- Fix surface retrieval in IB_GeneratorPVWatts
…ll objects

- Add constructor to IB_Children that initializes the list with a specified capacity
- Change Children property in IB_ModelObject from private to protected setter
- Initialize Children in IB_ElectricLoadCenterDistribution with capacity of 4
- Add InverterTable, PVPerfSimple, PVPerfSandia, and PVPerfSDM components
- Update component names and parameters for ElectricLoadCenter
- Modify icons and resources for new components
- Update Spine.json file to include new components
- Add PVWatts.gh for photovoltaic power generation
- Add PVs.gh for photovoltaic systems
- Add WindTurbine_MicroTurbine_Transformer.gh for wind power generation
@gemini-code-assist
Copy link

Summary of Changes

Hello @MingboPeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Ironbug library by introducing a robust 'ElectricLoadCenter' feature. This new capability allows users to design and simulate complex electrical systems, integrating various renewable energy sources like solar PV and wind, along with different types of electrical storage and power conversion devices. The changes span across new Grasshopper components for user interaction and corresponding backend HVAC library implementations, ensuring a comprehensive and extensible framework for energy modeling.

Highlights

  • New ElectricLoadCenter Feature: Introduced a comprehensive 'ElectricLoadCenter' system, allowing for detailed modeling of electrical generation, storage, and distribution within OpenStudio models.
  • Expanded Renewable Energy Components: Added new Grasshopper components for various electrical generators, including Photovoltaic (PVWatts, general PV with multiple performance models), Wind Turbines, and Micro Turbines.
  • Electrical Storage and Conversion: Implemented components for electrical storage (Simple, Li-Ion NMC Battery), inverters (Simple, PVWatts, LookUpTable), and storage converters to manage power flow.
  • Power Distribution and Transformers: Included components for main Electric Load Centers, distribution sub-panels, and electrical transformers for both grid-to-building and onsite-to-grid power transfer.
  • OpenStudio Model Integration: The Ironbug_SaveOSModel component has been updated to support saving the newly defined ElectricLoadCenter configurations into the OpenStudio model.
  • Base Class Refactoring: New abstract base classes (IB_ElecInverter, IB_ElecStorage, IB_Generator, IB_PhotovoltaicPerformance) were added, and IB_ModelObject was adjusted to support the modularity of the new electrical system components.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant number of new components and classes to support ElectricLoadCenter functionality, including photovoltaic and wind power generation. The overall structure and implementation are good, but there are several areas that need attention. Many of the new Grasshopper components have placeholder descriptions and GUIDs, which will impact usability and could cause conflicts. There are also some maintainability issues, such as a redundant null check, commented-out code that should be removed, and a file/class name mismatch that could cause confusion. Addressing these points will improve the quality and robustness of the new features.

Comment on lines +10 to +40
: 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This component has placeholder values that should be updated:

  • Description: The component description on line 11 is a placeholder. Please provide a meaningful description that explains what the component does.
  • GUID: The ComponentGuid on line 40 is a placeholder. Using non-unique GUIDs can cause conflicts in Grasshopper. Please generate a new, unique GUID for this component.

Comment on lines +11 to +48
: 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This component has placeholder values that should be updated:

  • Description: The component description on line 12 is a placeholder. Please provide a meaningful description that explains what the component does.
  • GUID: The ComponentGuid on line 48 is a placeholder. Using non-unique GUIDs can cause conflicts in Grasshopper. Please generate a new, unique GUID for this component.

Comment on lines +10 to +40
: 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This component has placeholder values that should be updated:

  • Description: The component description on line 11 is a placeholder. Please provide a meaningful description that explains what the component does.
  • GUID: The ComponentGuid on line 40 is a placeholder. Using non-unique GUIDs can cause conflicts in Grasshopper. Please generate a new, unique GUID for this component. You can use an online GUID generator or the 'Create GUID' tool in Visual Studio.

Comment on lines +10 to +40
: 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This component has placeholder values that should be updated:

  • Description: The component description on line 11 is a placeholder. Please provide a meaningful description that explains what the component does.
  • GUID: The ComponentGuid on line 40 is a placeholder. Using non-unique GUIDs can cause conflicts in Grasshopper. Please generate a new, unique GUID for this component.

Comment on lines +10 to +40
: 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This component has placeholder values that should be updated:

  • Description: The component description on line 11 is a placeholder. Please provide a meaningful description that explains what the component does.
  • GUID: The ComponentGuid on line 40 is a placeholder. Using non-unique GUIDs can cause conflicts in Grasshopper. Please generate a new, unique GUID for this component.

{
public Ironbug_PhotovoltaicPerformanceSandia()
: base("IB_PhotovoltaicPerformanceSandia", "PvPerfSandia",
"Description",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The component description is a placeholder. Please provide a meaningful description that explains what the component does to improve usability.

public Ironbug_PhotovoltaicPerformanceSimple()
: base("IB_PhotovoltaicPerformanceSimple", "PV",
: base("IB_PhotovoltaicPerformanceSimple", "PvPerfSimple",
"Description",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The component description is a placeholder. Please provide a meaningful description that explains what the component does to improve usability.

{
public Ironbug_ElectricLoadCenterTransformer()
: base("IB_ElectricLoadCenterTransformer", "Transformer",
"Description",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The component description is a placeholder. Please provide a meaningful description that explains what the component does to improve usability.

Comment on lines +62 to +63
if (generators != null && generators.Any())
obj.SetGenerators(generators);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The generators != null check is redundant. The DA.GetDataList method ensures that generators is initialized to an empty list if no data is provided, so it will never be null. You can simplify the condition to just generators.Any().

            if (generators.Any()) 
                obj.SetGenerators(generators);

Comment on lines +1 to +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_ModelObject> IB_InitSelf => () => new IB_GeneratorMicroTurbineHeatRecovery();

// private static GeneratorMicroTurbineHeatRecovery NewDefaultOpsObj(Model model) => new(model, new GeneratorMicroTurbine(model));
// private IB_GeneratorMicroTurbine _microTurbine => this.GetChild<IB_GeneratorMicroTurbine>(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<IB_GeneratorMicroTurbineHeatRecovery_FieldSet, GeneratorMicroTurbineHeatRecovery>
// {

// private IB_GeneratorMicroTurbineHeatRecovery_FieldSet() { }

// }


//}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This entire file is commented out. If this code is not ready or is no longer needed, it should be removed from the pull request to improve code clarity and maintainability. Leaving large blocks of commented-out code can create confusion.

- Rename IB_ElectricLoadCenterInverterPVWatts to IB_ElectricLoadCenterInverterLookUpTable and vice versa
- Update related FieldSet classes to match the new class names
- This change ensures the class names accurately reflect the type of inverter they represent
@MingboPeng MingboPeng merged commit 69f741e into master Oct 6, 2025
3 checks passed
@MingboPeng
Copy link
Owner Author

🎉 This PR is included in version 1.20.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@MingboPeng MingboPeng deleted the ElectricLoadCenter branch October 11, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant