Interfacing function
eng


PERRDSM_c

File content


//PERRDSM_c Scicos DSM Fractional synthesizer phase error block
//Classical interface function ver1.0 - scilab-4.1.2
//25 février 2008 - INRIA - Author : A.Layec
function [x,y,typ]=PERRDSM_c(job,arg1,arg2)
 x=[]
 y=[]
 typ=[]

 select job

  case 'plot' then
    standard_draw(arg1)

  case 'getinputs' then
    [x,y,typ]=standard_inputs(arg1)

  case 'getoutputs' then
    [x,y,typ]=standard_outputs(arg1)

  case 'getorigin' then
    [x,y]=standard_origin(arg1)

  case 'set' then
    x        = arg1
    graphics = arg1.graphics
    model    = arg1.model
    exprs    = graphics.exprs

    while %t do
      [ok,K,M,herit,exprs]=getvalue('Set phase error DSM-frac. synthesizer block',...
        ['K';'M';'Inherit (no:0, yes:1)'],...
          list('mat',[-1,-2],'mat',[-1,-2],'vec',1),exprs)

      if ~ok then break, end;

      if or(size(K)<>size(M)) then
        message('K and M must have the same size.')
        ok=%f
      end

      if ok then
        if herit==1 then
          [model,graphics,ok]=set_io(model,graphics,...
                                     list([size(K,1) size(K,2)],3),...
                                     list([size(K,1) size(K,2)],3),[],[])
        else
          [model,graphics,ok]=set_io(model,graphics,...
                                     list([size(K,1) size(K,2)],3),...
                                     list([size(K,1) size(K,2)],3),1,[])
        end
        model.ipar     = [K(:);M(:)]
        graphics.exprs = exprs
        x.graphics     = graphics
        x.model        = model
        break
      end
    end

  case 'define' then

    K     = 100
    M     = 2^14
    herit = 1

    model           = scicos_model()
    model.sim       = list('perrdsm',4)
    model.in        = size(K,1)
    model.in2       = size(K,2)
    model.intyp     = 3
    model.out       = size(K,1)
    model.out2      = size(K,2)
    model.outtyp    = 3
    model.evtin     = []
    model.ipar      = [K(:);M(:)]
    model.blocktype = 'd'
    model.dep_ut    = [%t %f]

    gr_i=['txt=[''     DSM'';''Phase error''];';
                'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']

    exprs = [string(100);string('2^14');string(herit)]
    x     = standard_define([3 2],model,exprs,gr_i)
 end
endfunction