Smart Train Deliveries with Combinator Magick [0.13/0.14]

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Innomin8
Inserter
Inserter
Posts: 21
Joined: Mon May 02, 2016 12:21 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Innomin8 »

Is there an easy way to convert this to a green network? I'm using the "new" version linked in the post, and I'm now at the situation where I'd like a second train network, and linking it to green seemed like the logical choice.. I don't really understand how it's all setup under the hood though.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Innomin8 wrote:Is there an easy way to convert this to a green network? I'm using the "new" version linked in the post, and I'm now at the situation where I'd like a second train network, and linking it to green seemed like the logical choice.. I don't really understand how it's all setup under the hood though.
You can put drivers in front of the depot and the outpost circuits that convert the red to the green signal. That will be a lot easier than actually converting the circuits (which is not possible unless you more or less understand them in detail).

What are your reasons for running a second train network? Are you sure you need to do that?

If it's about running oil, then there are easier solutions for that.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Malryn
Inserter
Inserter
Posts: 33
Joined: Fri Apr 22, 2016 7:33 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Malryn »

siggboy wrote:
Malryn wrote:Dumb question. What would be the reason a the depot train stations from your demo would not show "trainlines" when I load the blueprints to my game? I get stuck here as I cant find the rules to edit in
"Save the train line in the SmartTrains UI. Set the rule "go to signal #" in SmartTrains and save the updated line."
The smart trains GUI is in a separate window which is covered up by the Factorio train UI window. If you move the Factorio window you can access the SmartTrains stuff.

