#Fuel Cell Ratio-er

1 messages · Page 1 of 1 (latest)

dire prism
#

Ah, here we go.

#

Fuel Cell Ratio-er

late pawn
#

can you post what you got so far? and explain how it works of course

dire prism
#

Yeah, I'll try.

late pawn
#

well explaining how its supposed to work is enough for now lol

dire prism
late pawn
#

first glance that seems way overcomplicated

dire prism
#

This is a mock up/toy of where it will actually be used for me to try to not go more insane. That's why it's in a 'blueprint sandbox'.

#

As you can see there's a pair of crates at the top feeding in enriched (left) and unenriched (right) ore, inserters packing it into a central crate, and an inserter that will unload that crate. The 'edge' crates are just for mockup.

#

To the right is an attempt at a circuit.

late pawn
#

does it have to output the stuff constantly or is it fine if it waits until theres enough for one cell, then unloads it all at once?

dire prism
#

It is intended to load the box, then unload the box.

#

The top two combinators control the left and right inserters. The left is enabled by a [L]ight signal sent when in [P]ut mode and there is < 1 enriched ore. The right is enabled when in [P]ut mode and there is < 19 unenriched ore.

late pawn
#

okay because thats easier than continous output

#

well i guess not necessarily

#

but this is a classic SR latch situation, gimme a few minutes

dire prism
#

The next combinator down is a memory cell. It stops sending itself its input upon a [R]eset signal, but otherwise does nothing interesting.

#

Below that are a pair of decider combinators that monitor the crate and decide which 'mode' to be in, [P]ut or [G]et. [P]ut mode should be entered when there are 0 enriched and 0 unenriched uranium. [G]et mode should be entered when there are 1 enriched and 19 unenriched uranium.

#

Below that is a leading edge detector (two combinators, the ones with the yellow stars). It is intended to notice when the [P]ut or [G]et signal becomes non-zero. When that is the case it emits a [R]eset signal to the memory cell so that the previous mode is forgotten and sends it to the next element...

#

To the right of that at the bottom is a combinator that is connected to the mode-selecting combinators and, when sent a [R}eset signal, should pass their signals along for 1 pulse. Note that this path is 1 combinator longer than the reset path so it should arrive after the memory cell has been reset.

#

The 3 strange strands off to the left are push button combinators (not in the base game, but a very popular mod, and the only thing here that is modded other than the sandbox world, which is also a popular mod). These push buttons send whatever signal you want for 1 pulse. I was using them to force the memory cell into particular states ([R]eset, [P]ut, and [G]et) to try to debug this mess.

late pawn
#

0eNrdV1lu2zAQvQu/qUCrYwtogZwgQH4Dg9AyTohIlEBSbtzAB+hBerGepEPKll1FiW05TtHCP9Rw5g3fbKRfSFo0UEsuNIlfCM8qoUh8/0IUfxBJYWQiKYHEJIeM5yCdrCpTLhJdSbKmhIscnknsremACTzXEpRytEyEqiupnRQKvWfmr+eUgNBcc2jd2o8VE02ZgkRcusXiYsEFbjnZIyhNKKkrhWaVMP4QyvHCq4iSFYndq8h6aPWZAq25eFBGT0JZLYE1uFdokJAzrqHErUVSKKCkFbcn2fht8Oy8KR0/mKLTrGpMoDzXpaSscqOQaKeAxB6pC8Z8beLR4+LTd0I5xMey8SybnEvI2t3QnEJoWRUshcdkydEaTTaYDPdyi2MJ738hpwWXSrNXedrnuLbwSieW58zw6FvpVW2sllzqBiUdrVbDuW0xyjqRllpMvpCtANjGOBE5McmvGl03ul9yBzzctB7qFbP5YAtZlYwLBNpk0iRgIANBB5Q2xZPDhQKJ+R4Kvr8ppjb8QwHPuMwarhmIJC0gJ7GWDZbQVtxF3uiOi2CXhVfhHGQXdjALLMd32QV/tMpecXn+p5O9OUwWy2QJUmJ9M9TKnhD8O2yGTi8I0Q5eAxRvTwt/LwQDOJMTm9Ubbta34vkx3Rr1QvdfNev18eXsvVXO4T9ezdMTrj/3wtdfdOb1N6MHngXvNGnQT+x0wIHnnuHBP8qDd+pU2J6/h/2ZQ6FXgb9+/CRDc+LwU2AA6GMnxe3ISeGd+rJyL5+Wk8fuVzJiet9dfHqPzklwRjNGRzVjeIaH8CgP0ch2j/5aXQHeLCv9iAN/oDJGF8HdUUWA6N+QtMG+96lHsS2DOcWlTyPq21WIP7MKdtu4RSdWaFY4YbtlazTZqU7Q+toKUS00Urve82VExjCc42HM3Wae+t3/W0owOsqmJJr4s3A2i8LrwHcDfAH+BlSsGx4=

