#include /* module autotest */ #include #include #include #include #include #include #include #include #include #include #include #include #include /* 1 INITIAL 17 COLL 1 OVER-CUR 2 V1 REFL A 18 VACION 1 OVER-CUR 3 V1 REFL B 19 BODY CURRENT B 4 WASTER REFL A 20 MAG 2 OVER-CUR 5 TURN DL FWD A 21 MAG 2 UNDER-CUR 6 ANT REFL A 22 MAG 2 OVER-VOLT 7 V2 REFL A 23 MAG 2 UNDER-VOLT 8 V2 REFL B 24 COLL 2 OVER-CUR 9 WASTER REFL B 25 VACION 2 OVER-CUR 10 TURN DL FWD B 26 V1 ARC 11 ANT REFL B 27 V2 ARC 12 BODY CURRENT A 28 CROWBAR FIRE 13 MAG 1 OVER-CUR 29 MOV 14 MAG 1 UNDER-CUR 30 CROWBAR EMERGENCY OFF 15 MAG 1 OVER-VOLT 31 SPARE 16 MAG 1 UNDER-VOLT 32 SPARE */ union REGS inregs,outregs; /*****************************************************************************/ autotest(void) /* automatic testing screen */ { char *list0[]= { "MAGNET UNDER I", "MAGNET OVER I", "MAGNET UNDER V", "MAGNET OVER V", "COLLECTOR OVER I", "VACION OVER I", 0 }; char *list1[]= { "BODY I (A)", "BODY I (B)", "CROWBAR TRIGGER", "CROWBAR FIRE", "EMERGENCY OFF", "FO RCVR A", "FO RCVR B", "MOV", 0 }; char *list2[]= { "REFL PWR (A)", "REFL PWR (B)", "WG ARC (A)", "WG ARC (B)", "REFL DETECTOR", 0 }; char *list3[]= { "ANT REFL (A)", "ANT REFL (B)", "ANT REFL DETECTOR", "TURN FWD (A)", "TURN FWD (B)", "TURN FWD DETECTOR", "WASTER REFL (A)", "WASTER REFL (B)", "WASTER REFL DETECTOR", 0 }; int x1,y1,i; int tes[]= { /* test number */ 14,13,16,15,17,18, 21,20,23,22,24,25, 12,19,12,28,30,12,12,29, 2,3,26,26,2, 7,8,27,27,7, 6,11,6,5,10,5,4,9,4, 1 }; int x[]={ /* mouse target lower left */ 20,20,20,20,20,20, 40,40,40,40,40,40, 30,30,30,30,30,30,30,30, 220,220,220,220,220, 240,240,240,240,240, 230,230,230,230,230,230,230,230,230, 440,440,440 }; int y[]={ /* mouse target lower left */ 360,340,320,300,280,260, 360,340,320,300,280,260, 220,200,180,160,140,120,100,80, 360,340,320,300,280, 360,340,320,300,280, 240,220,200,180,160,140,120,100,80, 360,240,120 }; screen=5; clkey(); if(screen!=oldscrn) refresh=1; if(refresh) { clear(); /* clear screen */ oldayt[0]=0; font(0); text(PALEBLUE,50,479,"CONTROL CIRCUIT AUTO-TEST"); txnumber(); font(1); text(WHITE,10,420,"CROWBAR"); tex(230,420,"RF"); tex(410,420,"INITIAL"); tex(420,300,"RESET"); tex(415,180,"HOT CB"); font(2); tex(10,400,"KLY1 KLY2"); tex(210,400,"KLY1 KLY2"); tex(415,400,"CONDITIONS"); tex(430,280,"TESTS"); tex(435,160,"TEST"); font(3); texcolor(PALEBLUE); list(70,375,20,list0); /* dual crowbar */ list(60,235,20,list1); /* single crowbar */ list(270,375,20,list2); /* dual RF */ list(260,255,20,list3); /* single RF */ } switch(click()) /* mouse button */ { case 1: /* left button */ { x1=outregs.x.cx; y1=479-outregs.x.dx; for(i=0;i<42;i++) if((x1>x[i])&&(x1y[i])&&(y111)) if(counter[73]) { warn("CROWBAR TRIGGER RECOVERING"); goto abort; } if((!n)||(n<12)) tto(9,16,1); /* start driver */ if(n) /* one test */ { j1=n-1; j2=n; } else /* all tests */ { j1=0; j2=25; } clkey(); if(status[19]&0x02) /* hvps contactor */ { tto(13,12,0); /* stop */ tto(13,12,0); /* stop */ } if(j2<26) for(j=j1;j0&&j<11) { ttm(9,9,0,5); /* strobe RF address */ pause(1); /* wait for S/H timeout */ } else ttm(9,9,0,5); /* strobe non-RF address */ fail|=results(j,status[8]&0x03); if((!n)&&((j==11)||(j==13)||(j==18)||(j==20))) j++; /* skip magnet fault tests (RS) */ } if(!n) /* all tests */ { j1=25; j2=30; } if(j2>25) for(j=j1;j140||y1<120) goto loop; if(x1>220&&x1<240) { k='Y'; goto skip; } if(x1>400&&x1<420) { k='N'; goto skip; } } } k=caps(); skip: if(k=='Y') { boxit("ENTER CIPHER"); for(i=0;i<=3;i++) { k=caps(); if(k!=codec[i]) hack=1; } if(hack) status[46]|=0x02; else status[38]|=0x80; } } refresh=1; abort: return(fail); } /****************************************************************************/ results(j,sel) /* compare results to desired */ { unsigned char bit, stim[3][30][24]= /* stimulii */ { 0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, /*kly1*/ 1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,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,1,0,0,1, 0,1,1,0,0,1, 1,0,1,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,1,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 1,0,0,0,0,1, 0,1,1,0,0,1, 0,1,1,0,0,1, 0,1,1,1,0,1, 1,1,1,0,1,1, 1,1,1,0,0,0, }; int signal[]= { /* byte, bit mask */ 12,0x80, /* 0, V1 rfl power A */ 10,0x40, /* 2, V1 rfl power B */ 12,0x08, /* 4, waster dl rfl power A */ 12,0x04, /* 6, turnstile dl fwd power A */ 12,0x10, /* 8, antenna rfl power A */ 13,0x01, /* 10, V2 rfl power A */ 10,0x80, /* 12, V2 rfl power B */ 10,0x10, /* 14, waster dl rfl power B */ 18,0x04, /* 16, turnstile dl fwd power B */ 10,0x20, /* 18, antenna rfl power B */ 12,0x01, /* 20, body current A */ 11,0x01, /* 22, V1 magnet overcurrent */ 7,0x01, /* 24, V1 magnet undercurrent */ 11,0x04, /* 26, V1 magnet overvoltage */ 7,0x04, /* 28, V1 magnet undervoltage */ 11,0x10, /* 30, V1 collector overcurrent */ 11,0x40, /* 32, V1 vacion overcurrent */ 18,0x08, /* 34, body current B */ 11,0x02, /* 36, V2 magnet overcurrent */ 7,0x02, /* 38, V2 magnet undercurrent */ 11,0x08, /* 40, V2 magnet overvoltage */ 7,0x08, /* 42, V2 magnet undervoltage */ 11,0x20, /* 44, V2 collector overcurrent */ 11,0x80, /* 46, V2 vacion overcurrent */ 0,0x01, /* 48, klystron body current FF */ 0,0x02, /* 50, V1 collector current FF*/ 0,0x04, /* 52, V2 collector current FF*/ 0,0x08, /* 54, V1 magnet current FF */ 0,0x10, /* 56, V2 magnet current FF */ 0,0x20, /* 58, V1 magnet voltage FF */ 0,0x40, /* 60, V2 magnet voltage FF */ 0,0x80, /* 62, V1 vacion current FF */ 1,0x01, /* 64, V2 vacion current FF */ 1,0x04, /* 66, V1 wg arc FF */ 1,0x08, /* 68, V2 wg arc FF */ 1,0x10, /* 70, V1 rfl power FF */ 1,0x20, /* 72, V2 rfl power FF */ 1,0x40, /* 74, waster rfl power FF */ 1,0x80, /* 76, antenna rfl power FF */ 2,0x01, /* 78, turnstile dl fwd power FF */ 4,0x02, /* 80, waster dl detector */ 4,0x04, /* 82, antenna detector */ 7,0x20, /* 84, turnstile dl detector */ 7,0x40, /* 86, V1 rfl power detector */ 7,0x80, /* 88, V2 rfl power detector */ 12,0x20, /* 90, V1 wg arc A */ 12,0x40, /* 92, V2 wg arc A */ 18,0x10, /* 94, V1 wg arc B */ 18,0x20, /* 96, V2 wg arc B */ 21,0x04, /* 98, crowbar triggered */ 22,0x01, /* 100, FO rcvr A */ 22,0x02, /* 102, FO rcvr B */ 21,0x02, /* 104, crowbar fired */ 21,0x10, /* 106, mov */ 22,0x04, /* 108, emergency off cb test */ 0 }; unsigned char mask; int i,fail=0,testno=j+1; thous(1500); /* let RF A/H time out */ stats(); /* poll status changes */ for(i=0;i<24;i++) /* stimulii */ { bit=(status[signal[2*i]]&signal[2*i+1])&&1; /* (RS) */ if(bit!=stim[sel-1][j][i]) fail=1; } for(i=24;i<40;i++) /* first-event response */ { bit=(status[signal[2*i]]&signal[2*i+1])&&1; /* (RS) */ if(bit!=first[sel-1][j][i-24]) fail=1; } for(i=40;i<45;i++) /* detector response */ { bit=(status[signal[2*i]]&signal[2*i+1])&&1; /* (RS) */ if(bit!=comp[j][i-40]) { fail=1; if(i<44) status[44]|=(0x10<<(i-40)); else status[45]|=0x01; } } for(i=45;i<49;i++) /* arc response */ { bit=(status[signal[2*i]]&signal[2*i+1])&&1; /* (RS) */ if(bit!=arc[j][i-45]) { fail=1; status[44]|=(0x01<<(i-45)); } } for(i=49;i<55;i++) /* hvps response */ { bit=(status[signal[2*i]]&signal[2*i+1])&&1; /* (RS) */ if(bit!=hvps[sel-1][j][i-49]) { fail=1; if(i<52) status[45]|=(0x02<<(i-49)); } } if(j>0&&j<11) /* RF test */ { if((sel==1)&&((j==6)||(j==7))); else if((sel==2)&&((j==1)||(j==2))); else { average(); if((raw[25]>200)||(raw[26]>200)) /* drive power (RS) */ { fail=1; status[45]|=0x10; } } } i=39+j/8; loop: if(j>7) { j=j-8; goto loop; } mask=0x01<