Determining the evaluation band only once at the beginning.
@@ -980,21 +980,6 @@ class VectorFitting:
logging.info('Passivity enforcement: The model is already passive. Nothing to do.')
return
- A, B, C, D, E = self._get_ABCDE()
- dim_A = np.shape(A)[0]
- C_t = C
- delta = 0.999 # predefined tolerance parameter (users should not need to change this)
-
- # iterative compensation of passivity violations
- t = 0
- self.history_max_sigma = []
- while t < self.max_iterations:
- logging.info('Passivity enforcement; Iteration {}'.format(t + 1))
-
- A_matrix = []
- b_vector = []
- sigma_max = 0
-
# find the highest relevant frequency; either
# 1) the highest frequency of passivity violation
# or
@@ -1010,6 +995,21 @@ class VectorFitting:
f_eval_max = 1.2 * f_viol_max
freqs_eval = np.linspace(0, f_eval_max, n_samples)
+ A, B, C, D, E = self._get_ABCDE()
+ dim_A = np.shape(A)[0]
+ C_t = C
+ delta = 0.999 # predefined tolerance parameter (users should not need to change this)
+
+ # iterative compensation of passivity violations
+ t = 0
+ self.history_max_sigma = []
+ while t < self.max_iterations:
+ logging.info('Passivity enforcement; Iteration {}'.format(t + 1))
+
+ A_matrix = []
+ b_vector = []
+ sigma_max = 0
+
# sweep through evaluation frequencies
for i_eval, freq_eval in enumerate(freqs_eval):
# calculate S-matrix at this frequency
