Commit 2718bc9c authored by Markus Mirz's avatar Markus Mirz

Merge branch 'fix-shmem-direct' into 'master'

Fix shmem direct

See merge request !59
parents f5249878 d0ce686d
......@@ -312,6 +312,13 @@ namespace Flags {
};
return Attribute<Real>::make(set, get, mFlags, shared_from_this());
}
ComplexAttribute::Ptr scale(Complex factor) {
ComplexAttribute::Getter get = [this, factor]() -> Complex {
return factor*this->getByValue();
};
return std::make_shared<ComplexAttribute>(get, mFlags, shared_from_this());
}
};
template<typename T>
......
......@@ -142,7 +142,9 @@ namespace CPS {
Bool terminalNotGrounded(UInt index) { return !mSimNodeIsGround[index]; }
// #### Setters ####
void setIntfCurrent(MatrixVar<VarType> current) { mIntfCurrent = current; }
///
void setIntfVoltage(MatrixVar<VarType> voltage) { mIntfVoltage = voltage; }
///
void setVirtualNodeNumber(UInt num);
/// Sets the virtual node at index nodeNum.
......
......@@ -50,7 +50,9 @@ PowerComponent<Complex>::Ptr DP::Ph1::CurrentSource::clone(String name) {
void DP::Ph1::CurrentSource::initializeFromPowerflow(Real frequency) {
checkForUnconnectedTerminals();
mIntfVoltage(0,0) = initialSingleVoltage(1) - initialSingleVoltage(0);
mIntfVoltage(0,0) = initialSingleVoltage(0) - initialSingleVoltage(1);
mCurrentRef = attribute<Complex>("I_ref");
mIntfCurrent(0,0) = mCurrentRef->get();
mSLog->info(
"\n--- Initialization from powerflow ---"
......@@ -94,6 +96,7 @@ void DP::Ph1::CurrentSource::MnaPostStep::execute(Real time, Int timeStepCount)
}
void DP::Ph1::CurrentSource::mnaUpdateVoltage(const Matrix& leftVector) {
mIntfVoltage(0,0) = 0;
if (terminalNotGrounded(0))
mIntfVoltage(0,0) = Math::complexFromVectorElement(leftVector, simNode(0));
if (terminalNotGrounded(1))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment