All of the basic simulation infrastructure is provided for you. Specifically, we provide the discrete-time simulation tools, the constructs needed to communicate with other objects in the simulation, environmental actuators that will respond to your commands and standardized message definitions.
The codebase can be downloaded here
If you unpack the codebase, you will find the following files and
directories:
The simulator is composed of 5 main packages.
Detailed descriptions of each package can be found in the javadoc api
documentation, which can be built by running 'make' in the root of the
simulator release (not the code/ directory). The object
simulator.framework.Elevator is the
top-level object that provides command line interface and instantiates all
other simulation objects.
All source code is provided (except for the control modules you will be
creating later in the semester). You should not need to modify the
simulation framework code in the normal course of completing your
assignments. It is primarily to help you understand how the simulated
elevator works (and to help with debugging). If you wish to modify the
framework to make your life easier, you can do so, but be careful not to break
anything! Keep in mind that you will only submit your controller code, so
any modifications you make to your local copy of the framework will not be
present when we run tests on your project submissions.
If you come up with useful a useful modification to the framework (for
example, a modification that makes testing easier), you may submit the code to
TAs for eventual inclusion in the official codebase. Decisions on whether
to include your modification (or when to release the new version) will be at
the sole discretion of the course staff, and you will still be responsible for
making sure the code and test files submitted for each project work with the
current official release.
Please see the Example section of this document for more details and an example on how everything fits together.
In order to run the simulation, first make sure that you are running an
appropriate version of Java on an appropriate machine. We recommend using the
ece cluster (e.g., ece000). Accounts should be created for every enrolled
student by the end of the third week of class.
To connect to the ece cluster, ssh to one of the cluster machines. As of Sept 2015 this included ece000.campus.ece.cmu.local through ece031.campus.ece.cmu.local, which can only be accessed once you have a campus IP address (e.g., via VPN).
To ssh from a windows machine, you should use
Putty or another terminal program. You should also run a Windows X
client, as described in the Project FAQ.
For more information on accessing the clusters from on and off campus please see the ece wiki located here
For your benefit and the benefit of others, please spread the load around
on various machines. You can use the 'top' command to see what other programs
are running on each machine. A complete list of the machines in the cluster is
shown when you first log in.
The required version of java is whatever is being run on the cluster.
You can check what version of Java is installed by typing:
java -versionOnce you have downloaded the code to your home directory, you can extract it using this command (change the filenames as appropriate):
tar -xzvf .tar.gzOr
tar xvf .tar.gzDepending on your version of tar.
The makefile provided will compile all java files. You can execute it by
running
make
from the 'code' directory.
To execute the java compiler directly, use:
javac filename.java
You will need to recompile each file after you modify it. Running "make" does this automatically.
You can run the simulator from the code directory by executing:
java simulator.framework.Elevator
If you wish to run the simulator from another directory, then add the
"-cp /path/to/code" flag to the java command line, or set the
CLASSPATH variable using:
export CLASSPATH=`pwd`
(note the backticks used around pwd). If you wish to have your CLASSPATH
set every time, you can add the line above to your .bashrc file (assuming you
are using the BASH shell).
Running tests will produce files with the extension .stats that contain
statistics regarding the performance of your elevator, including assertions
passed and failed for unit and integration tests and detailed information on
passenger delivery, monitoring, and network usage for acceptance tests.
If you run the simulator with the -gui
option, you must make
sure that you have are running an X window manager and that you have X11
forwarding enabled in your ssh client. Also note that running the simulator on
an on-campus host while trying to view the GUI from an off-campus host over SSH
or X-Win 32 will be very slow. You will get more satisfactory results from the
GUI if you run the simulator on a local machine.
For Linux:
For Windows: