# Automation help

## Recommended Posts

Hello,

I've been trying to design this automation setup but cannot figure out how, mostly because I'm super confused about how the memory toggle works. I have an okayish idea about the rest of logic gates but i feel that without toggle this setup cannot be achieved so I'm hoping someone could help.

I looked up what truth tables are and this is what i'm trying to achieve.

Input               Output

0       0                  1

1       1                  0

0       0                  0

0       1                  0

0       0                  1

And then it cycles.

##### Share on other sites

So you're trying to create a state machine of some kind? A DFA graph would be more helpful than an incompatible truth table

##### Share on other sites

1 hour ago, Aelfled said:

So you're trying to create a state machine of some kind? A DFA graph would be more helpful than an incompatible truth table

Yeah it is like a state machine. But DFA looks quite technical to me and i'm not from a engineering background so I wouldn't know how to do that.

I did figure out a way to get the above logic required but it uses a ton of AND and OR gates. I realize the truth table looks quite stupid now that i've read about it a bit more but hopefully someone can help to get a more compact solution.

##### Share on other sites

Yeah, all digital logic can be implemented with ONI's logic gates, but that doesn't mean it would be compact, a state machine of more than 3 states would probably be enormous.

It's possible to do a truth table of a state machine built out of logic gates, but you need to include the output signals of the memory toggles as inputs as well as the normal inputs

Then there's ways of simplifying a truth table (I was taught Karnaugh maps at school) to reduce the number of gates required, but that can only take you so far, if what you want to do is complicated.

##### Share on other sites

Here's something that'll do it.  It will beep incessantly in one of the states but the desired output works.

The thing about the truth table that is immediately suspect is the change from 0 0 to 1 1.  Think about how do both inputs change simultaneously without one of them being ultimately derivative of the other?  We can test it artificially with the game by pausing and toggling both atmo sensors as in the diagram, but in the game world, if you're measuring temperature or something with one line and something else with the other, then it's improbable that both sensors flip simultaneously.

This kind of logic is difficult because we intuitively know what we want but it's really hard to formally express without omitting a key piece of information, and the minute you are able to express what you want completely and properly, the solution is almost always very obvious.  For example, with the state change from 0 0 to 1 1, tease out if you are trying to accommodate something like "no change in output until both A and B are 1" (Effectively masking intermediate state changes of 0 1 and/or 1 0).

You already know that a truth table won't be able to describe what you're after, but so far that's all you've given us.  If my diagram above doesn't do what you actually want, then can you try telling us what you're trying to do?  A screenshot might help too.

As for the memory toggle, the wiki has a great explanation.

##### Share on other sites

On 9/8/2019 at 11:25 AM, whodunit said:

Hello,

I've been trying to design this automation setup but cannot figure out how, mostly because I'm super confused about how the memory toggle works. I have an okayish idea about the rest of logic gates but i feel that without toggle this setup cannot be achieved so I'm hoping someone could help.

I looked up what truth tables are and this is what i'm trying to achieve.

Input               Output

0       0                  1

1       1                  0

0       0                  0

0       1                  0

0       0                  1

And then it cycles.

Are these the states and the cases upon which you want to switch. If so it is a state diagram and not a truth table. If it is the state diagram, then the interpretation would be:

In state 1: Output high - Wait for both inputs to be high - Goto state 2

In state 2: Output low - Wait for both inputs to go low - Goto state 3

In state 3: Output low - Wait for input 1 to be low, and input 2 to be high - Goto state 4

In state 4: Output low - Wait for both inputs to be low - Goto state 1

If so you could use a chain of memory toggles which toggle the next one and reset the current one when the inputs match the transition (and it's the current state is active), then pull the output off the start state. In the example here, meant to be easy to understand rather than minimal, I also use a reset line with the buffer gates set to 0.3, 0.2, and 0.1 seconds to force a reset to the start in case a mistake puts it in a position where more than one, or no state toggle is active.

##### Share on other sites

On 9/9/2019 at 11:29 AM, Saturnus said:

It would be helpful to know what you're trying to automation, and what the specific conditions of operation are.

I was trying to automate the fuel delivery to the rockets so that the fuel only gets delivered when the rocket has returned. With input 1 being the output from command capsule and input 2 being the dedicated rocket scanner. I also understand I could just easily use the memory toggle with "set" signal being the scanner output and reset being the command capsule output.  But I wanted to use all the different states that the 2 inputs go through to achieve the required automation state as well as a learning tool.

So essentially, 0,0 would be when the rocket is home, so pump fuel

1,1 > rocket is leaving, stop fuel (could also detect this using liquid pipe sensor)

0,0> rocket left, stop fuel

0,1> scanner detects rocket coming back, stop fuel

0,0> rocket home, start fuel.

Hope this makes sense, i'm fairly new to the game and to logic concept in general.

On 9/9/2019 at 8:32 PM, ZanthraSW said:

That was really helpful but i think while the system is in state 2 and both the inputs go low, it jumps back to state 1 instead of state 3.

##### Share on other sites

1 hour ago, Saturnus said:

Seems to me you don't really need input 1 except as a matter of starting the state changer in the correct place.

Let me explain. See input one as a manual reset in a two bit adder on a single edge detected input that output active only when the result is double positive.

0, 0 = 1
1, 1 = 0
0, 0 = 0
0, 1 = 0

is the same as

0 = 1, 1 > 1
1 = 0, 0 > 0
0 = 1, 0 > 0
1 = 0, 1 > 0

where input 1 merely makes sure we start the bit counter at the 1, 1 = 0, 0 > 0 reset position.

Okay i read up on what a two bit adder is and what an edge detection is and i kinda know what you're talking about when you say that input 1 is just there to make sure that the state changer is started in correct place. But i'm not sure what a double positive on a single edge detected input would be? (is it when both the sum and carry of previous bit is 1?).

However, the other ( 1, 1 = 0, 0 > 0 ) thing just went over my head.

##### Share on other sites

1 hour ago, Saturnus said:

when input 1 = 1 and input 2 = 1 then sum = 0 and carry = 0 which results in an inactive output

Okay that makes so much more sense. For some reason I was seeing that as 1, (1=0), 0>0 instead of (1,1), (0,0) and 0.

It's so exciting that this is making sense to me and that i can imagine a logic circuit made up with this. Thank you for explaining all this in a noob-friendly manner! I'll try to make this in ONI and hopefully I won't make any stupid mistakes.

On 9/9/2019 at 5:50 AM, SpreadsheetGamr said:

You already know that a truth table won't be able to describe what you're after, but so far that's all you've given us.  If my diagram above doesn't do what you actually want, then can you try telling us what you're trying to do?  A screenshot might help too.

Yeah sorry about not giving the complete scenario. Basically I was trying to automate the fuel delivery to rockets.

0,0 would be when the rocket is home, so pump fuel

1,1 > rocket is leaving, stop fuel (could also detect this using liquid pipe sensor)

0,0> rocket left, stop fuel

0,1> scanner detects rocket coming back, stop fuel

0,0> rocket home, start fuel.

And you're right that the state change 0,0 to 1,1 is definitely suspect and not something achievable in-game. I just thought it was most likely a stupid thing I was trying to achieve and if I could get a general idea of what to do, I might be able to sort of manipulate the general idea into what exactly i was looking for.

##### Share on other sites

5 hours ago, whodunit said:

That was really helpful but i think while the system is in state 2 and both the inputs go low, it jumps back to state 1 instead of state 3.

There are 2 AND gates for each state change. The first identifies whether the inputs are correct for a state change, and the second makes sure that the state to the right is only enabled if the state to the left is enabled. It can only go to state 1 if state 4 is active.

##### Share on other sites

On 9/11/2019 at 10:13 PM, ZanthraSW said:

There are 2 AND gates for each state change. The first identifies whether the inputs are correct for a state change, and the second makes sure that the state to the right is only enabled if the state to the left is enabled. It can only go to state 1 if state 4 is active.

Yeah you're right. It was my mistake. By far the only solution and the best one that's working for me, even after reload. Thank you!

On 9/11/2019 at 7:23 PM, Saturnus said:

hen every change on the input 2 thereafter whether it be from active to inactive or vice versa is an active input to the adder so after the 3th change in input state on input 2 both sum and carry will be active and output will be active. The next change (the 4th one) on input 2 will result in it starting over, no matter if input 1 was even connected or not. And it will just then loop.

Is what i'm doing the right thing? I can't seem to get the correct output

##### Share on other sites

Hey there, I was just asking the same question, and found the perfect solution in the thread I created.  Now, I'm not automating liquid fuel just yet, but the concept is the same for using oxylite and using conveyor shutoffs for only when the rocket is landed, or in your case liquid shutoffs.

I've expanded it a tiny bit since I last posted in that thread, because there was a problem with sending green to the shutoffs and gantry, so I added a 200 second timer to the memory toggle outputting green to absolutely make sure the rocket has landed before turning on fuel delivery and opening the gantry back up.

up by the scanners there is a 40 second filter on the rocket detection, which means the rocket is coming back.  at that point, I send green to set port on the memory toggle, which sits to the right of the rocket, which then hits a 200 second filter to give it the absolute time to land before sending green to the shut offs (the shutoff automation is to the bottom left of the left most rocket by the way, connecting to the oxylite refinery) and extending the gantry.  As soon as the rocket automation sends green for all prerequisites for launch, I then send that to the reset port on the memory toggle, basically telling the system that the rocket is now gone, stopping fuel delivery and closing the gantry.

I hope this helps!  As you can see the left most rocket is there, sending green to the shutoffs, and the right most is JUST about ready to launch.  It's receiving no more fuel, and is waiting for a short filter to make sure the bottom bunker doors are shut so it doesn't melt my miners in the event the rocket launches immediately after a meteor storm.

CipherLoco

##### Share on other sites

I decided to do a video of the fuel delivery automation I just finished, since I realized I had a rocket returning when I posted last.  I hope this is close to what you were looking to do.  Anyway, have a good one.

##### Share on other sites

On 9/12/2019 at 9:23 AM, Saturnus said:

It's basically me being a little less teasing than @SpreadsheetGamr above.

Hey, I object! I never meant to be teasing.  I genuinely believe these things are difficult, regardless of your experience or whatever.  It's kind of a metacognition thing (which I'm super interested in).  Knowing something intuitively usually comes easily, right?  But being able to explain it logically to someone else (or a computer) is often difficult.  I have nothing but admiration for OP who is pushing themselves to learn new things.

All I was trying to say is if you break it in to two steps it can be easier.  Explain the 'problem' in totality first, then map it in digital logic.  Once you get part A right, part B becomes easier.

##### Share on other sites

@SpreadsheetGamr@Saturnus I used the 2 bit counter @GamesOmatic mentions in this thread

. But instead of the required output, i get something else instead. What am I doing wrong or how can i fix this?

##### Share on other sites

Great, thanks for sharing!

##### Share on other sites

On 9/16/2019 at 4:05 PM, Saturnus said:

. Here's the set up as I suggested in a working state.

This was perfect! I just tried it and it's just fascinating. Thank you

##### Share on other sites

On 9/18/2019 at 11:41 PM, whodunit said:

This was perfect! I just tried it and it's just fascinating. Thank you

##### Share on other sites

15 hours ago, fishoutofwater said:

sure man, here. It's not exactly tailored for rocket launch so you'll have to make some tiny adjustments but it was what I was looking for.