exportToC
Purpose
Export the explicit controller to C-code
Syntax
controller.exportToC
controller.exportToC('filename')
controller.exportToC('filename','dirname')
Description
The routine exportToC generates C-code from the explicit controller.
A new directory is always created with the generated code. If no name of the
directory is provided in the second argument, the default name for the directory is
mpt_explicit_controller. If no file name is specified, the default name for the files
to to be generated is mpt_getInput. The directory contains three files:
-
mpt_getInput.c - The routine for evaluation of PWA control law.
-
mpt_getInput_mex.c - The mex interface for evaluation using Matlab.
-
mpt_getInput_sfunc.c - The Simulink interface for evaluation using the mpt_sim library.
The generated code can be used for fast evaluation of PWA control law. The generated mex interface file can
be compiled in Matlab (assuming that a C-compiler is installed and recognized in Matlab)
mex mpt_getInput_mex.c
and evaluated for a particular value of the parameters.
The Simulink interface is given by mpt_getInput_sfunc.c file. To compile the file,
type in Matlab
mex mpt_getInput_sfunc.c.
After succesful compilation, the generated mex-file can be evaluated within Simulink. For this purpose using
one can deploy the controller block from MPT Simulink library mpt_sim.
Input Arguments
filename |
Name of the header file to be generated.
Class: char
|
dirname |
Name of the directory to be generated.
Class: char
|
◀ |
empccontroller |
|
evaluate |
▶ |
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch
© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk