Rig type 0 with additional features
Home
Up

Below GWbasic program shows rig type 0 version with various additional features that FS does not produce:

bulletAdded runway bumps that change in amplitude and frequency when ground speed increases
bulletAdded engine start-up and shut-down shudder
bulletImproved touch-down bump with left/right-wheel touchdown
bulletMix of engine RPM and speed is send to DAC4 for wind in your face and rudder force feedback feature

10 RWT1=60:RWT2=800:RWA1=2:RWA2=0.2  'sets runway bump frequency and amplitude
20 ENGSTA1=5:ENGSTT1=15
'sets engine start shudder amplitude and frequency
30 TDAMPL1=20:TDPERIOD=2.3:TDDECAY=1.4
'sets touch-down amplitude, frequency and decay
120 ON ERROR GOTO 870
130 CLOSE #1
140 OPEN "com1:4800,n,8" FOR RANDOM AS #1
150 A$=""
155 ON ERROR GOTO 150
160 LINE INPUT#1, A$
170 STBYTE$=mid$(A$,3,2)
180 PITCH$=mid$(A$,5,2)
190 ROLL$=mid$(A$,7,2)
200 HEAVE$=mid$(A$,9,2)
210 SPEED$=mid$(A$,11,2)
220 RPM$=mid$(A$,13,2)
250'
230 STBYTE=INSTR("123456789ABCDEF",right$(STBYTE$,1))+16*INSTR("123456789ABCDEF",left$(STBYTE$,1))
'extract status byte
240 PITCH=INSTR("123456789ABCDEF",right$(PITCH$,1))+16*INSTR("123456789ABCDEF",left$(PITCH$,1))
250 ROLL=INSTR("123456789ABCDEF",right$(ROLL$,1))+16*INSTR("123456789ABCDEF",left$(ROLL$,1))
260 HEAVE=INSTR("123456789ABCDEF",right$(HEAVE$,1))+16*INSTR("123456789ABCDEF",left$(HEAVE$,1))
270 SPEED=INSTR("123456789ABCDEF",right$(SPEED$,1))+16*INSTR("123456789ABCDEF",left$(SPEED$,1))
280 RPM=INSTR("123456789ABCDEF",right$(RPM$,1))+16*INSTR("123456789ABCDEF",left$(RPM$,1))
290'
300 DPITCH=128-PITCH:DROLL=128-ROLL:DHEAVE=128-HEAVE
390'
400 IF STBYTE AND 2 THEN WOG=1 ELSE WOG=0
'check wheels on ground bit
410 IF STBYTE AND 4 THEN STALL=1 ELSE STALL=0 
'check stall bit
420 IF STBYTE AND 8 THEN OVRSPD=1 ELSE OVRSPD=0
'check overspeed bit
430 IF STBYTE AND 16 THEN SPOIL=1 ELSE SPOIL=0 
'check spoiler bit
440 IF STBYTE AND 32 THEN BRAKE=1 ELSE BRAKE=0 
'check brake bit
450 IF STBYTE AND 64 THEN GEAR=1 ELSE GEAR=0 
'check gear down bit
460 IF STBYTE AND 128 THEN FLAP=1 ELSE FLAP=0 
'check flaps down bit
490'
500 IF SPEED>0 THEN IF WOG=1 THEN GOSUB 1000 ELSE IF RWBUMP>1 THEN GOSUB 1100 
'trigger/end runway bump routine
510 IF RPM>3 THEN IF RPM<20 THEN GOSUB 1200 ELSE ENGSTCOUNT=-1:ENGSTVIB=0
'trigger/end engine shudder routine
530 IF (WOG=0) AND (TDAMPL<>TDAMPL1) THEN TDAMPL=TDAMPL1:TDCOUNT=-1:IF ROLL>128 THEN ROLLPOL=-1 ELSE IF ROLL<124 THEN ROLLPOL=1 ELSE ROLPOLL=0 
'set roll polarity bit for touch-down routine
540 IF (WOG=1) AND (TDAMPL>0.5) THEN GOSUB 1300 ELSE TDBUMP=0:TDBUMPL=0:TDBUMPR=0:TDCOUNT=0
590
'trigger/end touchdown bump routine
600 DAC1=128+DPITCH+DHEAVE+CINT(RWBUMP)-CINT(TDBUMP) 
'combine all elements
610 DAC2=128-DPITCH+DHEAVE-DROLL+CINT(RWBUMP)-CINT(ENGSTVIB)-CINT(TDBUMP)-CINT(TDBUMPR)
'combine all elements
620 DAC3=128-DPITCH+DHEAVE+DROLL+CINT(RWBUMP)+CINT(ENGSTVIB)-CINT(TDBUMP)-CINT(TDBUMPL)
'combine all elements
630 DAC4=CINT((0.6*SPEED+0.4*RPM)*1.1)
'DAC 4 is mix of speed and engine RPM
640 PRINT PITCH;" "ROLL;" "HEAVE;" "SPEED;" "RPM;" "DAC1;" "DAC2;" "DAC3;" "DAC4
700 IF DAC1>255 or DAC1<0 then goto 740
710 Out 888,DAC1
720 Out 890,10
730 out 890,11
740 IF DAC2>255 or DAC2<0 then goto 780
750 Out 888,DAC2
760 Out 890,3
770 out 890,11
780 IF DAC3>255 or DAC3<0 then goto 820
790 Out 888,DAC3
800 Out 890,15
810 out 890,11
820 IF DAC4>255 or DAC4<0 then goto 860
830 Out 888,DAC4
840 Out 890,9
850 out 890,11
860 GOTO 150
870 RESUME 120
1000 RWCOUNT=RWCOUNT+1
1010 RWBUMP=RWA1*SIN(6.28*SPEED*RWCOUNT/RWT1)+RWA2*SPEED*SIN(6.28*SPEED*RWCOUNT/RWT2) 
'create runway bump sinewaves
1020 IF BRAKE=1 THEN RWBUMP=RWBUMP*1.2 
'increase runway bumps when braking
1030 RETURN
1100 RWCOUNT=-1
1110 RWBUMP=RWBUMP/1.05
1120 RETURN
1200 ENGSTCOUNT=ENGSTCOUNT+1
1210 ENGSTVIB=ENGSTA1*SIN(6.28*RPM*ENGSTCOUNT/ENGSTT1)
 'create engine start/stop shudder sinewave
1220 IF SPEED>20 THEN ENGSTVIB=ENGSTVIB/2
1230 RETURN
1300 TDCOUNT=TDCOUNT+1
1310 TDBUMP=TDAMPL*SIN(6.28*TDCOUNT/TDPERIOD)
'create touchdown bump decaying sinewave
1320 IF ROLLPOL=-1 THEN TDBUMPR=TDBUMP
'create rightwheel touchdown bump
1330 IF ROLLPOL=1 THEN TDBUMPL=TDBUMP
'create leftwheel touchdown bump
1340 TDAMPL=TDAMPL/TDDECAY
1350 RETURN

 

 

 

Back