Page 1 of 2

Connect train stops to circuit networks

Posted: Wed May 06, 2015 12:30 pm
by tobsimon
Many players have suggested more control over the train loading.
https://forums.factorio.com/forum/vie ... f=6&t=9112
https://forums.factorio.com/forum/vie ... f=6&t=7658
https://forums.factorio.com/forum/vie ... f=6&t=4738

My solution would be to actually not let the train decide, but the train stop, when the train may leave. With circuit networks. Some kind of gate logic implementation would be advisable to make this work well. I'm sure there are plenty of concepts for that already.

The stop-timer may be removed without substitution then. So trains better tie in with the rest of the factory's control flow (no timers anywhere).

Signals on the other hand should not be connected to the circuit network. When you do, you may as well let the player implement the whole signal safety logic using sensors (and logic gates).

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 2:14 pm
by MeduSalem
Even if it might have been suggested before, but you have my support on that matter.

I would rather have train stops being connected to the circuit network and decide over the applied signal if a train is allowed to leave or not. Handling the trains would become a lot easier if they are told to stay there until a certain amount of resources are in a wagon measured by a sensor placed at the wagon location or whatever.

And then completely remove the stupid timer from trains altogether or at least make them optional because they are just plain annoying, especially when setting up multiple dozens of trains. The timers are ineffecient because no matter what they cause the train to move even if for example not enough resources are available to be loaded. You can't tell the train to wait longer in the station until the wagons are full or to halt there until it is told otherwise. It makes me pull my hair out when they are still moving at the original schedule I entered even if an orefield is nearly or completely depleted already. They waste like a ton of fuel until one realizes "Oh... There's no ore anymore".

If someone really needs a timer I would actually find it more appealing if there would be a circuit logic block that is placeable with an interface that lets you adjust the timing the way you like it and then connect that thing with red/green wire for example to the train stop or whereever else you want it... like for example to assemblers or other stuff to make it work on a fixed schedule.

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 3:41 pm
by Twinsen
I am working on the improved circuit network at the moment.

This is also what I was thinking: the train station is connectable to the circuit network. It will send you the contents of the train that is currently in the station. Also, the connected circuit network can send a signal that will send the train to a specific station.

Keep in mind that the train system should still function well even without the circuit network, so the timer will not go away. Rather it will be a bit better. Probably something like "wait until the train is full/empty or until the timer has passed".

If you want to do crazy logic like: "leave is the train is full or 60 seconds have passed or no new item was added in the last 3 seconds", you will be able to do this with the circuit network (although it will not be as easy as it sounds).

If you have any detailed ideas about how the trains station should work, you can share it. But maybe you should wait for a Friday facts detailing how the new circuit network "combinators" work.

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 4:48 pm
by tobsimon
Now I'm excited ... and a little confused
Twinsen wrote:Also, the connected circuit network can send a signal that will send the train to a specific station.
We will be able to send messages accross the circuit network? How would that integrate with it's current functionality?

You are right about the timer beeing necessary without the circuit network, unfortunately.
But the timer and/or conditions should be set at the train stop, not the train itself. Like if there is a station master. Train conductors get their departure times from the station master and they are the ones overseeing loading. Not like there are any conductors or station masters in the game.

By the way doesn't the train stop look a bit like a big clock on a pole?
Twinsen wrote:Any detailed ideas about how this should work are appreciated.
Really? Well. We would need binary gates obviosly. Currently we have
"(red operator constant) AND (green operator constant) AND (logistics operator constant)"
implemented everywhere, with red, green and logistics being the amount of a selected item in this OR another chest in the corresponding network. So a smart insterter taking something out of a smart chest is basically a NAND gate. :o :shock: Guess there is no need to do anything then.

But kidding aside, I think there should be binary logic building blocks, one tile big or even smaller*.
The binary connector gets a signal from one input side and distributes it to every other side.
The binary gates AND, OR, NAND, NOR, NOT get their signals from 3 sides and send the result to one output side.
The IF gate connects to one network, red, green or circuit, has item and range settings and sends the result to every side.
The CODEC block gets the signal from every side connects to a circuit network (or the wirless network of the logistics network) and sends a message. This means, the networks get a new tab, but not for items and their overall number, but for user definable messages, which are boolean variables set to either true or false. CODEC blocks may also be used the other way around, to decode messages.

Smart inserters may get dumber, as they now only need one internal CODEC block.
Everything else may be connected to a CODEC block, including assembling machines.

That is my basic idea about circuit logic. I have no idea how to send more complicated messages though, like go to this station next and grab there some iron ore.

