<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hello Romain,<br>
    <br>
    The difference is due to the solver type. Your diagram currently
    selects the ODE solver Sundials/CVode - BDF - Newton.<br>
    <br>
        "xcos_simulate(scs_m, 4);" detects two continuous states and
    switches to a DAE solver (Sundials/IDA).<br>
    <br>
        "scicos_simulate(scs_m);" only detects one continuous state and
    keeps the ODE solver.<br>
    <br>
    This must be due to a Modelica compilation difference between xcos
    and scicos.<br>
    <br>
    I don't know the equations of your model so I cannot assess which
    method is correct.<br>
    <br>
    Also, I noticed that the context variables (C, R, T, end_time) are
    not present in the diagram, so what are you trying to change when
    you modify the context? You might want ot use the <a
      href="http://help.scilab.org/docs/5.4.1/fr_FR/ENDBLK.html">END</a>
    block to set the end time.<br>
    <br>
    Hope this helps,<br>
    Regards,<br>
    Paul<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 02/25/2014 05:52 PM, R0M1 wrote:<br>
    </div>
    <blockquote cite="mid:1393347159977-4028965.post@n3.nabble.com"
      type="cite">
      <pre wrap="">Dear Users,

Trying different compilation methods for this model, I found some
discrepancies in the results that I do not explain so far.

With the same .xcos model and .csv input file as in the first post, I
compile using /xcos_simulate/ and /scicos_simulate/:

The plots shows the difference between the results from the two methods.

Any idea on what is causing this ?

Thanks a lot.

Here is the code:

clear

// parameters
data=csvRead('input.csv',';');
input_current=evstr(data(:,1));
size1=length(input_current);

C=1/12900;
R=765;

T=0.0001; // timestep
time=[0:T:(size1-1)*T]'; // in s
end_time=time($)+T; // end time in s

// loading Xcos functions
loadScicos;
loadXcosLibs();
exec(loadpallibs,-1);

// loading model: creates scs_m
importXcosDiagram('graphic_model.xcos')

// first compilation method
scs_m.props.context=strcat(["C=",string(C),"; R=",string(R),";
T=",string(T)"; end_time=",string(end_time)]);
xcos_simulate(scs_m,4) // '4' is to perform compilation

graph_voltage_1=graph_voltage.values; // output variable

// second compilation method
%scicos_context.C=C;
%scicos_context.R=R;
%scicos_context.T=T;
%scicos_context.end_time=end_time;
Info=scicos_simulate(scs_m,list(),%scicos_context,flag='nw');

graph_voltage_2=graph_voltage.values; // output variable

set("current_figure",10)
plot(time,graph_voltage_1,'-b')
plot(time,graph_voltage_2,'-r')
xtitle('graph title','time (s)','voltage (V)');
hl=legend(['xcos_simulate';'scicos_simulate'],"in_upper_right");




--
View this message in context: <a class="moz-txt-link-freetext" href="http://mailinglists.scilab.org/Scilab-users-Problem-running-xcos-in-batch-mode-from-Scilab-tp4028765p4028965.html">http://mailinglists.scilab.org/Scilab-users-Problem-running-xcos-in-batch-mode-from-Scilab-tp4028765p4028965.html</a>
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Paul BIGNIER
Development engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
<a class="moz-txt-link-freetext" href="http://www.scilab-enterprises.com">http://www.scilab-enterprises.com</a> </pre>
  </body>
</html>