Copyright VirtualSim 2004-2020 - All rights reserved
Simulink
Concept
Simulink model must be generated using the Simulink Coder (use to be Real-Time Workshop) before being linked with vsTASKER libraries.
Once the code is generated, it will be compiled and linked.
Unlink with Matlab functions, Simulink model does not produce a library. All code will be compiled every time simulation engine will be generated.
How to Use
Open or create you model inside Simulink (here, SimExample1.mdl)
Setup the Code in order to produce a code that is compatible with vsTASKER libraries and use a proper solver.
Tools::Code Generation::Options...
In this window, set the Solver and the Fixed-step value (in seconds) that must be coherent with the setting in vsTASKER for the Simulink object.
For the Code Generation, use the above settings (grt_malloc.tlc for the System, C++ for the Language and make_rtw for the Makefile)
The generated code will be put on the working directory of Matlab (in Matlab, for example: cd 'D:\VirtualSim\vsTasker\7\Runtime\Simulink\sinusoide' to set the working directory to point to the model sinusoide.mdl file; the generated code will then be there)
note: every time you do a change in the Simulink model, you will need to regenerate the C code and then, recompile the vsTASKER database to get a new simulation engine.
Create the Simulink object inside vsTASKER then set it.
Code Hints
I: is a macro that returns a pointer to the Input parameter structure of the Simulink model.
O: is a macro that returns a pointer to the Output parameter structure of the Simulink model.