Fuelling a locomotive with conditions

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Fuelling a locomotive with conditions

Post by darebakk »

Let's say I have a box with 50 pieces of solid fuel. And the task is, when a locomotive stops at the station, I want to load only 2 pieces of that fuel in it. How to do it??

I tried to fiddle with the station signals, decider and arithmetic combinators with several boxes and inserters, however, no matter what I tried it either did not load the locomotive at all, or it kept loading and loading (ignoring any conditions about the 2 pieces limit). Can somebody please help me with a screenshot of the setup and a detailed description of wiring and combinators (if used)?

Many thanks in advance!

Amarula
Filter Inserter
Filter Inserter
Posts: 389
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by Amarula »

I would use a counter, to count how many pieces of fuel have been loaded.
I would use that counter to control the inserter, so it would only load when the count is less than 2. Limit the stack size on the inserter to 1.
I would use a latch that resets when the train enters the station so the next train also gets loaded. The reset would set the count back to zero.
Hmm and might need a second latch to distinguish a train entering the station from a train being at the station, so the first latch doesn't reset right away and just keeping loading the first train...
Luck is not a robust control.

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

In theory I have some many ideas and I know exactly how to do it. Just when I start wiring and using combinators, it doesn't work. Thats why I need help, like a screenshot and description of combinators' settings. I just can't figure it out, how to connect everything properly.
Amarula wrote:
Sun Jan 10, 2021 1:58 pm
I would use a counter, to count how many pieces of fuel have been loaded.
I would use that counter to control the inserter, so it would only load when the count is less than 2. Limit the stack size on the inserter to 1.
I would use a latch that resets when the train enters the station so the next train also gets loaded. The reset would set the count back to zero.
Hmm and might need a second latch to distinguish a train entering the station from a train being at the station, so the first latch doesn't reset right away and just keeping loading the first train...

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

If anybody is interested in this task, posting a solution by Renan Gomes.
Attachments
Solution by Ronan Gomes
Solution by Ronan Gomes
138139347_3665777970180848_5770373864075646228_o.jpg (765.83 KiB) Viewed 1266 times

Amarula
Filter Inserter
Filter Inserter
Posts: 389
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by Amarula »

I discovered it could be easier than I thought:

Overview:
Overview.png
Overview.png (282.58 KiB) Viewed 1206 times
One decider combinator, setting constant C to true (1) if a train is present to have fuel loaded.
Decider train present.png
Decider train present.png (37.41 KiB) Viewed 1206 times
One non-standard arithmetic combinator, counting the fuel as it is loaded into the locomotive.
Rather than adding zero to the count when another fuel is loaded by the inserter, it multiplies the fuel by the constant C. As soon as the train leaves the station, C becomes false, and the count is multiplied by zero.
Fuel counter when present.png
Fuel counter when present.png (25.32 KiB) Viewed 1206 times
The inserter controls, to read the hand contents, and load fuel if the count is less than two:
Inserter read contents enable fuel less than 2.png
Inserter read contents enable fuel less than 2.png (33.7 KiB) Viewed 1206 times
Hopefully this helps!
Luck is not a robust control.

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

Thank you for another interesting solution!
Amarula wrote:
Sun Jan 10, 2021 7:00 pm
I discovered it could be easier than I thought:
...

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

I don't understand how this arithmetic combinator is wired to the system. The inserter keeps loading and loading, no matter what the train does :(
Amarula wrote:
Sun Jan 10, 2021 7:00 pm
One non-standard arithmetic combinator, counting the fuel as it is loaded into the locomotive.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 571
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by disentius »

Here is another solution using 1 combinator and a signal to reset the count after the train leaves the station. This makes sure everything only happens once per train. This works because when the train wants to leave, it reserves (yellow) the next signal it wants to pass.

2021-01-11 12_23_14-Window.png
2021-01-11 12_23_14-Window.png (364.94 KiB) Viewed 999 times
2021-01-11 12_30_09-Window.png
2021-01-11 12_30_09-Window.png (63.6 KiB) Viewed 999 times
2021-01-11 12_30_32-Window.png
2021-01-11 12_30_32-Window.png (119.08 KiB) Viewed 999 times
2021-01-11 12_30_49-Window.png
2021-01-11 12_30_49-Window.png (57.31 KiB) Viewed 999 times
Last edited by disentius on Mon Jan 11, 2021 1:52 pm, edited 3 times in total.

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

