CURENT / andes

Python toolbox / library for power system transient dynamics simulation with symbolic modeling and numerical analysis 🔥
https://ltb.curent.org
Other
226 stars 111 forks source link

Model `DGPRCT` (Previously named `PLK2`) #161

Closed jinningwang closed 3 years ago

jinningwang commented 3 years ago

This is an early version of PLK2. The multi-level frequency and voltage tripping points are added. The improvements of the model remain to be finished.

codecov[bot] commented 3 years ago

Codecov Report

Merging #161 (e4c050d) into develop (fac2aa0) will increase coverage by 0.12%. The diff coverage is 100.00%.

:exclamation: Current head e4c050d differs from pull request most recent head efb9034. Consider uploading reports for the commit efb9034 to get more accurate results Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #161      +/-   ##
===========================================
+ Coverage    82.29%   82.42%   +0.12%     
===========================================
  Files          106      106              
  Lines        11638    11712      +74     
===========================================
+ Hits          9578     9654      +76     
+ Misses        2060     2058       -2     
Impacted Files Coverage Δ
andes/models/__init__.py 100.00% <ø> (ø)
andes/core/block.py 83.78% <100.00%> (+0.03%) :arrow_up:
andes/core/discrete.py 82.24% <100.00%> (+0.03%) :arrow_up:
andes/core/model.py 80.83% <100.00%> (+0.10%) :arrow_up:
andes/models/distributed/__init__.py 100.00% <100.00%> (ø)
andes/models/distributed/dgprct.py 100.00% <100.00%> (ø)
andes/models/distributed/pvd1.py 99.13% <100.00%> (+<0.01%) :arrow_up:
andes/routines/tds.py 66.16% <0.00%> (-0.51%) :arrow_down:
tests/test_case.py 100.00% <0.00%> (ø)
andes/models/vsc.py 100.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fac2aa0...efb9034. Read the comment docs.

cuihantao commented 3 years ago

What's next for this PR? @jinningwang

jinningwang commented 3 years ago

What's next for this PR? @jinningwang

Oh, I plan to give an early version PLK2. It can lock the f, Psum, and Qsum (these three are Algebs). Accordingly, Qsum of PVD1 is separated into two parts.

jinningwang commented 3 years ago

Early version PLK2

It can lock the f, Psum, and Qsum (these three are Algebs). Accordingly, Qsum in PVD1 is separated into two Algebs. Also, redundant variables Pe and Qe in PVD1 are removed for efficiency.

TODO: clear State when lock flag is raised.

cuihantao commented 3 years ago

Sounds good. You can leave it open and keep pushing to the branch. Let me know if it's feature ready.

jinningwang commented 3 years ago

Sounds good. You can leave it open and keep pushing to the branch. Let me know if it's feature ready.

Sure, thanks for your guidance.

Also, since the PLK1 is not good written, maybe we can discard it in the future? (Like EV2 and EV1 can be combined as EV1).

cuihantao commented 3 years ago

We can mark it as deprecated in the future to allow time for transition. Since it’s not widely used, it can be removed after a couple of releases.

Regards, Hantao Cui On Aug 24, 2021, 10:42 AM -0500, Jinning Wang @.***>, wrote:

Sounds good. You can leave it open and keep pushing to the branch. Let me know if it's feature ready. Sure, thanks for your guidance. Also, since the PVD1 is not good written, maybe we can discard it in the future? (Like EV2 and EV1 can be combined as EV1). — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

jinningwang commented 3 years ago

We can mark it as deprecated in the future to allow time for transition. Since it’s not widely used, it can be removed after a couple of releases. Regards, Hantao Cui …

Got it, thanks!

Regards, Jinning

jinningwang commented 3 years ago

DGPRCT Model

Refactored PLK as DGPRCT Base, 1, and Ext.

@cuihantao The new DGPRCT1 model cannot be compiled by andes prepare. It should that cannot find self.v. This may be caused by inherited issues, but I failed to fix them. Would you mind take a look at DGPRCT1 init statement?

Regards, Jinning

cuihantao commented 3 years ago

Jinning,

Thanks for the code!! The trick to fix the reference to self.v is to further separate DGPRCTModelBase into classes that do not depend on self.v and sections that do. Look into DGPRCT1Model for how they are organized.

Currently, dgprct.py has duplicated code from plk2.py. I guess you will consolidate the two before merging.

jinningwang commented 3 years ago

Jinning,

Thanks for the code!! The trick to fix the reference to self.v is to further separate DGPRCTModelBase into classes that do not depend on self.v and sections that do. Look into DGPRCT1Model for how they are organized.

Currently, dgprct.py has duplicated code from plk2.py. I guess you will consolidate the two before merging.

Thanks for restructuring the code, I'll take care of the consolidation.

Regards, Jinning

jinningwang commented 3 years ago

Removed PLK

Models PLK1 and PLK2 are removed, but the tests for DGPRCT haven't been finished.

jinningwang commented 3 years ago

DGPRCT Error

Set DGPRCT fflag=0 will lead to simulation crash. Note: fflag=1 means do not lock the frequency source signal, whereas 0 means lock the source signal.

jinningwang commented 3 years ago

No bug but misunderstanding (Bug with ExtendedEvent)

It turned out to be a misunderstanding. ExtendedEvent works well.


@cuihantao ExtendedEvent did not work as expected, I'm trying to figure out the code logic and fix it.

I want to use it to monitor the ue drop back to 0 from 1, but its output does not follow the description.

cuihantao commented 3 years ago

@jinningwang

Thanks. It was working in REECA1 in my last testing, but it was a year ago.

jinningwang commented 3 years ago

Ready-to-use version

The model is considered ready-to-use.

cuihantao commented 3 years ago

Thanks for taking care of the no_warn argument for AntiWindup.

cuihantao commented 3 years ago

@jinningwang Would you like to include the test case files?

jinningwang commented 3 years ago

@jinningwang Would you like to include the test case files?

Added input files and demonstration notebook.

Hope it helps.

Regards, Jinning

sonarcloud[bot] commented 3 years ago

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 24 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

jinningwang commented 3 years ago

@cuihantao Hi Hantao,

I added a notebook file for DGPRCTExt, shall we reopen this to merge them?

Regards, Jinning

cuihantao commented 3 years ago

You can make a new PR.

Regards, Hantao Cui On Sep 2, 2021, 3:54 PM -0500, Jinning Wang @.***>, wrote:

@cuihantao Hi Hantao, I added a notebook file for DGPRCTExt, shall we reopen this to merge them? Regards, Jinning — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.