Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New minor release #475

Merged
merged 7 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion andes/core/discrete.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading