CURENT / andes

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

Fix GAST #319

Closed jinningwang closed 2 years ago

jinningwang commented 2 years ago

Fix GAST initialization error: set the adjust_lower=True in the model.

codecov[bot] commented 2 years ago

Codecov Report

Merging #319 (70a8f14) into develop (2db90ea) will increase coverage by 0.23%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #319      +/-   ##
===========================================
+ Coverage    77.80%   78.04%   +0.23%     
===========================================
  Files          171      166       -5     
  Lines        13938    13844      -94     
===========================================
- Hits         10845    10804      -41     
+ Misses        3093     3040      -53     
Impacted Files Coverage Δ
andes/models/governor/gast.py 100.00% <100.00%> (ø)
tests/test_case.py 100.00% <0.00%> (ø)
andes/core/discrete.py 75.76% <0.00%> (ø)
andes/models/__init__.py 100.00% <0.00%> (ø)
andes/models/renewable/reeca1.py 100.00% <0.00%> (ø)
andes/models/experimental/fixed.py
andes/models/experimental/__init__.py
andes/models/experimental/picontroller.py
andes/models/experimental/testmodel.py
andes/models/experimental/genrouos.py
... and 3 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 2db90ea...70a8f14. Read the comment docs.

cuihantao commented 2 years ago

I might hold on a bit. The default option (in Powerworld and ANDES) for all is NOT to adjust the lower limit unless enabled by the user. The PR can fix this issue but introduces confusion on which lower limit has been automatically adjusted and which has not.

We want to stay consistent in the treatment of the limits while properly warning the users of issues. The limit adjustment logic in an AW

https://github.com/cuihantao/andes/blob/cfac3a7b4f974f9369c3a5d9076391f245966890/andes/core/discrete.py#L765-L783

needs to be updated to that in a Limiter:

https://github.com/cuihantao/andes/blob/cfac3a7b4f974f9369c3a5d9076391f245966890/andes/core/discrete.py#L458-L480

where if self.allow_adjust == True and is_init == True, self.do_adjust_upper will be called. It is up to self.do_adjust_upper to only print out warnings or adjust the limit, based on allow_adjust and adjust_upper.

cuihantao commented 2 years ago

I will work on the fix.

cuihantao commented 2 years ago

There is also an issue with the PSS/E parser for GAST. The sequence of inputs is not the same as PSS/E's.

https://github.com/cuihantao/andes/blob/cfac3a7b4f974f9369c3a5d9076391f245966890/andes/io/psse-dyr.yaml#L750-L762

image

sonarcloud[bot] commented 2 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 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

cuihantao commented 2 years ago

Thanks @jinningwang. It has been fixed in my develop branch. If you don't mind, I will close this issue for now.