Tutorial: Simulate and then generating code from a Scicos diagram
Before execute this simple tutorial follow installation procedure described in installig scicoslab tutorial
How to simulate and then generating code from a Scicos diagram
Note: The images showed below refer to the example for FLEX named DCmotor_Simulation.cos in the 'DCMotor' folder.
To simulate a diagram and then use the same diagram to generate code is advisable to proceed in this way.
- Create your diagram using a superblock that contains the diagram of your embedded application.
- Outside the superblock put your simulation blocks.
- To link the outer blocks with the inner blocks you can use Goto and From blocks.
See the images below.
By clicking on Simulate menu and selecting Run you can start the simulation. In this case you obtain the graph showed below.
To generate code there are two ways:
- Copy the superblock and create another diagram to be used for code generation.
- Remove Goto blocks and substitute From blocks with zero-constants source blocks.
The second approach is showed in the images below.
From the CodeGen menu, by clicking on the superblock, you can launch code generation.