New to NML and many questions

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

audigex
Tycoon
Tycoon
Posts: 1999
Joined: 09 Dec 2007 21:28
Contact:

Re: New to NML and many questions

Post by audigex »

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
Jon
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: New to NML and many questions

Post by MagicBuzz »

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).
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: New to NML and many questions

Post by MagicBuzz »

Well, that's a point of view I can understand.

After all even IRL we can find diesel TGV... :o
TGV on unpowered line
TGV on unpowered line
TGV_diesel.jpg (31.25 KiB) Viewed 1675 times
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: New to NML and many questions

Post by MagicBuzz »

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 !
tractive_effort_coefficient.png
(68.09 KiB) Not downloaded yet

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
}
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

?( :cry:

--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...
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: New to NML and many questions

Post by MagicBuzz »

For power according to the rail voltage I finally found something that works:

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;
    }
}
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.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5656
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: New to NML and many questions

Post by andythenorth »

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
I recommend leaving it at the default 0.3 for most trains.
  • It's approximately correct for many trains, compared to real-life
  • It matches what many other grfs have used
Tractive effort doesn't have much gameplay effect. It is used correctly by OpenTTD physics, but horsepower and top speed are bigger factors for overall train performance in most OpenTTD games.

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
In real life also, maximum TE isn't the continuous value. TE changes according to many things, including rail conditions (wet, leaves, etc), engine maintenance condition, how well the engine is driven, current speed of the train, protection limits to prevent mechanical damage etc. :)

TL;DR don't worry about TE much :D

---

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. :wink:
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: New to NML and many questions

Post by MagicBuzz »

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?
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5656
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: New to NML and many questions

Post by andythenorth »

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?
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.

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
So there is a lot of scope for adjusting power values if you want gameplay effects. :)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests