@@ -157,6 +157,11 @@ def _define_termination_impedance_dll_functions(self):
157157 self ._dll .getLumpedComplexCompOrder .argtypes = [POINTER (c_int ), c_bool ]
158158 self ._dll .getLumpedComplexCompOrder .restype = c_int
159159
160+ def _bytes_or_none (self , str_value ):
161+ if str_value :
162+ return bytes (str_value , "ascii" )
163+ return None
164+
160165 def table_type_to_bool (self ):
161166 """Set a flag to recognize source and load complex table.
162167
@@ -190,7 +195,7 @@ def row(self, row_index):
190195 Parameters
191196 ----------
192197 row_index: int
193- Row index on complex impedance table, starting at ``0`` and with a maximum value of ``99 ``.
198+ Row index on complex impedance table, starting at ``0`` and with a maximum value of ``149 ``.
194199
195200 Returns
196201 -------
@@ -216,33 +221,30 @@ def row(self, row_index):
216221 imag_value_string = imag_value_buffer .value .decode ("utf-8" )
217222 return frequency_value_string , real_value_string , imag_value_string
218223
219- def update_row (self , row_index , frequency = "" , real = "" , imag = "" ):
224+ def update_row (self , row_index , frequency = None , real = None , imag = None ):
220225 """Update frequency and complex impedance at a specified index in the complex impedance table.
221226
222227 Parameters
223228 ----------
224229 row_index: int
225- Row index on complex impedance table, starting at ``0`` and with a maximum value of ``99 ``.
230+ Row index on complex impedance table, starting at ``0`` and with a maximum value of ``149 ``.
226231 frequency: str, optional
227232 The frequency value to update. If not specified, it remains unchanged.
228233 real: str, optional
229234 The real part of the complex impedance to update. If not specified, it remains unchanged.
230235 imag: str, optional
231236 The imaginary part of the complex impedance to update. If not specified, it remains unchanged.
232237 """
233- frequency_bytes_value = bytes (frequency , "ascii" )
234- real_bytes_value = bytes (real , "ascii" )
235- imag_bytes_value = bytes (imag , "ascii" )
236238 status = self ._dll .updateComplexTableRow (
237239 row_index ,
238- frequency_bytes_value ,
239- real_bytes_value ,
240- imag_bytes_value ,
240+ self . _bytes_or_none ( frequency ) ,
241+ self . _bytes_or_none ( real ) ,
242+ self . _bytes_or_none ( imag ) ,
241243 self .table_type_to_bool (),
242244 )
243245 ansys .aedt .core .filtersolutions_core ._dll_interface ().raise_error (status )
244246
245- def append_row (self , frequency , real , imag ):
247+ def append_row (self , frequency = None , real = None , imag = None ):
246248 """Append frequency and complex impedance values to the last row of
247249 both the source and load complex impedance table.
248250
@@ -256,39 +258,33 @@ def append_row(self, frequency, real, imag):
256258 imag: str
257259 The imaginary part of the complex impedance to append.
258260 """
259- frequency_bytes_value = bytes (frequency , "ascii" )
260- real_bytes_value = bytes (real , "ascii" )
261- imag_bytes_value = bytes (imag , "ascii" )
262261 status = self ._dll .appendComplexTableRow (
263- frequency_bytes_value ,
264- real_bytes_value ,
265- imag_bytes_value ,
262+ self . _bytes_or_none ( frequency ) ,
263+ self . _bytes_or_none ( real ) ,
264+ self . _bytes_or_none ( imag ) ,
266265 self .table_type_to_bool (),
267266 )
268267 ansys .aedt .core .filtersolutions_core ._dll_interface ().raise_error (status )
269268
270- def insert_row (self , row_index , frequency , real , imag ):
269+ def insert_row (self , row_index , frequency = None , real = None , imag = None ):
271270 """Insert frequency and complex impedance values at a specified index in the complex impedance table.
272271
273272 Parameters
274273 ----------
275274 row_index : int
276- Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``99 ``.
275+ Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``149 ``.
277276 frequency : str
278277 The frequency value to insert.
279278 real : str
280279 The real part of the complex impedance to insert.
281280 imag : str
282281 The imaginary part of the complex impedance to insert.
283282 """
284- frequency_bytes_value = bytes (frequency , "ascii" )
285- real_bytes_value = bytes (real , "ascii" )
286- imag_bytes_value = bytes (imag , "ascii" )
287283 status = self ._dll .insertComplexTableRow (
288284 row_index ,
289- frequency_bytes_value ,
290- real_bytes_value ,
291- imag_bytes_value ,
285+ self . _bytes_or_none ( frequency ) ,
286+ self . _bytes_or_none ( real ) ,
287+ self . _bytes_or_none ( imag ) ,
292288 self .table_type_to_bool (),
293289 )
294290 ansys .aedt .core .filtersolutions_core ._dll_interface ().raise_error (status )
@@ -299,7 +295,7 @@ def remove_row(self, row_index):
299295 Parameters
300296 ----------
301297 row_index : int
302- Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``99 ``.
298+ Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``149 ``.
303299 """
304300 status = self ._dll .removeComplexTableRow (row_index , self .table_type_to_bool ())
305301 ansys .aedt .core .filtersolutions_core ._dll_interface ().raise_error (status )
0 commit comments