.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\00-EDB\09_Configuration.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_00-EDB_09_Configuration.py: EDB: Pin to Pin project ----------------------- This example shows how you can create a project using a BOM file and configuration files. run anlasyis and get results. .. GENERATED FROM PYTHON SOURCE LINES 10-14 Perform required imports ~~~~~~~~~~~~~~~~~~~~~~~~ Perform required imports. Importing the ``Hfss3dlayout`` object initializes it on version 2023 R2. .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: default import os import pyaedt .. GENERATED FROM PYTHON SOURCE LINES 19-22 Set non-graphical mode ~~~~~~~~~~~~~~~~~~~~~~ Set non-graphical mode. The default is ``True``. .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: default non_graphical = True .. GENERATED FROM PYTHON SOURCE LINES 26-29 Download file ~~~~~~~~~~~~~ Download the AEDB file and copy it in the temporary folder. .. GENERATED FROM PYTHON SOURCE LINES 29-35 .. code-block:: default project_path = pyaedt.generate_unique_folder_name() target_aedb = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=project_path) print("Project folder will be", target_aedb) .. rst-class:: sphx-glr-script-out .. code-block:: none Project folder will be D:\Temp\pyaedt_prj_WA3\edb/ANSYS-HSD_V1.aedb .. GENERATED FROM PYTHON SOURCE LINES 36-39 Launch EDB ~~~~~~~~~~ Launch the :class:`pyaedt.Edb` class, using EDB 2023 R2 and SI units. .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: default edbapp = pyaedt.Edb(target_aedb, edbversion="2023.2") .. GENERATED FROM PYTHON SOURCE LINES 42-76 Import Definitions ~~~~~~~~~~~~~~~~~~ A definitions file is a json containing, for each part name the model associated. Model can be RLC, Sparameter or Spice. Once imported the definition is applied to the board. In this example the json file is stored for convenience in aedb folder and has the following format: { "SParameterModel": { "GRM32_DC0V_25degC_series": "./GRM32_DC0V_25degC_series.s2p" }, "SPICEModel": { "GRM32_DC0V_25degC": "./GRM32_DC0V_25degC.mod" }, "Definitions": { "CAPC1005X05N": { "Component_type": "Capacitor", "Model_type": "RLC", "Res": 1, "Ind": 2, "Cap": 3, "Is_parallel": false }, "'CAPC3216X180X55ML20T25": { "Component_type": "Capacitor", "Model_type": "SParameterModel", "Model_name": "GRM32_DC0V_25degC_series" }, "'CAPC3216X180X20ML20": { "Component_type": "Capacitor", "Model_type": "SPICEModel", "Model_name": "GRM32_DC0V_25degC" } } } .. GENERATED FROM PYTHON SOURCE LINES 76-79 .. code-block:: default edbapp.components.import_definition(os.path.join(target_aedb, "1_comp_definition.json")) .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 80-92 Import BOM ~~~~~~~~~~ This step imports a BOM file in CSV format. The BOM contains the reference designator, part name, component type, and default value. Components not in the BOM are deactivated. In this example the csv file is stored for convenience in aedb folder. +------------+-----------------------+-----------+------------+ | RefDes | Part name | Type | Value | +============+=======================+===========+============+ | C380 | CAPC1005X55X25LL05T10 | Capacitor | 11nF | +------------+-----------------------+-----------+------------+ .. GENERATED FROM PYTHON SOURCE LINES 92-102 .. code-block:: default edbapp.components.import_bom(os.path.join(target_aedb, "0_bom.csv"), refdes_col=0, part_name_col=1, comp_type_col=2, value_col=3) .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 103-106 Check Component Values ~~~~~~~~~~~~~~~~~~~~~~ Component property allows to access all components instances and their property with getters and setters. .. GENERATED FROM PYTHON SOURCE LINES 106-111 .. code-block:: default comp = edbapp.components["C1"] comp.model_type, comp.value .. rst-class:: sphx-glr-script-out .. code-block:: none ('RLC', 1.0000000000000001e-07) .. GENERATED FROM PYTHON SOURCE LINES 112-115 Check Component Definition ~~~~~~~~~~~~~~~~~~~~~~~~~~ When an s-parameter model is associated to a component it will be available in nport_comp_definition property. .. GENERATED FROM PYTHON SOURCE LINES 115-118 .. code-block:: default edbapp.components.nport_comp_definition .. rst-class:: sphx-glr-script-out .. code-block:: none {} .. GENERATED FROM PYTHON SOURCE LINES 119-121 Save Edb ~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 121-123 .. code-block:: default edbapp.save_edb() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 124-131 Configure Setup ~~~~~~~~~~~~~~~ This step allows to define the project. It includes: - Definition of nets to be included into the cutout, - Cutout details, - Components on which to create the ports, - Simulation settings. .. GENERATED FROM PYTHON SOURCE LINES 131-150 .. code-block:: default sim_setup = edbapp.new_simulation_configuration() sim_setup.solver_type = sim_setup.SOLVER_TYPE.SiwaveSYZ sim_setup.batch_solve_settings.cutout_subdesign_expansion = 0.003 sim_setup.batch_solve_settings.do_cutout_subdesign = True sim_setup.batch_solve_settings.use_pyaedt_cutout = True sim_setup.ac_settings.max_arc_points = 6 sim_setup.ac_settings.max_num_passes = 5 sim_setup.batch_solve_settings.signal_nets = ['PCIe_Gen4_TX2_CAP_P', 'PCIe_Gen4_TX2_CAP_N', 'PCIe_Gen4_TX2_P', 'PCIe_Gen4_TX2_N'] sim_setup.batch_solve_settings.components = ["U1", "X1"] sim_setup.batch_solve_settings.power_nets = ["GND", "GND_DP"] sim_setup.ac_settings.start_freq = "100Hz" sim_setup.ac_settings.stop_freq = "6GHz" sim_setup.ac_settings.step_freq = "10MHz" .. GENERATED FROM PYTHON SOURCE LINES 151-154 Run Setup ~~~~~~~~~ This step allows to create the cutout and apply all settings. .. GENERATED FROM PYTHON SOURCE LINES 154-158 .. code-block:: default sim_setup.export_json(os.path.join(project_path, "configuration.json")) edbapp.build_simulation_project(sim_setup) .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 159-162 Plot Cutout ~~~~~~~~~~~ Plot cutout once finished. .. GENERATED FROM PYTHON SOURCE LINES 162-165 .. code-block:: default edbapp.nets.plot(None,None) .. image-sg:: /examples/00-EDB/images/sphx_glr_09_Configuration_001.png :alt: main :srcset: /examples/00-EDB/images/sphx_glr_09_Configuration_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 166-169 Save and Close EDB ~~~~~~~~~~~~~~~~~~ Edb will be saved and closed in order to be opened by Hfss 3D Layout and solved. .. GENERATED FROM PYTHON SOURCE LINES 169-173 .. code-block:: default edbapp.save_edb() edbapp.close_edb() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 174-177 Open Aedt ~~~~~~~~~ Project folder aedb will be opened in AEDT Hfss3DLayout and loaded. .. GENERATED FROM PYTHON SOURCE LINES 177-179 .. code-block:: default h3d = pyaedt.Hfss3dLayout(specified_version="2023.2", projectname=target_aedb, non_graphical=non_graphical, new_desktop_session=True) .. rst-class:: sphx-glr-script-out .. code-block:: none Initializing new desktop! .. GENERATED FROM PYTHON SOURCE LINES 180-183 Analyze ~~~~~~~ Project will be solved. .. GENERATED FROM PYTHON SOURCE LINES 183-185 .. code-block:: default h3d.analyze() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 186-189 Get Results ~~~~~~~~~~~ S Parameter data will be loaded at the end of simulation. .. GENERATED FROM PYTHON SOURCE LINES 189-191 .. code-block:: default solutions = h3d.post.get_solution_data() .. GENERATED FROM PYTHON SOURCE LINES 192-195 Plot Results ~~~~~~~~~~~~ Plot S Parameter data. .. GENERATED FROM PYTHON SOURCE LINES 195-197 .. code-block:: default solutions.plot(solutions.expressions, "db20") .. image-sg:: /examples/00-EDB/images/sphx_glr_09_Configuration_002.png :alt: Simulation Results Plot :srcset: /examples/00-EDB/images/sphx_glr_09_Configuration_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 198-201 Save and Close AEDT ~~~~~~~~~~~~~~~~~~~ Hfss3dLayout is saved and closed. .. GENERATED FROM PYTHON SOURCE LINES 201-203 .. code-block:: default h3d.save_project() h3d.release_desktop() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 18.904 seconds) .. _sphx_glr_download_examples_00-EDB_09_Configuration.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 09_Configuration.py <09_Configuration.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 09_Configuration.ipynb <09_Configuration.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_