need help on train-schedule-setup.

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
Kostriktor
Inserter
Inserter
Posts: 40
Joined: Sun Aug 21, 2016 12:58 pm
Contact:

need help on train-schedule-setup.

Post by Kostriktor »

hi !
a train carries iron-ore to the smelter.
there is several iron-ore-stations. they are all called "iron - 1"
there is a big train-deposit, called "hotel".

the quest is:
all trains want to "wait" in hotel, until there is iron-1 with full cargo.

how to set it up ?

i tried to use circuit on train-stop, with enable/disable. the trains have 2 wagons, i said enable when "iron-ore" ≥ 4000.
now the train runs trough hotel, to the smelter and back to hotel, ignoring iron-1 until it "turns on" when 4k iron-ore are reached.

i tried "send to train", which probably only sends to docked train, not across the map.

please help.

astroshak
Filter Inserter
Filter Inserter
Posts: 597
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: need help on train-schedule-setup.

Post by astroshak »

If you leave ‘Hotel’ on, and turn the Iron stations off when they do not have enough ore across all their chests, then one of two things will happen :

You either will not be able to meet the demand of the smelter, or you will.

If you do, if the trains are providing ore faster than the smelter can use it, you will have trains waiting to finish emptying before they leave Hotel.

If you do not, then the trains will circle around because their wait condition (until empty) has been met, but there are no open Iron stations to go to. So they leave, but come right back.

The first is what you want. If you are experiencing the second, set up more mining stations.

For each Iron mining station : wire all of the chests per Cargo Wagon to the input side of a Decider Combinator. Have that Decider Combinator output a signal (say, the color Green) of 1 (NOT input count, the other setting). Using the other color wire, connect all of the Decider Combinator outputs together, and to the Train Station. Set that Train Station to On when Green = (number of cargo wagons).

This only turns the Station on when there is enough ore distributed such that all of the Cargo Wagons would be filled. IE - if you have 3000 Iron for the first Cargo Wagon and only 1000 for the second, the Station would not open up, even though you have enough ore (4000) to fill both Cargo Wagons.

User avatar
Kostriktor
Inserter
Inserter
Posts: 40
Joined: Sun Aug 21, 2016 12:58 pm
Contact:

Re: need help on train-schedule-setup.

Post by Kostriktor »

thanks for the answer.
lets clarify this, hotel is not a waiting-room before the unloads in the smelter. hotel is a separate place, it should represent my train-garage, where all the trains are sleeping, getting maintained and fueled.
and yes, i can correctly enable/disable the train-stations, but that doesnt help.
what i need is the trains to stay still on their stop in hotel, until an iron-mine becomes enabled, then they should take the load, bring it to the smelters, and go back into hotel.
how ?

User avatar
valneq
Smart Inserter
Smart Inserter
Posts: 1150
Joined: Fri Jul 12, 2019 7:43 am
Contact:

Re: need help on train-schedule-setup.

Post by valneq »

Do you know that you can send circuit network signals over long distances? Connect large electric poles via red and green wires.

Locally at your mining site, you can use combinators to decide whether a train should come to this mining site. If the decision is "yes", you can send out a signal of the type of resource of the mining site with a value of "1" on, let's say, the green wires. [add:] Additionally, you can activate the train stop at the mining site. I had good experiences of setting two limits: one for the train stop at the mining site to be activated at about 90% of one train's cargo, and another at about 300% of one train's cargo to send out the resource signal on the green wire. [/add]

[edit:] When the hotel is connected via green wires to the mining site, its train stops can be connected to the green wires as well. Setting "send signal to train" on the train stops allows the trains at the hotel to see the signal from the mining site.[/edit] When the trains "wait for circuit condition" at the hotel, the trains could individually decide when to leave.

This is not originally my idea, saw it in various let's plays on YouTube.

User avatar
Kostriktor
Inserter
Inserter
Posts: 40
Joined: Sun Aug 21, 2016 12:58 pm
Contact:

Re: need help on train-schedule-setup.

Post by Kostriktor »

valneq wrote:
Wed Nov 13, 2019 8:05 am
When the trains "wait for circuit condition" at the hotel, the trains could individually decide when to leave.
sounds good !
i connect all the ore-chests with the mining-station, and then all the way to the hotel-station ?
in hotel i say wait for iron-ore ≥ 4k (for 2 wagons) ?
might try that, thanks !

plussantana
Inserter
Inserter
Posts: 33
Joined: Sun Aug 18, 2019 7:22 pm
Contact:

Re: need help on train-schedule-setup.

Post by plussantana »

