-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTRAJECT.PAS
More file actions
105 lines (100 loc) · 2.8 KB
/
TRAJECT.PAS
File metadata and controls
105 lines (100 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{ @author: Sylvain Maltais (support@gladir.com)
@created: 2025
@website(https://www.gladir.com/avionix)
@abstract(Target: Turbo Pascal, Free Pascal)
}
Program TRAJECT;
Uses Crt;
Var
x,y,vx,vy,t,dt:Real;
i,n:Integer;
Err:Word;
BEGIN
{$IFDEF FPC}
{$IFDEF WINDOWS}
SetUseACP(False);
{$ENDIF}
{$ENDIF}
If(ParamStr(1)='/?')or(ParamStr(1)='--help')or(ParamStr(1)='-h')or
(ParamStr(1)='/h')or(ParamStr(1)='/H')Then Begin
WriteLn('TRAJECT : Cette commande permet d''effectuer la simulation de la ',
'trajectoire d''un avion.');
WriteLn;
WriteLn('Syntaxe : TRAJECT [x y vx vy t dt]');
WriteLn;
WriteLn(' x Ce paramŠtre permet d''indiquer la position initiale x (m)');
WriteLn(' y Ce paramŠtre permet d''indiquer la position initiale y (m)');
WriteLn(' vx Ce paramŠtre permet d''indiquer la vitesse en X (m/s)');
WriteLn(' vy Ce paramŠtre permet d''indiquer la vitesse en Y (m/s)');
WriteLn(' t Ce paramŠtre permet d''indiquer la dur‚e totale de simulation');
WriteLn(' dt Ce paramŠtre permet d''indiquer l''intervalle de temps (s)');
End
Else
If ParamCount>0 Then Begin
Val(ParamStr(1),x,Err);
If Err>0 Then Begin
WriteLn('La position initiale x n''est pas valide');
Halt(1);
End;
Val(ParamStr(2),y,Err);
If Err>0 Then Begin
WriteLn('La position initiale y n''est pas valide');
Halt(1);
End;
Val(ParamStr(3),vx,Err);
If Err>0 Then Begin
WriteLn('La vitesse en X n''est pas valide');
Halt(1);
End;
Val(ParamStr(4),vy,Err);
If Err>0 Then Begin
WriteLn('La vitesse en Y n''est pas valide');
Halt(1);
End;
Val(ParamStr(5),t,Err);
If Err>0 Then Begin
WriteLn('La dur‚e totale de simulation n''est pas valide');
Halt(1);
End;
Val(ParamStr(6),dt,Err);
If Err>0 Then Begin
WriteLn('L''intervalle de temps n''est pas valide');
Halt(1);
End;
n:=Round(t/dt);
Writeln('Temps (s) Position X (m) Position Y (m)');
Writeln('-------------------------------------------');
For i:=0 to n do Begin
WriteLn(i*dt:5:1, ' ', x:8:2, ' ', y:8:2);
x:=x+vx*dt;
y:=y+vy*dt;
End;
End
Else
Begin
ClrScr;
WriteLn('Simulation de la trajectoire d''un avion');
WriteLn('--------------------------------------');
Write('Position initiale X (m) : ');
ReadLn(x);
Write('Position initiale Y (m) : ');
ReadLn(y);
Write('Vitesse en X (m/s) : ');
ReadLn(vx);
Write('Vitesse en Y (m/s) : ');
ReadLn(vy);
Write('Dur‚e totale de simulation (s) : ');
ReadLn(t);
Write('Intervalle de temps (s) : ');
ReadLn(dt);
n:=Round(t/dt);
Writeln('Temps (s) Position X (m) Position Y (m)');
Writeln('-------------------------------------------');
For i:=0 to n do Begin
WriteLn(i*dt:5:1, ' ', x:8:2, ' ', y:8:2);
x:=x+vx*dt;
y:=y+vy*dt;
End;
ReadLn;
End;
END.