Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
Loading...
Searching...
No Matches
AC_source Class Reference

Ideal AC voltage source with added series impedance. More...

#include <AC_source.h>

Inheritance diagram for AC_source:
Collaboration diagram for AC_source:

Public Member Functions

 AC_source (const std::string &symbol, const std::string &location, int pins, double V, DenseMatrix Z)
 Construct an AC source with a dense impedance matrix.
 
 AC_source (const std::string &symbol, const std::string &location, int pins, double V, const std::vector< double > &Z)
 Construct an AC source with a vector of per-phase impedances.
 
 AC_source (const std::string &symbol, const std::string &location, int pins, double V, const double Z)
 Construct an AC source with a scalar series impedance.
 
 ~AC_source ()
 
void writeMNAmatrix (SymEngine::DenseMatrix &, std::unordered_map< Bus *, int > &, int, std::map< Element *, std::vector< RCP< const Basic > > > &) override
 Stamp this element into the symbolic MNA matrix (override in derived classes).
 
std::vector< MatrixXcd > simulateInputStep (const std::vector< MatrixXcd > &states, int nKeep) const override
 Simulate a step response given input states (override in dynamic elements).
 
void printElementValues () override
 Print extended element-specific values (override in derived classes).
 
- Public Member Functions inherited from Source_base
 Source_base (const std::string &symbol, const std::string &location, int pins)
 Construct a source with equal input and output pin counts.
 
 ~Source_base ()
 
void computePowerFlow (std::map< std::string, double > &branchData, std::map< std::string, double > &globalParams) const override
 Compute branch power-flow quantities (override in derived classes).
 
double getZsrc () const
 
double getVg () const
 
- Public Member Functions inherited from Element
 Element (const std::string &symbol, const std::string &location, int inputPins, int outputPins)
 Construct an element with symbol, location, and pin counts.
 
virtual ~Element ()
 Virtual destructor for derived-class cleanup.
 
int getInputPins () const
 Get the number of input pins/phases.
 
int getOutputPins () const
 Get the number of output pins/phases.
 
void setInputPins (int pins)
 Set the number of input pins/phases.
 
void setOutputPins (int pins)
 Set the number of output pins/phases.
 
void setTransformation (bool flag)
 Enable or disable coordinate transformation for this element.
 
std::string getElementSymbol () const
 Get the element type symbol.
 
std::vector< Bus * > getBuses ()
 Collect all buses connected to this element.
 
int getBusIndex (Bus *bus)
 Find the terminal index associated with a given bus.
 
BusgetOtherBus (Bus *)
 Get the bus connected at the opposite terminal from a given bus.
 
const std::map< Bus *, int > & getConnections () const
 Const access to the bus-to-terminal connection map.
 
std::map< Bus *, int > getConnections ()
 Copy of the bus-to-terminal connection map.
 
string getElementLocation () const
 Get the element's grid or partition location label.
 
void attachBus (Bus *, int)
 Attach a bus to a specific element terminal.
 
void printElementInfo () const
 Print basic element metadata (symbol, input/output pin counts).
 
void writeFile (double start_frequency, double end_frequency, int number_of_points)
 Write Y-parameter matrix samples over a frequency sweep to a file.
 
void plotYParameters (double start_frequency, double end_frequency, int number_of_points)
 Plot Y-parameter matrix entries versus frequency.
 
virtual void plotEigenvalues ()
 Plot eigenvalues of the element model (override in state-space elements).
 
virtual void plotParticipationFactors ()
 Plot participation factors (override in state-space elements).
 
virtual std::vector< std::vector< complex< double > > > compute_y_parameters (double frequency)
 Compute complex Y-parameters at a single frequency.
 
virtual DenseMatrix get_y_parameters ()
 Get the symbolic or stored Y-parameter matrix.
 
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.
 
virtual int getNumberOfInternalStates () const
 Number of internal state variables for dynamic elements.
 
virtual int getNumberOfPlantStates () const
 Number of plant states exposed for simulation (may differ from internal states).
 
virtual std::vector< RCP< const Basic > > getVirtualInputSymbols () const
 Return symbolic names for virtual inputs used in stamping.
 
