//this is a file in the VAc dynamic model software package //Copyright: Rong Chen and Kedar Dave, June 2002 //VERSION 1.0 //This routine provides a transmitter algorithm //original author: Francisco Reyes-De Leon, Chemical Engineering Department, Lehigh University //modified by Rong Chen //mex transmit.c #include #include #include void Transmit(double *x_out, double *y_out, double y_original, double x[], double y[], double ded, double tau, int Nded, int Nlag, double h, double LO, double HI) //y_original: measurement //x: storage spaces for deadtime //y: storage spaces for lag time //ded: should be "transmitter_deadtime" defined above //tau: should be "transmitter_lag" defined above //Nded: measurement deadtime storage, which should be 1+transmitter_deadtime*transmitter_sampling_frequency //Ntau: measurement time constant storage, which should be 1 all the time //h: transmitter sampling time //LO HI: measurement range { int i; double dy; if (ded >= 1e-4) { for (i=Nded-1;i>=1;i--) { x_out[i]= x[i-1]; } } x_out[0]= (y_original -LO)/(HI -LO); if (x_out[0] <0) x_out[0]= 0; else { if (x_out[0] >1) x_out[0]= 1; } if (tau > 1e-4) { for (i=0;i