Siffer

Time to write some stuff. :factorio-gun-turret:

Me and some friends have weekly factorio sessions where we are building a big base.

For some reason I've gotten really sidetracked into making complex circuit designs in factorio, so that's what I'm spending most of my time doing.

We initially joked that I should write a Confluence page for the various circuits, but as of yesterday it is now real requests.

So I'm going to make some posts about some of the components I've produced.

Table of Contents

* Table of Content {:toc}

Bus network overview

It is a common pattern to add green and red circuits to the power grid in rail network blueprints

A large power pole, with green and red circuits connected

The green and red circuit networks have been allocated to

Different architectures/bus designs/philosophies

I have thus far categorized larger circuit designs in two groups. The data bus :factorio-green_network: is the same in both, but the usage of the control bus :factorio-red_network: differs.

There is nothing that prevents one design from containing devices that internally use a bus design of the other type.

It is however advisable to decide which design to use for the global, rail-connected network.

Sovereignly owned buses

These buses are owned by a single central controller. The central controller orchestrates all bus traffic, and any peripheral devices are slaves that can not initiate bus traffic.

Shared buses

Devices connected to these buses negotiate and cooperate for access to the bus. Only a single device can control the bus at any single time. Once control is obtained, it is retained until it is volountarily released. Multiple bus operations can be performed during this time.

Shared access negotiation

This section contains the details for the negotiation protocol. Click to expand. A device outputs its [ID] on the :factorio-red_network:‍:factorio-info: signal for up to two ticks. It will read back the :factorio-red_network:‍:factorio-info: value from the bus, and if it is the same as the [ID] there is no competition for the bus. If there is another device trying for access at the same time, the value that is read from the control bus :factorio-red_network: will be the sum of the individual [ID]s, and we thus know there is contention. Devices must keep their [ID] on the :factorio-red_network:‍:factorio-info: signal at least until they have determined wether they are the master or not. If they become the master, the :factorio-red_network:‍:factorio-info: signal must be maintained until ownership is released. The value of :factorio-red_network:‍:factorio-info: on the bus must be examined for the first tick that :factorio-red_network:‍:factorio-info: was on the network in order to determine ownership. However, deciding on this may happen many ticks after the fact. The fastest design I have made requires only two ticks to determine this. Once a device knows there was no contention, it will put out its [ID] on the :factorio-red_network:‍:factorio-signal_M: signal. This is purely done for debugging purposes. During the ownership, the :factorio-red_network:‍:factorio-info: signal may fluctuate as other devices are trying for access. But there is only a single master, the [ID] of which will be stable on :factorio-red_network:‍:factorio-signal_M: signal.

A blueprint that performs this negotiation is available in Bus Negotiator.

