Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implementation of exciter, new turbine governor model and refactor VBR models #120

Merged
merged 8 commits into from
Jan 19, 2023

Conversation

martinmoraga
Copy link
Contributor

@martinmoraga martinmoraga commented Sep 14, 2022

  • fixes implementation of exciter DC1A model
  • adds new turbine governor TGOV1 (Ref: Milano, Power system modelling and scripting p. 358)
  • adds new validation notebook for controllers: SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withControllers.ipynb
  • partially solves points of Refactor VBR models #75
  • enables choice between thevenin and norton representation of VBR models, default is norton now
  • adds reduced order SG models, exciter and turbine governor to dpsimpy

@sonarcloud
Copy link

sonarcloud bot commented Sep 14, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 80 Code Smells

0.0% 0.0% Coverage
7.2% 7.2% Duplication

m-mirz
m-mirz previously approved these changes Oct 13, 2022
@JTS22
Copy link
Contributor

JTS22 commented Dec 15, 2022

@martinmoraga Can you maybe push the pybind-binding code that does not work for you, along with the error message? Normally, you should be able to just bind the abstract base class along with any child classes like this (assuming stepInPerUnit is changed to be public):

	py::class_<CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR, std::shared_ptr<CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR>, CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "BaseSynchronGeneratorReducedOrder", py::multiple_inheritance())
		.def("set_modelling_approach", &CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR::setModellingApproach)
		.def("step_in_per_unit", &CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR::stepInPerUnit);

	py::class_<CPS::DP::Ph1::SynchronGenerator3OrderVBR, std::shared_ptr<CPS::DP::Ph1::SynchronGenerator3OrderVBR>, CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR>(mDPPh1, "SynchronGenerator3OrderVBR", py::multiple_inheritance())
		.def(py::init<std::string>());

The base class is then non-constructible in Python but because Python only handles the shared pointers, methods can still take and return instances of the base class.
For a more comprehensive example, you can check the bindings in dpsim/src/pybind/Attributes.cpp where both AttributeBase and Attribute<T> are abstract classes that are bound to Python.

Signed-off-by: Jan Dinkelbach <[email protected]>
@sonarcloud
Copy link

sonarcloud bot commented Jan 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 42 Code Smells

0.0% 0.0% Coverage
4.9% 4.9% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants