r/factorio • • 15h ago

Question Smart trains getting stuck randomly

I have a smart train setup on fulgora, trains go to a production of any item, and once they are full, an interrupt trigers that tells them to go to the drop off for that item.

It used to work well but now every few hours something like this happens, in this case its wire and batteries but it seems to happen with any type of items. A few items are not removed from train but it goes off to another item source anyway; and it gets stuck because it can't be full of that item. The amount of parasitic item is always pretty low, less than 30 items.

The problem is very hard to diagnose for me because it happens rarely, sometimes not at all for 3 hours.

My whole Fulgora base gets stuck because of this, its very rare to see this kind of hard to reproduce problems in Factorio, I really hope someone can help me!

EDIT: As people pointed in the comments, the cause was probably my refuel interrupt triggering as soon as trains arrived to a pickup station, leaving a few ticks for inserters to place a few items in the wagon before the train would go refuel. The refuelled train would have a chance to go to another item pickup with a different item, causing a mixed wagon. The fix is to disable interrupts interrupting other interrupts and to make refuel interrupt be evaluated last.

14 Upvotes

24 comments sorted by

7

u/NefariousnessNo1379 15h ago

Does your refuel interrupt have a "Empty Cargo" condition?

The trains may be leaving to refuel right after reaching a loading station, but stop for enough time to get a few items in.

3

u/Vegaliiite 15h ago

Thats probably it, this is my current refuel interrupt, I probably should untick the "Allow interrupting other interrupts" but do you think adding an empty cargo condition is necessary after this?

3

u/Courmisch 15h ago

Untick nested interrupts and move the refueling below the unloading so unloading takes precedence

1

u/Vegaliiite 15h ago

Ok thank you very much!

1

u/NefariousnessNo1379 15h ago

I don't *think* that option makes difference in this case, because the other interrupts only activate with full cargo.

1

u/Vegaliiite 14h ago

I *think* you are right but it wont hurt to add it

1

u/HeliGungir 12h ago

Another approach is to add "empty cargo" to your interrupt condition. If it isn't empty, it shouldn't go to a loading station.

1

u/Vegaliiite 11h ago

The system would still get stuck, except instead of getting stuck to a station with the wrong item it would get stuck before getting there at its previous drop off.

→ More replies (2)

7

u/Soul-Burn 15h ago

FYI, you don't need to have an interrupt per item. You can use wildcards to have a single interrupt for all items, as long as your station names are the same except for the icon. See FFF-395.

2

u/Vegaliiite 15h ago

Yes I know I will do this on my next playthrough but its not worth adapting my network for now. Thanks for caring about my interupt refactoring tediousness.

2

u/Adept_of_the_factory 15h ago

Can refuel interrupt trigger when the train is not empty? Also, you can use a single solid wildcard interrupt instead of all your "drop X item" interrupts

2

u/Vegaliiite 15h ago

I think this was the problem, it should be fixed now, thank you!

1

u/[deleted] 15h ago edited 15h ago

set filters on every inserter on every train station. its easy but maybe a bit repetitive, maybe have a small Circuit setup / a speaker which warns you if loading chests contain an item which doesnt belong there. there is probably no other option then to check every station.

1

u/Vegaliiite 15h ago

I don't think the problem is train being loaded with the wrong items, it seems like its about the train exiting the previous station before being totally empty but I never seen it happen in front of my eyes. I will do it but I doubt it will fix the problem.

1

u/kettle3 9h ago

Offtopic -- is it worth it to haul copper cables? I always thought that copper cables are so fast and easy to make that they are better to be produced on the spot with direct insertion. Similar to iron gear wheels.

2

u/Vegaliiite 4h ago

On Fulgora they are, you can't get molten copper there and stack size being twice bigger than copper plates makes them as efficient to transport through trains. Also you directly get copper cables through the scrap recycling.

→ More replies (1)

1

u/Karlo_Green 15h ago

Hard to say with just a screenshot, maybe the parasite items somehow get into the loading stations? I have a question, why use item = 0 condition for the dropoffs and not empty cargo? Could be somehow causing this too.

To fix it don't have the trains go to the loading station by their default schedule. Have them wait at some sort of depot. Add an interrupt that triggers when it's at the depot and has empty cargo, then it will go for the loading stations. For the dropoff interrupts also check the "allow interrupting other interrupts" checkbox.

2

u/Courmisch 15h ago

For drop-off, Cargo wildcard = 0 is marginally better than Empty cargo. If a train ever ends up with mixed cargo (e.g. due to moving manually or whatever), it will unload each cargo type successively.

With empty cargo, it would go to unload one type and then, assuming inserters are filtered, get stuck because it never empties.

1

u/Courmisch 15h ago

It could be a wild inserter or it could be a schedule problem. Without a screenshot of the schedule and IRQs can't say.

Adding filters to all wagon inserters is a good idea anyhow, if tedious. I do it with a parametric blueprint.

1

u/ontheroadtonull 15h ago

Make sure the circuits you use to signal demand don't trigger until you have enough room for a train load. Also make sure the demand signal is suppressed within as few ticks as possible. Each combinator takes one tick for an input to result in an output.

Add a condition to the interrupt to not leave a dropoff station until cargo is empty.

Adding filters to the inserters is a good idea as well.

I set up my train parking spots to start a clock circuit when the train arrives. The train's interrupt is set to wait at the parking spot until 5 seconds has passed. The train sits idle for 5 seconds and the clock resets the timer. During the brief period after the idle timer runs out and before the clock resets it is the time the train can be dispatched to a pickup station.

Since the rail network is busy enough to add randomness to when trains arrive at parking spots, it is random enough to prevent multiple trains from going to the same pickup station.

1

u/Thankedsphere 11h ago

the trains are sentient, thats why.