Add default initial values
This CIF to CIF transformation adds the default initial values to variables that are not given an explicit initial value. This includes discrete and continuous variables, as well as local variables of functions.
Supported specifications
This transformation supports a subset of CIF specifications. The following restrictions apply:
Component definitions and component instantiations are not supported.
Preprocessing
No preprocessing is currently performed by this CIF to CIF transformation. To increase the subset of specifications that can be transformed, apply the following CIF to CIF transformations (in the given order):
Implementation details
The default values for all types are simple values. The only exception are function types, for which a new function is introduced. This new functions returns the default value for the return type of the function. If multiple default values for the same function type are needed, the newly introduced function is reused. The functions are named _f
, _f2
, _f3
, etc.
For instance, the following specification:
automaton x:
disc int x, y = 5;
disc func bool (int) f;
location;
end
is transformed to the following specification:
func bool _f(int p0):
return false;
end
automaton x:
disc int x = 0, y = 5;
disc func bool (int) f = _f;
location;
end
Renaming
If the names of the functions that are introduced, conflict with already existing declarations, they are renamed. For instance, if _f2
is already in use, _f22
, _f23
, etc, are used instead. If renaming takes place, a warning is printed to the console.
Size considerations
Since values are added, this transformation increases the size of the specification. For an array of 400 elements, with an array of 300 integers each, the default initial value consists of 120,000 integers. Adding such an initial value can significantly increase the size of the model.