Introduce cosimulation interface component#401
Conversation
|
|
||
| if (signals_.template isAttached<IREAL>()) | ||
| { | ||
| bus_->Ir() = signals_.template readExternalVariable<IREAL>(); |
There was a problem hiding this comment.
Should this be += instead of =? Unless we call the evalResidual before all other components, but check my logic here
There was a problem hiding this comment.
That wouldn't fit MY intuition, but I don't know. I'll defer. @pelesh can you answer this?
There was a problem hiding this comment.
Yes, your intuition is correct, injection currents add to the sum of currents on the bus.
|
Only had one implementation concern regarding correctness. The facade of the Vr/Vi being treated as an internal variable is confusing to me. What are your thoughts on an auxiliary internal state? That would be more consistent, and since we would only have a small number of CoSim components for any given system model, the state duplication isn't too costly. |
My opinion is that the arrays in All that to say, given the current implementation of |
I am a big fan of this solution, this would resolve some modeling vocab concerns I have in our exciter and stabilizers. |
nkoukpaizan
left a comment
There was a problem hiding this comment.
Setting to draft for now. I have some thoughts, but I'll let @pelesh discuss this offline.
| namespace Connector | ||
| { | ||
| // Available template instantiations | ||
| template class CoSim<double, long int>; |
There was a problem hiding this comment.
Connector::CoSim as a component is confusing to me. Domain experts can chime in on the naming, but my understanding is that Co-Simulation is the approach. Perhaps we can call the class CoSimConnector (unless we plan to add other things to the namespace)? I would understand CoSim::Connector as well, though I expect the co-simulation environment to live outside of PhasorDynamics.
There was a problem hiding this comment.
CoSim::Connector is okay. Most other power system frameworks actually model the interfacing component as a circuit element, so either a lossless branch with a time delay, or a Bus.
From an electrical perspective a Bus or Branch implementation (BusCoSim, or BranchCoSim) would be correct and has an equivalent circuit model which is nice.
I'm okay with either
There was a problem hiding this comment.
Good points. I was not at all sure about the naming/organizing. Happy to change as you all see fit.
There was a problem hiding this comment.
I would call it BusToSignalAdapter or something along those lines. While we are developing it for use in co-simulations, it is not a co-simulation object itself. I also think "connector" is a misleading name because it is not a model of a physical connector. It is just a modeling "adapter" without physical meaning, used to convert data for use by models of different type.
There was a problem hiding this comment.
I suggest for the purpose of this PR to use temporary names (something that we can search/replace easily).
| }; | ||
|
|
||
| template <class ScalarT, typename IdxT> | ||
| class CoSim : public Component<ScalarT, IdxT> |
There was a problem hiding this comment.
I'm not sure this should inherit from Component. If it does, we will need a README in the Connector folder describing the model. But to me, this should behave closer to the signal nodes or buses than other components.
There was a problem hiding this comment.
I would let it be a component for now (and, yes, we need a README). It connects to a bus and has signal ports, so it can use the infrastructure of a component.
The other end of the connection (outside the scope of this PR) should probably inherit from the bus and allow components to connect to it.
This is correct understanding. Signals represent directed communication and are defined by inputs/outputs. Physics-based couplings are based on conservation laws and have associated variables that are external to coupled components. |
Description
Basic implementation of cosimulation component
Closes #393
Proposed changes
Uses two output signals to transmit$V_r$ and $V_i$ from connected bus and two input signals to transfer $I_r$ and $I_i$ to connected bus.
Checklist
-Wall -Wpedantic -Wconversion -Wextra.