Jump to content

Signal Selector/Distributor-based Signal Lock

Recommended Posts

Hello everyone.
Recently I decided to join the open testing, and try some new stuff before upgrading my current base with it.
This is theĀ first somewhat complex thing that I came up with and I decided to share it with the community.


* So, what is this thing and what does it do?

This logical scheme has 4 pairs of bound inputs and outputs. Signal from each input is retranslated to the corresponding output, however, the scheme is restricted from retranslating more than one green signal at time. If multiple inputs are green, only one would be picked for retranslation, and the outputs for other green input would retranslate red until the picked signal would turn red. After that, another green signal would be picked and so on.
Basically, whenever it discovers a green signal from any of the outputs, it "locks" on it (hence the name) and ignores other signals until the first discovered signal becomes red. Then it proceeds to the next green signal, locks on it, and so on.
For people who are familiar with coding may think of it as analog of lock for multithreading.

* Where could this thing be used?

This solution may be useful in situation where single resource is shared between multiple concurrently running systems, and there is need to ensure that those systems are not trying to access the resource at the same time.

For example, let's say there is a single aquatuner and a number of separate liquid reservoirs. For whatever reason it is not desired to allow liquids to move between reservoirs. As an alternative to building additional aquatuners and creating closed cooling systems for each reservoir, the Signal Lock may be used in order to restrict access to the aquatuner, so only one reservoir would be able cool its contents at the same time.

* How does it work?

The signal selector "polls" the inputs, selecting each one in a cycle until it discovers a green signal. The logic wire from selector is connected to signal distributor and to polling mechanism, so encountering green signal disables the polling and enables distributor to retranslate the signal to the selected output. Selector and Distributor are taking the same settings from the polling mechanism, so inputs are always synchronized with tier bound outputs.



The polling mechanism could be made from two timer sensors that have a different green and red signal duration, but I decided to choose a harder way and made it with from single timer sensor and two counters.

Basically, my polling system is a two-bit register that counts ticks from the timer sensor and resets on overflow.

To simulate 1 bit behaviour, the counter should to do two things:
1. Send green signal when it reaches the value of 1;
2. If it has value of 1 and it gets another green signal, it should reset to 0.

While the first thing is a matter of sensor's settings, the second behaviour requires additional logic gates.
The second gets a little bit harder.

The general idea is that reset input requires an AND gate that is connected to both input and output. However, if a green signal on the input wire last longer than a single game tick, it would result in counter resetting right after reaching 1 instead of waiting for the next green signal. To counter that, the counter that is directly connected to the timer sensor requires memory gate to be included to the resetting logic. Instead of connecting straightly to the AND gate, the output signal should go to the SET port of the memory gate. The input wire should be connected to both AND gate and RESET port. That way, when counter would set to 1, the signal from the timer would block memory gate from activating, and that would keep counter from resetting. The next time timer emits green signal, it would activate the AND gate just before resetting the memory gate,
thus successfully restoring the whole system to its original state.

The last part, polling lock, is made by combining timer and NOT from Selectors's output with AND gate. Timer's green signal would pass to counter only if the Selector is currently retranslates red signal.

Link to comment
Share on other sites

If you additionally want to keep your version "rotating" between the ports, just add a third counter. So this version basically distributes to all X targets that are enabled. With the switch you can cycle between these both modes.

Timer is set to one. Buffer is set to 0,1 just to prevent backlogging.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...