This DimSim distribution contains two folders: src and examples.

The "src" directory contains all source files required for dimension 
analysis of a Simulink model. 

The "examples" directory contains six examples: "sldemo_househeat", "cd2d", 
"cruise_ctrl", "sldemo_clutch", "sldemo_engine", "prb". Each example folder
contains the Simulink model to be analyzed. In this document,
we use <example_name> to denote any of these examples. The details on 
the examples are available in the DimSim paper.


Dimsim performs two types of analysis: First, given a Simulink model
annotated by dimensions by the user, Dimsim finds the most general 
dimensions for all the variables in the model. Second, given a Simulink
model, Dimsim provides a minimal subset of variables that the user
should annotate for unique dimension assignment of all the variables
in the model.


To run an example, one need to first run the script start.m. Before 
running the script, modify "start.m" following the steps below: 

- Select the example you want to run by uncommenting the lines 
started with mdlPathName and modelName for the example (line 10-31).

- Examples "prb" and "cd2d" need a Matlab script to be run before the model 
can run. Select the proper script by uncommenting it (line 39-41).

- For the general dimension finding problem, uncomment the line (line 51)

%createGEInputFile(get_param(gas, 'Name')); 

and for the problem of finding minimal subset of variables to be 
annotated, uncomment the line (line 52)

%createDimensionEqualityFile(get_param(gas, 'Name'));

Running start.m parses the Simulink model and saves all necessary 
information. For general dimension finding with Gauss-Jordan Elimination, 
the generated files are stored in a folder "ge". For the second problem, 
the files are stored in "eq" folder. These folders are located inside the 
"examples/<example_name>" folder.


To find general dimension assignments to the variables in the model,
select the example you want to run in "automate_ge_checking.pl" file, and
then run it from the command prompt.

> perl automate_ge_checking.pl 

It generates a file <example_name>_run in "examples/<example_name>/ge"
folder. Run the script "<example_name>_run" in a Common Lisp interpreter 
to find the most general dimension assignment to the variables in the 
Simulink model. The dimensions are represented as a vector. The definition 
of the vector (the ordering of the base dimensions) can be found at the 
beginning of a file <model_name> (name of the Simulink model) in 
"examples/<example_name>/ge" folder.


To find minimal subset of variables to be annotated for each subsystem,
select an example in the script "run_unique.pl", and run it from the 
command prompt. 

> perl run_unique.pl

It compiles and runs aprogram written in Ocaml. The output file "result" 
is generated in "examples/<example_name>/eq" folder.

