Skip to content

Improved Robustness of import_configurations to handle integration lines for Lumped RLC and Ports. #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions pyaedt/generic/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pyaedt.modeler.GeometryOperators import GeometryOperators
from pyaedt.modeler.Modeler import CoordinateSystem
from pyaedt.modules.Boundary import BoundaryObject
from pyaedt.modules.Boundary import BoundaryProps
from pyaedt.modules.DesignXPloration import SetupOpti
from pyaedt.modules.DesignXPloration import SetupParam
from pyaedt.modules.MaterialLib import Material
Expand Down Expand Up @@ -772,6 +773,43 @@ def _update_boundaries(self, name, props):
bound.auto_update = False
bound.props["Independent"] = b.name
bound.auto_update = True
if bound.props.get("CurrentLine", None):
current = bound.props["CurrentLine"]["GeometryPosition"]
x1 = self._app.modeler._arg_with_dim(float(current[0]["XPosition"]), self._app.modeler.model_units)
y1 = self._app.modeler._arg_with_dim(float(current[0]["YPosition"]), self._app.modeler.model_units)
z1 = self._app.modeler._arg_with_dim(float(current[0]["ZPosition"]), self._app.modeler.model_units)
x2 = self._app.modeler._arg_with_dim(float(current[1]["XPosition"]), self._app.modeler.model_units)
y2 = self._app.modeler._arg_with_dim(float(current[1]["YPosition"]), self._app.modeler.model_units)
z2 = self._app.modeler._arg_with_dim(float(current[1]["ZPosition"]), self._app.modeler.model_units)
p1 = OrderedDict({"Coordinate System": "Global", "Start": [x1, y1, z1], "End": [x2, y2, z2]})
bound.auto_update = False
bound.props["CurrentLine"] = BoundaryProps(bound, p1)
bound.auto_update = True
if bound.props.get("Modes", None):
modes = OrderedDict({})
for k, v in bound.props["Modes"].items():
p1 = OrderedDict({"ModeNum": v["ModeNum"], "UseIntLine": v["UseIntLine"]})
if v["UseIntLine"]:
current = v["IntLine"]["GeometryPosition"]
x1 = self._app.modeler._arg_with_dim(float(current[0]["XPosition"]), self._app.modeler.model_units)
y1 = self._app.modeler._arg_with_dim(float(current[0]["YPosition"]), self._app.modeler.model_units)
z1 = self._app.modeler._arg_with_dim(float(current[0]["ZPosition"]), self._app.modeler.model_units)
x2 = self._app.modeler._arg_with_dim(float(current[1]["XPosition"]), self._app.modeler.model_units)
y2 = self._app.modeler._arg_with_dim(float(current[1]["YPosition"]), self._app.modeler.model_units)
z2 = self._app.modeler._arg_with_dim(float(current[1]["ZPosition"]), self._app.modeler.model_units)
p1["IntLine"] = OrderedDict(
{"Coordinate System": "Global", "Start": [x1, y1, z1], "End": [x2, y2, z2]}
)
if v.get("AlignmentGroup", None):
p1["AlignmentGroup"] = v["AlignmentGroup"]
if v.get("CharImp", None):
p1["CharImp"] = v["CharImp"]
if v.get("RenormImp", None):
p1["RenormImp"] = v["RenormImp"]
modes[k] = p1
bound.auto_update = False
bound.props["Modes"] = BoundaryProps(bound, modes)
bound.auto_update = True
if bound.create():
self._app.boundaries.append(bound)
if props["BoundType"] in ["Coil Terminal", "Coil", "CoilTerminal"]:
Expand Down Expand Up @@ -948,7 +986,7 @@ def import_config(self, config_file):
# self._convert_objects(dict_in["facecoordinatesystems"][name], dict_in["general"]["object_mapping"])
# if not self._update_face_coordinate_systems(name, props):
# self.results.import_face_coordinate_systems = False

self._app.modeler.set_working_coordinate_system("Global")
if self.options.import_object_properties and dict_in.get("objects", None):
self.results.import_object_properties = True
for obj, val in dict_in["objects"].items():
Expand All @@ -964,7 +1002,6 @@ def import_config(self, config_file):
if not self._update_boundaries(name, dict_in["boundaries"][name]):
self.results.import_boundaries = False

# TODO implement MeshRegion handler
if self.options.import_mesh_operations and dict_in.get("mesh", None):
self.results.import_mesh_operations = True
for name, props in dict_in["mesh"].items():
Expand Down
14 changes: 7 additions & 7 deletions pyaedt/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2675,7 +2675,7 @@ def create_perfecth_from_objects(self, startobj, endobject, axisdir=0, sourcenam
>>> box2 = hfss.modeler.create_box([0, 0, 30], [10, 10, 5],
... "perfect2", "copper")
>>> perfect_h = hfss.create_perfecth_from_objects("perfect1", "perfect2",
... hfss.AxisDir.ZNeg, "PerfectH")
... hfss.AxisDir.ZNeg, "Perfect H")
pyaedt info: Connection Correctly created
>>> type(perfect_h)
<class 'pyaedt.modules.Boundary.BoundaryObject'>
Expand Down Expand Up @@ -2837,7 +2837,7 @@ def create_lumped_rlc_between_objects(
>>> box2 = hfss.modeler.create_box([0, 0, 60], [10, 10, 5],
... "rlc2", "copper")
>>> rlc = hfss.create_lumped_rlc_between_objects("rlc1", "rlc2", hfss.AxisDir.XPos,
... "LumpedRLC", Rvalue=50,
... "Lumped RLC", Rvalue=50,
... Lvalue=1e-9, Cvalue = 1e-6)
pyaedt info: Connection Correctly created

Expand Down Expand Up @@ -2872,7 +2872,7 @@ def create_lumped_rlc_between_objects(
props["UseCap"] = True
props["Capacitance"] = str(Cvalue) + "F"

return self._create_boundary(sourcename, props, "LumpedRLC")
return self._create_boundary(sourcename, props, "Lumped RLC")
return False

@pyaedt_function_handler()
Expand Down Expand Up @@ -2971,7 +2971,7 @@ def create_boundary(
Parameters
----------
boundary_type : str, optional
Boundary type object. Options are ``"PerfectE"``, ``"PerfectH"``, ``"Aperture"``, and
Boundary type object. Options are ``"Perfect E"``, ``"Perfect H"``, ``"Aperture"``, and
``"Radiation"``. The default is ``PerfectE``.
sheet_name : in, str, or list, optional
Name of the sheet. It can be an integer (face ID), a string (sheet), or a list of integers
Expand All @@ -2998,9 +2998,9 @@ def create_boundary(

if boundary_type == self.BoundaryType.PerfectE:
props["InfGroundPlane"] = is_infinite_gnd
boundary_type = "PerfectE"
boundary_type = "Perfect E"
elif boundary_type == self.BoundaryType.PerfectH:
boundary_type = "PerfectH"
boundary_type = "Perfect H"
elif boundary_type == self.BoundaryType.Aperture:
boundary_type = "Aperture"
elif boundary_type == self.BoundaryType.Radiation:
Expand Down Expand Up @@ -3518,7 +3518,7 @@ def assign_lumped_rlc_to_sheet(
if Cvalue:
props["UseCap"] = True
props["Capacitance"] = str(Cvalue) + "F"
return self._create_boundary(sourcename, props, "LumpedRLC")
return self._create_boundary(sourcename, props, "Lumped RLC")
return False

@pyaedt_function_handler()
Expand Down
18 changes: 11 additions & 7 deletions pyaedt/modules/Boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,24 @@ def create(self):
``True`` when successful, ``False`` when failed.

"""
if self.type == "PerfectE":
if self.type == "Perfect E":
self._app.oboundary.AssignPerfectE(self._get_args())
elif self.type == "PerfectH":
elif self.type == "Perfect H":
self._app.oboundary.AssignPerfectH(self._get_args())
elif self.type == "Aperture":
self._app.oboundary.AssignAperture(self._get_args())
elif self.type == "Radiation":
self._app.oboundary.AssignRadiation(self._get_args())
elif self.type == "Finite Conductivity":
self._app.oboundary.AssignFiniteCond(self._get_args())
elif self.type == "LumpedRLC":
elif self.type == "Lumped RLC":
self._app.oboundary.AssignLumpedRLC(self._get_args())
elif self.type == "Impedance":
self._app.oboundary.AssignImpedance(self._get_args())
elif self.type == "Layered Impedance":
self._app.oboundary.AssignLayeredImp(self._get_args())
elif self.type == "Anisotropic Impedance":
self._app.oboundary.AssignAssignAnisotropicImpedance(self._get_args())
self._app.oboundary.AssignAnisotropicImpedance(self._get_args())
elif self.type == "Primary":
self._app.oboundary.AssignPrimary(self._get_args())
elif self.type == "Secondary":
Expand Down Expand Up @@ -482,20 +484,22 @@ def update(self):
``True`` when successful, ``False`` when failed.

"""
if self.type == "PerfectE":
if self.type == "Perfect E":
self._app.oboundary.EditPerfectE(self._boundary_name, self._get_args())
elif self.type == "PerfectH":
elif self.type == "Perfect H":
self._app.oboundary.EditPerfectH(self._boundary_name, self._get_args())
elif self.type == "Aperture":
self._app.oboundary.EditAperture(self._boundary_name, self._get_args())
elif self.type == "Radiation":
self._app.oboundary.EditRadiation(self._boundary_name, self._get_args())
elif self.type == "Finite Conductivity":
self._app.oboundary.EditFiniteCond(self._boundary_name, self._get_args())
elif self.type == "LumpedRLC":
elif self.type == "Lumped RLC":
self._app.oboundary.EditLumpedRLC(self._boundary_name, self._get_args())
elif self.type == "Impedance":
self._app.oboundary.EditImpedance(self._boundary_name, self._get_args())
elif self.type == "Layered Impedance":
self._app.oboundary.EditLayeredImpedance(self._boundary_name, self._get_args())
elif self.type == "Anisotropic Impedance":
self._app.oboundary.EditAssignAnisotropicImpedance(
self._boundary_name, self._get_args()
Expand Down