ansys / pyaedt

AEDT Python Client Package
https://aedt.docs.pyansys.com
MIT License
204 stars 125 forks source link

create_touchsthone_component freezes program execution #3002

Closed ryand323 closed 1 year ago

ryand323 commented 1 year ago

Before submitting the issue

Description of the bug

modeler.components.create_touchstone_component() freezes program execution. I am unable to create a Nport component in an aedt circuit.

Program execution continues until this function call, then idles indefinitely.

Not sure if this is a bug, but help is be appreciated.

Steps To Reproduce

Code: import os from matplotlib import pyplot as plt import numpy as np import pyaedt

cir = pyaedt.Circuit(projectname=pyaedt.generate_unique_project_name(), new_desktop_session=False, non_graphical=False)

tdr1 = cir.modeler.components.components_catalog["Probes:TDR_Single_Ended"].place("tdr1")

print("Making Touchstone Component") nport1 = cir.modeler.components.create_touchsthone_component(model_name="dut.s4p") #dut.s4p is in the directory, I have also tried using the full path

Log: pyaedt INFO: using existing logger. pyaedt INFO: Launching PyAEDT outside AEDT with CPython and PythonNET. pyaedt INFO: AEDT installation Path C:\Program Files\AnsysEM\v221\Win64. pyaedt INFO: Launching AEDT with module PythonNET. pyaedt INFO: pyaedt v0.6.74 pyaedt INFO: Python version 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] pyaedt INFO: AEDT 2022.1.0 Build Date 2021-11-22 22:18:25 pyaedt INFO: Project Project_YUS has been created. pyaedt INFO: No design is present. Inserting a new design. pyaedt INFO: Added design 'Circuit Design_XW1' of type Circuit Design. pyaedt INFO: Aedt Objects initialized pyaedt INFO: Variable Manager initialized pyaedt INFO: Design Loaded pyaedt INFO: Materials Loaded pyaedt INFO: aedt file load time 0.010759592056274414 Making Touchstone Component

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

Installed packages

alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work argh==0.26.2 astroid @ file:///C:/b/abs_d4lg3_taxn/croot/astroid_1676904351456/work asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work atomicwrites==1.4.0 attrs @ file:///C:/b/abs_09s3y775ra/croot/attrs_1668696195628/work autopep8 @ file:///tmp/build/80754af9/autopep8_1615918855173/work Babel @ file:///C:/b/abs_a2shv_3tqi/croot/babel_1671782804377/work backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work bcrypt @ file:///C:/Windows/Temp/abs_36kl66t_aw/croots/recipe/bcrypt_1659554334050/work beautifulsoup4 @ file:///C:/b/abs_0agyz1wsr4/croot/beautifulsoup4-split_1681493048687/work black @ file:///C:/b/abs_620t6ndje8/croot/black_1680737261963/work bleach @ file:///opt/conda/conda-bld/bleach_1641577558959/work brotlipy==0.7.0 certifi @ file:///C:/b/abs_85o_6fm0se/croot/certifi_1671487778835/work/certifi cffi @ file:///C:/b/abs_49n3v2hyhr/croot/cffi_1670423218144/work chardet @ file:///C:/ci/chardet_1607690654534/work charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work click @ file:///C:/ci/click_1646056799533/work cloudpickle @ file:///C:/b/abs_3796yxesic/croot/cloudpickle_1683040098851/work clr-loader==0.2.5 colorama @ file:///C:/b/abs_a9ozq0l032/croot/colorama_1672387194846/work comm @ file:///C:/b/abs_1419earm7u/croot/comm_1671231131638/work contourpy==1.0.7 cryptography @ file:///C:/b/abs_8ecplyc3n2/croot/cryptography_1677533105000/work cycler==0.11.0 debugpy @ file:///C:/ci/debugpy_1637073815078/work decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work diff-match-patch @ file:///Users/ktietz/demo/mc3/conda-bld/diff-match-patch_1630511840874/work dill @ file:///C:/b/abs_42h_07z1yj/croot/dill_1667919550096/work docutils @ file:///C:/Windows/TEMP/abs_24e5e278-4d1c-47eb-97b9-f761d871f482dy2vg450/croots/recipe/docutils_1657175444608/work entrypoints @ file:///C:/ci/entrypoints_1649926621247/work executing @ file:///opt/conda/conda-bld/executing_1646925071911/work fastjsonschema @ file:///C:/Users/BUILDE~1/AppData/Local/Temp/abs_ebruxzvd08/croots/recipe/python-fastjsonschema_1661376484940/work flake8 @ file:///tmp/build/80754af9/flake8_1615834841867/work fonttools==4.39.4 future @ file:///C:/b/abs_3dcibf18zi/croot/future_1677599891380/work idna @ file:///C:/b/abs_bdhbebrioa/croot/idna_1666125572046/work imagesize @ file:///C:/Windows/TEMP/abs_3cecd249-3fc4-4bfc-b80b-bb227b0d701en12vqzot/croots/recipe/imagesize_1657179501304/work importlib-metadata @ file:///C:/b/abs_20ndzb2j6v/croot/importlib-metadata_1678997085534/work importlib-resources @ file:///tmp/build/80754af9/importlib_resources_1625135880749/work intervaltree @ file:///Users/ktietz/demo/mc3/conda-bld/intervaltree_1630511889664/work ipykernel @ file:///C:/b/abs_b4f07tbsyd/croot/ipykernel_1672767104060/work ipython @ file:///C:/b/abs_d1yx5tjhli/croot/ipython_1680701887259/work ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work isort @ file:///tmp/build/80754af9/isort_1628603791788/work jaraco.classes @ file:///tmp/build/80754af9/jaraco.classes_1620983179379/work jedi @ file:///C:/ci/jedi_1606914528444/work Jinja2 @ file:///C:/b/abs_7cdis66kl9/croot/jinja2_1666908141852/work jsonschema @ file:///C:/b/abs_6ccs97j_l8/croot/jsonschema_1676558690963/work jupyter_client @ file:///C:/b/abs_059idvdagk/croot/jupyter_client_1680171872444/work jupyter_core @ file:///C:/b/abs_9d0ttho3bs/croot/jupyter_core_1679906581955/work jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work keyring @ file:///C:/b/abs_dbjc7g0dh2/croot/keyring_1678999228878/work kiwisolver==1.4.4 lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1616529307648/work lxml @ file:///C:/b/abs_c2bg6ck92l/croot/lxml_1679646459966/work MarkupSafe @ file:///C:/ci/markupsafe_1654489871526/work matplotlib==3.7.1 matplotlib-inline @ file:///C:/ci/matplotlib-inline_1661934035815/work mccabe==0.6.1 mistune==0.8.4 more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work mypy-extensions==0.4.3 nbclient @ file:///C:/ci/nbclient_1650290386732/work nbconvert @ file:///C:/b/abs_4av3q4okro/croot/nbconvert_1668450658054/work nbformat @ file:///C:/b/abs_85_3g7dkt4/croot/nbformat_1670352343720/work nest-asyncio @ file:///C:/b/abs_3a_4jsjlqu/croot/nest-asyncio_1672387322800/work numpy==1.24.3 numpydoc @ file:///C:/b/abs_cfdd4zxbga/croot/numpydoc_1668085912100/work packaging @ file:///C:/b/abs_ed_kb9w6g4/croot/packaging_1678965418855/work pandocfilters @ file:///opt/conda/conda-bld/pandocfilters_1643405455980/work paramiko @ file:///opt/conda/conda-bld/paramiko_1640109032755/work parso==0.7.0 pathspec @ file:///C:/b/abs_9cu5_2yb3i/croot/pathspec_1674681579249/work pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work Pillow==9.5.0 pkgutil_resolve_name @ file:///C:/Users/BUILDE~1/AppData/Local/Temp/abs_81wm45v3kb/croots/recipe/pkgutil-resolve-name_1661463352381/work platformdirs @ file:///C:/b/abs_73cc5cz_1u/croots/recipe/platformdirs_1662711386458/work pluggy @ file:///C:/ci/pluggy_1648042776090/work plumbum==1.8.1 pooch==1.7.0 prompt-toolkit @ file:///C:/b/abs_6coz5_9f2s/croot/prompt-toolkit_1672387908312/work psutil @ file:///C:/Windows/Temp/abs_b2c2fd7f-9fd5-4756-95ea-8aed74d0039flsd9qufz/croots/recipe/psutil_1656431277748/work ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work pyaedt==0.6.74 pycodestyle @ file:///home/ktietz/src/ci_mi/pycodestyle_1612807597675/work pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work pydocstyle @ file:///C:/b/abs_6dz687_5i3/croot/pydocstyle_1675221688656/work pyflakes @ file:///home/ktietz/src/ci_ipy2/pyflakes_1612551159640/work Pygments @ file:///opt/conda/conda-bld/pygments_1644249106324/work pylint @ file:///C:/b/abs_83sq99jc8i/croot/pylint_1676919922167/work pyls-black @ file:///tmp/build/80754af9/pyls-black_1607553132291/work pyls-spyder @ file:///tmp/build/80754af9/pyls-spyder_1613849700860/work PyNaCl @ file:///C:/Windows/Temp/abs_d5c3ajcm87/croots/recipe/pynacl_1659620667490/work pyOpenSSL @ file:///C:/b/abs_552w85x1jz/croot/pyopenssl_1677607703691/work pyparsing==3.0.9 pyrsistent @ file:///C:/ci/pyrsistent_1636111468851/work PySocks @ file:///C:/ci/pysocks_1605287845585/work python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work python-jsonrpc-server @ file:///tmp/build/80754af9/python-jsonrpc-server_1600278539111/work python-language-server @ file:///tmp/build/80754af9/python-language-server_1607972495879/work pythonnet==3.0.1 pytoolconfig @ file:///C:/b/abs_18sf9z_iwl/croot/pytoolconfig_1676315065270/work pytz @ file:///C:/b/abs_22fofvpn1x/croot/pytz_1671698059864/work pyvista==0.39.0 pywin32==305.1 pywin32-ctypes==0.2.0 PyYAML==6.0 pyzmq @ file:///C:/b/abs_8b16zbmf46/croot/pyzmq_1682697651374/work QDarkStyle==2.8.1 QtAwesome @ file:///C:/b/abs_c5evilj98g/croot/qtawesome_1674008690220/work qtconsole @ file:///C:/b/abs_eb4u9jg07y/croot/qtconsole_1681402843494/work QtPy @ file:///C:/ci/qtpy_1662015036641/work requests @ file:///C:/b/abs_41owkd5ymz/croot/requests_1682607524657/work rope @ file:///C:/b/abs_55g_tm_6ff/croot/rope_1676675029164/work rpyc==5.3.1 Rtree @ file:///C:/b/abs_e116ltblik/croot/rtree_1675157871717/work scikit-rf==0.26.0 scipy==1.10.1 scooby==0.7.2 sip==4.19.13 six @ file:///tmp/build/80754af9/six_1644875935023/work snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1637937080595/work sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1623949099177/work soupsieve @ file:///C:/b/abs_a989exj3q6/croot/soupsieve_1680518492466/work Sphinx @ file:///C:/ci/sphinx_1657598970590/work sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work sphinxcontrib-htmlhelp @ file:///tmp/build/80754af9/sphinxcontrib-htmlhelp_1623945626792/work sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work sphinxcontrib-serializinghtml @ file:///tmp/build/80754af9/sphinxcontrib-serializinghtml_1624451540180/work spyder @ file:///C:/ci/spyder_1616776239898/work spyder-kernels @ file:///C:/ci/spyder-kernels_1614030842607/work stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work tinycss2 @ file:///C:/b/abs_52w5vfuaax/croot/tinycss2_1668168823131/work toml @ file:///tmp/build/80754af9/toml_1616166611790/work tomli @ file:///C:/Windows/TEMP/abs_ac109f85-a7b3-4b4d-bcfd-52622eceddf0hy332ojo/croots/recipe/tomli_1657175513137/work tomlkit @ file:///C:/Windows/TEMP/abs_3296qo9v6b/croots/recipe/tomlkit_1658946894808/work tornado @ file:///C:/ci/tornado_1662476991259/work traitlets @ file:///C:/b/abs_e5m_xjjl94/croot/traitlets_1671143896266/work typing_extensions @ file:///C:/b/abs_a1bb332wcs/croot/typing_extensions_1681939523095/work ujson @ file:///C:/ci/ujson_1657525943778/work urllib3 @ file:///C:/b/abs_3ce53vrdcr/croot/urllib3_1680254693505/work vtk==9.2.6 watchdog @ file:///C:/ci/watchdog_1612471251191/work wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work webencodings==0.5.1 win-inet-pton @ file:///C:/ci/win_inet_pton_1605306167264/work wrapt @ file:///C:/Windows/Temp/abs_7c3dd407-1390-477a-b542-fd15df6a24085_diwiza/croots/recipe/wrapt_1657814452175/work yapf @ file:///tmp/build/80754af9/yapf_1615749224965/work zipp @ file:///C:/b/abs_b9jfdr908q/croot/zipp_1672387552360/work

