9#include "../Constants.h"
10#include "../Solver/Helper_Functions/Helper_Functions.h"
42 Element(
const std::string& symbol,
const std::string& location,
int inputPins,
int outputPins)
160 void writeFile(
double start_frequency,
double end_frequency,
int number_of_points);
168 void plotYParameters(
double start_frequency,
double end_frequency,
int number_of_points);
174 cout <<
"Eigenvalue plotting is not available for the linear element." << endl;
181 cout <<
"Participation factors plotting is not available for the linear element." << endl;
207 virtual std::vector<std::vector<complex<double>>>
apply_transformation(std::vector<std::vector<complex<double>>>& Y1, std::vector<std::vector<complex<double>>>& Y2);
216 virtual void writeMNAmatrix(SymEngine::DenseMatrix&, std::unordered_map<Bus*, int>&,
int, std::map<
Element*, std::vector<RCP<const Basic>>>&) {};
239 const std::vector<MatrixXcd>& states,
int nKeep)
const {
261 std::map<std::string, double>& globalParams)
const {
DenseMatrix createZeroMatrix(int size1, int size2)
Creates a zero-filled SymEngine dense matrix.
Definition Symbolic_functions.cpp:15
A network node connecting one or more element terminals.
Definition Bus.h:21
Base class for multi-phase network elements with Y-parameters and MNA stamping hooks.
Definition Element.h:29
void setInputPins(int pins)
Set the number of input pins/phases.
Definition Element.h:68
int getBusIndex(Bus *bus)
Find the terminal index associated with a given bus.
Definition Element.h:99
virtual ~Element()
Virtual destructor for derived-class cleanup.
Definition Element.cpp:15
bool transformation
Definition Element.h:279
int getInputPins() const
Get the number of input pins/phases.
Definition Element.h:56
int input_pins
Definition Element.h:283
int getOutputPins() const
Get the number of output pins/phases.
Definition Element.h:62
std::string element_symbol
Definition Element.h:281
std::vector< Bus * > getBuses()
Collect all buses connected to this element.
Definition Element.cpp:30
virtual int getNumberOfInternalStates() const
Number of internal state variables for dynamic elements.
Definition Element.h:222
std::string element_location
Definition Element.h:282
std::map< Bus *, int > connections
Definition Element.h:285
virtual std::vector< std::vector< complex< double > > > compute_y_parameters(double frequency)
Compute complex Y-parameters at a single frequency.
Definition Element.cpp:56
virtual std::vector< std::vector< complex< double > > > apply_transformation(std::vector< std::vector< complex< double > > > &Y1, std::vector< std::vector< complex< double > > > &Y2)
Apply a coordinate or coupling transformation to Y-parameter blocks.
Definition Element.cpp:122
virtual void writeMNAmatrix(SymEngine::DenseMatrix &, std::unordered_map< Bus *, int > &, int, std::map< Element *, std::vector< RCP< const Basic > > > &)
Stamp this element into the symbolic MNA matrix (override in derived classes).
Definition Element.h:216
virtual map_basic_basic getParameterSubstitutions() const
Return parameter substitutions for symbolic evaluation.
Definition Element.h:253
virtual void plotParticipationFactors()
Plot participation factors (override in state-space elements).
Definition Element.h:180
void printElementInfo() const
Print basic element metadata (symbol, input/output pin counts).
Definition Element.h:143
virtual int getNumberOfPlantStates() const
Number of plant states exposed for simulation (may differ from internal states).
Definition Element.h:228
virtual void plotEigenvalues()
Plot eigenvalues of the element model (override in state-space elements).
Definition Element.h:173
virtual DenseMatrix get_y_parameters()
Get the symbolic or stored Y-parameter matrix.
Definition Element.h:199
void writeFile(double start_frequency, double end_frequency, int number_of_points)
Write Y-parameter matrix samples over a frequency sweep to a file.
Definition Element.cpp:198
std::map< std::string, double > element_OPF_info
Definition Element.h:286
void plotYParameters(double start_frequency, double end_frequency, int number_of_points)
Plot Y-parameter matrix entries versus frequency.
Definition Element.cpp:231
virtual void computePowerFlow(std::map< std::string, double > &branchData, std::map< std::string, double > &globalParams) const
Compute branch power-flow quantities (override in derived classes).
Definition Element.h:260
void setTransformation(bool flag)
Enable or disable coordinate transformation for this element.
Definition Element.h:80
DenseMatrix Y_matrix
Definition Element.h:288
int output_pins
Definition Element.h:284
Element(const std::string &symbol, const std::string &location, int inputPins, int outputPins)
Construct an element with symbol, location, and pin counts.
Definition Element.h:42
void attachBus(Bus *, int)
Attach a bus to a specific element terminal.
Definition Element.cpp:22
const std::map< Bus *, int > & getConnections() const
Const access to the bus-to-terminal connection map.
Definition Element.h:118
void setOPFInfo(std::map< std::string, double > &info)
Store OPF-related metadata for this element.
Definition Element.h:276
std::map< Bus *, int > getConnections()
Copy of the bus-to-terminal connection map.
Definition Element.h:124
virtual void printElementValues()
Print extended element-specific values (override in derived classes).
Definition Element.cpp:181
Bus * getOtherBus(Bus *)
Get the bus connected at the opposite terminal from a given bus.
Definition Element.cpp:43
std::map< std::string, double > getOPFInfo() const
Get stored OPF-related metadata for this element.
Definition Element.h:268
std::string getElementSymbol() const
Get the element type symbol.
Definition Element.h:86
string getElementLocation() const
Get the element's grid or partition location label.
Definition Element.h:130
virtual std::vector< RCP< const Basic > > getVirtualInputSymbols() const
Return symbolic names for virtual inputs used in stamping.
Definition Element.h:247
virtual std::vector< MatrixXcd > simulateInputStep(const std::vector< MatrixXcd > &states, int nKeep) const
Simulate a step response given input states (override in dynamic elements).
Definition Element.h:238
void setOutputPins(int pins)
Set the number of output pins/phases.
Definition Element.h:74