[Scilab-users] Problem running xcos in batch mode from Scilab

Paul Bignier paul.bignier at scilab-enterprises.com
Wed Feb 26 09:57:13 CET 2014


Hello Romain,

The difference is due to the solver type. Your diagram currently selects 
the ODE solver Sundials/CVode - BDF - Newton.

     "xcos_simulate(scs_m, 4);" detects two continuous states and 
switches to a DAE solver (Sundials/IDA).

     "scicos_simulate(scs_m);" only detects one continuous state and 
keeps the ODE solver.

This must be due to a Modelica compilation difference between xcos and 
scicos.

I don't know the equations of your model so I cannot assess which method 
is correct.

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 END 
<http://help.scilab.org/docs/5.4.1/fr_FR/ENDBLK.html> block to set the 
end time.

Hope this helps,
Regards,
Paul


On 02/25/2014 05:52 PM, R0M1 wrote:
> 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: http://mailinglists.scilab.org/Scilab-users-Problem-running-xcos-in-batch-mode-from-Scilab-tp4028765p4028965.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Paul BIGNIER
Development engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
http://www.scilab-enterprises.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140226/634c3912/attachment.htm>


More information about the users mailing list