Computer Science and Engineering

Modeling And Simulation Technology

Problem 3


Assignment Details:


Problem #3 (10 points)

Simple Network Flow Model

Assigned: 2012-02-01
Due: 2012-02-06

Overview:

Implement a model that represents a dynamical flow from a source to a sink with a restricted flow pathway in-between.

Use the given plot package (plot.jar) to plot the results for the following problem:

Details:

Implement the model with the initial values:

      v0,0 = 10.0
      v1,0 = 5.0

      p0,0 = 0.1
      p1,0 = 0.05

      s0 = 0.0


      t0 = 0.0
      t_max = 5.0;
      dt = 0.1
      θ0 = π * 0.2
      θ1 = π * 0.1
      Fmax = 5.0
And the dynamics equations:

      p0,i = v0,i - 1 * 0.1

      f0,i = p0,i * v0,i - 1 + 0.2 * sin(t * θ0)

      v0,i = v0,i - 1 - f0,i * dt 

      p1,i = v1,i - 1 * 0.1

      f1,i = p1,i * v1,i - 1 + 0.1 * sin(t * θ1)

      v1,i = v1,i - 1 - f1,i * dt 

      if f0,i + f1,i < Fmax
         {
         Fi = f0,i + f1,i
         }
      else
         {
         Fi = Fmax
         }

      si = si - 1 + Fi * dt

Then display the following three separate plots:
      v0, v1, and s values versus t
      p0 and p1 values versus t
      f0, f1, and F values versus t
on a three GUI panels (may be in separate frames).

If you require extra arguments on the javac and java command lines create a script (makefile, bourne script, perl script, python script, ...) which is easily executed and performs the compile and run of your code.

These are to be placed in a single jar or tar file and e-mailed as an attachment to jholten@nmt.edu

The plot.jar package contains a directory structure and the java source code for the plot and support routines, as well as a test program called "plf_2_tst.java" as an included example, so access the plot files and the example as follows:

  1. Set up a base directory directory to receive a directory hierarchy and cd into it.
  2. Use "jar -xvf plot.jar" to unpack the jar file into your base directory.
  3. Use "javac plf_2_tst.java" in your base directory to compile. It compiles the entire hierarchy of referenced files.
  4. Use "java plf_2_tst" to run the test program, generating several plots.
The source code in "plf_2_tst.java" demonstrates how to use the plot routines to generate the data plots. Note that right clicking the mouse buttons in a plot brings up a menu of possible plot display variations.

The source code included in this exercise is open source and you may use it freely, distribute it, and/or modify it as you see fit.

To compile and run your own code using the libraries you merely need to include the import statements in your code and make sure the directory hierarchy base is in your classpath, which it is for any code compiled and executed from the directory you created for its installation above.

Turn-in:

The files to be turned in for this programming assignment are as follows:

  1. All your source code files and any others you modified

  2. Writeup on how to compile, run, and use the program, as well as details of which systems you used, any problems you encountered, and how you overcame them.

    Include a discussion of any significant problems found in the model and suggestions of how they might be overcome.

  3. Any output text file log from your test run.

Extra Credit: (1 point each, max 3 points)

Generate and display the following, using the plot objects, on each panel of plotted values above:

  1. Plot titles and axis labels for each plot panel.
  2. Axes, reasonable tic marks, and reasonable tic mark labels for each (horizontal and vertical) axis for the panels.
  3. A key relating the point markers and colors to a descriptive string and displayed on the plot panel in a reasonable location.