News:

SimuTranslator
Make Simutrans speak your language.

articulated loco

Started by Vladki, July 12, 2017, 10:06:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vladki

The discussion here http://forum.simutrans.com/index.php?topic=17225 was getting a bit off topic, so I'm creating a new thread.

I have trouble how to properly code engines like these two:
https://cs.wikipedia.org/wiki/Lokomotiva_131
https://cs.wikipedia.org/wiki/Lokomotiva_125.8
They are articulated two-part engines, permanently coupled together, each part has only one cab. They are joined by gangway.
If I set them as bidirectional=1, they will reverse quickly, but will swap positions without rotation, and run with cabs heading to each other.
If I set them as bidirectional=0, they will take long time to reverse, and rotate completely. Moreover, they will take one more unpowered car with them to the other side of train.
See this save http://server.exp.simutrans.com/debug-saves/twin-engine.sve and look for train No. 20 (T698.0 Kokakola).

jamespetts

Thank you for that. I think that I am going to have to write some special code to accommodate these types of locomotives. This should be fairly straightforward (I have already had to do the same for Garrett type steam locomotives), but this will require the locomotives to be encoded in a very specific way so that the reversing code can recognise them as such.

Is it workable to have both units coded as having can_lead_from_rear=1, the front unit having exactly one rear coupling constraint and the rear unit having exactly one forward coupling constraint? Also, would it be correct to assume that these will always both be powered units?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Don't forget that there can be triple articulated ones as well, like the Swedish Dm3, which already is in the pakset. In the Dm3 all parts are powered. They also show the same behavior as vladki described. I seem to remember a discussion about this a year ago or something, what about the idea to take the rearmost vehicle with "can-lead-from-rear" and split the convoy there?

jamespetts

Ves - can I ask precisely what assumptions can be made about the three unit articulated locomotive that will not be true of any other sets of vehicles so that I can code for this, too?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vladki

James, the constraints are exactly as you write. But one should tek into account alos other engines, like american F7 (A), which can be coupled back to back in similar fashion to czechoslovak class 131, but can be used alone as well. They even have a cabless B part - similar to the middle part of swedish Dm3. So they have more possible combinations: A; A+B; A+A(reversed); A+B+A(reversed); A+B+B+A(rev). So these american engines would not have such strict constraints, as czechoslovak or swedish articulated engines.

Another similar situation would be,if general cars are attached at the end of a multiple unit. In that case, the whole multiple unit shall "shunt" and go to the other end of train, just as if it would be an articulated loco.

In some older discussion I proposed the following change in semantics of bidirectional, and can_lead_from_rear, which may offer solution.
bidirectional=0 would mean that the vehicle cannot move backwards at all (or only at reduced speed), and has to be turned around on turntable. I.e. steam engine with tender
bidirectional=1 would mean that the vehicle can move backwards at full speed, but does not necessarily have a rear cab
can_lead_from_rear=1 would mean that the vehicle has a rear cab (or a cab somewhere in the middle, from which the driver can see in both directions.)

Examples:
steam engine with tender: bidir=0, clfr=0
tank steam engine: bidir=1, clfr=1
most modern diesel and electric engines with cabs on both ends: bidir=1, clfr=1
front part of articulated loco or front part of DMU/EMU: bidir=1, clfr=0
rear part of articulated loco or DMU/EMU or driving trailed: bidir=1, clfr=1

Implementation:
If all vehicles are bidir=1, find the rearmost vehicle with clfr=1, and split the train there. Move the whole front part up to the car with clfr=1 to the end of train.
If there are some vehicles with bidir=0, turn them around, and put them in the same relative position as before reversal (so that the engine and tender is again on the head of train.)

Ves

Quote from: jamespetts on July 13, 2017, 11:29:09 AM
Ves - can I ask precisely what assumptions can be made about the three unit articulated locomotive that will not be true of any other sets of vehicles so that I can code for this, too?
They need to go to a workshop in order to split, so they will always stay in the same order.