[Scilab-users] Xcos : accelerate the simulation

Clément David clement.david at scilab-enterprises.com
Fri Oct 17 14:37:47 CEST 2014


Hello Quentin,

(answered in line)

> I have an Xcos diagram which is a simplification of a Simulink
> diagram. Both
> diagram use the same solver (Runge Kutta 4) but Xcos works at 100Hz
> and
> Simulink at 3000Hz
> 
> For the same result, Simulink needs 15sec (without accelerator mode)
> and
> Xcos 45sec.
> 
> 1) How could I decrease efficiently my simulation time? 

Do you have multiple clock ? If yes, sharing the same clock can reduce
simulation time. A diagram containing both event detection and
continuous states can also lead to greater simulation time.

> 2) Is there an equivalent to the simulink accelerator mode in Xcos?

No, there is not.

> 3) If I use the "code generation" for my diagramm, will it improve the
> simulation time?

Maybe, maybe not. The 'Tools -> Code generation' button will generate
code for a subsystem and convert it back on Xcos.

The generated code is basically a scheduler and C call to simulation
functions. As all these pieces are in a single compilation unit, the C
compiler can better optimize things than the Xcos simulator.

> --> If yes : How could I properly use the code generation mode?

Save your diagram, select a SUPER_f block, click on Tools->Code
generation.

Note that after the operation the sub-system can not be edited anymore,
all the blocks has been removed and a new block using the generated code
is generated at the same place.

--
Clément




More information about the users mailing list