4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Computer/Wind/Computer.hpp"
25 #include "Computer/CirclingComputer.hpp"
26 #include "Computer/Settings.hpp"
27 #include "Formatter/TimeFormatter.hpp"
28 #include "OS/Args.hpp"
29 #include "DebugReplay.hpp"
33 int main(int argc
, char **argv
)
35 Args
args(argc
, argv
, "DRIVER FILE");
36 DebugReplay
*replay
= CreateDebugReplay(args
);
42 printf("# time wind_bearing (deg) wind_speed (m/s)\n");
44 GlidePolar
glide_polar(fixed(0));
46 CirclingSettings circling_settings
;
48 WindSettings wind_settings
;
49 wind_settings
.SetDefaults();
51 CirclingComputer circling_computer
;
52 circling_computer
.Reset();
54 WindComputer wind_computer
;
55 wind_computer
.Reset();
60 while (replay
->Next()) {
61 const MoreData
&basic
= replay
->Basic();
62 const DerivedInfo
&calculated
= replay
->Calculated();
64 circling_computer
.TurnRate(replay
->SetCalculated(),
65 basic
, calculated
.flight
);
66 circling_computer
.Turning(replay
->SetCalculated(),
71 wind_computer
.Compute(wind_settings
, glide_polar
, basic
,
72 replay
->SetCalculated());
74 if (calculated
.estimated_wind_available
.Modified(last
)) {
75 TCHAR time_buffer
[32];
76 FormatTime(time_buffer
, replay
->Basic().time
);
78 _tprintf(_T("%s %d %g\n"),
79 time_buffer
, (int)calculated
.estimated_wind
.bearing
.Degrees(),
80 (double)calculated
.estimated_wind
.norm
);
83 last
= calculated
.estimated_wind_available
;