[Scilab-Dev] New xcos blocks executing scilab primitive functions

ericgernot gernot.eric at wanadoo.fr
Fri Apr 6 14:47:36 CEST 2018


Hi, 

I am new to scilab, and I am not a developper, but I fear I may become one
because of Scilab :-;
I am on windows 7 /64, and installed some recent versions.

I created a physic model (chemical process with compositions, streams, etc.)
from a script and used xcos to solve it, only using Sci_func blocks calling
my functions (so that it is easily portable to other scilab versions). It
works as desired, so now I want to speed it up.

After all the possible improvements from vectorization, I decided to convert
30% of my scifunc into superblocks, giving a 30% speedup boost to the model.
I could have written these in c/c++ also, but I suspect it would have taken
longer (for me)

My remaining scifunc blocks are using some scilab gateways such as fsolve,
diag, etc, thus the conversion is not as straighforward. 

I tried to convert it in c using the scilab 2 c toolbox, this is great for
all operations exept scilab gateways.

I had a look at how to create a new block, how the c-block work, and finally
how existing blocks are coded in c++.

If I understand well, the possibilities are
1. copy the c++ primitive function code in a c-block, it will not work
because it is not c, and because I don't know which libraries should be
included. By the way, where can I put them so that the compiler finds them ?
2. use scilab API from a xcos c-block and send jobs. Will it really skip the
interpreter ?
3. create a new block as a user (from within scilab). But you can't use c++
can you ? So I have to write or find c equivalent of scilab primitives, this
is a pity !
4. create a new block source code, and compile a new version of scilab with
the new block. I suppose that the same problem exists: converting to c
scilab primitives ?

So this raised a few questions:
 - In the block source code, why not call scilab built in functions in c/c++
(not the gateway), only passing them the block arguments / parameters,
instead of pasting the code there. That would ease the creation of new
blocks isn't it ?
 - can users call these built in functions in their custom blocks (e.g.
c-block) ? (I mean without invoking the parser etc., without linking already
linked libraries, etc.)

I suppose that many users ran through these problems.
Thank you very mucn
Regards, 
Eric




--
Sent from: http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.html



More information about the dev mailing list