* Smaller could look like this. Build a binary logic thingy. Clicking on it opens a window with a 10x10 grid one which you can place the described gates. The edges of the grid are directly connected to neighboring binary logic thingies, in case you need more space to work with.

-- addendum --

The longer i think about it, the more I like the idea of the logic thingy above. It should be called FPGA, cause that's what it is, or CPU, maybe more understandable. It's window shoud contain a grid you can fill with logic gates and stuff, but the edges of the grid directly connect to the edges of neighboring CPUs. A button on every edge should directly open the window of the other CPU (like in SpaceChem). The CPU may contain CODEC functionality. On a cell, select the network (shown as colored border) and item, now an operator placed next to it sees the amount. Oh the possibilities...

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 5:12 pm
by MeduSalem
Twinsen wrote:I am working on the improved circuit network at the moment.

This is also what I was thinking: the train station is connectable to the circuit network. It will send you the contents of the train that is currently in the station. Also, the connected circuit network can send a signal that will send the train to a specific station.
Ah nice to get some information first hand :D

If the train station is actually the sensor to the train currently in the station then it works even better than I had in mind...

How does the connected circuit network send a signal to the train station? Current signals of a circuit network are all item count based signals. Are there new signals independent from item based signals, like ones that send only "true" or "false" values or whatever which one can work upon?

Because that's actually a thing I wanted to ask for a few months already concerning the upcoming "logic combiner" that does simple arithmethics... the output signal is most likely a "true" or "false" signal and not an item count as far as I can imagine, at least it would be true for many of the logic operations.

Also it would be interesting to know how the circuit network will pass on something complex like which station to go to?

Twinsen wrote:Keep in mind that the train system should still function well even without the circuit network, so the timer will not go away. Rather it will be a bit better. Probably something like "wait until the train is full/empty or until the timer has passed".
The options for "wait until train is full" and/or "wait until train is empty" sound quite nice. That's all I have been waiting for :D

As long as the timer is implemented directly into the train station as an option with "wait until <xx> seconds have passed and then leave" one can tick/untick rather than in the trains themselves that's no real problem. There's no way of doing a rail setup without train stations anyways. :lol:

Setting up 2 or more fixed train stations each with an implemented timer is more convenient than setting a timer on each of the dozen trains themselves because one probably has many more trains than train stations and also because the trains are moving entities... so if you ever want to change something it is hard to do if one has to play tag with all the trains spread out all over the map, especially with no centralized trainlist available in the game. You are sure to miss one of them and won't even notice until very late. I know from experience because I tried to update the train schedule multiple times and it was plain horrible. Easier to get a new train going rather than catching the one you want to change.

So... The full/empty/timer should be in the train station and it's the default/fast way of setting up a rail network. That is if one doesn't actually rely on a more sophisticated circuit network to control said train station and thereby incoming/outgoing trains.

Twinsen wrote:If you want to do crazy logic like: "leave is the train is full or 60 seconds have passed or no new item was added in the last 3 seconds", you will be able to do this with the circuit network (although it will not be as easy as it sounds).

Any detailed ideas about how this should work are appreciated.
That would probably require a new placeable item besides the upcoming "logic combiner", something like I mentioned in above post: An item that can send an output signal on a timed schedule. This timer item would probably require an incoming signal as well at which the timer can be started/halted/resetted.

That way you could reset this timer every time a new item enters the circuit network of the train station. And once it reaches 3 it sends an outgoing signal to the circuit network of the train station that makes the train leave.

But it would probably also require the train station to be able to send a signal whenever a new item has entered the train which can be send to the timer item as input to reset the timer. That would be the easiest way.

Everything else would require some sort of memory one can check upon to determine if the content of the train has changed or not and that is just ugly to say at least, especially if one has to depend on checking on ALL individual chests that are placed along the train sides to see if the content of any single one of those has changed, which is just... urgh... an ulgy lot of red/green wire mess.

At least one would need to set the train station to all the following:
  • Leave if full (which is probably an option of the train station itself which can be ticked or unticked)
  • Leave if <xx> Seconds have passed (which is probably also an option of the train station itself which can be ticked or unticked with a specified value)
  • Leave if input signal is "true", which comes from the timer item I mentioned above.
I wouldn't try doing it without a timer item available because doing it with inserters outputting to a belt and the belt length determining the time passed is just... the ugliest contraption ever conceived in Factorio and I hate it. :lol:

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 6:09 pm
by Twinsen
It appears I started something here...

The current circuit network can do binary logic. Basically the existence of an item means 1, the lack of an item means 0.

Now I don't want to spoil Friday facts by telling you all the details, but the new "combinators" can be combined in many different ways to do alot of things. It will probably be a complex and hard to understand system but very flexible. More details Soon™(not this week).