#

this works

#

theres infinity chests in this from sandbox but you can replace those with anything

dire prism
#

The observed behavior is that this contraption will go into put mode, load a crate properly, go into get mode, unlode a crate properly, and then fail to go back into put mode.

late pawn
#

i cant fully debug yours without a blueprint, but i think youre overcomplicating it with the modes, you can drop one of them, that ensures you dont need tight timings on the reset since it doesnt need a new value, it just considers it to be in put mode when the cell is empty

dire prism
#

This is my mess 0eNrdWc1u2zgQfhceC6owSUmWDOytQC49BL0GgSDbTExUf6WopEbgB+hb7GVfbJ9kh5IlqrZkU2qTLHrKmCY/zsw3f3Re0DqpeCFFptDqBYlNnpVodfeCSvGYxYley+KUoxXa8o3Yculs8nQtsljlEh0wEtmWf0crcsADR5SMs7LIpXLWPFG97fRwjxHPlFCCN9fVH/ZRVqVrLgEPtxgiK7lUsIZRkZdwIM/0DfpO9tHDaI9WjvvRO2gFTkBoB/Kc51ueOZsdL9UlIG8YiNlos7yijWurzfKKNl4HVKZxkjg84RslxcYp8oQP4NEWjw3j+XiErwuOAkxgcyskXF1/HwwAL2cAMxvgoAN+iEvlXCDFHVWYQHRAsCuZJ9Ga7+InAQENpzZCbiqhIp7F64Rv0UrJiuNuGY5suxsehCxVZMJe7Qut1JOQqoIVw1O9w/msM0AnmIp1thH9IS1iWefSCv2FDkP0hBPp9q7QTRYGUHGejMah1/fdEBCxpsEfpcF9cxY+zWKBUPtgXk4KZsJmIFvlHzElZ10lXy8R1HFNauA3puRmHiWeveM6+xZWjvOn5Rxd9N03BLi06SCtkmMgwXR77cydWmL8HvpQ3zUVZmBoOIcLW7gTVYfj8AhpAq6so7P36W5yAN5eDUB8jnmEqIALUaUOZd4ICo+O18fZFunJJ69UUanTOcuuexR7sLzKVPQg8zQSGQCh1UOclPxwP5gmlExig5I/hI3gBCX8vXR8mkuH9VTa5vBI+6VsYtYGR7yRuYC60+KkrXn03eLky+U4+ffH3+j3cs6fuNyrncgeoSON0DtxOqf0CiumFRVVuVtXSsHZ8WBxR/t32TBU/iyD+e0TDoP/E+hMp6tXWcDoG3wBWsNilsu03nSSsnqhqlkCx93rl2AZae2bVBkyfGlneNuLvDc3/PaVDA/mdU/v9fJwrNOdGXqeahMqtQXa3MS9nVusw3m98x24GO+Wv0zMeQt9JZpuZtLEFna1on0++W9eK25ep1YwM9vFUqhdyhV0GqtyEViFqEE9idKJrZrHm50mF3wKMJGJKQcsyAsOPqjVQB9QGztTwYcjg05sx+0PRuHIL4FTh67W3WTkrcSmTV3dEEfIu41dLZeXJq9/5heBL9eKABzg6jmXX2tbpPkp4lFybrJlpFR4M5/2ZGQMZ/60FkE7vP/r3KzrUB8xsnP3r7RmqxvwtE5SBwBo9Qw+1jrdedjDIfbu8V2ACaYLzECEBUyaVbJolkknk54c9OSwkUmzR8MQF1MMLyhXy34PU8vwJqhlfRe82rQM13T7AcLIzOyvZXbc78JdUMxII5v98AfDG4F28tLI0BaNfNyvnQA4NWaAGWaN/iC7WqadfMQMe3vC3p7Q7NFfa3ytm1ZRr7NG7vRv5MYuxnqyq8/6cBaYEoqn+rfK7h9SGMGDq6zTw/Np6Iah5y4ZXTDIxP8A7mrePQ==

#

Yours does seem to do what I had in mind. I'm pulling it apart to try to figure out how it works.

late pawn
#

its basically just

Insert when uranium is below desired level and memory cell isnt running
Activate memory cell when chest contents reach desired level
Ouput while memory cell is active
Reset memory cell when chest is empty

#

the one issue here is that 19 is a prime number so you can only insert single pieces of stuff if you dont include extra ciruitry to handle that

dire prism
#

I'm fine with that.

#

So the reason I 'needed' this thing is another friend wanted it. I've done complicated circuitry before, but not something like this. Normally I would just hook up the fuel cell maker and use an automatic power switch to shut off what comes before it if it were to back up.

#

But once I started working on it I ran into all sorts of difficulties. I'm used to using 'normal' programming languages and kept having thoughts about doing it normal ways, running into the fact I can only emit the count or 1, not, for example, arbitrary values, and so on.

#

At this point I more want to know what I did wrong than the solution.

#

I can foresee someday needing a fancier finite state machine than just ABABAB.

late pawn
#

yeah that makes sense, i think in that case you should have decider that matches the state, and clears the cell

#

for each state

dire prism
#

There is one.

#

That leading edge detector that emits the reset and then uses the emitted reset to pass along the new state is intended for that. But for some reason, while P transitions to G, G does not transition to P, and I can't understand why.

late pawn
#

you should run it in tick mode in the editor

dire prism
#

It would really help to have a single stepper for this stuff. There was a mod for that, but it doesn't work in 2.0, which is what I'm playing with that friend.

#

Not sure how to do that.

late pawn
#

open console with ^ and enter editor with /editor

#

that has time controls where you can pause and advance by one tick

dire prism
#

Shift-6 (^) doesn't seem to do anything.

late pawn
#

keep in mind with no extra cabling a memory cell is always empty for 1 tick after resetting, that might be causing issues

#

weird

#

well you can bind the console to somewhere else

dire prism
#

Ah, I actually thought about what happens if there's no mode. The inserters only work when there is a (non-zero) mode so they should at worst seize up.

#

Looks like the console defaults to the backtick key?

late pawn
#

for me its on ^ but i might have set that at some point

#

i also dont exactly know which of your combinators is the memory?

#

im not great at debugging other peoples stuff lol

dire prism
#

Okay, that's weird...

#

Running it at the lowest speed, it does not seem to send the [R]eset or [P]ut signals after [G] ceases to be true. I'll try again to be sure.

late pawn
#

you can stop time and go tick by tick

dire prism
#

The memory is the only one with the red star in alt mode, the one beneith the combinators for the inserters.

late pawn
#

ah right, i usually set mine to R = 0 instead of R != 1 lol

dire prism
#

The whole thing has had its conditions screwed around a lot, either to get something unstuck or try different ways at working around problems.

#

There is a leading edge detector involved so that may have had something to do with it. I know I tried a non-biased edge detector for a while. I don't know what the G-to-P transition is doing that is special from the P-to-G one.

late pawn
#

doesnt seem to transition from empty to G either

dire prism
#

Might need to start in a sane state. Can push the R button and then the P button if necessary.

late pawn
#

i think if you made it enter G on its own it might already fix your issue?

#

since the empty tick at the end of P is essentially the same as the initial state as far as i can tell rn

dire prism
#

I'll give that a try.

#

Nah, it just resets doesn't enter [P]ut mode.

#

Which is strange, because here's the state of that node

late pawn
#

does the P arrive at the memory cell?

dire prism
#

Which, if my leading edge detector works (and it seems to for P-to-G) should mean the P signal went from 0 to 1 and thus created a leading edge and thus caused a reset followed by passing along both signals for a tick.

#

Just that only one signal is ever non-zero at a time.

dire prism
late pawn
#

well then its gotta be happening between those, i dont quite get why you do each *-1, can you explain that?

dire prism
#

That's how an edge detector works. You connect some input to both the input and the output of an arithmetic combinator and set it to multiply each input by -1. Networks merge by addition. So if nothing changed between the tick at the input of the arithmetic combinator and the output of the arithmetic combinator X + -X = 0. But if it did change, it'll be non-zero. If it is something going up (like putting something in a crate), it'll be >= 1 (i.e. a leading edge). If it's something going down (like ammo being fired by a turret), it'll be <= -1 (i.e. a trailing edge). I use them all over for various things. The reason I reached for one here is I knew memory cells don't work right with hold signals, so I needed to convert the hold signals from how much the crate is holding of each kind of ore to a pulse signal (so it wouldn't count up like a timer).

late pawn
#

ah right, yeah of course lol, i was being stupid

dire prism
#

I use them in 3 different kinds of automatic power switches I designed, so I'm pretty sure I have at least a vague handle on that part.

#

And those switches actually do work exactly like I expected, unlike this thing. :p

#

Yours is better. It uses less combinators, and thus less power and space. I'm more bothered by why mine doesn't.

late pawn
#

yeah i get that lol

#

i did make a working state machine at some point but i dont think ive saved it

#

also still working on my FIFO memory stack so i cant really help rn

dire prism
#

I figrue if I could find some generic "clear the old state, put the new one in, given a condition" I could make arbitrarily complex ones. I have no idea what I'd need that for, but FSMs are useful in programming (e.g. regular expression pattern matching), so it'd probably come up. That's what I thought I'd managed to do with everything below the top two combinators. You got your memory cell. You got your conditions for state transitions. When a state transition condition changes to true, that's a leading edge. When you detect a leading edge, first you send a reset, then you send the new state.

#

Just somehow it only works P-to-G, not G-to-P.

dire prism
late pawn
#

i think youre working with a lot of intermediary signals that make this hard to read, you should see if you can get rid of those first

dire prism
#

Maybe. Using separate signals for each thing makes it easy for me to see if I've got spurious signals, and I tried to not have any conceptually unnecessary ones. You can't 'and' in an inserter enabling condition, so I needed signals for those, at least 3 since there's 3 different conditions for when they should act (load light, load dark, and unload). There's a reset signal for the memory so I can try to switch modes. There's signals for the put and get modes. The get one suffices for the unload inserter enabling condition. I believe that's it.

late pawn
#

i guess i didnt do anything else in mine

late pawn
#

oh btw @dire prism heres a version that doesnt need 19 inserter cycles

#

0eNrdV1lu2zAQvQu/qcDavAhogZ4gQPoZGIKWcUxEogSSSuMGPkAP0ov1JB1StuyodCwrS4t+GBgNNW/INzOP8hNJiwZqwbgi0RNhWcUliW6fiGR3PCm0jyclkIjkkLEchJNVZcp4oipBtpQwnsMjidwttYTAYy1ASkeJhMu6EspJoVBHYd52SQlwxRSDNq152MS8KVMQiEvPYFFSVxLDK67zIqTjBlchJRsSTa5CzJQzAVm7Pteb7CXwugRpU9w7jEsQChcsuP4pXBdBkDclqiJOYZ08MOQGozImsoapGHiSFpCTSIkGaOfGkLzLsGJCqvjAoNrUelMPTKgGPd0u2zecL5pEXSuV6MK5+qGsE2HKEpFPZnmXRwL+VJLdI/x3aHeBy9UDCIEVfbbmehaOfPpCD9gKYGhy+zQFdpZ2mAc6pOHu6On2T3p2+2mwGVhTOp4/7xGy0Oe4kNTrFuMZj3sHxLvghOdEd23VqLpR/VkZVrZ6g6dtuIpXoipjxhGIRKukkLBdbreWCgTDu9TbdWlL/we35fXZtrSdLjzAKIDCydYg1Utn0xNowZmOEIvJJWIxu3AQXPsgnNKLt5mEsFeD/2oQ5h3QKpHqxUFwT1U2+AfV+qQeWzhYdPCJYGpdgmLZIEX2hjbiAbfXi+25j2WWEgn6nbPaXNWA5zVpiUP2bTOcw69aOyxsuJMRU78XEn/I1LvuKzJ4gzJ4lwrLfv897I/UlV4T//rxk9ik5vxNbQF6W7G5Hik27qUfPpP3L8vFyv2ZjLgAbt79Ahhdk+AVwxgOGsbwFRmCQRmmI8c9/Gt9BXg5bdSa8TtLZ4xugptBTYDo3/DQGvvWox71abCkxloYy6cuxVH1jenRkHpoBQcnOujMOEMTs7dQdTtzaszZIWhGAzo3Tnwt0F5jH+XSLh0YLHGDTEGpv867/9KUIGPSlCmceotgsQiDme9NfPxy/Q0qrT+6

dire prism
#

Trying to see what changed. Looks like there's a bulk inserter to try to speed up loading the unenriched ore.

#

Not sure how to make that ensure the right ratio since there's no way for me to evenly divide 19 with the bonuses I have (my bulk inserters can't do 19 at a time).