28 memset(intJP11bit,0,
sizeof(intJP11bit));
38 void EEdsm1::setYear(
int y,
int *JPth,
int TPthrSelc,
int HTTPthrSelc){
41 for( i=0; i<mxTh; i++){
44 TPthrSelect=TPthrSelc;
45 HTTPthrSelect=HTTPthrSelc;
51 void EEdsm1::setWord(
int ch,
unsigned short val){
53 assert(ch>=0 && ch<nc);
61 EEdsm1::getInp16bit(
int ch)
const {
62 assert(ch>=0 && ch<nc);
63 unsigned short val=
data[ch];
70 EEdsm1::getInpHT2bit(
int ch)
const {
71 assert(ch>=0 && ch<nc);
72 unsigned short val=(
data[ch]& 0xfff) >>10;
84 EEdsm1::getInpTP2bit(
int ch)
const {
85 assert(ch>=0 && ch<nc);
87 unsigned short val=
data[ch] >>12;
94 EEdsm1::getInpHTTP2bit(
int ch)
const {
95 assert(ch>=0 && ch<nc);
97 unsigned short val=
data[ch] >>14;
104 EEdsm1::getInpTPsum(
int ch)
const {
105 assert(ch>=0 && ch<nc);
116 unsigned short val=0xfff;
132 else if (type == 2) {
168 int combHT2bit=0, combTP2bit=0, combHTTP2bit=0;
170 for ( i=0; i<nc; i++ ){
172 intJP11bit[iJP]+=getInpTPsum(i);
173 intJPsum13bit +=getInpTPsum(i);
174 if ( combHT2bit <= getInpHT2bit(i) ) combHT2bit = getInpHT2bit(i);
175 if ( combTP2bit <= getInpTP2bit(i) ) combTP2bit = getInpTP2bit(i);
176 if ( combHTTP2bit <= getInpHTTP2bit(i) ) combHTTP2bit = getInpHTTP2bit(i);
179 outHT2bit = combHT2bit;
184 if ( combTP2bit >= TPthrSelect ) outTP1bit=1;
187 if ( combHTTP2bit >= HTTPthrSelect ) outHTTP1bit=1;
192 for ( j=0; j<nJP; j++ ){
193 if ( mxJP <= intJP11bit[j] ) mxJP = intJP11bit[j];
196 if ( mxJP <= JPthr[0]) outJP2bit=0;
197 if ( mxJP > JPthr[0] && mxJP <= JPthr[1] ) outJP2bit=1;
198 if ( mxJP > JPthr[1] && mxJP <= JPthr[2] ) outJP2bit=2;
199 if ( mxJP > JPthr[2] ) outJP2bit=3;
202 flag =( intJPsum13bit >>7 ) & 0x3f;
203 if ( flag > 0 ) outJPsum5bit = 31;
204 else outJPsum5bit = ( intJPsum13bit >>2 ) & 0x1f;
206 out16bit= outJPsum5bit + ( outHTTP1bit << 7 ) + ( outTP1bit << 9 ) + ( outJP2bit << 10 ) + ( outHT2bit << 12 );
215 EEdsm1::print(
int k )
const {
216 printf(
"EEdsm1:: print() INPUTS, year=%d \n",mYear);
220 for(i=nc-1;i>=0;i--) printf(
" %4d ",i);
222 for(i=nc-1;i>=0;i--) printf(
" x%4.4x ",
data[i] );
224 printf(
"\nTPsum = ");
225 for(i=nc-1;i>=0;i--) printf(
" %4d ", getInpTPsum(i));
227 printf(
"\nJPsum = ");
228 for(i=2;i>=0;i--) printf(
" %8d ", intJP11bit[i]);
230 printf(
"\nHT2bit= ");
231 for(i=nc-1;i>=0;i--) printf(
" %4d ", getInpHT2bit(i));
234 printf(
"\nTP2bit= ");
235 for(i=nc-1;i>=0;i--) printf(
" %4d ", getInpTP2bit(i));
237 printf(
"\nHTTP2bit=");
238 for(i=nc-1;i>=0;i--) printf(
" %4d ", getInpHTTP2bit(i));
241 printf(
"\n output: HT2bit=%d, JP2bit=%d, TP1bit=%d, HTTP1bit=%d, JPsum5bit=%d\n", outHT2bit ,outJP2bit, outTP1bit ,outHTTP1bit,outJPsum5bit);