Piensa en lo mas básico q se te ocurra respecto al tema de la forma mas anticuada te va a dar la respuesta. Es sencilla, como yo lo haría seria conectando el tren en la estación y dándole una condicional (if). Así también funciona (please translate this because muy google translate is broken)

User avatar
valneq
Smart Inserter
Smart Inserter
Posts: 1150
Joined: Fri Jul 12, 2019 7:43 am
Contact:

Re: need help on train-schedule-setup.

Post by valneq »

Kostriktor wrote:
Wed Nov 13, 2019 5:07 pm
in hotel i say wait for iron-ore ≥ 4k (for 2 wagons) ?
That may work if you have exactly one mining site per resource. However, if you have five different mining sites for iron, then just adding up all their chest contents onto the same network might give you a total sum of ≥ 4k, but each could have ≤ 1k.
Ideally, you would design your circuit network in a way that you can easily expand it by more mining sites, more resources, more hotel stations, more trains, etc.

One way to achieve this is to not send the exact count of iron onto the global network, but a signal of iron with the value 1 when your mining site needs a pickup. Then, the value for iron that the trains would see from the hotel station is not how much iron is there in total, but rather the total number of mining sites that want iron getting picked up. A waiting condition of iron>0 then means, as soon as a single iron mining site is ready for pickup, a train (or many) would depart. Obviously, once you have several trains dedicated for iron, you will need some buffer. For example: The mining site would send out an iron signal of 1 only when the contents of its chests is more than 4 full trains worth of iron. With two cargo wagons per train, that would be 16k iron. If then three iron trains depart from the hotel at the same time because one mining site needs a pickup, all three trains would still get a full cargo load of iron when they arrive at the mining site -- assuming that the train station does not deactivate before it has less than 1 full train's worth of iron.

With some more circuit magic for counting the exact number of trains that leave the hotel to pick up iron, you could reduce the buffers quite a lot.
However, the circuit logic becomes a bit more complicated.

In case you want to try to build such a circuit controlled rail network: do it. It's a lot of fun.

In case you want an easy to use and super flexible solution, you could check out the amazing mod "Logistic Train Network", in short LTN. Adding LTN to your game is a good option if you have dozens of trains picking up stuff from dozens of mining sites, smelting areas, and science production facilities. However, it is not a pure vanilla Factorio solution -- and reduces the fun of developing the circuit logic by yourself to practically zero.

astroshak
Filter Inserter
Filter Inserter
Posts: 597
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: need help on train-schedule-setup.

Post by astroshak »

Kostriktor wrote:
Wed Nov 13, 2019 3:51 am
thanks for the answer.
lets clarify this, hotel is not a waiting-room before the unloads in the smelter. hotel is a separate place, it should represent my train-garage, where all the trains are sleeping, getting maintained and fueled.
and yes, i can correctly enable/disable the train-stations, but that doesnt help.
what i need is the trains to stay still on their stop in hotel, until an iron-mine becomes enabled, then they should take the load, bring it to the smelters, and go back into hotel.
how ?
If all you have is one train for, say, Iron Ore .... then it should be a simple matter of connecting everything to the Logistics Network, all the outposts and whatnot.

At the smelter, have a Decider Combinator output Blue 1 when the contents of its chests drop below a specified amount.
At the mines, have a Decider Combinator output some other signal 1 (say, Yellow 1) when there is enough ore, as described above, to fill a train.

At the ‘Hotel’ area, have the train wait at Hotel until it receives a logistic signal. Two Decider Combinators are set up here, one reading the Blue (and outputting a third signal of 1, say, Green 1) (If Blue > 0, output Green 1), the other reading whatever signal you had for the mines (If Yellow > 0, output Green 1). Have the train leave the station when Green = 2.

That’s a lot of work for a centralized train depot. And I have no idea whatsoever how to have multiple trains for Iron Ore when setting things up like this - since you would want one train at a time, and not all at once, to be dispatched.

That’s why I prefer to simply have the trains waiting at the smelter area. I’ll have a refueling train pick fuel up where I’m making fuel (the first thing I set up when transitioning from the belt make everything base to a megabase) and I’ll have a drop off at various stations where trains are known to visit to offload or on load stuff, for refueling purposes. Trains tend to just wait in parking lots or in the station until it is clear to move, based on how empty or full they are.

Boniac
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Nov 14, 2019 11:36 am
Contact:

Re: need help on train-schedule-setup.

Post by Boniac »

Sorry for formatting I'm on my phone.

I think the simple answer is that you can have multiple stations with the same name.

Instead of iron1, Iron 2, etc, name them all "Load Iron". Keep the station turned off until you have just enough to fill a train. Then route your trains like so:
Load
Unload
Depo

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

Re: need help on train-schedule-setup.

Post by mrvn »

Boniac wrote:
Thu Nov 14, 2019 11:46 am
Sorry for formatting I'm on my phone.

I think the simple answer is that you can have multiple stations with the same name.

Instead of iron1, Iron 2, etc, name them all "Load Iron". Keep the station turned off until you have just enough to fill a train. Then route your trains like so:
Load
Unload
Depo
And then trains will constantly drive around between Unload and Depo. As already mentioned.

Deactivating stops alone only works with 2 scheduled stops. Any more and you need circuit logic to halt trains when the next station is deactivated.

Serenity
Smart Inserter
Smart Inserter
Posts: 1000
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: need help on train-schedule-setup.

Post by Serenity »

This mod allows you to set up depots pretty easily:

https://mods.factorio.com/mod/train-pubsub

wobbycarly
Fast Inserter
Fast Inserter
Posts: 241
Joined: Tue Jan 29, 2019 4:00 am
Contact:

Re: need help on train-schedule-setup.

Post by wobbycarly »

Or Logistic Train Network mod (affectionately known as LTN)

User avatar
Kostriktor
Inserter
Inserter
Posts: 40
Joined: Sun Aug 21, 2016 12:58 pm
Contact:

Re: need help on train-schedule-setup.

Post by Kostriktor »

now the idea with combinators and using signals is certainly the way to go.
and thanks for the mod recommendations but i want to "win" vanilla.

too bad i didnt pay attention in school...
what i want more is to learn how this logic-stuff works, because of course it will be useful elsewhere in life as well !!

so id send several signals to hotel.
fac1.jpg
fac1.jpg (22.45 KiB) Viewed 4649 times
and next like this ?
fac2.jpg
fac2.jpg (12.98 KiB) Viewed 4649 times

User avatar
valneq
Smart Inserter
Smart Inserter
Posts: 1150
Joined: Fri Jul 12, 2019 7:43 am
Contact:

Re: need help on train-schedule-setup.

Post by valneq »

So what you are doing now is
Set [Signal 1] = 1 at the mining site
Check [Signal 1] ≥ 0 at the hotel

You can do that, so you can keep the status signals from different mining sites for iron separated. Then [Signal 2] could represent a second mining site for iron. However, you will need to remember that [Signal 1] and [Signal 2] on this network represents iron ore.

How about changing this to

[Signal iron-ore] = 1
[Signal iron-ore] ≥ 0

Then you can add another iron mining site with the same setup. Then each could send [Signal iron-ore] = 1 to the hotel, resulting in [Signal iron-ore]=2.
When you add a different mining site for copper, your global network will carry two signals. Using [Signal iron-ore] = 2 and [Signal copper-ore]=1 is easier to interpret from far away. Imagine hovering over any power pole along the network and seeing the network's signals as [Signal 1]=2, [Signal 2]=1, [Signal 3]=5, [Signal 4]=1. Will you always be able to tell which of these represents iron, which represents copper, which is coal?

Just make sure that all your mining sites have train stations with identical names. Once your trains leave the hotel, they will go to any iron station that is not deactivated by circuit condition.
And make sure that the local circuit network counting the items in the chest at the mining site is not connected to the global circuit network sending [Signal iron-ore] = 1 to the hotel. Otherwise you end up with a [Signal iron-ore] = [item count in chests], which is almost always bigger than zero.

User avatar
Kostriktor
Inserter
Inserter
Posts: 40
Joined: Sun Aug 21, 2016 12:58 pm
Contact:

Re: need help on train-schedule-setup.

Post by Kostriktor »

boom !
that is it !
you gave me the right idea !
Logic is so logic once someone enlightens you !
thanks

so im getting this right ?
connecting the chests with green wire to constant-combinator as shown in image.
set an output-signal to when this station is ready. also enable station when load is ready.
redwire, the output signal all the way to hotel.
in hotel, the train departs when the signal comes in, and will go to the first enabled station, because the other ones are turned off.

this is brilliant, i go try

EDIT:
crazy ! it works !
now we need to figure out how not to send all of the trains at once

EDIT2:
so you mentioned putting hotel signal≥0.
so i could say, depart a train at signal=1, another train at signal=2, so maybe they dont run all together for 1 site ?
and thanks again valneq, made my day. understanding and applying logic gives you such a feelsgood

User avatar
valneq
Smart Inserter
Smart Inserter
Posts: 1150
Joined: Fri Jul 12, 2019 7:43 am
Contact:

Re: need help on train-schedule-setup.

Post by valneq »

Kostriktor wrote:
Fri Nov 15, 2019 4:21 pm
this is brilliant, i go try

EDIT:
crazy ! it works !
I don't claim that this is my original idea. As I said: I saw several people doing similar stuff.

One of them recently did a "base tour" as the final episode of his most recent Factorio series. There he explains fairly briefly how his train-based factory works:
https://www.youtube.com/watch?v=9TekgMJbcLE
He addresses the station designs in episodes 15–17.
Kostriktor wrote:
Fri Nov 15, 2019 4:21 pm
now we need to figure out how not to send all of the trains at once

EDIT2:
so you mentioned putting hotel signal≥0.
so i could say, depart a train at signal=1, another train at signal=2, so maybe they dont run all together for 1 site ?
and thanks again valneq, made my day. understanding and applying logic gives you such a feelsgood
First of all: Sorry I made a typo earlier. It has to be [iron ore] > 0 at the hotel. The =0 case does not help you at all.

The remaining question about all of them running at once is actually tricky. First question is: How many trains do you think you will actually need? In the Factorio Let's play series I linked above, the content creator is insisting that you normally don't need as many trains as you think you need.
And: the longer the train, the fewer rides will you actually need.

If you end up with only one train per item type: victory!
Otherwise you will need something like two or three trains with ~4 cargo wagons per item type. Depending on how many science packs you want to make per minute.

Furthermore: Note that a typical train station is able to hold enough items to fill up several trains: A steel chest can carry 4800 iron ore, a cargo wagon can hold only 4000 iron ore. With up to 12 steel chests per cargo wagon, that is about 14.4 full cargo loads. Loading the wagons from one side, you have still six chests. And even iron chests can have 3200 iron ore each. A station with six iron chests per cargo wagon can still hold around 4.8 full trains.

So what you could do: Just activate the outgoing signal [iron ore] = 1 from the mining site later, that is when your train station carries at least three full cargo loads. Then, even three empty trains leaving the hotel for the station because they all wait for [iron ore]>0 will still each be filled up. Even when your mining site produces almost zero items per second. When you have considerable production rates, your train station will start filling up more items while the first three trains are loading, and might have accumulated enough iron ore to fill a fourth train. Make sure there is enough space right in front of the mining site for the trains to wait. Train stackers are your friend here.

Make sure that the train station is not deactivated too early! It needs to remain active as long as it holds at least 90% of a train's cargo load.
And deactivate it, once it is below 90%. Thus, a train could arrive when it is at 90%, and while it loads the current production could be fast enough to fill the remaining 10%.

You also need to make sure that the full trains will all be able to unload at your smelting site, or wherever their cargo needs to go. Otherwise you could have another "holding" or "chillout" station, similar to the hotel. There the trains can wait again, now with full cargo, for a circuit signal coming from your consumption stations, that is smelters etc. Those could be on a green wire along the common global network. When connecting the train stations to the global circuit network, you just need to make sure you take the correctly colored wire.
In this example it would be red for supply (pickup), and green for demand (dropoff). Some people like to have green for supply and red for demand but whatever. You can do as you please.

To deal with six trains, you could increase the buffer even more: send out the signal [iron-ore]=1 only when your station holds at least six full cargo loads.

When you have many stations supplying ore, most of them will be deactivated for some parts of the time, and activated but not sending signals most of the time. Funnily enough: in this setup, one mining site could send out a red signal, but the trains go to different mining sites that are closer and not deactivated yet. As long as the trains get filled with iron ore and don't wait idling at mining sites, you don't really care.

I admit that this setup is maybe not optimal, but still "good enough". There will still be some useless routes that some trains make sometime, but meh. As I said: good enough. At least good enough to carry you to the infinite sciences. Once you only have the infinite sciences, you need to think bigger, and these deficiencies will be noticeably bad.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1644
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: need help on train-schedule-setup.

Post by Pi-C »

valneq wrote:
Fri Nov 15, 2019 7:27 pm
Make sure that the train station is not deactivated too early! […]

You also need to make sure that the full trains will all be able to unload at your smelting site, or wherever their cargo needs to go.
When I tried to build a smart rail network, I didn't deactivate stations at all. Instead, I used requests: stations that needed an item made a pull request for that item (e.g. ore/fuel for smelting; fluids or intermediate products for production; building materials for repairs; ammo), while stations that wanted to push out stuff (mining outposts, refineries, finished products) requested cargo (empty or partially empty) or fluid trains. I had to cope with problems like all empty cargo trains going to the iron mining site, getting filled, and being unable to unload, while no train would go to the copper mining site and every thing would be stalled. Therefore, I added some circuit logic that pushing stations would only request empty trains if at least one pulling station would request the item they had in store.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Gameplay Help”