From cbbae61c24717c05db08a2949d89f84570ceadb5 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 22 Feb 2023 18:57:17 +0100 Subject: [PATCH] python: fix TD for MSL ports with set ref. impedance Signed-off-by: Thorsten Liebig --- python/openEMS/ports.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/openEMS/ports.py b/python/openEMS/ports.py index 3433c0e..d24fcca 100644 --- a/python/openEMS/ports.py +++ b/python/openEMS/ports.py @@ -126,7 +126,7 @@ class Port(object): self.uf_ref = self.uf_tot - self.uf_inc self.if_ref = self.if_inc - self.if_tot - if type(self.Z_ref) == float: + if type(self.Z_ref) in [int, float]: self.ut_inc = 0.5 * ( self.ut_tot + self.it_tot * self.Z_ref ) self.it_inc = 0.5 * ( self.it_tot + self.ut_tot / self.Z_ref ) self.ut_ref = self.ut_tot - self.ut_inc @@ -300,9 +300,11 @@ class MSLPort(Port): def ReadUIData(self, sim_path, freq, signal_type ='pulse'): self.u_data = UI_data(self.U_filenames, sim_path, freq, signal_type ) self.uf_tot = self.u_data.ui_f_val[1] + self.ut_tot = self.u_data.ui_val[1] self.i_data = UI_data(self.I_filenames, sim_path, freq, signal_type ) self.if_tot = 0.5*(self.i_data.ui_f_val[0]+self.i_data.ui_f_val[1]) + self.it_tot = 0.5*(self.i_data.ui_val[0]+self.i_data.ui_val[1]) unit = self.CSX.GetGrid().GetDeltaUnit() Et = self.u_data.ui_f_val[1]