The Sample Application

Running the sample application requires that you at least have Sun's Java™ Java Runtime Environment (JRE) version 1.3 or later installed. If your machine does not have at least the JRE on it, then download it from Sun's Java download page. If you want to build applications using the framework, then download the latest Java 2 Software Development (SDK) Standard Edition.

To run the sample application first switch into the sample_app directory as shown

wbailey:/tmp> cd sample_app/
After you are there make sure that the feynman.jar file is present and if it is, then issue the following command:
wbailey:/tmp/sample_app> java -jar feynman.jar config/ 
If Java is installed correctly on your machine, then everything should run without error and produce the following output exactly as it appears below:
Using properties file: config/
Creating the physical system...created
Configuring system using <Setup>...configured
Configuring Algorithm using <SimpleGravity>...configured
Configuring Physical Measurement using <Measurement>...configured
Configuring the Persistent Data Source using <file>...complete
Configuring the FinalReport using <Report>...complete
Running simulation...complete

---------- Simulation Report -----------
max height:         5.05 m
impact velocity:   -9.99 m/s
total flight time:  2.04 s
Congradulations! Dr. Feynman would be proud of you because you just numerically simulated a ball being launched up in the air under Newton's simple Law of Gravity. You should also notice that the sample application produced a data file that is in Comma Seperated Value (CSV) format as shown below:
wbailey:/tmp/sample_app> dir
build.xml    classes/     config/      data.csv     feynman.jar  lib/         src/
The file has all of the measurement data that was taken during the simulation. As you will learn later, when you are developing an application you have the ability to specify what measurements will be taken and how often they will be performed during the simulation. The sample application has specified to record the following data that appears in the following columns:
  1. Time - The elapsed time when the mearsurement was taken.
  2. Height - The y position of the ball.
  3. Kinetic Energy
  4. Potential Energy
  5. Total Energy
The first ten lines of the data.csv file are listed below:
wbailey:/tmp/sample_app> head data.csv 
000000000.01, 000000000.10, 000000000.97, 000000049.02, 000000050.00
000000000.03, 000000000.29, 000000002.88, 000000047.10, 000000049.99
000000000.05, 000000000.49, 000000004.76, 000000045.22, 000000049.98
000000000.07, 000000000.67, 000000006.59, 000000043.38, 000000049.97
000000000.09, 000000000.86, 000000008.39, 000000041.57, 000000049.96
000000000.11, 000000001.04, 000000010.15, 000000039.80, 000000049.95
000000000.13, 000000001.21, 000000011.87, 000000038.07, 000000049.94
000000000.15, 000000001.38, 000000013.55, 000000036.38, 000000049.93
000000000.17, 000000001.55, 000000015.19, 000000034.73, 000000049.92
000000000.19, 000000001.71, 000000016.80, 000000033.11, 000000049.91
For further analysis the data could be imported into a spreadsheet like Microsoft Excel™ or another equivalent free graphing utility like gnuplot available for free under the GNU General Public License (GPL) written by the Free Software Foundation. If you have never used gnuplot, then copy the following into your favorite editor and save as using.gnu:
set title "Energy Plot"
set key below box
set xrange [0:2.1]
set yrange [0:55]
set xlabel 'Time (Sec)'
set ylabel 'Energy (Joule)'
plot 'data.csv' using 1:3 title "Kinetic" with lines,\
     'data.csv' using 1:4 title "Potential" with lines;
After you save the file, start gnuplot from the shell command prompt and type the following:
wbailey:/tmp/sample_app> gnuplot

	G N U P L O T
	Macintosh version 3.7
	patchlevel 1
	last modified Fri Oct 22 18:00:00 BST 1999

	Copyright(C) 1986 - 1993, 1998, 1999
	Thomas Williams, Colin Kelley and many others

	Type `help` to access the on-line reference manual
	The gnuplot FAQ is available from

	Send comments and requests for help to <>
	Send bugs, suggestions and mods to <>

Terminal type set to 'pict'
gnuplot> cd '/tmp/sample_app'
gnuplot> load 'using.gnu'
The first command tells gnuplot to change the specified directory where the data.csv and using.gnu files are located. The next step tells it to load the file that has all of the plotting commnds in it. Note the the directory and filename are surrounded by single quotes. Double quotes should work as well. Lack of quotes will produce an error. If everything is done correctly, then you should see the following plot appear as shown below:

Energy Plot