Skip to content

Commit

Permalink
FEAT: enforce touchstone model passive (#4668)
Browse files Browse the repository at this point in the history
Co-authored-by: HaiwenZhang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sébastien Morais <[email protected]>
  • Loading branch information
4 people authored May 13, 2024
1 parent 2e21c89 commit 5a2b89a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
15 changes: 15 additions & 0 deletions _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,3 +898,18 @@ def test_49_automatic_ami(self):
design_name="AMI",
)
assert result

def test_50_enforce_touchstone_passive(self):
self.aedtapp.insert_design("Touchstone_passive")
self.aedtapp.modeler.schematic_units = "mil"
s_parameter_component = self.aedtapp.modeler.schematic.create_touchstone_component(self.touchstone_file)
assert s_parameter_component.enforce_touchstone_model_passive()
nexxim_customization = s_parameter_component.model_data.props["NexximCustomization"]
assert -1 == nexxim_customization["DCOption"]
assert 1 == nexxim_customization["InterpOption"]
assert 3 == nexxim_customization["ExtrapOption"]
assert 0 == nexxim_customization["Convolution"]
assert 6 == nexxim_customization["Passivity"]
assert not nexxim_customization["Reciprocal"]
assert "" == nexxim_customization["ModelOption"]
assert 2 == nexxim_customization["DataType"]
33 changes: 33 additions & 0 deletions pyaedt/modeler/circuits/object3dcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from collections import OrderedDict
import math
import time

from pyaedt import pyaedt_function_handler
from pyaedt.application.Variables import decompose_variable_value
Expand Down Expand Up @@ -871,6 +872,38 @@ def change_property(self, property_name, names=None):
return self._oeditor.ChangeProperty(vOut)
return False

@pyaedt_function_handler()
def enforce_touchstone_model_passive(self):
"""Enforce touchstone model passive.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
References
----------
>>> oModelManager.EditWithComps
"""
props = self.model_data.props
passive = OrderedDict(
[
("DCOption", -1),
("InterpOption", 1),
("ExtrapOption", 3),
("Convolution", 0),
("Passivity", 6),
("Reciprocal", False),
("ModelOption", ""),
("DataType", 2),
]
)
props["NexximCustomization"] = passive
props["ModTime"] = int(time.time())
self.model_data.props = props
return self.model_data.update()


class Wire(object):
"""Creates and manipulates a wire."""
Expand Down

0 comments on commit 5a2b89a

Please sign in to comment.