verivital / hyst

HyST: A Source Transformation and Translation Tool for Hybrid Automaton Models
http://verivital.com/hyst/
Other
15 stars 18 forks source link

Automatic conversion of lookup table flows #11

Closed stanleybak closed 8 years ago

stanleybak commented 9 years ago

This set of changes provides support for having flows defined as N-dimensional lookup tables, using matlab-like syntax. A flow for a variable with a 2d lookup table might be:

x' == 5 + y + lut([a, 2*b], [1, 2, 4 ; 2, 3, 5 ; 3, 5, 10], [0, 1, 3], [0, 10, 30])

The first argument to lut() provides the input selection for the lookup table; since there are two inputs here it will be a two dimensional lookup table. The second argument is the data table (matlab's reshape is allowed for more than 2 dimensions), the remaining arguments are the breakpoints for each of the input dimensions.

Modes with lookup tables automatically get split into several modes with the associated dynamics using the automatic Preconditions check in Hyst (the conversion will take place unless a printer or pass explicitly says it supports lookup tables).

To allow LUTs, support was added for matlab-like n-dimensional matrix expressions, although right now these only make sense as part of a lookup table expression. Extensive unit tests were added in ConvertLutFlowsPass.java, and a regression test model was added as well.

Other things:

We can discuss this more in person at RTSS, but I wanted to give you a preview.