New to NML and many questions
Moderator: Graphics Moderators
Re: New to NML and many questions
Your sw_no_emu idea would work for the units within your set
You can't really control what other GRFs do/don't allow, as far as I'm aware - it's just one of the limitations of GRFs that the callback is called on the "front" vehicle of a consist, and if that isn't from your set then there's not a huge amount you can do about it
You can't really control what other GRFs do/don't allow, as far as I'm aware - it's just one of the limitations of GRFs that the callback is called on the "front" vehicle of a consist, and if that isn't from your set then there's not a huge amount you can do about it
Jon
Re: New to NML and many questions
Actually my idea would work for any vehicle type (engine, wagon, emu).
Checking when attaching to a consist if the consist is really compatible with the current vehicle sound quite natural for me.
Also is would avoid waiting to try to start the train to get the message "your train is too long" as the "can_attach_wagon" can't do the job, and we need to check it in the start_stop (according to my tests and the tutorial though).
Checking when attaching to a consist if the consist is really compatible with the current vehicle sound quite natural for me.
Also is would avoid waiting to try to start the train to get the message "your train is too long" as the "can_attach_wagon" can't do the job, and we need to check it in the start_stop (according to my tests and the tutorial though).
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: New to NML and many questions
If player wants to build trains in a way you don't like, it's easier to just let them.
My 2 cents.
Your set, your right to choose of course.

My 2 cents.
Your set, your right to choose of course.

FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: New to NML and many questions
Well, that's a point of view I can understand.
After all even IRL we can find diesel TGV...
After all even IRL we can find diesel TGV...

Re: New to NML and many questions
Another question.
I wonder how to compute the property "tractive_effort_coefficient".
https://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles
The NML specs says it's a range between 0 and 1, with 0.3 a "good" value.
And it gives the formula:
Tractive effort (in kN) is calculated as (TE coefficient) * 10 * weight (in tons), with 10 being an approximation of the acceleration of gravity (9.81 m/s).
I have the TE in kN for my train: 196
TEC = TE / (weight * G) and I get 0.18 that sounds like very poor. It's pretty surprising as this engine is a modern and powerfull engine used for express passengers : it's designed to accelerate quickly.
Also, when I read the definition in the NML specs, it says "Fraction of the vehicle weight that is available as tractive effort." In the turorial there is some calculation about the number of axles powered and not powered, and it sounds to me more accurate regarding to the definition... But when I compute the provided formula I don't get a value between 0 and 1 !
What is the correct way to get this value?
Here I get another calculation from the GRF specs :
viewtopic.php?p=867118#p867118
TEC = TE / Weight

--Edit: A second question. How could I change the power according to the current rails? Most french engines can run in 1,5 kV DC and 25 kV AC, but they often have about 30% more power on 25 kV AC. I would like to take it into account to make the conversion from 1,5 DC to 25 AC more attractive. I found I can use callback for power and tractive effort, but I can't figure how to use "is_rail_type(???)" in a switch expression...
I wonder how to compute the property "tractive_effort_coefficient".
https://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles
The NML specs says it's a range between 0 and 1, with 0.3 a "good" value.
And it gives the formula:
Tractive effort (in kN) is calculated as (TE coefficient) * 10 * weight (in tons), with 10 being an approximation of the acceleration of gravity (9.81 m/s).
I have the TE in kN for my train: 196
TEC = TE / (weight * G) and I get 0.18 that sounds like very poor. It's pretty surprising as this engine is a modern and powerfull engine used for express passengers : it's designed to accelerate quickly.
Also, when I read the definition in the NML specs, it says "Fraction of the vehicle weight that is available as tractive effort." In the turorial there is some calculation about the number of axles powered and not powered, and it sounds to me more accurate regarding to the definition... But when I compute the provided formula I don't get a value between 0 and 1 !
Code: Select all
switch(FEAT_TRAINS, SELF, sw_icm_te, cargo_subtype) {
/* Base TE coefficient = 0.3
* 3 parts: 4/12 of weight on driving wheels
* 4 parts: 6/16 of weight on driving wheels */
0: return int(0.3 * 255 / 3); // = 25
return int(0.3 * 255 * 3 / 8); // = 28
}
Here I get another calculation from the GRF specs :
viewtopic.php?p=867118#p867118
TEC = TE / Weight


