Sample menu:

news:

03 Juli 2013:
hart_0.4.5 released!

sourceforge project site »

CSS ist valide!

Valid XHTML 1.0 Strict

SourceForge.net Logo

Documentation:

Tutorials:

Example:

Documentation

Structure of a macro file

Each block need a macro file in the macros-directory.

function [x,y,typ] = hart_ser2par(job,arg1,arg2)

The macro is a scilab funtion. Filename and funktion name must be identical. The input and ouput structure must not be changed.

x=[];y=[];typ=[];
select job
case 'plot' then
  exprs=arg1.graphics.exprs;
  ch=exprs(1);samples=exprs(2)
  standard_draw(arg1)

In the plot part it is possible to plot the content of a variable in front of the block. Here the first variable "ch" and the second variable "samples" is loaded and can be used for plotting.

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)

The getinputs,getoutputs and getorigin parts should not be changed.

case 'set' then
  x=arg1
  model=arg1.model;
  graphics=arg1.graphics;
  exprs=graphics.exprs;
The set case is selected every time, when the block is opened in Scicos.
  while %t do
    [ok,ch,samples,exprs]=..
    getvalue('Set ser2par block parameters',..
    ['Channels:';
    'No of Samples:'],..
    list('vec',-1,'vec',-1),exprs)
The getvalue-funktion opens a graphical dialog. The first input-parameter is the title, the second parameter is the text of each box and the last parameter is the definition of the type that can be inserted. Following definition are possible: After the type, the size of the ith value has to be defined. It must be a integer or a 2-vector of integer, -1 stands for undefined dimension. The old values are saved in exprs. Each box has one variable in the output vector. If an error occurs, the first entry will be not true..
    if ~ok then break,end
Nothing will be saved, if an error occurs.
    outport=ch;
    inport=ch;
    if exists('inport') then in=ones(inport,1), else in=1, end
    if exists('outport') then out=ones(outport,1)*samples, else out=1, end
    [model,graphics,ok]=check_io(model,graphics,in,out,1,[])
The check_io funktion sets the dimension of the inputs and outputs.
    if ok then
      graphics.exprs=exprs;
      model.ipar=[ch;
      samples;];
      model.dstate=[];
      model.rpar=[];
      x.graphics=graphics;x.model=model
      break
    end
  end
In the next step, spezific parts of the the model-structure are changed. Take a look at the scilab help for more Information.
case 'define' then
  ch=1;
  samples=50;
  model=scicos_model()
  model.sim=list('rt_ser2par',4)
  outport=ch;
  inport=ch;
  if exists('inport') then model.in=ones(inport,1), else model.in=1, end
  if exists('outport') then model.out=ones(outport,1)*samples, else model.out=1, end
  model.evtin=[1]
  model.rpar=[]
  model.ipar=[ch;
  samples;]
  model.dstate=[];
  model.blocktype='d'
  model.dep_ut=[%f %f]
The define case is only selected once, when the block is inserted in the scicos diagram.
  exprs=[sci2exp(ch),sci2exp(samples)]
Each variable, which can be changed through the getvalue-dialog must inserted here.
  gr_i=['xstringb(orig(1),orig(2),[''1 -> ''+string(samples);''ser2par''],sz(1),sz(2),''fill'');']
  x=standard_define([3 2],model,exprs,gr_i)
This part defines the look of the block.
end
endfunction