virtual map_basic_basic getParameterSubstitutions () const
 Return parameter substitutions for symbolic evaluation.
 
std::map< std::string, double > getOPFInfo () const
 Get stored OPF-related metadata for this element.
 
void setOPFInfo (std::map< std::string, double > &info)
 Store OPF-related metadata for this element.
 

Additional Inherited Members

- Protected Attributes inherited from Source_base
vector< double > Zsrc = {}
 
vector< double > V = {}
 
vector< double > theta = {}
 
double P
 
double Q
 
double P_min
 
double P_max
 
double Q_min
 
double Q_max
 
- Protected Attributes inherited from Element
bool transformation = false
 
std::string element_symbol
 
std::string element_location
 
int input_pins
 
int output_pins
 
std::map< Bus *, int > connections
 
std::map< std::string, double > element_OPF_info = {}
 
DenseMatrix Y_matrix
 

Detailed Description

Ideal AC voltage source with added series impedance.

Supports single- or multi-phase configuration. Power-flow data (voltage magnitude, phase shift, P/Q limits) is supplied after construction.

Constructor & Destructor Documentation

◆ AC_source() [1/3]

AC_source::AC_source ( const std::string &  symbol,
const std::string &  location,
int  pins,
double  V,
DenseMatrix  Z 
)

Construct an AC source with a dense impedance matrix.

Parameters
symbolElement identifier.
locationNetwork area or location string.
pinsNumber of pins (phases).
VVoltage magnitude.
ZSeries impedance matrix.

References j, omega, substitute_symbol(), Source_base::V, Element::Y_matrix, and Source_base::Zsrc.

◆ AC_source() [2/3]

AC_source::AC_source ( const std::string &  symbol,
const std::string &  location,
int  pins,
double  V,
const std::vector< double > &  Z 
)

Construct an AC source with a vector of per-phase impedances.

Parameters
symbolElement identifier.
locationNetwork area or location string.
pinsNumber of pins (phases).
VVoltage magnitude.
ZSeries impedance values in ohms.

References j, Source_base::V, Element::Y_matrix, and Source_base::Zsrc.

◆ AC_source() [3/3]

AC_source::AC_source ( const std::string &  symbol,
const std::string &  location,
int  pins,
double  V,
const double  Z 
)

Construct an AC source with a scalar series impedance.

Parameters
symbolElement identifier.
locationNetwork area or location string.
pinsNumber of pins (phases).
VVoltage magnitude.
ZSeries impedance in ohms.

References j, Source_base::V, Element::Y_matrix, and Source_base::Zsrc.

◆ ~AC_source()

AC_source::~AC_source ( )

Member Function Documentation

◆ printElementValues()

void AC_source::printElementValues ( )
overridevirtual

Print extended element-specific values (override in derived classes).

Prints the symbolic Y-parameter matrix of the element to the console.

Reimplemented from Element.

References Element::printElementInfo().

◆ simulateInputStep()

std::vector< MatrixXcd > AC_source::simulateInputStep ( const std::vector< MatrixXcd > &  states,
int  nKeep 
) const
overridevirtual

Simulate a step response given input states (override in dynamic elements).

Parameters
statesInput state trajectories per channel.
nKeepNumber of states to retain in the output.
Returns
Simulated state matrices; empty for static elements.

Reimplemented from Element.

References Source_base::V.

◆ writeMNAmatrix()

void AC_source::writeMNAmatrix ( SymEngine::DenseMatrix &  ,
std::unordered_map< Bus *, int > &  ,
int  ,
std::map< Element *, std::vector< RCP< const Basic > > > &   
)
overridevirtual

Stamp this element into the symbolic MNA matrix (override in derived classes).

Parameters
mnaGlobal MNA matrix being assembled.
busIndexMapMaps buses to global node indices.
offsetCurrent matrix offset for stamping.
elementSymbolsPer-element symbolic substitution table.

Reimplemented from Element.

References addSym(), Element::connections, Element::getElementSymbol(), and Element::input_pins.


The documentation for this class was generated from the following files: