[Scilab-Dev] Scilab interconnection

Federico Bergero fedebergero at gmail.com
Sat Mar 13 20:23:44 CET 2010


Thanks for the response Sylvestre.
Sorry I didn't gave more info regarding the work we did connecting
Scilab with our DEVS-Simulator
(http://sourceforge.net/projects/powerdevs/).
We wanted Scilab to act as a workspace for PowerDEVS (as it is Matlab
for Simulink) . To this end we modify Scilab so that it starts a new
thread that listens on a UDP port waiting for a request from
PowerDEVS. The request are direct representation of the command to
execute (a string like 'x=inv(A)*-b'), so if you send a UDP message
containing that string, it gets executed in Scilab workspace. In some
cases the new thread in Scilab gives the result of the last operation
(the 'ans' variable) back to PowerDEVS. Based on this mechanism we can
read and modify Scilab's variables and use it as a calculation engine.
This solution works but like I said before is rather nasty. It has
some problems, for example if you try use this mechanism while Scilab
is running another scripts, Scilabs dies.
Another problem is that as we modified Scilab's behaviour, we have to
distribute a modified binary with our package (for Linux and Windows).
Another issue is that we used Scilab 4.1.2, and have no yet done a
attempt to modify newer versions of Scilab.

Our first attempt was to use call_scilab, in fact we used this
solution for some time, but it didn't fulfill our objectives because
we needed a complete Scilab instance with GUI. This is because one of
our objectives was that the user of PowerDEVS could keep a live
workspace running between simulations. For example changing a variable
in Scilab workspace, running a DEVS simulation, change the variable
again and then run another simulation. If we had  implemented with
call_scilab, the Scilab workspace is lost after the first simulation
(because the program ends and quits).
Perhaps I haven't used it well but I think that if a process uses the
call_scilab mechanism, Scilab doesnt show a GUI, and when the caller
process finishes, the Scilab instance finishes too.

So I was wondering if there is a cleaner mechanism that the one we
have implemented.


Federico
On Sat, Mar 13, 2010 at 9:35 AM, Sylvestre Ledru
<sylvestre.ledru at scilab.org> wrote:
> Le vendredi 12 mars 2010 à 16:42 -0300, Federico Bergero a écrit :
>> Hi,
>>   we are currently developing a Discrete Event System Simulator
>> (PowerDEVS) and we are using Scilab as a workspace for calculation. We
>> have made a modification to Scilab in order to communicate both tools
>> by UDP, but this a rather nasty solution.
> I would be interested by a description of your work here.
> It could interest other people to have UDP connection available.
>
>> Is there a clean way that another process (the simulator) can access
>> and modify Scilab's workspace variables?
> call_scilab is probably what you are looking for:
> http://www.scilab.org/product/man/call_scilab.html
> Don't hesitate if you have any questions here.
>
>> I think that I'm trying to do something similar to the LabView
>> Gateway, where can I get more information.
> AFAIK, the labview gateway uses call_scilab.
> Allan, don't hesitate to correct me if I am wrong.
>
> Sylvestre
>
>> Thanks
>> Federico Bergero
>>
>> --
>> I find television very educational. Every time someone switches it on,
>> I go into another room and read a good book.
>>
>>
>>
>
> --
> -------------------------
> Sylvestre Ledru
> -------------------------
> The Scilab Consortium
> Digiteo
> Domaine de Voluceau
> Rocquencourt - B.P. 105
> 78153 Le Chesnay Cedex
> France
>
>



-- 
I find television very educational. Every time someone switches it on,
I go into another room and read a good book.



More information about the dev mailing list