A simple memory counter didnt work (combinators)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
FritzHugo3
Fast Inserter
Fast Inserter
Posts: 104
Joined: Tue Jan 09, 2018 4:30 pm
Contact:

A simple memory counter didnt work (combinators)

Post by FritzHugo3 »

image55.jpg
image55.jpg (329 KiB) Viewed 1758 times
Left from right:

Constand combinator only for the income signal simulate)
(One positive red signal)

Middle is asking if there is a red signal bigger than 0
(And thank the left constand combinator ist true)

Right say, the incoming red signal + 0 and tadaa the Number hwo came out is 1

But! If i put a cable from the output tot he input (remember the incoming signal is plus sero, by the way same think by multiplicat with 1, its not always the incoming number one! He add one again and again and goes upper and upper.

I dont understand it, normaly its only a little countbuffer but why the number dont stay (add 0 is add 1 please can me anybody explain this).


I want only a very simple memory counter (no storrage or Item)
If i say incoming 5 output shoud permament 5

I have look here https://wiki.factorio.com/Tutorial:Combinator_tutorial but maybe im to stupid for it ;-) (yes i have many time googled and tested many time ingame)

Thank you all.

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

Re: A simple memory counter didnt work (combinators)

Post by quyxkh »

The signal on a wire is the sum of all signals on connected output posts.

Combinators operate on the sum of the signals at their two input posts.

Your arithmetic combinator has both inputs connected, so its output post next tick will be their sum plus 0 -- i.e. each tick the combinator will output the 1 Red (from the green wire) plus its current output (from the red wire) which is the sum of its inputs the previous tick, plus 0. So, each tick, its output is the previous output plus 1 Red.

Thinking in circuits is weird.

Engimage
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Wed Jun 29, 2016 10:02 am
Contact:

Re: A simple memory counter didnt work (combinators)

Post by Engimage »

You are messing up with the names of things.

A counter is a unit which basicly counts stuff and stores the sum.
The rightmost combinator (arithmetic) with its setup and connected output to input - is indeed a counter.

But here is the basic stuff you need to learn.
  • Each interconnected wire set is considered a separate "circuit network".
  • The signals on each network are a sum of all output signals connected to the network
  • All networks are calculated in the beginning of every game "tick" which are those magic "UPS" and are normally 60/second, and the value is based off previous tick output values.
  • All output entities including combinators are calculating their outputs based on input values and the new (updated) output value will affect only next tick calculations
  • You can debug every network by connecting it to a power pole with that color wire and mousing over power pole
  • Every entity with multiple inputs (red + green) will basicly sum those inputs and consider it the resulting input value.
So looking at arithmetic combinator. With a +0 and output connected to input it will store some value (so that it inputs the same value as it outputs). This is called "memory cell" as this particular setup can store value. The main problem here is actually setting its stored value properly.

However if you input extra something to input it will add that value to stored value EVERY TICK (as it does sum its inputs, red and green). This function is called "counter".
In your setup the added value is Decider conbinator's "1" value so basicly this counter in your setup counts ticks while decider combinator value is true. This is why you see it incrementing by 1 every tick.

So if you want some help you should more definitely describe what are you trying to achieve.
Last edited by Engimage on Thu Jan 18, 2018 8:35 am, edited 3 times in total.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 584
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: A simple memory counter didnt work (combinators)

Post by BenSeidel »

Your "memory cell" is accumulating the input value on each game tick (60 ticks in a second). So what you have built here is a clock.
What you want is a pulse into the cell (a value for a single tick).

Inserters & belts can be set to a "pulse" mode so that it only emits the value for one tick.
If you are not hooking it up to either of these entities you can build yourself a pulse generator: https://wiki.factorio.com/Tutorial:Comb ... Generators

But that's your issue. Each game update the combinator takes it's previous output on the green wire (1.5k in your screenshot) and adds it to the value of the red wire (1 I'm assuming) and outputs it for the next tick on both it's output red & green wires (the red one being the input as well).

FritzHugo3
Fast Inserter
Fast Inserter
Posts: 104
Joined: Tue Jan 09, 2018 4:30 pm
Contact:

Re: A simple memory counter didnt work (combinators)

Post by FritzHugo3 »

I think i have understand the problem. I think too much in Minecraft-redstone logistiks, i thougth the constand combinator (in the left [for me its the name say constant its one single signal ;-) ]) signal its like a single Minecraftbutton/lever (one single signal) and not like an pulse every tick (like a redstoneclock).

What will i do? Oh i have serched many times for shuffle (not realy shuffle most shuffle in combinations with some arguments, my english are not good enouth to explain it better, sorry) the train-stops. Allways i found tutorials for read chests and items and i dont like it. I like to read a train at a positon and count this, and than disactivate or activate the trainstops with the same name. (Its a little bit more complicated at this but yes, my english smile)

Thank you quyxkh this was realy helpful, short and easy for not english peoples smile. Thank you also PacifyerGrey, many thinks i knowed (from puhhh 20 youtube tutorials or so), somethings not.

Have both a nice day.

Post Reply

Return to “Gameplay Help”