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

Multi-layer cable model with conductor and insulator sections. More...

#include <Cable.h>

Inheritance diagram for Cable:
Collaboration diagram for Cable:

Classes

class  Conductor
 Conducting layer with inner/outer radius and material properties. More...
 
class  Insulator
 Insulating layer with optional inner/outer semiconductor radii. More...
 

Public Member Functions

 Cable ()
 Default cable with placeholder symbol, location, and pin counts.
 
 Cable (const string &symbol, const std::string &location, int pins, const string &type_constructor, double length_constructor, std::tuple< double, double, double > earth, std::map< string, Conductor * > conductors_constructor, std::map< string, Insulator * > insulators_constructor, std::vector< std::pair< double, double > > positions_constructor)
 Construct a cable from geometry, earth, conductor, and insulator maps.
 
void setLength (double newLength)
 
void addConductor (const std::string &key, Conductor *conductor)
 
void addInsulator (const std::string &key, Insulator *insulator)
 
void addPosition (double x, double y)
 
void setEarthParameters (double mu, double epsilon, double rho)
 
void setConfiguration (const std::string &newConfig)
 
void setEliminate (bool value)
 
double getLength () const
 
const std::tuple< double, double, double > & getEarthParameters () const
 
const std::vector< std::pair< double, double > > & getPositions () const
 
const std::string & getConfiguration () const
 
const std::string & getType () const
 
bool getEliminate () const
 
ConductorgetConductor (const std::string &key)
 
InsulatorgetInsulator (const std::string &key)
 
void updateInsulator (const std::string &key, Insulator *insulator)
 
void updateLayers ()
 
void updateConductor (const std::string &key, Conductor *conductor)
 
void removeConductor (const std::string &key)
 
const std::map< std::string, Conductor * > & getCableConductors () const
 
const std::map< std::string, Insulator * > & getCableInsulators () const
 
bool hasProperty (const std::string &key)
 
bool isConductor (const std::string &key)
 
bool isInsulator (const std::string &key)
 
virtual std::vector< std::vector< complex< double > > > compute_y_parameters (double frequency) override
 Compute complex Y-parameters at a single frequency.
 
virtual void printElementValues () override
 Print extended element-specific values (override in derived classes).
 
 ~Cable ()
 
- 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 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 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).
 
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< MatrixXcd > simulateInputStep (const std::vector< MatrixXcd > &states, int nKeep) const
 Simulate a step response given input states (override in dynamic elements).
 
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.
 
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).
 
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 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

Multi-layer cable model with conductor and insulator sections.

Constructor & Destructor Documentation

◆ Cable() [1/2]

Cable::Cable ( )
inline

Default cable with placeholder symbol, location, and pin counts.

◆ Cable() [2/2]

Cable::Cable ( const string &  symbol,
const std::string &  location,
int  pins,
const string &  type_constructor,
double  length_constructor,
std::tuple< double, double, double >  earth,
std::map< string, Conductor * >  conductors_constructor,
std::map< string, Insulator * >  insulators_constructor,
std::vector< std::pair< double, double > >  positions_constructor 
)

Construct a cable from geometry, earth, conductor, and insulator maps.

Constructs a new Cable object.

Parameters
symbolElement identifier.
locationNetwork area or location string.
pinsNumber of pins (phases).
type_constructorCable type ("underground" or "aerial").
length_constructorLine length (m).
earthEarth parameters tuple (mu_r, epsilon_r, resistivity).
conductors_constructorMap of conductor symbols to Conductor layers.
insulators_constructorMap of insulator symbols to Insulator layers.
positions_constructor(x, y) positions of each cable in the layout.

This constructor initializes a cable element with its physical and electrical properties. It performs extensive calculations to model the cable's behavior, including impedance and admittance matrix computations using symbolic mathematics. The constructor handles various configurations, such as single-core, multi-layer cables, and multi-cable systems, and accounts for earth return path effects.

