Skip to content

Commit

Permalink
Let TDS.run() take the argument from_csv. Can still pass csv thro…
Browse files Browse the repository at this point in the history
…ugh CLI.
  • Loading branch information
cuihantao committed Apr 3, 2024
1 parent 0496b55 commit e562fbd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions andes/routines/tds.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(self, system=None, config=None):
self.config.kqrt = system.options.get('kqrt')

# if data is from a CSV file instead of simulation
self.from_csv = system.options.get('from_csv')
self.from_csv = None
self.data_csv = None
self.k_csv = 0 # row number

Expand Down Expand Up @@ -323,7 +323,7 @@ def init_resume(self):
logger.debug("Resuming simulation: initial step size is h=%.4fs.", self.h)
logger.debug("Resuming from t=%.4fs.", system.dae.t)

def run(self, no_summary=False, **kwargs):
def run(self, no_summary=False, from_csv=None, **kwargs):
"""
Run time-domain simulation using numerical integration.
Expand All @@ -342,6 +342,10 @@ def run(self, no_summary=False, **kwargs):
return succeed

# load from csv is provided
if from_csv is not None:
self.from_csv = from_csv
else:
self.from_csv = system.options.get("from_csv")
if self.from_csv is not None:
self.data_csv = self._load_csv(self.from_csv)

Expand Down Expand Up @@ -813,7 +817,7 @@ def do_switch(self):

# check system connectivity after a switching
if ret is True and self.config.check_conn == 1:
system.connectivity(info=False)
system.connectivity(info=False, routine='tds')

return ret

Expand Down

0 comments on commit e562fbd

Please sign in to comment.