home *** CD-ROM | disk | FTP | other *** search
-
-
- CM
-
- Celestial Mechanics Simulator
- Version 1.0
-
-
- W. John Guineau
- 3 Royal Crest Drive #9
- Marlboro, Mass 01752
- (508) 485-6233
-
-
-
- NOTICE
- ------
-
- I have placed this software in the Public Domain with the
- condition that all the files remain together and that I remain
- listed as the original author. This software may not be used for
- commercial purposes or to make money in any way without expressed
- written permission from the author (me). I'm including the source
- code so if you make any significant modifications please concider
- sending me a copy at the above address. I'd also be interested in
- any interesting saved setup files you create.
-
-
- This is my first Amiga program so I welcome any comments at all.
- I wrote this program as both a way to learn the Amiga environment
- and in response to a conversation I had with a friend on Celestial
- Mechanics.
-
-
-
-
-
-
- What is it?
- -----------
-
- CM is a Celestial Mechanics simulation tool. It allows you to
- construct a layout of Masses (called Bodys) and specify various
- parameters concerning both the bodys and the simulation. All input
- is accomplished through a fully intuitionized interface. CM then
- proceeds to animate the bodys according to the laws of gravational
- attraction ( F = Gm1m2/r^2 ). Setups may be saved to disk to allow
- you later re-inact interesting scenarios.
-
-
-
-
- Getting Started
- ---------------
-
- CM can be run from either the CLI or from workbench by double
- clicking it's icon. In order for you to get a quick start, I've
- included some interesting setup files (described below). Just run
- CM and select LoadData from the FILE menu. Enter the name of the
- saved simulation you want and hit return (or click OK in the file
- requestor).
-
- Next select START from the CONTROL menu. That's it!
-
- Here are the included setups:
-
- 3BODY.DAT - This is a setup of 3 bodys (no kidding!). One is a
- very (relativly) massive body which is not moving. The other two
- are much smaller and have initial velocities - one in a close
- orbit, the other in a larger orbit. What makes this interesting is
- that on several occasions the two get close enough to affect
- eachothers orbit. Then after about t=1400, they swap orbits.
-
- FIXED1.DAT - This is an example of a feature in creating bodys
- where they can be "fixed" in place (i.e. not allowed to move).
- While this is not possible in reality, it makes for some interesting
- effects (and gives a good control on single body experiments).
-
- FIXED2.DAT - Another fixed body example. Watch this one around
- t=1700!
-
-
- SVEM.DAT - This stands for SUN, VENUS, EARTH, MARS. It's a scale
- experiment of (guess what) the inner planets. While the masses,
- velocities and distances are correct, I don't quite have the
- initial directions just right (although it does indeed take the
- Earth 365 days to complete an orbit, as well as the other planets
- are quite close to thier orbital period). This is a good example for
- scaling time and distance.
-
- SMVEM.DAT - Another like above. SUN, MERCURY, VENUS, EARTH, MARS.
-
-
-
-
- How to use CM
- -------------
-
- CM is really pretty easy to use. You first need to decide on what
- you want to simulate. Then decide on an appropriate scale for
- both distance and time.
-
- The visible universe is made up of 635 units in the x direction
- and 377 units in the y direction. I say units instead of pixels
- because CM lets you assign any arbitrary scale to the distance
- between each pixel. Calculations are based on the scaled distance and on
- scaled time. CM lets you specify an arbitrary amount of time for each
- iteration of the simulation.
-
- The non-visible universe extends virtually infinetly in all
- directions (2D space).
-
- To see how scaling is useful concider the 3BODY.DAT example
- (described above). It has a distance scale of 1:1 and a time scale
- of 0.5. Which brings up another useful variable to set - G. G is the
- gravational constant and is, in reality, equal to 6.67E-11. CM
- lets you specify what G is for the calculations. 3BODY.DAT uses
- just 6.67 for G, pretty amazing, huh? :-0.
-
- Now contrast 3BODY's settings with those of SVEM.DAT. This is a
- real scale model. The distance scale is 1E6, which just happens
- to work nicely for distances in KiloMeters from the SUN to the inner
- planets. The time scale is 8.64E4. What is that?? It's the number of
- seconds in one day. G is set to 6.67E-8, which is appropriate
- for the KiloMeter scaling of distance. Since the units for G are
- based on 1 second, time scaling must also be based on 1 second -
- hence, 1 day in seconds. This means that for each iteration of the
- simulation, one day goes by and by placing the Earth body 150
- units (pixels) away from the SUN's location, it's really 150E6
- kilometers away (it's correct mean distance). Ij addition to
- distance and time, you should use units for Mass and Velocity
- that are consistant with everything. Get the idea?
-
-
- The best things to do are get a good book with real numbers and
- experiment. Eventually you'll get the feel for the scaling and
- how it affects the simulation.
-
-
-
-
- The Menus
- ---------
-
- With that simple look at things, heres what the menu's do.
-
- There are 3 main menus in the title bar: FILE, EDIT and CONTROL.
-
-
- The FILE menu has the following items.
-
- ABOUT - Read this one and send mail to the address listed or just
- call to say hi! I'd love to hear from anyone using this
- program with questions, comments or whatever.
-
- LoadData
- - This allows you to load in a previously saved setup file.
- The files are pretty simple. You can type or edit them but
- beware that CM expects the EXACT format they get saved in. Type
- one out and see!
-
- Selecting this item pops up a simple file requestor asking
- for the name.
-
-
- SaveData
- - This allows you to save a setup. It's a good idea to
- save an experiment BEFORE you run it. That way you can
- reload it to modify the initial parameters.
-
- Selecting this item pops up a simple file requestor asking
- for the name.
-
- SaveScreen
- - This item will dump the current screen to an IFF ILBM
- file (for use with DPaint or whatever). CM uses a hires
- interlaced, 8 color custom screen.
-
- This menu item is currently not implemented. If anyone is
- interested I will put it in. Actually I'll do it sometime
- anyway just to learn how!
-
- EXIT - Exits CM. The window close gadget does the same thing.
-
-
-
- The EDIT menu has the following items.
-
- Setup - This pops up a requestor to allow you to set all the
- simulation parameters. The parameters are described
- below.
-
- Create - This puts CM into the Create Body mode. Once selected
- a small window will open at the top of the screen showing
- the current mouse coordinates (properly scaled). When the
- mouse is where you want a body, click the left button.
- A body requestor will pop up to let you fill in the
- information for that body. The body requestor is described
- below. You can create up to 10 bodys.
-
- Modify - Once you've created bodys (or loaded them in from a file)
- you can step through them to view/modify their parameters.
- You can also delete a body this way.
-
- ClearScreen
- - Just clears the screen. Useful when trails have
- cluttered the display.
-
- ClearBodys
- - Clears all body information. A requestor will ask you if
- you really want to do this.
-
-
- The CONTROL menu has the following items.
-
- Start - Starts a simulation. You must have bodys created to use
- this item.
-
- Stop - Stops a simulation in progress. Setup info can then be
- changed, bodys can be modified or saved and the simulation
- restarted.
-
-
- The setup requestor allows you to change the following.
-
- G - The gravational constant. Entered as a floating point
- number such as 6.67e-11.
-
- Sim Time
- - This is the time scaling for each iteration of the
- simulation. Specified as a floating point number.
-
- Real Time
- - Normally the simulator runs at full speed. Putting a value
- other than zero here inserts a real delay, in miliseconds,
- between each iteration. Maybe useful for 68020/68030 users.
- Specified as an integer.
-
- Units/Pixel
- - This is the distance scale. It specifies the distance
- between pixels. Specified as a floating point number.
-
- TrailLength
- - This decides how a bodys trail is dealt with.
- A value of ZERO means leave no trail.
- A value of -1 means leave an infinite trail.
- A value between 1 and 300 specifies the number of
- past locations to save. This creates worm like
- trails behind a body.
-
- ShowTime
- - If YES, the integer number of iterations will be displayed
- during the simulation. This number can then be multiplied
- by the time scale for real time. In some cases, such as
- with the SVEM and SMVEM examples, it can be read directly
- as days.
-
-
- The Body requestor allows you to specify the following
- characteristics of a body.
-
- NAME - This is a name you give it (such as SUN, EARTH etc.)
-
-
- MASS - This is it's mass. Entered as a floating point number.
- The units you use should be consistant with the rest
- of the setup information (i.e. G, scaling, velocity etc)
-
- VELOCITY
- - The scalar velocity of the body. Floating point. Should
- be dimensionally consistant with the rest of the setup
- info.
-
- DIRECTION
- - The angle of the velocity in degrees. 0 degrees is due
- east with 90 strait up, 180 due west and 270 due south.
- Integer number.
-
- COLOR - Clicking on a color will set the bodys color.
-
-
- FIXED - YES means the body can't move. While this is not "real",
- it can be useful for experimentation.
-
-
- The bodys current location is displayed below the FIXED gadget.
-
-
- In both the SETUP and the BODY requestors, clicking on OK accepts
- the values, RESET sets them to their defaults and CANCEL quits the
- operation without any changes. In addition the BODY requestor will
- display DELETE in place of CANCEL during a MODIFY operation.
- Selcecting this will delete the body from the simulation.
-
-
-
-
-
-
-
-
-
-
-