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.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Version 3 for 0.13 (beta)

Post by siggboy »

doxsroxs wrote:For example, setting up the Depot, I cannot get a light indication from the first train when I send it to the depot as per your instruction post.
If you don't copy the lanes exactly from the demo map, then you have to set up the lane number and signal for each lane.

Let's say you've blueprinted 3 lanes, separately, and connected all the wires to the depot.

Then, for each train station (each lane), you have to go through the combinators and set the lane signals.

For example, for lane "2" the top combinator needs to do "signal 2 + 0 => output D" and the bottom one needs to do "train-at-station * 2 => output signal 2".

It's very obvious when you look at it in the demo map.

You can also make a combined blueprint of all 3 lanes in the demo map and then just use that for a 3-lane depot, if you don't want to reconfigure this manually.

Also maybe I should post a simpler version without multi-lane at all.
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 »

This is the current status:

Depot brain:
I have no idea what R3 and P2 means.
48k is a full trainload. I have 6 depot lanes, still not indicating with any of the ground lamps.
Image

I have one requester station set to request when under 100k, looks like this and was installed according to the checklist you provided earlier in the thread.
Instead of hooking it to unloading chests I got it connected the the buffer for copper that currently has around 32k in it. Constant chest is set to -100k copper. Combinator just under the chest outputs 1 coppper.
Signal on red bus is 48k copper D1.
Image

Here is the provider station:
It has 230k copper in the chests, cant really see anything wrong with it. Set up according to checklist.
Limit in lower right combinator is set to 48k.
Image

Any ideas? Im not even tired and have gone through this something like 10 times but Im obviously doing something wrong.
I have tried with fresh blueprints from my earlier working game and straight from the demo rebuilding all the stations each try to avoid faulty signals etc.
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: Version 3 for 0.13 (beta)

Post by doxsroxs »

siggboy wrote:
doxsroxs wrote:For example, setting up the Depot, I cannot get a light indication from the first train when I send it to the depot as per your instruction post.
If you don't copy the lanes exactly from the demo map, then you have to set up the lane number and signal for each lane.

Let's say you've blueprinted 3 lanes, separately, and connected all the wires to the depot.

Then, for each train station (each lane), you have to go through the combinators and set the lane signals.

For example, for lane "2" the top combinator needs to do "signal 2 + 0 => output D" and the bottom one needs to do "train-at-station * 2 => output signal 2".

It's very obvious when you look at it in the demo map.

You can also make a combined blueprint of all 3 lanes in the demo map and then just use that for a 3-lane depot, if you don't want to reconfigure this manually.

Also maybe I should post a simpler version without multi-lane at all.
Hi, thats no problem, was easy to figure out, here is a pic showing them, all are configured exactly as the original 3 in the demo but with rising numbers:
I also used this earlier before I got desynced.
Image
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 »

Think I solved it!

Was a missing wire between two poles. Really just my own fault and I should have checked all wires earlier instead of going deep into the technical stuff :lol:
Sorry for the fuckup!

When fixed train went to provider station, loaded and unloaded at the drop off station.

So it seems to work now, however, I still have no indicator light for the depot tracks. I assume the left most light should light up, its condition is track number > 2000000000.
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 »

I can join your server and help you with all this. We can even go on voice chat if you want. That would probably be a lot easier than going through this thread everytime.

BTW I'm also playing a normal game now with my setup, and I'm running into slight hiccups now and then (sometimes the trains don't follow their orders). These events seem to be somewhat random, so it could be a bug in SmartTrains.

Just in case funny things happen on your map -- it might not even be a problem with the circuit itself.

Also I would not recommend to try mixed resource providers right now. That is something that is surprisingly difficult to get right.
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 »

siggboy wrote:I can join your server and help you with all this. We can even go on voice chat if you want. That would probably be a lot easier than going through this thread everytime.

BTW I'm also playing a normal game now with my setup, and I'm running into slight hiccups now and then (sometimes the trains don't follow their orders). These events seem to be somewhat random, so it could be a bug in SmartTrains.

Just in case funny things happen on your map -- it might not even be a problem with the circuit itself.

Also I would not recommend to try mixed resource providers right now. That is something that is surprisingly difficult to get right.
Thanks, that would be awesome, we are playing tonight, just dont cry when you see the mess we have made! Only issue left is the Depot track signals, seems like the first one is working now, but not the rest of them.

I also noticed several bugs in Smarttrains, one related to deleting or destroying a train connected to one of the schedules ( think, cant remember exactly). I do know that just picking up one of the trains in a consist will cause a lot of errors.
Ill send you the TS details via PM. Just be prepared to install a lot of mods, we have a pack on the server though so should go fast to download it if you have a decent connection.
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 »

I sent you a PM but to be honest Im a bit unsure on how this works.
The message is stuck in the outbox folder and wont appear in sent items.
From where I am from that might mean it never reached you, let me know if thats the case.
Send train to station ID using combinator signal is a long overdue feature!
viewtopic.php?f=6&t=74663

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

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

Post by Nexela »

The message is stuck in the outbox folder and wont appear in sent items.
That just means he hasn't read it and you can still change it. It will go to sent items after he reads it.

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 »

Nexela wrote:
The message is stuck in the outbox folder and wont appear in sent items.
That just means he hasn't read it and you can still change it. It will go to sent items after he reads it.
Thanks, I honestly dont understand who ever designed such a system, better to mark a mail as read/not read instead.
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 »

I have thought about another scenario, how do I get this to work with a central storage?

Why do I want a central storage? Because I hate the unfinished ore patches littering the map, it needs to be ordered in nice and tidy rows of storage boxes!

Now the problem is, either I have to build a combined provider/requester station, possibly causing a bottleneck.
Or find some other way of not causing a loop in the system. Any ideas?
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 »

I have also looked a bit at the signal light that I cant seem to get working for each Depot track.
The number one track is indicating.

However, when reviewing the main "brain" or cluster of combinators, the combinator in the right corner as seen in the picture is outputting signal 1 x 2 billion regardless of whether track one is occupied or not.

Image

This does not make sense to me, should it not be outputting a signal for each occupied track # * 2 billion?
The current state is that track two is the only occupied track.
However, this does not affect the sending of trains, which surprises me to be honest since I thought it had to send the goto signal to the right Depot track #.

Assuming it does need to send the goto signal to the correct track, then I think the fault is isolated to the last part of the circuit that is only here to indicate what tracks are known to be occupied.
The signal on the green return bus from the tracks are currently signal 1 * 2 billion and signal 2 * 2.
I expect signal 2, but I think signal 1 should not be there.
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 »

I think the issue is with this combinator:

Image

It was stuck on signal 1 * 1 even though track one was not occupied.
Current status is that tracks 2 and 3 are occupied. I removed and replaced it and now its stuck on signal 2 * 1. The combinator to the right of it multiplies by 2 billon and now track 2 status light is lit.
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 »

I had another thought on this.

Assuming this logic is meant to select the next track for assignment, me manually backing a train off the station might be an unhandled exception and it only picks a new track after sending off the train at the current track.

Sooo, maybe this is working as intended?
If so I misunderstood the instructions earlier where I thought all occupied tracks would be indicated with a lit lamp?
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 »

doxsroxs wrote:I have thought about another scenario, how do I get this to work with a central storage?

Why do I want a central storage? Because I hate the unfinished ore patches littering the map, it needs to be ordered in nice and tidy rows of storage boxes!

Now the problem is, either I have to build a combined provider/requester station, possibly causing a bottleneck.
Or find some other way of not causing a loop in the system. Any ideas?
Regarding this, my current idea is to have a dual purpose station, possibly two if I can get it to work. Its request ability is only to be active if no other station on the red bus is asking for the same materials.
I think I can get it to work by monitoring the red bus and activating the provider/requester part off the station logic based on that.
If anyone else on the bus is asking for the stored materials, the station will go into provider mode.

Does this sound feasible, or am I making it overly complicated?
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 »

You ask interesting questions. Let me answer in two parts.

Part 1: Lane selection at the depot

The "2G" signal that makes the indicator lamp light up is purely informational. You could remove the lamp and the combinator that outputs the "2G" signal and everything would still work. Simply ignore the "2G" signal for now, it has no real significance (the reason why the signal value is "2,000,000,000" is just so it can be easily checked in the lamp condition).

Here's how the lane selection actually works:

Each station outputs a unique signal ("A", "B", C" or "1", "2", "3", it doesn't matter it just has to be unique). The value of the signal is the number of the lane (1, 2, 3, ...). So it could be "A=1", "B=2", ... or "Red=1", "Green=2", ...
A lane outputs its signal only if there's a train waiting at that lane (the station for the lane outputs "train-at-station"). The "train-at-station" gets multiplied by the lane signal/value and output on the lane selection bus, which is completely separate from the main bus.
The lane selector looks at all the signals, and simply selects one of them at random. Because of combinator limitations, this has to be done by polling through the values, and then taking the first value that appears in the selector into a register.

When we have a lane selected, we have the signal of that lane in a register, with a value of 1. So it might be "C=1" if the third lane has been selected. We now have to send the train at that lane to the next destination, so we need to find a way to talk to that lane, and only to that lane.
This is very easy now, because we multiply the destination signal (which is a station number) with the unique lane signal (in the register) and put it on the lane bus. The lane can then filter out its own signal ("C" in this example) and convert it into a destination signal. The destination signal is output to the lamp of the train station (not the indicator lamp, ignore that one), and to the train station as well to make the train actually leave.

If you look at the combinators at the depot and at the lanes you will be able to reverse engineer the precise functionality with that information in mind.

It's a bummer that the decider combinator does not have an "Anything" output, because that would make the lane polling a lot easier (there would be no polling, you could use the "Anything" output to simply filter one of the existing signals; but it doesn't exist yet, maybe Twinsen will add it, who knows).

Part 2: Combining requester and provider stations

Wow, this is such a complex question.

First of all, the really short answer for your specific scenario: NO.

You want to have a requester provide the same resource that it's requesting. That means you'll have two "virtual stations" (requester and provider) tied to the same "physical station" (actual smart train stop). In the circuit that's a requester (R) and provider (P) with the same number. The problem with that is that the polling is sequential, so this "requester-provider hybrid" will respond in the same tick, and the values will get added together. It's what you've called a "loop". The current design does not handle this situation cleanly.

You have proposed some ways to work around this, but honestly I don't recommend it. Even if you can make it work (and I'm not saying it's impossible), it might cause you a lot of pain in a setup that is already quite complex.

Also, you have not gained much at this point, because you'll still need to transfer the items from the requester side to the provider side. That will require robots or belt spaghetti or some crazy contraptionarino.

Make two stations instead, a requester and a provider, and then transfer the items from one into the other. You will need a few more tiles of space and a bit more additional rail.

Now, combining providers and requesters into one is an interesting idea, and it should work fine as long as you don't create at requester-provider-loop. So if the requester never requests what the provider side provides then it should work -- I haven't tested this yet, but it's an interesting idea. In 0.12 the inserters were simply too slow to make this viable, but in 0.13 with stack inserters there is enough inserter throughput. It would be feasible to split a train station in half and have one half unload to the requester side and the other one load from the provider end (it would also require filter inserters and correct setting of filters but it would all probably somehow work if done correctly; comparable in complexity to the multi-product provider which also is quite a pain as mentioned before).
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 »

siggboy wrote:You ask interesting questions. Let me answer in two parts.

Part 1: Lane selection at the depot

The "2G" signal that makes the indicator lamp light up is purely informational. You could remove the lamp and the combinator that outputs the "2G" signal and everything would still work. Simply ignore the "2G" signal for now, it has no real significance (the reason why the signal value is "2,000,000,000" is just so it can be easily checked in the lamp condition).

Here's how the lane selection actually works:

Each station outputs a unique signal ("A", "B", C" or "1", "2", "3", it doesn't matter it just has to be unique). The value of the signal is the number of the lane (1, 2, 3, ...). So it could be "A=1", "B=2", ... or "Red=1", "Green=2", ...
A lane outputs its signal only if there's a train waiting at that lane (the station for the lane outputs "train-at-station"). The "train-at-station" gets multiplied by the lane signal/value and output on the lane selection bus, which is completely separate from the main bus.
The lane selector looks at all the signals, and simply selects one of them at random. Because of combinator limitations, this has to be done by polling through the values, and then taking the first value that appears in the selector into a register.

When we have a lane selected, we have the signal of that lane in a register, with a value of 1. So it might be "C=1" if the third lane has been selected. We now have to send the train at that lane to the next destination, so we need to find a way to talk to that lane, and only to that lane.
This is very easy now, because we multiply the destination signal (which is a station number) with the unique lane signal (in the register) and put it on the lane bus. The lane can then filter out its own signal ("C" in this example) and convert it into a destination signal. The destination signal is output to the lamp of the train station (not the indicator lamp, ignore that one), and to the train station as well to make the train actually leave.

If you look at the combinators at the depot and at the lanes you will be able to reverse engineer the precise functionality with that information in mind.

It's a bummer that the decider combinator does not have an "Anything" output, because that would make the lane polling a lot easier (there would be no polling, you could use the "Anything" output to simply filter one of the existing signals; but it doesn't exist yet, maybe Twinsen will add it, who knows).

Part 2: Combining requester and provider stations

Wow, this is such a complex question.

First of all, the really short answer for your specific scenario: NO.

You want to have a requester provide the same resource that it's requesting. That means you'll have two "virtual stations" (requester and provider) tied to the same "physical station" (actual smart train stop). In the circuit that's a requester (R) and provider (P) with the same number. The problem with that is that the polling is sequential, so this "requester-provider hybrid" will respond in the same tick, and the values will get added together. It's what you've called a "loop". The current design does not handle this situation cleanly.

You have proposed some ways to work around this, but honestly I don't recommend it. Even if you can make it work (and I'm not saying it's impossible), it might cause you a lot of pain in a setup that is already quite complex.

Also, you have not gained much at this point, because you'll still need to transfer the items from the requester side to the provider side. That will require robots or belt spaghetti or some crazy contraptionarino.

Make two stations instead, a requester and a provider, and then transfer the items from one into the other. You will need a few more tiles of space and a bit more additional rail.

Now, combining providers and requesters into one is an interesting idea, and it should work fine as long as you don't create at requester-provider-loop. So if the requester never requests what the provider side provides then it should work -- I haven't tested this yet, but it's an interesting idea. In 0.12 the inserters were simply too slow to make this viable, but in 0.13 with stack inserters there is enough inserter throughput. It would be feasible to split a train station in half and have one half unload to the requester side and the other one load from the provider end (it would also require filter inserters and correct setting of filters but it would all probably somehow work if done correctly; comparable in complexity to the multi-product provider which also is quite a pain as mentioned before).
Thanks for the info, now I understand the lane selection better.
Ill wait with my requester/provider station until I have everything else working smoothly.

Currently we are having issues with trains loading up and then going to the wrong station, Im starting to think there is something wrong with Auto trains because it gives errors almost every time I try to save the schedule.
The issues started when I added the last two stations, it seems they go to the requester stations and when leaving they continue with the schedule instead of going to the correct target station.

The only thing I can remember doing that was different was to rename one of them after it was added to Auto trains schedule. Currently rebuilding them to try and see whats wrong.
Looking at the bus the requests and advertised materials look right to me, but I guess the signal for target station is something I would not see since I assume its pulsed or sent directly via Auto trains.
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 »

Ok, seems I have broken something again, after reorganizing the Auto trains schedule no trains would leave the depot.
So I recreated the depot from an earlier save. Still no go. Current plan is to start over and add each station one by one.

Just want to check with you, are these supposed to show R # for requesters, P # for providers and the last figure how much a train load is?
Image
What are the conditions that could cause them all to be zero?

This screenshot was taken just after rebuilding it from a blueprint. Depot tracks and station bus is connected.

/Edit, let me rephrase that question, when and what are they supposed to output? :)
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 »

Ok, have now rebuilt all stations and updated to new version of Smart trains.

Now I dont get errors when assigning new stations to the line.
I also noticed that I had several stations that would start enumerating bogus information in the combinators, Ill post pictures of that later, it has caused me some issues.
But now that I know how to handle them it has worked out fine.

The first 10 stations went fine, trains loaded and unloaded as they should. However when I attached station 11 and 12 it broke down.
Now I have a train loading oil barrels at station 11 that should go up to my base just continue driving along the Auto trains route straight to station 12 where it of course causes a huge mess.

Not sure what the cause is yet. But station 8 that should have received the barrels have a correct reservation for them so I assume the failure is with the goto station # command or something.
Incidentally, this is the same number of stations that gave me the same issues the other day.

Is there possibly an issue with the number of stations? I have set the max to 200 in the main brain, so should not be that.
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 »

These are too many detailed questions that depend on your setup to be really answered accurately.

I currently have one issue on my current game: sometimes the scheduling fails and the cargo gets sent to the wrong requester station. This is something caused by the scheduler, because the requested resources appear in the combinator of a station that is not even requesting them.

So there is a bug, and I currently do not know what causes it. I will try to fix it.

I have not seen any of the other erratic behaviour that you are describing, so I have to assume that it is a setup problem.

When you extend the network (add a new outpost or new unload/requester), you should always take the following steps in order:
  1. Install the train station with the blueprint.
  2. Set the limits in the respective combinators.
  3. Make sure that everything is connected, except the connection to the main bus.
  4. Add the new station to the main train line, in Smart Trains. Set the rule "signal #" in smart trains. Add it to a train that is not about to leave the depot, because if you do not save the schedule and the train leaves the depot then SmartTrains will reset it to the old schedule. The mod updates the line when a train leaves the station.
  5. Check the combinator at the new outpost, it should output the station number.
  6. Supply power to the outpost.
  7. Connect the outpost to the main bus.
So the connection to the main bus should always happen last, and it's important to make the schedule change on a train that is not occupied (you can stop the train so it won't leave the station while you're changing the train line).
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: Smart dynamic train deliveries with combinator Magick [0.13]

Post by siggboy »

doxsroxs wrote:Just want to check with you, are these supposed to show R # for requesters, P # for providers and the last figure how much a train load is?
Image
What are the conditions that could cause them all to be zero?
Yes, it's the requester-provider-train load for the currently selected schedule. It will get erased as soon as the train is sent, so you usually do not see it if there's already a train at the depot (it will pick up the schedule very quickly).

If the numbers are zero, then there currently is no schedule in the registers. The numbers should either all be zero, or all be set, anything else would be a grave bug in the circuit (I've never had that, though).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Post Reply

Return to “Combinator Creations”