Netlist Example Analysis

# This example shows how to import Netlist data into a # Circuit design. Supported Netlist files are HSPICE and, # partially, Mentor.

import os

Import Packages

Set the local path to the path for AEDTLib.

from pyaedt import examples
import tempfile
netlist = examples.download_netlist()
from pyaedt import generate_unique_name

tmpfold = tempfile.gettempdir()
temp_folder = os.path.join(tmpfold, generate_unique_name("Example"))
if not os.path.exists(temp_folder):
    os.makedirs(temp_folder)
myfile = os.path.join(netlist)
print(temp_folder)

Out:

C:\Users\ansys\AppData\Local\Temp\Example_1PONHF

Import the main classes needed: pyaedt.Desktop and pyaedt.Circuit.

from pyaedt import Circuit
from pyaedt import Desktop

Launch AEDT and Circuit

This example launches AEDT 2021.1 in graphical mode.

# This examples uses SI units.

desktopVersion = "2021.1"

Launch AEDT in Non-Graphical Mode

Change the Boolean parameter NonGraphical to False to launch AEDT in graphical mode.

NonGraphical = False
NewThread = True

Launch AEDT and Circuit

The pyaedt.Desktop class initializes AEDT and starts it on a specified version in a specified graphical mode. The Boolean parameter NewThread defines whether to create a new instance of AEDT or try to connect to existing instance of it.

desktop = Desktop(desktopVersion, NonGraphical, NewThread)
aedtapp = Circuit()

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.1\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info:: Ansoft.ElectronicsDesktop.2021.1 Started with process ID 10604.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20211026_141127.log
pyaedt info: pyaedt v0.4.0
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
pyaedt info: Project Project6077 has been created.
pyaedt info: No design is present. Inserting a new design.
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

Save the Project to the Temp Folder

The temp folder can be changed.

aedtapp.save_project(os.path.join(temp_folder, "my_firt_netlist.aedt"))

Out:

pyaedt info: Saving Project6077 Project

True

Define a Design Variable

Using a $ prefix creates a project variable.

aedtapp["Voltage"] = "5"

Create a Schematic from a Netlist File

This method reads the netlist file and parses it. All components will be parsed but only specified categories will be mapped. In particular, R, L, C, Q, U, J, V, and I components will be mapped.

aedtapp.create_schematic_from_netlist(myfile)

Out:

**************************************************************
**************************************************************
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
Arguments Provided:
Arguments Provided:
    symbol_name = Models_Netlist
    symbol_name = Models_Netlist
    pin_lists = []
    pin_lists = []
Error in :
Error in :
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
Check Online documentation on:
Check Online documentation on:
https://aedtdocs.pyansys.com/search.html?q=create_symbol
https://aedtdocs.pyansys.com/search.html?q=create_symbol
************************************************************
************************************************************
**************************************************************
**************************************************************
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
Arguments Provided:
Arguments Provided:
    symbol_name = STS6NF20V
    symbol_name = STS6NF20V
    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4', 'Pin5', 'Pin6', 'Pin7', 'Pin8']

    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4', 'Pin5', 'Pin6', 'Pin7', 'Pin8']

Error in :
Error in :
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
Check Online documentation on:
Check Online documentation on:
https://aedtdocs.pyansys.com/search.html?q=create_symbol
https://aedtdocs.pyansys.com/search.html?q=create_symbol
************************************************************
************************************************************
**************************************************************
**************************************************************
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
Arguments Provided:
Arguments Provided:
    symbol_name = CON4
    symbol_name = CON4
    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4', 'Pin5']
    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4', 'Pin5']
Error in :
Error in :
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
Check Online documentation on:
Check Online documentation on:
https://aedtdocs.pyansys.com/search.html?q=create_symbol
https://aedtdocs.pyansys.com/search.html?q=create_symbol
************************************************************
************************************************************
**************************************************************
**************************************************************
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
pyaedt error on Method create_symbol:  General or AEDT Error. Please Check again
Arguments Provided:
Arguments Provided:
    symbol_name = DCH010505SN7
    symbol_name = DCH010505SN7
    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4']
    pin_lists = ['Pin1', 'Pin2', 'Pin3', 'Pin4']
Error in :
Error in :
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
  File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesCircuit.p
y", line 667, in create_symbol
Check Online documentation on:
Check Online documentation on:
https://aedtdocs.pyansys.com/search.html?q=create_symbol
https://aedtdocs.pyansys.com/search.html?q=create_symbol
************************************************************
************************************************************
pyaedt info: Netlist correctly imported into Circuit Design_0TP

True

Close the Project

After adding any other desired functionalities, close the project.

if os.name != "posix":
    desktop.release_desktop()

Total running time of the script: ( 0 minutes 10.548 seconds)

Gallery generated by Sphinx-Gallery