So, you want to build a train for BVE4?

Okay, up until now we've mostly only considered the visual aspects of the train, and by now you should have a more or less complete set of images in your Train\<mytrain>\d3d directory (unelss you called it something else!).   We're now moving on to the physics.  There are several aspects which affect the way the train drives in BVE4, and all of these are dealt with a in a file called train.dat which lives in the train's directory.

Mackoy produced a train.dat editor which has been translated into English and which is available from TSC, along with some other useful bits and pieces.  I recommend you donwload it - it's not the best tool for all things but it is useful for acceleration and motor sounds, of which more later.  There's also a guide to the train.dat files, available from here which you can also download for reference although it does have various errors in it.

To make a good, prototypical train for BVE4 requires accurate data about the real thing.  The problems start when you look at the data you have to put into the train.dat file, and compare that with the data you can actually get.  For example, you can quite often find figures for maximuim tractive effort, esepcially for a loco.  However, you don't want that in the train.dat, you want acceleration in the rather unusual units Km/h/s.  So, you need to get your calculator out, and dust off those school science books.

This is made worse by the fact that BVE is really made to simulate EMUs.  As you've probably realised by now, in BVE, each train has its own directory, so for example the class 56 with loaded HAAs is distinct from the class 56 empty, or light engine.  The actual differences are all in the train.dat file, but to simluate a different consist, you need a "different" train, although all the graphics and so on are the same.

What this means is that you need to consider the exact train you're creating.  If it's a loco, what's it hauling?  If it's a DMU, is it a 2 car, 3 car, 7 car made form a 3 and a 4, and so on.  You then need some data about the weight and dimensions of the cars (and the loco, if it's a loco) and then you can start the calculating...

I'll run through an example that I did recently for the class 66 loco, hauling 22 empty HTA coal wagons, which was for a diagram on the excellent ECML: Northumberland route.  You can see the beginning of the train.dat file below, make sure that the first line reads BVE2000000 for a BVE4 train:
sample train.dat

First, you want the train weight.  In this case, we have:
Class 66 loco:  130T
HTA wagon, empty:  27T
So, the total train weight is 130+(27x22) = 724T.

The figures for maximuim Tractive Effort (T.E.) for the class 66 are:
Starting T.E.:  409kN
continuous T.E.  260kN, at 26Km/h

Now, the formula for acceleration, a, in terms of mass m and applied force F is a=F/m.

Using the values above, initial acceleration is 0.56 m/s²,  and acceleration at 26Km/h is 0.36 m/s².  However, BVE wants the figures in Km/h/s, which means you need to multiply by 3.6, giving you figures of 2.01 and 1.31 to put into the train editor.  Note that these are maximum figures, so they apply to the highest notch of the power lever, in the case of the class 66 that's notch 8.  The other thing to note about the class 66 is that it's limited to 75 mph.  The loco, on maximum power and on the level, would go quite a bit faster than that with an unladen train.  The limiter is one thing that isn't in the train.dat, it's a function of the plugin file and that will be discussed later.

Okay, so now it's time to get that train editor out, and this is what it looks like; in this case, I have the class 66 example I'm using loaded:
train editor 1

As you can see, quite a few things to look at. 

Firstly, at the top left, you can see "rate" and "adhesion" - In the train.dat file, these are in a section headed #PERFORMANCE.  Now, Adhesion is in fact a common railway term but in some way the units don't seem to add up if you study real-life figures.  The train.dat guide suggests that 0.9 is fantastic grip and 0.1 is very little grip.  Generally, using too low a figure will mean a lot of wheelslip.  BVE has no simulation for a sander (which real trains tend to have for slippery conditions) so you need to err a bit on the high side.  "Rate" is for braking and we'll come back to that.

Under that, on the left, is "Delay" (#DELAY in train.dat).  These figures, in seconds, are the delay between operating the contorl and something happening.  Generally, controls are not instant.  The first two are for power:  delay between moving the lever and power being applied, and between moving the lever and the power being reduced.  The next two are for Electric brake, application and release, and the last 2 are for application of service brakes and emergency brakes.

R.O.C. in the train.dat is in the #MOVE section in train.dat, and these figures are described as follows in Shaun Myers' guide:

120     = The amount the train sways when accelerating.
120     = The amount the train sways when travelling but not accelerating.
3000   = The amount the train sways when the electric brake is applied.
3000   = The amount the train sways when the electric brake are released.
300     = The amount the train sways when the service brake is applied.
300     = The amount the train sways when the emergency brake is applied.

This really doesn't mean a lot, and that's mostly because it's probably a mistranslation.  The following interpretation is from Steve "Trainsim" of TSC:

When we translated the Train Editor we worked out it was rate of change of power build up/shut down and from brake release to apply and vice versa. (Hence R.O.C in the editor).

The lower the figure - the slower the reaction.

Traction+ is the time taken for power to build up after moving power handle.
Traction- the time taken for power to drop a notch or to go to idle.
ElBrk+ time taken for brake pressure to go from release to full (IIRC any brake except straight air)
ElBrk- time taken for brake pressure to go from fully applied to full release.
BPr+ )Same as above for straight air perhaps?
BPr- )

