tcsltj4.c

Go to the documentation of this file.
00001 #include <math.h>
00002 #include <memory.h>
00003 #include "machine.h"
00004 #include "scicos_block.h"
00005 #include "sci_mem_alloc.h"  /* malloc */
00006 
00007 extern int C2F(dmmul)();
00008 extern int C2F(dmmul1)();
00009 
00010 void tcsltj4(scicos_block *block,int flag)
00011 {
00012   /* Copyright INRIA
00013 
00014      Scicos block simulator
00015      continuous state space linear system simulator
00016      rpar(1:nx*nx)=A
00017      rpar(nx*nx+1:nx*nx+nx*nu)=B
00018      rpar(nx*nx+nx*nu+1:nx*nx+nx*nu+nx*ny)=C
00019      rpar(nx*nx+nx*nu+nx*ny+1:nx*nx+nx*nu+nx*ny+ny*nu)=D */
00020 
00021   int un=1,lb,lc;
00022   int nx=block->nx;
00023   double* x=block->x;
00024   double* xd=block->xd;
00025   double* rpar=block->rpar;
00026   double* y=block->outptr[0];
00027   double* u1=block->inptr[0];
00028   double* u2=block->inptr[1];
00029   int* outsz=block->outsz;
00030   int* insz=block->insz;
00031     
00032   lb=nx*nx;
00033   lc=lb;
00034   
00035   if (flag ==1 || flag ==6){
00036     /* y=c*x*/  
00037     C2F(dmmul)(&rpar[lc],outsz,x,&nx,y,outsz,outsz,&nx,&un);    
00038   }else if (flag == 2 && block->nevprt == 1){
00039     
00040     /* x+=u2 */
00041     memcpy(x,u2 ,nx*sizeof(double));
00042   }else if (flag ==0 && block->nevprt == 0){
00043     /* xd=a*x*/
00044     C2F(dmmul)(&rpar[0],&nx,x,&nx,xd,&nx,&nx,&nx,&un);
00045   }
00046 }
00047 

Generated on Sun Mar 4 15:04:00 2007 for Scilab [trunk] by  doxygen 1.5.1