/* autogenerated from "macros/Branching/DEMUX.sci" */ function DEMUX() { DEMUX.prototype.define = function DEMUX() { this.out = 2; model = scicos_model(); model.sim = list("multiplex",4); model.in1 = 0; model.out = -transpose([1:this.out]); model.ipar = this.out; model.blocktype = "c"; model.firing = []; model.dep_ut = [true,false]; exprs = string(this.out); gr_i = []; this.x = standard_define([.5,2],model,exprs,gr_i); return new BasicBlock(this.x); } DEMUX.prototype.details = function DEMUX() { return this.x; } DEMUX.prototype.get = function DEMUX() { var options = { out:["number of output ports or vector of sizes",this.out], } return options; } DEMUX.prototype.set = function DEMUX() { this.out = parseFloat((arguments[0]["out"])) this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { [ok,this.out,exprs] = scicos_getvalue("Set DEMUX block parameters",["number of output ports or vector of sizes"],list("intvec",-1),exprs); if (!ok) { break; } if (size(this.out,"*")==1) { if (this.out<2||this.out>31) { message("Block must have at least 2 and at most 31 output ports"); ok = false; } else { [model,graphics,ok] = check_io(model,graphics,0,-transpose([1:this.out]),[],[]); } } else { if (size(this.out,"*")<2||or(this.out==0)||size(this.out,"*")>31) { message([["Block must have at least 2 and at most 31 output ports"],["size 0 is not allowed"]]); ok = false; } else { if (min(this.out)<0) { nin = 0; } else { nin = sum(this.out); } [model,graphics,ok] = check_io(model,graphics,nin,this.out.slice(),[],[]); if (ok) { this.out = size(this.out,"*"); } } } if (ok) { graphics.exprs = exprs; model.ipar = this.out; this.x.graphics = graphics; this.x.model = model; break; } } return new BasicBlock(this.x); } }