23
23
* See the file ./license.txt
25
25
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="scicos_simulate">
27
<refname>scicos_simulate</refname>
28
<refpurpose>Function for running xcos simulation in batch mode</refpurpose>
31
<title>Calling Sequence</title>
32
<synopsis>Info=scicos_simulate(scs_m)</synopsis>
33
<synopsis>Info=scicos_simulate(scs_m,Info)</synopsis>
34
<synopsis>Info=scicos_simulate(scs_m,context)</synopsis>
35
<synopsis>Info=scicos_simulate(scs_m,flag)</synopsis>
36
<synopsis>Info=scicos_simulate(scs_m ,Info [, context] [,flag])</synopsis>
38
<refsection id="Parameters_scicos_simulate">
39
<title>Arguments</title>
42
<term>scs_m</term>: A diagram data structure (see <link linkend="scicos_diagram">scs_m structure</link>).
46
<term>Info</term>: A list. It must be set to <literal>list()</literal> at
47
the first call, then use output <literal>Info</literal> as
48
input <literal>Info </literal>for the next
49
calls. <literal>Info</literal> contains compilation and
50
simulation information and is used to avoid recompilation when
55
<term>ContextValues</term>: A Scilab struct containing values of symbolic variables
56
used in the context and xcos blocks.
60
<term>flag</term>: A string. If it equals 'nw' (no window),
61
then blocks using graphical windows are not executed. Note
62
that the list of such blocks must be updated as new blocks are
67
<refsection id="Module_scicos_simulate">
27
<refname>scicos_simulate</refname>
28
<refpurpose>Function for running xcos simulation in batch mode</refpurpose>
31
<title>Calling Sequence</title>
32
<synopsis>Info=scicos_simulate(scs_m)</synopsis>
33
<synopsis>Info=scicos_simulate(scs_m,Info)</synopsis>
34
<synopsis>Info=scicos_simulate(scs_m,context)</synopsis>
35
<synopsis>Info=scicos_simulate(scs_m,flag)</synopsis>
36
<synopsis>Info=scicos_simulate(scs_m ,Info [, context] [,flag])</synopsis>
38
<refsection id="Parameters_scicos_simulate">
39
<title>Arguments</title>
42
<term>scs_m</term>: A diagram data structure (see <link linkend="scicos_diagram">scs_m structure</link>).
46
<term>Info</term>: A list. It must be set to <literal>list()</literal> at
47
the first call, then use output <literal>Info</literal> as
48
input <literal>Info </literal>for the next
49
calls. <literal>Info</literal> contains compilation and
50
simulation information and is used to avoid recompilation when
55
<term>ContextValues</term>: A Scilab struct containing values of symbolic variables
56
used in the context and xcos blocks.
60
<term>flag</term>: A string. If it equals 'nw' (no window),
61
then blocks using graphical windows are not executed. Note
62
that the list of such blocks must be updated as new blocks are
67
<refsection id="Module_scicos_simulate">
72
<link linkend="xcos">xcos</link>
77
<refsection id="Description_scicos_simulate">
78
<title>Description</title>
79
This function is used to simulate xcos diagrams in batch
80
mode. It requires the <link linkend="scicos_diagram">scs_m
83
which can be obtained by loading in Scilab the
84
<literal>.xcos</literal> file (see <link linkend="importXcosDiagram">
72
<link linkend="xcos">xcos</link>
77
<refsection id="Description_scicos_simulate">
78
<title>Description</title>
79
This function is used to simulate xcos diagrams in batch
80
mode. It requires the <link linkend="scicos_diagram">scs_m
83
which can be obtained by loading in Scilab the
84
<literal>.xcos</literal> file (see <link linkend="importXcosDiagram">
90
The <literal>ContextValues</literal> may be used to change
91
the main parameters value set in the main diagram
92
context. example: if the variable <literal>A</literal> is set to 1
93
in the main context of the diagram. One can change the
94
<literal>A</literal> value for a <literal>scicos_simulate</literal> simulation by setting
95
<programlisting role="example"><![CDATA[
90
The <literal>ContextValues</literal> may be used to change
91
the main parameters value set in the main diagram
92
context. example: if the variable <literal>A</literal> is set to 1
93
in the main context of the diagram. One can change the
94
<literal>A</literal> value for a <literal>scicos_simulate</literal> simulation by setting
95
<programlisting role="example"><![CDATA[
97
97
]]></programlisting>
99
<para> It is also possible to use variables defined inside Scilab
100
directly without using the <literal>ContextValues</literal>
101
argument, but for such a use the context definition must allow
102
this: example, if one wants to allow simulation use the
103
<literal>A</literal> Scilab variable value for the parameter
104
<literal>A</literal> the diagram context definition should contain
105
<programlisting role="example"><![CDATA[
99
<para> It is also possible to use variables defined inside Scilab
100
directly without using the <literal>ContextValues</literal>
101
argument, but for such a use the context definition must allow
102
this: example, if one wants to allow simulation use the
103
<literal>A</literal> Scilab variable value for the parameter
104
<literal>A</literal> the diagram context definition should contain
105
<programlisting role="example"><![CDATA[
106
106
if ~exists('A') then A=1,end
107
107
]]></programlisting> Note that this second solution is
108
fragile because it rely on the current value of
109
<literal>A</literal> in Scilab.
112
<refsection id="Filecontent_scicos_simulate">
113
<title>File content</title>
116
<para> SCI/modules/scicos/macros/scicos_auto/scicos_simulate.sci</para>
120
<refsection id="Examples_scicos_simulate">
121
<title>Examples</title>
122
The xcos diagram in <literal>SCI/modules/xcos/demos/batch_simulation.xcos</literal>
125
<imagedata align="center" fileref="../../images/batch_simulation.png"/>
128
<programlisting role="example"><![CDATA[
108
fragile because it rely on the current value of
109
<literal>A</literal> in Scilab.
112
<refsection id="Filecontent_scicos_simulate">
113
<title>File content</title>
116
<para> SCI/modules/scicos/macros/scicos_auto/scicos_simulate.sci</para>
120
<refsection id="Examples_scicos_simulate">
121
<title>Examples</title>
122
The xcos diagram in <literal>SCI/modules/xcos/demos/batch_simulation.xcos</literal>
125
<imagedata align="center" fileref="../../images/batch_simulation.png"/>
128
<programlisting role="example"><![CDATA[
129
129
importXcosDiagram("SCI/modules/xcos/demos/batch_simulation.xcos")
131
131
typeof(scs_m) //The diagram data structure