Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Wiki Markup
h3. Ohje

[Ohjeita webissä|http://help.scilab.org/docs/5.4.0-beta-3/fr_FR/xcos_simulate.html]



xcos malli testausta varten  [^EkaKertaluvunMalli.xcos]





Tuo ensin xcos malli työtilaan funktiolla *{_}importXcosDiagram{_}*


\-->*{_}importXcosDiagram("/home/jes/Documents/scilab/EkaKertaluvunMalli.xcos")_*


Putsaa työtilasta vanhat simulaatiot
\-->clear post_xcos_simulate;
\-->pre_xcos_simulate(scs_m, 4)

h3. Tee alla kuvattu funktio


{code}
function continueSimulation=pre_xcos_simulate(scs_m, needcompile)
    // Retrieve all objects
    objs = scs_m.objs;

    clrBlock = [];
    //Looking for CLR block
    for i=1:size(objs)
        if objs(i).gui == "CLR" then
            clrBlock = objs(i);
            break;
        end
    end

    // Check if we found some CLR
    if isempty(clrBlock) then
        disp("No CLR block found.")
        return
    end

    // Retrieve exprs
    exprs = clrBlock.graphics.exprs;
    s = poly(0,'s');
    num = eval(exprs(1));
    den = eval(exprs(2));
    h = syslin('c', num/den);
    // Open new figure then plot Bode
    scf(max(winsid())+1);
    bode(h, 0.01, 100);

    // Stop after bode plot. We do not want any simulation.
    continueSimulation = %f;
endfunction
{code}
//xcos_simulate(scs_m, 4);