ryand323 commented 1 year ago

Are there any updates to this issue request?

Samuelopez-ansys commented 1 year ago

Hi @ryand323 ,

Please try to import the NPort manually to verify it is not a problem, of the file.

I have tried with this one:

https://github.com/ansys/pyaedt/blob/main/_unittest/example_models/T21/SSN_ssn.s6p

And it works perfectly: circuit

ryand323 commented 1 year ago

It does appear to be related to the s-parameter files being imported. SSN_ssn.s6p imported correctly with pyaedt into the circuit simulator.

Opening up the touchsone files for comparison, it appears SSN_ssn.s6p is an exported file from aedt:

! Touchstone file exported from HFSS 3D Layout Design 2021.2.0 ! File: D:/Simulation/SSN.aedt ! Generated: 12:36:15 PM Feb 18, 2021 ! Design: ssn ! Project: SSN ! Setup: SYZ Sweep 1 ! Solution: SYZ Sweep 1 ! (Pound Sign Removed for Github Markup) GHz S MA R 50.000000 ! Terminal data exported ! Port[1] = A-MII-RXD1_30_SQFP28X28_208_U1 ! Port[2] = A-MII-RXD1_65_SQFP20X20_144_U7 ! Port[3] = A-MII-RXD2_32_SQFP28X28_208_U1 ! Port[4] = A-MII-RXD2_66_SQFP20X20_144_U7 ! Port[5] = A-MII-RXD3_33_SQFP28X28_208_U1 ! Port[6] = A-MII-RXD3_67_SQFP20X20_144_U7 0 0.00298166409530576 0 0.997018335804667 0 9.71569326119175E-06 0 9.71569326119176E-06 180
9.71553401690422E-06 0 9.71553398912824E-06 180
0.997018335804667 0 0.00298166409530576 0 9.71569326119175E-06 180 9.71569326119175E-06 0
9.71553398921538E-06 180 9.71553401684487E-06 0
9.71569326119175E-06 0 9.71569326119175E-06 180 0.00299134546858548 0 0.997008654431399 0
9.71543966877399E-06 0 9.71543965339285E-06 180
9.71569326119176E-06 180 9.71569326119175E-06 0 0.997008654431399 0 0.0029913454685857 0
9.71543965340107E-06 180 9.71543966877518E-06 0
9.71553401690422E-06 0 9.71553398921538E-06 180 9.71543966877399E-06 0 9.71543965340107E-06 180
0.00300768812298791 0 0.996992311774038 0
9.71553398912824E-06 180 9.71553401684487E-06 0 9.71543965339285E-06 180 9.71543966877518E-06 0
0.996992311774038 0 0.00300768812300545 0

