DPsim
EMT_Ph3_SynchronGeneratorIdeal.h
1 /* Copyright 2017-2020 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #pragma once
10 
11 #include <dpsim-models/CompositePowerComp.h>
12 #include <dpsim-models/EMT/EMT_Ph3_CurrentSource.h>
13 #include <dpsim-models/EMT/EMT_Ph3_VoltageSource.h>
14 #include <dpsim-models/Solver/MNAInterface.h>
15 
16 namespace CPS {
17 namespace EMT {
18 namespace Ph3 {
21  public SharedFactory<SynchronGeneratorIdeal> {
22 private:
24  CPS::GeneratorType mSourceType;
26  std::shared_ptr<EMT::Ph3::VoltageSource> mSubVoltageSource;
28  std::shared_ptr<EMT::Ph3::CurrentSource> mSubCurrentSource;
29 
30 public:
33 
36  String uid, String name, Logger::Level logLevel = Logger::Level::off,
37  CPS::GeneratorType sourceType = CPS::GeneratorType::IdealVoltageSource);
39  SynchronGeneratorIdeal(String name,
40  Logger::Level logLevel = Logger::Level::off);
41 
42  SimPowerComp<Real>::Ptr clone(String name) override;
43 
44  // #### General ####
46  void initializeFromNodesAndTerminals(Real frequency) override;
47 
48  // #### MNA section ####
50  void mnaParentPreStep(Real time, Int timeStepCount) override;
52  void mnaParentPostStep(Real time, Int timeStepCount,
53  Attribute<Matrix>::Ptr &leftVector) override;
56  AttributeBase::List &prevStepDependencies,
57  AttributeBase::List &attributeDependencies,
58  AttributeBase::List &modifiedAttributes) override;
60  void
61  mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
62  AttributeBase::List &attributeDependencies,
63  AttributeBase::List &modifiedAttributes,
64  Attribute<Matrix>::Ptr &leftVector) override;
66  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
68  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
69 };
70 } // namespace Ph3
71 } // namespace EMT
72 } // namespace CPS
Base class for composite power components.
Ideal voltage source representing a synchronous generator.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates current through the component.
SimPowerComp< Real >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
const Attribute< MatrixComp >::Ptr mRefVoltage
CHECK: Is this actually necessary? It is never read from within the component's code.
SynchronGeneratorIdeal(String uid, String name, Logger::Level logLevel=Logger::Level::off, CPS::GeneratorType sourceType=CPS::GeneratorType::IdealVoltageSource)
Defines UID, name, component parameters and logging level.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates voltage across component.
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
String uid()
Returns unique id.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17