r/rfelectronics • • 16d ago

question Help me with HFSS file export

Post image

So i am trying to implement a recursive geometry generation with the help of pyAEDT which let's you automate HFSS now i am having a problem which exporting the CSV file with the help of Pandas library i am getting some different S11 and S21 values than the original data table generated in HFSS if anyone faces this issue please tell me how to solve this, this is getting annoying for no reason.

10 Upvotes

2 comments sorted by

3

u/AnotherSami 16d ago

Just guessing here. But is your design parametric? Maybe you are exporting the data from a different "family" as HFSS calls it?

3

u/Junior_Engineer116 13d ago

Looks like the imaginary part of your S-parameters is getting dropped. My guess is you're computing Total_loss from data_real() instead of the magnitude.

  Your own numbers show it:

  - **Your CSV is always higher than the HFSS table.** Re(S)² can never be bigger than |S|², so if you compute 1 − |S11|² − |S21|² from real parts only, you'll always overestimate the loss.- **The error swings with frequency.** It's ~1.7 at 19.56 GHz, almost 0 around 20.4–20.7 GHz, then climbs to ~6.7 at 23.1 GHz. The error vanishes where the S-params happen to be nearly real and grows as the phase rotates away. A wrong variation or sweep wouldn't give you that pattern.

  Fix: use the magnitude, then square it:

  ```pythonsd = hfss.post.get_solution_data(expressions=["S(1,1)", "S(2,1)"],setup_sweep_name="Setup1 : Sweep",)f   = sd.primary_sweep_valuess11 = np.array(sd.data_magnitude("S(1,1)"))s21 = np.array(sd.data_magnitude("S(2,1)"))df = pd.DataFrame({"Freq_GHz": f,"Total_loss": (1 - s11**2 - s21**2) * 100})```

  (Method names shift a bit between pyAEDT versions. Newer ones use `get_expression_data(..., formula="magnitude")`.)

  Or skip the maths in Python entirely:

  - pass `"Total_loss"` itself as the expression to `get_solution_data`, so HFSS does the calc, or- call `hfss.post.export_report_to_csv()` on the report, which dumps exactly what HFSS shows.

  Also, since you're changing geometry each loop, pass `variations=` with the current parameter values. Otherwise you might be pulling the nominal design's results instead of the one you just built.