Need help with Multiplexers

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
TheRangerLOL
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Fri Sep 18, 2020 11:56 pm
Contact:

Need help with Multiplexers

Post by TheRangerLOL »

So, I need help with multiplexing, and the problem i have, (as far as i'm concerned) can only be solved with multiplexing.

I've been trying to follow this post: viewtopic.php?f=193&t=61722
...but it doesn't entirely make sense to me. What's worse is i know how multiplexers work irl, but it's been years. I'm kinda at a loss right now and need a little help. The product, i hope, will be worth it and i'll definitely be posting it in the creations forum.

Oh and i'm working on 32-bit so i can't do copy-paste blueprints, so technical explanations are preferred.

Thank you to anyone in advance. If not i'll figure it out eventually. :lol:
The one and only.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2804
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Need help with Multiplexers

Post by mmmPI »

In the post you link are included several practical details that could make what's happening look a little more complex than what it really is.

Basic logic for it could be summed up as this : Each signal sent is similar, only the time at which it is send gives it a meaning. If you have 10 iron outpost, each of them would send a signal that could be 1000 iron, 500 iron, 0 iron, 250 iron and so on.

Problem: if you send all of them at the same time, they are summed up.

One could use a different signal for each oupost, let say A = 1000 ; B = 500 ; C = 0 ; D = 250. but this is limited quite quickly, and you need to manually assign a fake signal to each indiviual outpost.

Other solution is "multiplexing", meaning that each outpost will send 1000 iron, 500 iron, 0 iron 250 iron, but at a different time.

For this the basic component are 1) the clock, 2) multiplexer, 3) Demultiplexer.

The clock is connected to both mux and demux, it allows for the emiter to known when to emit, and for the receiver to know what to read.
The clock send a signal , let say C; its value will be 1 2 3 4 5 and then again 1 2 3 4 5 and again and again, each time sending this value for a duration of 1 tick.


Each multiplexer will have a unique number, either 1 or 2 or 3 or 4 or 5. And each of them will send a signal only during tick 1 or tick 2 or tick 3 or tick 4 or tick 5.
So 1rst outpost send iron=1000, next tick 2nd outpost send iron=500, next tick 3rd outpost send iron=0,next tick 4rth outpost send iron = 0 and so on.


a demultiplexer is allowed to read signal based on the C signal from the clock.
A simple one would read signal only when A= 1, and it would be the receiver for iron quantity in the first outpost.
You can have a second one that read signal only when B=1 and it would be the receiver for iron quantity in the 2nd outpost. And another one for the 3rd and 4rth outpost and continue this way.

In the linked post the demultiplexer seems a bit more developped as it is able to receive a Q signal that with my example would be 1 or 2 or 3 or 4 or 5, up to 10 if you have 10 outpost. Those are called channel in the post. And the demultiplexer can dynamically change which channel is being read by adjusting the Q signal.




Also in the linked post are what i called practical details.

For example if you try to apply theory: "outputing iron = 100 during tick 1 in the first outpost" and then "outputing iron = 500 during tick 2 in the second outpost" you will probably use a decider combinator at each outpost set with "If C=1 output everything" at 1rst outpost "If C=2 output everything" at 2nd outpost.

But doing this will shift every value by 1 tick. Because the 1rst tick at the 1rst oupost the check will be performed "If C=1", but the iron quantity sent at tick 1 ( when C=1) can only be read the next tick due to how circuits function in factorio.

If you have a constant combinator that output C=1 and you then place 5 arithmetic combinator in a row doing "each +0 = each " at the end you will have C=1. But if you change C in the constant combinator, it will take 5 ticks for the value at the end to change due to the time needed for the signal to propagate.

This particular behavior you need keep in mind when doing the whole system so that it stays synchronized.

Hopefully it helps, i made a similar system quite some time ago it was fun but overkill and overengineered for my needs. I learned from the forum i may not be able to explain a more advanced system than the one i did :).

User avatar
TheRangerLOL
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Fri Sep 18, 2020 11:56 pm
Contact:

Re: Need help with Multiplexers

Post by TheRangerLOL »

mmmPI wrote:
Mon Sep 21, 2020 11:53 am

Hopefully it helps, i made a similar system quite some time ago it was fun but overkill and overengineered for my needs. I learned from the forum i may not be able to explain a more advanced system than the one i did :).
Hey so this is what i was working on, in case you were curious: viewtopic.php?f=193&p=513458#p513458

It helped me understand the points i was missing, but i ended up not using the multiplexer for the system I was working on because it would end up strobing the lights. Odds are I'll end up using it in something else though, when i run out of signals to send. I know it's possible to create constant signals after demuxing, I just didn't feel like going through the effort of doing all that. Besides, I think the system that's being used probably requires less combinators than using a multiplexer. Making one is kind of redundant anyways, if you think about it, since technically all the lines are already multiplexed on green and red.
The one and only.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2804
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Need help with Multiplexers

Post by mmmPI »

TheRangerLOL wrote:
Tue Sep 22, 2020 4:33 am
it would end up strobing the lights. I know it's possible to create constant signals after demuxing

if you think about it, since technically all the lines are already multiplexed on green and red.
glad it could help.

You can avoid strobing lights aka getting constant signals after demuxing, if you store the value in a memory cell, then each cycle of the clock would update a value that will then stay constant untill next update.

Those kind of setup quickly ramp up the number of combinator required and become quite a mess quite fast ( at least when i do them ).

The trouble doesn't feel worth unless for example you decide to use the red wire to receive all quantity of all material in all buffer chests of all outpost on the map, and the green wire to send instruction based on the data you receive on the red wire to open or close some station. In this particular case i found myself in need of pushing more datas through each wire than what is possible with constant signals.

This is also the moment i learned that you need to leave yourself some notes about things, because i was lost when trying to understand how what i did function after a week or 2 off :).

User avatar
TheRangerLOL
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Fri Sep 18, 2020 11:56 pm
Contact:

Re: Need help with Multiplexers

Post by TheRangerLOL »

mmmPI wrote:
Sat Sep 26, 2020 2:51 am
TheRangerLOL wrote:
Tue Sep 22, 2020 4:33 am
it would end up strobing the lights. I know it's possible to create constant signals after demuxing

if you think about it, since technically all the lines are already multiplexed on green and red.
glad it could help.

[...and stuff]
Haha yeah, I'm going to have to make some notes before I start my next map since I can't copy/paste blueprints (v.14.23). I might have to end up using the muxer for if/when i decide to fully map out my rail network with the system i recently posted about elsewhere. It'll be a challenge but a fun one.
The one and only.

Post Reply

Return to “Gameplay Help”