Aa@d!HH $ d    dFootnote TableFootnote**. . / - % ]N0 ]NTOCHeadingYie YZ[\]^_`abcdY [] _ ac !<$lastpagenum><$monthname> <$daynum>, <$year>"<$monthnum>/<$daynum>/<$shortyear>;<$monthname> <$daynum>, <$year> <$hour>:<$minute00> <$ampm>"<$monthnum>/<$daynum>/<$shortyear><$monthname> <$daynum>, <$year>"<$monthnum>/<$daynum>/<$shortyear> <$fullfilename>  <$filename>^  <$paratext[Title]>W[  <$paratext[Heading]>  <$curpagenum>oz  <$marker1>F> <$marker2> (Continued)Pagepage<$pagenum>Heading & Page <$paratext> on page<$pagenum>See Heading & Page%See <$paratext> on page<$pagenum>. Table & Page7Table<$paranumonly>, <$paratext>, on page<$pagenum>+ (Sheet <$tblsheetnum> of <$tblsheetcount>) Title<$Title> wwnxxyyzz{{A||A}}~~[_AAKKtpaVTthnTynuJr>K$moT$daJhorJZthnTynuTr> E$miE$amE"Em>/E/<$E>E$moE<$dE$yeE"Em>/E/<$E>E$fuEe>E$fiE  EateE>W[E$paTadiT TnumTT>F>T$maTTtinTTeTgenTHeTageRtexRgeR>R HeRageRparRn pRenuR TaRe7RaraR <R>,T<$pTTet TtnuTblsE>) EleE>EEEExEEyEEE{EE|EEE~EE_EEAEKEKEVETETEJEKETEJEJEZETETEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EE EE EE ET ETETETETETETETETETETETETERERERERERERER ER!ER"ER#ER$ER%ER&ET'ET(ET)ET*ET+EE,EE-EE.EE/EE0EE1EE2EE3EE4EE5EE6EE7EE8EE9EE:EE;EE<EE=EE>QE?EE@EEAEEBEECEEDEEEEEFEEGEEHEEIEEJEEKEELEEMEENEEOEEPEEQEEREESEETEEUEEVEEWEEXEEYEEZEE[EE\EE]EE^E E_E E`E EaE EbE EcEEdEEeEfEEgEEhEEiEEjEEkEElEEmEEnEEoEEpEEqEErEEsEEtEEuE EvE!EwE"ExE#Ez[$Eu$duEw|EdvE}EH$ wxu EH$ EUU`E EHz xwyu EHz EUU`E H$ yxzu H$ EEUU`SOI-MDISU-LPARL Hz zy{u EHz EUUhE;a12/9/93b ]6^c110.IPVelocityd HH{z|u HHEEUTUT` EHH|{u HHEUTUT`E EH$ }~v EH$ EUU`ESU-LPARLSOI-MDI Hz ~}v Hz EUUh=_110.IPVelocity`Y7Z[12/9/93\ xHH~v HH EUTUT` ydH3K ^ H RH RFootnoteHqv? ^ EHzHz Single LineSH'Footnote UU ]6HvDf ^ HH| Double LineHH  Double Line E EHH  Single LineSUHZ TableFootnoteyEGX-Rb ^ EPoEPo TableFootnotedUTHH HH&K `MDI IP Velocity Algorithm * `vPhilip H. Scherrer BUT UT`z#SOI-TN-110  December 1993 dURUT [The following contains the definition of the IP velocity calculation. It begins with some qUPUTvYdiscussion/statements about the range of numbers expected and concludes with a c program ~UNUT@Ythat implements the algorithm. This document was used to generate the initial IP code. ULUT ^The velocity observable is described in the IPFR document where the terms I1, I2, I3, I4, Sa, UJUT@and Sc are defined. SUUHUT` Sa = I1 - I3 UFUT` Sc = I2 - I4 UDUT` UBUT`'Ssum = Sa + Sc = (I1 + I2) - (I3 + I4) RbU@UT` U>UT`Ssum > 0 and Sa > 0 when V > 0  U<UT`Ssum < 0 and Sc < 0 when V < 0 U:UT` )U8UT`Sa = 0 at about -1800 m/s 7U6UT`Sc = 0 at about +1800 m/s EU4UT` vSU2UT`er 0 U*UT`taalpha = Ssum/Sa aU(UT`ecelse U&UT` palpha = Ssum/(-Sc) U$UT`nt hU"UT`alpha = 0 for V=0 U UT`al UUT`%For 12 bit a-d range of Ix is 0:4095 sUUT  d^Assuming I0 disk center is set to 3/4 full well, I0 will be about 3000. Thus Sa max is about  UUT@ I51000. Alpha ranges from about +-2 for V=+-4000 m/s. #UUT UT_The expected range for velocity is about +-4000 m/s. We need a range of 8000 or 13 bits for V 0UUT@> with 1 m/s resolution. GUUT  a`A 15 bit lookup table will be used. The full range of alpha will be set as described below, to U6TUUTSc^+- 5.333 for a range of greater than +- 10,000 m/s with a resolution slightly better than 1 m/aUUT@r 9s. The scaling on alpha will be 5.333 * scale = 16384. mxUUT esXThe division will be done by a multiply by a lookup reciprocal. The reciprocal will be adecHH UTHH&r UTUTRdetermined by dividing a BIGNUMBER by each possible denominator value. BIGNUMBER URUTdi^is chosen to keep the values for Sa, Sc of 100 to 1000 (1 pass) mapped to 3000 to 30000. Sa, !UPUT rXSc should never exceed 2000 (1 pass) so we can multiply the 1 pass numbers by 16. this it.UNUTm/Smeans 1/1600 to 1/16000 should map into 30000 to 3000 respectively. Then BIGNUMBER lut;ULUTRshould be 3000*16000 = 48,000,000. We can adopt 3 * 2^24 which is 50,331,648 for HUJUT@ t BIGNUMBER. _UHUT  fYThen the calculated alpha will be BIGNUMBER * alpha. We want alpha of +- 2 to be scaled TlUFUTTh]into say +-6000 to allow the velocity range described above. Thus we need to multiply alpha dyUDUT@by9by about 3000. I will choose 3 * 1024 for this factor. UBUT`@So now we have wanted_alpha_index = BIGNUMBER/(3*1024) too big. U@UT ]But since the 16 bit multiply yeilds a 32 bit product, we can pick up the result in the high sU>UT@vaJorder word. So we WANT the target alpha index to be 2^16 times too big. U<UT`1 GSo we need to multiply by an additional (2^16) / (BIGNUMBER/(3*1024)). exU:UT  s`Thus we need to multiply the 32 bit product by 4, then take the lower 15 of the upper 16 bits. shU8UT0 UThis will give an alpha scaled +-2 into +-6144. The range for alpha is +-5.333 which ,U6UT@docorresponds to v = +-7183. 8 U4UT \The V lookup table should be constructed for alpha_index to be in the range +-16383 in a 15  U2UT@- Mbit lookup table. The max alpha will then be 2 * (16384/6144) = 5.3333333. g7U0UT` QThe performance of the algorithm is shown as the rms values for test as follows: NU.UT`favmaxI0passesnoiserms ]U,UT`an _lU*UT`UM400030001no1.2 {U(UT`400010001no3.2 t mU&UT`2 40005001no6.5 U$UT` i40004001no7.9 U"UT`r 40003001no261.0 taU UT`o  2UUT` 400030004yes9.5 SoUUT`ly400010004yes16.1 )UUT`0240005004yes23.2 UUT` t40004004yes26.0 prUUT`ak40003004yes263.0 pUUT`U8 T(UUT` w ?UUT`ed3The code for the routine and test program follows: h ,VUUT`do'#### REMOVE THIS AND ABOVE LINES ##### mU UT`ok tU UT`st#include dd 1- HH wHH g.UTUTUT`pe rURUT`itUT`float makeVlookup(); 6U<UT`int verbose = is_flag("-v"); U:UT`40+int passes = (int)parameter("passes",1.0); 03U8UT`U(int ntest = (int)parameter("n",2001.0); U6UT`ed$double I0 = parameter("I0",3000.0); ogU4UT`U double v, l; oU2UT` Ashort I1,I2,I3,I4; U0UT`ok"double dmin, dmax, dmean, dnoise; U.UT`int i; U,UT`8double *vdiff = (double *)malloc(ntest*sizeof(double)); -U*UT`7double *vobs = (double *)malloc(ntest*sizeof(double)); ;U(UT`L *double maxvtest=parameter("vmax",2500.0); IU&UT`'double delta=((2*maxvtest)/(ntest-1)); UTWU$UT`pefloat vcalib; eU"UT`UTdouble noise(); insU UT`int wantnoise = is_flag("-n"); `UUT` UUT`UDmakeVrecip(); UUT`vcalib = makeVlookup(); ; UUT`  hUUT`U>(initMDI(NULL, 0, 1.0, 1.0, 0, verbose); U<UUT`in eUUT`v"for (i=0; i400,000 electrons so noise (daTUT`UT#* is sqrt(I*100 electrons) with er(oTUT`U&* scaling 1/100. le}TUT`t)*/ dt HH HH.UTUTUT`U'I1 += sqrt((double)I1)*noise()/10.0; URUT` m'I2 += sqrt((double)I2)*noise()/10.0; U#UPUT`in'I3 += sqrt((double)I3)*noise()/10.0; U1UNUT` e'I4 += sqrt((double)I4)*noise()/10.0; i++?ULUT` } {MUJUT` -vobs[i] = Vcalc(I1,I2,I3,I4,passes)*vcalib; [UHUT` _Nvdiff[i] = vobs[i] - v; iUFUT` e_} l, wUDUT` U5statisticsd(vdiff,ntest,&dmin,&dmax,&dmean,&dnoise); aUBUT`4fprintf(stderr,"min=%f max=%f mean=%f stddev=%f\n", UU@UT`Idmin,dmax,dmean,dnoise); U>UT`UTif (is_flag("-p")) ntnU<UT`{ doU:UT`,0#dataplotd(vobs,ntest,"vresponse", `U8UT`(I*string("-%f:%f m/s",maxvtest,maxvtest), U6UT`00"V m/s (observed)"); U4UT`*dataplotd(vdiff,ntest,"vresponse error", U2UT`*string("-%f:%f m/s",maxvtest,maxvtest), U0UT`#"delta V m/s (observed-input)"); t((U.UT`/1} U,UT` m} -U*UT`)I n;U(UT`UP/* START ONBOARD CODE */ t((IU&UT`/1 ;WU$UT`short Vrecip[32768]; beU"UT`0;short Vlookup[32768]; sU UT` UUT` caBshort Vcalc(short I1, short I2, short I3, short I4, short passes) UUT`!UT{ UUT`"UDshort Sa, Sc, Ssum, recip; (vdUUT`#maunsigned short denom, alpha; UUT`$stshort shift_count; eanUUT`%Ulong prod_32; UUT`&me dUUT`'#shift_count = (passes == 4 ? 2 : UTUUT`(do(passes == 2 ? 3 : dU UT`)t,(passes == 1 ? 4 : 0))); ` U UT`*f: mUUT`+esSa = I1 - I3; )UUT`, (Sc = I2 - I4; 7UUT`- dEUUT`.stSa <<= shift_count; U2SUUT`/Sc <<= shift_count; xvaTUT`0U0 ToTUT`1elSsum = Sa + Sc; -i}TUT`2UT d m)IHH T HH ;.UTUTUT`3t if (Ssum > 0) URUT`40;denom = (unsigned short)Sa; T#UPUT`5Uelse 1UNUT`6al1denom = (unsigned short)-Sc; /* note sign */ s?ULUT`7! TMUJUT`8",denom &= 077777; /* use 15-bit table */ [UHUT`9 s tiUFUT`:Urecip = Vrecip[denom]; hifwUDUT`;UT UBUT`<d_prod_32 = Ssum * recip; dU@UT`= hU>UT`>se7prod_32 <<= 2;/* mult by 4 result in upper word */ : dU<UT`?t, U:UT`@ 0Ialpha = ((unsigned)prod_32 >> 16) & 0077777;/* extract 15 bit alpha */ TU8UT`A I U6UT`B-return(Vlookup[alpha]); stU4UT`Cnt} U2UT`D cU0UT`Exv U.UT`F T/* END ONBOARD CODE FOR V */ U,UT`G 2-U*UT`H/* START TABLE GENERATION */ ;U(UT`I IU&UT`J.#define BIGNUMBER (0300000000) /* 3 * 2^24 */ WU$UT`KUT eU"UT`L > makeVrecip() sU UT`M ({ UUT`NUP double tmp; UUUT`Oshort recip; UUT`P)-unsigned short i,j; sUUT`Q! TUUT`R"for (i=1; i<=32767; i++) sUUT`S{ UTUUT`TUFtmp = (double)BIGNUMBER/i; ipUUT`UUTif (tmp > 32767) UUT`Vprtmp = 32767; cipU UT`W=Vrecip[i] = tmp + 0.5; se U UT`X} lt UUT`YerVrecip[0] = 0; UT)UUT`ZU:} 7UUT`[a  (EUUT`\> #include eSUUT`]a  TaTUT`^ Ifloat makeVlookup() -oTUT`_lp{ }TUT``C GDS *gVlook; Td THH U,HH/* TUTUT`a int i, nVlook; URUT`bJunsigned j, k, mid; R #UPUT`c* short *tabl; T1UNUT`dU"float vcalib; ?ULUT`eU  TMUJUT`fU=gVlook = gds_in("/home0/soi/tables/MDI_Vlookup", gds_SHORT); c[UHUT`gPif (gVlook == NULL) ,jiUFUT`hQfprintf(stderr,"oops\n"); fowUDUT`ii+,vcalib = gds_info_value_d(gVlook,"BSCALE"); TUBUT`jletabl = (short *)gVlook->data; U@UT`k27nVlook = gVlook->dims[0]; U>UT`lU mid = nVlook/2; VU<UT`m.5 eU:UT`nfor (i=0; iQ UTCellBodyf? nV CellHeadingmf@ UTFootnotefATkVHeadingaBodyfB,  TableFootnotefCTe  TableTitleT:Table : fDpDateBodyfE Q6lUT CeFormulafF  Ce CellHeadingfG FoCellBodyfHT He TableTitleT:Table : fI teHf2Table@Je f  Header@Ky   FooterfMe 6fl Formula fNPTitleBody fP BodyfQ 6l FormulafR He2Table fT BodyfU AuthorBody fVPTitleBodyfZ AuthorBodyf[pDateBody  l rm Emphasis  Subscript  Superscript     Bo;eujeThinfMediumgDoublehThick@i Very Thin eeeeeeeeegHHFGFHFGFHFGFHFGFHFGFFormat A efeeeeefHHFGFHFGFHFGFHFGFHFGFFormat B-=-.CommentCourier HelveticaNew Century SchlbkSymbolTimesRegularRomanMediumBold Regular Italic@ p NcA[LJwYԂzzRСm|vBW[hFKBΩO%Bo=k}ABp_@5oM:e=l