[Scilab-users] Parsing and Manipulating Xcos Models

classic Classic list List threaded Threaded
2 messages Options
Dr.Umut Durak Dr.Umut Durak
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Parsing and Manipulating Xcos Models

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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Grzegorz Grzegorz
Reply | Threaded
Open this post in threaded view
|

Re: Parsing and Manipulating Xcos Models

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 <[hidden email]>:
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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users