The s-parameter file I would like to use comes from a VNA measurement. The way data is formatted is quite a bit different, not to mention different units.

!Date: Tuesday, April 25, 2023 08:31:13 !Correction: S11(C 4-Port ) !S12(C 4-Port ) !S13(C 4-Port ) !S14(C 4-Port ) !S21(C 4-Port ) !S22(C 4-Port ) !S23(C 4-Port ) !S24(C 4-Port ) !S31(C 4-Port ) !S32(C 4-Port ) !S33(C 4-Port ) !S34(C 4-Port ) !S41(C 4-Port ) !S42(C 4-Port ) !S43(C 4-Port ) !S44(C 4-Port ) !S4P File: Measurements: <S11,S12,S13,S14>, !<S21,S22,S23,S24>, !<S31,S32,S33,S34>, !<S41,S42,S43,S44>: (Pound Sign Removed for Github Markup) Hz S dB R 50 10000000 -38.25531 -78.733177 -0.025349155 0.015774187 -63.130737 83.516792 -71.892441 -98.401344 -0.021411726 0.032946281 -39.054512 -74.961319 -72.006302 -100.13907 -62.459106 81.599861 -63.774036 84.543793 -73.498238 -101.85165 -38.741035 -78.042351 -0.027126838 0.00080163183 -74.801346 -98.826355 -63.534279 83.437126 -0.025177831 0.0071976553 -40.113575 -74.683968

Does the pyaedt function only accept files with the AEDT formatting and that is all this issue is?

Samuelopez-ansys commented 1 year ago

@ryand323 Did you try to import this VNA touchstone in Circuit manually?

Because if it does not work, you should contact the Ansys support to help you because it is related to AEDT.

pyAEDT accepts the same that Aedt accepts, if in AEDT works please share the file, because one solution could be formatting the file.

ryand323 commented 1 year ago

@Samuelopez-ansys The VNA touchstone s-parameters can be loaded into circuit manually. It does not load with pyaedt. The AEDT and Keysight files are delimited very different, perhaps this is a python problem. See the attached s4p file. Keysight_VNA_microstrip.zip