Meanwhile this discussion is helpful so I know what people want to achieve and how they think it could be done.

Re: Connect train stops to circuit networks

Posted: Wed May 06, 2015 6:14 pm
by DerivePi
http://i.imgur.com/0lMrLFE.jpg from this thread -

https://forums.factorio.com/forum/vie ... c&start=10

I'd like to think this thread had a lot of ideas for an improved circuit network. Ideas such as:
- Patch bays for ganging signals together
- multi cables for long distance signals
- Math Modules for manipulating the data (add, subtract, etc...)
- circuit requester chest
- Multi colored circuit lights (very important for in-game shenanigans!)
- Railroad logic connection

Re: Connect train stops to circuit networks

Posted: Thu May 07, 2015 8:25 am
by bobingabout
... so you're adding logic gates?
Or gate, Not gate, And gate etc. to the Circuit networks?

Re: Connect train stops to circuit networks

Posted: Thu May 07, 2015 9:23 am
by MeduSalem
bobingabout wrote:... so you're adding logic gates?
Or gate, Not gate, And gate etc. to the Circuit networks?
I think it was pretty obvious in the developer diary that the "Combinator" kovarex mentioned would be something like that.

Re: Connect train stops to circuit networks

Posted: Thu May 07, 2015 12:16 pm
by Plop and run
Twinsen wrote:Also, the connected circuit network can send a signal that will send the train to a specific station
wait... are you telling that stations will be able to accept a train, stuff it as you desire and send the train to a station, where the station can be picked with a custom logic? WANT!!

Re: Connect train stops to circuit networks

Posted: Thu May 07, 2015 1:49 pm
by Twinsen
Plop and run wrote:wait... are you telling that stations will be able to accept a train, stuff it as you desire and send the train to a station, where the station can be picked with a custom logic? WANT!!
That's the plan at least.

Re: Connect train stops to circuit networks

Posted: Fri May 08, 2015 12:12 am
by ssilk
We had that discussion:
https://forums.factorio.com/forum/vie ... f=6&t=5276 Thoughts about circuit network (while I'm just on it)

I think my stakes with this (to cut out the essence of the idea), is that I can add new generated signals to a bus. Also boolean signals are just a new signal.

The signal looks as follows:

Code: Select all

iron-plates: 100                                       >>>> this two signals is, what are in the
electronic circuits: 57                                >>>> chests, needs a sensor to measure
iron-plates > 200: false (or 0 depends on standpoint)  >>>> this is a generated signal (by the combinator?)
                                                            by combining some signals and returned back to the bus with a new name.
Therefore all the other stuff in that thread mentioned is a potential implementation.

Re: Connect train stops to circuit networks

Posted: Fri May 08, 2015 3:25 pm
by MF-
Twinsen wrote:It appears I started something here...

The current circuit network can do binary logic. Basically the existence of an item means 1, the lack of an item means 0.

Now I don't want to spoil Friday facts by telling you all the details, but the new "combinators" can be combined in many different ways to do alot of things. It will probably be a complex and hard to understand system but very flexible. More details Soon™(not this week).

Meanwhile this discussion is helpful so I know what people want to achieve and how they think it could be done.
I like what you say.
Doing complex things should not be as easy as some in-my-point-of-view-cheaters would say.

Re: Connect train stops to circuit networks

Posted: Mon Jun 01, 2015 3:52 pm
by Cordylus
Ready to implementation.

https://www.factorio.com/blog/post/fff-88
The circuit network

The combinators are new entities that connect to the Circuit Network. As a quick reminder, the circuit network is a network you create by connecting entities using red and green wires. The information on the network is just a list of items and their count.
Before, only the Smart Chests and Smart Inserter were connectible to the circuit network.

The plan is that many more entities will be connectible to the Circuit Network and with the help of the Combinators, you will be able to have more control over your factory.
Here are some entities that are planned to be connectible to the Circuit Network:

Lamp (can be turned on and off or show colors)
Power Switch
Accumulator/Substation
Storage Tank
Train Station(to control where your train is going)
Gate

The circuit network has been modified a bit. You can now connect wires directly between entities. Also every time you connect both red and green wires to an entity, their signals are summed inside the entity and this sum is considered the "input".

Re: Connect train stops to circuit networks

Posted: Mon Sep 21, 2015 8:55 am
by hitzu
If you have any detailed ideas about how the trains station should work, you can share it. But maybe you should wait for a Friday facts detailing how the new circuit network "combinators" work.
Usually I have one big unloading station that have a relatively small buffer storage: active provider chests combined with requester chests. And I don't want to overflow it because it is very important to have active provider chests empty, otherwise they couldn't take for example copper if they are full of iron ore. Now I manage it mostly manually, but I dream of some sort of a system that can dispatch one of the ready-to-go-trains waiting somewhere when the unloading station can take teir load. Overall it would be great if stations can act like requester and provider chests: if <condition> then request <specfic train/train full of specific stuff>

Re: Connect train stops to circuit networks

Posted: Mon Sep 21, 2015 3:25 pm
by ssilk
I would love that.

In my eyes we need three things:
1. A router or converter, a device that can convert signals from one net to another.
2. A wireless network, similar to the circuit network, just with 26 channels.
3. Train routes in general.
4. Automatic train routes: The route is generated by a logic, that knows where is the most stuff and where the least of one item-type and calculates for this item-type the current best source-target-pairs.
5. Some logic that can assign such automatic train routes depending on some condition to a list of trains.


Long description:

- I would say, with the way how the circuit network is currently implemented, we need some converter. Formerly I called that device a "router" ( https://forums.factorio.com/forum/vie ... f=6&t=5276 ) .

A device that can take any input from circuit network OR logistic network - OR any other upcomming network - and forward a signal or more signals or all signals to another network. And maybe change that signal to another signal-type. But that is not really needed.

- The second thing we need is a wireless network. Because it is too much afford to wire over long distances. Simply like the circuit network, but instead of cables we have channels. I think 26 channels, like the alphabet should be enough. The above device can be used to transmit the informations.

- The third is then, that we need to say: IF A IS EMPTY GO TO B, LOAD AND THEN GO TO C.

A is a simple scalar. B and C is a place, a coordinate or the name of a train station. A non-scalar.

It's not possible to transmit that information via circuit network and it also makes no sense.

So I think we need also a "train network". Something, which tells us: Item A can be loaded at B and unloaded at C. A simple list, that is automatically created and is reflecting the current situation. We can call that also a route. Or better: An auto-route.

The function is like so:
IF ITEM A IS LOWER THAN X THEN TRAINS WITH NAME "AUTO-ROUTE #1" ARE ASSIGNED TO ROUTE "ROUTE FOR TRANSPORT OF A" (Which is an auto-route, that generates this mentioned list and sends the trains to the places automatically).

Re: Connect train stops to circuit networks

Posted: Fri Dec 25, 2015 8:20 am
by Jackalope_Gaming
Knowing how much of each resource an outpost has should be pretty easy to implement since it's already possible to know with smart chests hooked up to the circuit network. Automatically telling a train to go to a certain stop based on a given condition (including conditions such as X stop has the most resources or Y stop has the fewest) would be the main thing to add in.

And yeah, some sort of wireless circuit/radio network would be nice. Have its transmission area be like roboport area and it'll be great. I don't see directional radio towers working out so well in the game so a centered area would be best if it gets added in.

Re: Connect train stops to circuit networks

Posted: Sat Mar 12, 2016 5:47 am
by dapullia
Would it be possible to have the cargo wagons send a signal through the train stop? Basically a Yes or No as to whether the cargo wagons were empty. This would make it possible to setup "Wait until Empty" type of train routing where the trains would stop, fully unload, then automatically go back for another load.

Re: Connect train stops to circuit networks

Posted: Sat Mar 12, 2016 10:30 am
by ssilk
Yes, cause basically there are already mods, that do that.

Re: Connect train stops to circuit networks

Posted: Sat Mar 12, 2016 11:29 am
by daniel34
Friday Facts #114 - Better train conditions wrote:It is obvious, that we need better tools to control the train behaviour. We decided to solve it by extending waiting conditions of the train. This is the list of the conditions prepared for 0.13:
  • Time passed - The only available in 0.12
  • Inventory full
  • Inventory empty
  • In-activity - No items were added or removed for specified amount of seconds.
  • Item count - specific condition can be set, like train contains more than 30 iron plates etc.
  • Circuit condition - The train stop will be connectable to the circuit network, so the condition can use it.
We also wanted to make it possible to combine these conditions, so it can be something like Wait for 30 seconds or until inventory isn't full..
This is how the window looks now:
Image
  • Tabs make the cargo/schedule context switching much more understandable. Yes the graphics of the tabs needs an upgrade, but we are talking mainly abut understandability now.
  • The switch between automatic/manual mode was redesigned. It is clear now which is active, and what can you expect from switching it.
  • The station list is only shown as popup window when adding new station.
  • More understandable icon of removing station.
  • The bottom list is now the list of conditions for the current station, these can be added, removed or modified.
  • There is indicator of the train goal now, something I was missing a lot.