Which makes some more sense; they combine with the "delay" figures - so when you go from Neutral to full power, firstly there's a delay defined in #DELAY for the power controller, and then the power builds from zero to maximum as defined by the Trctn+ parameter in ROC.  In the same way, ElBrk+ defines how long it takes the brakes to build brake force.

Don't (yet) know what the units are, but they would appear to be reciprocal time, since a smaller number makes a slower reaction.  Have a look at what other people have used.  Puttgin silly-big numbers like 1000 doesn't make it react a lot faster, so I guess it's non-linear - if it were linear, 1000 would make the train hit full power almost instantly!

Next, you have brake type.  "straight air", as used on the class 66, is not what is commonly understood, in the UK at least, as "straight air", since it applies the train brakes as well.  It's a non-self lapping brake, and has only 3 positions, bascially, these are increase pressure, lap (hold pressure) and reduce pressure.  This kind of brake is uncommon on passenger trains now.  The other 2 kinds of braking in BVE are "electro-pneumatic, sefl lapping" and "electronically controlled pneumatic, self-lapping".  Frankly, they both look the same, you have a brake control with different positions.  In addition, there's the option of turning on regenerative or rheostatic braking.  Both of these apply electric retardation to the train at higher speeds, and there's a control speed where the electic braking is switched off as it ceases to be effective.  The difference between these two is explained in the guide:

Regenerative/Rheostatic brake:
0        = Off
1        = Rheostatic, uses electric braking until control speed is reached then activates the service brake automatically,
2        = Regenerative, uses electric and service brakes until control speed is reached then uses service brake only.

although I can't help thinking that in terms of meaning, they look the wrong way round.  Regenerating means that you're feeding power back into the electric lines (as the class 390 pendolino does), and applies really only to electric trains, and I wouldn't have though you'd want service brakes as well.

After brake type, you have "Pres", #PRESSURE in the train.dat file, these are fairly self-explanatory: maximum normal brake pressure, maximum emergency pressure, minimum and maximum reservoir pressures.  The last 2 are used for switching on and off the conmpressor sounds.

Next over is a panel called "Safe", which in the train.dat is #DEVICE.  Basically, for a UK train, you want it as the example: ATS-P and ATC off, EB is the vigilance or deadman device.  Not sure if Brake hold by itself does anything, but enable that and speed hold and the first of your brake steps becomes "HB" which keeps the train at the current speed when going downhill.  Re-adh is traction control, set it to the appropriate kind, (DMU, EMU, Loco - light is for such things as tramcars), and error pass alarm should be "none".  Load compensation is supposed to vary the brake pressure depending on train load - however, it probably only works on passenger trains as it seesm to interact with the value for train load in the .sta command in the route.

The controls section is better edited in a text editor in train.dat, in my opinion - train editor tends to mess it up.  You should also check that it's right after using TrEditor.  The sections are self-explanatory, the section in train.dat is called #HANDLE and has 4 values:  Note there's something about you can only vary the "handles" part if you've got regen braking set - hence why it's greyed out in the example above.  However, it's easy to edit in a text editor.

0 = Control type.
8 = Number of power steps.
6 = Number of brake steps.
0 = Number of steps required to reduce power

The first one is 0 for 2 handles, 1 for 1 handle.  Normally, you'll leave the last one on 0 - if you set it to (say) 2, then you have to back off more than 2 steps before the power reduces.  Don't see the point in that, myself.

The last 2 parts are cab and cons.  Cab (#COCKPIT in train.dat) is the location of the driving position, in the normal XYZ co=ordinates, X measured from the centre of the running rail and Z from the front of the train.

Cons is the train consist, called #CAR in  train.dat.    The top two figures are the weight and number of powered cars, the bottom pair are the unpowered cars.  "Motor" means whether the leading car  is a motor car or not.   All cars have the same length,  so  you may need a correction  if you're simiualting a train of  short wagons, say.  In the case of the 66 and the 22 coal wagons, the HTAs are  17.8m long,  so not as long as the loco.  22 of these have a combined length  of 392m,  so to correct the train length we divide this by the loco length and take the nearest round number, in this case, 19  cars of 20.1m.
The train length is relevant to things like how soon after passing a speed limit board you can increase speed.

That's all now except for the acceleration and braking.  If you click "Accel. curve",  you'll get the accleration window, which looks like this:
accelcurve 1

This one is for the 66 coal empties again, and I've selected notch 8, which is the highest one.  If you're only using 6 power nothces, then you'd select 6.  The figures on the right come from the acceleration figures worked out earlier.  The 4th and 5th figures determine the "tail end" of the curve: 110 km/h is where it stops being a curve and starts to decline and 3 is the rate at which it declines from then on.  4 is the maximum (steepest drop-off) and 1 gives a long tail.  In the case of the 66 it has a limiter at 75mph (about 120kph) and so it's more or less irrelevant.  On trains without a limiter, you can use this part of the acceleration curve to control the maximum speed on the level: suppose the train is flat-out at 90 mph (144 kph), you arrange for the highest notch acceleration to tail off to nothing at a bit over 140.  The lesser notch curves are arranged to give less acceleration and less top speed - within reason, you can do more or less what you want with them but it makes sense to have them more or less looking the same as the full-power one.

There's limited scope for messing around with these curves as the algorithm is built into BVE.  However, there is some scope:  Below is a set which I created for a light engine version of 37901, in consultation with a Man Who Knows how the loco performs in real life - it's been reported that it's not far off.
accelcurve 2

This set are not based on calculation but on trial and error and on information about how the train behaves - 37901 takes off slowly from rest but once rolling the acceleration picks up and peaks around 40 mph.

The final thing to set in train.dat (apart form the sounds, which are going to be covered later) is the braking.  This one is very diffcult to get enough data about.  Loco data some times has brake force in tonnes, but that may not include the train brakes - with continuous-braked trains the maximum brake force depends on many things, so a heavy train will sometimes out-brake a light engine, just because it has a much higher number of brakes.  Indeed, when towing dead engines around, you often see a few coaches included in the consist to increase the brake force available.

There are 2 options on the matter of how much brake you build in.  One is to talk to drivers who've driven "your" train and see if they can give you an idea of how long it takes to stop from a given speed - more or less any such data can be used - suppose you find out that the 4-car train you're modelling, if you apply service brake notch 1 out of 3 (commonly known as B1) from 30 at the end of the platform it comes to rest nicely on the 3/4 car marker board.  You then try a value for "Rate" (the first value in #PERFORMANCE in train.dat), take the train for a drive and see if it stops the way it should.  If it's not stopping fast enough, make "Rate" a bit higher, if it's too violent, make it lower.

The other way to do it is to hunt around the BVE world 'til you find a train similar to yours, and copy the value used on that.  As with everything, if it's a long way off, people will soon tell you, and you can always release an update to address such issues.

That's about it for train.dat.  Part 8 will consider the config files which actually make the train work in BVE4.