Starting a new SmartAHS project

In this section it is explained how to create a new project. A step-by-step description follows
the creation of a new sample project.

SmartAHS directory structure

To install the SmartAHS library follow these steps:

1 - Go to the main SmartAHS directory (the one where you unpacked).
2 - Run the command 'configure' (if '.' - dot - is not in your path, run ' ./configure');
       this will check a few things and set up the environment for your work.
      Normally, 'configure' will set up '/usr/local' as the installation  directory.
      You can override this behavior by using the '--prefix'  command line switch to 'configure',
       as in

              $ configure --prefix=$HOME/my-smartahs-dir

3 - Run 'make install'.

The SmartAHS framework is now installed.

The core set of the SmartAHS building blocks is contained within the following directory structure

The files contained herein are provided by the SmartAHS development team at PATH and should not
be modified by the user.
 

 Highway configuration

The highway topology might be an important feature of the simulation being constructed.
While it is possible to write the SHIFT code for a highway manually, you are advised not to do so.
Instead,  you should prepare a Smart PATH compliant highway description (Smart PATH is a different
modeling tool built at PATH). The Smart PATH highway description scheme is very easy to understand
and to use. The next step is to use the Highway Compiler, called  hwyc, which will produce the SHIFT
code for you. A detailed description of  hwyc  and a  Smart PATH highway representation is available.

Let us create a highway specification as follows:

Save  it in a file myroad.inp.  Note that hwyc requires an *.inp sufix for an input file. Compile the file: The file myroad.out will be created. Copy or move this file to myroad.hs. This file should be included into
your main file: The weather description generated by default is a sunny condition with
excellent visibility. The weather conditions could be edited manually for
different parts of the road.

Origin-Destination Specification

In order to populate the road specified above with instances of vehicles the source and sink  types
should be used to specify the Origin-Destination patterns. Here is an example (file od.hs): Note how the exact location of an arbitrary source and sink is specified. For the source type variable
the section, segment and lane name should be specified.  For the sink type the lane name should be given.
The hwyc compiler creates the derivative names for the segments and lanes within a given section.
It does so by expanding the <the_section> name  in the following manner: where  <number> is the number of the segment or of the lane respectively.

The file od.hs should be included into your main file:

A detailed description of the sink and source types is provided in  the AHS Model Description section.
The road is populated by the instances of vehicles of vehicle  type by default. It is advised to
copy the sink and source files from the SmartAHS directory structure to your project directory
for a modification if necessary (e.g. to populate with your vehicle type, derived from vehicle type).
 

Controller Implementation.

Controller implementation is the most serious step in constructing your simulation. At this time detailed
models of  a passenger vehicle dynamics are provided in SmartAHS. this library will be extended by heavy
truck models in the future. The part which represents the driver  is the actual control module which gets some
predefined inputs (e.g. visual and motion feedbacks) and outputs the values for steering, accelerator and
braking into the vehicle dynamics module.
These building blocks could be borrowed from the SmartAHS library, or designed by a third party for
a particular scenario. It is advised to follow the outline of the Standard Project while creating your own simulation.
The VREP module is the only link between the vehicle and the road. Its interface should be understood and
closely followed (see  AHS Model Description).

You should create a file myvehicle.hs - it will contain the type description for your vehicle:

In the setup clause of this type the controllers and VREP components of your vehicle should be initialized.
The connect clause of the setup establishes the connection between the controller and  the vehicle dynamics
modules. If you are using the Smart-AHS modules make sure all the supporting files are included into your main file.
 

Monitors.

Monitor types could be added to the simulation in order to provide a convenient way  to gather, aggregate and otherwise process the simulation data. Alternatively, vehicle parameters could be direct output for each vehicle instance.  However, on the roadway part it is virtually impossible to gather useful data (e.g traffic flow parameters) without introducing the monitors.  A traffic flow monitor is provided as an example below:

Data Processing.

 The easiest way to collect data from your simulation is to run the simulation in the batch mode, preferrably from a UNIX script, and to dump the data to a file using the SHIFT tty-debugger  commands.  The resulting files could be further processed using  the usual UNIX script programming techniques, including PERL, AWK, GREP, SED, etc.