Lecture 15B
Serving PhysicsSim
DataMonitorDesign
Run Data Server
Run Data Client
Data S
erver Code
Physics Sim Code
Data Client Code

Lectures

1A: Introduction
1B: Java Intro
2A: BuildingBlocks
2B: Objects
3A: More Objects
3B: Exceptions
       & Threads
4A: Waves
4B: Nuclear &
       Particle
5A: AWT
5B: More AWT
      & Graphics
6A:Detectors &
      Simulation
6B: LHC/Atlas &
     RandomSims    
7A: Swing
7B: Java2D
8A: Java Apps
8B: Dialogs &
    MoreClasses
9A: Java I/O
9B: Utilities,
        Unicode
10A: More
    Threading
10B: File
    Handling
11A: Array,Print,
    Images
11B: SimplePhysics
    Simulation
12A: Tips &
    Techniques
12B: More Tips &
    Techniques
13A: Satellite
    
Simulations
13B: Intro to Java
    Networking
14A: Java Servers
14B: HTTP Server
15A: ServerClient
15B: ServerClient
   Expt.Simulation
16A: Course
          Review
16B: ExerciseTest
        Discussion

    Contacts
    Description
    Exercises
    Index
    Outline
    Q&A
    Resources
    StudentInfoForm
    Student Pages
    What's New

 

Home : Lectures : Lecture 15B : Server with a Physics Simulation
Server with a Physics Simulation
We will now modify DataServer such that it sends data from a physics simulation rather than just random values.

The FallingObject applet discussed in Lecture 11B will do fine as our physics simulator.

FallingObject included both a physics generator and a simulated detector.

Here the server will provide data from the detector, i.e. the histogram of falling time measurements, to DataClient requests.

Two possible approaches to designing our new DataServer:

  • Combine the FallingObject applet directly into the DataServer.

  • Make FallingObject into a standalone application and let DataServer start it as an external process. Then communicate with it via sockets or RMI to grab data, stop/start the measurements, etc.

The latter approach is more in keeping with a building block, object oriented approach.

However, for the sake of simplicity we will go with the first approach but try to maintain a clear separation of the objects.

The FallingObject classes will be put into a package called FOExperiment.

We will add some "Getter" methods, e.g. getNumData(), to the classes to provide access to properties of interest. (As opposed to allowing direct access to the variables and harming the encapsulation of our classes.)

DataServer will add applet holder code, e.g. a Frame and menu (see Lecture 8A), where it will put the FallingObject applet.

DataSender will replace the code that generates random data in run() with code that gets data from the detector in FallingObject.

 

 

Home Lectures Resources Index Contacts Students


Physics Simulations with JavaTM
KTH, Kurskod: 5A1418
Curator: Clark S. Lindsey