Simulink¶
The Simulink front-end is loaded from a separate, closed-source library; see
Importing models. The usual entry point is
intrepyd.tools.translate_simulink.
simulink ¶
Python binding of the Simulink front-end.
The translator from Simulink models to intrepyd circuits is a C library (libintrepid_simulink.so on Linux, intrepid_simulink.dll on Windows), built and released from its own repository, as intrepid is. This module loads it with ctypes, when it is first needed: intrepyd works without it, and only translate_simulink() requires it.
The library is looked up first in the INTREPID_SIMULINK_LIBRARY environment variable, which must be the path of the library file, and then next to this module, which is where the packaged intrepyd ships it.
SimulinkError ¶
Bases: Exception
A model that cannot be translated: the message lists the reasons
translate_file ¶
translate_file(infilename, realtype='float', variables=None, scripts=None, mats=None, callbacks=True)
Translates a Simulink model, a .mdl or a .slx file, and returns the python module of its circuit, as a string. Raises SimulinkError, listing the blocks that cannot be translated, if the model cannot be.
realtype is 'float', to translate single and double as floats, exactly, or 'real', as reals, which is not exact but much easier for the engines. The workspace of MATLAB the model refers to is filled, in order, by the callbacks of the model (PreLoadFcn, PostLoadFcn, InitFcn: their loads of MAT files and their scripts), unless callbacks is False; then by the MAT files in mats (their Simulink.Bus objects and numeric variables); then by the MATLAB scripts of assignments in scripts; then by variables, which maps names to MATLAB expressions.