Control bus :factorio-red_network: signals {#control-bus-spec}

Sovreign bus Shared bus Signal Description
:white_check_mark: :white_check_mark: :factorio-red_network:‍:factorio-signal_R: Address of register/device to put on the data bus:factorio-green_network:
:white_check_mark: :white_check_mark: :factorio-red_network:‍:factorio-signal_W: Address of register/device write data bus :factorio-green_network: content into
:white_check_mark: :white_check_mark: :factorio-red_network:‍:factorio-checked-green: Used to clock the addressed device, details depend on device
:white_check_mark: :factorio-red_network:‍:factorio-info: Used to query the control bus :factorio-red_network: for access.
Typically a device uses its [ID] for this.
:white_check_mark: :factorio-red_network:‍:factorio-signal_M: The [ID] of the current master of the bus

Addressable memory circuit

Addressable Memory

Blueprint
0eNrlWkuO4zYQvcqAq0wid0TqZxtJgAkyCLKYWUwWvRgMDFmi28ToY1BUJ0bDB5hb5Gw5SSjLttwybbJk+QNk02hJ5DPJV6x6VeQLmiYlXXCWCTR+QSzKswKNP7+ggj1lYVK9E8sFRWP0zLgo5RsLZWFavahbDD6glYVYFtO/0RivvliIZoIJRmuY9cNykpXplHLZoOldTgsRCpZnEnGRF2z9r/w5CTNwHzwLLeU/3oMn0eWgMhpVDYqqBa7+cBrv/wCTT75syXhUMrF+xCvr1WfiVqN74pRm7Z7Y1XddrfZebudDdvMJORPzlAoWDaI8nbIsFDk/nBrezsyV84oZr6dVjz3PBM+TyZTOw2cmO8seDepEfo7Zbg1mjBdiYkxSNKfR14qoglY4FZhc/YrzgaQkX1BeUzFG38u+eSkWJRx9dQZVX2RfUjVW8uMcNlex4ewGFtOIxZSfpqImgqxNbI8KV03FBrInHhoC7OohXYR8Pcox+qk7ARXSYilHWGZiMuN5OmGZxEHjWZgU9Cx6jmwc8roh0fA4MuPR3c1vu0wnibRrIh0jGmcsEZQDfdw0CbfrW1ac+b6/7/M6Lyw5sgAe1K04MFvuy618UroU+7VH+aGDQX/qyZt0p8CHUkBuQ8HjpSh4BFHQjpieJqCe/uxACHVP/zRpfcbYzAkFUAMY2NvYTl5bALmsBcS5uFhkX2MfMwOlix/CIvvQbDcOu5OBr0oGy2b5xdiowUF0BKc3GvZgdAWaveWZ0TnqItTsawq1LY8Ngbil036+gE4TvITItLYrI0d1mgPTaQRr3LehIMc2iGjnBkTvS5guevBMi9g47550uyq2neIZO+0NPDQkFoOIJTcg9vG2xDYO5BIZ2YHjtSGKaaQJCiPT9A8fc/C4KYwUaZgkgyRMF4d24TZ6SWUH20Hs7KAXR95OuH9BoIiqcLrqJXAgS4AvuAQ7H9PXCtiGK+CCVVvtKOwr51A0jOZK0daDZquxYeur89q+oZP2Oqtm+6qi+abVSbMsxtIyAMpyTsMd3VB+Z0KvmwXd24bSVCPa5X+dPMa6EoNhnRPDawzOhk9y1eOD2/GpUC/ENAAPQRp1t1Uco6XtRaMeROY+kkz6TPlSzFn21DHTNAz6lpaVkymmaRAbdWPRrAZ3x7WCs2k8q2CgCknHEwrTegCxweelNZlXFoT3J0gIqCROHDMXSXCH+oxzZwem97K5Dj2gpSPFMjom1ew9Ta0OB8bZvEb1kuCYGRHYga2j8tB9ntfuWU25MZndaa0FwGk8e7nd/BscAsJ5rxxLAML4TYkxBGH8rsQY9TAXbINAflWDOCCQP9QgLgjknRrEA4H8qQbxIVcDjGOo06H0em+XXP799s+9SKKRxmsD3HSrJ6gmS4D6+qh5uLArdqAbdidiR3u4hieBpHuNyrtqCnxfp+wEdOWF+KbKg7QvUxDD0hTpXppy/yelDCPNRTT7SEO0Z0y06f4MjE4x6jTNv+AhRpjte/6eTjLUpSS5ZkzQVMI1d6MtlIRTKgeK3sUxp0URThP6gaY5X75Jvz44b777mGeDv6SRUjHnefk0//Hj+7eymwxZxXrGQeBgOxgG3tBdrf4DlJuZPw==


Overview

Usage examples

Usage details

Initial setup

Bus interaction

The circuit is controlled with :factorio-red_network:‍:factorio-signal_R:, :factorio-red_network:‍:factorio-signal_W:, :factorio-red_network:‍:factorio-checked-green:. See the control bus :factorio-red_network: for an overview.

New data is sampled from the data bus :factorio-green_network: at the tick that the clock signal :factorio-red_network:‍:factorio-checked-green: has a negative flank. As factorio has discrete ticks, this means that the data sampled is from the last tick that the clock signal :factorio-red_network:‍:factorio-checked-green: was high.

Any signals except :factorio-green_network:‍:factorio-list-dot:, :factorio-green_network:‍:factorio-info:, and :factorio-green_network:‍:factorio-checked-green: can be stored in the memory.

Signal lamps

Data ports

The left-most arithmetic combinator is diode/gate from which the memory content is always available. Hook up your own logic (like remote alerts or anything) here.

How to read the content of a cell

How to write data to a cell

How to update/adjust the content of a memory register


Complete Bus negotiator {#bus-negotiator}

Blueprint
0eNrtXW1u40YSvUpAYIHdrDRgf1IykACaeBAYiJ2J7YGRXQwEWaJtYmhSoKjJGgMdYG+xP/Zke5Il9WEpVDe7q1WklXH+zFimVJS7Xr2uel3d/OLdxvNwmkVJ7p188aJxmsy8k39+8WbRfTKKy9/lT9PQO/GiPHz0Ol4yeixfTcJxNAmz7jh9vI2SUZ5m3qLjRckk/Jd3QhYdo4FRFuUPj2EejdU26OJjxwuTPMqjcPWNli+ehsn88TbMips8m5rNb2f5KI/SpDA/TWfR8sfixoWZLu14T8V/waL8ThUT9NlE+WfnoyTf/S77tuQbsbJW/FB800mUhePVddkpTeRZGg9vw4fR56j4fPGhuyjOw0wzoJ+jLJ8Xv9n+Hct3dC/LURin89IjxDCmOhvvdmz4O2MKsfGL0gYD2ThT2hAgGxdKG7LERzQblqN/N4pn4fJNSbLyyKy0S8p/snCyi56oeMWKd0bZeB7ly5dk8XGhQgczYHUfHzp0UDU6tmaHxeVJ9PzF76Jslg9hgJmFpY3hBsjLoUqnYbaKixPv78XH0nk+ncMML+yHtYjY4s1Uc1X8ftCpZtC5a0iKJkPyFCEkf0YIyQuEkFRTA0cIa0IQ/hhC3QNb2AW2cA1s0XJgnzYV2KegwOa1gc2qgd353WXSs3OKhAW+38pUrME5COanCHH/05HE/fhplKipsLfEiApQ91kYJlXQBBoUBNs7Po7iuBuPHqc1zl8FpMrdG8g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XCRO2vruQafd5kcGJWGQL2VgXcPALdXNlwYhVFquoEmoEMqVVpx2kLE/Wy3qdhRQl3JYBRXLRgnpuDmMa3flHPxgD9cH+rxH2Ml1eSQ7uc4xZOd3GLLzZQOnVklL1U66nJVzbATjJrG8SDcX9Hg9btkBJLlDec5eSeqCWZ5LDitb9tIRCZljJIcVdzVzm2U5JcFi3eaZGWLxug4NkNTg2vpMU/VupUOAwpvBG0d8asDWKgYnS+vHJUnQCcXSlpFddm2xV7KfFLmYtNYdYLqCMOkKpoU43Un0sgc/HZ8DznqT5qpVd6Cz7klssm/18OEVjINFeYNZkbpN5vH6WcbbfUrla9bfecOqkKmcb/Nxmf6WD1A+2Xlgc8eLR7dhATHv7Xx2Ed4XBksYfnP+6Q355q8/FLiMwzzslD+Mxnk4+Vvxic9FrbS0HASM+D3BCCWLxf8BNhdqdw==

The bus negotiator is a basic control device that requests access to a shared bus.

This device is composed of the LCG pseudo-random generator generator, a ID-generator, and the basic form of the bus negotiator.

Overview

Usage examples

Usage Details

Initial setup

  1. Put the train in automatic mode and have it wait at the station (see ID-generation)
  2. Start the device by putting it into idle mode by toggling the state-seeding combinator on/off.
    • Click to show in image
  3. Connect it to the control bus :factorio-red_network:

Bus interaction

See the details of the shared bus protocol

Picture

![Complete bus negotiator](factorio-designs-1/factorio-bus-negotiator-complete.png)

Data ports

The data ports have been gated to prevent accidental signal corruptions.

Signal Lamps

Counting from left to right

Color and location Description Signal to enable
:factorio-signal_cyan: Upper row, 1st Idle state :factorio-signal_I: = 1
:factorio-signal_yellow: Upper row, 2nd Aquire state :factorio-signal_A: = 1
:factorio-signal_pink: Upper row, 3rd Try state :factorio-signal_T: = 1
:factorio-signal_red: Upper row, 4th Wait state :factorio-signal_W: = 1
:factorio-signal_green: Upper row, 5th Master state. The bus is ours!! :factorio-signal_M: = 1
:factorio-signal_red: Middle Red light, indicates that there is no [ID] source yet.
See Initial setup for details.

UUID

UUID generator

Blueprint
0eNqlVMuOqzAM/ZWR11DxKGXEejbzAV1dVSiA20YDCUpCdauKf7829KWBKw2dDShOzrF9fJILFHWHrZHKQXYBWWplIftzASsPStQcc+cWIYOTNK6jiAdKNBwYT/hb6D2QqsK/kIW99yIyWoT8fELGi5AfT8h1v/MAlZNO4tj0sDjnqmsKNNTOA+2MkIej8+nHpK22hNKKMxKTH3lwpt+652K+sUR3FiZRvnW6nVIENwYPaAbO6Dov8ChOUhs+YVFVudP5QAHZXtQWPTAoqpz5WqxuW850tDMs7ls/lkeqvYZ+rEFhyfVZhoX8ORhE9ayTrFj+HZ+3TozNwHb7ySJPZIjvudhjTijnl7oppBKOWpzoEa6SUZF4lRB/Jc1YDmSbeYX2snZoXjFvqTt2f/AbG084XjD0hOMFa084BpNLm+uba5YMN+Lhzsxyfc9daxqidvKE/70VwSrepOF7ymPURhLV1SpcpMNmqKHU3GMylyxZegujOZbNQpZgjiRdSEKVkPq2PGLV1dc35qEYr9dP+6N1v12k3TA/kokij6fag1oUWF9PvTVfq4hiJ/L/gE3TOAzekziMwr7/BzMG95o=

This blueprint generates a game-unique ID on the :factorio-info: signal.

The ID is 100% guaranteed to not collide, so it can be safely used to give ID's to devices and circuits without having to do central book-keeping, and it makes blueprinting easy.

Initial setup

Just put the train in automatic mode and you are set.


Misc

Diodes / Gating {#diode}

It is sometimes important to prevent back-propagation of signals to prevent accidental state corruption and isolate circuits.

This can easily be achieved with arithmetic combinators. To only allow :factorio-signal_A: to travel in one direction, simply do :factorio-signal_A: = :factorio-signal_A: + 0.

If you want to allow all signals through, instead do :factorio-signal_each: = :factorio-signal_each: + 0.

You might do * 1 as well, but I find it easier to spot diodes when using + 0.


Chronological (or something ¯\_(ツ)_/¯ ) Category: factorio