#include /* module bars9 */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* V1 MAGNET VOLTAGE 0 meter samples V2 MAGNET VOLTAGE 1 BEAM VOLTAGE 2 V1 MAGNET CURRENT 3 V2 MAGNET CURRENT 4 BODY CURRENT 5 V1 FILAMENT VOLTAGE 6 V2 FILAMENT VOLTAGE 7 V1 FILAMENT CURRENT 8 V2 FILAMENT CURRENT 9 V1 COLLECTOR CURRENT 10 V2 COLLECTOR CURRENT 11 V1 VACION CURRENT 12 V2 VACION CURRENT 13 SPARE 14 SPARE 15 WASTER FWD POWER 16 V1 FWD POWER 17 V1 RFL POWER 18 V2 FWD POWER 19 V2 RFL POWER 20 WASTER RFL POWER 21 TURNSTILE DL POWER 22 ANTENNA FWD POWER 23 ANTENNA RFL POWER 24 V1 RF DRIVE POWER 25 V2 RF DRIVE POWER 26 WASTER FLOW RATE 27 WASTER DELTA TEMP 28 KLY2 COLLECTOR FLOW 29 EXCITER INPUT PROOF 30 SPARE 31 CALORIMETRIC POWER 0 calculations KLYSTRON 1 VSWR 1 KLYSTRON 2 VSWR 2 WASTER VSWR 3 ANTENNA VSWR 4 DRIVER TOTAL POWER 5 SPARE 6 TOTAL BEAM CURRENT 7 TOTAL KLYSTRON DISS 8 AVG MAGNET VOLTAGE 9 AVG MAGNET CURRENT 10 AVG FILAMENT VOLTAGE 11 AVG FILAMENT CURRENT 12 AVG COLLECTOR CURRENT 13 AVG VACION CURRENT 14 */ /*****************************************************************************/ bars(void) /* metering bar graphs */ { int i,k,color,x,y,dy; int seq[]= { /* boundary tick sequence */ 0,3,6,8,10,12,17,18, /* klystron V1 */ 1,4,7,9,11,13,19,20, /* klystron V2 */ 33,34,16,21,35,23,24,36, /* directional coupler */ 2,39,40,5,27,28,32,29, /* total power */ 41,42,43,44,37,22,25,26, /* miscellaneous */ 1,1,1,1,1,1,1,1 /* D to A */ }; float scal[]= { /* bar height scaling divisors */ 1.25,1.25,1.25,1.25,1.25,2.5,2.5,2.5, /* screen 7 */ 1.25,1.25,1.25,1.25,1.25,2.5,2.5,2.5, /* screen 8 */ 0.1,0.1,5.0,0.5,0.1,5.0,0.5,0.1, /* screen 9 */ 2.5,1.25,12.5,0.5,1.25,5.0,5,1.25, /* screen 10 */ 1.25,1.25,1.25,1.25,2.5,1.25,2.5,2.5, /* screen 11 */ 55.55,55.55,55.55,55.55,55.55,55.55,55.55,55.55 /* screen 12 */ }; double expon; if(parse[0]&&parse[4]!=CR) { if(arg(1,6)) goto bye; screen=atoi(&parse[4])+6; } if(parse[4]==CR) screen=7; /* default */ clkey(); if(screen<7||screen>12) goto bye; if(screen!=oldscrn) refresh=1; /*--------------------------------------------------------------------------*/ if(screen==7) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,60,479,"KLYSTRON 1"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(10,120,40,5,50,50,0); /* magnet volts */ vaxis(95,120,40,4,5,5,0); /* magnet amps */ vaxis(170,120,40,4,5,5,0); /* filament volts */ vaxis(260,120,40,6,5,5,0); /* filament amps */ vaxis(340,120,40,4,5,5,0); /* collector amps */ vaxisl(415,120,40,5,1); /* vacion uA */ vaxis(490,120,40,6,100,100,0); /* fwd pwr */ vaxis(585,120,40,5,1,1,0); /* rfl pwr */ /* horizontal axis labels */ tex(25,60,"MAGNET"); /* no. 1 */ tex(20,45,"VOLTAGE"); tex(60,30,"V"); tex(105,60,"MAGNET"); /* no. 2 */ tex(100,45,"CURRENT"); tex(140,30,"A"); tex(175,60,"FILAMENT"); /* no. 3 */ tex(180,45,"VOLTAGE"); tex(220,30,"V"); tex(255,60,"FILAMENT"); /* no. 4 */ tex(260,45,"CURRENT"); tex(300,30,"A"); tex(335,60,"COLLECTOR"); /* no. 5 */ tex(340,45,"CURRENT"); tex(380,30,"A"); tex(425,60,"VACION"); /* no. 6 */ tex(420,45,"CURRENT"); tex(460,30,"uA"); tex(495,60,"FORWARD"); /* no. 7 */ tex(500,45,"POWER"); tex(540,30,"KW"); tex(570,60,"REFLECTED"); /* no. 8 */ tex(580,45,"POWER"); tex(620,30,"KW"); setcolor(WHITE); /* horizontal lines */ line(40,70,620,70); /* vertical lines */ line(39,70,39,270); /* magnet volts */ line(119,70,119,230); /* magnet amps */ line(199,70,199,230); /* filament volts */ line(279,70,279,310); /* filament amps */ line(359,70,359,230); /* collector amps */ line(439,70,439,270); /* vacion uA */ line(519,70,519,310); /* forward kW */ line(599,70,599,270); /* reflected kW */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*i; y=70+lolim[seq[i]]/scal[i]; if(y>69&&y<450) line(x,y,x+10,y); /* lower tick mark */ y=70+hilim[seq[i]]/scal[i]; if(y>69&&y<450) line(x,y,x+10,y); /* upper tick mark */ } } if(refresh||(avmet[0]!=oldav[0])) { if(avmet[0]<=hilim[0]&&avmet[0]>=lolim[0]) color=GREEN; else color=YELLOW; y=70+avmet[0]/scal[0]; col2(color,40,70,y,20,70,270); texcolor(color); number2(25,30,avmet[0],0); /* magnet voltage */ } if(refresh||(avmet[3]!=oldav[3])) { if(avmet[3]<=hilim[3]&&avmet[3]>=lolim[3]) color=GREEN; else color=YELLOW; y=70+avmet[3]/scal[1]; col2(color,120,70,y,20,70,230); texcolor(color); number2(105,30,avmet[3],1); /* magnet current */ } if(refresh||(avmet[6]!=oldav[6])) { if(avmet[6]<=hilim[6]&&avmet[6]>=lolim[6]) color=GREEN; else color=YELLOW; y=70+avmet[6]/scal[2]; col2(color,200,70,y,20,70,230); texcolor(color); number2(185,30,avmet[6],1); /* filament voltage */ } if(refresh||(avmet[8]!=oldav[8])) { if(avmet[8]<=hilim[8]&&avmet[8]>=lolim[8]) color=GREEN; else color=YELLOW; y=70+avmet[8]/scal[3]; col2(color,280,70,y,20,70,310); texcolor(color); number2(265,30,avmet[8],1); /* filament current */ } if(refresh||(avmet[10]!=oldav[10])) { if(avmet[10]<=hilim[10]&&avmet[10]>=lolim[10]) color=GREEN; else color=YELLOW; y=70+avmet[10]/scal[4]; col2(color,360,70,y,20,70,230); texcolor(color); number2(345,30,avmet[10],1); /* collector current */ } if(refresh||(avmet[12]!=oldav[12])) { if(avmet[12]<=hilim[12]&&avmet[12]>=lolim[12]) color=GREEN; else color=YELLOW; if(avmet[12]>0) expon=exp((double)EXP*((double)(avmet[12])/100)); else expon=0; y=70+(40*avmet[12])/100; col2(color,440,70,y,20,70,270); texcolor(color); number2(425,30,(int)expon,2); /* vacion current */ } if(refresh||(avmet[17]!=oldav[17])) { if(avmet[17]<=hilim[17]&&avmet[17]>=lolim[17]) color=GREEN; else color=YELLOW; y=70+avmet[17]/scal[6]; col2(color,520,70,y,20,70,310); texcolor(color); number2(505,30,avmet[17],0); /* forward power */ } if(refresh||(avmet[18]!=oldav[18])) { if(avmet[18]<=hilim[18]&&avmet[18]>=lolim[18]) color=GREEN; else color=YELLOW; y=70+avmet[18]/scal[7]; col2(color,600,70,y,20,70,270); texcolor(color); number2(585,30,avmet[18],2); /* reflected power */ } refresh=0; goto quit; } /*--------------------------------------------------------------------------*/ if(screen==8) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,60,479,"KLYSTRON 2"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(10,120,40,5,50,50,0); /* magnet volts */ vaxis(95,120,40,4,5,5,0); /* magnet amps */ vaxis(170,120,40,4,5,5,0); /* filament volts */ vaxis(260,120,40,6,5,5,0); /* filament amps */ vaxis(340,120,40,4,5,5,0); /* collector amps */ vaxisl(415,120,40,5,1); /* vacion uA */ vaxis(490,120,40,6,100,100,0); /* fwd pwr */ vaxis(585,120,40,5,1,1,0); /* rfl pwr */ /* horizontal axis labels */ tex(25,60,"MAGNET"); /* no. 1 */ tex(20,45,"VOLTAGE"); tex(60,30,"V"); tex(105,60,"MAGNET"); /* no. 2 */ tex(100,45,"CURRENT"); tex(140,30,"A"); tex(175,60,"FILAMENT"); /* no. 3 */ tex(180,45,"VOLTAGE"); tex(220,30,"V"); tex(255,60,"FILAMENT"); /* no. 4 */ tex(260,45,"CURRENT"); tex(300,30,"A"); tex(335,60,"COLLECTOR"); /* no. 5 */ tex(340,45,"CURRENT"); tex(380,30,"A"); tex(425,60,"VACION"); /* no. 6 */ tex(420,45,"CURRENT"); tex(460,30,"uA"); tex(495,60,"FORWARD"); /* no. 7 */ tex(500,45,"POWER"); tex(540,30,"KW"); tex(570,60,"REFLECTED"); /* no. 8 */ tex(580,45,"POWER"); tex(620,30,"KW"); setcolor(WHITE); /* horizontal lines */ line(40,70,620,70); /* vertical lines */ line(39,70,39,270); /* magnet volts */ line(119,70,119,230); /* magnet amps */ line(199,70,199,230); /* filament volts */ line(279,70,279,310); /* filament amps */ line(359,70,359,230); /* collector amps */ line(439,70,439,270); /* vacion uA */ line(519,70,519,310); /* forward kW */ line(599,70,599,270); /* reflected kW */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*(i); y=70+lolim[seq[i+8]]/scal[i+8]; if(y>69&&y<450) line(x,y,x+10,y); y=70+hilim[seq[i+8]]/scal[i+8]; if(y>69&&y<450) line(x,y,x+10,y); } } if(refresh||(avmet[1]!=oldav[1])) { if(avmet[1]<=hilim[1]&&avmet[1]>=lolim[1]) color=GREEN; else color=YELLOW; y=70+avmet[1]/scal[8]; col2(color,40,70,y,20,70,270); texcolor(color); number2(25,30,avmet[1],0); /* magnet voltage */ } if(refresh||(avmet[4]!=oldav[4])) { if(avmet[4]<=hilim[4]&&avmet[4]>=lolim[4]) color=GREEN; else color=YELLOW; y=70+avmet[4]/scal[9]; col2(color,120,70,y,20,70,230); texcolor(color); number2(105,30,avmet[4],1); /* magnet current */ } if(refresh||(avmet[7]!=oldav[7])) { if(avmet[7]<=hilim[7]&&avmet[7]>=lolim[7]) color=GREEN; else color=YELLOW; y=70+avmet[7]/scal[10]; col2(color,200,70,y,20,70,230); texcolor(color); number2(185,30,avmet[7],1); /* filament voltage */ } if(refresh||(avmet[9]!=oldav[9])) { if(avmet[9]<=hilim[9]&&avmet[9]>=lolim[9]) color=GREEN; else color=YELLOW; y=70+avmet[9]/scal[11]; col2(color,280,70,y,20,70,310); texcolor(color); number2(265,30,avmet[9],1); /* filament current */ } if(refresh||(avmet[11]!=oldav[11])) { if(avmet[11]<=hilim[11]&&avmet[11]>=lolim[11]) color=GREEN; else color=YELLOW; y=70+avmet[11]/scal[12]; col2(color,360,70,y,20,70,230); texcolor(color); number2(345,30,avmet[11],1); /* collector current */ } if(refresh||(avmet[13]!=oldav[13])) { if(avmet[13]<=hilim[13]&&avmet[13]>=lolim[13]) color=GREEN; else color=YELLOW; if(avmet[13]>0) expon=exp((double)EXP*((double)(avmet[13])/100)); else expon=0; y=70+(40*avmet[13])/100; col2(color,440,70,y,20,70,270); texcolor(color); number2(425,30,(int)expon,2); /* vacion current */ } if(refresh||(avmet[19]!=oldav[19])) { if(avmet[19]<=hilim[19]&&avmet[19]>=lolim[19]) color=GREEN; else color=YELLOW; y=70+avmet[19]/scal[14]; col2(color,520,70,y,20,70,310); texcolor(color); number2(505,30,avmet[19],0); /* forward power */ } if(refresh||(avmet[20]!=oldav[20])) { if(avmet[20]<=hilim[20]&&avmet[20]>=lolim[20]) color=GREEN; else color=YELLOW; y=70+avmet[20]/scal[15]; col2(color,600,70,y,20,70,270); texcolor(color); number2(585,30,avmet[20],2); /* reflected power */ } refresh=0; goto quit; } /*--------------------------------------------------------------------------*/ if(screen==9) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,50,479,"DIRECTIONAL COUPLER"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(10,120,40,8,104,4,2); /* kly 1 vswr */ vaxis(90,120,40,8,104,4,2); /* kly 2 vswr */ vaxis(170,120,40,6,200,200,0); /* waster fwd pwr */ vaxis(260,120,40,6,2,2,0); /* waster rfl pwr */ vaxis(330,120,40,8,104,4,2); /* waster vswr */ vaxis(410,120,40,6,200,200,0); /* antenna fwd pwr */ vaxis(500,120,40,6,2,2,0); /* antenna rfl pwr */ vaxis(570,120,40,8,104,4,2); /* antenna vswr */ /* horizontal axis labels */ tex(20,60,"KLYSTRON 1"); tex(30,45,"VSWR"); /* no. 1 */ tex(100,60,"KLYSTRON 2"); tex(110,45,"VSWR"); /* no. 2 */ tex(180,60,"WASTER"); /* no. 3 */ tex(180,45,"FWD PWR"); tex(220,30,"KW"); tex(260,60,"WASTER"); /* no. 4 */ tex(255,45,"REFL PWR"); tex(300,30,"KW"); tex(340,60,"WASTER"); /* no. 5 */ tex(350,45,"VSWR"); tex(420,60,"ANTENNA"); /* no. 6 */ tex(420,45,"FWD PWR"); tex(460,30,"KW"); tex(500,60,"ANTENNA"); /* no. 7 */ tex(500,45,"REFL PWR"); tex(540,30,"KW"); tex(580,60,"ANTENNA"); tex(590,45,"VSWR"); /* no. 8 */ setcolor(WHITE); /* horizontal lines */ line(40,70,639,70); /* vertical lines */ line(39,70,39,390); /* kly 1 vswr */ line(119,70,119,390); /* kly 2 vswr */ line(199,70,199,310); /* waster forward kW */ line(279,70,279,310); /* waster reflected kW */ line(359,70,359,390); /* waster vswr */ line(439,70,439,310); /* antenna forward kW */ line(519,70,519,310); /* antenna reflected kW */ line(599,70,599,390); /* antenna vswr */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*(i); y=70+lolim[seq[i+16]]/scal[i+16]; if(y>69&&y<450) line(x,y,x+10,y); y=70+hilim[seq[i+16]]/scal[i+16]; if(y>69&&y<450) line(x,y,x+10,y); } } if(refresh||(calc[1]!=olcalc[1])) { if((calc[1]-100)<=hilim[33]&&(calc[1]-100)>=lolim[33]) color=GREEN; else color=YELLOW; y=70+(calc[1]-100)/scal[16]; col2(color,40,70,y,20,70,390); texcolor(color); lnumber2(30,30,calc[1],2); /* klystron 1 vswr */ } if(refresh||(calc[2]!=olcalc[2])) { if((calc[2]-100)<=hilim[34]&&(calc[2]-100)>=lolim[34]) color=GREEN; else color=YELLOW; y=70+(calc[2]-100)/scal[17]; col2(color,120,70,y,20,70,390); texcolor(color); lnumber2(110,30,calc[2],2); /* klystron 2 vswr */ } if(refresh||(avmet[16]!=oldav[16])) { if(avmet[16]<=hilim[16]&&avmet[16]>=lolim[16]) color=GREEN; else color=YELLOW; y=70+avmet[16]/scal[18]; col2(color,200,70,y,20,70,310); texcolor(color); number2(190,30,avmet[16],0); /* waster fwd pwr */ } if(refresh||(avmet[21]!=oldav[21])) { if(avmet[21]<=hilim[21]&&avmet[21]>=lolim[21]) color=GREEN; else color=YELLOW; y=70+avmet[21]/scal[19]; col2(color,280,70,y,20,70,310); texcolor(color); number2(270,30,avmet[21],1); /* waster rfl pwr */ } if(refresh||(calc[3]!=olcalc[3])) { if((calc[3]-100)<=hilim[35]&&(calc[3]-100)>=lolim[35]) color=GREEN; else color=YELLOW; y=70+(calc[3]-100)/scal[20]; col2(color,360,70,y,20,70,390); texcolor(color); lnumber2(350,30,calc[3],2); /* waster vswr */ } if(refresh||(avmet[23]!=oldav[23])) { if(avmet[23]<=hilim[23]&&avmet[23]>=lolim[23]) color=GREEN; else color=YELLOW; y=70+avmet[23]/scal[21]; col2(color,440,70,y,20,70,310); texcolor(color); number2(430,30,avmet[23],0); /* antenna fwd pwr */ } if(refresh||(avmet[24]!=oldav[24])) { if(avmet[24]<=hilim[24]&&avmet[24]>=lolim[24]) color=GREEN; else color=YELLOW; y=70+avmet[24]/scal[22]; col2(color,520,70,y,20,70,310); texcolor(color); number2(510,30,avmet[24],1); /* antenna rfl pwr */ } if(refresh||(calc[4]!=olcalc[4])) { if((calc[4]-100)<=hilim[36]&&(calc[4]-100)>=lolim[36]) color=GREEN; else color=YELLOW; y=70+(calc[4]-100)/scal[23]; col2(color,600,70,y,20,70,390); texcolor(color); lnumber2(590,30,calc[4],2); /* antenna vswr */ } refresh=0; goto quit; } /*--------------------------------------------------------------------------*/ if(screen==10) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,160,479,"TOTAL POWER"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(20,120,40,8,10,10,0); /* beam voltage */ vaxis(100,120,40,8,5,5,0); /* beam current */ vaxis(170,120,40,6,500,500,0); /* beam power */ vaxis(260,120,40,7,20,20,0); /* body current */ vaxis(330,120,40,7,50,50,0); /* water flow rate */ vaxis(420,120,40,8,2,2,0); /* delta T */ vaxis(495,120,40,6,200,200,0); /* calorimetric power */ vaxis(575,120,40,7,50,50,0); /* kly2 coll flow */ /* horizontal axis labels */ tex(30,60,"BEAM"); /* no. 1 */ tex(20,45,"VOLTAGE"); tex(60,30,"KV"); tex(110,60,"BEAM"); /* no. 2 */ tex(100,45,"CURRENT"); tex(140,30,"A"); tex(180,60,"BEAM"); /* no. 3 */ tex(180,45,"POWER"); tex(220,30,"KW"); tex(260,60,"BODY"); /* no. 4 */ tex(260,45,"CURRENT"); tex(300,30,"MA"); tex(340,60,"WASTER"); /* no. 5 */ tex(350,45,"FLOW"); tex(380,30,"GPM"); tex(425,60,"WASTER"); /* no. 6 */ tex(415,45,"DELTA TEMP"); tex(460,30,"C"); tex(500,60,"CALORIC"); /* no. 7 */ tex(500,45,"POWER"); tex(540,30,"KW"); tex(570,60,"KLY2 COLL"); /* no. 7 */ tex(580,45,"FLOW"); tex(610,30,"GPM"); setcolor(WHITE); /* horizontal lines */ line(40,70,620,70); /* vertical lines */ line(39,70,39,390); /* beam voltage */ line(119,70,119,390); /* beam current */ line(199,70,199,310); /* beam power */ line(279,70,279,350); /* body current */ line(359,70,359,350); /* flow rate */ line(439,70,439,390); /* delta temp */ line(519,70,519,310); /* calorimetric power */ line(599,70,599,350); /* kly2 coll flow */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*i; y=70+lolim[seq[i+24]]/scal[i+24]; if(y>69&&y<450) line(x,y,x+10,y); /* lower tick */ y=70+hilim[seq[i+24]]/scal[i+24]; if(y>69&&y<450) line(x,y,x+10,y); /* upper tick */ } } if(refresh||(avmet[2]!=oldav[2])) { if(avmet[2]<=hilim[2]&&avmet[2]>=lolim[2]) color=GREEN; else color=YELLOW; y=70+avmet[2]/scal[24]; col2(color,40,70,y,20,70,390); texcolor(color); number2(25,30,avmet[2],1); /* beam voltage */ } if(refresh||(calc[7]!=olcalc[7])) { if(calc[7]<=hilim[39]&&calc[7]>=lolim[39]) color=GREEN; else color=YELLOW; y=70+calc[7]/scal[25]; col2(color,120,70,y,20,70,390); texcolor(color); lnumber2(105,30,calc[7],1); /* beam current */ } if(refresh||(calc[8]!=olcalc[8])) { if(calc[8]<=hilim[40]&&calc[8]>=lolim[40]) color=GREEN; else color=YELLOW; y=70+calc[8]/scal[26]; col2(color,200,70,y,20,70,310); texcolor(color); lnumber2(185,30,calc[8],0); /* beam power */ } if(refresh||(avmet[5]!=oldav[5])) { if(avmet[5]<=hilim[5]&&avmet[5]>=lolim[5]) color=GREEN; else color=YELLOW; y=70+avmet[5]/scal[27]; col2(color,280,70,y,20,70,350); texcolor(color); number2(265,30,avmet[5],0); /* body current */ } if(refresh||(avmet[27]!=oldav[27])) { if(avmet[27]<=hilim[27]&&avmet[27]>=lolim[27]) color=GREEN; else color=YELLOW; y=70+avmet[27]/scal[28]; col2(color,360,70,y,20,70,350); texcolor(color); number2(345,30,avmet[27],0); /* flow rate */ } if(refresh||(avmet[28]!=oldav[28])) { if(avmet[28]<=hilim[28]&&avmet[28]>=lolim[28]) color=GREEN; else color=YELLOW; y=70+avmet[28]/scal[29]; col2(color,440,70,y,20,70,390); texcolor(color); number2(425,30,avmet[28],2); /* delta T */ } if(refresh||(calc[0]!=olcalc[0])) { if(calc[0]<=hilim[32]&&calc[0]>=lolim[32]) color=GREEN; else color=YELLOW; y=70+calc[0]/scal[30]; col2(color,520,70,y,20,70,350); texcolor(color); lnumber2(505,30,calc[0],0); /* calorimetric power */ } if(refresh||(avmet[29]!=oldav[29])) { if(avmet[29]<=hilim[29]&&avmet[29]>=lolim[29]) color=GREEN; else color=YELLOW; y=70+avmet[29]/scal[31]; col2(color,600,70,y,20,70,350); texcolor(color); number2(575,30,avmet[29],0); /* kly2 coll flow */ } refresh=0; goto quit; } /*--------------------------------------------------------------------------*/ if(screen==11) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,60,479,"MISCELLANEOUS"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(10,120,40,5,50,50,0); /* avg magnet volts */ vaxis(95,120,40,4,5,5,0); /* avg magnet amps */ vaxis(170,120,40,4,5,5,0); /* avg filament volts */ vaxis(260,120,40,6,5,5,0); /* avg filament amps */ vaxis(340,120,40,5,1,1,0); /* total drive power */ vaxis(420,120,40,7,5,5,0); /* turnstile dl power */ vaxis(500,120,40,5,1,1,0); /* driver 1 power */ vaxis(580,120,40,5,1,1,0); /* driver 2 power */ /* horizontal axis labels */ tex(20,60,"AVG MAG"); /* no. 1 */ tex(20,45,"VOLTAGE"); tex(60,30,"V"); tex(100,60,"AVG MAG"); /* no. 2 */ tex(100,45,"CURRENT"); tex(140,30,"A"); tex(180,60,"AVG FILA"); /* no. 3 */ tex(180,45,"VOLTAGE"); tex(220,30,"V"); tex(260,60,"AVG FILA"); /* no. 4 */ tex(260,45,"CURRENT"); tex(300,30,"A"); tex(330,60,"TOTAL DRIVE"); /* no. 5 */ tex(340,45,"FWD PWR"); tex(380,30,"W"); tex(415,60,"TURNSTILE"); /* no. 6 */ tex(420,45,"DL POWER"); tex(460,30,"KW"); tex(500,60,"KLY 1"); /* no. 7 */ tex(500,45,"DRV PWR"); tex(540,30,"W"); tex(580,60,"KLY 2"); /* no. 8 */ tex(580,45,"DRV PWR"); tex(620,30,"W"); setcolor(WHITE); /* horizontal lines */ line(40,70,620,70); /* vertical lines */ line(39,70,39,270); /* avg magnet voltage */ line(119,70,119,230); /* avg magnet current */ line(199,70,199,230); /* avg filament voltage */ line(279,70,279,310); /* avg filament current */ line(359,70,359,270); /* total drive power */ line(439,70,439,350); /* turnstile dl power */ line(519,70,519,270); /* driver 1 power */ line(599,70,599,270); /* driver 2 power */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*i; y=70+lolim[seq[i+32]]/scal[i+32]; if(y>69&&y<450) line(x,y,x+10,y); /* lower tick */ y=70+hilim[seq[i+32]]/scal[i+32]; if(y>69&&y<450) line(x,y,x+10,y); /* upper tick */ } } if(refresh||(calc[9]!=olcalc[9])) { if(calc[9]<=hilim[41]&&calc[9]>=lolim[41]) color=GREEN; else color=YELLOW; y=70+calc[9]/scal[32]; col2(color,40,70,y,20,70,270); texcolor(color); lnumber2(25,30,calc[9],0); /* avg magnet voltage (RS) */ } if(refresh||(calc[10]!=olcalc[10])) { if(calc[10]<=hilim[42]&&calc[10]>=lolim[42]) color=GREEN; else color=YELLOW; y=70+calc[10]/scal[33]; col2(color,120,70,y,20,70,230); texcolor(color); lnumber2(105,30,calc[10],1); /* avg magnet current */ } if(refresh||(calc[11]!=olcalc[11])) { if(calc[11]<=hilim[43]&&calc[11]>=lolim[43]) color=GREEN; else color=YELLOW; y=70+calc[11]/scal[34]; col2(color,200,70,y,20,70,230); texcolor(color); lnumber2(185,30,calc[11],1); /* avg filament voltage */ } if(refresh||(calc[12]!=olcalc[12])) { if(calc[12]<=hilim[44]&&calc[12]>=lolim[44]) color=GREEN; else color=YELLOW; y=70+calc[12]/scal[35]; col2(color,280,70,y,20,70,310); texcolor(color); lnumber2(265,30,calc[12],1); /* avg filament current */ } if(refresh||(calc[5]!=olcalc[5])) { if(calc[5]<=hilim[37]&&calc[5]>=lolim[37]) color=GREEN; else color=YELLOW; y=70+calc[5]/scal[36]; col2(color,360,70,y,20,70,430); texcolor(color); lnumber2(345,30,calc[5],2); /* total drive power */ } if(refresh||(avmet[22]!=oldav[22])) { if(avmet[22]<=hilim[22]&&avmet[22]>=lolim[22]) color=GREEN; else color=YELLOW; y=70+avmet[22]/scal[37]; col2(color,440,70,y,20,70,350); texcolor(color); number2(430,30,avmet[22],1); /* turnstile dl pwr */ } if(refresh||(avmet[25]!=oldav[25])) { if(avmet[25]<=hilim[25]&&avmet[25]>=lolim[25]) color=GREEN; else color=YELLOW; y=70+avmet[25]/scal[38]; col2(color,520,70,y,20,70,270); texcolor(color); number2(510,30,avmet[25],2); /* driver 1 fwd pwr */ } if(refresh||(avmet[26]!=oldav[26])) { if(avmet[26]<=hilim[26]&&avmet[26]>=lolim[26]) color=GREEN; else color=YELLOW; y=70+avmet[26]/scal[39]; col2(color,600,70,y,20,70,270); texcolor(color); number2(590,30,avmet[26],2); /* driver 2 fwd pwr */ } refresh=0; goto quit; } /*--------------------------------------------------------------------------*/ if(screen==12) { if(refresh) /* (RS) */ { oldscrn=screen; clear(); /* clear entire screen */ oldayt[0]=0; font(0); text(PALEBLUE,60,479,"D/A CONTROL SIGNALS"); txnumber(); calendar(); texcolor(PALEBLUE); /* vertical axis labels */ vaxis(20,115,36,10,2,2,0); /* beam voltage */ vaxis(100,115,36,10,2,2,0); /* magnet 1 voltage */ vaxis(180,115,36,10,2,2,0); /* magnet 2 voltage */ vaxis(260,115,36,10,2,2,0); /* driver level */ vaxis(340,115,36,10,2,2,0); /* driver balance */ vaxis(420,115,36,10,2,2,0); /* driver phase */ vaxis(500,115,36,10,2,2,0); /* feed-forward offset*/ vaxis(580,115,36,10,2,2,0); /* feed-forward gain */ /* horizontal axis labels */ tex(30,60,"BEAM"); /* no. 1 */ tex(20,45,"VOLTAGE"); tex(60,30,"MA"); tex(110,60,"MAG 1"); /* no. 2 */ tex(100,45,"CURRENT"); tex(140,30,"MA"); tex(190,60,"MAG 2"); /* no. 3 */ tex(180,45,"CURRENT"); tex(220,30,"MA"); tex(260,60,"DRIVER"); /* no. 4 */ tex(260,45,"LEVEL"); tex(300,30,"MA"); tex(340,60,"DRIVER"); /* no. 5 */ tex(340,45,"BALANCE"); tex(380,30,"MA"); tex(420,60,"DRIVER"); /* no. 6 */ tex(420,45,"PHASE"); tex(460,30,"MA"); tex(500,60,"FEED FWD"); /* no. 7 */ tex(500,45,"OFFSET"); tex(540,30,"MA"); tex(570,60,"FEED FWD"); /* no. 8 */ tex(580,45,"GAIN"); tex(620,30,"MA"); setcolor(WHITE); /* horizontal lines */ line(40,70,620,70); /* vertical lines */ line(39,70,39,430); /* beam voltage */ line(119,70,119,430); /* magnet 1 current */ line(199,70,199,430); /* magnet 2 current */ line(279,70,279,430); /* driver level */ line(359,70,359,430); /* driver balance */ line(439,70,439,430); /* driver phase */ line(519,70,519,430); /* feed-forward offset */ line(599,70,599,430); /* feed-forward gain */ /* warning boundary ticks */ setcolor(YELLOW); for(i=0;i<=7;i++) { x=30+80*i; y=70; line(x,y,x+10,y); /* lower tick */ y=430; line(x,y,x+10,y); /* upper tick */ } } if(refresh||(counter[43]!=dac[0])) { if(counter[43]<=20000) color=GREEN; else color=YELLOW; y=70+counter[43]/scal[40]; col2(color,40,70,y,20,70,430); texcolor(color); number2(25,30,counter[43]/100,1); /* beam voltage */ } if(refresh||(counter[41]!=dac[1])) { if(counter[41]<=20000) color=GREEN; else color=YELLOW; y=70+counter[41]/scal[41]; col2(color,120,70,y,20,70,430); texcolor(color); number2(110,30,counter[41]/100,1); /* magnet 1 current */ } if(refresh||(counter[42]!=dac[2])) { if(counter[42]<=20000) color=GREEN; else color=YELLOW; y=70+counter[42]/scal[42]; col2(color,200,70,y,20,70,430); texcolor(color); number2(185,30,counter[42]/100,1); /* magnet 2 current (RS) */ } if(refresh||(counter[35]!=dac[3])) { if(counter[35]<=20000) color=GREEN; else color=YELLOW; y=70+counter[35]/scal[43]; col2(color,280,70,y,20,70,430); texcolor(color); number2(265,30,counter[35]/100,1); /* driver level */ } if(refresh||(counter[36]!=dac[4])) { if(counter[36]<=20000) color=GREEN; else color=YELLOW; y=70+counter[36]/scal[44]; col2(color,360,70,y,20,70,430); texcolor(color); number2(350,30,counter[36]/100,1); /* driver balance (RS) */ } if(refresh||(counter[37]!=dac[5])) { if(counter[37]<=20000) color=GREEN; else color=YELLOW; y=70+counter[37]/scal[45]; col2(color,440,70,y,20,70,430); texcolor(color); number2(430,30,counter[37]/100,1); /* driver phase */ } if(refresh||(counter[38]!=dac[6])) { if(counter[38]<=20000) color=GREEN; else color=YELLOW; y=70+counter[38]/scal[46]; col2(color,520,70,y,20,70,430); texcolor(color); number2(510,30,counter[38]/100,1); /* feed-forward offset */ } if(refresh||(counter[39]!=dac[7])) { if(counter[39]<=20000) color=GREEN; else color=YELLOW; y=70+counter[39]/scal[47]; col2(color,600,70,y,20,70,430); texcolor(color); number2(590,30,counter[39]/100,1); /* feed-forward gain */ } refresh=0; } quit: if(k==REFRESH) { for(i=0;i<=7;i++) rect(BLACK,60+i*80,60,70+i*80,440); } abort: time(&keystart); bye: refresh=0; }