# Train.dat and Deceleration Rates

## Train.dat and Deceleration Rates

I see that there is a Deceleration rate in the train.dat file.. how would we calculate the deceleration rate of the individual service brake settings? I guess it would depend on your speed too.

**waterburn**- Posts : 55

Join date : 2012-06-29

## Re: Train.dat and Deceleration Rates

I believe you'll find this is the deceleration at the maximum service brake notch.

The deceleration for other brake notches should be proportional to this, e.g.

Set a deceleration of 20km/h per second on a train with 10 brake notches:

Using the partial air brake, it should work as a percentage based upon the brake pipe pressure.

Be aware, that this is effected by the brake type defined in the #Brake section, as follows:

The deceleration rate is the train's maximum acceleration (The documentation isn't clear on this, but I presume this is at the current speed, would have to check the code) *plus* the deceleration rate stated above.

If the speed is below that set by BrakeControlSpeed, use the value calculated above, otherwise, use this figure:

First, this sum is performed:

Otherwise, the Deceleration calculated above is added to this figure.

To use the figure calculated solely, you want a #Brake section that looks like this (Unless you plan a train that goes faster than 999km/h....):

Disclaimer:

I haven't tried this or thought about it before now, but it's based upon a reasonable understanding of the workings of the sim, and seems reasonably logical to me

None of the trains I've had a brief look at seem to follow this pattern, and a lot of the documentation I can find suggests just fudging the deceleration figure until you get one that's right.

The original BVE train.dat was built to simulate a standard Japanese EMU, with engine braking in addition to the train brakes, and OpenBVE never got as far as implementing a newer format, and so I'm afraid that anything other than this is somewhat of a fudge....

Cheers

Chris Lees

http://www.bvecornwall.co.uk

The deceleration for other brake notches should be proportional to this, e.g.

Set a deceleration of 20km/h per second on a train with 10 brake notches:

- Code:
`#Deceleration`

20

0.35

0

0.0025

1.1

Using the partial air brake, it should work as a percentage based upon the brake pipe pressure.

Be aware, that this is effected by the brake type defined in the #Brake section, as follows:

**Brake Control System set to 0:**The deceleration rate is the train's maximum acceleration (The documentation isn't clear on this, but I presume this is at the current speed, would have to check the code) *plus* the deceleration rate stated above.

**Brake Control System set to 1:**If the speed is below that set by BrakeControlSpeed, use the value calculated above, otherwise, use this figure:

- Code:
`0.5 * (MaximumAcceleration + Deceleration calculated above)`

**Brake Control System set to 2:**First, this sum is performed:

- Code:
`0.5 * (MaximumAcceleration + Deceleration calculated above)`

Otherwise, the Deceleration calculated above is added to this figure.

To use the figure calculated solely, you want a #Brake section that looks like this (Unless you plan a train that goes faster than 999km/h....):

- Code:
`#Brake`

0

1

999

Disclaimer:

I haven't tried this or thought about it before now, but it's based upon a reasonable understanding of the workings of the sim, and seems reasonably logical to me

None of the trains I've had a brief look at seem to follow this pattern, and a lot of the documentation I can find suggests just fudging the deceleration figure until you get one that's right.

The original BVE train.dat was built to simulate a standard Japanese EMU, with engine braking in addition to the train brakes, and OpenBVE never got as far as implementing a newer format, and so I'm afraid that anything other than this is somewhat of a fudge....

Cheers

Chris Lees

http://www.bvecornwall.co.uk

## Re: Train.dat and Deceleration Rates

#PERFORMANCE

8.8 ; Deceleration

#BRAKE

1 ; BrakeType

1 ; BrakeControlSystem

1 ; BrakeControlSpeed

For B3 it would be 8.8/5*3 (5 brake settings not incl. emergency)=5.28

And for a speed above 1 km/h it would 0.5*(8.8+5.28) - the deceleration seems greater than what I get in the simulator using F10. The speed I am entering the station is 72 km/h

8.8 ; Deceleration

#BRAKE

1 ; BrakeType

1 ; BrakeControlSystem

1 ; BrakeControlSpeed

For B3 it would be 8.8/5*3 (5 brake settings not incl. emergency)=5.28

And for a speed above 1 km/h it would 0.5*(8.8+5.28) - the deceleration seems greater than what I get in the simulator using F10. The speed I am entering the station is 72 km/h

**waterburn**- Posts : 55

Join date : 2012-06-29

## Re: Train.dat and Deceleration Rates

You're confusing acceleration with deceleration in your calculations, which is why I think your speed is off.

The MaximumAcceleration figure is the train's maximum acceleration under power (As calculated in the

With your current

Your calculation should therefore look like this for B3:

(8.8 / 5) * 3 = 5.28km/h per second

0.5 * (MaximumAcceleration + ((8.8 / 5) * 3))

I haven't got the maximum acceleration for your train.dat, so let's take an example #Acceleration section (OpenBVE format exponents, although the result should be broadly similar):

