Skip to content

Pl mg - #69

Open
poli-machines wants to merge 10 commits into
mainfrom
pl_mg
Open

poli-machines wants to merge 10 commits into
mainfrom
pl_mg

Conversation

@poli-machines

Copy link
Copy Markdown
Collaborator
  • added deleting magnets
  • creating new motion setup (to insert magnets into the band)
  • created own run_mag

@poli-machines
poli-machines requested a review from sadda October 15, 2026 11:28
@sadda

sadda commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

@poli-machines Please do the following:

  • Write a proper description of the PR. I need to understand from the description what the PR does. Check the PRs of Haitao.
  • Give me some basic results from running the run_mag.py file, including the designs. We should have a function plotting the designs in Geometry, if not, write it please. If it exists, but does not include plotting magnets, add it.
  • I guess there are some bugs (delete_magnets is never called) and inefficiencies (set_magnets is called twice). Give the code more care.
  • Add a safety check that the magnets are not sticking out of the barriers.
  • Do I understand correctly that add_rotor_magnet (from an older PR) modifies the magnets? If so, this should not be so. It is supposed to just place the materials there. Or am I missing something?

@poli-machines

Copy link
Copy Markdown
Collaborator Author

@sadda
This PR:

  • plot_barrier is modified to draw not only the barriers but magnets too if they are available
  • reassign_motion_setup is created to refresh existing motion_setup. It helps magnets to appear inside of the Band for correct calculation. It works like this: checking if motion_setup exits - if yes, delete it and creating new one and putting magnets inside of it.
  • delete_magnets were moved inside of delete_rotor and now magnets are deleted with rotor after calculation

@sadda

sadda commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

@poli-machines Please take notes during our meetings. Many of the things I asked you to do have not been finished. I made a review of the PR, and the following should be answered/incorporated first:

  • Refer to my comments written earlier in the thread and provide some answers and changes to the code. Most of them were not incorporated.
  • Please provide examples of how it works, including pictures and some numerical results. There should be at least two instances run in the loop, so that the verification of the magnet deletion is confirmed. The results should also compare the same design with and without magnets.
  • Why is the deletion of the magnet coordinate systems not in delete_rotor? This causes clutter in _create_magnet_cs.
  • The magnets should be tracked instead of searching for "Magnet". This may cause the deletion of objects which we do not want to be deleted.
  • The magnets are still shrunk in add_rotor_magnet. This method should just add the magnets and nothing else.
  • The magnet generators are a bit problematic since they are ad hoc and can overlap with the barriers. There should be some checks. The variable margin should be a keyword argument. But I guess that this is the lowest priority because we will change to a different magnet anyway.
  • What is the reason for having reassign_motion_setup? What happens if it is not called?

@poli-machines

poli-machines commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Summary

This PR adds support for removing magnets and for inserting new magnets into the band through a dedicated motion_setup. It also introduces a custom run_mag routine so that magnet operations run through our own logic instead of changing default run.py.

Changes

Deleting magnets and their coordinate systems

  • Added the ability to remove magnets from the model.
  • Using delete_rotor to remove existing magnets with theirs CS from model

New motion setup for inserting magnets into the band

  • Created a new motion setup that handles moving magnets into position in the band.
  • When magnets are created they are not automatically inserted into the Band for correct calculation, so I delete old one and create new motion_setup with magnets in there.

Custom run_mag

  • Used to compile models with magnets in it without changing default run.py which is used y other users.

Changes in add_rotor_magnets

  • This def was shrinking magnets, now magnets are filling the whole barrier
  • It takes points which are generated inside of generate_magnets, finds the center of them and then it is used for coordinate system to set right direction of magnetization
  • There is small change in generate_magnets - margin is now argument.

Comparing models with and without magnets

  • Models without magnets have lower torque and higher ripple
  • Adding magnets inside of the barriers increase torque and decreasing ripple.

Comparison

  • Comparison of torque and ripple by computing 10 design
Screenshot 2026-10-29 103549 output

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