shredEngineer / MagnetiCalc

MagnetiCalc calculates the magnetic field of arbitrary coils.
https://paulwilhelm.de/magneticalc/
Other
45 stars 4 forks source link

[feature] allow calculating or visualizing field in an arbitrary plane only #11

Closed prof7bit closed 2 years ago

prof7bit commented 2 years ago

I would like to be able to visualize the field in one specific plane only, currently I cannot find any way to do this.

Example:

I have a complicated wire loop located flat on the XY plane. A real world example would be for example the boundary wire of a robot lawn mower.

Now I want to visualize what the sensor in the mower is actually seeing, the sensor is always located in a plane of maybe 7 centimeters above the wire loop (or even more if the wire is buried below the surface).

For simulating this I would want to design the wire loop in plane XY and then I would need some way to specify another arbitrary plane (in my case the plane 7cm above the ground) and plot the field only in this plane.

Bonus-killer-feature: It would highlight with colors the points in this plane where the field vector is parallel to that plane because this would be where the mower would think the wire is located. Maybe some kind of heat map where the color depends on the Z-component of the vector (or any other parameter of the field to make it more universal) and then be able to export this 2d heat map as an image. This would be extremely useful.

shredEngineer commented 2 years ago

I would like to be able to visualize the field in one specific plane only, currently I cannot find any way to do this.

Option 1: Use the Override Padding dialog!

Option 2: Use the Constraint Editor!

Bonus-killer-feature: It would highlight with colors the points in this plane where the field vector is parallel to that plane [...]

I'm, not 100% sure, but it sounds to me that the already existing metric "Magnitude Z" would accomplish that? :) Like, it is parallel to the Z-plane when the magnitude in the Z-direction vanishes.

EDIT: I have fixed another bug related to Python 3.10's more strict type checking. Please pull the repo again!

prof7bit commented 2 years ago

Oh, so it is indeed hidden behind the "override..." Button. I already suspected this but nothing happened when clicking it, no dialog popped up and no error message. I will try again tomorrow. It might also be because I tried patching the source in a few places to prevent the tracebacks, maybe I broke something. I'll try again tomorrow.

shredEngineer commented 2 years ago

Indeed, the "Override Padding" dialog was broken. Should've produced an error on your side, but who knows. :) It is now fixed! Waiting for your feedback.

Have a great evening!

shredEngineer commented 2 years ago

@prof7bit Hi, were you able to achieve your desired calculation? If so, I would go on and close this issue.

Have a great one! :)

prof7bit commented 2 years ago

Sorry, I didn't answer anymore.

Shortly after I tried MagnetiCalc I had the idea to write my own tool for my very specific purpose, I didn't need all the many options that it provides, instead I wanted something very easy to use and only for this one specific purpose.

So I created this: https://github.com/prof7bit/mower-boundary-simulator

There is absolutely nothing to configure, only a dropdown to select one of the model files, and it immediately begins plotting a heatmap to visualize the vertical component of the field in a certain height above the boundary wire loop. It ignores all units and assumes µ0/4pi = 1, so it outputs just some number with some unknown (unimportant) scaling factor, the only thing I need are colors.

It produces images like these: 2022-07-22_15-26

And this is absolutely enough for the demonstration purpose I need.

So I guess this bug can probably be closed

shredEngineer commented 2 years ago

Alright, I'm glad you were able to achieve your goal!

BTW: Wow, it's been some time since I developed in Pascal! 😁 Looks nice.