You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output variable f seems to have different values than the input variable f. This causes the extracted variables from Ansys to have different values than expected.
Long description
Investigate why this happened.
Replacing f by some other name (or worse, by hard-coding 50) is not an option because we may encounter it again in the future.
Try to understand whether it may happen for other variables.
Is there any check possible for this behaviour?
Before starting the PR or fixing the issue, post the summary in this issue in proper Markdown formatting.
Tested several candidate names by assigning them the same value and comparing against a hardcoded reference. f, freq, R, Temp gave wrong results, t, w, V, I, L, fr behaved correctly. Matches the documented list exactly.
Time vs time
Time (capitalized) is required in output variable expressions, time (lowercase) in the winding excitation source, not interchangeable.
Variables we actually use
Tested InitPos, f, RotSpeed, Nper, PointPer, PolePairs, RotSign, Rstat, Lew for real, not just against the list. All correct except f.
Separate bug found along the way
A normal Computation2 run crashes in extract_results(): solutions.data_real() returns a plain list, and the code does an in-place division for unit conversion, which lists don't support. Likely the "main does not run" issue, opened a separate PR fixing it.
Proposed check
Compare a candidate variable name against the documented list (case insensitively) before pushing it to AEDT.
@saxik13 Can you please check this? Haitao claims that having f in the expression for the output variables does not work because it is protected (see the link above). Actually, it works, but the value is taken from some other variable, so instead of erroring, it gives a nonsensical answer.
@haitao-ZCU Can you please provide Honza the code (here) where you substituted 50 for f and it gave you a different answer?
Not sure where the problem could be. I use the variable "f" for the frequency definition in models and it is without problems.
I can imagine that if you input f=50 Hz and try to output f from Ansys, you get f=50e-9. It is problem of Default units in Ansys (GHz) (I commented in Issue #25) But it is not the problem you are facing right now
@saxik13 This is not a problem with units almost for sure. Haitao has changed f to fr everywhere in the inputs and outputs, starting from
"f": "50Hz",
to
"fr": "50Hz",
The output for this change is different. This implies to me that it is unsafe for ANY computation to use f (or any other variable used in Haitao's link) because there is probably some overwriting of variables (it seems after the Ansys solution happens and before they are accessed by pyaedt).
There are some Postprocessing variables (such as Freq or Time) which cannot be set by the user and if it happens, the call returns an error (tried both while changing f to Freq and freq). The problem may be that F is Frequency of the circuit/system analysis and this value gets accessed by pyaedt.
This problem may potentially affect other projects as well. I think that changing f to something else is the minimum change we must do. Any ideas?
One more thing. It seems that Ansys is case-insensitive for variables (even though Google told me otherwise). That goes back to the difference between time and Time Haitao mentioned and which Vasek highlighted. When we changed time to Time in the equation
there were no changes in the results (making the original Haitao's assessment 3 probably wrong). It probably makes sense because we never define time or Time.
Update on point 3 (Time vs time, I wrote in the first comment.):
after switching f to fr. Time and time give the same results in both dIA_dt..dIE_dt and I_A..I_E. So they are interchangeable here, this point was wrong.
I agree that the simplest solution is not to use "f" as a variable. Its only usage is to be multiplied by 2pi and for the definition of the rotating speed of the model. We can directly use w as w=2pi*f.
It is true that it seems like for the variables, Ansys is case insensitive, and we should avoid the names from that list...
@haitao-ZCU I think that we are ready now for a PR. I think we should continue (along with the suggestion of Honza) by doing:
Remove f by created a new variable w, which is 2.pi.f. Check that it can be replaced everywhere.
Unify time and Time.
Get a list of variables from the webpage (I would probably add all or at least the most important ones) and write checks that they do not appear in (the keys of) the dictionaries which we have there. If so, there should be an error. This should be a general property in one fo the base classes and the checks should be performed automatically. Write some tests for this behaviour.
@sadda Agreed. I'll open a branch for this and start with removing f in favor of w = 2pif, then unify time/Time, and finally add the reserved-variable check with tests. It should be 3 PRs for these three items.
Activity
haitao-ZCU commentedon Sep 3, 2026
What I have investigated:
freads incorrectly because it conflicts with Ansys Maxwell's own intrinsic variable names. Maxwell reserves several intrinsic names, includingF,Freq,R,Temp, and more (https://ansyshelp.ansys.com/public/Views/Secured/Electronics/v242/en/Subsystems/Maxwell/Content/UsingIntrinsicVariables.htm). Matching is case insensitive, sofandfreqconflict with these reserved names.Tested several candidate names by assigning them the same value and comparing against a hardcoded reference.
f,freq,R,Tempgave wrong results,t,w,V,I,L,frbehaved correctly. Matches the documented list exactly.TimevstimeTime(capitalized) is required in output variable expressions,time(lowercase) in the winding excitation source, not interchangeable.Tested
InitPos,f,RotSpeed,Nper,PointPer,PolePairs,RotSign,Rstat,Lewfor real, not just against the list. All correct exceptf.A normal
Computation2run crashes inextract_results():solutions.data_real()returns a plain list, and the code does an in-place division for unit conversion, which lists don't support. Likely the "main does not run" issue, opened a separate PR fixing it.Compare a candidate variable name against the documented list (case insensitively) before pushing it to AEDT.
sadda commentedon Sep 3, 2026
@saxik13 Can you please check this? Haitao claims that having
fin the expression for the output variables does not work because it is protected (see the link above). Actually, it works, but the value is taken from some other variable, so instead of erroring, it gives a nonsensical answer.@haitao-ZCU Can you please provide Honza the code (here) where you substituted
50forfand it gave you a different answer?haitao-ZCU commentedon Sep 4, 2026
of course.
Here is the repro script: https://github.com/AI-RICE/MachineDesign/blob/diagnose/f-vs-50-repro/notebooks/diagnose_f_confirm.py
It pushes diag_coeff_50 (hardcoded 50) and diag_coeff_f (symbolic f) as output variables computing the same coefficient, they should match but diag_coeff_f comes out 50x smaller, as if f were 1.
sadda commentedon Sep 4, 2026
@haitao-ZCU Thanks, can you also paste the actual results (output of the script), please?
haitao-ZCU commentedon Sep 4, 2026
Sure, results are:
saxik13 commentedon Sep 4, 2026
Not sure where the problem could be. I use the variable "f" for the frequency definition in models and it is without problems.
I can imagine that if you input f=50 Hz and try to output f from Ansys, you get f=50e-9. It is problem of Default units in Ansys (GHz) (I commented in Issue #25) But it is not the problem you are facing right now
sadda commentedon Sep 4, 2026
@saxik13 This is not a problem with units almost for sure. Haitao has changed
ftofreverywhere in the inputs and outputs, starting fromto
The output for this change is different. This implies to me that it is unsafe for ANY computation to use
f(or any other variable used in Haitao's link) because there is probably some overwriting of variables (it seems after the Ansys solution happens and before they are accessed by pyaedt).There are some Postprocessing variables (such as
FreqorTime) which cannot be set by the user and if it happens, the call returns an error (tried both while changingftoFreqandfreq). The problem may be thatFis Frequency of the circuit/system analysis and this value gets accessed by pyaedt.This problem may potentially affect other projects as well. I think that changing
fto something else is the minimum change we must do. Any ideas?sadda commentedon Sep 4, 2026
One more thing. It seems that Ansys is case-insensitive for variables (even though Google told me otherwise). That goes back to the difference between
timeandTimeHaitao mentioned and which Vasek highlighted. When we changedtimetoTimein the equationthere were no changes in the results (making the original Haitao's assessment 3 probably wrong). It probably makes sense because we never define
timeorTime.haitao-ZCU commentedon Sep 4, 2026
Update on point 3 (Time vs time, I wrote in the first comment.):
after switching f to fr. Time and time give the same results in both dIA_dt..dIE_dt and I_A..I_E. So they are interchangeable here, this point was wrong.
saxik13 commentedon Sep 4, 2026
I agree that the simplest solution is not to use "f" as a variable. Its only usage is to be multiplied by 2pi and for the definition of the rotating speed of the model. We can directly use w as w=2pi*f.
It is true that it seems like for the variables, Ansys is case insensitive, and we should avoid the names from that list...
sadda commentedon Sep 4, 2026
@haitao-ZCU I think that we are ready now for a PR. I think we should continue (along with the suggestion of Honza) by doing:
fby created a new variablew, which is 2.pi.f. Check that it can be replaced everywhere.timeandTime.haitao-ZCU commentedon Sep 4, 2026
@sadda Agreed. I'll open a branch for this and start with removing f in favor of w = 2pif, then unify time/Time, and finally add the reserved-variable check with tests. It should be 3 PRs for these three items.
sadda commentedon Sep 10, 2026
This was resolved in 32, 33 and 34.