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
cb5b1297
Commit
cb5b1297
authored
Oct 21, 2020
by
Jan Dinkelbach
Committed by
Markus Mirz
Nov 21, 2020
Browse files
refactor mna tasks of voltage source, controlled voltage source and transformer in em3ph
parent
27afe5f7
Changes
9
Hide whitespace changes
Inline
Side-by-side
models/Include/cps/DP/DP_Ph1_Transformer.h
View file @
cb5b1297
...
...
@@ -62,11 +62,13 @@ namespace Ph1 {
void
mnaUpdateCurrent
(
const
Matrix
&
leftVector
);
/// Updates internal voltage variable of the component
void
mnaUpdateVoltage
(
const
Matrix
&
leftVector
);
/// MNA pre
and post
step operations
/// MNA pre step operations
void
mnaPreStep
(
Real
time
,
Int
timeStepCount
);
/// MNA post step operations
void
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
///
a
dd MNA pre
and post
step dependencies
///
A
dd MNA pre step dependencies
void
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
);
/// Add MNA post step dependencies
void
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
class
MnaPreStep
:
public
Task
{
...
...
models/Include/cps/EMT/EMT_Ph3_ControlledVoltageSource.h
View file @
cb5b1297
...
...
@@ -28,7 +28,7 @@ namespace CPS {
ControlledVoltageSource
(
String
name
,
Logger
::
Level
logLevel
=
Logger
::
Level
::
off
)
:
ControlledVoltageSource
(
name
,
name
,
logLevel
)
{
}
void
setParameters
(
Matrix
voltageRefABC
);
void
setParameters
(
const
Matrix
&
voltageRefABC
);
SimPowerComp
<
Real
>::
Ptr
clone
(
String
name
);
// #### General ####
...
...
@@ -44,32 +44,34 @@ namespace CPS {
void
mnaApplyRightSideVectorStamp
(
Matrix
&
rightVector
);
/// Returns current through the component
void
mnaUpdateCurrent
(
const
Matrix
&
leftVector
);
/// MNA pre step operations
void
mnaPreStep
(
Real
time
,
Int
timeStepCount
);
/// MNA post step operations
void
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
/// Add MNA pre step dependencies
void
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
);
/// Add MNA post step dependencies
void
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
class
MnaPreStep
:
public
CPS
::
Task
{
class
MnaPreStep
:
public
Task
{
public:
MnaPreStep
(
ControlledVoltageSource
&
ControlledVoltageSource
)
:
Task
(
ControlledVoltageSource
.
mName
+
".MnaPreStep"
),
mControlledVoltageSource
(
ControlledVoltageSource
)
{
mAttributeDependencies
.
push_back
(
ControlledVoltageSource
.
attribute
(
"v_intf"
));
mModifiedAttributes
.
push_back
(
mControlledVoltageSource
.
attribute
(
"right_vector"
));
}
void
execute
(
Real
time
,
Int
timeStepCount
);
MnaPreStep
(
ControlledVoltageSource
&
controlledVoltageSource
)
:
Task
(
controlledVoltageSource
.
mName
+
".MnaPreStep"
),
mControlledVoltageSource
(
controlledVoltageSource
)
{
mControlledVoltageSource
.
mnaAddPreStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
);
}
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mControlledVoltageSource
.
mnaPreStep
(
time
,
timeStepCount
);
};
private:
ControlledVoltageSource
&
mControlledVoltageSource
;
};
class
MnaPostStep
:
public
CPS
::
Task
{
class
MnaPostStep
:
public
Task
{
public:
MnaPostStep
(
ControlledVoltageSource
&
ControlledVoltageSource
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
:
Task
(
ControlledVoltageSource
.
mName
+
".MnaPostStep"
),
mControlledVoltageSource
(
ControlledVoltageSource
),
mLeftVector
(
leftVector
)
{
mAttributeDependencies
.
push_back
(
mLeftVector
);
mModifiedAttributes
.
push_back
(
mControlledVoltageSource
.
attribute
(
"i_intf"
));
MnaPostStep
(
ControlledVoltageSource
&
controlledVoltageSource
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
:
Task
(
controlledVoltageSource
.
mName
+
".MnaPostStep"
),
mControlledVoltageSource
(
controlledVoltageSource
),
mLeftVector
(
leftVector
)
{
mControlledVoltageSource
.
mnaAddPostStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
,
mLeftVector
);
}
void
execute
(
Real
time
,
Int
timeStepCount
);
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mControlledVoltageSource
.
mnaPostStep
(
time
,
timeStepCount
,
mLeftVector
);
};
private:
ControlledVoltageSource
&
mControlledVoltageSource
;
Attribute
<
Matrix
>::
Ptr
mLeftVector
;
...
...
models/Include/cps/EMT/EMT_Ph3_Transformer.h
View file @
cb5b1297
...
...
@@ -62,20 +62,22 @@ namespace CPS {
void
mnaUpdateCurrent
(
const
Matrix
&
leftVector
);
/// Updates internal voltage variable of the component
void
mnaUpdateVoltage
(
const
Matrix
&
leftVector
);
/// MNA pre step operations
void
mnaPreStep
(
Real
time
,
Int
timeStepCount
);
/// MNA post step operations
void
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
/// Add MNA pre step dependencies
void
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
);
/// Add MNA post step dependencies
void
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
class
MnaPreStep
:
public
Task
{
public:
MnaPreStep
(
Transformer
&
transformer
)
:
Task
(
transformer
.
mName
+
".MnaPreStep"
),
mTransformer
(
transformer
)
{
mAttributeDependencies
.
push_back
(
transformer
.
mSubSnubResistor
->
attribute
(
"right_vector"
));
mAttributeDependencies
.
push_back
(
transformer
.
mSubInductor
->
attribute
(
"right_vector"
));
if
(
transformer
.
mSubResistor
)
mAttributeDependencies
.
push_back
(
transformer
.
mSubResistor
->
attribute
(
"right_vector"
));
mModifiedAttributes
.
push_back
(
transformer
.
attribute
(
"right_vector"
));
mTransformer
.
mnaAddPreStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
);
}
void
execute
(
Real
time
,
Int
timeStepCount
);
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mTransformer
.
mnaPreStep
(
time
,
timeStepCount
);
};
private:
Transformer
&
mTransformer
;
};
...
...
@@ -85,13 +87,9 @@ namespace CPS {
public:
MnaPostStep
(
Transformer
&
transformer
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
:
Task
(
transformer
.
mName
+
".MnaPostStep"
),
mTransformer
(
transformer
),
mLeftVector
(
leftVector
)
{
mAttributeDependencies
.
push_back
(
transformer
.
mSubInductor
->
attribute
(
"i_intf"
));
mAttributeDependencies
.
push_back
(
leftVector
);
mModifiedAttributes
.
push_back
(
transformer
.
attribute
(
"i_intf"
));
mModifiedAttributes
.
push_back
(
transformer
.
attribute
(
"v_intf"
));
mTransformer
.
mnaAddPostStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
,
mLeftVector
);
}
void
execute
(
Real
time
,
Int
timeStepCount
);
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mTransformer
.
mnaPostStep
(
time
,
timeStepCount
,
mLeftVector
);
};
private:
Transformer
&
mTransformer
;
...
...
models/Include/cps/EMT/EMT_Ph3_VoltageSource.h
View file @
cb5b1297
...
...
@@ -30,7 +30,9 @@ namespace CPS {
void
updateVoltage
(
Real
time
);
void
updateVoltage
(
Matrix
vabc
);
/// Magnitude of the sinusoidal voltage (peak-value, phase-to-ground)
Attribute
<
Complex
>::
Ptr
mVoltageRef
;
/// Frequency of the sinusoidal voltage
Attribute
<
Real
>::
Ptr
mSrcFreq
;
public:
/// Defines UID, name and logging level
...
...
@@ -55,33 +57,34 @@ namespace CPS {
void
mnaApplyRightSideVectorStamp
(
Matrix
&
rightVector
);
/// Returns current through the component
void
mnaUpdateCurrent
(
const
Matrix
&
leftVector
);
/// MNA pre step operations
void
mnaPreStep
(
Real
time
,
Int
timeStepCount
);
/// MNA post step operations
void
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
/// Add MNA pre step dependencies
void
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
);
/// Add MNA post step dependencies
void
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
);
class
MnaPreStep
:
public
CPS
::
Task
{
class
MnaPreStep
:
public
Task
{
public:
MnaPreStep
(
VoltageSource
&
voltageSource
)
:
Task
(
voltageSource
.
mName
+
".MnaPreStep"
),
mVoltageSource
(
voltageSource
)
{
mAttributeDependencies
.
push_back
(
voltageSource
.
attribute
(
"V_ref"
));
mModifiedAttributes
.
push_back
(
mVoltageSource
.
attribute
(
"right_vector"
));
mModifiedAttributes
.
push_back
(
mVoltageSource
.
attribute
(
"v_intf"
));
}
void
execute
(
Real
time
,
Int
timeStepCount
);
mVoltageSource
.
mnaAddPreStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
);
}
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mVoltageSource
.
mnaPreStep
(
time
,
timeStepCount
);
};
private:
VoltageSource
&
mVoltageSource
;
};
class
MnaPostStep
:
public
CPS
::
Task
{
class
MnaPostStep
:
public
Task
{
public:
MnaPostStep
(
VoltageSource
&
voltageSource
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
:
Task
(
voltageSource
.
mName
+
".MnaPostStep"
),
mVoltageSource
(
voltageSource
),
mLeftVector
(
leftVector
)
{
mAttributeDependencies
.
push_back
(
mLeftVector
);
mModifiedAttributes
.
push_back
(
mVoltageSource
.
attribute
(
"i_intf"
));
Task
(
voltageSource
.
mName
+
".MnaPostStep"
),
mVoltageSource
(
voltageSource
),
mLeftVector
(
leftVector
)
{
mVoltageSource
.
mnaAddPostStepDependencies
(
mPrevStepDependencies
,
mAttributeDependencies
,
mModifiedAttributes
,
mLeftVector
);
}
void
execute
(
Real
time
,
Int
timeStepCount
);
void
execute
(
Real
time
,
Int
timeStepCount
)
{
mVoltageSource
.
mnaPostStep
(
time
,
timeStepCount
,
mLeftVector
);
};
private:
VoltageSource
&
mVoltageSource
;
Attribute
<
Matrix
>::
Ptr
mLeftVector
;
...
...
models/Source/EMT/EMT_Ph3_ControlledVoltageSource.cpp
View file @
cb5b1297
...
...
@@ -13,16 +13,17 @@ using namespace CPS;
EMT
::
Ph3
::
ControlledVoltageSource
::
ControlledVoltageSource
(
String
uid
,
String
name
,
Logger
::
Level
logLevel
)
:
SimPowerComp
<
Real
>
(
uid
,
name
,
logLevel
)
{
setVirtualNodeNumber
(
3
);
mPhaseType
=
PhaseType
::
ABC
;
setVirtualNodeNumber
(
1
);
setTerminalNumber
(
2
);
mIntfVoltage
=
Matrix
::
Zero
(
3
,
1
);
mIntfCurrent
=
Matrix
::
Zero
(
3
,
1
);
}
void
EMT
::
Ph3
::
ControlledVoltageSource
::
setParameters
(
Matrix
voltageRefABC
)
{
void
EMT
::
Ph3
::
ControlledVoltageSource
::
setParameters
(
const
Matrix
&
voltageRefABC
)
{
mIntfVoltage
=
voltageRefABC
;
mSLog
->
info
(
"Reference voltage: {:s}"
,
Logger
::
matrixToString
(
mIntfVoltage
));
mParametersSet
=
true
;
}
...
...
@@ -70,13 +71,22 @@ void EMT::Ph3::ControlledVoltageSource::mnaApplyRightSideVectorStamp(Matrix& rig
Math
::
setVectorElement
(
rightVector
,
mVirtualNodes
[
0
]
->
matrixNodeIndex
(
PhaseType
::
C
),
mIntfVoltage
(
2
,
0
));
}
void
EMT
::
Ph3
::
ControlledVoltageSource
::
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
)
{
attributeDependencies
.
push_back
(
attribute
(
"v_intf"
));
modifiedAttributes
.
push_back
(
attribute
(
"right_vector"
));
}
void
EMT
::
Ph3
::
ControlledVoltageSource
::
M
naPreStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mControlledVoltageSource
.
mnaApplyRightSideVectorStamp
(
mControlledVoltageSource
.
mRightVector
);
void
EMT
::
Ph3
::
ControlledVoltageSource
::
m
naPreStep
(
Real
time
,
Int
timeStepCount
)
{
mnaApplyRightSideVectorStamp
(
mRightVector
);
}
void
EMT
::
Ph3
::
ControlledVoltageSource
::
MnaPostStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mControlledVoltageSource
.
mnaUpdateCurrent
(
*
mLeftVector
);
void
EMT
::
Ph3
::
ControlledVoltageSource
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
attributeDependencies
.
push_back
(
leftVector
);
modifiedAttributes
.
push_back
(
attribute
(
"i_intf"
));
};
void
EMT
::
Ph3
::
ControlledVoltageSource
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
mnaUpdateCurrent
(
*
leftVector
);
}
void
EMT
::
Ph3
::
ControlledVoltageSource
::
mnaUpdateCurrent
(
const
Matrix
&
leftVector
)
{
...
...
models/Source/EMT/EMT_Ph3_Inductor.cpp
View file @
cb5b1297
...
...
@@ -192,5 +192,6 @@ void EMT::Ph3::Inductor::mnaUpdateCurrent(const Matrix& leftVector) {
"
\n
Current: {:s}"
,
Logger
::
matrixToString
(
mIntfCurrent
)
);
mSLog
->
flush
();
}
models/Source/EMT/EMT_Ph3_Resistor.cpp
View file @
cb5b1297
...
...
@@ -141,6 +141,7 @@ void EMT::Ph3::Resistor::mnaUpdateVoltage(const Matrix& leftVector) {
"
\n
Voltage: {:s}"
,
Logger
::
matrixToString
(
mIntfVoltage
)
);
mSLog
->
flush
();
}
void
EMT
::
Ph3
::
Resistor
::
mnaUpdateCurrent
(
const
Matrix
&
leftVector
)
{
...
...
@@ -149,4 +150,5 @@ void EMT::Ph3::Resistor::mnaUpdateCurrent(const Matrix& leftVector) {
"
\n
Current: {:s}"
,
Logger
::
matrixToString
(
mIntfCurrent
)
);
mSLog
->
flush
();
}
models/Source/EMT/EMT_Ph3_Transformer.cpp
View file @
cb5b1297
...
...
@@ -41,6 +41,8 @@ void EMT::Ph3::Transformer::setParameters(Real ratioAbs, Real ratioPhase,
Matrix
resistance
,
Matrix
inductance
)
{
Base
::
Ph3
::
Transformer
::
setParameters
(
ratioAbs
,
ratioPhase
,
resistance
,
inductance
);
mSLog
->
info
(
"Resistance={} [Ohm] Inductance={} [Ohm] (referred to primary side)"
,
resistance
,
inductance
);
mSLog
->
info
(
"Tap Ratio={} [ ] Phase Shift={} [deg]"
,
ratioAbs
,
ratioPhase
);
mParametersSet
=
true
;
}
...
...
@@ -65,6 +67,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) {
Complex
(
mResistance
(
0
,
0
),
omega
*
mInductance
(
0
,
0
)),
Complex
(
mResistance
(
0
,
1
),
omega
*
mInductance
(
0
,
1
)),
Complex
(
mResistance
(
0
,
2
),
omega
*
mInductance
(
0
,
2
)),
Complex
(
mResistance
(
1
,
0
),
omega
*
mInductance
(
1
,
0
)),
Complex
(
mResistance
(
1
,
1
),
omega
*
mInductance
(
1
,
1
)),
Complex
(
mResistance
(
1
,
2
),
omega
*
mInductance
(
1
,
2
)),
Complex
(
mResistance
(
2
,
0
),
omega
*
mInductance
(
2
,
0
)),
Complex
(
mResistance
(
2
,
1
),
omega
*
mInductance
(
2
,
1
)),
Complex
(
mResistance
(
2
,
2
),
omega
*
mInductance
(
2
,
2
));
mSLog
->
info
(
"Reactance={} [Ohm] (referred to primary side)"
,
Logger
::
matrixToString
(
omega
*
mInductance
));
MatrixComp
vInitABC
=
MatrixComp
::
Zero
(
3
,
1
);
vInitABC
(
0
,
0
)
=
mVirtualNodes
[
0
]
->
initialSingleVoltage
()
-
RMS3PH_TO_PEAK1PH
*
initialSingleVoltage
(
0
);
...
...
@@ -102,6 +105,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) {
mSubSnubResistor
->
connect
({
node
(
1
),
EMT
::
SimNode
::
GND
});
mSubSnubResistor
->
initialize
(
mFrequencies
);
mSubSnubResistor
->
initializeFromNodesAndTerminals
(
frequency
);
mSLog
->
info
(
"Snubber Resistance={} [Ohm] (connected to LV side)"
,
Logger
::
matrixToString
(
mSnubberResistance
));
mSLog
->
info
(
"
\n
--- Initialization from powerflow ---"
...
...
@@ -115,7 +119,7 @@ void EMT::Ph3::Transformer::initializeFromNodesAndTerminals(Real frequency) {
Logger
::
matrixToString
(
mIntfCurrent
),
Logger
::
phasorToString
(
RMS3PH_TO_PEAK1PH
*
initialSingleVoltage
(
0
)),
Logger
::
phasorToString
(
RMS3PH_TO_PEAK1PH
*
initialSingleVoltage
(
1
)),
Logger
::
phasorToString
(
mVirtualNodes
[
0
]
->
initialSingleVoltage
()));
Logger
::
phasorToString
(
RMS3PH_TO_PEAK1PH
*
mVirtualNodes
[
0
]
->
initialSingleVoltage
()));
}
void
EMT
::
Ph3
::
Transformer
::
mnaInitialize
(
Real
omega
,
Real
timeStep
,
Attribute
<
Matrix
>::
Ptr
leftVector
)
{
...
...
@@ -207,13 +211,43 @@ void EMT::Ph3::Transformer::mnaApplyRightSideVectorStamp(Matrix& rightVector) {
mSubInductor
->
mnaApplyRightSideVectorStamp
(
rightVector
);
}
void
EMT
::
Ph3
::
Transformer
::
MnaPreStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mTransformer
.
mnaApplyRightSideVectorStamp
(
mTransformer
.
mRightVector
);
void
EMT
::
Ph3
::
Transformer
::
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
)
{
// add pre-step dependencies of subcomponents
mSubInductor
->
mnaAddPreStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
);
// add pre-step dependencies of component itself
prevStepDependencies
.
push_back
(
attribute
(
"i_intf"
));
prevStepDependencies
.
push_back
(
attribute
(
"v_intf"
));
modifiedAttributes
.
push_back
(
attribute
(
"right_vector"
));
}
void
EMT
::
Ph3
::
Transformer
::
MnaPostStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mTransformer
.
mnaUpdateVoltage
(
*
mLeftVector
);
mTransformer
.
mnaUpdateCurrent
(
*
mLeftVector
);
void
EMT
::
Ph3
::
Transformer
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
// pre-step of subcomponents
mSubInductor
->
mnaPreStep
(
time
,
timeStepCount
);
// pre-step of component itself
mnaApplyRightSideVectorStamp
(
mRightVector
);
}
void
EMT
::
Ph3
::
Transformer
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
// add post-step dependencies of subcomponents
if
(
mSubResistor
)
mSubResistor
->
mnaAddPostStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
,
leftVector
);
mSubInductor
->
mnaAddPostStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
,
leftVector
);
mSubSnubResistor
->
mnaAddPostStepDependencies
(
prevStepDependencies
,
attributeDependencies
,
modifiedAttributes
,
leftVector
);
// add post-step dependencies of component itself
attributeDependencies
.
push_back
(
leftVector
);
modifiedAttributes
.
push_back
(
attribute
(
"v_intf"
));
modifiedAttributes
.
push_back
(
attribute
(
"i_intf"
));
}
void
EMT
::
Ph3
::
Transformer
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
// post-step of subcomponents
if
(
mSubResistor
)
mSubResistor
->
mnaPostStep
(
time
,
timeStepCount
,
leftVector
);
mSubInductor
->
mnaPostStep
(
time
,
timeStepCount
,
leftVector
);
mSubSnubResistor
->
mnaPostStep
(
time
,
timeStepCount
,
leftVector
);
// post-step of component itself
mnaUpdateVoltage
(
*
leftVector
);
mnaUpdateCurrent
(
*
leftVector
);
}
void
EMT
::
Ph3
::
Transformer
::
mnaUpdateCurrent
(
const
Matrix
&
leftVector
)
{
...
...
models/Source/EMT/EMT_Ph3_VoltageSource.cpp
View file @
cb5b1297
...
...
@@ -11,9 +11,6 @@
using
namespace
CPS
;
// !!! TODO: Adaptions to use in EMT_Ph3 models phase-to-ground peak variables
// !!! with initialization from phase-to-phase RMS variables
EMT
::
Ph3
::
VoltageSource
::
VoltageSource
(
String
uid
,
String
name
,
Logger
::
Level
logLevel
)
:
SimPowerComp
<
Real
>
(
uid
,
name
,
logLevel
)
{
mPhaseType
=
PhaseType
::
ABC
;
...
...
@@ -112,13 +109,24 @@ void EMT::Ph3::VoltageSource::updateVoltage(Matrix vabc) {
mIntfVoltage
=
vabc
;
}
void
EMT
::
Ph3
::
VoltageSource
::
MnaPreStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mVoltageSource
.
updateVoltage
(
time
);
mVoltageSource
.
mnaApplyRightSideVectorStamp
(
mVoltageSource
.
mRightVector
);
void
EMT
::
Ph3
::
VoltageSource
::
mnaAddPreStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
)
{
attributeDependencies
.
push_back
(
attribute
(
"V_ref"
));
modifiedAttributes
.
push_back
(
attribute
(
"right_vector"
));
modifiedAttributes
.
push_back
(
attribute
(
"v_intf"
));
}
void
EMT
::
Ph3
::
VoltageSource
::
mnaPreStep
(
Real
time
,
Int
timeStepCount
)
{
updateVoltage
(
time
);
mnaApplyRightSideVectorStamp
(
mRightVector
);
}
void
EMT
::
Ph3
::
VoltageSource
::
MnaPostStep
::
execute
(
Real
time
,
Int
timeStepCount
)
{
mVoltageSource
.
mnaUpdateCurrent
(
*
mLeftVector
);
void
EMT
::
Ph3
::
VoltageSource
::
mnaAddPostStepDependencies
(
AttributeBase
::
List
&
prevStepDependencies
,
AttributeBase
::
List
&
attributeDependencies
,
AttributeBase
::
List
&
modifiedAttributes
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
attributeDependencies
.
push_back
(
leftVector
);
modifiedAttributes
.
push_back
(
attribute
(
"i_intf"
));
};
void
EMT
::
Ph3
::
VoltageSource
::
mnaPostStep
(
Real
time
,
Int
timeStepCount
,
Attribute
<
Matrix
>::
Ptr
&
leftVector
)
{
mnaUpdateCurrent
(
*
leftVector
);
}
void
EMT
::
Ph3
::
VoltageSource
::
mnaUpdateCurrent
(
const
Matrix
&
leftVector
)
{
...
...
Write
Preview
Markdown
is supported
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