[0.18.18] build-50828. circuit network delay in train content.

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

[0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

I build a train station with 4 resources to be transferred to different stations on the map.

I use a requester chest to request the specific resource and a stack inserter to insert into the cargo wagon.
The stack inserter is enable upon signal "X" with count "124"
The train station sends signal X and the number of the train (123) directly to the stack inserter.(function read stopped train)
The train station also sends the contents of the trains cargo to decider combinators. 1 for each resource/stack inserter.
The decider combinator is set to sent signal X with count 1 to the stack inserter when the resource in the cargo wagon is less than (<) 10.

Situation:
Train (123) arrives and carries 100 of each resource.
Station sends contents via circuit network to decider combinators and train number 123 on signal "X"
Decider combinators read that 100 is more than 10 and does not sent signal "X" with number 1 to the stack inserter.
Signal "X" that reaches the stack inserter has number 123, upon 124 it is enabled so it remains off.

Expected behaviour:
-Train waits at the station and the stack inserters remain off.

Actual behaviour:
-Stack inserters turn on for 1 cycle completing 1 drop-off and the train now has 112 of each resource.

This repeats each time the train arrives until the cargo wagons is full.
I suspect that there is a delay when the train station sends the circuit signals.
It instantly sends the train number on signal "X" (123) and has a delay in sending the contents of the train.
So the decider combinator reads that the cargo wagons contains no resources(due to the delay) and sends signal "X" 1 to the stack inserter. causing "X" 124 that enables the stack inserter.

This also is the case with a much simpler version where the stack inserter is enabled with resource < 10. and the cargo wagon contains 100.

Loewchen
Global Moderator
Global Moderator
Posts: 8317
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Loewchen »

Post a save with a minimal example setup, exact steps to perform and at what point it fails.

Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

Save:
Bugtest save.zip
(4.1 MiB) Downloaded 50 times
1- load the save
2- watch the trains arrive at the loading stations.
3- see how the inserters insert 1 item of each on each round.
4- question how this can happen because the settings on both loading stations should keep the inserters off.
5- hope the awesome devs can fix it ;)




Edit:
Using a filter inserter with "set filter" set to blacklist, connected to a train station.
To set the blacklist filter to the contents of the train will still enable the filter inserter to transfer any item like a normal inserter for 1 swing.
Bugtest save filter inserter.zip
(4.92 MiB) Downloaded 54 times
Last edited by Omega-Ryu on Sun Apr 12, 2020 5:26 pm, edited 1 time in total.

astroshak
Filter Inserter
Filter Inserter
Posts: 597
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by astroshak »

This behavior is because it takes a moment for the contents of the train to be read and propagated to the inserters.

Have a power switch for the inserters, and only have it come on when the station reads a train is present. That one tick is important, as you can see.

Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

It is, however is it intentional, a bug or something else?
due to it taking a bit longer before the contents is read the systems read contents as 0.

astroshak
Filter Inserter
Filter Inserter
Posts: 597
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by astroshak »

I’d say its intentional, because it is by the design of the circuit network. Each Update (aka each tick) the circuit network entity does something, and sends its results on the output to the next entity. The next tick, that next entity takes the information and does whatever it is supposed to do, sending it out to the next entity, and while its doing that, the first entity does its something.

The first entity, in this case, would be the train station. Tick 1 : train arrives. Station still outputting nothing. Tick 2 : station reads the train and sends its information to the network. Tick 3 : the next entities do their thing and send information on.

This delay is why inserters which are about to be told “don’t act” get one action in before they are ordered not to. Their default is “act”.

That’s why I suggested the power switch. Have the signal from the station go through a couple Arithmetic Combinators (Each + 0, Each) in series and have the power switch turn on when there is a train present. Force the inserters to wait (but make sure that the combinators always have power) until the signals have propagated the network.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by ptx0 »

astroshak wrote:
Sat Apr 11, 2020 10:56 pm
This behavior is because it takes a moment for the contents of the train to be read and propagated to the inserters.

Have a power switch for the inserters, and only have it come on when the station reads a train is present. That one tick is important, as you can see.
you need to do something with the items that get stuck in their hand, because powered-off inserters will still drop whatever they're holding into whatever train arrives.

also, powered off entities are awful for UPS.

however, filter inserters connected to circuit network and setting filter based on signals, go to sleep when no filter is set.

Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

Still with a dozen work-arounds id like to hear something official about this. if it's intentional or not?
Since the function is delayed (read content of train) a lot of ways this is intended for use will not work as intended. (start/stop/count) it all receives signal 0 the first tick than the contents.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by ptx0 »

Omega-Ryu wrote:
Sun Apr 12, 2020 4:13 pm
Still with a dozen work-arounds id like to hear something official about this. if it's intentional or not?
Since the function is delayed (read content of train) a lot of ways this is intended for use will not work as intended. (start/stop/count) it all receives signal 0 the first tick than the contents.
of course it is. how else could a deterministic game operate?

you must check for T signal before you do anything.

Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

Forwarded to the right department.

gGeorg
Filter Inserter
Filter Inserter
Posts: 392
Joined: Wed Jun 19, 2019 8:06 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by gGeorg »

Omega-Ryu wrote:
Sat Apr 11, 2020 3:22 pm
The decider combinator is set to sent signal X with count 1 to the stack inserter when the resource in the cargo wagon is less than (<) 10.

So, the signal from the station comes sooner to the inserter, than other signal which need to be processed. It is the way the game work.
Omega-Ryu wrote:
Sun Apr 12, 2020 4:13 pm
Still with a dozen work-arounds id like to hear something official about this. if it's intentional or not?
Since the function is delayed (read content of train) a lot of ways this is intended for use will not work as intended. (start/stop/count) it all receives signal 0 the first tick than the contents.
Function is NOT DELAYED.
Proceesing each decider, takes one tick. That is also wriiten in the officoal game Wiki.
https://wiki.factorio.com/Main_Page
How much more official statement you would need ? Chocolate Jesus.

All you need to do, make sure, inserter gets enable signal later or same tick as stock amount. For axample aritmetic combinator with AND will do.
Or use filter inserter and whitelist.

Omega-Ryu
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed May 01, 2019 3:32 pm
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by Omega-Ryu »

Dev picked it up and sent it to the right department. No need to revive this.
And as for all that. Yeah i know that. But the point is that the train station sent signal content is null on the first tick. That gets picked up as a 0. So an i serter that is set to enable if content X is below 100 will turn on for 1 dropoff. Even if content X = 2000.
Resulting in a constant increase of content X despite having given the inserter the command not to.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.18.18] build-50828. circuit network delay in train content.

Post by quyxkh »

Omega-Ryu wrote:
Sun Apr 19, 2020 12:33 am
But the point is that the train station sent signal content is null on the first tick.
No, your problem is that when there's no train at the station, the content readout is zero, which is less than 100, so your deciders are transmitting the go signal at idle. You can see this in the mouseover. Combinators take one tick to deliver their outputs, so their output this tick is the result of the calculation on the previous tick's values, the info signal output the first tick of a train's arrival is based on the train stop values one tick ago, when there was nothing. But the train stop is wired directly to the inserters, so they see the train stop values from this tick and the combinator result based on that previous tick. To be sure you send the train stop values with the comparison results that apply to them, delay them a tick so those results can be calculated.

Like this:
pic
and you can see that the cargo and train id values arrive at the inserters at the same time as the inserters see the calculated decisions based on them.

Post Reply

Return to “Gameplay Help”