toC
Purpose
Export of PWA/PWQ function to C-code
Syntax
controller.toC('function')
controller.toC('function','filename')
controller.toC('function','filename','tie_break_fcn')
Description
The function toC() exports given piecewise affine (PWA) or piecewise quadratic (PWQ) function
to C-language including a sequential evaluation routine. The PWA/PWQ function must be attached to the
PolyUnion object.
If the file name is not provided, the default output name is mpt_getInput.
The export routine generates two files on the output:
-
mpt_getInput.c - which contains the PWA/PWQ function including the sequential search
-
mpt_getInput_mex.c - mex interface for evaluation in Matlab
The file mpt_getInput_mex can be compiled inside Matlab and used for fast evaluation of PWA/PWQ
function. The compilation is invoked by mex routine as follows:
mex mpt_getInput_mex
The PWA/PWQ function can be exported using the tie-break option if the function is multiple valued.
The tie-breaking option determines which value of PWA/PWQ function will be evaluated based on the selecting the
minimum in the tie-breaking function. In this case, the tie-breaking function must be attached to the
PolyUnion object as well. If no tie-breaking function is provided, the first found value
in the sequential search of PWA/PWQ function is evaluated.
The function toC() can export the floating point numbers to single or double precision. The default
setting is double but this can be modified in global options
modules.geometry.unions.PolyUnion.toC.
Input Arguments
function |
Name of the attached PWA/PWQ function to export.
Class: char
|
filename |
Base name of the file to be generated.
Class: char
|
tie_break_fcn |
Name of the attached scalar PWA/PWQ function to be used in tie-breaking case.
Class: char
|
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch
© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk