NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

MagnetFun

by Jerry James (Submitted: 02/18/2003)

[screen shot]

Download MagnetFun
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)

This model mimics the behavior of a magnet suspended over other magnets fixed on a surface such that the suspended magnet
is attracted by the fixed ones, but cannot contact them. The resulting motion of the suspended magnet is random.

In this model the suspended magnet, called the bob, is a turtle which slides among the fixed magnets, but is not "allowed"
to collide with them. The bob can act like a pendulum with simple harmonic motion by setting the force attracting the bob
to the center to a non-zero value. Unlike a pendulum the bob does not separate vertically from the fixed magnets as it
"swings" away from its equilibrium point.

The number of fixed magnets can be varied from 0 to 10. The magnetic force between each fixed magnet and the bob can be varied,
but is the same for all fixed magnets.

How to Play

Before pressing the Setup button:

Select the number of fixed magnets using the slider "NumMagnets".

Select the minimum and maximum distance from the center to locate the fixed magnets using the sliders "MagMaxRadius"
and "MagMinRadius". If the maximum is set to less than the minimum, it defaults to the minimum and all magnets
will be placed at that same distance. Otherwise they are randomly placed within the range specified.

Select the magnetic strenth to apply using slider "MagStrength". If it is set to zero, only the "gravity" force
on the bob will attract it and the bob will simply move back and forth.

Select the minimum and maximum distance from the center to locate the bob using the sliders "bobMaxRadius"
and "bobMinRadius". If the maximum is set to less than the minimum, it defaults to the minimum and the bob
will be placed at that same distance. Otherwise it is randomly placed within the range specified.

Select the force on the bob using the slider "gravity". If it is set to zero, only the fixed magnets will
attract the bob.

Note: Speed settings actually change the size of time intervals between computation of position of the bob. The further
the bob travels between these updates, the less accurate the updates are.

Stronger magnet strength and bob gravity causes higher acceleration and velocity, which, like increasing speed,
results in larger position changes between computations. This means that if you use higher magnet strength and/or
bob gravity, you may need to use slower speed settings to keep accuracy of trajectory calculations acceptable.

After pressing the Setup button and before pressing the Go button:

If you don't like the positioning of the magnets and bob, press Setup again.

At any time:

If you like the positioning of the fixed magnets but not that of the bob, press the "Setup bob" button. This will
reposition the bob but not the fixed magnets. If the model is running, this will clear any existing trace and
the model will continue running as though it were just started with the bob at its new location.

Press the "Labels On/Off" button to toggle the display of the fixed magnet labels, which is simply their number ID.

Set the "Trace On/Off" switch as desired.

Set the "fade-rate" slider to vary the speed with which the trace fades out. Fading is not executed for each point
plotted, but only every 500 points. This greatly speeds up the model.

Change the execution speed using the "Speed" slider. Because this actually changes the size of the time steps between
computation of new positions, if the speed is changed during a run, the bob path may not be exactly the same as it would
have been without a speed change.

Use the "Zoom" slider to zoom in or out on the screen. The bob and magnet coordinates are maintained separately and
then mapped onto the screen. The bob can "swing" off screen and then come back into view again. Because an existing
trace cannot be zoomed, it is cleared whenever the Zoom setting is changed.

Press "Clear Trace" button to clear an existing trace without affecting anything else. If the model is running the
bob will continue its motion, leaving a new trace from that point, if the "Trace On/Off" switch is "On".

If you would like to have the bob, at its current position, whether the model is running or not, behave as though
the model were just started running, press the "Reset Beginning" button. Except that the bob is started from its
current location and not randomly repositioned, this button acts like the "Reset bob" button.

You can change the magnet strength.

You can change the bob's gravity.

Have fun, but don't get hypnotized!

(back to the NetLogo User Community Models)