--Edit: A second question. How could I change the power according to the current rails? Most french engines can run in 1,5 kV DC and 25 kV AC, but they often have about 30% more power on 25 kV AC. I would like to take it into account to make the conversion from 1,5 DC to 25 AC more attractive. I found I can use callback for power and tractive effort, but I can't figure how to use "is_rail_type(???)" in a switch expression...
Re: New to NML and many questions
For power according to the rail voltage I finally found something that works:
I don't know why I need to create an group "ELEC" as "ELRL" is in all electrified groups I though AC25 should be chosen in the switch when running on standard ELRL but one DC was chosed instead...
At least it works as expected. TGV Atlantique can't run at full speed on DC rails as there is not enough power.
Code: Select all
railtypetable {
UNELECTRIFIED: [ RLA0, RLA1, RLA2, RLA3, RAIL ],
ELEC: [ ELRL ],
DC15: [ ERd0, ERd1, ERd2, ERd3, ELRL ],
DC03: [ ERD1, ERD2, ERD3, ELRL ],
AC15: [ ERa0, ERa1, ERa2, ERa3, ERa4, ELRL ],
AC25: [ ERA1, ERA2, ERA3, ERA4, ELRL ],
DC15DC03: [ ER2D, ELRL ],
AC25DC03: [ ER2S, ELRL ],
AC25DC15: [ ER2s, ELRL ],
AC25AC15DC15: [ ER3a, ELRL ],
AC25DC03DC15: [ ER3D, ELRL ],
AC25AC15DC03DC15: [ ER4S, ELRL ],
}
switch (FEAT_TRAINS, SELF, sw_TGV_Reseau_power, current_railtype) {
ELEC: 11801;
AC25: 11801;
DC15: 4938;
DC03: 4938;
default: 11801;
}
item(FEAT_TRAINS, item_TGV_ATLANTIQUE) {
property {
[...]
power: 8800 kW;
}
graphics {
[...]
power: sw_TGV_ATLANTIQUE_power;
}
}
At least it works as expected. TGV Atlantique can't run at full speed on DC rails as there is not enough power.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: New to NML and many questions
I recommend leaving it at the default 0.3 for most trains.MagicBuzz wrote: 21 Feb 2023 13:43 I wonder how to compute the property "tractive_effort_coefficient".
https://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles
- It's approximately correct for many trains, compared to real-life
- It matches what many other grfs have used
Sometimes there is a good reason to change the TE coefficient, for example
- a locomotive with many non-powered wheels, reduce the TE coefficient to values like 0.25 or 0.2
- a locomotive with advanced traction control, super slip, creep control etc, increase the TE to 0.35 or 0.4

TL;DR don't worry about TE much

---
For the railtype, use tile_powers_railtype instead of current_railtype. I don't have time now to explain correctly, but it's a more reliable choice.

FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: New to NML and many questions
Ok, thank you for the advice 
A small question : for local service EMUs, there are often one or more small engine per coach rather than a big engine in the main locomotive.
Should I increase the TE in this case? Like for metro, almost all wheels are powered in this case.
Will this setting increase the acceleration?

A small question : for local service EMUs, there are often one or more small engine per coach rather than a big engine in the main locomotive.
Should I increase the TE in this case? Like for metro, almost all wheels are powered in this case.
Will this setting increase the acceleration?
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: New to NML and many questions
It would make sense to increase TE in that case. There will be a small effect on acceleration, but it won't be very noticeable in gameplay.MagicBuzz wrote: 24 Feb 2023 09:11 A small question : for local service EMUs, there are often one or more small engine per coach rather than a big engine in the main locomotive.
Should I increase the TE in this case? Like for metro, almost all wheels are powered in this case.
Will this setting increase the acceleration?
If there is a gameplay reason to have those EMUs accelerate faster, give them a bit more HP (KW) than real life.
There is some justification for this:
- Traction motors can often exceed their continuous HP for a short period of time (but they risk damage if there is too much power for an extended time).
- Or published power values might be using average HP, continuous HP, or peak HP, and often the values are rounded to e.g. nearest 1000. Figures can also be motor HP or HP at the rail/drawbar which can all be quite different numbers
- Power values quoted on e.g. wikipedia or railfan sites sometimes have mistakes anyway

FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Who is online
Users browsing this forum: No registered users and 10 guests