Circuit: netlist to schematic import#

This example shows how you can import netlist data into a circuit design. HSPICE files are fully supported. Mentor files are partially supported.

Perform required imports#

Perform required imports and set paths.

import os

# Import required modules
from pyaedt import examples
from pyaedt import generate_unique_project_name
netlist = examples.download_netlist()

project_name = generate_unique_project_name()
print(project_name)
D:\Temp\pyaedt_prj_6SF\Project_UOP.aedt

Import main classes#

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

from pyaedt import Circuit
from pyaedt import Desktop

Launch AEDT#

Launch AEDT 2022 R2 in graphical mode. This example uses SI units.

desktopVersion = "2022.2"

Set non-graphical mode#

Set non-graphical mode. "PYAEDT_NON_GRAPHICAL" is needed to generate documentation only. You can set non_graphical either to True or False. The Boolean parameter NewThread defines whether to create a new instance of AEDT or try to connect to an existing instance of it.

non_graphical = os.getenv("PYAEDT_NON_GRAPHICAL", "False").lower() in ("true", "1", "t")
NewThread = True

Launch AEDT with Circuit#

Launch AEDT with Circuit. The pyaedt.Desktop class initializes AEDT and starts it on the specified version in the specified graphical mode.

desktop = Desktop(desktopVersion, non_graphical, NewThread)
aedtapp = Circuit(projectname=project_name)

Define variable#

Define a design variable by using a $ prefix.

aedtapp["Voltage"] = "5"

Create schematic from netlist file#

Create a schematic from a netlist file. The create_schematic_from_netlist method reads the netlist file and parses it. All components are parsed but only these categories are mapped: R, L, C, Q, U, J, V, and I.

aedtapp.create_schematic_from_netlist(netlist)
['NAME:Models_Netlist', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 0, 'DataSource:=', '', 'ModifiedOn:=', '', 'Manufacturer:=', '', 'Symbol:=', 'Models_Netlist', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', '', 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'x', 'NumParts:=', 1, 'ModSinceLib:=', True, 'CompExtID:=', 1, ['NAME:Parameters', 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'x@ID '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
['NAME:STS6NF20V', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 8, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'STS6NF20V', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'Q', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin5', 'Pin5', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin6', 'Pin6', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin7', 'Pin7', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin8', 'Pin8', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'STS6NF20V'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'Q@ID %0 STS6NF20V %1 STS6NF20V %2 STS6NF20V %3 STS6NF20V %4 STS6NF20V %5 STS6NF20V %6 STS6NF20V %7 STS6NF20V @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
['NAME:CON4', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 5, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'CON4', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'J', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin5', 'Pin5', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'CON4'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'J@ID %0 CON4 %1 CON4 %2 CON4 %3 CON4 %4 CON4 @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]
['NAME:DCH010505SN7', 'Info:=', ['Type:=', 0, 'NumTerminals:=', 4, 'DataSource:=', '', 'ModifiedOn:=', 1591858313, 'Manufacturer:=', '', 'Symbol:=', 'DCH010505SN7', 'ModelNames:=', '', 'Footprint:=', '', 'Description:=', '', 'InfoTopic:=', '', 'InfoHelpFile:=', '', 'IconFile:=', '', 'Library:=', '', 'OriginalLocation:=', 'Project', 'IEEE:=', '', 'Author:=', '', 'OriginalAuthor:=', '', 'CreationDate:=', 1591858313, 'ExampleFile:=', '', 'HiddenComponent:=', 0, 'CircuitEnv:=', 0, 'GroupID:=', 0], 'CircuitEnv:=', 0, 'Refbase:=', 'U', 'NumParts:=', 1, 'ModSinceLib:=', True, 'Terminal:=', ['Pin1', 'Pin1', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin2', 'Pin2', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin3', 'Pin3', 'A', False, 0, 1, '', 'Electrical', '0'], 'Terminal:=', ['Pin4', 'Pin4', 'A', False, 0, 1, '', 'Electrical', '0'], 'CompExtID:=', 1, ['NAME:Parameters', 'TextValueProp:=', ['MOD', 'D', '', 'DCH010505SN7'], 'ButtonProp:=', ['CosimDefinition', 'D', '', 'Edit', 'Edit', 40501, 'ButtonPropClientData:=', []], 'MenuProp:=', ['CoSimulator', 'D', '', 'DefaultNetlist', 0]], ['NAME:CosimDefinitions', ['NAME:CosimDefinition', 'CosimulatorType:=', 4, 'CosimDefName:=', 'DefaultNetlist', 'IsDefinition:=', True, 'Connect:=', True, 'Data:=', ['Nexxim Circuit:=', 'U@ID %0 DCH010505SN7 %1 DCH010505SN7 %2 DCH010505SN7 %3 DCH010505SN7 @MOD '], 'GRef:=', ['Nexxim Circuit:=', '']], 'DefaultCosim:=', 'DefaultNetlist']]

True

Close project and release AEDT#

After adding any other desired functionalities, close the project and release AEDT.

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

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

Gallery generated by Sphinx-Gallery