Instructions for running ALPHA, Simulation Samples Edition (2016.07.14):

For more information about ALPHA visit: http://epa.gov/otaq/climate/alpha.htm

System Requirements:
	Matlab/Simulink with StateFlow 2014a, may also work with later releases after library/model up-conversions.
	Also required is a compiler, for compiling the StateFlow code, see
		www.mathworks.com/support/compilers/R2014a/index.html
	
1) Launch Matlab and add REVS_Common and its subfolders to your Matlab path

2) Change your Matlab working directory to
	ALPHA\samples\
    using the appropriate file path for your system.

	Run the example script:
	>> sample_run;

    A number of Matlab warnings may be issued as the model reconfigures bus connections for the simulation.  For example:
        "Warning: Remapping selected signal 'veh_spd_mps' to 'vehicle.veh_spd_mps' in..."
    These are part of the model configuration process and are not errors.

    The Matlab Command Window will display an energy audit of the simulation once it has completed.
	
    The cold-corrected FTP and weighted-combined city-highway results will be calculated, and fuel consumption details will be
    displayed.

    A series of results will be displayed in the Matlab console window.  The include drive quality statistics for each phase
    of the drive cycle and a set of fuel economy and GHG emissions results, including the weighted-combined results.

	In the Matlab workspace, after simulation, the following variables will hold simulation trace data: datalog, audit, result, model_data
    The model_data variable holds many signals of interest, pulled from the datalog and audit structures, and may be explored as desired.

    As a convenience, some signals of common interest may be plotted using the following command: 
        >> REVS_CVM_DOR({},model_data,'engine',engine);

    To run individual drive cycles, instead of the default concatenated drive cycle, commands such as the following may be used:
        >> sim_epa_udds;
        >> sim_epa_hwfet;

Notes:
	1) To run a different sample case, edit line 7 of sample_run.m
	2) There is a workaround in the sample_run script for a potential Matlab glitch, see lines 13 through 22.

Background:
	The REVS_Common folder contains the core models and libraries used by ALPHA as well as helper functions
	and various scripts for processing data before and after simulation.  The libraries here are a subset of the complete
	package used for our in-house modeling efforts so it's possible one may find references to libraries or subroutines that
	are not present, e.g. hybrid or electric vehicles or alternative transmission technologies which are not part of this ALPHA release.

	REVS_Common\REVS_VM.mdl is the Simulink model file.

	Vehicle and component parameters are stored in the sample workspace files, which are provided in .mat and .txt form.
    The plaintext form of the workspace is an m-file format but will not be runnable, it's only purpose is to provide a look
    at the complete workspace in a human-readable form that does not required Matlab or Simulink.

Disclaimer:
	ALPHA is under active development and this release represents the state of the package at a particular
	point in time, it is subject to change without notice.  Sample input and output files are provided for reference only and
	cannot be processed by the peer review package and may not represent the production file formats.

