Skip to content

Commit

Permalink
apply clang-format
Browse files Browse the repository at this point in the history
Signed-off-by: martin.moraga <[email protected]>
  • Loading branch information
martinmoraga committed Mar 26, 2024
1 parent 8131c2c commit 13719e5
Show file tree
Hide file tree
Showing 26 changed files with 2,224 additions and 1,752 deletions.
123 changes: 65 additions & 58 deletions dpsim-models/include/dpsim-models/DP/DP_Ph1_PiLine_deprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,79 @@

#pragma once

#include <dpsim-models/CompositePowerComp.h>
#include <dpsim-models/Solver/MNATearInterface.h>
#include <dpsim-models/Base/Base_Ph1_PiLine.h>
#include <dpsim-models/DP/DP_Ph1_Resistor.h>
#include <dpsim-models/DP/DP_Ph1_Inductor.h>
#include <dpsim-models/CompositePowerComp.h>
#include <dpsim-models/DP/DP_Ph1_Capacitor.h>
#include <dpsim-models/DP/DP_Ph1_Inductor.h>
#include <dpsim-models/DP/DP_Ph1_Resistor.h>
#include <dpsim-models/Solver/MNATearInterface.h>

namespace CPS {
namespace DP {
namespace Ph1 {
/// \brief PI-line dynamic phasor model
///
/// This model consists sub components to represent the
/// RLC elements of a PI-line.
class PiLine :
public CompositePowerComp<Complex>,
public MNATearInterface,
public Base::Ph1::PiLine,
public SharedFactory<PiLine> {
protected:
/// Series Inductance submodel
std::shared_ptr<Inductor> mSubSeriesInductor;
/// Series Resistor submodel
std::shared_ptr<Resistor> mSubSeriesResistor;
/// Parallel Resistor submodel at Terminal 0
std::shared_ptr<Resistor> mSubParallelResistor0;
// Parallel Capacitor submodel at Terminal 0
std::shared_ptr<Capacitor> mSubParallelCapacitor0;
/// Parallel resistor submodel at Terminal 1
std::shared_ptr<Resistor> mSubParallelResistor1;
/// Parallel capacitor submodel at Terminal 1
std::shared_ptr<Capacitor> mSubParallelCapacitor1;
/// Right side vectors of subcomponents
std::vector<const Matrix*> mRightVectorStamps;
public:
/// Defines UID, name and logging level
PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
/// Defines name and logging level
PiLine(String name, Logger::Level logLevel = Logger::Level::off)
: PiLine(name, name, logLevel) { }
/// \brief PI-line dynamic phasor model
///
/// This model consists sub components to represent the
/// RLC elements of a PI-line.
class PiLine : public CompositePowerComp<Complex>,
public MNATearInterface,
public Base::Ph1::PiLine,
public SharedFactory<PiLine> {
protected:
/// Series Inductance submodel
std::shared_ptr<Inductor> mSubSeriesInductor;
/// Series Resistor submodel
std::shared_ptr<Resistor> mSubSeriesResistor;
/// Parallel Resistor submodel at Terminal 0
std::shared_ptr<Resistor> mSubParallelResistor0;
// Parallel Capacitor submodel at Terminal 0
std::shared_ptr<Capacitor> mSubParallelCapacitor0;
/// Parallel resistor submodel at Terminal 1
std::shared_ptr<Resistor> mSubParallelResistor1;
/// Parallel capacitor submodel at Terminal 1
std::shared_ptr<Capacitor> mSubParallelCapacitor1;
/// Right side vectors of subcomponents
std::vector<const Matrix *> mRightVectorStamps;

SimPowerComp<Complex>::Ptr clone(String copySuffix);
public:
/// Defines UID, name and logging level
PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
/// Defines name and logging level
PiLine(String name, Logger::Level logLevel = Logger::Level::off)
: PiLine(name, name, logLevel) {}

// #### General ####
/// Initializes component from power flow data
void initializeFromNodesAndTerminals(Real frequency);
SimPowerComp<Complex>::Ptr clone(String copySuffix);

// #### MNA section ####
/// Updates internal current variable of the component
void mnaCompUpdateCurrent(const Matrix& leftVector);
/// Updates internal voltage variable of the component
void mnaCompUpdateVoltage(const Matrix& leftVector);
/// MNA pre and post step operations
void mnaParentPreStep(Real time, Int timeStepCount) override;
void mnaParentPostStep(Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) override;
/// add MNA pre and post step dependencies
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override;
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute<Matrix>::Ptr &leftVector) override;
// #### General ####
/// Initializes component from power flow data
void initializeFromNodesAndTerminals(Real frequency);

MNAInterface::List mnaTearGroundComponents();
void mnaTearInitialize(Real omega, Real timeStep);
void mnaTearApplyMatrixStamp(SparseMatrixRow& tearMatrix);
void mnaTearApplyVoltageStamp(Matrix& voltageVector);
void mnaTearPostStep(Complex voltage, Complex current);
// #### MNA section ####
/// Updates internal current variable of the component
void mnaCompUpdateCurrent(const Matrix &leftVector);
/// Updates internal voltage variable of the component
void mnaCompUpdateVoltage(const Matrix &leftVector);
/// MNA pre and post step operations
void mnaParentPreStep(Real time, Int timeStepCount) override;
void mnaParentPostStep(Real time, Int timeStepCount,
Attribute<Matrix>::Ptr &leftVector) override;
/// add MNA pre and post step dependencies
void mnaParentAddPreStepDependencies(
AttributeBase::List &prevStepDependencies,
AttributeBase::List &attributeDependencies,
AttributeBase::List &modifiedAttributes) override;
void
mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
AttributeBase::List &attributeDependencies,
AttributeBase::List &modifiedAttributes,
Attribute<Matrix>::Ptr &leftVector) override;

};
}
}
}
MNAInterface::List mnaTearGroundComponents();
void mnaTearInitialize(Real omega, Real timeStep);
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix);
void mnaTearApplyVoltageStamp(Matrix &voltageVector);
void mnaTearPostStep(Complex voltage, Complex current);
};
} // namespace Ph1
} // namespace DP
} // namespace CPS
146 changes: 79 additions & 67 deletions dpsim-models/include/dpsim-models/DP/DP_Ph1_Transformer_deprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,96 @@

#pragma once

#include <dpsim-models/Base/Base_Ph1_Transformer.h>
#include <dpsim-models/CompositePowerComp.h>
#include <dpsim-models/Solver/MNAInterface.h>
#include <dpsim-models/DP/DP_Ph1_Resistor.h>
#include <dpsim-models/DP/DP_Ph1_Capacitor.h>
#include <dpsim-models/DP/DP_Ph1_Inductor.h>
#include <dpsim-models/Base/Base_Ph1_Transformer.h>
#include <dpsim-models/DP/DP_Ph1_Resistor.h>
#include <dpsim-models/Solver/MNAInterface.h>

namespace CPS {
namespace DP {
namespace Ph1 {
/// Transformer that includes an inductance and resistance
class Transformer :
public CompositePowerComp<Complex>,
public SharedFactory<Transformer>,
public Base::Ph1::Transformer {
private:
/// Internal resistor to model losses
std::shared_ptr<DP::Ph1::Resistor> mSubResistor;
/// Internal inductor to model losses
std::shared_ptr<DP::Ph1::Inductor> mSubInductor;
/// Transformer that includes an inductance and resistance
class Transformer : public CompositePowerComp<Complex>,
public SharedFactory<Transformer>,
public Base::Ph1::Transformer {
private:
/// Internal resistor to model losses
std::shared_ptr<DP::Ph1::Resistor> mSubResistor;
/// Internal inductor to model losses
std::shared_ptr<DP::Ph1::Inductor> mSubInductor;

/// Internal parallel resistance 1 as snubber
std::shared_ptr<DP::Ph1::Resistor> mSubSnubResistor1;
/// Internal parallel resistance 2 as snubber
std::shared_ptr<DP::Ph1::Resistor> mSubSnubResistor2;
/// Internal parallel capacitance 1 as snubber
std::shared_ptr<DP::Ph1::Capacitor> mSubSnubCapacitor1;
/// Internal parallel capacitance 2 as snubber
std::shared_ptr<DP::Ph1::Capacitor> mSubSnubCapacitor2;
/// Internal parallel resistance 1 as snubber
std::shared_ptr<DP::Ph1::Resistor> mSubSnubResistor1;
/// Internal parallel resistance 2 as snubber
std::shared_ptr<DP::Ph1::Resistor> mSubSnubResistor2;
/// Internal parallel capacitance 1 as snubber
std::shared_ptr<DP::Ph1::Capacitor> mSubSnubCapacitor1;
/// Internal parallel capacitance 2 as snubber
std::shared_ptr<DP::Ph1::Capacitor> mSubSnubCapacitor2;

/// Snubber resistance 1 [Ohm]
Real mSnubberResistance1;
/// Snubber resistance 2 [Ohm]
Real mSnubberResistance2;
/// Snubber capacitance 1 [F]
Real mSnubberCapacitance1;
/// Snubber capacitance 2 [F]
Real mSnubberCapacitance2;
/// Snubber resistance 1 [Ohm]
Real mSnubberResistance1;
/// Snubber resistance 2 [Ohm]
Real mSnubberResistance2;
/// Snubber capacitance 1 [F]
Real mSnubberCapacitance1;
/// Snubber capacitance 2 [F]
Real mSnubberCapacitance2;

/// Boolean for considering resistive losses with sub resistor
Bool mWithResistiveLosses;
public:
/// Defines UID, name and logging level
Transformer(String uid, String name,
Logger::Level logLevel = Logger::Level::off, Bool withResistiveLosses = false);
/// Defines name and logging level
Transformer(String name, Logger::Level logLevel = Logger::Level::off)
: Transformer(name, name, logLevel) { }
/// Boolean for considering resistive losses with sub resistor
Bool mWithResistiveLosses;

SimPowerComp<Complex>::Ptr clone(String name);
public:
/// Defines UID, name and logging level
Transformer(String uid, String name,
Logger::Level logLevel = Logger::Level::off,
Bool withResistiveLosses = false);
/// Defines name and logging level
Transformer(String name, Logger::Level logLevel = Logger::Level::off)
: Transformer(name, name, logLevel) {}

// #### General ####
/// Defines component parameters
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance);
/// Set transformer specific parameters
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance);
/// Initializes component from power flow data
void initializeFromNodesAndTerminals(Real frequency);
SimPowerComp<Complex>::Ptr clone(String name);

// #### MNA section ####
/// Initializes internal variables of the component
void mnaParentInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) override;
/// Stamps system matrix
void mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) override;
/// Updates internal current variable of the component
void mnaCompUpdateCurrent(const Matrix& leftVector) override;
/// Updates internal voltage variable of the component
void mnaCompUpdateVoltage(const Matrix& leftVector) override;
/// MNA pre step operations
void mnaParentPreStep(Real time, Int timeStepCount) override;
/// MNA post step operations
void mnaParentPostStep(Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) override;
/// Add MNA pre step dependencies
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override;
/// Add MNA post step dependencies
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute<Matrix>::Ptr &leftVector) override;
// #### General ####
/// Defines component parameters
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratioAbs,
Real ratioPhase, Real resistance, Real inductance);
/// Set transformer specific parameters
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower,
Real ratioAbs, Real ratioPhase, Real resistance,
Real inductance);
/// Initializes component from power flow data
void initializeFromNodesAndTerminals(Real frequency);

};
}
}
}
// #### MNA section ####
/// Initializes internal variables of the component
void mnaParentInitialize(Real omega, Real timeStep,
Attribute<Matrix>::Ptr leftVector) override;
/// Stamps system matrix
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
/// Updates internal current variable of the component
void mnaCompUpdateCurrent(const Matrix &leftVector) override;
/// Updates internal voltage variable of the component
void mnaCompUpdateVoltage(const Matrix &leftVector) override;
/// MNA pre step operations
void mnaParentPreStep(Real time, Int timeStepCount) override;
/// MNA post step operations
void mnaParentPostStep(Real time, Int timeStepCount,
Attribute<Matrix>::Ptr &leftVector) override;
/// Add MNA pre step dependencies
void mnaParentAddPreStepDependencies(
AttributeBase::List &prevStepDependencies,
AttributeBase::List &attributeDependencies,
AttributeBase::List &modifiedAttributes) override;
/// Add MNA post step dependencies
void
mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
AttributeBase::List &attributeDependencies,
AttributeBase::List &modifiedAttributes,
Attribute<Matrix>::Ptr &leftVector) override;
};
} // namespace Ph1
} // namespace DP
} // namespace CPS
Loading

0 comments on commit 13719e5

Please sign in to comment.