Page 15 - DCAP601_SIMULATION_AND_MODELING
P. 15
Unit 1: Introduction to System Simulation
Our purpose is to compute the positions of the pursuer, namely, XF(t), YF(t) for t = 1,2, ... , 12, or Notes
until the fighter catches up with the bomber.
Suppose we will assume that once the fighter is within IO kms of the bomber, the fighter shoots
down its target by firing a missile, and the pursuit is over. If case the target is not caught up
within 12 minutes, the pursuit is abandoned, and the target is considered escaped. From the time
t = 0 till the target is shot down, the attack course is determined as follows:
The fighter uses the following simple strategy: It looks at the target at instant t, aligns its
velocity vector with the line of sight means points itself toward the target. It continues to fly in
that direction for one minute, till instant (t + 1). At time (t + 1) it looks at the target again and
realigns itself.
The distance DIST (t) at a given time t between the bomber and the fighter is given by
DIST (t) = (YB(t) YF(t)) 2 (XB)(t) XF(t)) 2 ...(1)
The angle of the line from the figher to the target at a given time t is given by
YB(t) YF(t)
sinθ ...(2)
DIST(t)
XB(t) XF(t)
cos θ ...(3)
DIST(t)
Using this value of the position of the fighter at time (t + 1) is determined by
XF(t + 1) = XF(t) + VF cos ...(4)
YF(t + 1) = YF(t) + VF sin ...(5)
With these new coordinates of the pursuer, its distance from the target is again computed using
Eq. (1). If this distance is 10 kms. or less the pursuit is over, otherwise q is recomputed, and the
process continues.
A flowchart of the logic of this program is given below:
The following FORTRAN program (a format-free version) will implement the flowchart.
DIMENSION XB (25), YB (25), XF (25), YF (25)
INTEGER T, J
READ, (XB (T), YB (T), T = 1,13)
READ, XF (I), YF (I), VF
T=1
100 DIST = SQRT ((YB (T) - YF (T)) **2 + (XB (T) - XF (T)** 2)
IF (DIST. LE. 10.0) GO TO 110
IF (T.GT.12) GO TO 120
XF (T + I) = XF(T) + VF* (XB(T) – XF (T))/DIST
YF (T + 1) = YF(T) + YF* (YB (T) – YF (T))/DIST
T = T+l
GO TO 100
110 PRINT 990, T, DlST
990 FORMAT (10X, 10H CAUGHT AT, 13, 8H MTS AND, F10.3, 4H KMS)
STOP
120 PRINT 1000
LOVELY PROFESSIONAL UNIVERSITY 9