home *** CD-ROM | disk | FTP | other *** search
- Orbits
- ------
-
- A many body orbital mechanics simulation for RISC OS computers.
-
- By Neil Hoggarth.
-
- Introduction
- ------------
- Orbits simulates the movement of an arbitary number of objects under
- the effects of their mutual gravitational attraction. The main program
- itself takes control of the machine for the duration of the run. However a
- multitasking desktop front end is provided so that the program can be
- started and controlled from within the desktop environment. The program is
- Public Domain and may be copyed subject to certain conditions. Please see
- the section "Copying" below and the license agreement.
-
- Running the program
- -------------------
- The program is started by double clicking the !Orbits application
- directory in the normal way. An Orbits icon is installed on the icon bar.
- The icon menu has six options.
-
- Info - displays the usual 'information about program' box.
- Intro - displays this file in a text window.
- License - displays the program's license conditions in a text
- window.
- Trail - selectable option. When this is ticked the bodies in the
- simulation leave a trail behind them, marking out the
- orbit.
- Input - opens a filer window for the sub-directory containing the
- example input files.
- Quit - terminates the program.
-
- A simulation is started by draging a text file with the appropriate
- format to the Orbits icon. The simulation program then takes over the
- machine for the duration of the simulation. Whilst the program is running
- the following control keys can be used.
-
- f1 - toggle the trail option on/off.
- f2 - clear the screen. This is useful if the screen has become
- cluttered with orbit trails.
- f12 - terminate simulation.
-
- The simulation runs until the user presses f12, after which it stops
- and the computer returns to the desktop environment.
-
- Input format
- ------------
- The simulation operates on a series of "bodies". Each body has
- the following attributes.
-
- mass
- position ("x" and "y" co-ordinates)
- velocity (rate of change of "x" and rate of change of "y")
-
- The co-ordinate system used is the same as the graphics co-ordinate
- system used by BBC BASIC but with the origin (the 0,0 point) shifted into
- the middle of the screen. Co-ordinate 0,0 is in the centre, the x axis runs
- horizontally from -640 on the left hand edge to +640 on the right and the y
- axis runs vertically from -512 at the bottom edge to +512 at the top.
- Hopefully the following diagram makes this clear (co-ordinates are given as
- x,y).
-
- -640, 512 -------------------- 0,512 ------------------------- 640, 512
- | |
- | |
- | |
- | |
- | |
- -640, 0 0,0 640, 0
- | |
- | |
- | |
- | |
- | |
- -640,-512 -------------------- 0,512 ------------------------- 640,-512
-
- Bodies can be outside of the co-ordinate ranges given, but thay will no
- appear on the screen.
-
- Input files consist of a series of lines, each one of which is the
- specification of a body. These take the following form.
-
- mass / x , y / rate-of-change-of-x , rate-of-change-of-y
-
- The properties are specified as decimal numbers. The "/" and "," punctuation
- is required. The "rate-of-change-of..." properties state how many pixels the
- body is shifted by in the relevent direction each time the simulator runs
- through its main loop and therefore govern how quickly the body moves
- around. If you violate the input format the program responds with the (not
- very helpful!) error message "parse error at line xxxx".
-
- Comments can be introduced using a "#" character. Everything from a
- "#" to the end of a line is treated as a comment and is ignored. Blank lines
- are also allowed.
-
- A number of example input files (with comments) are provided and
- studying these is proberbly the best way to get a feel for the sizes of
- parameter which work. These are supplied in a sub-directory 'input'. A
- filer window for this directory can be opened by clicking on "Input" in the
- main icon bar menu.
-
- Running from the command line
- -----------------------------
- Although the casual user does not need to know it, the application
- actually consists of two programs. "!RunImage" is the multitasking front end
- and "orbits" is the simulation. The !RunImage program invokes orbits in
- response to the user draging an input file to the icon. If you are the sort
- of person who doesn't like windows, desktops and rodents then you can use
- the orbits program directly. Simply copy "orbits" out of the application
- directory into your normal "library" directory. You can now use "orbits" as
- a command from the "*" prompt.
-
- *orbits [-t] [-h] [<input file>]
-
- The -t switch indicates that the program should trail orbits. The -h
- switch causes the program to print a short help message. If the name of an
- input file is omitted the program attempts to read from the standard input,
- usualy the keyboard. Terminate keyboard input by typing <CTRL>-D.
-
- Bugs
- ----
- The simulation is non-relativistic. Anyone who understands the
- General Theory is invited to rectify this and then explain to me how it
- works!
- In the real universe (on the scale we are interested in!) time and
- space are continuous things. Unfortunatly the simulation runs in discrete
- steps. This has no major effect most of the time. However I am effectively
- making the assumption that each time the simulator moves on a step things
- don't change very much. This falls down when bodies get very close to each
- other. In such cases the gravitational gradiant can change very sharply. If
- two bodies pass very close together they get a massive kick due to the
- inverse square law. By the next discrete time interval they are far appart
- again and so only weakly interact. The result of this is that when two
- bodies almost collide then they tend to fly off at high speed never to be
- seen again. Similarly if a body orbits another and the low point of its
- orbit is very low then the orbit is distorted.
-
- Notes to programmers
- --------------------
- The programs are written in C language and the source files are
- distributed within the application directory. The programs were developed
- with release 4 of the Acorn ANSI C compiler and have been tested with both
- release 3 and release 4 (supplied with Desktop C). The module "c.RunImage"
- makes a call to RISC_OSlib which is only supported by release 4. You
- therefore require Desktop C to recompile RunImage. All the other files can
- be compiled under release 3. For distribution to the PD libraries I have
- compiled everything except RunImage under release 3. I have linked RunImage
- with ANSIlib rather than the shared C library. This is because programs
- compiled under release 4 require version 3.75 of the CLIB module which most
- users will not have yet.
- The C source files are in the sub-directory "c". The files
- "c.orbpar" and "c.orblex", which control the reading of the input file, were
- generated automatically by software development tools called "bison" and
- "flex" from the files in the "y" and "l" sub-directories. If you don't have
- bison and flex (or similar programs) then you can't rebuild the programs
- from scratch. You can however change the other source files and re-link with
- the existing "c.orbpar" and "c.orblex". The file "Makefile" provides
- instructions to the AMU program (or similar) for putting the whole lot
- together. Simply make the application directory the current directory and
- type "amu" to compile any modifications you might make.
-
- Copying.
- --------
- This program has been placed in the public domain by the author
- subject to the GNU general public license (NB: this program has nothing to
- do with the GNU project as such, I am simply borrowing the FSF's license). A
- copy of the license should be distributed with the program in a file called
- "Copying". You can read this file by choosing the option "License" from the
- main icon bar menu. The license covers all the program modules EXCEPT the
- file "c.getopt". I didn't write this and so have no right to impose
- conditions on its use. I have included the textfile "getopt" which is the
- function as originally distributed by its author.
- As explained in the general license you may modify the program and
- distribute your own version. Since different people may take the source and
- modify it independently, it is impossible to come up with any consistent
- version numbering scheme. Instead I use a file which goes with the program
- called "ChangeLog". If you modify the code and subsiquently distribute your
- version then comment the changes in the code and also append an entry to
- ChangeLog. The ChangeLog file should therefore provide a "backtrace" of all
- the people who have had a hand in the code. The "Info" dialogue box of the
- application should contain the date of the last change and the initials of
- the person making the change. Modify the file "Templates" using FormEd to
- do this.
-
-
- All bug reports, new versions, constructive critisism, etc. to the following
- address.
-
- Neil Hoggarth
- 18 Stanmore Lane,
- Winchester,
- SO22 4AJ.
-