6 Using sf2lus with s2l and ss2lus
The ss2lus script is a simple program which allows Simulink models with
Stateflow components to be translated into a monolithic Lustre program.
The process is very simple, sf2lus is called to translate the Stateflow
component into a temporary file, the name of which is then passed to s2l
which translates the Simulink component generating calls to the
The entire temporary Stateflow Lustre file is then appended to the
In practice, however, this interface is still in its infancy and only fairly
simple and regular Simulink/Stateflow combinations are supported.
For example, we do not handle callbacks from Stateflow to Simulink as yet,
although this is possible and may be implemented in future.
6.1 ss2lus syntax
The sytax of the ss2lus command is very simple:
% ss2lus SetReset_r13.mdl --monoperiodic
This translates the given model file and combines the two components.
Some of the options to sf2lus are mandatory and set by ss2lus.
If you wish to pass options to s2l they can be passed on the ss2lus
Both s2l and sf2lus can receive additional arguments in the
S2LOPTS and SF2LUSOPTS environment variables, respectively.
Be careful with sf2lus options, however, since they may invalidate the
interface between s2l and sf2lus.
In particular, do not set
-states_visible, or any
options which generate additional inputs or outputs.
In fact, some of the features of sf2lus which allow management of Stateflow
charts in isolation should also not be used.
For instance, you need to ensure that all Stateflow components have at least
one input and one output to ensure that the dummy arguments generated to allow
legal Pollux output are not triggered.
6.2 Matlab workspace files
To assist in building the interface, a file describing sf2lus's view of the
Matlab workspace is generated in a
This contains a list of Matlab workspace variables used by the sf2lus code
and which have to be declared in the s2l output.
It also contains information about any pseudo-variables generated by
sf2lus (currently only the
t time variable).
Note that the
.mws file is not deleted by either sf2lus or
ss2lus since constants are read from this file.
It is up to the programmer to maintain this file with respect to the current
It may be possible, in future, to generate this file from Matlab