Feature request: custom train schedules

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Feature request: custom train schedules

Post by mrvn »

I wonder if you would be interested in including the following idea if given patches:

A LTN station can have signal "Schedule" and LTN Network ID set on the lamp. A train can then be parked at the station but must have a unique composition (for the given Network). The trains schedule is then a template for the schedule generated by LTN for trains with that composition in the corresponding Network.

The schedule can have up to 3 stops, the names of which are ignored. First entry is used for the depot, second for loading and third for unloading. LTN would add a template item and fluid to be used in the train stop condition. E.g. Inventory empty AND LTN-Fluid-Template = 0 or 42 seconds of inactivity. The template item or fluid get replaced with whatever is transported and the amount adjusted to the transported amount when creating a schedule.

This would allow customization of the schedules by the user. For example I want some trains to leave when loaded (fluid stations and bulk rail loader that doesn't honor item count) while others should wait for the inserters to empty their hands (mixed goods stations).

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Feature request: custom train schedules

Post by Optera »

It took me three times reading through that to hopefully understand what you want.

1) a template signal similar to the depot signal
2) template stops will only accept is template signal and network id
3) any train parked at that stop will have its schedule used as blueprint for how ltn generates schedules for the network(s) the template stop belongs to (i'd revert to any if none is give to be consistent)

I'll think about it, but it seems way too complicated considering users still have problems grasping the concept of network ids.

alienwombat
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun Dec 10, 2017 9:03 pm
Contact:

Re: Feature request: custom train schedules

Post by alienwombat »

I think it's an interesting idea. But i can't think of a use case that can't be solved simpler. If you wan't to load and unload full trains without worrying about items stuck in inserters, just set appropriate thresholds, to make sure a full train can be loaded/unloaded at the provider/requester. Just don't use any circuit logic on the inserters, and they will work as fast as possible.

Another use case where you want "wait till full/empty" is if you use the train as buffer, or need tolerance for unbalanced (un)loading. Both cases are seem similar. This could be made possible with a custom signal, that tells the LTN stop to generate schedules with "wait till full/empty".

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Feature request: custom train schedules

Post by mrvn »

alienwombat wrote:I think it's an interesting idea. But i can't think of a use case that can't be solved simpler. If you wan't to load and unload full trains without worrying about items stuck in inserters, just set appropriate thresholds, to make sure a full train can be loaded/unloaded at the provider/requester. Just don't use any circuit logic on the inserters, and they will work as fast as possible.

Another use case where you want "wait till full/empty" is if you use the train as buffer, or need tolerance for unbalanced (un)loading. Both cases are seem similar. This could be made possible with a custom signal, that tells the LTN stop to generate schedules with "wait till full/empty".
But that's where the problem start. No circuit logic on the inserters so they will load till the train is full. The request might be for only 100 iron plates but the inserter will load till it reaches 4000 per wagon. And as long as the inserter works the train won't leave because of the "wait till loading finishes" option.

So now you need circuit logic to make the inserter stop when the requested amount is reached. Can't do that with bulk rail loaders as they can't be circuit programmed. It makes fluid stations more complex too and so on.


An alternative to custom train schedules like described above would be to add circuit conditions to the train schedule, e.g. "OR circuit condition G=1 AND circuit condition W=0". Then the station could use circuit logic to decide when the train should leave without waiting by setting G=1. Or keep a train waiting past the timeout (e.g. fluid trains that must unload no matter what) by setting W=1.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Feature request: custom train schedules

Post by Optera »

mrvn wrote:An alternative to custom train schedules like described above would be to add circuit conditions to the train schedule, e.g. "OR circuit condition G=1 AND circuit condition W=0". Then the station could use circuit logic to decide when the train should leave without waiting by setting G=1. Or keep a train waiting past the timeout (e.g. fluid trains that must unload no matter what) by setting W=1.
I like that idea. It's simplistic, uses mostly already existing base functions and offers as much flexibility as possible.
Unlike template copying this can be implemented very quickly. It will also have 0 performance impact.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Feature request: custom train schedules

Post by mrvn »

While I would have no problem programming the right G and W signals for each station that might be hard to beginners. So maybe a few more basic options would be good:

1) Different settings for solids and liquids.
2) Different settings for loading an unloading.
3) Allow infinite timeouts.

For example my fluid trains should generally:
- leave loading when they have the right amount
- leave loading after 60s
- wait forever to unload (give an error message when exceeding total time but don't have the train leave unloading)

And solid trains should generally:
- wait to finish loading
- leave loading after 200s
- leave unloading after 200s

So if you are looking into the code that creates the schedules to add the G and W signals please also consider making the default configuration a bit more flexible so it's needed less. (There are still places where G/W signals would solve problems even with the more flexible default so it's not "either or".).
Thanks.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Feature request: custom train schedules

Post by Optera »

Beginners wouldn't need those signals in the first place.
Same as with network id those are configuration options in game.
mrvn wrote:1) Different settings for solids and liquids.
2) Different settings for loading an unloading.
3) Allow infinite timeouts.
1) 1000 fluid x is treated the same as 1000 item y, Breaking this up would make LTN conceptually harder to learn for beginners.
2) default thresholds have been separate options for over a year
3) station timeout can be omitted by disabling finish loading
mrvn wrote: - leave loading when they have the right amount
- leave loading after 60s
- wait forever to unload (give an error message when exceeding total time but don't have the train leave unloading)
fluid trains originally did that but someone complained about inconsistent behavior.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Feature request: custom train schedules

Post by mrvn »

Optera wrote:Beginners wouldn't need those signals in the first place.
Same as with network id those are configuration options in game.
mrvn wrote:1) Different settings for solids and liquids.
2) Different settings for loading an unloading.
3) Allow infinite timeouts.
1) 1000 fluid x is treated the same as 1000 item y, Breaking this up would make LTN conceptually harder to learn for beginners.
Except they are not. 1000 fluids are 1000 stacks while 1000 item y are 5 stacks. Also 1000 fluids select a train with fluid wagon and 1000 item y select a train with cargo wagon. They really aren't the same and LTN already knows what is a fluid and what an item.
Optera wrote: 2) default thresholds have been separate options for over a year
I'm not talking about threaholds you set with signals. I'm talking about the mod config options.
Optera wrote: 3) station timeout can be omitted by disabling finish loading
mrvn wrote: - leave loading when they have the right amount
- leave loading after 60s
- wait forever to unload (give an error message when exceeding total time but don't have the train leave unloading)
fluid trains originally did that but someone complained about inconsistent behavior.
So the default should be the same behavior for both. But the mod could have config options for each separately. So I can disable finish loading for fluid trains but enable it for item trains for example.

I'm not even asking for any new features there. The options are already all there. Just not separate options for fluid/item trains.

Nut anyway, if you do the signal I can cope. It's the more important, powerfull feature.

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Feature request: custom train schedules

Post by nuhll »

most ppl dont understand your way of doin things because you do it for programers.

You could seperate the networks with a simpe number, and transcode it internally, but i guess, you dont want...

Like now, but just Network ID 1 = network 1
Netword ID 2 = network 2

Thats how non technical ppl think.

Same for train composition, could also be as simple as 121 (means 1-2-1) which gets internally translated...

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Feature request: custom train schedules

Post by mrvn »

nuhll wrote:most ppl dont understand your way of doin things because you do it for programers.

You could seperate the networks with a simpe number, and transcode it internally, but i guess, you dont want...

Like now, but just Network ID 1 = network 1
Netword ID 2 = network 2

Thats how non technical ppl think.

Same for train composition, could also be as simple as 121 (means 1-2-1) which gets internally translated...
But then how do you say Network ID 3 = network 1 + network 2? You would need up to 32 different network signals.

As for train composition: 121 makes things far far more complex. What does that even mean? Fluid wagon, 2 locomotives and a cargo wagon? So now you need signals for "type of first group", "count of first group", "type of second group", "count of second group", ... And how to you tell if a locomotive is at position 10 of a train? Now you have to sum up all the group counts till the next group contains position 10 and then check the type of that group. HORRIBLE.

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Feature request: custom train schedules

Post by nuhll »

I dont want to think about such things, but i guess there is definitly a more easy way to do it then its now :mrgreen:

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Feature request: custom train schedules

Post by Optera »

I've added optional schedule circuit conditions in LTN 1.8.0.
Instead of letters I used red and green signals.

There are some requirements for circuit conditions to work:
1) all stops must have a circuit connection (even if it's just to a pole)
2) all stops must have send to train enabled
Trains will be stuck looking for signals if those are not fulfilled.

Post Reply

Return to “Logistic Train Network”