Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Setup.props Attribute in HFSS Models Containing Encrypted Components #5691

Open
2 tasks done
chamanth-vct opened this issue Jan 24, 2025 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@chamanth-vct
Copy link

chamanth-vct commented Jan 24, 2025

Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

Hi, I am working with two HFSS models where the Solve Type is set to Multiple Frequencies. The only difference between the two models is:

  • One model is normal (unencrypted).
  • The other model contains a few encrypted components, while the rest remains the same.

Both models can be downloaded from the link, folder structure is shown below:

aedt_issue_test_data_two
      ├── with_encryption
      │           └── Project3.aedt
      └── no_encryption
                    └── Project3.aedt

I aim to create field plots and export them for individual objects. Below is the code snippet I am using:

import ansys.aedt.core 
from pathlib import Path

#folder_path = Path(r"C:\aedt_issue_test_data_two\no_encryption")
folder_path = Path(r"C:\aedt_issue_test_data_two\with_encryption")
file_path =  folder_path.joinpath("Project3.aedt")

exports_folder_path = folder_path.joinpath("exports_folder")
exports_folder_path.mkdir(parents=True,exist_ok=True)

result_folder = exports_folder_path.joinpath("result_folder")
result_folder.mkdir(parents=True,exist_ok=True)

desktop = ansys.aedt.core.Desktop() 
prj= desktop.load_project(file_path.__str__())
prj.set_auto_open(enable=False)
model = prj.modeler
part_names = model.object_names
post = prj.post  # post_processor

#print(prj.setups[0].props)

if prj.setups[0].props['SolveType'] == 'MultiFrequency':
    available_frequencies = prj.setups[0].props['MultipleAdaptiveFreqsSetup']['AdaptAt']

part_list = ['Ground','Pin','Cylinder6','Dielectric'] 

intrinsics = prj.setups[0].default_intrinsics
intrinsics["Freq"] = available_frequencies[0]['Frequency']

for name in part_list:

    obj =  model.get_object_from_name(name)
    
    if obj.solve_inside:
        h_field_plot = post.create_fieldplot_volume([name],quantity="Vector_H",
                                                    plot_name="H_vector_plot",
                                                    intrinsics=intrinsics)
    else:
        h_field_plot = post.create_fieldplot_surface(obj.faces,quantity="Vector_H",
                                                    plot_name="H_vector_plot",
                                                    intrinsics=intrinsics)


    result_file_name = result_folder.joinpath(name+'_h_vector')
    export_status = post.export_field_plot(plot_name = "H_vector_plot",
                            output_dir = exports_folder_path,
                            file_name = result_file_name.__str__(),
                            file_format = 'case')

    if export_status:
        print(f"\tExported H_Vector")
    else:
        print(f"\tNot Exported H_Vector")

    h_field_plot.delete()
prj.close_project()
desktop.close_desktop()

Issue:

The code works perfectly for the unencrypted model. However, when used with the encrypted model, the code fails at line 23, specifically when accessing the prj.setups[0].props attribute of the setup object.

Observations:

  • When an encrypted component is present in the model, the prj.setups[0].props attribute returns empty dictionary instead of the expected dictionary containing the setup properties (documentation_link).

  • This prevents retrieval of available frequencies and subsequently breaks any Python scripts that rely on prj.setups[0].props for post-processing.

  • This behavior has been consistently observed across multiple HFSS models with encrypted components.

Questions:

  • Am I missing any steps or configurations in the code?
  • Are there any alternative methods to retrieve frequency data from encrypted models?

Your guidance on this issue would be greatly appreciated.

Thank you

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

annotated-types==0.7.0
ansys-pythonnet==3.1.0rc3
asttokens==2.4.1
attrs==24.2.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
clr-loader==0.2.6
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cycler==0.12.1
debugpy==1.8.5
decorator==5.1.1
defusedxml==0.7.1
exceptiongroup==1.2.2
executing==2.1.0
fonttools==4.53.1
fpdf2==2.7.9
idna==3.10
ipykernel==6.29.5
ipython==8.27.0
jedi==0.19.1
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_client==8.6.3
jupyter_core==5.7.2
kiwisolver==1.4.7
llvmlite==0.43.0
matplotlib==3.9.2
matplotlib-inline==0.1.7
nest-asyncio==1.6.0
numba==0.60.0
numpy==1.26.4
packaging==24.1
pandas==2.2.2
parso==0.8.4
pillow==10.4.0
platformdirs==4.3.6
plumbum==1.8.3
pooch==1.8.2
prompt_toolkit==3.0.47
psutil==6.0.0
pure_eval==0.2.3
pyaedt==0.13.2
pycparser==2.22
pydantic==2.9.2
pydantic_core==2.23.4
pyedb==0.31.0
Pygments==2.18.0
pyparsing==3.1.4
python-dateutil==2.9.0.post0
pytomlpp==1.0.13
pytz==2024.2
pyvista==0.44.1
pywin32==306
PyYAML==6.0.2
pyzmq==26.2.0
referencing==0.35.1
requests==2.32.3
rpds-py==0.20.0
rpyc==6.0.0
Rtree==1.3.0
scikit-rf==1.3.0
scipy==1.14.1
scooby==0.10.0
six==1.16.0
stack-data==0.6.3
toml==0.10.2
tomli==2.2.1
tomli_w==1.1.0
tornado==6.4.1
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.3
vtk==9.3.1
wcwidth==0.2.13
@chamanth-vct chamanth-vct added the bug Something isn't working label Jan 24, 2025
@chamanth-vct
Copy link
Author

chamanth-vct commented Jan 24, 2025

In the case of an encrypted model:

  • The props attribute is empty.
  • From version 0.13.0, a new attribute called properties was introduced.

Single Frequency Solve Type:

For models with a single frequency solve type, the solution frequency can be retrieved using the properties attribute, as highlighted in this comment (Link).

Multiple Frequency Solve Type:

For models with a multiple frequency solve type, the solution frequency is represented as "Multiple" as shown below. Unfortunately, in such cases, we are unable to retrieve specific frequency values even using the properties attribute.

{'Name': 'MySetupAuto',
 'Enabled': True,
 'Passes': '3',
 'Percent Refinement': '30',
 'Solution Freq': 'Multiple',
 'Basis Order': 'First Order',
 'Basis Order/Choices': ['Mixed Order',
  'Zero Order',
  'First Order',
  'Second Order'],
 'Max Refinement': '1000000',
 'Use Max Refinement': False,
 'Use ABC On Ports': False,
 'Solver Type': 'Direct Solver',
 'Solver Type/Choices': ['Direct Solver',
  'Iterative Solver',
  'Domain Solver',
  'Auto Select Direct/Iterative'],
 'Use ABC During Adaptive Passes FEBI': False}

@chamanth-vct
Copy link
Author

chamanth-vct commented Jan 31, 2025

Hi @gmalinve,

I hope you’re doing well!

I’m following up on this issue. After conducting further testing and research, I’ve summarized my observations in a structured manner. Your insights on this would be greatly appreciated whenever you have a moment.

Objective:

My primary goal is to automate the generation and export of field plots using PyAEDT. To achieve this, I use the create_fieldplot_surface() (link) or create_fieldplot_volume()(link) methods. These functions require the intrinsics parameter, where frequency and phase need to be passed as a dictionary for the successful generation of field plots.

I had assumed it would be possible to retrieve all available frequencies programmatically using PyAEDT, as displayed in the "Create Field Plot" GUI window (illustrated in the figure). However, I noticed some inconsistencies in accessing these frequencies under different scenarios.

Observations:

I rely on the prj.setup[0].props (link)and prj.setup[0].properties(link) attributes to retrieve frequencies. However, their behavior varies depending on whether the model contains encrypted components or not. Below is a detailed summary of my findings for HFSS, categorized by solve type (Single, Multi, Broadband) and encryption status.

Solve Type prj.setup[0].props prj.setup[0].properties Frequency_Retrieval Frequency Availability
No Encrypted Components Single ✅ Available ✅ Available
frequency = prj.setup[0].props['Frequency'] 
Multi ✅ Available ✅ Available
available_frequencies  = prj.setup[0].props['MultipleAdaptiveFreqsSetup']['AdaptAt']
frequencies = [item['Frequency'] for item in available_frequencies]
Broadband ✅ Available ✅ Available
available_frequencies  = prj.setup[0].props['MultipleAdaptiveFreqsSetup']
low_freq = available_frequencies['Low']
high_freq = available_frequencies['High']

prj.setup[0].properties['Solution Freq'] --> returns "Multiple"

Retrieves Low and High frequencies but not the one shown in the "Create Field Plot" GUI window.
With Encrypted Components Single ❌ Empty ✅ Available props is empty, however, we can get frequency from properties
frequency = prj.setup[0].properties['Solution Freq']
Multi ❌ Empty ✅ Available props is empty
prj.setup[0].properties['Solution Freq'] --> returns "Multiple"
Broadband ❌ Empty ✅ Available props is empty
prj.setup[0].properties['Solution Freq'] --> returns "Multiple"

Key Observations:

  1. When a model contains encrypted components, prj.setup[0].props is always empty.
  2. For the multiple frequency encrypted case, frequencies are not accessible.
  3. In the broadband case, frequencies are unavailable in both encrypted and non-encrypted scenarios.
  4. These limitations prevent me from automating the generation and export of field plots because I cannot programmatically retrieve the frequencies displayed in the "Create Field Plot" GUI window.

Is there any alternative way to retrieve the frequencies using PyAEDT?

Your feedback would be invaluable. Thank you for your time and support!

Test Data:

All the models can be downloaded from the link, folder structure is shown below:

aedt_issue_test_data_three/
	│── no_encryption/
	│        ├── single_frequency/
	│        │            └── Project3.aedt
	│        ├── multiple_frequency/
	│        │            └── Project3.aedt
	│        └── broadband/
	│                     └── Project3.aedt
	│
	└── with_encryption/
	         ├── single_frequency/
	         │            └── Project3.aedt
	         ├── multiple_frequency/
 	         │            └── Project3.aedt
	         └── broadband/
	                      └── Project3.aedt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant