When cloning a set of combinators, for example a memory cell, the signals stored by/on the wires of the combinator are not cloned.
The most simple example of this is an arithmetic combinator feeding back into itself, A+1 output A, the cloned combinator will begin the count at 0, not the value the original had.
[0.17.11] Cloning combinators doesn't preserve signals "in flight"
Re: [0.17.11] Cloning combinators doesn't preserve signals "in flight"
Thanks for the report however I don't consider this worth changing. The clone logic doesn't preserve this kind of data on almost anything. The data isn't actually on the entity but on the logistic network itself which is not cloned/cloneable.
If you want to get ahold of me I'm almost always on Discord.
-
- Fast Inserter
- Posts: 124
- Joined: Wed Aug 23, 2017 10:17 pm
- Contact:
Re: [0.17.11] Cloning combinators doesn't preserve signals "in flight"
This does come up in game for Space Exploration mod.
Whenever a ship is launched and the contents are cloned to the travel surface, all of our combinator computers get rebooted.
Observations:
When power is cut, combinators retain their outputs.
Even when not connected to any network, the powered-down combinator remembers.
It is this internal combinator state that is failing to get cloned.
PS: The combinators taking a tick to power up is important here; when pausing and replacing all the wires without the electical blip, the data is lost.
It seems like we need to refresh the tally of outputs in the network when the wires change.
For example: I've fed a math combinator with some starter values, and then removed the power. It remembers its outputs many ticks later: I then delete all logic networks from the map. Restoring power and adding a brand new logic network to feed back, which currently has no signal tally in it. And it just works. Signal values from the combinator state itself. It looks to me like the network is holding a cache with the sum of combinator outputs, used for display purposes and speeding up logic calculations, but that cache needs to be refreshed at the beginning of the tick if there are any changes, and the combinators are where the true source of the data is.
As a fancier logic test, a fibbonachi sequencer was able to operate successfully after powerdown, complete wire replacement, and resume.
Whenever a ship is launched and the contents are cloned to the travel surface, all of our combinator computers get rebooted.
Observations:
When power is cut, combinators retain their outputs.
Even when not connected to any network, the powered-down combinator remembers.
It is this internal combinator state that is failing to get cloned.
PS: The combinators taking a tick to power up is important here; when pausing and replacing all the wires without the electical blip, the data is lost.
It seems like we need to refresh the tally of outputs in the network when the wires change.
For example: I've fed a math combinator with some starter values, and then removed the power. It remembers its outputs many ticks later: I then delete all logic networks from the map. Restoring power and adding a brand new logic network to feed back, which currently has no signal tally in it. And it just works. Signal values from the combinator state itself. It looks to me like the network is holding a cache with the sum of combinator outputs, used for display purposes and speeding up logic calculations, but that cache needs to be refreshed at the beginning of the tick if there are any changes, and the combinators are where the true source of the data is.
As a fancier logic test, a fibbonachi sequencer was able to operate successfully after powerdown, complete wire replacement, and resume.