1#include <dpsim-models/Definitions.h>
2#include <dpsim-models/Logger.h>
5#include <dpsim-models/Base/Base_ReducedOrderSynchronGenerator.h>
6#include <dpsim-models/DP/DP_Ph1_SynchronGenerator4OrderPCM.h>
7#include <dpsim-models/DP/DP_Ph1_SynchronGenerator4OrderTPM.h>
8#include <dpsim-models/DP/DP_Ph1_SynchronGenerator6OrderPCM.h>
17 virtual std::shared_ptr<BaseClass>
18 Create(
const std::string &name,
19 CPS::Logger::Level logLevel = CPS::Logger::Level::debug) = 0;
22template <
class DerivedClass,
class BaseClass>
26 std::shared_ptr<BaseClass>
27 Create(
const std::string &name,
28 CPS::Logger::Level logLevel = CPS::Logger::Level::debug) {
29 return std::shared_ptr<BaseClass>(
new DerivedClass(name, logLevel));
33template <
class BaseClass>
class Factory {
35 static Factory &get() {
36 static Factory instance;
40 std::vector<std::string> getItems() {
42 std::vector<std::string> items;
43 for (
auto g : functionMap) {
44 items.push_back(g.first);
50 std::shared_ptr<BaseClass>
51 create(std::string type,
const std::string &name,
52 CPS::Logger::Level logLevel = CPS::Logger::Level::debug) {
54 auto it = functionMap.find(type);
55 if (it != functionMap.end())
56 return it->second->Create(name, logLevel);
63 functionMap[type] = Fn;
68 Factory(
const Factory &);
70 auto i = functionMap.begin();
71 while (i != functionMap.end()) {
77 std::map<std::string, Creator<BaseClass> *> functionMap;
80template <
class BaseClass>
class FactoryRegistration {
83 Factory<BaseClass>::get().registerExciter(type, Fn);
87namespace SynchronGeneratorFactory {
90void registerSynchronGenerators() {
116void registerSynchronGenerators() {
117 FactoryRegistration<CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>
119 "4PCM",
new DerivedCreator<
120 CPS::DP::Ph1::SynchronGenerator4OrderPCM,
121 CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>);
122 FactoryRegistration<CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>
125 CPS::DP::Ph1::SynchronGenerator4OrderTPM,
126 CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>);
127 FactoryRegistration<CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>
129 "6PCM",
new DerivedCreator<
130 CPS::DP::Ph1::SynchronGenerator6OrderPCM,
131 CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>);
Base class for SP VBR synchronous generator model single phase.
Voltage-Behind-Reactance (VBR) implementation of 3rd order synchronous generator model.
Voltage-Behind-Reactance (VBR) implementation of 4th order synchronous generator model.
Voltage-Behind-Reactance (VBR) implementation of 5th type 2 order synchronous generator model Ref: Mi...
Voltage-Behind-Reactance (VBR) implementation of 6th order synchronous generator model Marconato's mo...
Voltage-Behind-Reactance (VBR) implementation of 6th order synchronous generator model Anderson-Fouad...