@disentius, this is so simple and elegant. i love it! ;)

Amarula
Filter Inserter
Filter Inserter
Posts: 389
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by Amarula »

darebakk wrote:
Sun Jan 10, 2021 8:05 pm
I don't understand how this arithmetic combinator is wired to the system. The inserter keeps loading and loading, no matter what the train does :(
Amarula wrote:
Sun Jan 10, 2021 7:00 pm
One non-standard arithmetic combinator, counting the fuel as it is loaded into the locomotive.
Wiring is standard for a counter: one wire from the inserter to the input of the counter combinator, and a second wire from the output of the combinator back into itself.
Plus one wire from the output of the decider combinator to deliver the control signal C to the input of the counter.
Luck is not a robust control.

Amarula
Filter Inserter
Filter Inserter
Posts: 389
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by Amarula »

disentius wrote:
Mon Jan 11, 2021 11:32 am
This works because when the train wants to leave, it reserves (yellow) the next signal it wants to pass.
Sweet!
Luck is not a robust control.

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

Amarula wrote:
Mon Jan 11, 2021 2:02 pm
darebakk wrote:
Sun Jan 10, 2021 8:05 pm
I don't understand how this arithmetic combinator is wired to the system. The inserter keeps loading and loading, no matter what the train does :(
Amarula wrote:
Sun Jan 10, 2021 7:00 pm
One non-standard arithmetic combinator, counting the fuel as it is loaded into the locomotive.
Wiring is standard for a counter: one wire from the inserter to the input of the counter combinator, and a second wire from the output of the combinator back into itself.
Plus one wire from the output of the decider combinator to deliver the control signal C to the input of the counter.
I think I misplaced a wire before, thats why it didnt work. However, I like the solution from disentius the best, because it uses only 1 inserter and 1 chest - perfect!

Laie
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Fri Dec 25, 2020 6:18 pm
Contact:

Re: Fuelling a locomotive with conditions

Post by Laie »

Asking here rather than starting my own thread: how does one check he amount of fuel present in a locomotive?

This doesn't seem to happen in the above examples, or if it does, I'm totally missing it. To me it looks as if the inserter will count fuel into the locomotive whenever it stops at the station, regardless of how much it already has in the bunker. If the set amount doesn't exactly match consumption, the locomotive will, in due time, either fill up or run out.

I'm only getting started with circuit network stuff, but setting up an inserter to load items into a chest until an arbitrary amount has been reached is trivial and doesn't even require any combinators: just hook up the receiving chest with the inserter and you're good.

Trying to do the same with trains, it seems that the train contents as reported by the station pole only return the cargo, that is, the content of the carriages, but not the fuel in the locomotive itself. I can load 17 wood into a carriage, but not into the locomotive.

darebakk
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jan 10, 2021 10:51 am
Contact:

Re: Fuelling a locomotive with conditions

Post by darebakk »

Laie wrote:
Sat Jan 16, 2021 4:39 pm
Asking here rather than starting my own thread: how does one check he amount of fuel present in a locomotive?

This doesn't seem to happen in the above examples, or if it does, I'm totally missing it. To me it looks as if the inserter will count fuel into the locomotive whenever it stops at the station, regardless of how much it already has in the bunker. If the set amount doesn't exactly match consumption, the locomotive will, in due time, either fill up or run out.

I'm only getting started with circuit network stuff, but setting up an inserter to load items into a chest until an arbitrary amount has been reached is trivial and doesn't even require any combinators: just hook up the receiving chest with the inserter and you're good.

Trying to do the same with trains, it seems that the train contents as reported by the station pole only return the cargo, that is, the content of the carriages, but not the fuel in the locomotive itself. I can load 17 wood into a carriage, but not into the locomotive.
Your observation is good - there is no check how much fuel is left in the locomotive. The trick is different, I will explain it in a second. I was only asking how to do the loading of a specific number of items into something, in this case into a locomotive. I didnt care what was left in the locomotive, because when it comes to the station, the fuel will always be low. How I know? Im using a mod called "Automatic Train Fuel Stop" which calls the locomotive only when the fuel is low, automaticaly. So I know, by experience, how much fuel is left (approximately) when the locomotive comes and I set a reasonable number to fill it up.

Post Reply

Return to “Gameplay Help”