pyEPR.project_info module#

ProjectInfo — primary configuration class for pyEPR’s HFSS interface.

Stores connection handles (app, desktop, project, design, setup) and user-defined parameters (junctions, dissipative objects) needed by DistributedAnalysis.

Copyright Zlatko Minev, Zaki Leghtas, and the pyEPR team 2015, 2016, 2017, 2018, 2019, 2020

class pyEPR.project_info.ProjectInfo(project_path: str = None, project_name: str = None, design_name: str = None, setup_name: str = None, dielectrics_bulk: list = None, dielectric_surfaces: list = None, resistive_surfaces: list = None, seams: list = None, junctions: dict = None, do_connect: bool = True)[source]#

Bases: object

Primary class to store interface information between pyEPR and Ansys.

Note

Junction parameters. The junction parameters are stored in the self.junctions ordered dictionary

A Josephson tunnel junction has to have its parameters specified here for the analysis. Each junction is given a name and is specified by a dictionary. It has the following properties:

  • Lj_variable (str):

    Name of HFSS variable that specifies junction inductance Lj defined on the boundary condition in HFSS. WARNING: DO NOT USE Global names that start with $.

  • rect (str):

    String of Ansys name of the rectangle on which the lumped boundary condition is defined.

  • line (str):

    Name of HFSS polyline which spans the length of the rectangle. Used to define the voltage across the junction. Used to define the current orientation for each junction. Used to define sign of ZPF.

  • length (str):

    Length in HFSS of the junction rectangle and line (specified in meters). To create, you can use epr.parse_units('100um').

  • Cj_variable (str, optional) [experimental]:

    Name of HFSS variable that specifies junction inductance Cj defined on the boundary condition in HFSS. DO NOT USE Global names that start with $.

Warning

To define junctions, do NOT use global names! I.e., do not use names in ansys that start with $.

Note

Junction parameters example . To define junction parameters, see the following example

 1# Create project infor class
 2pinfo = ProjectInfo()
 3
 4# Now, let us add a junction called `j1`, with the following properties
 5pinfo.junctions['j1'] = {
 6            'Lj_variable' : 'Lj_1', # name of Lj variable in Ansys
 7            'rect'        : 'jj_rect_1',
 8            'line'        : 'jj_line_1',
 9            #'Cj'          : 'Cj_1' # name of Cj variable in Ansys - optional
10            }

To extend to define 5 junctions in bulk, we could use the following script

1n_junctions = 5
2for i in range(1, n_junctions + 1):
3    pinfo.junctions[f'j{i}'] = {'Lj_variable' : f'Lj_{i}',
4                                'rect'        : f'jj_rect_{i}',
5                                'line'        : f'jj_line_{i}'}
check_connected() bool[source]#

Return True if fully connected to Ansys (app, desktop, project, design, and setup).

Returns:

True when all five COM handles are non-None.

Return type:

bool

connect() ProjectInfo[source]#

Establish a full connection to the Ansys Desktop API.

Calls connect_project(), connect_design(), and connect_setup() in sequence. Logs connection status at each step.

Returns:

Returns self to allow chaining (e.g. pinfo = ProjectInfo(...).connect()).

Return type:

ProjectInfo

connect_design(design_name: str = None) None[source]#

Attach to an HFSS design within the open project.

Sets self.design and self.design_name.

Parameters:

design_name (str, optional) – Name of the design to open. If None, attaches to the currently active design. Raises if the named design does not exist.

connect_project() None[source]#

Open the Ansys Desktop application and attach to the target project.

Sets self.app, self.desktop, self.project, self.project_name, and self.project_path.

If project_name is None, attaches to the currently active project in the running Ansys Desktop instance.

connect_setup() None[source]#

Attach to a simulation setup within the active design.

If setup_name was specified in the constructor and the setup exists, that setup is used. If setup_name is None, the first available setup is selected automatically. If no setups exist, a default one is created for Eigenmode, DrivenModal, DrivenTerminal, and Q3D designs.

Raises:
  • ValueError – If setup_name was specified but does not exist in the design.

  • ValueError – If the design solution type is not supported.

disconnect() None[source]#

Release all COM handles and disconnect from the Ansys Desktop API.

Raises:

AssertionError – If not currently connected. Call check_connected() first, or use the context manager form (with ProjectInfo(...) as pinfo:) which guards the call automatically.

get_all_object_names() list[source]#

Return the names of all 3-D modeler objects in the active design.

Covers Non Model, Solids, Unclassified, Sheets, and Lines groups.

Returns:

All object names as reported by the HFSS 3-D Modeler.

Return type:

list of str

get_all_variables_names() list[source]#

Return all project-level and design-level variable names.

Returns:

Concatenation of project variable names and local design variable names. Does not include global $-prefixed project variables from other designs.

Return type:

list of str

get_dm() tuple[source]#

Return the active design and 3-D modeler as a tuple.

Returns:

(design, design.modeler) — the HfssDesign and HfssModeler handles.

Return type:

tuple

Example

oDesign, oModeler = pinfo.get_dm()
get_setup(name: str)[source]#

Connects to a specific setup for the design. Sets self.setup and self.setup_name.

Parameters:
  • name (str) – Name of the setup.

  • exist (If the setup does not)

  • error. (then throws a logger)

  • None (in which case returns)

  • None

get_variable_value(name: str) str[source]#

Return the value of a local design variable as a string.

Parameters:

name (str) – Name of the design-level variable (e.g. 'Lj').

Returns:

Value string as stored in HFSS (e.g. '10nH').

Return type:

str

Note

Only reads local design variables. Global project variables (prefixed with $) are not accessible via this method.

save() dict[source]#

Serialise project info to a dictionary of pandas objects.

Returns:

Keys: "pinfo" (Series of scalar attributes), "dissip" (Series), "options" (Series), "junctions" (DataFrame), "ports" (DataFrame).

Return type:

dict

validate_junction_info() None[source]#

Validate that all junction parameters refer to objects that exist in HFSS.

Checks that each junction’s Lj_variable exists as a design or project variable, and that rect and line exist as 3-D modeler objects.

Raises:

AssertionError – Descriptive message identifying the junction name and the missing variable or object.

Note

Also verify the physical length of junction rectangles and polylines if you modify geometry after the initial setup.