Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
d96009fd
Commit
d96009fd
authored
Oct 07, 2020
by
Markus Mirz
Browse files
check for unconnected terminals in solver
parent
b93a5c5a
Changes
55
Hide whitespace changes
Inline
Side-by-side
Source/MNASolver.cpp
View file @
d96009fd
...
...
@@ -97,6 +97,7 @@ void MnaSolver<Real>::initializeComponents() {
for
(
auto
comp
:
mMNAComponents
)
{
auto
pComp
=
std
::
dynamic_pointer_cast
<
SimPowerComp
<
Real
>>
(
comp
);
if
(
!
pComp
)
continue
;
pComp
->
checkForUnconnectedTerminals
();
pComp
->
initializeFromPowerflow
(
mSystem
.
mSystemFrequency
);
}
...
...
@@ -124,6 +125,7 @@ void MnaSolver<Complex>::initializeComponents() {
for
(
auto
comp
:
mMNAComponents
)
{
auto
pComp
=
std
::
dynamic_pointer_cast
<
SimPowerComp
<
Complex
>>
(
comp
);
if
(
!
pComp
)
continue
;
pComp
->
checkForUnconnectedTerminals
();
pComp
->
initializeFromPowerflow
(
mSystem
.
mSystemFrequency
);
}
...
...
models/Source/DP/DP_Ph1_AvVoltageSourceInverterDQ.cpp
View file @
d96009fd
...
...
@@ -148,7 +148,6 @@ void DP::Ph1::AvVoltageSourceInverterDQ::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
AvVoltageSourceInverterDQ
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
// set initial interface quantities
mIntfVoltage
(
0
,
0
)
=
initialSingleVoltage
(
0
);
...
...
models/Source/DP/DP_Ph1_Capacitor.cpp
View file @
d96009fd
...
...
@@ -36,7 +36,6 @@ void DP::Ph1::Capacitor::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
Capacitor
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Real
omega
=
2
*
PI
*
frequency
;
Complex
impedance
=
{
0
,
-
1.
/
(
omega
*
mCapacitance
)
};
...
...
@@ -212,7 +211,7 @@ void DP::Ph1::Capacitor::mnaApplyRightSideVectorStampHarm(Matrix& rightVector, I
}
void
DP
::
Ph1
::
Capacitor
::
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
)
{
// actually depends on C, but then we'd have to modify the system matrix anyway
// actually depends on C, but then we'd have to modify the system matrix anyway
prevStepDependencies
.
push_back
(
this
->
attribute
(
"i_intf"
));
prevStepDependencies
.
push_back
(
this
->
attribute
(
"v_intf"
));
modifiedAttributes
.
push_back
(
this
->
attribute
(
"right_vector"
));
...
...
models/Source/DP/DP_Ph1_ControlledVoltageSource.cpp
View file @
d96009fd
...
...
@@ -41,7 +41,6 @@ void DP::Ph1::ControlledVoltageSource::initialize(Matrix frequencies) {
void
DP
::
Ph1
::
ControlledVoltageSource
::
mnaInitialize
(
Real
omega
,
Real
timeStep
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
{
checkForUnconnectedTerminals
();
MNAInterface
::
mnaInitialize
(
omega
,
timeStep
);
updateMatrixNodeIndices
();
...
...
@@ -94,7 +93,7 @@ void DP::Ph1::ControlledVoltageSource::mnaAddPostStepDependencies(AttributeBase:
modifiedAttributes
.
push_back
(
this
->
attribute
(
"i_intf"
));
}
void
DP
::
Ph1
::
ControlledVoltageSource
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
void
DP
::
Ph1
::
ControlledVoltageSource
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
this
->
mnaUpdateCurrent
(
*
leftVector
);
}
...
...
models/Source/DP/DP_Ph1_CurrentSource.cpp
View file @
d96009fd
...
...
@@ -36,7 +36,6 @@ SimPowerComp<Complex>::Ptr DP::Ph1::CurrentSource::clone(String name) {
}
void
DP
::
Ph1
::
CurrentSource
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
mIntfVoltage
(
0
,
0
)
=
initialSingleVoltage
(
0
)
-
initialSingleVoltage
(
1
);
mCurrentRef
=
attribute
<
Complex
>
(
"I_ref"
);
...
...
models/Source/DP/DP_Ph1_Inductor.cpp
View file @
d96009fd
...
...
@@ -35,7 +35,6 @@ void DP::Ph1::Inductor::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
Inductor
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Real
omega
=
2.
*
PI
*
frequency
;
Complex
impedance
=
{
0
,
omega
*
mInductance
};
...
...
models/Source/DP/DP_Ph1_Inverter.cpp
View file @
d96009fd
...
...
@@ -32,10 +32,7 @@ void DP::Ph1::Inverter::setParameters(std::vector<Int> carrierHarms, std::vector
mParametersSet
=
true
;
}
void
DP
::
Ph1
::
Inverter
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
//mIntfVoltage(0,0) = initialSingleVoltage(0));
}
void
DP
::
Ph1
::
Inverter
::
initializeFromPowerflow
(
Real
frequency
)
{
}
void
DP
::
Ph1
::
Inverter
::
generateFrequencies
()
{
for
(
Int
m
=
2
;
m
<=
mMaxCarrierHarm
;
m
=
m
+
2
)
{
...
...
models/Source/DP/DP_Ph1_NetworkInjection.cpp
View file @
d96009fd
...
...
@@ -28,7 +28,6 @@ SimPowerComp<Complex>::Ptr DP::Ph1::NetworkInjection::clone(String name) {
}
void
DP
::
Ph1
::
NetworkInjection
::
initialize
(
Matrix
frequencies
)
{
checkForUnconnectedTerminals
();
mFrequencies
=
frequencies
;
mNumFreqs
=
static_cast
<
UInt
>
(
mFrequencies
.
size
());
...
...
models/Source/DP/DP_Ph1_PQLoadCS.cpp
View file @
d96009fd
...
...
@@ -57,7 +57,6 @@ SimPowerComp<Complex>::Ptr DP::Ph1::PQLoadCS::clone(String name) {
}
void
DP
::
Ph1
::
PQLoadCS
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
mActivePower
=
attribute
<
Real
>
(
"P"
);
mReactivePower
=
attribute
<
Real
>
(
"Q"
);
...
...
models/Source/DP/DP_Ph1_PiLine.cpp
View file @
d96009fd
...
...
@@ -36,7 +36,6 @@ void DP::Ph1::PiLine::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
PiLine
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
// Static calculation
Real
omega
=
2.
*
PI
*
frequency
;
...
...
@@ -165,7 +164,7 @@ void DP::Ph1::PiLine::mnaAddPreStepDependencies(AttributeBase::List &prevStepDep
modifiedAttributes
.
push_back
(
this
->
attribute
(
"right_vector"
));
}
void
DP
::
Ph1
::
PiLine
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
void
DP
::
Ph1
::
PiLine
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
// pre-step of subcomponents
this
->
mSubSeriesInductor
->
mnaPreStep
(
time
,
timeStepCount
);
if
(
this
->
mParallelCap
>=
0
)
{
...
...
models/Source/DP/DP_Ph1_RXLoad.cpp
View file @
d96009fd
...
...
@@ -39,7 +39,6 @@ void DP::Ph1::RXLoad::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
RXLoad
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
if
(
!
mParametersSet
){
setParameters
(
...
...
models/Source/DP/DP_Ph1_RXLoadSwitch.cpp
View file @
d96009fd
...
...
@@ -16,7 +16,7 @@ DP::Ph1::RXLoadSwitch::RXLoadSwitch(String uid, String name, Logger::Level logLe
setVirtualNodeNumber
(
1
);
mIntfVoltage
=
MatrixComp
::
Zero
(
1
,
1
);
mIntfCurrent
=
MatrixComp
::
Zero
(
1
,
1
);
// Create sub components
mSubRXLoad
=
std
::
make_shared
<
DP
::
Ph1
::
RXLoad
>
(
mName
+
"_rxload"
,
mLogLevel
);
mSubSwitch
=
std
::
make_shared
<
DP
::
Ph1
::
Switch
>
(
mName
+
"_switch"
,
mLogLevel
);
...
...
@@ -34,13 +34,12 @@ void DP::Ph1::RXLoadSwitch::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
RXLoadSwitch
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
if
(
!
mParametersSet
)
{
// use powerflow results
mSubRXLoad
->
setParameters
(
mTerminals
[
0
]
->
singleActivePower
(),
mTerminals
[
0
]
->
singleReactivePower
(),
mTerminals
[
0
]
->
singleActivePower
(),
mTerminals
[
0
]
->
singleReactivePower
(),
std
::
abs
(
mTerminals
[
0
]
->
initialSingleVoltage
()));
}
...
...
@@ -120,18 +119,18 @@ void DP::Ph1::RXLoadSwitch::mnaAddPreStepDependencies(AttributeBase::List &prevS
void
DP
::
Ph1
::
RXLoadSwitch
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
mSubRXLoad
->
mnaPreStep
(
time
,
timeStepCount
);
// pre-step of component itself
updateSwitchState
(
time
);
mnaApplyRightSideVectorStamp
(
mRightVector
);
}
void
DP
::
Ph1
::
RXLoadSwitch
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
void
DP
::
Ph1
::
RXLoadSwitch
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
// add post-step dependencies of subcomponents
mSubRXLoad
->
mnaAddPostStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
,
leftVector
);
mSubSwitch
->
mnaAddPostStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
,
leftVector
);
// add post-step dependencies of component itself
attributeDependencies
.
push_back
(
leftVector
);
modifiedAttributes
.
push_back
(
attribute
(
"v_intf"
));
...
...
@@ -142,7 +141,7 @@ void DP::Ph1::RXLoadSwitch::mnaPostStep(Real time, Int timeStepCount, Attribute<
// post-step of subcomponents
this
->
mSubRXLoad
->
mnaPostStep
(
time
,
timeStepCount
,
leftVector
);
this
->
mSubSwitch
->
mnaPostStep
(
time
,
timeStepCount
,
leftVector
);
mIntfVoltage
=
mSubRXLoad
->
attributeMatrixComp
(
"v_intf"
)
->
get
();
mIntfCurrent
=
mSubRXLoad
->
attributeMatrixComp
(
"i_intf"
)
->
get
();
}
...
...
models/Source/DP/DP_Ph1_ResIndSeries.cpp
View file @
d96009fd
...
...
@@ -36,7 +36,6 @@ void DP::Ph1::ResIndSeries::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
ResIndSeries
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Real
omega
=
2.
*
PI
*
frequency
;
Complex
impedance
=
{
0
,
omega
*
mInductance
};
...
...
models/Source/DP/DP_Ph1_Resistor.cpp
View file @
d96009fd
...
...
@@ -30,7 +30,6 @@ void DP::Ph1::Resistor::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
Resistor
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Complex
impedance
=
{
mResistance
,
0
};
mIntfVoltage
(
0
,
0
)
=
initialSingleVoltage
(
1
)
-
initialSingleVoltage
(
0
);
...
...
models/Source/DP/DP_Ph1_RxLine.cpp
View file @
d96009fd
...
...
@@ -30,7 +30,6 @@ SimPowerComp<Complex>::Ptr DP::Ph1::RxLine::clone(String name) {
}
void
DP
::
Ph1
::
RxLine
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
mIntfVoltage
(
0
,
0
)
=
initialSingleVoltage
(
1
)
-
initialSingleVoltage
(
0
);
Complex
impedance
=
{
mSeriesRes
,
mSeriesInd
*
2.
*
PI
*
frequency
};
...
...
models/Source/DP/DP_Ph1_Switch.cpp
View file @
d96009fd
...
...
@@ -28,7 +28,6 @@ SimPowerComp<Complex>::Ptr DP::Ph1::Switch::clone(String name) {
}
void
DP
::
Ph1
::
Switch
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Real
impedance
=
(
mIsClosed
)
?
mClosedResistance
:
mOpenResistance
;
mIntfVoltage
(
0
,
0
)
=
initialSingleVoltage
(
1
)
-
initialSingleVoltage
(
0
);
...
...
@@ -127,10 +126,10 @@ void DP::Ph1::Switch::mnaUpdateCurrent(const Matrix& leftVector) {
mIntfVoltage
(
0
,
0
)
/
mOpenResistance
;
}
void
DP
::
Ph1
::
Switch
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
void
DP
::
Ph1
::
Switch
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
attributeDependencies
.
push_back
(
leftVector
);
modifiedAttributes
.
push_back
(
attribute
(
"v_intf"
));
modifiedAttributes
.
push_back
(
attribute
(
"i_intf"
));
...
...
@@ -139,4 +138,4 @@ void DP::Ph1::Switch::mnaAddPostStepDependencies(AttributeBase::List &prevStepDe
void
DP
::
Ph1
::
Switch
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
mnaUpdateVoltage
(
*
leftVector
);
mnaUpdateCurrent
(
*
leftVector
);
}
\ No newline at end of file
}
models/Source/DP/DP_Ph1_SynchronGeneratorIdeal.cpp
View file @
d96009fd
...
...
@@ -35,7 +35,6 @@ void DP::Ph1::SynchronGeneratorIdeal::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
SynchronGeneratorIdeal
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
// maybe not necessary because voltage source is also set up from powerflow
mVoltageRef
=
initialSingleVoltage
(
0
);
...
...
models/Source/DP/DP_Ph1_SynchronGeneratorTrStab.cpp
View file @
d96009fd
...
...
@@ -105,7 +105,6 @@ void DP::Ph1::SynchronGeneratorTrStab::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
SynchronGeneratorTrStab
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
// Initialize omega mech with nominal system frequency
mOmMech
=
mNomOmega
;
...
...
models/Source/DP/DP_Ph1_Transformer.cpp
View file @
d96009fd
...
...
@@ -52,7 +52,6 @@ void DP::Ph1::Transformer::initialize(Matrix frequencies) {
}
void
DP
::
Ph1
::
Transformer
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
// Component parameters are referred to high voltage side.
// Switch terminals if transformer is connected the other way around.
...
...
@@ -125,13 +124,13 @@ void DP::Ph1::Transformer::mnaInitialize(Real omega, Real timeStep, Attribute<Ma
if
(
mSubResistor
)
subComponents
.
push_back
(
mSubResistor
);
for
(
auto
comp
:
subComponents
)
{
comp
->
mnaInitialize
(
omega
,
timeStep
,
leftVector
);
for
(
auto
task
:
comp
->
mnaTasks
())
mMnaTasks
.
push_back
(
task
);
}
mMnaTasks
.
push_back
(
std
::
make_shared
<
MnaPreStep
>
(
*
this
));
...
...
@@ -190,7 +189,7 @@ void DP::Ph1::Transformer::mnaAddPreStepDependencies(AttributeBase::List &prevSt
modifiedAttributes
.
push_back
(
this
->
attribute
(
"right_vector"
));
}
void
DP
::
Ph1
::
Transformer
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
void
DP
::
Ph1
::
Transformer
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
// pre-step of subcomponents
this
->
mSubInductor
->
mnaPreStep
(
time
,
timeStepCount
);
// pre-step of component itself
...
...
models/Source/DP/DP_Ph3_Capacitor.cpp
View file @
d96009fd
...
...
@@ -31,7 +31,6 @@ SimPowerComp<Complex>::Ptr DP::Ph3::Capacitor::clone(String name) {
}
void
DP
::
Ph3
::
Capacitor
::
initializeFromPowerflow
(
Real
frequency
)
{
checkForUnconnectedTerminals
();
Real
omega
=
2
*
PI
*
frequency
;
MatrixComp
susceptance
=
Matrix
::
Zero
(
3
,
3
);
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment