Skip to content

Implement tagDifferentiable in PowerElectronics models - #540

Open
alexander-novo wants to merge 9 commits into
developfrom
alex/powerelec-tags
Open

Implement tagDifferentiable in PowerElectronics models#540
alexander-novo wants to merge 9 commits into
developfrom
alex/powerelec-tags

Conversation

@alexander-novo

Copy link
Copy Markdown
Collaborator

Description

Implemented tagDifferentiable() in PowerElectronics models, so that they can be used for scaling testing of Rosenbrock.

Proposed changes

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here
to help! This is simply a reminder of what we are going to look for before
merging your code.

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

@alexander-novo
alexander-novo requested a review from pelesh August 13, 2026 21:37
@nkoukpaizan nkoukpaizan added the enhancement New feature or request label Aug 19, 2026

@nkoukpaizan nkoukpaizan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address the failing test.

@nkoukpaizan nkoukpaizan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few comments on the code. Should other examples exercise the sysmodel->tagDifferentiable() as well?

Comment thread GridKit/Model/PowerElectronics/CircuitComponent.hpp Outdated
Comment thread examples/PowerElectronics/Microgrid/Microgrid.cpp Outdated
Comment thread examples/PowerElectronics/Microgrid/Microgrid.cpp Outdated
Comment thread GridKit/Model/PowerElectronics/MicrogridBusDQ/MicrogridBusDQ.cpp
Comment thread GridKit/Model/PowerElectronics/Resistor/Resistor.cpp Outdated
Comment thread GridKit/Model/PowerElectronics/Capacitor/Capacitor.cpp Outdated
Comment thread GridKit/Model/PowerElectronics/SystemModelPowerElectronics.hpp
Added tags to `Resistor`, which has no internal variables, but still need the appropriate tag size to be set.
Resistor, like MicrogridBusDQ, doesn't have an internal variables, so does not need to set any tags in tagDifferentiable()
Also removed check that isn't necessary anymore due to tag_ being alllocated in allocate()
@nkoukpaizan
nkoukpaizan self-requested a review August 24, 2026 18:21
* \brief Identify differential variables
*/
/// There are no internal variables in this component, so \ref tag_ can be set arbitrarily.
template <class ScalarT, typename IdxT>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a particular reason for changing the documentation format from /* ... */ to ///?

Comment on lines -135 to +138
y_ext_ = std::make_unique<const ScalarT*[]>(static_cast<size_t>(size_));
yp_ext_ = std::make_unique<const ScalarT*[]>(static_cast<size_t>(size_));
f_ext_ = std::make_unique<ScalarT*[]>(static_cast<size_t>(size_));
connection_nodes_ = std::make_unique<IdxT[]>(static_cast<size_t>(size_));
y_ext_ = std::make_unique<const ScalarT*[]>(static_cast<IdxT>(size_));
yp_ext_ = std::make_unique<const ScalarT*[]>(static_cast<IdxT>(size_));
f_ext_ = std::make_unique<ScalarT*[]>(static_cast<IdxT>(size_));
connection_nodes_ = std::make_unique<IdxT[]>(static_cast<IdxT>(size_));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This needs to be reverted, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants