leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
281 stars 51 forks source link

[Suggestion] Pantograph height route command #1086

Open hotdamndel opened 2 weeks ago

hotdamndel commented 2 weeks ago

Many routes require catenary height variation (tunnels, etc) and pantographs on trains must react to that. However, currently it's either very difficult and route-specific via plugins, or just inachievable. I can suggest a simple solution (or at least my vision on it) - CatenaryHeight command for Track section in routes and a corresponding function for .animated files.

Route side:

With Track,
1000,.CatenaryHeight 5.0, ;in meters above rail heads
1200,.CatenaryHeight 5.0,
1250,.CatenaryHeight 4.2, ;tunnel starts here
1500,.CatenaryHeight 4.2, ;tunnel ends
1550,.CatenaryHeight 5.0,
...

Heights are interpolated similarly to .Brightness command (i.e. there are 50m "ramps" before tunnels in this example)

Train side:

[object]
States = PantoTop.csv
TranslateYFunction = 5.0 - CatenaryHeight(-6.2)

-6.2 in this example is offset along the track from Car[i]'s model origin, since we need to receive catenary height from route position exactly matching Car[i]'s current position with some offset (pantos are rarely mounted in the middle of a car).

leezer3 commented 2 weeks ago

I actually wrote most of this several years ago: https://github.com/leezer3/OpenBVE/pull/501

Trouble is that traction modelling (the logical follow-on) is nowhere near being done, and I just end up bodging bits badly into the existing code, which was never designed to do stuff.... That's one of the reasons I've mostly been re-writing things slowly over the last few years, so that stuff like this can be added in sensibly.

If that PR looks interesting, it'd probably be simple enough to revive.

hotdamndel commented 3 days ago

Looks promising. I'd honestly contribute a lot of traction and related sound realism, but can't code, so can only suggest the parts of my overall vision on how to make train simulation more realistic but still configurable and flexible enough