[Scilab-users] Parsing and Manipulating Xcos Models

Grzegorz Skiba skiba.g at gmail.com
Thu Jan 29 08:21:17 CET 2015


Umut,

I think model (scs_m) recursive parsing script will be a good starting
point for you.  In Arduino Scilab boolbox you can find script that shows
how to create diagram with create_xcosdiagram() function -
http://forge.scilab.org/index.php/p/arduino/source/tree/HEAD/macros/ARDUINO_SCOPE.sci


function obj=scan_blocks(scs_m)
    obj = [];

    for i=1:(size(scs_m.objs)-1)
        if typeof(scs_m.objs(i))=="Block" then
            if
scs_m.objs(i).model.sim=="super"|scs_m.objs(i).model.sim=="csuper" then

                // if we have superblock make a recurrence call
                scs_m.objs(i).model.rpar =
scan_blocks(scs_m.objs(i).model.rpar);
            else

                // here you can modify your model
                if scs_m.objs(i).model.sim(1) == "your_block"
                    // do some modifications here
                end

            end
        end
    end

    obj = scs_m;
endfunction

Regards Grzegorz


2015-01-29 0:01 GMT+01:00 Dr.Umut Durak <umut.durak at tu-clausthal.de>:

> Hello open source simulation community,
>
> I would like to parse, search Xcos models and modify them via deleting,
> modifying and replacing its elements, namely blocks and lines. While it
> evident that I need to use the API namely scicos_block, scicos_link,
> scicos_diagram, etc., help pages and web resources fail to provide any
> example or so to speak a tutorial about how to use this API. Can anyone
> help me, and provide some examples about the use of these functions?
>
> Thanks in advance for your help,
>
> Umut
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150129/9be93ad0/attachment.htm>


More information about the users mailing list