[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

The tagging thread has some interesting ideas, added it as anissue so i don't forget :D

SmartTrains managed IDs would probably be the simplest solution, it's "just" one more signal to output to the combinator. Adding (multiple) signals/values via circuit would need a third proxy entity (another lamp or maybe a decider combinator)
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

I'm all for adding this to SmartTrains, since it would finally be a good way to recognize trains. Currently some designs are not possible because you lose track of the train as soon as it leaves the station.

How would you write new tags to the train? The lamp is already reserved for a different purpose.

One of the ideas was to use the rails for reading and writing train-related information. What do you think of actually doing that with SmartTrains? You could get rid of the combinator at the station, and instead make the rails smart. This is a far-reaching suggestion, but if the game offers the API it might be better than what we have right now (and it would not be against the spirit of SmartTrains and not out of scope, either).

If you use the rails, they would have to be put into a read-mode and a write-mode, otherwise one would have to add input and output ports, that's probably not possible.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

siggboy wrote:How would you write new tags to the train? The lamp is already reserved for a different purpose.
Another lamp would be added. I'd need a way to read signals depending on a condition (write signal), that's what lamp/decider combinator offer :D
siggboy wrote:One of the ideas was to use the rails for reading and writing train-related information. What do you think of actually doing that with SmartTrains? You could get rid of the combinator at the station, and instead make the rails smart. This is a far-reaching suggestion, but if the game offers the API it might be better than what we have right now (and it would not be against the spirit of SmartTrains and not out of scope, either).
If you use the rails, they would have to be put into a read-mode and a write-mode, otherwise one would have to add input and output ports, that's probably not possible.
I haven't checked, but i doubt rails support wires connected to them, so it probably would mean an invisible entity. which probably ends up being messier than the combinator
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Choumiko wrote:I haven't checked, but i doubt rails support wires connected to them, so it probably would mean an invisible entity. which probably ends up being messier than the combinator
Let's assume rails don't support wire connections and that it's not going to be added to 0.13.

So we'd have an invisible entity, but that does not seem to be feasible.

Could we maybe add a modded rail signal? That is circuit connectable and it's associated to a rail/block/segment. Then the magic rail signal would get the capabilities we need (read/write to a wagon/locomotive that is on its rail segment).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 302
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by justarandomgeek »

siggboy wrote:
Choumiko wrote:I haven't checked, but i doubt rails support wires connected to them, so it probably would mean an invisible entity. which probably ends up being messier than the combinator
Let's assume rails don't support wire connections and that it's not going to be added to 0.13.

So we'd have an invisible entity, but that does not seem to be feasible.

Could we maybe add a modded rail signal? That is circuit connectable and it's associated to a rail/block/segment. Then the magic rail signal would get the capabilities we need (read/write to a wagon/locomotive that is on its rail segment).
The only thing that can write bulk arbitrary signals from lua to circuit networks is a constant combinator.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

I am currently slowly updating the Readme/Manual, if anyone wants to add text snippets, images feel free to create a pull request or post here. Documentation is such an annoying part, but i guess it must/should be done before a release on the portal :? :D
https://github.com/Choumiko/SmartTrains ... /README.md
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Choumiko wrote:I am currently slowly updating the Readme/Manual, if anyone wants to add text snippets, images feel free to create a pull request or post here.
I'll be happy to help with the documentation. I guess we can also make pull requests in that regard after you've released to the mod portal?
The only thing that can write bulk arbitrary signals from lua to circuit networks is a constant combinator.
I thought, since the new rail signals also write to the circuit network if asked, maybe it's possible to mod them and output additional signals. Or maybe one could add a constant combinator as an invisible entity to the modded rail signal?
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

siggboy wrote:This looks very nice. BTW this is the wrong thread for this, but please make a post to the thread that I've started and maybe post a blueprint/demo map of your system there, we would really like to try it.

I don't know if you have looked at the old version of my system (that is documented on the front page), or the newer version (version 2). I have still not updated my documentation for version 2, but it does have two kinds of stations, "requester" and "provider", what you call "unload" and "outpost". The depot will release a train when a requester needs a product and there's a provider that has it in store. The requesters also keep track of incoming resources, so the trains will be efficiently distributed (there will be no "oversupply" of resources). In 0.13 I will also allow the providers to have more than 1 resource type in stock, the inserters will select the correct resource to load when the train arrives.

I do not count trains, I count the resource amounts directly. So when the train leaves the depot to pick up 6000 iron from P and deliver it to R, then R will be notified that it will receive 6000 iron. It will then subtract this 6000 from the amount it requires (because it will soon be incoming). Only if it consumes the iron really quickly it's possible that a second train will be requested (before the first one has arrived with the 6000 iron). This avoids the problem that you have 4 trains with 6000 iron each sent all to the same requester very rapidly (and then it has too much and other requesters can starve).

Your system is very advanced in the train distribution, because you do not require the trains to run through the depot. They can go from an unload to a provider directly, and you even take distance into account. This is very efficient, but I imagine it's difficult to set up in a real game.

I think in my system (and in the systems made by other people who have posted), the bottleneck can be the depot, because the trains always need to go there. In my latest version (also not published), I can have multiple lanes in the depot, so it's possible to release a lot of trains very quickly. They still all have to go there, and it will become a limitation with many trains.
Thanks for tips and links to other thread. So I will post my stuff there.
Now made my second version of system working (but without supplying outposts from base), but I had an issue, that stucked me for quite long time, so I had decided to write a mod called CircuitLogger for logging wire signals. It is wery nice to see exactly what is "in the wire" tick after tick. There is a link: https://mods.factorio.com/mods/xmnovotny/CircuitLogger . And best thing is that the issue was caused by short electricity shortages from peak consumption. :-)
siggboy wrote:How do you solve the refueling problem, if you cannot guarantee that your trains run through the depot?

I check fuel level at unloading stations and if it's low I send train directly to refueling station (defined in constant combinator at each unloading station) and then to the depot.

Now I'm going to holidays and when I come back, I'll made demo save of my system and some blueprints.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

xmnovotny wrote:I had decided to write a mod called CircuitLogger for logging wire signals. It is wery nice to see exactly what is "in the wire" tick after tick. There is a link: https://mods.factorio.com/mods/xmnovotny/CircuitLogger .
This is very, very helpful, I will try it out right now.
And best thing is that the issue was caused by short electricity shortages from peak consumption. :-)
That's why I develop and test my complicated circuits in sandbox maps with unlimited energy and other goodies :). Although some issues you only see when you go into a real game.

