Skip to content

Commit

Permalink
Merge pull request #475 from CURENT/develop
Browse files Browse the repository at this point in the history
New minor release
  • Loading branch information
cuihantao committed Aug 11, 2023
2 parents d20c689 + 9c8f6ed commit 6203731
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion andes/core/discrete.py
Expand Up @@ -111,7 +111,7 @@ def get_tex_names(self):
A list of tex_names for all exported flags.
"""

return [rf'{flag_tex}^{self.tex_name}' for flag_tex in self.export_flags_tex]
return [rf'{flag_tex}^{{{self.tex_name}}}' for flag_tex in self.export_flags_tex]

def get_values(self):
return [self.__dict__[flag] for flag in self.export_flags]
Expand Down
2 changes: 2 additions & 0 deletions andes/core/model/modeldata.py
Expand Up @@ -176,6 +176,8 @@ def as_dict(self, vin=False):
An additional `uid` key is added with the value default to range(n).
"""
out = dict()

# append 0-indexed `uid`
out['uid'] = np.arange(self.n)

for name, instance in self.params.items():
Expand Down
2 changes: 1 addition & 1 deletion andes/core/param.py
Expand Up @@ -177,7 +177,7 @@ def _sanitize(self, value):
# check for mandatory
if value is None:
if self.get_property('mandatory'):
raise ValueError(f'Mandatory parameter {self.name} for {self.owner.class_name} missing')
raise ValueError(f'Mandatory parameter {self.owner.class_name}.{self.name} is missing')
else:
value = self.default

Expand Down
3 changes: 2 additions & 1 deletion andes/core/symprocessor.py
Expand Up @@ -112,9 +112,10 @@ def generate_symbols(self):
# -----------------------------------------------------------
for key in self.parent.tex_names.keys():
self.tex_names[key] = sp.Symbol(self.parent.tex_names[key])

for instance in self.parent.discrete.values():
for name, tex_name in zip(instance.get_names(), instance.get_tex_names()):
self.tex_names[name] = tex_name
self.tex_names[name] = sp.Symbol(tex_name)
# -----------------------------------------------------------

for var in self.cache.all_params_names:
Expand Down
2 changes: 1 addition & 1 deletion andes/io/xlsx.py
Expand Up @@ -103,7 +103,7 @@ def read(system, infile):
"""
df_models = pd.read_excel(infile,
sheet_name=None,
index_col=0,
index_col=None,
engine='openpyxl',
)

Expand Down
2 changes: 1 addition & 1 deletion andes/routines/tds.py
Expand Up @@ -84,7 +84,7 @@ def __init__(self, system=None, config=None):
store_i='store RHS of external algeb. equations',
limit_store='limit in-memory timeseries storage',
max_store='maximum steps of data stored in memory before offloading',
save_every='save results for one step every "save_every" steps',
save_every='save one step to memory every N simulation steps',
save_mode='automatically or manually save output data when done',
no_tqdm='disable tqdm progressbar and outputs',
chatter_iter='minimum iterations to detect chattering',
Expand Down
8 changes: 8 additions & 0 deletions andes/system.py
Expand Up @@ -549,6 +549,9 @@ def add(self, model, param_dict=None, **kwargs):
if kwargs is not None:
param_dict.update(kwargs)

# remove `uid` field
param_dict.pop('uid', None)

idx = param_dict.pop('idx', None)
if idx is not None and (not isinstance(idx, str) and np.isnan(idx)):
idx = None
Expand Down Expand Up @@ -1221,6 +1224,11 @@ def connectivity(self, info=True):
to.extend(self.Line.a2.a.tolist())
u.extend(self.Line.u.v.tolist())

# collect from Jumper
fr.extend(self.Jumper.a1.a.tolist())
to.extend(self.Jumper.a2.a.tolist())
u.extend(self.Jumper.u.v.tolist())

# collect from Fortescue
fr.extend(self.Fortescue.a.a.tolist())
to.extend(self.Fortescue.aa.a.tolist())
Expand Down
10 changes: 10 additions & 0 deletions docs/source/release-notes.rst
Expand Up @@ -9,6 +9,16 @@ The APIs before v3.0.0 are in beta and may change without prior notice.
v1.8 Notes
==========

v1.8.10 (2023-08-10)
--------------------
- An internal change to the xlsx parser option. Previously, the index column was
set to 0, which assumes the existence of `uid` as the header. Manually input
sheets without `uid` will fail. This version unsets the index column when
using pandas to parse the xlsx file.
- `Jumper` is included for connectivity check.
- Add curly brackets for LaTeX symbols from sub-blocks. Nested symbols with
subscripts and superscripts now display properly.

v1.8.9 (2023-06-22)
-------------------
- Fix `Model.alter()` for parameters that are time constants for differential
Expand Down

0 comments on commit 6203731

Please sign in to comment.