DPsim
Loading...
Searching...
No Matches
EMT_DC_Resistor.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
2// SPDX-License-Identifier: MPL-2.0
3
5
6using namespace CPS;
7
11
13 auto copy = Resistor::make(name, mLogLevel);
14 copy->setParameters(**mResistance);
15 return copy;
16}
17
19 if (!Math::isFinite(resistance) ||
20 resistance <= std::numeric_limits<Real>::epsilon())
21 throw std::invalid_argument(
22 "DC resistance must be finite and safely greater than zero.");
23
24 **mResistance = resistance;
25
26 // Stateless conductance relation: i = v / R.
27 SSNComp::setParameters(Matrix::Zero(0, 0), Matrix::Zero(0, 1),
28 Matrix::Zero(1, 0),
29 Matrix::Constant(1, 1, 1.0 / resistance));
30}
void setParameters(Real resistance)
const Attribute< Real >::Ptr mResistance
Resistance [ohm].
Resistor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
SimPowerComp< Real >::Ptr clone(String name) override final
Returns a modified copy of the component with the given suffix added to the name and without.
TwoTerminalVTypeSSNComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void setParameters(const Matrix &A, const Matrix &B, const Matrix &C, const Matrix &D)
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
Definition Logger.h:33
static bool isFinite(Real value)
Definition MathUtils.cpp:63
std::shared_ptr< SimPowerComp< VarType > > Ptr
Logger::Level mLogLevel
Component logger control for internal variables.
static std::shared_ptr< Resistor > make(Args &&...args)
Definition PtrFactory.h:19
std::string String
Definition Definitions.h:65
double Real
Definition Definitions.h:62