# Usage

## Running an SUT model

With the Sut tool you can easily generate an implementation of an SUT from an EFSM model specified in Uppaal.

The sut_run tool also directly  runs the generated SUT so that you immediately with it over tcp/ip socket connections.

When running without arguments the sut_run command will show you its usage message:

  > sut_run
usage: sut_run [-h] [-v] [--port PORT] modelfile


When running with the -h commandline option it will show you a more detailed help message:

  usage: sut_run [-h] [-v] [--port PORT] modelfile

positional arguments:
modelfile         input uppaal model file

optional arguments:
-h, --help       show this help message and exit
-v, --verbose  turn verbose mode on : displays all input and outputs
--port PORT    tcp port to listen on for incoming connections (default:7892)


The Tomte tool comes with some predefined models in the tomte-0.4/models/ subdirectory.
If you want to learn your own model, please study the Making SUT section.

For example let us use the BiometricPassport model as teacher model in our learning experiment and run it on the fly as an SUT using the command:

  > sut_run tomte-0.x/models/BiometricPassport/model.xml --port 9999

SUT simulation socketserver
-> listening at port : 9999
-> verbose mode : OFF
-> the server has a timeout of 30 seconds
note: to prevent unnecessary servers to keep on running


Now the SUT is running and waiting for anyone to communicate with it!

Notes:

• The generated SUT is implemented in java.
With the sut_uppaal2jar command you can generate the java source and look into its implementation, and optionally modify it for your own purposes.
• For your convenience sut_run generates and directly executes the SUT. Instead of directly running the SUT you can generate a java jar file with the sut_uppaal2jar command instead which can be easily run with the command 'java -jar SUT.jar'.
• With the --port  commandline option you can specify to use a different tcp/ip port.
By default port 7892 is used.
• In the communication over the tcp/ip protocol, line messages with data parameters are serialized to strings. The serialization used is just string concatenation of the action and its parameters where we use an underscore as delimiter.
Eg. "<action>_<param1>_<param2>" for an action with two parameters.