diff options
Diffstat (limited to 'js/Misc/MPBLOCK.js')
-rw-r--r-- | js/Misc/MPBLOCK.js | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/js/Misc/MPBLOCK.js b/js/Misc/MPBLOCK.js index 83ed4ff3..2342fd37 100644 --- a/js/Misc/MPBLOCK.js +++ b/js/Misc/MPBLOCK.js @@ -1,35 +1,35 @@ /* autogenerated from "macros/Misc/MPBLOCK.sci" */ function MPBLOCK() { MPBLOCK.prototype.define = function MPBLOCK() { -in1=["u"]; -intype=["I"]; -out=[["y1"],["y2"]]; -outtype=[["I"],["I"]]; +this.in1=["u"]; +this.intype=["I"]; +this.out=[["y1"],["y2"]]; +this.outtype=[["I"],["I"]]; param=[]; paramv=list(); pprop=[]; nameF="myModel"; -exprs=tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],sci2exp(in1.slice()),sci2exp(intype.slice()),sci2exp(out.slice()),sci2exp(outtype.slice()),sci2exp(param.slice()),list(string(0.1),string(.0001)),sci2exp(pprop.slice()),nameF,[]); +exprs=tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],sci2exp(this.in1.slice()),sci2exp(this.intype.slice()),sci2exp(this.out.slice()),sci2exp(this.outtype.slice()),sci2exp(param.slice()),list(string(0.1),string(.0001)),sci2exp(pprop.slice()),nameF,[]); model=scicos_model(); model.blocktype="c"; model.dep_ut=[true,true]; model.rpar=[]; -for (i=1;i<=lstsize[paramv-1];i+=1) { +for (i=1;i<=lstsize(paramv);i+=1) { model.rpar=[[model.rpar],[paramv[i-1].slice()]]; } mo=modelica(); mo.model=nameF; mo.parameters=list(param,paramv); model.sim=list(mo.model,10004); -mo.inputs=in1; -mo.outputs=out; +mo.inputs=this.in1; +mo.outputs=this.out; model.in1=ones(size(mo.inputs,"r"),1); model.out=ones(size(mo.outputs,"r"),1); model.equations=mo; gr_i=[]; x=standard_define([3,2],model,exprs,gr_i); -x.graphics.in_implicit=intype; -x.graphics.out_implicit=outtype; +x.graphics.in_implicit=this.intype; +x.graphics.out_implicit=this.outtype; } MPBLOCK.prototype.details = function MPBLOCK() { } @@ -40,7 +40,7 @@ x=arg1; model=arg1.model; graphics=arg1.graphics; exprs=graphics.exprs; -if (type[exprs-1]==15) { +if (this.type[exprs-1]==15) { paramv=list(); pprop=[]; for (i=1;i<=size(model.rpar,"*");i+=1) { @@ -62,7 +62,7 @@ x_message("Error in evaluation of variables."); ok=false; } if (ok) { -for (i=1;i<=size(in1,"*");i+=1) { +for (i=1;i<=size(this.in1,"*");i+=1) { r=false; ierr=execstr("r=validvar(in(i))","errcatch"); if (!r) { @@ -71,11 +71,11 @@ break; } } if (!ok) { -x_message([["Invalid variable name for the input "+string(i)+"."],["\""+in1[i-1]+"\""],["Please choose another variable name."]]); +x_message([["Invalid variable name for the input "+string(i)+"."],["\""+this.in1[i-1]+"\""],["Please choose another variable name."]]); } } if (ok) { -for (i=1;i<=size(out,"*");i+=1) { +for (i=1;i<=size(this.out,"*");i+=1) { r=false; ierr=execstr("r=validvar(out(i))","errcatch"); if (!r) { @@ -84,7 +84,7 @@ break; } } if (!ok) { -x_message([["Invalid variable name for the output "+string(i)+"."],["\""+out[i-1]+"\""],["Please choose another variable name."]]); +x_message([["Invalid variable name for the output "+string(i)+"."],["\""+this.out[i-1]+"\""],["Please choose another variable name."]]); } } if (ok) { @@ -102,8 +102,8 @@ x_message([["Invalid variable name for the parameter "+string(i)+"."],["\""+para } } if (ok) { -for (i=1;i<=size(intype,"*");i+=1) { -if (intype[i-1]!="E"&&intype[i-1]!="I") { +for (i=1;i<=size(this.intype,"*");i+=1) { +if (this.intype[i-1]!="E"&&this.intype[i-1]!="I") { x_message("Input type should be \'E\' or \'I\'!"); ok=false; break; @@ -111,8 +111,8 @@ break; } } if (ok) { -for (i=1;i<=size(outtype,"*");i+=1) { -if (outtype[i-1]!="E"&&outtype[i-1]!="I") { +for (i=1;i<=size(this.outtype,"*");i+=1) { +if (this.outtype[i-1]!="E"&&this.outtype[i-1]!="I") { x_message("Output type should be \'E\' or \'I\'!"); ok=false; break; @@ -120,13 +120,13 @@ break; } } if (ok) { -if (or(size(intype)!=size(in1))) { +if (or(size(this.intype)!=size(this.in1))) { x_message("Input variables are not well defined!"); ok=false; } } if (ok) { -if (or(size(outtype)!=size(out))) { +if (or(size(this.outtype)!=size(this.out))) { x_message("Output variables are not well defined!"); ok=false; } @@ -145,31 +145,31 @@ ok=false; } } if (ok) { -if (funam=="") { +if (this.funam=="") { x_message("The model name is not defined!"); ok=false; } } if (ok) { -[dirF,nameF,extF]=fileparts(funam); +[dirF,nameF,extF]=fileparts(this.funam); if ((extF!="")||(dirF!="")) { x_message("Invalid model name!"); ok=false; } } if (ok) { -intypex=find(intype=="I"); -outtypex=find(outtype=="I"); -[model,graphics,ok]=set_io(model,graphics,list([ones(in1),ones(in1)],ones(in1)),list([ones(out),ones(out)],ones(out)),[],[],intypex,outtypex); +intypex=find(this.intype=="I"); +outtypex=find(this.outtype=="I"); +[model,graphics,ok]=set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); } if (ok) { Tparam_lab=evstr(Tparam); Tparam_sz=size(Tparam_lab,"*"); -if (Tparam_sz>lstsize[lab_2-1]) { -for (i=1;i<=(Tparam_sz-lstsize[lab_2-1]);i+=1) { +if (Tparam_sz>lstsize(lab_2)) { +for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { lab_2[$+1-1]="0"; } -} else if (Tparam_sz<lstsize[lab_2-1]) { +} else if (Tparam_sz<lstsize(lab_2)) { lab_2_tmp=list(); if (Tparam_sz!=0) { for (i=1;i<=Tparam_sz;i+=1) { @@ -217,8 +217,8 @@ execstr("paramv("+string(i)+")=%v"+string(i)); if (ok) { mo=modelica(); mo.model=nameF; -mo.inputs=in1; -mo.outputs=out; +mo.inputs=this.in1; +mo.outputs=this.out; if (pprop!=[]) { if (max(pprop)>0) { mo.parameters=list(transpose(param),paramv,transpose(pprop)); @@ -228,10 +228,10 @@ mo.parameters=list(transpose(param),paramv); } model.equations=mo; model.rpar=[]; -for (i=1;i<=lstsize[paramv-1];i+=1) { -model.rpar=[[model.rpar],[double[paramv[i-1].slice()-1]]]; +for (i=1;i<=lstsize(paramv);i+=1) { +model.rpar=[[model.rpar],[double(paramv[i-1].slice())]]; } -model.sim[1-1]=funam; +model.sim[1-1]=this.funam; exprs.in1=lab_1[1-1]; exprs.intype=lab_1[2-1]; exprs.out=lab_1[3-1]; @@ -239,8 +239,8 @@ exprs.outtype=lab_1[4-1]; exprs.param=lab_1[5-1]; exprs.paramv=list(); if (Tparam_sz!=0) { -if (type[lab_2-1]==15) { -for (i=1;i<=lstsize[lab_2-1];i+=1) { +if (this.type[lab_2-1]==15) { +for (i=1;i<=lstsize(lab_2);i+=1) { exprs.paramv[i-1]=lab_2[i-1]; } } else { @@ -254,8 +254,8 @@ exprs.nameF=lab_1[7-1]; exprs.funtxt=""; x.model=model; graphics.gr_i[1-1][1-1]="txt=[\' "+nameF+" \'];"; -graphics.in_implicit=intype; -graphics.out_implicit=outtype; +graphics.in_implicit=this.intype; +graphics.out_implicit=this.outtype; graphics.exprs=exprs; x.graphics=graphics; break; |