# Average speed

## Recommended Posts

Hi All

XML in FSX

Is there any vars. that can help to get average speed for a non direct course to a waypoint with changing speeds. It's easy to get if you use constant speed and direct course but maybe can't be done with XML.

Thanks

Paul EGLD

##### Share on other sites

If you need this info before the flight I assume you have the flight plan data available (leg distances and speeds) and you can use a formula to get the average speed?  If only needed after the flight keep track of the overall distance and time and divide.

##### Share on other sites

Hi Tom

Yes that would work OK but I am trying to get the average updated during the flight without keeping to a flightplan.

I thought of doing it by taking lat/long positions at minute intervals and get distance & ET from that but not sure of the maths required to get overall realtime average accurate.

Paul EGLD

##### Share on other sites

Ok... first... I have to state that unless the course leads to the waypoint... you can't arrive at the waypoint and thus time to the waypoint would always be infinite.

So... not certain you're saying what you actually mean.

Ed Wilson

Mindstar Aviation
My Playland - I69

##### Share on other sites

Hi Ed

OK I haven't described it correctly.

This for FMC flight log page giving various info. like T/O time, current enroute time, fuel used etc.

It also gives current avg. TAS & GS.  and  AIR DIST / GRD DIST traveled from departure point. These are values I am trying to get.

Thanks

Paul EGLD

##### Share on other sites

Ah... those averages have nothing to do with waypoints.

Essentially while in flight the FMC is sampling the TAS and GS and computing the aircraft's average TAS and GS.

The way most avionics systems do this is that they have a definition of start of flight. Once it sees that, it starts to track TAS and GS and calculate the aircraft's average.

As for air distance and ground distance... that too is linked to the definition of start of flight.

Ed Wilson

Mindstar Aviation
My Playland - I69

##### Share on other sites

That all strait forward but do you know how it calculates the aircrafts averages?

Paul EGLD

##### Share on other sites

Uh... you know how to find the average of a set of values?

Ed Wilson

Mindstar Aviation
My Playland - I69

##### Share on other sites

Yes

how does the the RW FMS get the basic over the ground distance information?

Paul EGLD

##### Share on other sites

All FMS systems get positional information... from a GPS, an INS... something that knows where the aircraft is. Many also utilize a triangulation method involving multiple navaids.

To be crystal clear... averaging speeds is completely separate from calculating distances of air vs ground. Are you wanting me to give you formula for calculating the distance values?

Ed Wilson

Mindstar Aviation
My Playland - I69

Paul EGLD

##### Share on other sites

In short, you need to track the following values:

1 - Average TAS.

2 - Average GS.

3 - Average TAS for current waypoint.

4 - Average GS for current waypoint.

5 - Ground distance.

6 - Air distance.

7 - Ground distance for current waypoint.

8 - Air distance for current waypoint.

For Average TAS and Average GS simply do the following once per second:

```avg_tas_total = avg_tas_total + tas.
avg_tas_count = avg_tas_count + 1.
avg_gs_total = avg_gs_total + gs.
avg_gs_count = avg_gs_count + 1.
avg_gs_waypoint = avg_gs_waypoint + gs.
avg_gs_waypoint_count = avg_gs_waypoint_count + 1.
avg_tas_waypoint = avg_tas_waypoint + tas.
avg_tas_waypoint_count = avg_tas_waypoint_count + 1.
```
With those values you can figure everything else out.

```1 - Check to see if waypoint has sequenced.
If so, then reset the following:
a. distance_ground = distance_ground + distance_ground_waypoint.
b. distance_air = distance_air + distance_air_waypoint.
c. average_gs_waypoint_count = 1.
d. average_tas_waypoint_count = 1.
e. average_gs_waypoint = gs.
f. average_tas_waypoint = tas.
2 - Calculate great circle distance from prior waypoint to aircraft current position.
3 - Store in distance_ground_waypoint.
4 - Calculate average_gs = average_gs_waypoint / average_gs_waypoint_count.
5 - Calculate average_tas = average_tas_waypoint / average_tas_waypoint_count.
6 - distance_air_waypoint = distance_ground_waypoint * (average_tas / average_gs).
7 - Calculate overall_average_gs = average_gs_total / average_gs_count.
8 - Calculate overall_average_tas = average_tas_total / average_tas_count.
```

Ed Wilson

Mindstar Aviation
My Playland - I69

Thanks Ed

Paul EGLD

## Create an account

Register a new account