8L2C)pJJJJ IH(ȱH:=IH[H`@HcH  $ +   I/H`JLNGȄBȄF aK  haaFF  mJm# KKJ UJ )J ۈ) ;J3ȱJFȱJGJKaȄM  aaNNJFLGJL L$# {  { / XXύX?klmnÍoL) !6L'!(0`670! = ***)<JJH !h穖tp% !Z/݀!!' ! !! *CON30MAY.A[M0-++CONFINAL.90u1ҴҴCON30MAY.5k. 3MAY30CONKS.TEMP 3CON30MAY.6.3CON30MAY.7.1-ELECTRO.CLK ' ,BASIC.SYSTEM(! o&PRODOS<! "''STARTUP=")!"*PROCLK.65C02.BI<P"!P"*CON30MAY.8BU/CLOCK.CBIN> >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@LLnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!)? &PRODOS `DaElH$?EGvѶK+`L HHLy XP LM ŠϠĠӠS)*+,+`F)) (*=GJFjJJA QE'+ '== `@ STSP8QSS8 m P o R(8R! !5).莀/ ! !!!!! !!$ ! "<" !!뭳!!!!ILYL 8!9!詍` ! !ՠî򠠠!STARTUP/p > 5L壥>  5e>>?́?`>ȥj>>m>` T`m8injkiljo풼i>?Ek?>Q>;>:8o>oȑ>ppȑ>> :op` {KpnͶ @p;=po:i>?Ek?!>Q>>>̀ `` > ̀ `e>>?́?>?Emn(>e>ȱ>e?>Q>ؠ> ie>>?`|;}=:<~:<=;`||m}K`JJJJ8`轚K)` 7#hhL"Jپھ pHJh` {!hgt}~p  `~t}p8n~ni}tpi~~tsLo8pinii>j?k̈́>~|ppn + {pnI:L ؅30,3L]8^933LAAJL ةޘг uv $ 8LЌ Le p>?@`>?@`BQ8`e 矮K ⟩ 䟢 춼LK  z KɍKL"?`  L@3 @LtJ)s@J % `͘?s?,E30ɍФ3 +E3HD F3 Ʉ%h3 M +E  LthɍLL3`3,A0s0% I`O>0O  矢POپھ p AH־Ǿh۰8L"־Jjjjɾ)Ⱦ8 + OL L$L>(F`־ؾپھ׾` Ʉ +KDEF L LK K% ʽ  ٚ,S` w $݅3`(l8L"3L>(Ƀ,`3,G0]ɾ ` w`پ_پ p _پ׾`>( p۾m׾) W)ʩ@`ɾ>(O puȾ ɾ-O c־Jjjj 왻ɠ, XLޭBDEF޾ p 7 ޾ p($ذ (0 U( L?ԦʚLeةީ s +  L ,FL,DLE,C0!3 > Ɉ 3ɾL(3ɾ;Ƀ UB94 H06172839h` 97L75v^͘ ?/( ?LKLLɍ$?`? ɍɥAH93827160hH46576879h`,C Lޛ $0. ɍ  ,S0 ?@ L L ŠϠŠà͠ӠàԠŬ` Y)Y i ۹  ODH鹝h,PIN'ҍIxy lLsIx Oy OJpnoF l= lm lw)!,ZJYH)h****)  md87`\H[< Gh  l( G쳼󩭙Llid l`H) ZhJJJJ ɺi`  ` .8 `O`S  [AI-Ly !B C ⟩VWS ?@$I0 U)VJ *T)`l8`a HbIJhjǾȾɾ p٭b=aIe f`8` yP־ǾҾ,G0C =W)_``\"׾پӾؾھ pD`־ǾY׾ؾOW)ݩȾɾʾ pD`8`W)CB) ۵ 5W) )W)@! pZ}ȾȾ 5   8 0 8 `0 / x X$$ $&$0`ŠӠέԠŠҬîʎ1DžϠ)&ʈ0  0ŠϠĠ͢Š͠͠ϠŠŠϠĠخ͠ YYZLYLYLY뿩 8@  *$ MNЩUM  LPN!-RB}PBiB ,m# m# J Qڨ)̰n]e мȱ ; ̀𩠙< iO P F V >Z SY ɘL` X _ [ V7 c L '0%O '8O JmO *  !"#$%&'()*+,-./0123456789:n!o!p! k! iL X%>!L;!ΠΠҠ`}!!!"!!!l4"# G$YO!-e(eR9B}PBiBCe! H$q!r! c&L*!M8tl # ) y!s!(&s!t! c&E )?  @ e!l!0 $l!0u!v! c&-) &ύw!x! c&Эb)0I0 ( d!N)Gi/ h!4 L5LLL"L  KN)_ `@S8` ԠŬLL<[B?I>孓`仫6VtCicQĿUKqtVt Nʮq$6,⨁ K6, VtI=v!gNVt Vt  lg~TŠӠŠҠüϠž(+@ABCDEFGHIKLMNPSV     T[fouu~ՠٯ* PWN*]ĿNTz @n6VC/+A>@I5gN Oz @n[Dz @nd0,~z @`$仫@v$⩔,CTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPENDx{[{0ǭ0hЫ}wA Xw­孶׭fl@@ -!S    !C- !ABELSDFRV@@ !$(19@E(8mȾȾmɾɾʾiʾ` Lpl8l:/[ҝƬƀ#(ZZV4D\-:% >M CgIY2m*b6>BSAVERIFYBLOADELETECATALOGOPENWRITEXECREATEFRES p` y־ǾҾ,G 8`׾ؾ  p жۥs׾tؾE` y ( о(־Ǿ,G 8`_`W)H־Jjjjh p̭ L;Ǿ ..8 ۭ 8f ZHH)hh8JhJJJJJ '&H(&8H) 12 (j21 h!hH h %)Ђ12H)M0 h10200I20h2 9&`L#`)&!2"L  :8! ȱɈ  )1& ` (Xp< @1& )m1&1&.1&4& M1&i  ``rȱȱȱȱ0]cȱeem<(ȱ=(ȱ>(=(ȱF(=(ȱN( '<( z' #'Lg&`L' 'L& ' ЭG ݰ%" ݰX)Im'F(G)* ݰ4 ֭ $H ݰ%HFFHGHG ݐ`R8`ͮͯ)` װ H` /ٰR(*؅IHHЍ@`[8W ؐeXW Y* Y=ȱ@/ȱ@9;<2DE)7I0 '*5 ܰ701FG ݰ( ְLݩI mIH` @= t=0FG ݰ ֬HFG ݰFF@ 0 [ [LթK8` I8`FHGH ܪhGhF ݰբFF芝 ݰFG ݮI m IHHyHȘI ݰLԩ` ՠ @/@ 7@Юz)mzʈ@i Q`RC8` @ l3Nz@) Wڎ} ԭziz}`0 iڰ0GF ݰ#Q0 ڰW,u0 Q ۩.H hȑNWȮvNuW8`xzNxz0NN` װG8`^x}z}Б|` Ґ L` א@>)I3|8^_0`1a`K8`@Nȱ@O@ lIiNȽN)/ȩ/N`@[ WHJjjjRhA &'KI0JH0ōҍJJJJ ɺi) ɺiL9Ҏw s)?ef t Ұs Ӱ s  |Ґ `l@Hȱ@I|HXAT^^ȱH ɯ|ȩxz^5H)/@a)_xx .0 :A[8@`,xx@~@}J@` ߩ%S @ ~`EhhhѺ0 h ѐ# ѐ ѐ ѐ 0 HϭэLпllllhh8` QSTV'P،h@ihAiȱ@JJJJq@)@%vȱ@Hȱ@Ah@E@c%e J) LxL LxJiB LxJ) <ҩxNhHHHHL(  аƠx@BEOD  а(`( C)CJJJlBJ,~آ <B*IBGF08Lé'+8H <(h`@؍L3<>=?<>CAB@?A` / L  <>` ڢF]PL8i m L   4< L  BLRAM' hLDLHB-4F 1"aɿ LL@ Nϰ H  @h( L Lh  @`bLJCAB@=?,<ʆ>*=?BC8 é&'112` ( < *? ( < (? ( < (? ( <*? * **? *? *? ( < *? ( <Lg& 'L&8ei` ,$`ee` `<( '<( '` ' ' '`hh8`8`=(>(F(`}N(`e`H)hJJ'0JJ)` (8T2hU3JJJJ)@` װ%I -=) t 0@)N8`*L o % YZoY 3 NZ`rZLkZq8r7IZiZkk 8 s q | kн Z)*>>` @ $(,048<@DHLPTX\`dh 0ުlptx| FGV*& .V  JJJJH :h Ei :EX`'8`jWC)p> pCYY 轊( ( BV ( p0 \BiJ @i> i'j:ZH i@ioZZH h ȭnWǥBJ 8X` +>H jjjj* 񍓿 񍒿h`  `U(*=>hP8`;Zx3QTTSRWVUHEVhEhH)IWHPHHHAHHHLaVEWLӿLLՐ`BLڑL COPYRIGHT APPLE, 1983 h@ 0J @L:HUSTONLL`BLLТТТТТТТТТТТТТТТCOPR. APPLE,1983LM Mh@8nЍLЭ 0J @L:LhhhhIL@Ae P o**ӂӹ]|wKIJK,-NOPQRSuHUSTON!' @   !"#$Ԡ͠ˠĠԠ ]XXKR Ko`V8`no` & on ]I9XX`)HJJJh`OeNeO࿰ ]9XАO`@ȭ@` ON CNJKO`HHHHхЅG ݐ ` ~ qͬ ݰFG ݐ` ~* q% L`FGLݮ 'ܰ8`FHGH] 'ܰ]hGhF`@Bɼ>K@J5 ]9X(KI0F1G ݰ:%&N  ݰ# 'ܰFG ݐ`J HHR hh` 0 @ LFL q[̄T 0̄ȩF𸽒G ݰ 0` ݰF0F1G ݰy &밀L֢ȹLݠ@ȅH@ILҠ,|0` װJ WP8`TU fېH8,=)N 0 [01)@L` b讀 'ܰݩ ݰ L֬Qyy`O Wݰ @LL א=@ 5ȹQP8` &iQ` C0 5B C)yz( ȹ`y8myz8mz@8` װG8`F  װ P=)@N8`)@J 5yy)0($ p,&"op8`kkV꽌ɪɖxl*k-kmMl 꽌ɪ`8` ZsDE8T8Wpq 7I꽌ɪ꽌ɭ蠪:VE:8`]V]H)]V])]T])] >8hUD` Y`> Hh݌(`HCJJJJ)*h`)A$"":2808 6T%(U%)L%:T$(U%)(" "(T%(U%)),4)O @19:V%::T$(U%);f JU%U%1:U%2ī200~ TV%V%1(V%6):220 19:V%::T$(U%);:U%U%1:V%V%1(V%8):U%8ī220 U%2:V%10:220 L%(A$):L%280 L%1A$"" L%1A$(ALLL_L1    *  (` @   `  0ݥH)JJjeh)#&(F e`x  ȑ `` ``;?@H jjjj* 񍓿 񍒿h`  `U1,12 V%4:U%77 19:V%::T$(U%);::19:A$""L X$:X$"!"ī500_ X$(13)ī300z X$(8)X$(11)ī400 X$(10)X$(21)ī320 X$(127)ī450 X$"0"X$"9"Č198:230 "X$;:A$A$X$:230 ,L%(A$):L%MN%(U%)L%MX%(U% D$(4):CL489027D$;"BLOAD CLOCK.CBIN,A$300"BCL,76Ld1000x15:"Move with arrows":"Delete with Delete":"Enter new values with Return":"Press ! to set clock":I27:MN%(I),MX%(I):I:200 0,59, 0,59, 0,23, 1,7, 1,31,  &@DEF   %LҠؠӠ΢ϠԩҠŠƠԠԠŠӢɯϠҠůȠԠĠ à ɘɉ ɈL :Lɍ)ې)ɮ۰ɺH h 'ĝL  LL L)'L L L'L  (L(L $ʩ $$ $L `ީ % XʩXύX X A %  % ɍNH hɛɘɉɈ $ Lc :Lcې)ɮ۰ɺ'Ɲ Lc  : X i % $ɛ$8V%&8V)HV)hH)hHIhդD?DRIDQD); ?JDQD]`MY pY)p  p`8L:HhHh VY>:Y)`;R?AJ;<ȰY)`Y?)`ȐҰ ;HhHh=`Hh `Hh`DEiȍ01$,L%1)/ 19:V%::A$;" ";:19L%:230U I27:0,I:1,T%(I):771:774:I X1000:::" This is current time - o.k.? (Y/N) ":X$:X$"Y"X$"y"Ā 100 I27:0,I:777:768:T%(I)(1):T$(I)(" "(T%(I)),4):IJ :4:" Month (1-12):";T$(7):" Day of Month:";T$(6):"Day of Week (1-7):";T$(5): " Hour (0-23):";T$(4):" Minute:";T$(3):" Second:";T$(2)::dP(2,8) 320 PI=3.14159: | RAD=PI/180.: | PI2=PI+PI: | PIH=PI/2. [------------------------------------------------------------------------------ [ *** Setup Analog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [----------------------------------------------------------------------------------------------- [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ [ *** NOTE: zero elements (ANLGN(0)) not allowed *** [ 300 DIM ANLGN(16) 310 DIM STENOy X BOP " " " [ 3 0,1,1 Display Y " " " [ 4 1,0,0 Display/read BOP Azimuth Preset " [ 5 1,0,1 Display/read Riser Azimuth Preset [ 7 1,1,1 Display MSS *** normal setting **** (open switch) [----- Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:0 0,0,0 Display X Riser angle/read zero adj [ 1 0,0,1 Display Y " " " " [ 2 0,1,0 Displawitch (MSS) [ [ 7 6 Determines local angle/azimuth display [ MSS:0 0,0 Not used [ 1 0,1 Display vertical angle of Riser Azimuth of Riser angle [ 2 1,0 Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 1,1tion (Port 0) [ 0 Zero set pushbutton [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarm acknowledge [ 6-7 Bits 0,1 of Mode Select Sure display [ 3 temp. display [ 4 remote diff. angle display [ 5 remote riser azimuth display [ 6 local angle display (accd setting of MSS) [ 7 local azimuth display (accd setting of MSS) [ [ Digital I/P(s) Descrips. signal [ 12 Port 1 BOP X (channels 12-15 are 4010 ports) [ 13 Port 2 BOP Y [ 14 Port 3 Riser X [ 15 Port 4 Riser Y [ [ Analog O/P Channel(s) Description [ 0,1 not used [ 2 press Inclinometer Vertical ref. signal (nom 4.5) [ 7 Port 2 Not used [ 8 Port 3 Angle Alarm Setpoint adj. [ 9 Port 3 Pressure Alarm Setpoint ajd. [ 10 Port 3 Mud temp. signal [ 11 Port 3 Mud presACDEFGHIJKLMNOPQRSTUVWXYc 4030 [ [ uMac 5000-4010-4030 assignments: [ [ Analog I/P Channel(s) Description [ 0,1 Port 1 X,Y Riser zero pots [ 2-3 Port 1 X,Y BOP zero pots [ 4-5 Port 2 Azimuth adjustment for BOP, Riser [ 6 Port 2 [ [ Electro-Flow Controls [ Final? [ Author D.J. Winningham [ Date May 1990 [ Language uMAC 5000 Basic [ Purpose Platform Indicators Intelligence [ Equipment uMac 5000; uMac 4050; uMa------------------------------------------------------- [ *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature (2V=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360) [ MSS: 0 1 angle display -- R/B/D angle *** [ Remote diff angle display [ chart riser angle display [ [ 1 2 3(Norm) 3000 ON MSS% GOTO 3010,3020,3030 3010 V=RANG:GOSUB 4500:RETURN 3020 V=BANG:GOSUB 4500:RETURN 3030 V=THETA:GOSUB 4 -----------DISPLAY LOOP-------------------- [ *** Get MSS status and Display Stuff *** [ 2500 MSS%=DIN(0,6,7): [ | FOR X%=2 TO 7: | ON X%-1 GOSUB 3200,3300,3030,3110,3000,3100: | GOTO 3500 [--------------------------------- [ *** Localeter stuff *** [ 2200 V=AIN(I%)*DRIFT: | GOSUB 4300: | ANLGN(I%+1)=V: | IF I%<>15 THEN RETURN [ [ *** On Riser Y we also do calc... *** [ 2210 GOSUB 5000: | RETURN [ 2400 NEXT [-------------------------------------------------------------- [---------------------------- [ *** Mud pressure signal (0-1000psi = 1-5v) (not saved) *** [ ---Mud pressure display--- 2100 V=(AIN(I%)-1)*250:X%=2:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Get inclinom)=AIN(I%)*1000: | RETURN [----------------------------------------------------------- [ *** Mud temp signal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(AIN(I%)-1)*25:X%=3:GOSUB 4500:RETURN [----------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 ANLGN(I%+1)=AIN(I%)*10*RAD: | RETURN [----------------------------------------------------------- [ *** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%+1---------- [ *** Get reference 4.5 v signal (Direct read-- no offset or span) *** [ Measured volts * drift=correct voltage [ 1600 ANLGN(I%+1)=AIN(I%): | DRIFT=4.5/ANLGN(I%+1): | RETURN [--------------------------------------------------------rticular adj selected accd css --- [ 1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*4: | IF CSS%>5 THEN RETURN [ 1020 V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 1025 ANLGN(CSS%+1)=V: | RETURN [------------------------------------------------ Not used *** [ 910 RETURN [------------------------------------------------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 is hi... [ 1000 IF CALB% THEN RETURN [ [ --- BINGO! now we read only the pa0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,1000,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 905 GOTO 2400 [----------------------------------------------------- [ ***.0, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [------------------------------begin main loop--------------------------------- [ *** Get input data readings decoded *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) [ P(2,I%)=OPVLT%/(X1-STENOP(1,I%)) [ 515 IF I%=3 OR I%=4 THEN GOTO 520 [ 517 STENOP(2,I%)=STENOP(2,I%)*RAD: | STENOP(1,I%)=STENOP(1,I%)*RAD [ 520 NEXT:GOTO 900 [ 540 DATA 0.0, 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0t of measurement [ [ Read array double :Start O/P unit (at 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... [ 500 OPVLT%=2 [ 510 FOR I%=1 TO 8: | READ STENOP(1,I%) [ 512 READ X1: | STENO 2 [ 6 0 20 Deg Angle: Diff BOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: STENOP(1,ch+1)=Start Unit of measurement at 0 volts [ (2,ch+1)=Volts per Uni500:RETURN [--------------------------------- [ *** Local Azimuth display --- R/B/R azimuth *** [ Remote R azimuth display [ chart riser azimuth display [ 1 2 3(Norm) 3100 ON MSS% GOTO 3110,3120,3110 3110 V=RAZ:GOSUB 4500:RETURN 3120 V=BAZ:GOSUB 4500:RETURN [--------------------------------- [ *** Pressure display *** [ 3200 V=ANLGN(12): | GOSUB 4500:RETURN [--------------------------------- [ *** Temp display *** [ 3300 V=ANLGN(11): | GOSUB 4500:RETURN [----er X,Y in radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [---------------------------------------------------------------------- 5000 TXR=TAN(ANLGN(15)-ANLGN(1)): | TYR=TAN(ANLGN(16)-ANLGN(2)): | TXB=TAN(ANLGN(13)-ANLGN(3)) 5010 TYB=TAN( 2pi [ unless |y|<.0001 in which case y=0 AZ=pi/2 (-x add pi) [--------------------------------------------------------------------- [ I/P: ANLGN(1-6) riser x,y zero; bop x,y zero; bop,riser azimuth all in radians [ ANLGN(13-16) BOP X,Y incl, RisA) (calc x',y' using BA) [ [ also return Polar co-ordinates: RANG=Riser Angle, RAZ=RANG Azimuth [ BANG=BOP Angle, BAZ=BANG Azimuth [ ANG=ATN[ SQR(x^2 + y^2 )/z ] [ AZ =ATN[ x/y ] +x-y add pi -x-y add pi -x+y addSQR{ 1/ [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Riser Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ y = x SIN(RA) + y COS(Ralues)-ANLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measured from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is to the East! [ [ z = unless W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoint co-ords for RISER [ x'y'z'are same for BOP [ ---------------------------------------------------------------- [ GIVEN:xr,yr,xb,yb are calc'ed: ANLGN(raw v [------------------------------------------------------------------------------ [ Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*W+1))+1.5708 [ =V-PI2: | GOTO 4450 [---ELSE--- 4415 IF V<0 THEN V=V+PI2 [ 4450 RETURN [------------------------------------------------- [ *** Send V to Analog O/P X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(1,X%+1))*STENOP(2,X%+1) : | RETURN [------------------------------------------------ [ --- range 0 to 360 deg at 1 to 4 volts (with wrap back to range <1 & >4 *** [ reads analog in (i%) [ output anlgn(i%) in radians 0 to 2pi [ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V>=PI2 THEN V************************************************** [ 0 1 2 3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts --- [ I/P =V O/P=V [ output anlgn(i%) in radians [ 4300 V=(V-3) * 10.0*RAD: | RETURN =DIN(0,5,5):DAHOT%=DIN(0,3,3) [ [ *** Set the alarms *** [ 3830 DOT(1,0,7)=ALRM% [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************************************************** [ ************** ROUTINES ****************** [*************** diff angle high=set 1,3 and (clear 5 unless dahot%=1) [ 3810 IF THETA0.99999999 THEN THET 6 1,1,0 Display Y " " " " [ 5 1,0,1 Display X BOP " " " [ 4 1,0,0 Display Y " " " [ 3 0,1,1 Display/read BOP Azimuth Preset " [ 2 0,1,0 Display/read Riser Azimuth Preset [ Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 0,0 Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:7 1,1,1 Display X Riser angle/read zero adj [ m acknowledge [ 6-7 Bits 0,1 of Mode Select Switch (MSS) [ [ 7 6 as read Determines local angle/azimuth display [ MSS:3 1,1 Not used [ 1 1,0 Display vertical angle of Riser Azimuth of Riser angle [ 2 0,1 tion (Port 0) ***NOTE: 5v is 0, gnd is 1 [ 0 Zero set pushbutton -------------------------- [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarure display [ 3 temp. display [ 4 remote diff. angle display [ 5 remote riser azimuth display [ 6 local angle display (accd setting of MSS) [ 7 local azimuth display (accd setting of MSS) [ [ Digital I/P(s) Descrips. signal [ 12 Port 1 BOP X (channels 12-15 are 4010 ports) [ 13 Port 2 BOP Y [ 14 Port 3 Riser X [ 15 Port 4 Riser Y [ [ Analog O/P Channel(s) Description [ 0,1 not used [ 2 press Inclinometer Vertical ref. signal (nom 4.5) [ 7 Port 2 Not used [ 8 Port 3 Angle Alarm Setpoint adj. [ 9 Port 3 Pressure Alarm Setpoint ajd. [ 10 Port 3 Mud temp. signal [ 11 Port 3 Mud presZ\]^_`abcdefghijklmnopqrsc 4030 [ [ uMac 5000-4010-4030 assignments: [ [ Analog I/P Channel(s) Description [ 0,1 Port 1 X,Y Riser zero pots [ 2-3 Port 1 X,Y BOP zero pots [ 4-5 Port 2 Azimuth adjustment for BOP, Riser [ 6 Port 2 [ [ Electro-Flow Controls [ Final? [ Author D.J. Winningham [ Date May 1990 [ Language uMAC 5000 Basic [ Purpose Platform Indicators Intelligence [ Equipment uMac 5000; uMac 4050; uMa-------------------------------------------------------------------------- 6000 EXIT Y>=0 THEN 5080 | ELSE RAZ=RAZ+PI: | IF RX<0 AND RY>0 THEN RAZ=RAZ+PI [ 5080 IF BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+PI [ 5100 RETURN [----A=0 | ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | BANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | ELSE RAZ=PIH [ (Note RY=0 can't get 2PI) 5070 IF RX>=0 AND R 0 0,0,0 Display MSS *** normal setting **** (open switch) [----------------------------------------------------------------------------- [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ [ *** NOTE: Dim lengths are no. of elem but start with 0 (ie 0-15=16) *** [ 300 DIM ANLGN(16) 310 DIM STENOP(2,8) 320 PI=3.14159: | RAD=PI/180.: | PI2=PI+PI: | PIH=PI/2. [------------------------------------------------------------------------------ [ *** Setup Analessure display--- 2100 V=(AIN(I%)-1)*250:X%=2:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Get inclinometer stuff *** [ 2200 V=AIN(I%)*DRIFT: | GOSUB 4300: | ANLGN(I%)=V: | IF I%<>15 THEN RETURN [ [ **nal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(AIN(I%)-1)*25:X%=3:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Mud pressure signal (0-1000psi = 1-5v) (not saved) *** [ ---Mud pr RETURN [----------------------------------------------------------- [ *** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%)=AIN(I%)*1000: | RETURN [----------------------------------------------------------- [ *** Mud temp sigvolts * drift=correct voltage [ 1600 ANLGN(I%)=AIN(I%): | DRIFT=4.5/ANLGN(I%): | RETURN [----------------------------------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 ANLGN(I%)=AIN(I%)*10*RAD: | %: | V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 1025 ANLGN(CSS%)=V: | RETURN [---------------------------------------------------------- [ *** Get reference 4.5 v signal (Direct read-- no offset or span) *** [ Measured s 5V=0 ... [ 1000 IF CALB%=0 THEN RETURN [ [ --- BINGO! now we read only the particular adj selected accd css --- [ 1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*4: | IF CSS%<2 THEN RETURN [ ---Convert CSS to 0-5 to match ANLGN array 1020 CSS%=7-CSS905 GOTO 2400 [----------------------------------------------------- [ *** Not used *** [ 910 RETURN [------------------------------------------------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 ioded *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) [ 0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,1000,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0.0, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [------------------------------begin main loop--------------------------------- [ *** Get input data readings dec[ 500 OPVLT%=2 [ 510 FOR I%=0 TO 7: | READ STENOP(0,I%) [ 512 READ X1: | STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%)) [ 515 IF I%=2 OR I%=3 THEN GOTO 520 [ 517 STENOP(1,I%)=STENOP(1,I%)*RAD: | STENOP(0,I%)=STENOP(0,I%)*RAD [ 520 NEXT [ 540 DATA 0.0, TENOP(0,ch)=Start Unit of measurement at 0 volts [ (1,ch)=Volts per Unit of measurement [ [ Read array double :Start O/P unit (at 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... f: Azimuth) (.36V=360) [ MSS: 0 1 2 [ 6 0 20 Deg Angle: Diff BOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: S Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature (2V=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Difog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [------------------------------------------------------------------------------ [ *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 * On Riser Y we also do calc... *** [ 2210 GOSUB 5000: | RETURN [ 2400 NEXT [-------------------------------------------------------------- [ -----------DISPLAY LOOP-------------------- [ *** Get MSS status and Display Stuff *** [ negate mss% logic to 1=riser,2=bop,3=diff [ 2500 MSS%=4-DIN(0,6,7): [ | FOR X%=2 TO 7: | ON X%-1 GOSUB 3200,3300,3030,3110,3000,3100: | GOTO 3500 [--------------------------------- [ *** Local angle display -- R/B/D angle *** [ Remote diff angl [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Riser Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ y = x SIN(RA) + y COS(RA) (NLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measured from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is to the East! [ [ z = SQR{ 1/less W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoint co-ords for RISER [ x'y'z'are same for BOP [ ---------------------------------------------------------------- [ GIVEN:xr,yr,xb,yb are calc'ed: ANLGN(raw values)-A------------------------------------------------------------------------ [ Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*W+1))+1.5708 [ unI2: | GOTO 4450 [---ELSE--- 4415 IF V<0 THEN V=V+PI2 [ 4450 RETURN [------------------------------------------------- [ *** Send V to Analog O/P X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(0,X%))*STENOP(1,X%) : | RETURN [---------------------------------------------------- [ --- range 0 to 360 deg at 1 to 4 volts (with wrap back to range <1 & >4 *** [ reads analog in (i%) [ output anlgn(i%) in radians 0 to 2pi [ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V>=PI2 THEN V=V-P********************************************** [ 0 1 2 3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts --- [ I/P =V O/P=V [ output anlgn(i%) in radians [ 4300 V=(V-3) * 10.0*RAD: | RETURN [--T%=0:ALRM%=ALRM% AND 0DFh [ [ *** Set the alarms *** [ 3830 DOT(1,0,7)=ALRM% [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************************************************** [ ************** ROUTINES ****************** [*******************ALRM%=ALRM% OR 10 AND 0DFh:DAHOT%=1: | GOTO 3820 [----ELSE--- 3815 ALRM%=ALRM% AND 0F5h OR (DAHOT%*32) [ [ *** Set prhot,dahot accd din 5,3 (Negative logic again) *** [ 3820 IF DIN(0,5,5) THEN PRHOT%=0:ALRM%=ALRM% AND 0EFh 3830 IF DIN(0,3,3) THEN DAHO%=ALRM% OR 5 AND 0EFh:PRHOT%=1: | GOTO 3810 [---ELSE--- 3806 ALRM%=ALRM% AND 0FAh OR (PRHOT%*16) [ [ diff angle cool=set 1,3 and clear 5=neuter hooter and set dahot%=1 [ diff angle high=clr 1,3 and (set 5=dahot%) [ 3810 IF THETA0 THEN RAZ=RAZ+PI [ 5080 IF BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+PI [ 5100 RETURN [------------ ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | BANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | ELSE RAZ=PIH [ (Note RY=0 can't get 2PI) 5070 IF RX>=0 AND RY>=0 THE001 THEN RY=0 [ 5030 BZ=SQR(1/ (1+TXB*TXB+TYB*TYB)): | BX=BZ * TXB: | BY=BZ * TYB: | X1=BX * CBA - BY*SBA 5035 BY=BX * SBA + BY*CBA: | BX=X1: | IF ABS(BY)<.0001 THEN BY=0 [ 5040 W=RX*BX + RY*BY + RZ*BZ: | IF W>0.99999999 THEN THETA=0 | )-ANLGN(3)): | SRA=SIN(-ANLGN(5)):CRA=COS(-ANLGN(5)): | SBA=SIN(-ANLGN(4)):CBA=COS(-ANLGN(4)) 5020 RZ=SQR(1/ (1+TXR*TXR+TYR*TYR)): | RX=RZ * TXR: | RY=RZ * TYR: | X1=RX * CRA - RY*SRA 5025 RY=RX * SRA + RY*CRA: | RX=X1: | IF ABS(RY)<.0n radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [---------------------------------------------------------------------- 5000 TXR=TAN(ANLGN(14)-ANLGN(0)): | TYR=TAN(ANLGN(15)-ANLGN(1)): | TXB=TAN(ANLGN(12)-ANLGN(2)) 5010 TYB=TAN(ANLGN(13tion (Port 0) ***NOTE: 5v is 0, gnd is 1 [ 0 Zero set pushbutton -------------------------- [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarm acknowledge [ 6-7 Bits 0,1 of Mode Select Switch (MSS) [ [ 7,6 as read Determines local angle/azimuth display [ MSS:3 1,1 Not used [ 2 1,0 Display vertical angle of Riser Azimuth of Riser angle [ 1 0,1 --- BINGO! now we read only the particular adj selected accd css --- [ first time we read all css% possibilities--- [ 1005 IF FRST% THEN CSS%=I%+2:GOTO 1020 [ [ *** After first time we only check css%'ed one once by setting i% [ 1010 CSS%=DIN(0,1,2--------------------- [ *** Not used *** [ 910 RETURN [------------------------------------------------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 is 5V=0 ... [ 1000 IF CALB%=0 THEN RETURN [ [ R FRST% [ 0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,1000,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 905 GOTO 2400 [--------------------------------, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [------------------------------begin main loop--------------------------------- [ *** Get input data readings decoded (Set calb first time) *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) O=2 OR I%=3 THEN GOTO 520 [ 517 STENOP(1,I%)=STENOP(1,I%)/RAD: | STENOP(0,I%)=STENOP(0,I%)/RAD [ 520 NEXT: | PSI2KPA=250*6.8948: | DAHOT%=1: | PRHOT%=1 [ 540 DATA 0.0, 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0.0Start O/P unit (at 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... [ 500 OPVLT%=2 [ 510 FOR I%=0 TO 7: | READ STENOP(0,I%) [ 512 READ X1: | STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%)) [ 515 IF I%e: Diff BOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: STENOP(0,ch)=Start Unit of measurement at 0 volts [ (1,ch)=Volts per Unit of measurement [ [ Read array double : (2V=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360) [ MSS: 3 2 1 [ 6 0 20 Deg Angl---------------------- [ *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature 2=PI+PI: | PIH=PI/2.: | FRST%=1 [------------------------------------------------------------------------------ [ *** Setup Analog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [--------------------------------------------------------ngths are no. of elem but start with 0 (ie 0-15=16) *** [ 300 DIM ANLGN(16) 310 DIM STENOP(2,8) [ [ *** Give us an easy exit for EPROM burn by pressing both resets *** [ 315 IF DIN(0,3,3) AND DIN(0,5,5) THEN EXIT [ 320 PI=3.14159: | RAD=PI/180.: | PI 0 0,0,0 Display MSS *** normal setting **** (open switch) [----------------------------------------------------------------------------- [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ [ *** NOTE: Dim le 3 0,1,1 Display Y " " " " [ 4 1,0,0 Display X BOP " " " [ 5 1,0,1 Display Y " " " [ 6 1,1,0 Display/read BOP Azimuth Preset " [ 7 1,1,1 Display/read Riser Azimuth Preset [ Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 0,0 Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:2 0,1,2 Display X Riser angle/read zero adj [ )+DIN(0,4,4)*4: | I%=5: | IF CSS%<2 THEN RETURN [ ---Convert CSS to 0-5 to match ANLGN array 1020 CSS%=CSS%-2: | V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 0 1 2 3 4 5 1025 ANLGN(CSS%)=V: | RETURN [---------------------------------------------------------- [ *** Get reference 4.5 v signal (Direct read-- no offset or span) *** [ Measured volts * drift=correct voltage [ 1600 ANLGN(I%)=AIN(I%): | DRIFT=4.5/ANLGN3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts --- [ I/P =V O/P=V [ output anlgn(i%) in radians [ 4300 V=(V-3) * 10.0*RAD: | RETURN [------------------------------------------------ [ --- range 0 to 360 deg at 1 [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************************************************** [ ************** ROUTINES ****************** [***************************************************************** [ 0 1 2 % AND 0F5h) OR (DAHOT%*32) [ [ *** Set prhot,dahot accd din 5,3 (Negative logic again) *** [ 3820 IF DIN(0,3,3) THEN PRHOT%=0:ALRM%=ALRM% AND 0EFh 3825 IF DIN(0,5,5) THEN DAHOT%=0:ALRM%=ALRM% AND 0DFh [ [ *** Set the alarms *** [ 3830 DOT(1,0,5)=ALRM% ) OR (PRHOT%*16) [ [ diff angle cool=set 1,3 and clear 5=neuter hooter and set dahot%=1 [ diff angle high=clr 1,3 and (set 5=dahot%) [ 3810 IF THETA15 THEN RETURN [ [ *** On Riser Y we also do calc... *** [ 2210 GOSUB 5000: | RETURN(AIN(I%)-1)*25:X%=3:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Mud pressure signal (0-1000psi = 1-5v) *** [ ---Mud pressure display--- 2100 V=(AIN(I%)-1)*PSI2KPA:ANLGN(I%)=V: | X%=2:GOSUB 4500:RETURN [** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%)=AIN(I%)*1000: | RETURN [----------------------------------------------------------- [ *** Mud temp signal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(I%): | RETURN [----------------------------------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 ANLGN(I%)=AIN(I%)*10*RAD: | RETURN [----------------------------------------------------------- [ *to 4 volts (with wrap back to range <1 & >4 *** [ reads analog in (i%) [ output anlgn(i%) in radians 0 to 2pi [ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V>=PI2 THEN V=V-PI2: | GOTO 4450 [---ELSE--- 4415 IF V<0 THEN V=V+PI2 [ 4450 RETURN [------------------------------------------------- [ *** Send V to Analog O/P X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(0,X%))*STENOP(1,X%): | RETURN [------------------------------------------------------------------------------ [ c 4030 [ [ uMac 5000-4010-4030 assignments: [ [ Analog I/P Channel(s) Description [ 0,1 Port 1 X,Y Riser zero pots [ 2-3 Port 1 X,Y BOP zero pots [ 4-5 Port 2 Azimuth adjustment for BOP, Riser [ 6 Port 2 [ [ Electro-Flow Controls [ Final? [ Author D.J. Winningham [ Date May 1990 [ Language uMAC 5000 Basic [ Purpose Platform Indicators Intelligence [ Equipment uMac 5000; uMac 4050; uMa BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+PI [ 5100 RETURN [------------------------------------------------------------------------------ 6000 EXIT ANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | ELSE RAZ=PIH [ (Note RY=0 can't get 2PI) 5070 IF RX>=0 AND RY>=0 THEN 5080 | ELSE RAZ=RAZ+PI: | IF RX<0 AND RY>0 THEN RAZ=RAZ+PI [ 5080 IF * TYB: | X1=BX * CBA - BY*SBA 5035 BY=BX * SBA + BY*CBA: | BX=X1: | IF ABS(BY)<.0001 THEN BY=0 [ 5040 W=RX*BX + RY*BY + RZ*BZ: | IF W>0.99999999 THEN THETA=0 | ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | BCBA=COS(-ANLGN(4)) 5020 RZ=SQR(1/ (1+TXR*TXR+TYR*TYR)): | RX=RZ * TXR: | RY=RZ * TYR: | X1=RX * CRA - RY*SRA 5025 RY=RX * SRA + RY*CRA: | RX=X1: | IF ABS(RY)<.0001 THEN RY=0 [ 5030 BZ=SQR(1/ (1+TXB*TXB+TYB*TYB)): | BX=BZ * TXB: | BY=BZ---------------------------------------------------- 5000 TXR=TAN(ANLGN(14)-ANLGN(0)): | TYR=TAN(ANLGN(15)-ANLGN(1)): | TXB=TAN(ANLGN(12)-ANLGN(2)) 5010 TYB=TAN(ANLGN(13)-ANLGN(3)): | SRA=SIN(-ANLGN(5)):CRA=COS(-ANLGN(5)): | SBA=SIN(-ANLGN(4)):------------------------------------------------- [ I/P: ANLGN(0-5) riser x,y zero; bop x,y zero; bop,riser azimuth all in radians [ ANLGN(12-15) BOP X,Y incl, Riser X,Y in radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [------------------RANG Azimuth [ BANG=BOP Angle, BAZ=BANG Azimuth [ ANG=ATN[ SQR(x^2 + y^2 )/z ] [ AZ =ATN[ x/y ] +x-y add pi -x-y add pi -x+y add 2pi [ unless |y|<.0001 in which case y=0 AZ=pi/2 (-x add pi) [-------------------- (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Riser Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ y = x SIN(RA) + y COS(RA) (calc x',y' using BA) [ [ also return Polar co-ordinates: RANG=Riser Angle, RAZ=ed from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is to the East! [ [ z = SQR{ 1/ [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) co-ords for RISER [ x'y'z'are same for BOP [ ---------------------------------------------------------------- [ GIVEN:xr,yr,xb,yb are calc'ed: ANLGN(raw values)-ANLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measur Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*W+1))+1.5708 [ unless W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoint Inclinometer Vertical ref. signal (nom 4.5) [ 7 Port 2 Not used [ 8 Port 3 Angle Alarm Setpoint adj. [ 9 Port 3 Pressure Alarm Setpoint ajd. [ 10 Port 3 Mud temp. signal [ 11 Port 3 Mud pres--------------------------begin main loop--------------------------------- [ *** Get input data readings decoded *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) [ 0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,10OTO 520 [ 517 STENOP(1,I%)=STENOP(1,I%)*RAD: | STENOP(0,I%)=STENOP(0,I%)*RAD [ 520 NEXT [ 540 DATA 0.0, 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0.0, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [----t 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... [ 500 OPVLT%=2 [ 510 FOR I%=0 TO 7: | READ STENOP(0,I%) [ 512 READ X1: | STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%)) [ 515 IF I%=2 OR I%=3 THEN GOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: STENOP(0,ch)=Start Unit of measurement at 0 volts [ (1,ch)=Volts per Unit of measurement [ [ Read array double :Start O/P unit (aV=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360) [ MSS: 0 1 2 [ 6 0 20 Deg Angle: Diff B *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature (2 PIH=PI/2. [------------------------------------------------------------------------------ [ *** Setup Analog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [------------------------------------------------------------------------------ [------------------------------------------------------------------------ [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ 300 DIM ANLGN(15) 310 DIM STENOP(7,1) 320 PI=3.14159: | RAD=PI/180.: | PI2=PI+PI: | Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:0 0,0,0 Display X Riser angle/read zero adj [ 1 0,0,1 Display Y " " " " [ 2 0,1,0 Displawitch (MSS) [ [ 7 6 Determines local angle/azimuth display [ MSS:0 0,0 Not used [ 1 0,1 Display vertical angle of Riser Azimuth of Riser angle [ 2 1,0 Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 1,1tion (Port 0) [ 0 Zero set pushbutton [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarm acknowledge [ 6-7 Bits 0,1 of Mode Select Sure display [ 3 temp. display [ 4 remote diff. angle display [ 5 remote riser azimuth display [ 6 local angle display (accd setting of MSS) [ 7 local azimuth display (accd setting of MSS) [ [ Digital I/P(s) Descrips. signal [ 12 Port 1 BOP X (channels 12-15 are 4010 ports) [ 13 Port 2 BOP Y [ 14 Port 3 Riser X [ 15 Port 4 Riser Y [ [ Analog O/P Channel(s) Description [ 0,1 not used [ 2 press00,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 905 GOTO 2400 [----------------------------------------------------- [ *** Not used *** [ 910 RETURN [------------------------------------------------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 is hi... [ 1000 IF CALB% THEN RETURN [ [ --- BINGO! now we read only the particular adj selected accd css --- [ 1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*4splay6[ 6 local angle display (accd setting of MSS)8[ 7 local azimuth display (accd setting of MSS)[3[ Digital I/P(s) Description (Port 0).[ 0 Zero set pushbutton -[ 1,2,4 Bit Riser X![ 15 Port 4 Riser Y[*[ Analog O/P Channel(s) Description [ 0,1 not used[ 2 pressure display[ 3 temp. display'[ 4 remote diff. angle display)[ 5 remote riser azimuth di Pressure Alarm Setpoint ajd.*[ 10 Port 3 Mud temp. signal/[ 11 Port 3 Mud press. signal F[ 12 Port 1 BOP X (channels 12-15 are 4010 ports)[ 13 Port 2 BOP Y![ 14 Port 3 P zero pots;[ 4-5 Port 2 Azimuth adjustment for BOP, RiserF[ 6 Port 2 Inclinometer Vertical ref. signal (nom 4.5)"[ 7 Port 2 Not used3[ 8 Port 3 Angle Alarm Setpoint adj.7[ 9 Port 3 atform Indicators Intelligence1[ Equipment uMac 5000; uMac 4050; uMac 4030[&[ uMac 5000-4010-4030 assignments:[*[ Analog I/P Channel(s) Description -[ 0,1 Port 1 X,Y Riser zero pots+[ 2-3 Port 1 X,Y BO[3[ Electro-Flow Controls [ Final?![ Author D.J. Winningham[ Date May 1990![ Language uMAC 5000 Basic2[ Purpose Pl< O=====|====|====|====|====|====|====|====|====|====|====|====|====|====|====|=== *** [ ---Mud pressure display--- 2100 V=(AIN(I%)-1)*250:X%=2:GOTO 4500 [------------------------------------------------------------ [ *** Get inclinometer stuff *** [ 2200 V=AIN(I%)*DRIFT: | GOSUB 4300: | ANLGN(I%)=V: | IF I%<>15 THEN R-------- [ *** Mud temp signal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(AIN(I%)-1)*25:X%=3:GOTO 4500 [------------------------------------------------------------ [ *** Mud pressure signal (0-1000psi = 1-5v) (not saved)ANLGN(I%)=AIN(I%)*10*RAD: | RETURN [----------------------------------------------------------- [ *** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%)=AIN(I%)*1000: | RETURN [---------------------------------------------------r span) *** [ Measured volts * drift=correct voltage [ 1600 ANLGN(I%)=AIN(I%): | DRIFT=4.5/ANLGN(I%): | RETURN [----------------------------------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 : | IF CSS%>5 THEN RETURN [ 1020 V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 1025 ANLGN(CSS%)=V: | RETURN [---------------------------------------------------------- [ *** Get reference 4.5 v signal (Direct read-- no offset os 0, 1, 2 of CSS4[ 3 Pressure alarm acknowledge1[ 5 Angle alarm acknowledge>[ 6-7 Bits 0,1 of Mode Select Switch (MSS)[;[ 7 6 Determines local angle/azimuth display[ MSS:0 0,0 Not usedK[ 1 0,1 Display vertical angle of Riser Azimuth of Riser angleI[ 2 1,0 Display vertical angle of BOP Azimuth of BOP angleJ[ MSS:0 1,1 Display angle between BOP & Riser Azimuth of Diff Angle[1 GOSUB 4300,4300,4300,4300,4400,4400[1025 ANLGN(CSS%)=V: | RETURN=[----------------------------------------------------------J[ *** Get reference 4.5 v signal (Direct read-- no offset or span) ***&[ Measured volts * drift=co ignore if bit0 is hi...[1000 IF CALB% THEN RETURN[J[ --- BINGO! now we read only the particular adj selected accd css ---[$1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*4:| IF CSS%>5 THEN RETURN[ 1020 V=AIN(CSS%):4| ON CSS%+GOTO 24008[-----------------------------------------------------[ *** Not used ***[ 910 RETURN:[-------------------------------------------------------:[ *** Convert riser,bop x,y zero values to radians ***0[ --- We totally0 TO 15:| CALB%=DIN(0,0,0)C[ 0 1 2 3 4 5 6 7 8 9E904 ON I%+1 GOSUB 1000,1000,1000,1000,1000,1000,1600,910,1800,1900,"[ 10 11 12 13 14 15 !| 2000,2100,2200,2200,2200,2200[905 , 0.0, 200.0(560 DATA 0.0, 20.0 , 0.0, 2000.0(570 DATA 0.0, 20.0 , 0.0, 2000.0,*[------------------------------begin main 'loop----------------------------------[ *** Get input data readings decoded ***[ 900 FOR I%=12 READ X1:+| STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%))[515 IF I%<2 OR I%>3 THEN"| STENOP(1,I%)=STENOP(1,I%)*RAD:!| STENOP(0,I%)=STENOP(0,I%)*RAD[ 520 NEXT[*540 DATA 0.0, 2.0 , 0.0, 2.0 (550 DATA 0.0,2000.0 t[6[ Read array double :Start O/P unit (at 0 volts)5[ last O/P unit (at 2 volts)[.[ Deg values area converted to radians...[500 OPVLT%=2[510 FOR I%=0 TO 7:| READ STENOP(0,I%)[5 20 Deg Angle: Diff BOP Riser (2V=20)H[ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360)[=[ Calc: STENOP(0,ch)=Start Unit of measurement at 0 volts6[ (1,ch)=Volts per Unit of measuremen (2V=200)G[ 4 0 20 Deg Angle (Diff: Theta) (2V=20)H[ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360)A[ MSS: 0 1 2G[ 6 0 [ *** Initialize Analogue O/P's ***[ [ STENOP%[ ch# Range(0-2V) Description[ 0 Not used[ 1 Not usedI[ 2 0 2000 mpascl Pressure (2V=2000)H[ 3 0 200 Deg Temperature ------------------------------------------ -------------------[ *** Setup Analog I/P ***[400 FOR I%=0 TO 15:| INTYPE (I%,5,.02): | NEXT?=[----------------------------------------------------------- -------------------'---------------------- ------------------[ *** Set up Constants *** [200 REM BEGIN HERE AND RS232 300 DIM ANLGN(15)310 DIM STENOP(7,1)320 PI=3.14159:| RAD=PI/180.:| PI2=PI+PI:| PIH=PI/2.?=[-----------------isplay Y " " "4[ 4 1,0,0 Display/read BOP Azimuth Preset "3[ 5 1,0,1 Display/read Riser Azimuth PresetF[ 7 1,1,1 Display MSS *** normal setting **** (open switch)?=[-------------------------------------F[ bits: 4,2,1 (cal selector swtch must be pressed or we get 111)5[ CSS:0 0,0,0 Display X Riser angle/read zero adj4[ 1 0,0,1 Display Y " " " "4[ 2 0,1,0 Display X BOP " " "4[ 3 0,1,1 DrreETURN [ [ *** On Riser Y we also do calc... *** [ 2210 GOSUB 5000: | RETURN [ 2400 NEXT [-------------------------------------------------------------- [ -----------DISPLAY LOOP-------------------- [ *** Get MSS status and Display Stuff *** [o the East! [ [ z = SQR{ 1/ [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Riser Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ ye calc'ed: ANLGN(raw values)-ANLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measured from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is tW+1))+1.5708 [ unless W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoint co-ords for RISER [ x'y'z'are same for BOP [ ---------------------------------------------------------------- [ GIVEN:xr,yr,xb,yb arOP(1,X%) : | RETURN [------------------------------------------------------------------------------ [ Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*[ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V=>PI2 THEN V=V-PI2 | ELSE IF V<0 THEN V=V+PI2 [ 4450 RETURN [------------------------------------------------- [ *** Send V to Analog O/P X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(0,X%))*STENradians [ 4300 V=(V-3) * 10.0*RAD: | RETURN [------------------------------------------------ [ --- range 0 to 360 deg at 1 to 4 volts (with wrap back to range <1 & >4 *** [ reads analog in (i%) [ output anlgn(i%) in radians 0 to 2pi ***** ROUTINES ****************** [***************************************************************** [ 0 1 2 3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts --- [ I/P =V O/P=V [ output anlgn(i%) in *** Set prhot,dahot accd din 5,3 *** [ 3820 PRHOT%=DIN(0,5,5):DAHOT%=DIN(0,3,3) [ [ *** Set the alarms *** [ 3830 DOT(1,0,7)=ALRM% [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************************************************** [ ********* [ diff angle cool=clear 1,3 and set 5=neuter hooter and set dahot%=0 [ diff angle high=set 1,3 and (clear 5 unless dahot%=1) [ 3810 IF THETA=0 AND RY>=0 THEN 5080 | ELSE RAZ=RAZ+PI: | IF RX<0 AND RY>0 THEN RAZ=RAZ+PI [ 5080 IF BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+W>0.99999999 THEN THETA=0 | ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | BANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | ELSE RAZ=PIH [ (Note RY=0 can't get 2PI| RX=X1: | IF ABS(RY)<.0001 THEN RY=0 [ 5030 BZ=SQR(1/ (1+TXB*TXB+TYB*TYB)): | BX=BZ * TXB: | BY=BZ * TYB: | X1=BX * CBA - BY*SBA 5035 BY=BX * SBA + BY*CBA: | BX=X1: | IF ABS(BY)<.0001 THEN BY=0 [ 5040 W=RX*BX + RY*BY + RZ*BZ: | IF LGN(2)) 5010 TYB=TAN(ANLGN(13)-ANLGN(3)): | SRA=SIN(-ANLGN(5)):CRA=COS(-ANLGN(5)): | SBA=SIN(-ANLGN(4)):CBA=COS(-ANLGN(4)) 5020 RZ=SQR(1/ (1+TXR*TXR+TYR*TYR)): | RX=RZ * TXR: | RY=RZ * TYR: | X1=RX * CRA - RY*SRA 5025 RY=RX * SRA + RY*CRA: -15) BOP X,Y incl, Riser X,Y in radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [---------------------------------------------------------------------- 5000 TXR=TAN(ANLGN(14)-ANLGN(0)): | TYR=TAN(ANLGN(15)-ANLGN(1)): | TXB=TAN(ANLGN(12)-ANtion (Port 0) [ 0 Zero set pushbutton [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarm acknowledge [ 6-7 Bits 0,1 of Mode Select Switch (MSS) [ [ 7 6 Determines local angle/azimuth display [ MSS:0 0,0 Not used [ 1 0,1 Display vertical angle of Riser Azimuth of Riser angle [ 2 1,0 Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 1,1r span) *** [ Measured volts * drift=correct voltage [ 1600 ANLGN(I%)=AIN(I%): | DRIFT=4.5/ANLGN(I%): | RETURN [----------------------------------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 : | IF CSS%>5 THEN RETURN [ 1020 V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 1025 ANLGN(CSS%)=V: | RETURN [---------------------------------------------------------- [ *** Get reference 4.5 v signal (Direct read-- no offset o------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 is hi... [ 1000 IF CALB% THEN RETURN [ [ --- BINGO! now we read only the particular adj selected accd css --- [ 1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*400,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 905 GOTO 2400 [----------------------------------------------------- [ *** Not used *** [ 910 RETURN [--------------------------------------------------------------------begin main loop--------------------------------- [ *** Get input data readings decoded *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) [ 0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,10OTO 520 [ 517 STENOP(1,I%)=STENOP(1,I%)*RAD: | STENOP(0,I%)=STENOP(0,I%)*RAD [ 520 NEXT [ 540 DATA 0.0, 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0.0, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [----t 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... [ 500 OPVLT%=2 [ 510 FOR I%=0 TO 7: | READ STENOP(0,I%) [ 512 READ X1: | STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%)) [ 515 IF I%=2 OR I%=3 THEN GOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: STENOP(0,ch)=Start Unit of measurement at 0 volts [ (1,ch)=Volts per Unit of measurement [ [ Read array double :Start O/P unit (aV=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360) [ MSS: 0 1 2 [ 6 0 20 Deg Angle: Diff B *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature (2 PIH=PI/2. [------------------------------------------------------------------------------ [ *** Setup Analog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [------------------------------------------------------------------------------ [------------------------------------------------------------------------ [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ 300 DIM ANLGN(15) 310 DIM STENOP(7,1) 320 PI=3.14159: | RAD=PI/180.: | PI2=PI+PI: | y X BOP " " " [ 3 0,1,1 Display Y " " " [ 4 1,0,0 Display/read BOP Azimuth Preset " [ 5 1,0,1 Display/read Riser Azimuth Preset [ 7 1,1,1 Display MSS *** normal setting **** (open switch) [----- Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:0 0,0,0 Display X Riser angle/read zero adj [ 1 0,0,1 Display Y " " " " [ 2 0,1,0 DisplaANLGN(I%)=AIN(I%)*10*RAD: | RETURN [----------------------------------------------------------- [ *** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%)=AIN(I%)*1000: | RETURN [----------------------------------------------------------- [ *** Mud temp signal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(AIN(I%)-1)*25:X%=3:GOTO 4500 [------------------------------------------------------------ [ *** Mud pressure signal (0-1000psi = 1-5v) (not saved)ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*W+1))+1.5708 [ unless W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoint co-ords for RISER [ x'y'z'are same for BOP [ ------------X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(0,X%))*STENOP(1,X%) : | RETURN [------------------------------------------------------------------------------ [ Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= n (i%) [ output anlgn(i%) in radians 0 to 2pi [ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V=>PI2 THEN V=V-PI2: | GOTO 4450 [---ELSE--- 4415 IF V<0 THEN V=V+PI2 [ 4450 RETURN [------------------------------------------------- [ *** Send V to Analog O/P [ I/P =V O/P=V [ output anlgn(i%) in radians [ 4300 V=(V-3) * 10.0*RAD: | RETURN [------------------------------------------------ [ --- range 0 to 360 deg at 1 to 4 volts (with wrap back to range <1 & >4 *** [ reads analog i************************************** [ ************** ROUTINES ****************** [***************************************************************** [ 0 1 2 3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts ---- 3815 ALRM%=ALRM% OR 5 AND (NOT (DAHOT%*32)) [ [ *** Set prhot,dahot accd din 5,3 *** [ 3820 PRHOT%=DIN(0,5,5):DAHOT%=DIN(0,3,3) [ [ *** Set the alarms *** [ 3830 DOT(1,0,7)=ALRM% [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************h AND (NOT (PRHOT%*16)) [ [ diff angle cool=clear 1,3 and set 5=neuter hooter and set dahot%=0 [ diff angle high=set 1,3 and (clear 5 unless dahot%=1) [ 3810 IF THETA15 THEN R---------------------------------------------------- [ GIVEN:xr,yr,xb,yb are calc'ed: ANLGN(raw values)-ANLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measured from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is to the East! [ [ z = SQR{ 1/ [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Ris Inclinometer Vertical ref. signal (nom 4.5) [ 7 Port 2 Not used [ 8 Port 3 Angle Alarm Setpoint adj. [ 9 Port 3 Pressure Alarm Setpoint ajd. [ 10 Port 3 Mud temp. signal [ 11 Port 3 Mud presc 4030 [ [ uMac 5000-4010-4030 assignments: [ [ Analog I/P Channel(s) Description [ 0,1 Port 1 X,Y Riser zero pots [ 2-3 Port 1 X,Y BOP zero pots [ 4-5 Port 2 Azimuth adjustment for BOP, Riser [ 6 Port 2 [ [ Electro-Flow Controls [ Final? [ Author D.J. Winningham [ Date May 1990 [ Language uMAC 5000 Basic [ Purpose Platform Indicators Intelligence [ Equipment uMac 5000; uMac 4050; uMa=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+PI [ 5100 RETURN [------------------------------------------------------------------------------ 6000 EXIT ELSE RAZ=PIH [ (Note RY=0 can't get 2PI) 5070 IF RX>=0 AND RY>=0 THEN 5080 | ELSE RAZ=RAZ+PI: | IF RX<0 AND RY>0 THEN RAZ=RAZ+PI [ 5080 IF BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>X1: | IF ABS(BY)<.0001 THEN BY=0 [ 5040 W=RX*BX + RY*BY + RZ*BZ: | IF W>0.99999999 THEN THETA=0 | ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | BANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | TXR: | RY=RZ * TYR: | X1=RX * CRA - RY*SRA 5025 RY=RX * SRA + RY*CRA: | RX=X1: | IF ABS(RY)<.0001 THEN RY=0 [ 5030 BZ=SQR(1/ (1+TXB*TXB+TYB*TYB)): | BX=BZ * TXB: | BY=BZ * TYB: | X1=BX * CBA - BY*SBA 5035 BY=BX * SBA + BY*CBA: | BX=N(14)-ANLGN(0)): | TYR=TAN(ANLGN(15)-ANLGN(1)): | TXB=TAN(ANLGN(12)-ANLGN(2)) 5010 TYB=TAN(ANLGN(13)-ANLGN(3)): | SRA=SIN(-ANLGN(5)):CRA=COS(-ANLGN(5)): | SBA=SIN(-ANLGN(4)):CBA=COS(-ANLGN(4)) 5020 RZ=SQR(1/ (1+TXR*TXR+TYR*TYR)): | RX=RZ * ser x,y zero; bop x,y zero; bop,riser azimuth all in radians [ ANLGN(12-15) BOP X,Y incl, Riser X,Y in radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [---------------------------------------------------------------------- 5000 TXR=TAN(ANLGBANG Azimuth [ ANG=ATN[ SQR(x^2 + y^2 )/z ] [ AZ =ATN[ x/y ] +x-y add pi -x-y add pi -x+y add 2pi [ unless |y|<.0001 in which case y=0 AZ=pi/2 (-x add pi) [--------------------------------------------------------------------- [ I/P: ANLGN(0-5) rier Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ y = x SIN(RA) + y COS(RA) (calc x',y' using BA) [ [ also return Polar co-ordinates: RANG=Riser Angle, RAZ=RANG Azimuth [ BANG=BOP Angle, BAZ=s. signal [ 12 Port 1 BOP X (channels 12-15 are 4010 ports) [ 13 Port 2 BOP Y [ 14 Port 3 Riser X [ 15 Port 4 Riser Y [ [ Analog O/P Channel(s) Description [ 0,1 not used [ 2 pressure display [ 3 temp. display [ 4 remote diff. angle display [ 5 remote riser azimuth display [ 6 local angle display (accd setting of MSS) [ 7 local azimuth display (accd setting of MSS) [ [ Digital I/P(s) Descrip------------- [ *** Convert riser,bop x,y zero values to radians *** [ --- We totally ignore if bit0 is hi... [ 1000 IF CALB% THEN RETURN [ [ --- BINGO! now we read only the particular adj selected accd css --- [ 1010 CSS%=DIN(0,1,2)+DIN(0,4,4)*400,1000,1000,1000,1000,1600,910,1800,1900, [ 10 11 12 13 14 15 | 2000,2100,2200,2200,2200,2200 [ 905 GOTO 2400 [----------------------------------------------------- [ *** Not used *** [ 910 RETURN [--------------------------------------------------------------------begin main loop--------------------------------- [ *** Get input data readings decoded *** [ 900 FOR I%=0 TO 15: | CALB%=DIN(0,0,0) [ 0 1 2 3 4 5 6 7 8 9 904 ON I%+1 GOSUB 1000,10OTO 520 [ 517 STENOP(1,I%)=STENOP(1,I%)*RAD: | STENOP(0,I%)=STENOP(0,I%)*RAD [ 520 NEXT [ 540 DATA 0.0, 2.0 , 0.0, 2.0 550 DATA 0.0,2000.0 , 0.0, 200.0 560 DATA 0.0, 20.0 , 0.0, 2000.0 570 DATA 0.0, 20.0 , 0.0, 2000.0 [----t 0 volts) [ last O/P unit (at 2 volts) [ [ Deg values area converted to radians... [ 500 OPVLT%=2 [ 510 FOR I%=0 TO 7: | READ STENOP(0,I%) [ 512 READ X1: | STENOP(1,I%)=OPVLT%/(X1-STENOP(0,I%)) [ 515 IF I%=2 OR I%=3 THEN GOP Riser (2V=20) [ 7 0 2000 Deg Azimuth:Riser BOP Riser (.36V=360) [ [ Calc: STENOP(0,ch)=Start Unit of measurement at 0 volts [ (1,ch)=Volts per Unit of measurement [ [ Read array double :Start O/P unit (aV=200) [ 4 0 20 Deg Angle (Diff: Theta) (2V=20) [ 5 0 2000 Deg Riser (Diff: Azimuth) (.36V=360) [ MSS: 0 1 2 [ 6 0 20 Deg Angle: Diff B *** Initialize Analogue O/P's *** [ [ STENOP [ ch# Range(0-2V) Description [ 0 Not used [ 1 Not used [ 2 0 2000 mpascl Pressure (2V=2000) [ 3 0 200 Deg Temperature (2 PIH=PI/2. [------------------------------------------------------------------------------ [ *** Setup Analog I/P *** [ 400 FOR I%=0 TO 15: | INTYPE (I%,5,.02): | NEXT [------------------------------------------------------------------------------ [------------------------------------------------------------------------ [ *** Set up Constants *** [ 100 REM--------- 200 REAL V,BANG,RANG,BAZ,RAZ,THETA,PI2,PIH [ 300 DIM ANLGN(15) 310 DIM STENOP(7,1) 320 PI=3.14159: | RAD=PI/180.: | PI2=PI+PI: | y X BOP " " " [ 3 0,1,1 Display Y " " " [ 4 1,0,0 Display/read BOP Azimuth Preset " [ 5 1,0,1 Display/read Riser Azimuth Preset [ 7 1,1,1 Display MSS *** normal setting **** (open switch) [----- Display angle between BOP & Riser Azimuth of Diff Angle [ [ bits: 4,2,1 (cal selector swtch must be pressed or we get 111) [ CSS:0 0,0,0 Display X Riser angle/read zero adj [ 1 0,0,1 Display Y " " " " [ 2 0,1,0 Displawitch (MSS) [ [ 7 6 Determines local angle/azimuth display [ MSS:0 0,0 Not used [ 1 0,1 Display vertical angle of Riser Azimuth of Riser angle [ 2 1,0 Display vertical angle of BOP Azimuth of BOP angle [ MSS:0 1,1tion (Port 0) [ 0 Zero set pushbutton [ 1,2,4 Bits 0, 1, 2 of CSS [ 3 Pressure alarm acknowledge [ 5 Angle alarm acknowledge [ 6-7 Bits 0,1 of Mode Select S: | IF CSS%>5 THEN RETURN [ 1020 V=AIN(CSS%): | ON CSS%+1 GOSUB 4300,4300,4300,4300,4400,4400 [ 1025 ANLGN(CSS%)=V: | RETURN [---------------------------------------------------------- [ *** Get reference 4.5 v signal (Direct read-- no offset or span) *** [ Measured volts * drift=correct voltage [ 1600 ANLGN(I%)=AIN(I%): | DRIFT=4.5/ANLGN(I%): | RETURN [----------------------------------------------------------- [ *** Get diff angle alarm setpoint adj (0-2V= 0-20 deg) *** [ 1800 to 4 volts (with wrap back to range <1 & >4 *** [ reads analog in (i%) [ output anlgn(i%) in radians 0 to 2pi [ 4400 V=(V-1.0)*120.0*RAD [ 4410 IF V>=PI2 THEN V=V-PI2: | GOTO 4450 [---ELSE--- 4415 IF V<0 THEN V=V+PI2 [ 4450 RETURN [--------3 4 5 (na) 7 [ --- range -20 to +20 deg at 1 to 5 volts --- [ I/P =V O/P=V [ output anlgn(i%) in radians [ 4300 V=(V-3) * 10.0*RAD: | RETURN [------------------------------------------------ [ --- range 0 to 360 deg at 1 [ [ *** LOOP forever *** [ 3900 GOTO 900 [***************************************************************** [ ************** ROUTINES ****************** [***************************************************************** [ 0 1 2 THEN ALRM%=ALRM% AND 0F5h OR 020h:DAHOT%=0: | GOTO 3820 [----ELSE--- 3815 ALRM%=ALRM% OR 5 AND (NOT (DAHOT%*32)) [ [ *** Set prhot,dahot accd din 5,3 *** [ 3820 PRHOT%=DIN(0,5,5):DAHOT%=DIN(0,3,3) [ [ *** Set the alarms *** [ 3830 DOT(1,0,7)=ALRM% Ah OR 010h:PRHOT%=0: | GOTO 3810 [---ELSE--- 3806 ALRM%=ALRM% OR 00Ah AND (NOT (PRHOT%*16)) [ [ diff angle cool=clear 1,3 and set 5=neuter hooter and set dahot%=0 [ diff angle high=set 1,3 and (clear 5 unless dahot%=1) [ 3810 IF THETA15 THEN RETURN [ [ *** On Riser Y we also do calc... *** [ 2210 GOSUB 5000: | RETURN [ 2400 NEXT [-------------------------------------------------------------- [ -----------DISPLAY LOOP-------------------- [ *** Get MSS status and Disp saved) *** [ ---Mud pressure display--- 2100 V=(AIN(I%)-1)*250:X%=2:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Get inclinometer stuff *** [ 2200 V=AIN(I%)*DRIFT: | GOSUB 4300: | ANLGN(I%)=V: | I-------- [ *** Mud temp signal (0-100 deg=1-5v) (not saved) *** [ ---Mud temp display--- 2000 V=(AIN(I%)-1)*25:X%=3:GOSUB 4500:RETURN [------------------------------------------------------------ [ *** Mud pressure signal (0-1000psi = 1-5v) (notANLGN(I%)=AIN(I%)*10*RAD: | RETURN [----------------------------------------------------------- [ *** Get pressure alarm setpoint adj (0-2v=0-2000kpa) *** [ 1900 ANLGN(I%)=AIN(I%)*1000: | RETURN [-------------------------------------------------------------------------------------------- [ *** Send V to Analog O/P X% (scaled and offset by stenop x%) *** [ 4500 AOT(X%)=(V-STENOP(0,X%))*STENOP(1,X%) : | RETURN [------------------------------------------------------------------------------ [ Calculate THETA--Angle between BOP and RISER [ [ Calc: THETA= ARCOS(x x' + y y' + z z') [ ----- where : ARCOS(W) is: -ATN(W/SQR(-W*W+1))+1.5708 [ unless W>0.99999999 in which case THETA=0 [ WHERE: x,y,z are unit vector endpoinIF BY<>0 THEN BAZ=ATN(BX/BY) | ELSE BAZ=PIH [ 5090 IF BX>=0 AND BY>=0 THEN RETURN | ELSE BAZ=BAZ+PI: | IF BX<0 AND BY>0 THEN BAZ=BAZ+PI [ 5100 RETURN [------------------------------------------------------------------------------ 6000 EXIT BANG=ATN(SQR(BX*BX+BY*BY)/RZ) [ 5060 IF RY<>0 THEN RAZ=ATN(RX/RY) | ELSE RAZ=PIH [ (Note RY=0 can't get 2PI) 5070 IF RX>=0 AND RY>=0 THEN 5080 | ELSE RAZ=RAZ+PI: | IF RX<0 AND RY>0 THEN RAZ=RAZ+PI [ 5080 BZ * TYB: | X1=BX * CBA - BY*SBA 5035 BY=BX * SBA + BY*CBA: | BX=X1: | IF ABS(BY)<.0001 THEN BY=0 [ 5040 W=RX*BX + RY*BY + RZ*BZ: | IF W>0.99999999 THEN THETA=0 | ELSE THETA=-ATN(W/SQR(-W*W+1))+PIH [ 5050 RANG=ATN(SQR(RX*RX+RY*RY)/RZ): | ):CBA=COS(-ANLGN(4)) 5020 RZ=SQR(1/ (1+TXR*TXR+TYR*TYR)): | RX=RZ * TXR: | RY=RZ * TYR: | X1=RX * CRA - RY*SRA 5025 RY=RX * SRA + RY*CRA: | RX=X1: | IF ABS(RY)<.0001 THEN RY=0 [ 5030 BZ=SQR(1/ (1+TXB*TXB+TYB*TYB)): | BX=BZ * TXB: | BY=----------------------------------------------------- 5000 TXR=TAN(ANLGN(14)-ANLGN(0)): | TYR=TAN(ANLGN(15)-ANLGN(1)): | TXB=TAN(ANLGN(12)-ANLGN(2)) 5010 TYB=TAN(ANLGN(13)-ANLGN(3)): | SRA=SIN(-ANLGN(5)):CRA=COS(-ANLGN(5)): | SBA=SIN(-ANLGN(4)-------------------------------------------------- [ I/P: ANLGN(0-5) riser x,y zero; bop x,y zero; bop,riser azimuth all in radians [ ANLGN(12-15) BOP X,Y incl, Riser X,Y in radians [ O/P: RANG,RAZ BANG,BAZ THETA all in radians [-----------------=RANG Azimuth [ BANG=BOP Angle, BAZ=BANG Azimuth [ ANG=ATN[ SQR(x^2 + y^2 )/z ] [ AZ =ATN[ x/y ] +x-y add pi -x-y add pi -x+y add 2pi [ unless |y|<.0001 in which case y=0 AZ=pi/2 (-x add pi) [------------------- (calc x',y',z' using XB,YB) [ [ x & y are (de)rotated by Riser Azimuth (RA), moving +Y to the NORTH [ x = x COS(RA) - y SIN(RA) [ y = x SIN(RA) + y COS(RA) (calc x',y' using BA) [ [ also return Polar co-ordinates: RANG=Riser Angle, RAZred from vertical (0=vert) in X and Y. [ XB,YB BOP angles measured from same Z but rotated X and Y. [ NOTE: If +Y is to the North, +X is to the East! [ [ z = SQR{ 1/ [ 1 + TAN(XR)^2 + TAN(YR)^2 ] } [ x = z * TAN(XR) [ y = z * TAN(YR) t co-ords for RISER [ x'y'z'are same for BOP [ ---------------------------------------------------------------- [ GIVEN:xr,yr,xb,yb are calc'ed: ANLGN(raw values)-ANLGN(zero values) [ all in radians. [ [ XR,YR Riser angles measu