You need to select a train (not a station) in order to change the main train line. If you click on a station you can still edit the rules ("go to signal #) but not add or remove stations.

If you want to edit the train line (in SmartTrains), what you do is click on any of the trains on the line, make the changes there, and then save it in the SmartTrains window. That will take the schedule from the train and copy/update it in SmartTrains.
Also, can you show an up to date screenshot of the depot's "computer?" I try to find things such as the number of wagons and I just start doing best guess when following viewtopic.php?f=8&t=25311&start=140#p191365.
If you look at this post

viewtopic.php?f=193&t=25311&start=260#p201443

you need to check the stuff marked in yellow. The number of wagons is in the group of combinators on the right (two combinators marked with a yellow outline). The combinator that multiplies holds the wagon count (as a negative number, e.g. "-2" for two wagons, "-4" for four wagons etc.). The other one subtracts a value, you can leave that.

The orange combinators also have configs, but at first you don't really have to touch them, it only becomes important later when your setup grows really quite large or when you need to add special resources that are not in the default configuration (or if you play with mods).

Also, you should definitely take the blueprint from that post (linked above), I'm not quite sure right now if I put that version into the demo map already.
Derp. I knew it was something simple... thanks for helping out the those of us at the lower end of the learning curve :). I got further along with my set up but not it is still not being friendly with me :(. The odd thing is i noticed the combinators at the top are not cycling through the resources to check. Would completely shutting down all the train stations remove any stuck values that could be getting the system stuck? I spent 6 hours last night scratching my head on troubleshooting but no success :( I will try again tonight as i really want this system to work as it will save my butt from having too many trains running around as i am hoping my trains functions as a main bus for delivering all the major circuits, plastics, and metals to my assemblers.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Malryn wrote:The odd thing is i noticed the combinators at the top are not cycling through the resources to check.
Yes, that's because the value "G=x" is missing as explained a few posts above in response to turkish25.

Actually that is my mistake because it's missing from the blueprint (from viewtopic.php?f=193&t=25311&p=201443#p201443).

I've now fixed that blueprint, but you can simply add something like "G=60" to the combinator that has the value "I=1" (or any other combinator in that group). These combinators are at the top of the depot circuit.
I spent 6 hours last night scratching my head on troubleshooting but no success :(
I'm very sorry that you've spent so much time on this, because it really was my honest mistake when I created that blueprint. turkish25 ran into the very same issue, it's a pity that you've missed that post above where I explained the fix.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Malryn
Inserter
Inserter
Posts: 33
Joined: Fri Apr 22, 2016 7:33 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Malryn »

siggboy wrote:
Malryn wrote:The odd thing is i noticed the combinators at the top are not cycling through the resources to check.
Yes, that's because the value "G=x" is missing as explained a few posts above in response to turkish25.

Actually that is my mistake because it's missing from the blueprint (from viewtopic.php?f=193&t=25311&p=201443#p201443).

I've now fixed that blueprint, but you can simply add something like "G=60" to the combinator that has the value "I=1" (or any other combinator in that group). These combinators are at the top of the depot circuit.
I spent 6 hours last night scratching my head on troubleshooting but no success :(
I'm very sorry that you've spent so much time on this, because it really was my honest mistake when I created that blueprint. turkish25 ran into the very same issue, it's a pity that you've missed that post above where I explained the fix.
Sweet! I cant wait to test it out tonight then.

You have nothing to be sorry about. You are doing something awesome with this tool and you are sharing it with the community. It is my fault for not reading all the posts 100%. Making documentation sucks and you are doing this without getting paid lol.

Innomin8
Inserter
Inserter
Posts: 21
Joined: Mon May 02, 2016 12:21 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Innomin8 »

siggboy wrote:If it's about running oil, then there are easier solutions for that.
It was... my ore trains are 1-4-1 with regular wagons, and my oil trains are 1-2-1 with Rail Tankers.. I want to manage oil the same way as the ores, so I was thinking about running oil over the green wire. You said there's an easier way?

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Innomin8 wrote:
siggboy wrote:If it's about running oil, then there are easier solutions for that.
It was... my ore trains are 1-4-1 with regular wagons, and my oil trains are 1-2-1 with Rail Tankers.. I want to manage oil the same way as the ores, so I was thinking about running oil over the green wire. You said there's an easier way?
Yes, take the blueprints from this post: viewtopic.php?f=193&t=25311&start=260#p199724
(the explanation is in the post directly above it).

That will allow you to set up a separate depot and trainline for your rail tankers, and it will work over the same red wire as the main depot does (I've made it so it won't conflict).

This mini-depot is limited in functionality (no requester stations, among other things), but it's perfectly fine for running oil. You could also use it to transport other goods (e.g. a high priority train line to take coal to the power plant), but probably oil is the best way to use it.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Innomin8
Inserter
Inserter
Posts: 21
Joined: Mon May 02, 2016 12:21 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Innomin8 »

siggboy wrote:This mini-depot is limited in functionality (no requester stations, among other things), but it's perfectly fine for running oil. You could also use it to transport other goods (e.g. a high priority train line to take coal to the power plant), but probably oil is the best way to use it.

Will definitely play with it for the vanilla+ game, but I think I'll have to experiment with converting the main one to green, as I'm also thinking about using it in games where there are multiple fluids to deal with :)

Thanks for the creation anyway.. had a lot of fun using it, even with a few minor glitches (on occasion I've had a train try to go direct to depot from an outpost, but not sure why).

Malryn
Inserter
Inserter
Posts: 33
Joined: Fri Apr 22, 2016 7:33 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Malryn »

Good news! It started working but then i touched it again then it stopped working :lol: I didnt follow the rules and I added multiple provider and requester stations at once. It looks like my providers never got a number assigned to them so my train went to every provider station then went to the correct requesting station. I was wondering if we have the ability to hit a reset button on this button on the combinators. I was trying to clear the values as the thing said I had 835M coal, copper, coal, etc without having to demolish it. I tried cutting the power but the combinators held onto their charge even after the entire base was shut down :(. Would the ability to reset the values even help?

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Innomin8 wrote:Thanks for the creation anyway.. had a lot of fun using it, even with a few minor glitches (on occasion I've had a train try to go direct to depot from an outpost, but not sure why).
With the latest version I couldn't find any more glitches that were due to an error in the circuit. When something "weird" happened, it was always because I had made a mistake setting it up, or had a low power/power failure (that does mess with inserter-based counting), or I did something wrong in the SmartTrains setup.

So just carefully follow procedures when you make changes and set up the the train stations, and it should run fine.
Malryn wrote:Good news! It started working but then i touched it again then it stopped working :lol: I didnt follow the rules and I added multiple provider and requester stations at once. It looks like my providers never got a number assigned to them so my train went to every provider station then went to the correct requesting station. I was wondering if we have the ability to hit a reset button on this button on the combinators. I was trying to clear the values as the thing said I had 835M coal, copper, coal, etc without having to demolish it. I tried cutting the power but the combinators held onto their charge even after the entire base was shut down :(. Would the ability to reset the values even help?
The registers can be reset manually in two ways: either disconnect and reconnect the loop-back wire, or flip the condition on the decider (you flip it back to its original state, of course, the condition actually does matter). In both cases the combinators will forget their values.

I've thought about adding some kind of global reset switch which would put all the stations into their default state, maybe I'll do that at some point.

When you set up stations, it's always good to add the station to the end of the SmartTrains schedule immediately after you've set up the blueprint, before you've done any adjustments and before you've connected power or the red wire bus. Just blueprint the station and then add it so it will receive the station number and it will be on your trains schedule.

Then you adjust the resource parameters and you can connect the station.

Just never, ever connect a station to the red wire bus if it's not in the SmartTrains schedule yet, because that's just an invitation for problems.

It helps to temporarily disable the depot, so no trains will leave. Then you can pick any train, update the train line, and re-enable the depot. This will ensure that all the trains will receive the new schedule (SmartTrains only updates it when a train leaves or enters a station, not immediately).

If you actually want to add several stations at once, and maybe even remove old ones or change the order of the stations, you have to suspend (disable) the depot, then wait for all the trains to return home, and then you can completely change the train line and save it before you resume the depot again.

To disable (suspend) the depot, you simply disable the constant combinator that outputs "S=1", it's at the left edge of the depot. The lamp will turn red if you do that, to indicate a suspended depot.

It helps to have the "Drones" mod, that will allow you to jump to your depot without actually moving the player character there. Great mod in any case.

The phenomenon of having large values (like 700M of something) in the registers is just due to the fact that they have no station number yet and then react to inputs from the red wire without knowing "who they are". However, if that happens while you're still working on the station it's not really a big deal, since you can simply reset the register manually after you've added the station the the schedule.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Malryn
Inserter
Inserter
Posts: 33
Joined: Fri Apr 22, 2016 7:33 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by Malryn »

Thanks!

Is there any limit on how many trains can be in the network? My guess is 10.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Malryn wrote:Thanks!

Is there any limit on how many trains can be in the network? My guess is 10.
10 trains is nothing, even if it's only 2-wagon trains and your train network is crappy that's still a piece of cake.

I've run 20 on a map in 0.12 and it could have been many more. The depot can easily launch 1 train per second, of course it depends on how many outposts you have, but the real constraint is how well your railroad is designed, not the depot or the circuit.

I think if you have 4-wagon trains you can easily make 1 rocket per minute even if you distribute your entire base into mini-factories. Personally I have not attempted that, but my 20-train base could consistently manufacture more than 1 rocket per 3 minutes, so I'm quite sure it could have scaled quite a bit higher (the base wasn't really made for effective rocket production after all). That was in 0.12 and trains were not as effective as in 0.13, where you have stack inserters and larger wagons.

Keep in mind that due to the efficient use of the trains, if you have 20 trains LL-CCCC, that's a lot of resources you can ferry around, because there really are no train redundancies at all. As far as the rail network is concerned, 20 trains is really not a lot. Some large setups run way more than 100, but that's necessary because you can not really optimize the assignment of trains in a "conventional" train setup.

Of course, at some point the depot will be a bottleneck, after all the trains all have to go through a single point after each delivery. The actual limit depends on a lot of things, so it's really difficult to model.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

turkish25
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Sep 17, 2016 2:00 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by turkish25 »

Hey Siggboy,

Cancel, it was my error. Was very tired last night. Top tip, always check red wire is connected!!! :oops:
Last edited by turkish25 on Fri Sep 30, 2016 5:03 pm, edited 1 time in total.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

turkish25 wrote:Hey Siggboy,

Hit another stumbling block, everything running smooth. just installed my 22nd station, the refinery. added to smart trains, only shows in the one train i updated it in itinery (the one on the left in the depot)
The individual train schedules are updated, by the SmartTrains mod, when a train leaves or enters a station. The mod will copy the schedule to the trains from its own configuration.

If you want to force an update, you can unassign and then reassign the train to the train line, via the SmartTrains UI.

The safest way to update the train line, if you want to make absolutely sure, is to suspend the depot, then add the station to the END of the schedule on any train in the depot, then save the updated line, then re-enable the depot.

There really is not much more to be said about this, as it's handled by the mod and not in any way connected to the circuits.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

turkish25
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Sep 17, 2016 2:00 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by turkish25 »

Cancel, it was my error. Was very tired last night. Top tip, always check red wire is connected!!! :oops:

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

Don't worry about it, I've made all these mistakes myself :).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

doxsroxs
Fast Inserter
Fast Inserter
Posts: 160
Joined: Mon Aug 01, 2016 4:19 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by doxsroxs »

Hi again

Im sorry to say, but its broken and I cant seem to fix it :o :lol:

This is the current situation:
246 stations in the network
Depot train stop value set to 300
T value set to 320
G value for materials set to 195, dont know exactly how many active materials we got, but its a bunch (13 chests, most full)

Issues started cropping up this weekend, cant remember exactly when. But I started noticing lost trains.
After a lot of error checking I found out the provider stations do not signal R to the train so it will just wander off.
Im pretty sure its not station specific, since I have found some stations still seem to work, so I would say it is intermittent.
However, this issue suddenly hit very old stations that have been working for maaany hours without issues.

After some testing I have found the stations malfunctioning does not save any information in the register when a match is made, usually I see all sorts of stuff and the R number being saved in one of the middle combinators is easy to spot.

I initially thought this might be related to station numbers. So tested by rebuilding staton number 2, it fails even though I use a blueprint I have been using literally hundreds of times.
At the same time, certain other stations still work.

The only major things that have happened lately is that I added a few materials on priority spots 56 to 59 in the priority combinators. (they where previously empty slots)
We have also been adding some new stations.

But apart from that Im not quite sure whats going on, I cannot say with 100% certainty that I did nothing wrong, but I do think I have enough experience with this system to find the most obvious issues pretty fast.

Any tips on what to look for? The bus values seem to work like usual and it matches stuff now and then even though our entire base has literally ground to a halt.
Current value on the bus is as follows, remember the O signal is something I use as a signal for mixed ore:
Image

Ill do some more testing, but any tips for things to look for would be awesome. I have a hunch that it might be related to the requesting station, but Im not sure since those have also been working for quite some time prior to this stop.
Send train to station ID using combinator signal is a long overdue feature!
viewtopic.php?f=6&t=74663

doxsroxs
Fast Inserter
Fast Inserter
Posts: 160
Joined: Mon Aug 01, 2016 4:19 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by doxsroxs »

Hi again

Further testing with a new test station and a material I have not otherwise used on the bus.

Built from blueprints, removed the stuff, and made them request and match:
Image
No problems in the requester, it correctly saves that it is promised 31k cans of ferric chloride and that it will receive it from provider station 246.
Now when I look at the provider however, its not as much fun, it has saved no information in the register that I think should contain it:
Image

Any ideas?
Send train to station ID using combinator signal is a long overdue feature!
viewtopic.php?f=6&t=74663

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

doxsroxs wrote:Any ideas?
As your provider you use the old version, which does "Everything > 0" in the decider (register). This will break if any signal on the red wire is negative while the protocol is running (the register will then not hold any value).

You need to use the version that does "E = 0" as the condition in the register (the rest is unchanged).

Also, looking at your signals, the sum of "P" signals during phase one is negative. This should not be possible, as all station numbers are positive. So there is some wrong station number in your network, and that yields a negative value on the red wire, which triggers the bug in the provider stations that you are using.

So you should use the fixed version of the provider and also find out where that large negative "P" value during phase one comes from.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

doxsroxs
Fast Inserter
Fast Inserter
Posts: 160
Joined: Mon Aug 01, 2016 4:19 pm
Contact:

Re: Smart dynamic train deliveries with combinator Magick [0.13]

Post by doxsroxs »

Awesome, thanks!

Im sure the negative value is due to something I did, Ill just have to review them. I did use negative station numbers trying to disable some stations earlier. (should not go on the bus, but mistakes happen so Im sure its me)
Nice catch on the provider, I must have missed that when I updated my blueprints, Ive had to do this when changing power poles etc as well as my modifications I did earlier. (Im on iteration 13 in my design...)

Im sure I can resolve this now, I do have a few provider stations to review to ensure none are left that are sensitive to negative values... :lol:
Hmm, maybe around 120? :| :o :shock: :? Going to be a looong ride around the network :lol:

Edit

Just tested and it works now, just need to check the system. However, in the register for the provider it cought a signal of 2,2 million satellites, which is not what I used... Im a bit confused as to how it could end up there when the station was making a match for ferric chloride canisters...? :lol:
Send train to station ID using combinator signal is a long overdue feature!
viewtopic.php?f=6&t=74663

Post Reply

Return to “Combinator Creations”