From 7cc8daf74068ddac500c08b72a8fe730c5ec29a4 Mon Sep 17 00:00:00 2001 From: Hantao Cui Date: Sun, 31 Mar 2024 17:16:54 +0000 Subject: [PATCH] Update. --- andes/core/symprocessor.py | 11 +++++++++-- docs/source/release-notes.rst | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/andes/core/symprocessor.py b/andes/core/symprocessor.py index 06f1202ea..e0aa4a119 100644 --- a/andes/core/symprocessor.py +++ b/andes/core/symprocessor.py @@ -118,11 +118,18 @@ def generate_symbols(self): self.tex_names[name] = sp.Symbol(tex_name) # ----------------------------------------------------------- + # `all_params_names` include parameters, services, exports from blocks, etc. for var in self.cache.all_params_names: + is_real = True + + if var in self.parent.services: + if self.parent.services[var].vtype == complex: + is_real = False + self.inputs_dict[var] = sp.Symbol(var) for var in self.cache.all_vars_names: - tmp = sp.Symbol(var) + tmp = sp.Symbol(var, real=True) # all DAE variables are real self.vars_dict[var] = tmp self.inputs_dict[var] = tmp if var in self.cache.vars_int: @@ -130,7 +137,7 @@ def generate_symbols(self): # store tex names defined in `self.config` for key in self.config.as_dict(): - tmp = sp.Symbol(key) + tmp = sp.Symbol(key, real=True) # not expecting complex numbers in config self.inputs_dict[key] = tmp if key in self.config.tex_names: self.tex_names[tmp] = sp.Symbol(self.config.tex_names[key]) diff --git a/docs/source/release-notes.rst b/docs/source/release-notes.rst index d766892bc..ae131afad 100644 --- a/docs/source/release-notes.rst +++ b/docs/source/release-notes.rst @@ -9,6 +9,12 @@ The APIs before v3.0.0 are in beta and may change without prior notice. v1.9 Notes ========== +v1.9.3 (2024-04-XX) +------------------- +- In symbolic processor, most variables are assumed to be real, except some + services that are specified as complex. This will allow generating simplified + expressions. + v1.9.2 (2024-03-25) ------------------- - Improve PSS/E parser for the `wmod` field in the static generator