Liquid level regulator

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
Tomiket
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Mar 26, 2024 12:24 am
Contact:

Liquid level regulator

Post by Tomiket »

Hello.
Ensuring that the refineries work and don't overfill one output is not difficult, but I didn't like that when I set the minimum and maximum levels, the pumps would start and immediately shut off again. It's logical. When the light oil level drops below 15,000 for example, the pump power on for fracking heavy oil, bringing the light oil level above 15,000, which turns the heavy oil pump off again. Depending on the size of the base and fluid consumption, it can be annoying

So I devised a controller that turns the pump on once the quantity is below 15000 (light oil for example) and keeps the pump on until the quantity is 19000 and then turns the pump off. Once the quantity drops below 19000 the pump will no longer turn on and will wait until the quantity drops below 15000 again.

I hope I translated that correctly.
Test2.png
Test2.png (588.52 KiB) Viewed 668 times
Test.png
Test.png (39.92 KiB) Viewed 668 times


0eNrtmVuOmzAUQPfibzLCvEFtpUr97gaqESLgZCyBQcZEjSIW0IV0Y11JbagmGcLDtvJSZ36QsPH19T2+D5sDWOcNqigmDEQHgNOS1CD6cQA13pIkF21sXyEQAcxQAQxAkkK8ZSjFGaKrtCzWmCSspKA1ACYZ+gki2BqLAhKK2UuBGE7HZVjtswEQYZhh1GvUvexj0hRrRPkkc7oYoCprPrQkQgEubgUdA+xB5D+5fI4MU5T2vZYB+JoZLfN4jV6SHeaj+ZB/MmPel3VyatG6wbRm8dnKNnmDs+PSKiTEoaZYbZNaLEkYlSXCwtA1TVM0FFVCO00j8OfXbz62bFjVjMjeYcoa3vIqvf9iZfaCqz1XsSEs3tCyiDHhMkC0SfIatf3EpF9opz4Ujy1FiJwalKseee0z/9ya7BdWwjRtMOteIf+8FZAHTKwFvCNYLCUsR7FyZKasB4X1aiRkKJq8rBAH1+kIvn7/pkdOiQ18a3vrxO7i3R12z5O05Uja6iTNd0cSTpOkKBtaPjgDZUg52xA49CaJj8zqDHm/FRbKbQdHLdgG14u1s/vgGGiHQfbzLUPsCAZbhZkvB8XVyoDBnTNgeJ4BP+n53uPlP+9VywJlmC8f5Xx6ykNnxc0xxsR9cjsqYUdFWl933qvhQrc5bFgaILl+XzdrBDfOGqZO1oD3yBrOfDIIzsBMJBVoq9UJgRzxQJd4+EFcOvpPIPUX6gRHJefY0hvJldsZoU7JEN6xZIAXKBngVUuGKSLeOZE51+bhfxyZcE21/OXppS9vvgq1pvTTO/NDeOeSZ7Cxvjz8cR86cj4OLT0g5uPdwjx+DQrthSJNFpqtCM26IrQbHucuGZtHcutUcLbU6i7Jsx90dK/apKPhf35DI0lr/qA0X1Mteqx0qSdZjUPVKwHzignyhmXXZbNjoOaxUNZlPZ2K+Dzseu8k7I4aO1TzqAvdhkP1i43gI9heLIUq/uIYOw+1Qnr3BzI6+eNpgB2idc8lgI4fWn7ghLYXem37F2G89Ys=

Tertius
Filter Inserter
Filter Inserter
Posts: 671
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Liquid level regulator

Post by Tertius »

It's great you created a switch with a low and a high threshold. This is called a hysteresis. This is commonly used with a circuit that remembers its state to decide if it should apply the low or the high threshold, which is called RS-latch or SR-latch (SR = set/reset).

I don't want to disappoint you, but there is an easily understandable example of a RS-latch with hysteresis in the wiki that uses 3 combinators for this:
https://wiki.factorio.com/Tutorial:Circ ... er_version

It seems you didn't find out yet the purpose and the implications of a wire that feeds back an output to the input of a combinator, so it has its previous output as input and has some kind of memory this way. Your setup also has such a feedback loop, but it's somewhat obscured. Explore the behavior of combinators, especially their 1 tick latency that delays the input to the output. Use the map editor for this (start a new map in the creative mode scenario), because in map editor you can single step through ticks and investigate the circuit status after each single tick.

SpookyMask
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Mar 17, 2024 3:27 pm
Contact:

Re: Liquid level regulator

Post by SpookyMask »

