Scilab Reference Manual |
---|
scicosim — Scicos simulation function
[state,t]=scicosim(state,0,tf,sim,'start' ,tol) [state,t]=scicosim(state,tcur,tf,sim,'run' ,tol) [state,t]=scicosim(state,tcur,tf,sim,'finish' ,tol)
state | : Scilab tlist contains scicosim initial state. Usually generated by Scicos Compile or Run menus (see scicos_cpr for more details). |
tcur | : initial simulation time |
tf | : final simulation time (Unused with options 'start' and 'finish' |
sim | : Scilab tlist. Usually generated by Scicos Compile menu (see scicos_cpr for more details). |
tol | : 4 vector [atol,rtol,ttol,deltat] where atol, rtol are respectively the absolute and relative tolerances for ode solver (see ode), ttol is the precision on event dates. deltat is maximum integration interval for each call to ode solver. |
t | : final reached time |
Simulator for Scicos compiled diagram. Usually scicosim is called by scicos to perform simulation of a diagram.
But scicosim may also be called outside Scicos. Typical usage in such a case may be:
1 | Use Scicos to define a block diagram, compile it. |
2 | Save the compiled diagram using Save ,SaveAs Scicos menus . |
3 | In Scilab, load saved file using load function. You get variables scicos_ver, scs_m, %cpr scs_m is the diagram Scicos main data structure. %cpr (see scicos_cpr) is a data structure with fields state ,sim ,cor ,corinv if the diagram had been compiled before saved, else %cpr=list(). |
4 | Extract state out of %cprstate=%cpr.state |
5 | Execute [state,t]=scicosim(state,0,tf,%cpr.sim,'start' ,tol) for initialisation. |
6 | Execute [state,t]=scicosim(state,0,tf,%cpr.sim,'run' ,tol]) for simulation from 0 to tf. Many successives such calls may be performed changing initial and final time. |
7 | Execute [state,t]=scicosim(state,0,tf,%cpr.sim,'finish' ,tol) at the very end of the simulation to close files,... For advanced user it is possible to "manually" change some parameters or state values |
The tol parameter is fixed is Scicos by the Run/Setup menu. In scicos its default value is [0.0001,0.000001,1D-10,10000]
<< scicos_graphics | scicos_link >> |