Skip to content

Commit

Permalink
Merge pull request #213 from cuihantao/develop
Browse files Browse the repository at this point in the history
bug fixes for cached model internals.
  • Loading branch information
cuihantao committed Oct 26, 2021
2 parents b7538dc + 637e446 commit 257b324
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 515 deletions.
3 changes: 3 additions & 0 deletions andes/core/model.py
Expand Up @@ -79,6 +79,9 @@ def refresh(self, name=None):
----------
name : str, list, optional
name or list of cached to refresh, by default None for refreshing all
TODO: bug found in Example notebook 2. Time domain initialization fails
after refreshing.
"""
if name is None:
for name in self._callbacks.keys():
Expand Down
6 changes: 6 additions & 0 deletions andes/system.py
Expand Up @@ -710,6 +710,12 @@ def store_adder_setter(self, models):
if not mdl.n:
continue

# Fixes an issue if the cache was manually built but stale
# after assigning addresses for simulation
# Assigning memory will affect the cache of `v_adders` and `e_adders`.

mdl.cache.refresh()

# ``getters` that retrieve variable values from DAE
for var in mdl.cache.v_getters.values():
self._getters[var.v_code].append(var)
Expand Down

0 comments on commit 257b324

Please sign in to comment.