DPsim
Loading...
Searching...
No Matches
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
16namespace CPS {
17namespace EMT {
18namespace Ph3 {
21 public SharedFactory<SynchronGeneratorIdeal> {
22private:
24 CPS::GeneratorType mSourceType;
27 std::shared_ptr<EMT::Ph3::VoltageSource> mSubVoltageSource;
29 std::shared_ptr<EMT::Ph3::CurrentSource> mSubCurrentSource;
30
31public:
33 const Attribute<MatrixComp>::Ptr mRefVoltage;
34
37 String uid, String name, Logger::Level logLevel = Logger::Level::off,
38 CPS::GeneratorType sourceType = CPS::GeneratorType::IdealVoltageSource);
40 SynchronGeneratorIdeal(String name,
41 Logger::Level logLevel = Logger::Level::off);
42
43 SimPowerComp<Real>::Ptr clone(String name) override;
44
45 // #### General ####
47 void createSubComponents() override;
49 void initializeParentFromNodesAndTerminals(Real frequency) override;
50
51 // #### MNA section ####
53 void mnaParentPreStep(Real time, Int timeStepCount) override;
55 void mnaParentPostStep(Real time, Int timeStepCount,
56 Attribute<Matrix>::Ptr &leftVector) override;
59 AttributeBase::List &prevStepDependencies,
60 AttributeBase::List &attributeDependencies,
61 AttributeBase::List &modifiedAttributes) override;
63 void
64 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
65 AttributeBase::List &attributeDependencies,
66 AttributeBase::List &modifiedAttributes,
67 Attribute<Matrix>::Ptr &leftVector) override;
69 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
71 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
72};
73} // namespace Ph3
74} // namespace EMT
75} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
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 createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
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 initializeParentFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
String uid()
Returns unique id.