Tuesday, May 24, 2011

code generation scicoslab/scicos

c/c++ code generation from system blocks (Matlab/Simulink, Scilab/xcos, ScicosLab/Scicos) is really helpful for rapid-prototyping.

some documentation available here: http://www.scicos.org/CodeGen_doc.pdf


ScicosLab/Scicos provides (also Scilab/xcos) code-generation facility for generating a stand-alone “c” code. The generated file can be linked to various interface modules.


Create a block diagram in Scicos. Select the relevant blocks and make them as super block. And make it as super-block for code generation. Select “code generation” from the tool bar and generate the code for the super-block.



xxx_standalone.c
xxx_act_sens_events.c
libxxx.lib

where xxx is the name of the workspace.

Include these files in the visual-studio and create an executable.

Open loop response of 2nd order system:

I have given some constant input 1.0 in the “xxx_act_sens_events.c”
*((double *) y+(k+l*(*ny1))) =1.0;

Otherwise the program will be asking the input continuously for every iteration.


Ol1.txt is generated from the “generated code”
foo.txt is from the scicos generated output.

2 comments:

awhan said...

great post this one.. haven't tried it out yet but i will ... expecting more posts like this :)

Anonymous said...

Hi!

Can you tell me please, how you do it step-by-step?

I have a lot of files in superblock:insuperblock,machine.h,makefile_superblock,makefile_superblock.lcc,makefile_superblock.mak,scicos_block.h,scicos_block4.h,superblock.c,superblock_act_sens_events.c,superblock_c.sci,superblock_loader.sce,superblock_stab=ndalone.c,superblock_void_io.c.

I open MV studio and my actions?

Thanks for all.