Skip to content

Replace design variable f with w to avoid Ansys intrinsic variable co… - #30

Merged
sadda merged 3 commits into
mainfrom
16-replace-f-with-w
Sep 8, 2026
Merged

sadda merged 3 commits into
mainfrom
16-replace-f-with-w

Conversation

@haitao-ZCU

@haitao-ZCU haitao-ZCU commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator
  • Replace the design variable f with w = 2*pi*f in motor2's output variable formulas (dIA_dt--dIE_dt) and excitation formulas (I_A--I_E), and in oper_params. f collides with Ansys's reserved intrinsic variable name and gets misread when used inside output variable expressions.
  • computation.py's create_setup() still hardcodes Nper/f and 1/(f*(PointPer-1)) for StopTime/TimeStep, shared with motor1. Extracted these into stop_time_expr()/time_step_expr() so motor1 keeps the original f-based formulas unchanged, while motor2 overrides them with w-based ones.
  • Verified that w reads back correctly through an output variable (equal to 2*pi*50), and that dIA_dt/Torque results are unchanged compared to a previous test where f was renamed to fr everywhere.
  • Updated test_design2.py to match the new oper_params.

@haitao-ZCU haitao-ZCU linked an issue Sep 4, 2026 that may be closed by this pull request
@sadda

sadda commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@haitao-ZCU Please resolve the conflicts created by the merged PR:29. Basically, just copy the changes from motor2.py and test_design2.py into the new files.

@sadda

sadda commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

@haitao-ZCU We do not want to use the default expression "Nper/f" because it contains f, which will be disallowed in a subsequent PR. I think we should remove the definition of the children stop_time_expr and time_step_expr and move them to the parent.

@sadda
sadda merged commit 74396ba into main Sep 8, 2026
6 checks passed
@haitao-ZCU

Copy link
Copy Markdown
Collaborator Author

@sadda
Agreed.

I have moved stop_time_expr/time_step_expr into the parent class as suggested, and it uses w now.
I also verified this modification does not change the results for motor1, I ran the old f based formula and the new w based one side by side across 3 structures (60 points total) and compared TorAvg and TorRippleRms. The results are same between f and w. I have attached the csv.
f_vs_w_motor1.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants