An Asynchronous Multiplexing system (CSMA/CD on a Factorio Wire!)

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
Posts: 30
Joined: Mon Oct 19, 2015 9:04 pm

An Asynchronous Multiplexing system (CSMA/CD on a Factorio Wire!)

Post by Eketek » Mon Apr 01, 2019 10:19 am

I have designed a transmitter which is able to share a single circuit network with an arbitrary number of other transmitters of the same design. The transmitter is clockless (doesn't use time slots, opting instead to attempt immediate transmission and use collision detection and resolution). It sends complete signals (all channels from the input signal but a few reserved ones are sent).

The transmitters make use of Wube's high-tech circuit networks to omit a lot of checks that would otherwise be required to implement CSMA/CD (signals which are instantaneously transmitted, additive, perfectly synchronized, and absurdly parallel are *extremely* useful).

[local] I - Identifier - a Unique number assigned to each transmitter
[wire] I - sum of all active transmitter identifiers
C - Contend - Total number of transmitters currently in contention for the wire (used to lock out subsequent transmitters until all currently contending transmitters transmit)
T - Transmit - Number of transmitters currently transmitting (used for collision detection)
A - AverageID - Mathematical average of all active transmitter IDs from the preceding tick. (used to resolve collisions)

Transmitter IDs should be unique. Due to the use of integer math and not wanting to add extra combinators to compensate, all IDs should be set up in increments of at least 2.


The transmitter expects a pulsed command to initiate transmission. It expects the signal to be a held value (it may also be continuously updated while the transmitter is working).

Conceptually, the transmitter is designed as something resembling a simple state machine.

Code: Select all

IDLE:  Wait for a "Send" command, then set state to "WAIT"

WAIT:  Wait for C=0 then set state to "SEND"

SEND:   Send [I C=1 T=1 SIGNAL]
        Set state to "CHECK"
CHECK:  Send [I C=1 T=1 SIGNAL]
        If C=1 set state to "IDLE"
        If I>=A and A>0 set state to "YIELD"
YIELD:  Send [C=1]
        If T=0 set state to "SEND"
Transmitter Blueprint
Note: The transmitter blueprint is set up to trigger from the "dot" signal (see the screenshot below)

The receiver watches the network for valid transmissions (indicated by 'T=1') and converts it into a single-tick pulse.
Receiver Blueprint
"Central" Controller

Basically, somewhere on the network, you'll need an arithmetic combinator which computes I/T and outputs it to A. Here is a blueprint that does that:
Central Controller Blueprint
The test build (with testing apparatus disconnected) is laid out like this:
async-multiplexer-draftsetup.png (2.78 MiB) Viewed 763 times
This design has not been extensively tested or used in any practical setup, but since it did successfully resolve 8-way collisions, correctly handled inputs received with one tick difference, and has a pretty simple design, it probably will be alright to immediately and impulsively tear down your entire existing system use my design exclusively for dispatching ambulances and fending off invaders.

This design is a major improvement over an earlier unpublished design, which used random backoff, was a lot more complex and less efficient, and didn't work.

Update: I have re-arranged the transmitter combinators to be semi-rotationally-symmetric and put together a blueprint book:

Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Sun Jul 31, 2016 5:52 pm

Re: An Asynchronous Multiplexing system (CSMA/CD on a Factorio Wire!)

Post by cid0rz » Mon Apr 29, 2019 6:13 pm

Looks interesting, ill have a look at it, thank you!

Smart Inserter
Smart Inserter
Posts: 1239
Joined: Thu Mar 17, 2016 6:27 am

Re: An Asynchronous Multiplexing system (CSMA/CD on a Factorio Wire!)

Post by Qon » Sat May 04, 2019 12:45 pm

I was just planning on doing something similar to this. I hadn't decided if I wanted to use average ID like you to resolve conflicts or if I wanted to use timeslots(/centrally coordinated messaging depending on ID). I was leaning towards timeslots but I guess it depends on how I want to use it. I have a central unit that can coordinate messages and assign timeslots. So the base CPU can ask a specific outpost it wants info from about some data and the outpost unit will be given the OK to transmit back its response in the following tick. But then outposts can't initiate emergency requests when under attack and instead have to wait for the CPU to loop through all outposts to check if anyone is requesting permission to speak.

For both systems, each unit needs a unique ID. But I don't want to set up unique IDs for outposts manually, I want the blueprint to set that up automatically. So I made a blueprint that can generate unique (for the network) IDs! I found this thread by searching this board for prior art. And your blueprint book would be a perfect match for my blueprint. I started making it because I read a request for a unique number combinator and realised it could be implemented with the combinators that already exists. It's pretty simple and I'll make a thread about it soon, but atm I posted the BP in that thread (2 posts after another, second contains the BP).

Time to study your system in detail :)

Post Reply

Return to “Combinator Creations”

Who is online

Users browsing this forum: No registered users