Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Ohje

Ohjeita webissä

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)

Tee alla kuvattu funktio

Code Block
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

//xcos_simulate(scs_m, 4);