Page 2 of 3

Re: [0.15] Automatic Coupler

Posted: Tue Aug 29, 2017 6:41 pm
by ransburger
vortex1967 wrote: by vortex1967 » Sat Aug 19, 2017 11:07 am

Hi all,

Sorry, in advance for the long post. There is a lot involved in getting this mod to work automatically with no, or very little intervention by the player.

The station at the smelters uses an expanded and adapted version of the outpost design.
All the following images are taken from the station at the smelters.
At the moment designs have been laid out into sections for ease of trouble shooting.
Blueprints...I am using the 'Lighted Power Pole Mod' and all the signal wires are run along these poles. I will have to redo all the logic stuff onto vanilla poles.
Any chance you could give a little explanation about how you got rail signals to work in conjunction with this mod?

I have a small system set up where a pair of locomotives brings in empty cars and swaps it for full cars, but the whole system is one big block, which is a bad plan long term.

Your screenshots seem to have signals on the tracks. How do you get your locomotives to approach parked rolling stock and successfully connect?

Re: [0.15] Automatic Coupler

Posted: Wed Aug 30, 2017 11:22 am
by TalAntilles
GotLag, I just wanted to say that this mod is fantastic. It's the only working automatic coupler mod I can find and it makes trains so much more interesting.

I've also just run into a multiplayer desync involving a train coupling to a few cars (in my case, two locomotives coupling to four item cars). No other mods installed. I have attached a desync report to this post if that is any help. Has anyone else found a solution to this?

Re: [0.15] Automatic Coupler

Posted: Wed Aug 30, 2017 2:31 pm
by Ruben_NL
TalAntilles wrote:GotLag, I just wanted to say that this mod is fantastic. It's the only working automatic coupler mod I can find and it makes trains so much more interesting.

I've also just run into a multiplayer desync involving a train coupling to a few cars (in my case, two locomotives coupling to four item cars). No other mods installed. I have attached a desync report to this post if that is any help. Has anyone else found a solution to this?
i have the same problem. since today(maybe because an upgrade in server hardware, but i don't think so.)

It happens also when i setup an multiplayer server local, with only me on it.

Re: [0.15] Automatic Coupler

Posted: Wed Aug 30, 2017 2:38 pm
by Nexela
If this is easily reproducible can you post the save where it happens?

Re: [0.15] Automatic Coupler

Posted: Wed Aug 30, 2017 9:52 pm
by TalAntilles
Yes, I will post the save and a guide to reproducing it later tonight. I have gotten it to happen 3-4 times now, though I am the only one (of three total) on the server affected. Although the other two are on the same network, so that may be a factor as well. If I find a solution I will post it, and any other things people find that work would be awesome to read.

Re: [0.15] Automatic Coupler

Posted: Sun Sep 03, 2017 8:02 am
by TalAntilles
Apologies for taking longer than anticipated, but I have attached the save. Only mod used is Automatic Coupler. You will want to look at the Southeast corner, specifically the railyard-in-progress right next to a large iron refinery. It is disconnected from the main rail line. It can be reproduced by having a shunter vehicle on automatic connect to a train of just cargo cars that is more than one car long.

In the meantime I have done a little more testing. It appears to select the player it desyncs at random. It is confirmed to not be the most recent player to join the server. It is also unrelated to the player that actually sets the orders. I suppose it could be based on ping, but can't test that theory yet. I have not yet tested it with fluid train cars either. All the cars tested have been empty as well, if that matters. It works fine on singleplayer.

Hope this helps!

Re: [0.15] Automatic Coupler

Posted: Tue Sep 05, 2017 1:17 am
by vortex1967
Hi ransburger,

Sorry for the delay in replying.
Connecting to rolling stock.
The But...and an Also.
Connecting to the back of locomotives.

Re: [0.15] Automatic Coupler

Posted: Wed Sep 06, 2017 8:19 am
by driver
You usually need three stops for uncoupling ("end"-stop to change direction and two stops for decoupling/coupling, because trainstops don't always properly align to each other. To better understand this, you could take a look at Nifty Maniacs video https://www.youtube.com/watch?v=fQAgWssR2aY
his mod worked similar.
Something I tried recently is this:
A train with 4 waggons (2x coal and 2 more or less empty waggons for copperore) enters the station at the right border, unloads some coal, then goes backwards to an "end"-stop, then forwards to the next stop for decoupling and decouples the 2 waggons for copperore (which ideally should be empty), goes to the stop at the right border again and then backwards to the station to couple two waggons with copperore and leaves.
The second pair of locomotives which provides the two full copperore waggons is still blocked and can only continue the path if the 4-waggon-train takes the 2 full waggons with copperore and leaves. No circuits involved.

Re: [0.15] Automatic Coupler

Posted: Wed Sep 27, 2017 9:56 am
by cid0rz
Hello all, I'm trying this mod. Very nice indeed! I liked the one with pieces of rail that break or join the train but of course with signals it is much more flexible!

I'm trying to do a classification staiton. In this station trains with mixed wagons should arrive in different composition from the factories. So one can bring 3 wagosn of ironplate + 2 wagons of greencards for example. And then in this station the wagons would be stacked, classified and when needed a train according to factory demand would be assembled. It is a proof of concept so the complete operation cycle is not totally defined yet.
I managed to make it work sequentially, so it was not easy but I managed to place the couplers and uncouplers to perform the tasks I wanted. The problem is I'm using the Smarter Trains mod to be able to direct the wagons to their corresponding stock railways "programatically". When I couple or uncouple the wagons, they are taken out form the "line" of the smarter trains so they start going to the stations sequentially (like normal facotrio trains do). My question is, is it possible to keep the locomotives that couple or stack in the smarter trains line? I don't know how the internals of the mods work so any help on this directioon would be appreciated. I modified the layout wit the smart stops so I cannot show you images of it let's say working but I attach one so you have an idea.

Re: [0.15] Automatic Coupler

Posted: Wed Sep 27, 2017 6:57 pm
by cid0rz
I made a small video to show functionality. i had to implement it with "dumber" trains. The problem with this approach is you loose a lot of flexibility and you need one locomotive for each operation instead of one for all. If I counld use the gotosignal# of smarter trains the build would have more combinators and less locos ^^

https://vimeo.com/235793457

Re: [0.15] Automatic Coupler

Posted: Wed Oct 04, 2017 2:41 pm
by vortex1967
Hi cidOrz,

I don't think Smarter Trains can be used to sort wagons by their contents.

I came up with a design to see if it was possible to automatically sort random composition trains.
It uses 1 double header locomotive to do the sorting.
Wagons can be delivered any length(adjust length of the delivery station to suit)
No requirement to split wagons before sorting.
The sorted wagons can be any length(adjust length of the sorted stations to suit)
Ready to sort
Midway sorted
Last wagon to sort
Sorting complete

Re: [0.15] Automatic Coupler

Posted: Wed Oct 04, 2017 7:19 pm
by cid0rz
Hi Vortex,

Very interesting design, very similar to what I have. I think smarter trains can be used to send the locomotive where you want, following a program that could also change the other signals, including the coupling and uncoupling signals. It was to explore more complex logic when sorting and composing new trains. I've used smarter trains to create a system that can deliver trains on demand, calculating number of trains needed, if the stock is available, it resets if it does not find a suitable provider, etc. So i think wit the ability to change your train itinerary by a signal you can build more complex stuff. Nevertheless it is very nice to try to solve this limitation by other means, like your design. I was just asking, I imagine as it gets changed to manual mode and then automatic again, smarter trains take it out of the line (like it does with trains set to manual). I stopped using the decoupling since I got desync errors when playing online with a friend, but this is a functionality that I'd love to have in Facotrio.

Re: [0.15] Automatic Coupler

Posted: Sun Oct 08, 2017 2:19 pm
by laku
First of all, thank you for this mod :)

I kept thinking for quite a while now, how i would use this mod and finaly made up my mind. So i started looking at your code and changed
line136

Code: Select all

schedule.current = (schedule.current)% #schedule.records + 1
to

Code: Select all

schedule.current = (schedule.current)% #schedule.records
it works with the following train setup, for decoupling = -2
<>CC (<,> are locomotivs showing the direction; C are cargo wagons)

but i dont fully understand it yet

Re: [0.15] Automatic Coupler

Posted: Sat Oct 28, 2017 11:49 pm
by Krazycat2012
I have a question, it seems i can not get a train to go down the same path to pick up the wagons after they are full, and pull them to the drop off zone. the rail signals will not change to green. Any way some one can do a in detail basic set up of this, how to set up the logic that goes with it please.

Re: [0.15] Automatic Coupler

Posted: Sun Oct 29, 2017 11:45 am
by driver
There's a nice video featuring the coupler mod in action:
https://www.youtube.com/watch?v=ODg3Eir ... e=youtu.be

Re: [0.15] Automatic Coupler

Posted: Thu Nov 02, 2017 6:36 am
by Fahrradkette
Is it possible to have hauling trains (locomotives included) being moved by shunter engines? Like saving/restoring the schedule/id of the hauler vial signals?

Re: [0.15] Automatic Coupler

Posted: Mon Nov 06, 2017 3:02 am
by vortex1967
Hi all,

Sorry it has taken so long, life got in the way, but here is a map(Factorio version 15.28) with two of my outpost designs set to work in a loop showing what controls and safety measures I have used.
One outpost is for loading the wagons and the other is for unloading the wagons.
Robots are used to transfer items. Currently there are 1000 bots in the network, when you open the map the player is
near a red lamp, Constant Combinator and a steel chest, in the steel chest there is another 2000 bots.
It gets very busy with 3000 bots flying around in such a small area.

There are two mods that are required:
Automatic Coupler by GotLag.(obviously)
and
Inventory Sensor by Optera(without which the detection of wagons and wagon contents breaks)

To start, turn off the Constant Combinator just below the red lamp(near player).
If you turn on the Constant Combinator again after the 3 locomotives have moved, one cycle will be completed and
the 3 locomotives will stop at their current position again.
If you leave the Constant Combinator off the whole thing will run continuously.
Eventually the two problems I have encountered and have described in my previous posts occur.

When using this mod, every couple and uncouple that occurs increases the trains ID by one.
The map I'm playing now, my train ID has just passed 25,000.

Hi Fahrradkette,
I wanted to do this also but currently it's not possible.

Hi Krazycat2012,
Hopefully the map will help.


Edit: removed map download. New version 1.0.1 of mod broke map.

Re: [0.15] Automatic Coupler

Posted: Tue Jan 02, 2018 10:13 pm
by kickbackman1277
Is there any chance this could be updated for 0.16. I am desperate to try it in my current build. Than you

Re: [0.15] Automatic Coupler

Posted: Wed Jan 03, 2018 9:25 am
by bitbased
kickbackman1277 wrote:Is there any chance this could be updated for 0.16. I am desperate to try it in my current build. Than you
I haven't tested a full setup yet but seems the only change needed for 0.16 is to set the factorio_version to 0.16 in `info.json` and add `icon_size = 32,` to each signal in `signals.lua`

change info.json

Code: Select all

{
	"name": "Automatic Coupler",
	"version": "1.0.1",
	"title": "Automatic Coupler",
	"author": "Hopewelljnj",
	"homepage": "https://forums.factorio.com/viewtopic.php?f=94&t=48455",
	"description": "Adds signals to allow stations to couple/uncouple trains automatically.",
	"factorio_version": "0.16"
}
change signals.lua

Code: Select all

BLUE_BACKGROUND = "__base__/graphics/icons/signal/shape_square.png"

data:extend({
  {
    type = "item-subgroup",
    name = "couple-signals",
    group = "signals",
    order = "g"
  },
  {
    type = "virtual-signal",
    name = "signal-couple",
    icons =
    {
      {icon = BLUE_BACKGROUND},
      {icon = "__Automatic Coupler__/graphics/signal/couple.png"}
    },
    icon_size = 32,
    subgroup = "couple-signals",
    order = "a-a"
  },
  {
    type = "virtual-signal",
    name = "signal-uncouple",
    icons =
    {
      {icon = BLUE_BACKGROUND},
      {icon = "__Automatic Coupler__/graphics/signal/uncouple.png"}
    },
    icon_size = 32,
    subgroup = "couple-signals",
    order = "a-b"
  }
})

Re: [0.15] Automatic Coupler

Posted: Wed Jan 03, 2018 5:49 pm
by kickbackman1277
ty. that worked