You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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

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);

  • No labels
You must log in to comment.