Please refer to the documentation for the exact formula (The board doesn't like exponent symbols...), but this gives us a maximum acceleration figure of:

This will decrease/ increase in line with the acceleration curve for your final power notch.

Post the #Acceleration section of your train.dat if you're not sure, and I can work out the exact figure.

Same disclaimer as above applies:

Haven't personally tested this, but it's a logical working through based upon the documentation and a good understanding of how the sim works.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

The MaximumAcceleration figure is the train's maximum acceleration under power (As calculated in the

**#Acceleration**section), *not* the maximum deceleration figure.With your current

**#Brake**section, the sim is taking into account engine braking.__Worked Example:__Your calculation should therefore look like this for B3:

**Below 1km/h**(8.8 / 5) * 3 = 5.28km/h per second

**Above 1km/h**0.5 * (MaximumAcceleration + ((8.8 / 5) * 3))

I haven't got the maximum acceleration for your train.dat, so let's take an example #Acceleration section (OpenBVE format exponents, although the result should be broadly similar):

- Code:
`#ACCELERATION`

0.9,0.8,30,30,0.99

1.2,1,40,40,0.99

1.5,1.2,50,50,0.99

1.8,1.5,60,60,0.99

2.2,1.8,70,70,0.99

2.5,2.1,80,80,0.99

Please refer to the documentation for the exact formula (The board doesn't like exponent symbols...), but this gives us a maximum acceleration figure of:

- Code:
`2.330876215941685`

- Code:
`0.5 * (2.330876215941685 + 5.28)`

This will decrease/ increase in line with the acceleration curve for your final power notch.

Post the #Acceleration section of your train.dat if you're not sure, and I can work out the exact figure.

Same disclaimer as above applies:

Haven't personally tested this, but it's a logical working through based upon the documentation and a good understanding of how the sim works.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

## Re: Train.dat and Deceleration Rates

Hey Chris thanks for your explanation. Here is the #Acceleration section

- Code:
`#ACCELERATION`

1.6,1.4,13,18,3.3

2.2,2,20,30,3.6834

3.3,3,24,40,2.6

**waterburn**- Posts : 55

Join date : 2012-06-29

## Re: Train.dat and Deceleration Rates

Right, so I make your maximum acceleration at 72km/h figure this (I've assumed that your train.dat is in #BVE2000 or #OPENBVE format):

Your final figure in the sim will differ slightly, as this is the pure calculation, without static friction or air resistance applied and assumes that the brakes are at 100% efficiency at 72km/h.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

- Code:
`0.3904487095765743`

- Code:
`0.5 * (0.3904487095765743 + 5.28)`

- Code:
`2.835224354788287`

Your final figure in the sim will differ slightly, as this is the pure calculation, without static friction or air resistance applied and assumes that the brakes are at 100% efficiency at 72km/h.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

## Re: Train.dat and Deceleration Rates

Is there a way to account for air resistance? I am trying to place brake markers. Or is there an easier way?

**waterburn**- Posts : 55

Join date : 2012-06-29

## Re: Train.dat and Deceleration Rates

Haven't forgotten this

I make this your stopping distance at 72km/h from a purely mathematical point of view:

I'd expect the wind resistance/ static friction to make this off by approx a meter or two.

Workings:

Take the basic equation of motion-

u = initial velocity

a = acceleration

d = distance

Rearrange to solve this for d:

That figure is mathematically correct, but having tested, OpenBVE is doing something funky with the deceleration rates- Your train.dat is giving me a deceleration figure bouncing between 0.7m/s and about 1.5m/s

I think that using a figure of about 1.1 (Fiddle around until you get something you're happy with, but driver reactions will differ so go high) in the equation above:

I'm in the process of working through exactly what's going on in the code, but frankly it's an under-documented mess in there

Cheers

Chris Lees

http://www.bvecornwall.co.uk

I make this your stopping distance at 72km/h from a purely mathematical point of view:

- Code:
`70.54115476337127`

I'd expect the wind resistance/ static friction to make this off by approx a meter or two.

Workings:

Take the basic equation of motion-

- Code:
`v² = u² + 2a * d`

u = initial velocity

a = acceleration

d = distance

Rearrange to solve this for d:

- Code:
`d = -u² / 2a`

- Code:
`Distance = 20² / 2 * (-2.835224354788287)`

That figure is mathematically correct, but having tested, OpenBVE is doing something funky with the deceleration rates- Your train.dat is giving me a deceleration figure bouncing between 0.7m/s and about 1.5m/s

I think that using a figure of about 1.1 (Fiddle around until you get something you're happy with, but driver reactions will differ so go high) in the equation above:

- Code:
`Distance = 20² / 2 * (-1.1)`

I'm in the process of working through exactly what's going on in the code, but frankly it's an under-documented mess in there

Cheers

Chris Lees

http://www.bvecornwall.co.uk

## Re: Train.dat and Deceleration Rates

Sorry, I know where I went wrong....

One of the biggest issues with OpenBVE is that there are a nasty mix of units all over the place, and forgetting to convert once will throw everything off...

Our deceleration figure above is in km/h per second.

Remembering to look closely (lol), you'll note that OpenBVE provides deceleration figures in meters per second, and this is also what the equation works in!

Thus, we need to multiply our deceleration figure by 0.277777778 before trying to use or compare it.

This gives us a this figure for deceleration in meters per second:

Let's try again with the calculation:

This is on level track; I can go digging for how gradient effects things if you really want.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

One of the biggest issues with OpenBVE is that there are a nasty mix of units all over the place, and forgetting to convert once will throw everything off...

**Revised:**Our deceleration figure above is in km/h per second.

Remembering to look closely (lol), you'll note that OpenBVE provides deceleration figures in meters per second, and this is also what the equation works in!

Thus, we need to multiply our deceleration figure by 0.277777778 before trying to use or compare it.

This gives us a this figure for deceleration in meters per second:

- Code:
`0.787562321404574`

Let's try again with the calculation:

- Code:
`Distance = 20² / 2 * (-0.787562321404574)`

- Code:
`-253.948156944978`

This is on level track; I can go digging for how gradient effects things if you really want.

Cheers

Chris Lees

http://www.bvecornwall.co.uk

Page

**1**of**1****Permissions in this forum:**

**cannot**reply to topics in this forum