Page 1 of 1

Read train contents from locomotive

Posted: Tue Mar 27, 2018 7:40 pm
by OilBrush
Hi!

When connecting trainstops to circuit network you have option to read contents from train. However this feature does not take into account locomotive's fuel supply. I suggest this feature to be divided into "read contents from cargo" and "read contents from locomotive". Why? The possibility to monitor locomotive's fuel supply would make possible to automate train refueling by using decider combinator for example. Setting decider combinator to enable refueling trainstop when fuel level drops to certain level would make train refueling quite easy and hassle free.

Let me know what you think!

Re: Read train contents from locomotive

Posted: Wed Mar 28, 2018 2:12 am
by Hedning1390
If you place a fuel chest next to the station and insert the trains from that chest you can read its content for your signal.

Re: Read train contents from locomotive

Posted: Wed Mar 28, 2018 3:27 am
by Tekky
Related suggestion thread:

viewtopic.php?f=6&t=51387 Rail car/locomotive scanners

Re: Read train contents from locomotive

Posted: Fri May 03, 2019 10:34 am
by Gradenkos
Hedning1390 wrote:
Wed Mar 28, 2018 2:12 am
If you place a fuel chest next to the station and insert the trains from that chest you can read its content for your signal.
How is this a solution???
This mod is a solution: https://mods.factorio.com/mod/Inventory%20Sensor
Tried the mod and it's too slow... An inserter wil already insert fuel in the train before the 'inventory sensor' senses the contents of the locomotive.

(I made the same request viewtopic.php?p=427229#p427229 as my search in the forum looked for the word station...)

Re: Read train contents from locomotive

Posted: Fri May 03, 2019 1:42 pm
by Darinth
Can we get something more specific about what you're trying to accomplish? I can think of several ways to automate train refueling without needing to know the exact quantity of fuel in a train. In my experience, it's generally for the best for an inserter to simply keep a full stack of fuel in a locomotive. At that point, as long as each train goes through an outpost that has refueling capabilities on a regular basis, they should be able to just be automatically refueled without any need for a dedicated depot or reading the fuel contents.

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 5:32 am
by DraculBloodaxe
So I was refueling my train at this station where it also loads up on fluid. I've encountered a small problem that unless I also specify a time wait condition. It could at some points leave the station. Filled up on fluids but with less fuel added then the amount it uses for the trip. This eventually lead to it being without fuel.

Now, there are a few things I did that help prevent this from happening again. (Like adding a "and time passed" condition) but ideally I would be able to check that it has enough fuel to make the trip before leaving so I waste the minimum amount of time. (Could be done with an extra wait condition or with the circuit network)

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 6:54 am
by boran_blok
you could add an inactivity check for 5 seconds.

Adding fuel resets this, so your train will wait as long as fuel is being added.

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 7:44 am
by DraculBloodaxe
boran_blok wrote:
Mon May 20, 2019 6:54 am
you could add an inactivity check for 5 seconds.

Adding fuel resets this, so your train will wait as long as fuel is being added.
Didn't think of that. Thanks!

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 10:38 am
by JimBarracus
Darinth wrote:
Fri May 03, 2019 1:42 pm
Can we get something more specific about what you're trying to accomplish? I can think of several ways to automate train refueling without needing to know the exact quantity of fuel in a train. In my experience, it's generally for the best for an inserter to simply keep a full stack of fuel in a locomotive. At that point, as long as each train goes through an outpost that has refueling capabilities on a regular basis, they should be able to just be automatically refueled without any need for a dedicated depot or reading the fuel contents.
I think he wants to fuel the trains as little as possible to not "waste" fuel sitting in the train for ever.
You usually use less than 5% of the stored fuel before you are back at your station which has a requester box for fuel.

Another use could be a central fuel station. Where trains only go, when there is only little fuel left.
A train full with nuclear fuel can drive for 134 minutes before it runs out of fuel (2016.67s per unit, three in stock, one in use)
Refilling a train every few hours would be nice and would save us the fuel distribution.

I think this would improve the way we can optimize the train system. Its about automation. What could be better than sending trains to refuel when needed.
Sure there are two types of people.
Some top of their car when the light comes on.
Others refill just enough to get to work the next day.

Times a filled up train can run for
wood (301 total) 16.5 min
coal (151 total) 16.78 min
solid fuel (151 total) 50.3 min
rocket fuel (31 total) 86.1 min
nuclear fuel (4 total) 134.4 min

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 1:23 pm
by mrvn
The problem with activating/deactivating a fuel station depending on a trains fuel load would cause all other trains to also go to refuel if only one of them is low on fuel. So really not helpful.

Reading the trains fuel load only makes sense in the refuel station or when we have a "skip next stop" or "goto stop X on schedule" signal.

I think what would be useful is to adopt something from AAI vehicles. They have a signal showing the amount of fuel in a vehicle in MJ. That's a purely virtual signal and independent of the fuel type. Put in 1 wood and you get 4MJ, put in 1 coal and you get 8MJ and so on. One benefit of this would be that you can put in nuclear fuel and get 1210MJ. Then when it drops below 100MJ you add the next one. Instead of loading up the locomotive with 6+1 nuclear fuel.

Re: Read train contents from locomotive

Posted: Mon May 20, 2019 3:03 pm
by urza99814
The bigger issue IME is that the full/empty cargo conditions don't account for fuel. So you have a train that unloads at your base and leaves when empty, and it refuels at the same stop. But if something stops -- mine depletes or base gets full and backs up or whatever -- the train never stops, never refuels, and ends up stuck somewhere in the middle of the tracks. So to get the most efficiency out of your load/unload, you have no choice but to destroy that efficiency again by building a separate fuel station that the train always goes to. Otherwise it'll eventually run out of fuel. The only other option is to skip the full/empty conditions entirely and use idle time for everything, so the train stops even if it doesn't need to.

Re: Read train contents from locomotive

Posted: Wed May 22, 2019 5:53 pm
by mrvn
urza99814 wrote:
Mon May 20, 2019 3:03 pm
The bigger issue IME is that the full/empty cargo conditions don't account for fuel. So you have a train that unloads at your base and leaves when empty, and it refuels at the same stop. But if something stops -- mine depletes or base gets full and backs up or whatever -- the train never stops, never refuels, and ends up stuck somewhere in the middle of the tracks. So to get the most efficiency out of your load/unload, you have no choice but to destroy that efficiency again by building a separate fuel station that the train always goes to. Otherwise it'll eventually run out of fuel. The only other option is to skip the full/empty conditions entirely and use idle time for everything, so the train stops even if it doesn't need to.
Huh?

If you set the train to wait till full it will never leave empty and it you set it to condition empty it will never leave with stuff. That means it will always load and unload a full cargo wagon. Plenty of time to refuel. If the mine depletes then the train will wait there. If the base gets backed up then the train will wait there. At no time will it drive around empty or full endlessly.

Now things differ if you start disabling stations because then you get the thundering herd. With that trains will, drive somewhere but fail to get a spot and then return empty (or full). So at the station that's always enabled you have to add "inactivity 2s". Or just build more mines so you don't have a thundering herd but rather trains waiting to be unloaded. Better for the rail system overall.

Re: Read train contents from locomotive

Posted: Wed May 22, 2019 6:38 pm
by csduff
If a mod solution is the way to go, then there is really nothing better than this one.

https://mods.factorio.com/mod/FuelTrainStop

Train low on fuel? Fuel Stop is added to the schedule with 2 seconds of inactivity condition. After leaving, Fuel Stop is removed from schedule.

Re: Read train contents from locomotive

Posted: Thu May 23, 2019 9:33 am
by mrvn
csduff wrote:
Wed May 22, 2019 6:38 pm
If a mod solution is the way to go, then there is really nothing better than this one.

https://mods.factorio.com/mod/FuelTrainStop

Train low on fuel? Fuel Stop is added to the schedule with 2 seconds of inactivity condition. After leaving, Fuel Stop is removed from schedule.
Now that the game has temporary stops I wonder if that mechanic could be used instead of scripting the removal part.

Re: Read train contents from locomotive

Posted: Thu May 23, 2019 12:58 pm
by csduff
mrvn wrote:
Thu May 23, 2019 9:33 am
csduff wrote:
Wed May 22, 2019 6:38 pm
If a mod solution is the way to go, then there is really nothing better than this one.

https://mods.factorio.com/mod/FuelTrainStop

Train low on fuel? Fuel Stop is added to the schedule with 2 seconds of inactivity condition. After leaving, Fuel Stop is removed from schedule.
Now that the game has temporary stops I wonder if that mechanic could be used instead of scripting the removal part.
Maybe. The mod author has updated it for 0.17.

I'm not familiar with writing mods for Factorio, so I'm not sure what mechanic he is using. Who knows, maybe it was the inspiration for how the devs implemented the temporary stops.