Actually the fact that you can get into trouble because the combinators don't get enough electricity is something that never occured to me; but it's true, of course, since they work slower then. Some of the problems I did have in the past (in the real game where I tested my stuff), could actually have come from this.

Overall, my system should not be affected by combinators being slowed down; at least I try to avoid designs that require that (they're usually very difficult to debug even if everything runs at 100% speed).
Now I'm going to holidays and when I come back, I'll made demo save of my system and some blueprints.
Nice. Another thing that interests me is how large your circuits are (i.e. how many combinators per unload/outpost and main CPU). I imagine that your design requires quite complicated circuits at the outposts.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

siggboy wrote:Another thing that interests me is how large your circuits are (i.e. how many combinators per unload/outpost and main CPU). I imagine that your design requires quite complicated circuits at the outposts.
Yep, my design require quite a lot of combinators. Now my outpost has cca 45 combinators, unloading station 56 + 30 (my unloading station has two smart stops - they are one train length apart. First one is used for unloading items, at second one train waits until it's needed at outpost or until another train arrives to the first station - then that train is sent to the depot.
Depot requires 23 combinators.

And it is distributed system, so I have no CPU.

Maybe there is a possibility to reduce amount of combinators, but now I can't do this.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Yeah, that's crazy, completely out of the question for me :).

I have 50 combinators at my depot (CPU), and it's not optimized and suffers from some limitations of the current combinators.

Requester has 10 combinators, provider has 15. It's about the limit of what I consider "practical".

I'm pretty sure you can downsize your circuits A LOT. You'll be amazed at what's possible if you put enough thought into it (after I've published version 1 I was convinced it cannot be shrunk any further, but that was, of course, a foolish assumption).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Choumiko wrote:
siggboy wrote:OK, so if my train is currently waiting at the Depot (for a signal), and I add a new station to the line, will the train know about that new station when it leaves?
I'm answering with a careful yes. When leaving it gets the signal value, then checks if the line needs updating and updates and then does the jump. So it should work, if not it's a bug.
OK, I'd like to report this bug now :).

If I update a waiting train (at the depot) with a new station, then save the updated line in ST, the other trains do not know about the new station when they leave.

I have to remove/add the trains manually to the line for them to get the update.

It would be rather important for my purposes to have this fixed, because updating all trains manually after a line change is not practical in my case (probably breaks a lot of other setups, too).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

siggboy wrote:OK, I'd like to report this bug now :).

If I update a waiting train (at the depot) with a new station, then save the updated line in ST, the other trains do not know about the new station when they leave.

I have to remove/add the trains manually to the line for them to get the update.

It would be rather important for my purposes to have this fixed, because updating all trains manually after a line change is not practical in my case (probably breaks a lot of other setups, too).
Should be fixed here

SmartTrains 0.4.3 https://github.com/Choumiko/SmartTrains ... tag/v0.4.3

The whole line updating is a bit strange depending on how much the line changes: adding/removing a single station to/from the end of the schedule, changing wait conditions/ goto rules for multiple stations should work properly. Removing/adding a station somewhere in the schedule is likely going to mess up the goto rules, so better check them after such changes.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Choumiko wrote:Should be fixed here

SmartTrains 0.4.3 https://github.com/Choumiko/SmartTrains ... tag/v0.4.3
You're spoiling us with the quick updates. I now grow impatient when you haven't fixed something after 24 hours :).

Thanks a lot.
Removing/adding a station somewhere in the schedule is likely going to mess up the goto rules, so better check them after such changes.
Yeah, it was the same in 0.12, but then I have never removed something from the middle, I only replaced it -- because changing all the station numbers would have been a no-no anyway.

Now that it's possible to actually do that (because the train station outputs the number; great feature BTW I'm already using it), it would be great if the goto rules could be updated accordingly -- it's not high priority for me because I have "goto signal #" everywhere, but it's something that can cause a lot of grief if you don't know it (especially if you use static station numbers in the goto rules).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Aes Sedai
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Jan 08, 2016 12:37 am
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Aes Sedai »

Uhh, added SmartTrains 0.4.3 to a 0.13.11 save and had a few script errors pop up:
__SmartTrains__/gui.lua:918: attempt to get length of field 'records' (a nil value)
__SmartTrains__/gui.lua:366: attempt to index field 'records' (a nil value)
__SmartTrains__/control.lua:1181: Error while running event handler: __SmartTrains__/gui.lua:366: attempt to index field 'records' (a nil value)

The first one happened when I tried to save a train line. The others just kind of happened after.

EDIT: Had another bug appear when I tried to remove a regular train stop that was placed by robots:
__SmartTrains__/control.lua:1304: bad argument #1 to 'pairs' (table expected, got nil)

Link to error log: https://drive.google.com/open?id=0ByjNo ... FRHc2UwanM
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Choumiko »

Did you try creating a line from a train that had no stations in the schedule?
The log shows 2 Trainlines without stations in it, these are causing all the following errors. I'm afraid you'll have to disable Smartrains, and do the load/save/reenable SmartTrains stuff, since i just relized that the console command won't work anymore :roll:

Proper fix will follow tomorrow (i hope)
Aes Sedai
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Jan 08, 2016 12:37 am
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Aes Sedai »

There were stations on the train schedule the first time I tried to make a trainline. I noticed that the 'Read from UI' button from the older 0.12.x version seems to have been done away with, so I had assumed that it would automatically read the schedule from the train when I clicked 'Save as line' on the ST side window.
As a side note, the errors are thrown everytime I have any train window open, so I have to quickly alter the schedules for new trains or be overrun by the console logs and beeps :P

EDIT: Just tried the disable / load / save / enable dance and it still throws those errors. Made sure that the train had a schedule this time.
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Bizobinator »

I'm a little bit confused what the purpose of lines is? I usually only produce enough resources at a mine-site to warrant a single, 2-container train.

Lol: Everyone is doing all these fancy things, and here I sit, just using it to make sure my trains have enough fuel :|
Aes Sedai
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Jan 08, 2016 12:37 am
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Aes Sedai »

Bizobinator wrote:I'm a little bit confused what the purpose of lines is? I usually only produce enough resources at a mine-site to warrant a single, 2-container train.

Lol: Everyone is doing all these fancy things, and here I sit, just using it to make sure my trains have enough fuel :|
Using the RSO mod to spread resources out makes trains much more useful. I have an iron patch that's a two minute train ride away, and it's much easier to simply add more trains to get a lower Load Station to Unload Station lag time, which means I can usually employ my furnaces more often instead of having them work in bursts. If you don't have a need for more than a couple of trains per route, then lines won't be as useful. I don't want to have to setup and modify the schedule for six trains and hope I don't mess up a wait condition somewhere haha.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.35|0.13] SmartTrains 0.3.95|0.4.3

Post by Choumiko »

Updated to SmartTrains 0.4.4
  • fix adding a new line
  • fix hardReset to properly initialize
Seems like i should not only try changing lines but also adding new ones :D
Bizobinator wrote:I'm a little bit confused what the purpose of lines is? I usually only produce enough resources at a mine-site to warrant a single, 2-container train.

Lol: Everyone is doing all these fancy things, and here I sit, just using it to make sure my trains have enough fuel :|
Yes, trainlines in 0.13 might not be as usefull for smaller/vanilla ressource maps. Back in 0.12 trainlines offered the conditions that are now vanilla.
Post Reply

Return to “Mods”