Parameters
symbolThe unique identifier for the cable element.
locationThe location of the element within the circuit.
pinsThe number of connection pins for the element.
type_constructorThe type of the cable (e.g., "underground").
configuration_constructorA string describing the cable's physical configuration.
length_constructorThe length of the cable in meters.
earthA tuple containing the ground properties: relative permeability (μᵣ), relative permittivity (εᵣ), and resistivity (ρ) in Ωm.
conductors_constructorA map of conductor layers, where the key is a string identifier (e.g., "C1", "SC") and the value is a pointer to a Conductor object.
insulators_constructorA map of insulator layers, where the key is a string identifier (e.g., "I1") and the value is a pointer to an Insulator object.
positions_constructorA vector of (x, y) coordinate pairs specifying the position of each cable in a multi-cable system.

References createZeroMatrix(), epsilon_0, gamma_num, getType(), j, kron_reduction(), mu_0, Cable::Insulator::permeability, Cable::Insulator::permittivity, Cable::Insulator::ri, Cable::Insulator::ro, s, updateLayers(), and Element::Y_matrix.

◆ ~Cable()

Cable::~Cable ( )

Member Function Documentation

◆ addConductor()

void Cable::addConductor ( const std::string &  key,
Conductor conductor 
)
inline

◆ addInsulator()

void Cable::addInsulator ( const std::string &  key,
Insulator insulator 
)
inline

◆ addPosition()

void Cable::addPosition ( double  x,
double  y 
)
inline

◆ compute_y_parameters()

std::vector< std::vector< complex< double > > > Cable::compute_y_parameters ( double  frequency)
overridevirtual

Compute complex Y-parameters at a single frequency.

Computes the numerical Y-parameter matrix at a given frequency.

Default implementation returns an empty matrix; derived classes provide the frequency-dependent admittance.

Parameters
frequencyEvaluation frequency in Hz.
Returns
Complex Y-parameter matrix as nested vectors.
Parameters
frequencyThe frequency in Hz for which to compute the Y-parameters.
Returns
A 2D vector of complex numbers representing the Y-parameter matrix.

Reimplemented from Element.

References j, omega, and substitute_symbol().

◆ getCableConductors()

const std::map< std::string, Conductor * > & Cable::getCableConductors ( ) const
inline

◆ getCableInsulators()

const std::map< std::string, Insulator * > & Cable::getCableInsulators ( ) const
inline

◆ getConductor()

Conductor * Cable::getConductor ( const std::string &  key)
inline

Referenced by updateLayers().

◆ getConfiguration()

const std::string & Cable::getConfiguration ( ) const
inline

◆ getEarthParameters()

const std::tuple< double, double, double > & Cable::getEarthParameters ( ) const
inline

◆ getEliminate()

bool Cable::getEliminate ( ) const
inline

◆ getInsulator()

Insulator * Cable::getInsulator ( const std::string &  key)
inline

Referenced by updateLayers().

◆ getLength()

double Cable::getLength ( ) const
inline

◆ getPositions()

const std::vector< std::pair< double, double > > & Cable::getPositions ( ) const
inline

◆ getType()

const std::string & Cable::getType ( ) const
inline

Referenced by Cable().

◆ hasProperty()

bool Cable::hasProperty ( const std::string &  key)
inline

◆ isConductor()

bool Cable::isConductor ( const std::string &  key)
inline

◆ isInsulator()

bool Cable::isInsulator ( const std::string &  key)
inline

◆ printElementValues()

void Cable::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.

Referenced by example_cable().

◆ removeConductor()

void Cable::removeConductor ( const std::string &  key)
inline

Referenced by updateLayers().

◆ setConfiguration()

void Cable::setConfiguration ( const std::string &  newConfig)
inline

◆ setEarthParameters()

void Cable::setEarthParameters ( double  mu,
double  epsilon,
double  rho 
)
inline

◆ setEliminate()

void Cable::setEliminate ( bool  value)
inline

◆ setLength()

void Cable::setLength ( double  newLength)
inline

◆ updateConductor()

void Cable::updateConductor ( const std::string &  key,
Conductor conductor 
)
inline

Referenced by updateLayers().

◆ updateInsulator()

void Cable::updateInsulator ( const std::string &  key,
Insulator insulator 
)
inline

◆ updateLayers()


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