Tomiket wrote:
Tue Mar 26, 2024 12:54 am
So I devised a controller that turns the pump on once the quantity is below 15000 (light oil for example) and keeps the pump on until the quantity is 19000 and then turns the pump off. Once the quantity drops below 19000 the pump will no longer turn on and will wait until the quantity drops below 15000 again.
It's a wonderful approach - you did it yourself, respect for that. But there is always a simpler solution! I try to keep that in mind. Welcome to the forum; I'd be glad to follow your progress.

Tomiket
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Mar 26, 2024 12:24 am
Contact:

Re: Liquid level regulator

Post by Tomiket »

I'm not disappointed. ;) I came up with it on my own and that makes me happy. ;)

This is hard for me, because I can work with logical 1 and 0. But signals are a different field for me, and it was hard to stop counting 0 as zero and realize that 0 is nothing.
The fact that the comparator of 1 and 0 = 0 is wrong because 0 doesn't exist and I have to make 0 as a signal, hence 1 (0 as 1-if the condition does not hold, then 0 is S1-thus illogical 1), which is outside the realm of my knowledge and way of thinking.


Thank you for your acceptance. However, there probably won't be much from me. Many of the solutions are simple and there is no point in publishing them in any way, as they would probably not help anyone or be useful.

If I'm making a mistake in the translation, please correct me. ;)

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Liquid level regulator

Post by mrvn »

It's much easier to implement this with some chests or belts, inserters and a fish (or any item really).

For each oil refinery recipe you make one chest or belt piece and connect it to a pump. If the fish is in it the pump turns on. Then you add the inserters to move the fish between those positions according to your thresholds. The location of the fish makes it easy to see where the system is at and easy to follow how it changes.

Only drawback is that you can't blueprint the fish. You always have to place it manually (unless you add a requester chest to get the fish).

PS: It's even more fun with a crafting combinator (mod needed) so you change the recipe in the oil refinery instead of turning pumps on and off.

Tertius
Filter Inserter
Filter Inserter
Posts: 671
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Liquid level regulator

Post by Tertius »

Tomiket wrote:
Tue Mar 26, 2024 8:41 pm
The fact that the comparator of 1 and 0 = 0 is wrong because 0 doesn't exist and I have to make 0 as a signal, hence 1 (0 as 1-if the condition does not hold, then 0 is S1-thus illogical 1), which is outside the realm of my knowledge and way of thinking.
When dealing with single signals you explicitly use in some condition, the vanishing of a signal with value=0 usually doesn't matter. A condition A=0 will just work and result as true, if A is 0 (or A is nothing) and A isn't appearing as signal. You can also check for A=B, and it will result in true, even if A and B are both 0 and actually vanished.

The vanishing of signals with value 0 becomes important if you use one of the * wildcards (EACH, ANYTHING, EVERYTHING), because for these wildcards only signals with value <> 0 are processed and considered for checking the condition. For example, the condition ANYTHING=0 always results in false, because only signals with a value are processed, and this means these signals are not 0, so it's false for all considered signals, so the wildcard result is false as well. For this case, the EVERYTHING operator comes in handy, because it has the special case that if there is no signal with a value, so every signal vanishes, it results in true no matter the actual condition. So if you check for EVERYTHING=0, it actually results in true if every signal is 0 because of the special case and in false, if any signal is not 0 because of the condition.

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

Re: Liquid level regulator

Post by mmmPI »

Tomiket wrote:
Tue Mar 26, 2024 8:41 pm
This is hard for me, because I can work with logical 1 and 0. But signals are a different field for me, and it was hard to stop counting 0 as zero and realize that 0 is nothing.
The fact that the comparator of 1 and 0 = 0 is wrong because 0 doesn't exist and I have to make 0 as a signal, hence 1 (0 as 1-if the condition does not hold, then 0 is S1-thus illogical 1), which is outside the realm of my knowledge and way of thinking.

Thank you for your acceptance. However, there probably won't be much from me. Many of the solutions are simple and there is no point in publishing them in any way, as they would probably not help anyone or be useful.
Your blueprint is difficult to understand for me because it's only logical 1 and 0 in value and name of signals :) I am more used to signals as letters with many digits for value, but there are situations where it is necessary to understand other logic because there is no alternative. It's interesting to see and learn how it works, i don't know if it's useful, but it's fun :D You have some solutions, but now you need to find problems. :lol: Lamps and speakers always need complicated solutions !

Maybe this is similar to what Tertius said, i'm not sure with translation. I notice none of the arithmetic combinator is used to do simple arithmetic operation, only bitwise logical operatio. When signals are 0 it is annoying to detect, but is is possible to detect if there is a signal that exist and is > 0 with the "ANYTHING>0" in decider combinator. i try an example :

Code: Select all

AND gate
A) S0 = 1 ; S1 = 0 ; S0*S1=0 ; Anything>0=> False
B) S0 = 1 ; S1 = 1 ; S0*S1=>1 ; Anything>0=> True
C) S0 = 0 ; S1 = 0 ; S0*S1=>0 ; Anything>0=> False
D) S0 = 0 ; S1 = 1 ; S0*S1=>0 ; Anything>0=> False

NAND gate
A-) S0 = 1 ; S1 = 0 ; S0*S1=>0 ; Everything=0=> True
B-) S0 = 1 ; S1 = 1 ; S0*S1=>1 ; Everything=0=> False
C-) S0 = 0 ; S1 = 0 ; S0*S1=>0 ; Everything=0=> True
D-) S0 = 0 ; S1 = 1 ; S0*S1=>0 ; Everything=0=> True

XOR gate
E)S0 = 1 ; S1=0 ; S0+S1=>1 (S2) ; S2=1=> True 
F)S0 = 1 ; S1=1 ; S0+S1=>2 (S2) ; S2=1=> False 
G)S0 = 0 ; S1=0 ; S0+S1=>0 (S2) ; S2=1=> False 
H)S0 = 0 ; S1=1 ; S0+S1=>1 (S2) ; S2=1=> True 

XNOR gate
E-)S0 = 1 ; S1=0 ; S0+S1=>1 (S2) ; S2 !=1=> False 
F-)S0 = 1 ; S1=1 ; S0+S1=>2 (S2) ; S2 !=1=> True 
G-)S0 = 0 ; S1=0 ; S0+S1=>0 (S2) ; S2 !=1=> True 
H-)S0 = 0 ; S1=1 ; S0+S1=>1 (S2) ; S2 !=1=> False 

OR gate
I)S0 = 1 ; S1=0 ; S0+S1=>1 (S2) ; S2>=1=> True
J)S0 = 1 ; S1=1 ; S0+S1=>2 (S2) ; S2>=1=> True
K)S0 = 0 ; S1=0 ; S0+S1=>0 (S2) ; S2>=1=> False
L)S0 = 0 ; S1=1 ; S0+S1=>1 (S2) ; S2>=1=> True

NOR gate
I-)S0 = 1 ; S1=0 ; S0+S1=>1  ; Everything<1=> False
J-)S0 = 1 ; S1=1 ; S0+S1=>2  ; Everything<1=> False
K-)S0 = 0 ; S1=0 ; S0+S1=>0  ; Everything<1=> True
L-)S0 = 0 ; S1=1 ; S0+S1=>1  ; Everything<1=> False

NOT ( inverter )
Decider S != 1  output "1" 
It was a short example at first, but i kept noticing some missing gates and for some i wasn't sure anymore so i needed to test in the game. The first operation is always arithmetic addition or multiplication, and the second comparator always give "comon sense" result, i thought, no surprise with bitwise operation on 0's, maybe some are special rules, they seem logical to me. When "True" it is possible to ouput "1". Everything = 0, true, result in 1. This is bizarre maybe. But it is possible to do S !=1 => S output "1". So the 1 is turned into 0 and 0 into 1. This way for A-) C-) D-) G-) or K-), it is possible to transform "true"=>"0" and "false"=>"1" with a "not" combinator. I think those are the situations you mentionned "illogical 1". I saw you did change a 0 to a 1 in the blueprint using S=0=> S output"1" there are many variations to find , but to me it's harder to use them x)
Last edited by mmmPI on Fri Mar 29, 2024 8:36 am, edited 2 times in total.

Tomiket
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Mar 26, 2024 12:24 am
Contact:

Re: Liquid level regulator

Post by Tomiket »

Thank you for all this advice. ;) This is already too complicated for me and I would have to look at it in game and try it out to fully understand what it does. In any case, I will save this, and check it out as soon as I have time. ;)

As I wrote, signals are a different field, and I'm not used to having 1 add up, hence the very common feedback problem of not being able to reset the comparator state by bringing in a 1, because instead of resetting the XOR 1 and 1 = 0, it starts cycling to infinity when I have 15,000 1's on the input.


Again as I write, I can work with logical 1 and 0, that's why the S1 and S0 are used in the blueprint, it was easier to work with and understand what I was doing. ;)

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

Re: Liquid level regulator

Post by mmmPI »

I added the names of the gates in previous post after searching them on wikipedia, and built the XOR and XNOR as example maybe it helps.The XOR already exist in the arithmetic combinator with the AND and OR gates, i made a similar version with them.

I have attempted to use such gates to build a similar controller with no sucess so far.

Natha
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: Liquid level regulator

Post by Natha »

This type of circuit you created is called "Schmitt trigger".

Post Reply

Return to “Combinator Creations”