fd = mopen(rpat+"/"+rdnom+"_void_io.c", "wt")
mputl(["/*";
- "** Copyright (c) 1989 - 2012 (INRIA)";
- "** Copyright (c) 2011 - 2013 (Scilab Enterprises)";
- "**";
"** Generated by Code_Generation toolbox of Xcos with "+getversion();
"** Date : "+date();
"*/"], fd);
//** Generate _act_sens_events.c
Code=["/*"
- "** Copyright (c) 1989 - 2012 (INRIA)"
- "** Copyright (c) 2011 - 2012 (Scilab Enterprises)"
- "**"
"** Generated by Code_Generation toolbox of Xcos with "+getversion()
"** Date :"+date()
"*/"
if (readGlobal <> [] | writeGlobal <> [])
fd = mopen(rpat+"/"+rdnom+"_read_write_global.c", "wt")
mputl(["/*"
- "** Copyright (c) 2012 - 2013 (Scilab Enterprises)"
- "**"
"** Generated by Code_Generation toolbox of Xcos with "+getversion()
"** Date :"+date()
"*/"
function ok=gen_gui42();
clkinput=ones(clkIN)';
clkoutput=ones(clkOUT)';
- //outtb=outtb;
- oz=cpr.state.oz;
-
- new_oz=list();
- for i=1:lstsize(oz)
- new_oz($+1) = oz(i)
- end
- for i=1:lstsize(outtb)
- new_oz($+1) = outtb(i)
- end
-
- //outtb($+1) = zeros(nblk,1);
- Code=["//";
- "// Copyright (c) 1989 - 2012 (INRIA)";
- "// Copyright (c) 2011 - 2013 (Scilab Enterprises)";
- "//";
- "// Generated by Code_Generation toolbox of Xcos with "+getversion();
- "// Date : "+date();
- "//"
- "function [x,y,typ]="+rdnom+"_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;";
- " case ''define'' then"
- " "+sci2exp(capt(:,3),"in",70); //input ports sizes 1
- " "+sci2exp(capt(:,4),"in2",70); //input ports sizes 2
- " "+sci2exp(scs_c_nb2scs_nb(capt(:,5)),"intyp",70); //input ports type
- " "+sci2exp(actt(:,3),"out",70); //output ports sizes 1
- " "+sci2exp(actt(:,4),"out2",70); //output ports sizes 2
- " "+sci2exp(scs_c_nb2scs_nb(actt(:,5)),"outtyp",70); //output ports type
- " "+sci2exp(x,"x",70); //initial continuous state
- " "+sci2exp(z,"z",70); //initial discrete state
- " work=zeros("+string(nblk)+",1)";
- " Z=[z;work]";
- " "+sci2exp(new_oz,"odstate",70);
- " "+sci2exp(cpr.sim.rpar,"rpar",70); //real parameters
- " "+sci2exp(cpr.sim.ipar,"ipar",70); //integer parameters
- " "+sci2exp(cpr.sim.opar,"opar",70); //object parameters
- " "+sci2exp(clkinput,"clkinput",70);
- " "+sci2exp(clkoutput,"clkoutput",70);
- " "+sci2exp(FIRING,"firing",70);
- " nzcross="+string(sum(cpr.sim.zcptr(2:$)-cpr.sim.zcptr(1:$-1)))';
- " nmode="+string(sum(cpr.sim.modptr(2:$)-cpr.sim.modptr(1:$-1)))';]
-
for i=1:length(bllst)
- deput=[%t,%f]
- if (bllst(i).dep_ut(2) == %t) then
- deput(1,2)=%t;
- break;
- end
- end
- Code($+1)=" "+sci2exp(deput,"dep_ut",70);
- Code=[Code
- " model=scicos_model(sim=list(''"+rdnom+"'',4),.."
- " in=in,.."
- " in2=in2,.."
- " intyp=intyp,.."
- " out=out,.."
- " out2=out2,.."
- " outtyp=outtyp,.."
- " evtin=clkinput,.."
- " evtout=clkoutput,.."
- " firing=firing,.."
- " state=x,.."
- " dstate=Z,.."
- " odstate=odstate,.."
- " rpar=rpar,.."
- " ipar=ipar,.."
- " opar=opar,.."
- " blocktype=''c'',.."
- " dep_ut=dep_ut,.."
- " nzcross=nzcross,.."
- " nmode=nmode)"
- " gr_i=''xstringb(orig(1),orig(2),''''"+rdnom+"'''',sz(1),.."
- " sz(2),''''fill'''')''";
- " x=standard_define([2 2],model,[],gr_i)";
- " end"
- "endfunction"];
+ deput=[%t,%f]
+ if (bllst(i).dep_ut(2) == %t) then
+ deput(1,2)=%t;
+ break;
+ end
+ end
+ Code=["function [sciblk, s1, s2] = "+rdnom+"_c(job,sciblk,e1)"
+ "// Interfacing function of generated Xcos block "+rdnom
+ "// Generated by the Xcos Code_Generation tool with "+getversion();
+ "// Date : "+date();
+ "//"
+ " s1= []; s2 = [];"
+ " select job";
+ " case ""set"" then";
+ " case ""define"" then"
+ " "+sci2exp(capt(:,3),"in",70); //input ports sizes 1
+ " "+sci2exp(capt(:,4),"in2",70); //input ports sizes 2
+ " "+sci2exp(scs_c_nb2scs_nb(capt(:,5)),"intyp",70); //input ports type
+ " "+sci2exp(actt(:,3),"out",70); //output ports sizes 1
+ " "+sci2exp(actt(:,4),"out2",70); //output ports sizes 2
+ " "+sci2exp(scs_c_nb2scs_nb(actt(:,5)),"outtyp",70); //output ports type
+ " "+sci2exp(cpr.state.x,"x",70); //initial continuous state
+ " "+sci2exp(cpr.state.z,"z",70); //initial discrete state
+ " work=zeros("+string(nblk)+",1)";
+ " Z=[z;work]";
+ " "+sci2exp(lstcat(cpr.state.oz,cpr.state.outtb),"odstate",70);
+ " "+sci2exp(cpr.sim.rpar,"rpar",70); //real parameters
+ " "+sci2exp(cpr.sim.ipar,"ipar",70); //integer parameters
+ " "+sci2exp(cpr.sim.opar,"opar",70); //object parameters
+ " "+sci2exp(clkinput,"clkinput",70);
+ " "+sci2exp(clkoutput,"clkoutput",70);
+ " "+sci2exp(FIRING,"firing",70);
+ " nzcross="+string(sum(cpr.sim.zcptr(2:$)-cpr.sim.zcptr(1:$-1)))';
+ " nmode="+string(sum(cpr.sim.modptr(2:$)-cpr.sim.modptr(1:$-1)))';
+ " "+sci2exp(deput,"dep_ut",70);
+ " model=scicos_model(sim=list(''"+rdnom+"'',4),...";
+ " in=in,..."
+ " in2=in2,..."
+ " intyp=intyp,..."
+ " out=out,..."
+ " out2=out2,..."
+ " outtyp=outtyp,..."
+ " evtin=clkinput,..."
+ " evtout=clkoutput,..."
+ " firing=firing,..."
+ " state=x,..."
+ " dstate=Z,..."
+ " odstate=odstate,..."
+ " rpar=rpar,..."
+ " ipar=ipar,..."
+ " opar=opar,..."
+ " blocktype=''c'',..."
+ " dep_ut=dep_ut,..."
+ " nzcross=nzcross,..."
+ " nmode=nmode)";
+ " gr_i=""xstringb(orig(1),orig(2),"""""+rdnom+""""",sz(1),sz(2),""""fill"""")""";
+ " sciblk = standard_define([2 2],model,[],gr_i);";
+ " style_properties = [""blockWithLabel"";";
+ " ""verticalLabelPosition=middle"";";
+ " ""verticalAlign=middle"";";
+ " ""displayedLabel="+rdnom+"""];";
+ " sciblk.graphics.style = strcat(style_properties,"";"");";
+ " end"
+ "endfunction"];
//Create file
- ierr=execstr("mputl(Code,rpat+''/''+rdnom+''_c.sci'')","errcatch")
+ ierr=execstr("mputl(Code,rpat+""/""+rdnom+""_c.sci"")","errcatch")
if ierr<>0 then
message(lasterror())
ok=%f
//actt=[i uk nuk_1 nuk_2 uk_t bllst(i).ipar]
function Code=make_actuator(standalone)
Call=["/*"
- "** Copyright (c) 1989 - 2012 (INRIA)"
- "** Copyright (c) 2011 - 2013 (Scilab Enterprises)"
- "**"
"** Generated by Code_Generation toolbox of Xcos with "+getversion()
"** Date : "+date()
"*/"
mputl(["/*"
"** SCILAB Computational function"
- "** Copyright (c) 1989 - 2012 (INRIA)"
- "** Copyright (c) 2011 - 2013 (Scilab Enterprises)"
- "**"
"** Generated by Code_Generation toolbox of Xcos with "+getversion()
"** Date : "+date()
"*/"
" block_"+rdnom+"["+string(kf-1)+"].x = &(x["+...
string(xptr(kf)-1)+"]);"], fd);
else
- mputl([" block_"+rdnom+"["+string(kf-1)+"].nx = 1;";
+ mputl([" block_"+rdnom+"["+string(kf-1)+"].nx = 0;";
" block_"+rdnom+"["+string(kf-1)+"].x = &(zero);"
" block_"+rdnom+"["+string(kf-1)+"].xd = w;"], fd);
end
mputl(["/*"
"** Code prototype for standalone use"
- "**"
- "** Copyright (c) 1989 - 2012 (INRIA)"
- "** Copyright (c) 2011 - 2013 (Scilab Enterprises)"
- "**"
"** Generated by Code_Generation toolbox of Xcos with "+getversion()
"** Date : "+date()
"*/"