Skip to content

Decoupling ITM#423

Open
pipeacosta wants to merge 35 commits intosogno-platform:masterfrom
pipeacosta:decoupling-itm
Open

Decoupling ITM#423
pipeacosta wants to merge 35 commits intosogno-platform:masterfrom
pipeacosta:decoupling-itm

Conversation

@pipeacosta
Copy link
Copy Markdown
Contributor

This PR implements new decoupling elements based on the Ideal Transformer Model (ITM) for exemplifying co-simulation scenarios.

@pipeacosta pipeacosta self-assigned this Nov 21, 2025
@pipeacosta pipeacosta added the enhancement New feature or request label Nov 21, 2025
@leonardocarreras leonardocarreras moved this to In Progress in DPsim Nov 21, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 71.98795% with 186 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.79%. Comparing base (379e89e) to head (579b4bf).

Files with missing lines Patch % Lines
.../src/Signal/DecouplingIdealTransformer_EMT_Ph1.cpp 0.00% 100 Missing ⚠️
.../src/Signal/DecouplingIdealTransformer_EMT_Ph3.cpp 84.61% 18 Missing ⚠️
...s/src/Signal/DecouplingIdealTransformer_SP_Ph1.cpp 86.84% 15 Missing ⚠️
...models/Signal/DecouplingIdealTransformer_EMT_Ph1.h 0.00% 12 Missing ⚠️
...m-models/src/SP/SP_Ph1_ControlledCurrentSource.cpp 76.92% 12 Missing ⚠️
...m-models/src/SP/SP_Ph1_ControlledVoltageSource.cpp 83.33% 11 Missing ⚠️
dpsim-models/src/EMT/EMT_Ph3_RXLoad.cpp 73.07% 7 Missing ⚠️
dpsim-models/src/SimNode.cpp 0.00% 4 Missing ⚠️
dpsim-models/src/SystemTopology.cpp 0.00% 4 Missing ⚠️
dpsim/src/pybind/SignalComponents.cpp 91.17% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #423      +/-   ##
==========================================
+ Coverage   65.22%   65.79%   +0.57%     
==========================================
  Files         374      385      +11     
  Lines       22723    23369     +646     
  Branches    11240    11616     +376     
==========================================
+ Hits        14820    15375     +555     
- Misses       7877     7939      +62     
- Partials       26       55      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
a initPowerFromTerminal method was implemented to
be able to set the parameters of the load before
running the simulation.

Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Modified the setParameters function of the DecouplingIdealTransformerEMT.

Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
…xample.

Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
delay in the ITM.

Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
- Add parameters for consistent initialization using extrapolation
- Improve initialization
- Refactor: Rename decoupling node specifying that it is Ph1

Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: Andres Acosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
@pipeacosta pipeacosta marked this pull request as ready for review November 25, 2025 11:57
@leonardocarreras leonardocarreras moved this from In Progress to Ready for Review in DPsim Nov 26, 2025
Copy link
Copy Markdown
Contributor

@leonardocarreras leonardocarreras left a comment

Choose a reason for hiding this comment

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

Hi Andres! Thanks for the PR! This is just a quick first comment. We can discuss more and see how to integrate it.

/// Initializes component from power flow data
void initializeFromNodesAndTerminals(Real frequency) override;
///
void initPowerFromTerminal();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is good to use a verb for the function name, i.e. initializePowerFromTerminal... In my opinion is also important to see if this is active, reactive or both powers. I think is possible to use the comment on top to say this in the code.

void SystemTopology::removeNode(const String &name) {
for (auto it = mNodes.begin(); it != mNodes.end(); ) {
if ((*it)->name() == name) {
it = mNodes.erase(it);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this makes sure to collect the components connected to the node and erase them too?

if (args.options.find("seq") != args.options.end())
numSeq = args.getOptionInt("seq");

std::cout << "Simulate with " << numThreads
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use a logger

UInt mExtrapolationDegree = 0;
Eigen::MatrixXd mVoltageSrcIntfCurr;

Real interpolate(std::vector<Real> &data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what does this inter/extrapolate? maybe more explanation can help

public:
typedef std::shared_ptr<DecouplingIdealTransformer_EMT_Ph1> Ptr;

const Attribute<Real>::Ptr mSourceVoltageIntfVoltage;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if possible, a drawing of this circuit in the documentation will help

Logger::matrixToString(**mActivePower),
Logger::matrixToString(**mReactivePower));
SPDLOG_LOGGER_INFO(mSLog, "Nominal Voltage={} [V]", **mNomVoltage);
if (doInitPowerFromTerminal) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this change needed?


SimPowerComp<Real>::Ptr EMT::Ph3::RXLoad::clone(String name) {
if (doInitPowerFromTerminal) {
initPowerFromTerminal();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this needed/cannot use existing function?

Matrix mCapacitance;
///
Bool initPowerFromTerminal = true;
Bool doInitPowerFromTerminal = true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mInitPowerFromTerminals ? new name has verb, is preferable that variables have noun names

protected:
Real mDelay;

std::shared_ptr<EMT::SimNode> mNode1, mNode2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please draw the circuit and add it to the documentation

.def(py::init<CPS::Real>())
.def("add", &DPsim::SystemTopology::addComponent)
.def("add", &DPsim::SystemTopology::addComponents)
.def("add_node", &DPsim::SystemTopology::addNode)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we overload add? as we do not have add component or add signal separately

Copy link
Copy Markdown
Contributor

@leonardocarreras leonardocarreras left a comment

Choose a reason for hiding this comment

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

Hi Andres! Please have a look to the comments! Thanks for the PR!

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

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants