最近幾天我在Scicoslab中遇到了難以理解的問題。
我一直在爲C中的scicos編寫一些通信塊(將數據發送到外部應用程序),然後用它自己的代碼包裝它們。問題是,即使代碼工作(我已經檢查每一個可能輸出),scicos給了我此錯誤消息:sicosim: error. Type 0 not yet supported by outtb.
Error Screenshot
這裏是傳感器調度模塊的C函數的代碼:「scicosim:error。類型0尚未支持outtb。」如何解決這個問題呢?
這是塊定義代碼(在SCILAB代碼):
function [x,y,typ] = SENS_Disp(job,arg1,arg2)
x=[];y=[];typ=[];
select job
case 'plot' then
exprs=arg1.graphics.exprs;
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
model=arg1.model;graphics=arg1.graphics;
exprs=graphics.exprs;
case 'define' then
model = scicos_model()
model.sim = list('bro_comm_sens_disp',4)
model.out = [1;1;1;1;1;1;1]
model.out2 = [1;1;1;1;1;1;1]
model.outtyp= [1;1;1;1;1;1;1]
model.in = [1;3;3;3;3;3;3;3]
model.in2 = [1;1;1;1;1;1;1;1]
model.intyp = [3;1;1;1;1;1;1;1]
model.evtin = []
model.rpar = []
model.ipar = []
model.dstate=[1];
model.blocktype='c'
model.dep_ut=[%t %f]
exprs=[]
gr_i=['xstringb(orig(1),orig(2),[''Sensors'';+''Dispatcher''],sz(1),sz(2),''fill'');']
x=standard_define([3 2],model,exprs,gr_i)
end
endfunction
塊的第一個輸入端口是通信的套接字描述符,而其他七個端口連接到設置塊。輸出返回從外部應用程序接收到的數據。 我試着瀏覽Scilab代碼,我知道我得到的錯誤告訴我數據的類型已被錯誤地設置,但我已經檢查過,但情況並非如此。
這裏是Scicoslab的輸出誤差的代碼:
/*set vectors of outtb*/
for (j=0; j<nlnk; j++) { /*for each link*/
subheader=(int *)(listentry(il_state_outtb,j+1)); /*get header of outtbl(j+1)*/
outtbsz[j]=subheader[1]; /*store dimensions*/
outtbsz[j+nlnk]=subheader[2];
switch (subheader[0]) { /*store type and address*/
/*matrix of double*/
case 1 :
switch (subheader[3]) {
case 0 :
outtbtyp[j]=SCSREAL_N; /*double real matrix*/
outtbptr[j]=(SCSREAL_COP *)(subheader+4);
break;
case 1 :
outtbtyp[j]=SCSCOMPLEX_N; /*double complex matrix*/
outtbptr[j]=(SCSCOMPLEX_COP *)(subheader+4);
break;
default :
Scierror(888,\
"%s : error. Type %d of double scalar matrix not yet supported "
"for outtb.\n",\
fname,subheader[3]);
FREE(outtbptr);
FREE(outtbtyp);
FREE(outtbsz);
FREE(opar);
FREE(oparsz);
FREE(opartyp);
FREE(oz);
FREE(ozsz);
FREE(oztyp);
FREE(lfunpt);
freeparam;
FREE(outtb_elem);
break;
}
break;
/*matrix of integers*/
case 8 :
switch (subheader[3]) {
case 1 :
outtbtyp[j]=SCSINT8_N; /*int8*/
outtbptr[j]=(SCSINT8_COP *)(subheader+4);
break;
case 2 :
outtbtyp[j]=SCSINT16_N; /*int16*/
outtbptr[j]=(SCSINT16_COP *)(subheader+4);
break;
case 4 :
outtbtyp[j]=SCSINT32_N; /*int32*/
outtbptr[j]=(SCSINT32_COP *)(subheader+4);
break;
case 11 :
outtbtyp[j]=SCSUINT8_N; /*uint8*/
outtbptr[j]=(SCSUINT8_COP *)(subheader+4);
break;
case 12 :
outtbtyp[j]=SCSUINT16_N; /*uint16*/
outtbptr[j]=(SCSUINT16_COP *)(subheader+4);
break;
case 14 :
outtbtyp[j]=SCSUINT32_N; /*uint32*/
outtbptr[j]=(SCSUINT32_COP *)(subheader+4);
break;
default :
Scierror(888,\
"%s : error. Type %d of integer scalar matrix not yet supported "
"for outtb.\n",\
fname,subheader[3]);
FREE(outtbptr);
FREE(outtbtyp);
FREE(outtbsz);
FREE(opar);
FREE(oparsz);
FREE(opartyp);
FREE(oz);
FREE(ozsz);
FREE(oztyp);
FREE(lfunpt);
freeparam;
FREE(outtb_elem);
break;
}
break;
default :
Scierror(888,"%s : error. Type %d not yet supported for outtb.\n",fname,subheader[0]);
FREE(outtbptr);
FREE(outtbtyp);
FREE(outtbsz);
FREE(opar);
FREE(oparsz);
FREE(opartyp);
FREE(oz);
FREE(ozsz);
FREE(oztyp);
FREE(lfunpt);
freeparam;
FREE(outtb_elem);
return 0;
break;
}