Code Generation allows you to generate C-code out of any 20-sim model. Using built in templates, C-code can be generated for various targets.
The package 20-sim 4C helps you to run C-code on hardware to control machines and systems. 20-sim 4C imports models (C-code) from 20-sim and runs them on hardware like embedded arm boards, PC 104 systems and much more.
Generating C-code for use in MATLAB Simulink also includes a submodel block with input and output terminals. 20-sim uses the MEX-compiler, to compile this code directly into an S-function. These S-functions can also be used in the Real-Time Workshop in order to generate code for a specific platform, for instance xPC Target.
20-sim can generate standalone C-code for use in C and C++ programs. The generated C-code is supplied with several fixed step simulation algorithms to assure that it will run in real-time. The Euler and RungeKutta methods are supported by default.
All C-code templates are open and can be adapted by the user to assign compilers, run ftp-sessions and automate almost everything between the 20-sim code generation and the actual running of the code on a (remote) machine. During C-code generation support code is generated for 20-sim operators like matrix calculations and trigonometric functions.