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

Example for TDS save and load #328

Closed jinningwang closed 2 years ago

jinningwang commented 2 years ago

Add an example for TDS save and load

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

jinningwang commented 2 years ago

Hi Hantao,

I prepared an example to demonstrate the TDS results save and load. However, I'm not sure how I realized it is the way you desired. Further, I suggest setting a return handle of TDS.plt.export_csv(). Maybe the output file name can be a good choice. Another question is that I failed to follow the new feature "Plot tool works with in-memory time-series data specified by Output.", is there any clue to plot Output results?

Regards, Jinning

codecov[bot] commented 2 years ago

Codecov Report

Merging #328 (a4bafb1) into develop (62253ba) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop     #328   +/-   ##
========================================
  Coverage    77.81%   77.81%           
========================================
  Files          169      169           
  Lines        14058    14058           
========================================
  Hits         10939    10939           
  Misses        3119     3119           

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 62253ba...a4bafb1. Read the comment docs.

cuihantao commented 2 years ago

Thanks for putting it up!

Plot tool works with in-memory time-series data specified by Output

This is about the model `Outputfor selecting the specific models and variables for specific devices to save. When Output is used, the indices of the stored variables will change. Plot has been updated to work with systems that include Output.

cuihantao commented 2 years ago

Jining, most of the notebook you provided can be integrated into ex1: Simulate and Plot.

Also, your use of from_csv is very creative, but it's not meant to be used in this way. from_csv was added when Qiwei needed to stream custom data. What it does is use the data provided by the CSV file as mock simulation data.

Data from the CSV will be processed identically to actual simulation data for processing. In a recent version, if ss.TDS.config.limit_store = 1, the size of the time series will be limited. In this scenario, if data loaded from the CSV exceeds a certain size, the in-memory data will be a subset of the CSV data. Plotting will then be incomplete.

Also, if one uses Output, reading from the CSV will error outright.

What actually needs to be done is to use the andes.plot.TDSData class for reading from an npz file and plotting the data.

jinningwang commented 2 years ago

Thanks, let me find the right way to do it.

cuihantao commented 2 years ago

Closing this PR due to inactivity.