<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>scicosim</TITLE>
  <TYPE>Scilab Function  </TYPE>
  <DATE>14-Apr-2005</DATE>
  <SHORT_DESCRIPTION name="scicosim">  Scicos (batch) simulation function </SHORT_DESCRIPTION>

  <CALLING_SEQUENCE>
  <CALLING_SEQUENCE_ITEM>[state,t] = scicosim(state,tcur,tf,sim,str,tol)</CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>

  <PARAM>
  <PARAM_INDENT>

    <PARAM_ITEM>
    <PARAM_NAME>state</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : Scilab tlist containing initial state. Usually generated by
    Scicos Compile. After loading a compiled .cos file, it can be
    found in %cpr.state.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>tcur</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : starting time of simulation. At the beginning it must be zero.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>tf</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : final simulation time.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>sim</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : Scilab tlist containing compilation results. Usually generated by
    Scicos Compile. After loading a compiled .cos file, it can be
    found in %cpr.sim.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>str</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : 'start' , 'run' or 'finish'. Function must be first called
    with 'start', then with 'run' one or more times, and finally with 'finish'.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>tol</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       :  vector [atol,rtol,ttol,deltat,realtimescale,solver,hmax]
    where atol, rtol are respectively the absolute and relative
    tolerances for ode or dae solver, ttol is the precision on
    event dates (must be very small). deltat is maximum integration interval for each call
    to ode solver (sometimes needed to force restaring the call to
    solver). raltimescale is the correspondance between simulation
    time and real time (0 means no slowing down). solver is the choice
    of solver (0: lsodar, 100: daskr). hmax: max step size used by
    solver. Default: [0.0001,1.000E-06,1.000E-10,100001,0,0]

       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>state</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : state after simulation
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>

    <PARAM_ITEM>
    <PARAM_NAME>t</PARAM_NAME>
    <PARAM_DESCRIPTION>
       <SP>
       : final reached time. Usually tf but not always.
       </SP>
    </PARAM_DESCRIPTION>
    </PARAM_ITEM>
  </PARAM_INDENT>
  </PARAM>
 
  <DESCRIPTION>
     <DESCRIPTION_INDENT>
     <DESCRIPTION_ITEM>
     <P>
      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 is the data structure containing (state,sim,cor,corinv) if the diagram had been compiled before saved, else %cpr=list(). 
	4- Extract state, sim out of cpr  
	5- Execute [state,t]=scicosim(state,0,tf,sim,'start',tol) for initialisation.  
	6- Execute [state,t]=scicosim(state,0,tf,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,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.  
     </P>

     </DESCRIPTION_ITEM>
     </DESCRIPTION_INDENT>
  </DESCRIPTION>



  <SEE_ALSO>
    <SEE_ALSO_ITEM> <LINK> scicos_simulate</LINK> </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM> <LINK> scicos</LINK> </SEE_ALSO_ITEM>
  </SEE_ALSO>

  <AUTHORS>
    <AUTHORS_ITEM label='Ramine Nikoukhah'>
    </AUTHORS_ITEM>
  </AUTHORS>

</MAN>
