Logical operations tutorial?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
GlassDeviant
Fast Inserter
Fast Inserter
Posts: 170
Joined: Wed Feb 11, 2015 1:51 am
Contact:

Logical operations tutorial?

Post by GlassDeviant »

Is there a good tutorial for logical operations (in Factorio) anywhere? There are some things I want to implement that I don't know how to do using the circuit network.

One particular example from just the other day, I had this:

Decider 1: If petroleum > 200 send signal grey+1
Decider 2: If sulfur < 1000 send signal yellow+1
Decider 3: If plastic < 1000 send signal white+1

And what I wanted to do was this:

Pump for petrol to sulfur plants: If grey > 0 AND yellow > 0 then operate.
Pump for petrol to plastic plants: If grey > 0 and white > 0 then operate.

Obviously I need something between to do the actual AND operations and provide a single signal to drive each pump, but I am having some sort of brain fart and can't wrap my head around what I need to do here. It would be simple if I could just make grey + yellow = orange and grey + white = green, but that doesn't seem possible.

Although, having put down on "paper" the problem, I have at least an inkling of what I need to do. I'll leave this here in case it doesn't pan out, perhaps someone can suggest something.
- GD

Sorry if my posts are becoming difficult to read, my typing ability is rapidly deteriorating due to a nerve disorder. I try to clean them up before posting but don't always get every last typo.

User avatar
GlassDeviant
Fast Inserter
Fast Inserter
Posts: 170
Joined: Wed Feb 11, 2015 1:51 am
Contact:

Re: Logical operations tutorial?

Post by GlassDeviant »

So I tried using 4 deciders like this:

Decider 1: If petrol > 200 output 1 white
Decider 2: If plastic < 1000 output 1 white
Decider 3: If petrol > 200 output 1 yellow
Decider 4: If sulfur < 1000 output 1 yellow

the outputs I connected to the circuit network, then I connected the pumps to the network and set:

pump to sulfur plants: If yellow > 1 operate
pump to plastic plants: If white > 1 operate

This did not work, and when I checked a power pole on the network it showed only White 1, no yellow, on the network.

So then instead of putting the signals onto the network (hey, it made sense to me) I connected the decider outputs directly to the pumps they were signaling to and it seems things are working now, or should if I ever get more petrol.
- GD

Sorry if my posts are becoming difficult to read, my typing ability is rapidly deteriorating due to a nerve disorder. I try to clean them up before posting but don't always get every last typo.

Frightning
Filter Inserter
Filter Inserter
Posts: 807
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Logical operations tutorial?

Post by Frightning »

I always handle AND-gates as follows:
-Setup two decider combinators and arithmetic combinator.
-Deciders are wired to incoming signals and each check one of the conditions, if true, they output 1 on the same signal.
-Decider outputs are wired to Arithmetic combinator inputs (1 red wire, other green wire)
-Arithmetic multiplies the two signals and outputs a 'control' signal (e.g. I use L for light oil cracking and H for heavy oil cracking)
-Control signal is wired to device(s) I want to regulate (note, I use different color wire for control signal than I do for input signals to avoid possible interference).

What this does:

Either the arithmetic combinator sees 1 from a given input signal or nothing at all (functionally equivalent to a 0 for that signal). By multiplying them, I am creating the operation table:
1 0
1 1 0
0 0 0

Which describes logical AND as a truth function from propositional calculus (https://en.wikipedia.org/wiki/Propositional_calculus)
With some creativity you can probably figure out methods for the other basic logical operations and more complex conditions, but I only ever find myself using this, and only for regulating oil cracking.

Post Reply

Return to “Gameplay Help”