Page 1 of 1

Control voltage

Posted: Fri May 31, 2013 11:13 pm
by ssilk
... Some would say oh no, not again he... :)

Today I wrote much about controlling: ... 6234#p6234 ... 8&start=30 ... 6237#p6237

And there are many other threads which covers this area...

But I thought about what would make the smart inserters more useful. I mean the hole system lacks flexibility. Smart inserters can be used only in one way. But this isn't always, what's needed.

I had an idea: Control voltage was and is used in analog synthesizers.

I know that, cause one of my hobbies is making music. I use most times Reason for that. A demo version of Reason can be downloaded here:
I mention this, cause in Reason control voltage is fully implemented.
( Here is more info abou how it works: ... cle=part40

Hard stuff. But in general the only thing you need to know is
- You have devices
- every device has some input and outputs.
- the inputs are plugged to an output by a cable

So, just to make you see, what I mean I describe, how the smart inserters and smart chest would be implemented with control voltage:
- a SMART CHEST would have outputs: for every type of item one. The voltage of the output is the number of items of this type in a chest. (I will explain later how to get rid of all the outputs)
- a SUMARIZER has N inputs (2, 3, 4 or 8 are common) and just adds the incoming voltages and output this sum also as voltage.
- a CONTROLLER has one or more inputs and outputs the highest possible voltage, if this input voltage is higher, lower, equal eyc. to a reference voltage.
- a SMART INSERTER has an input and if plugged, he only works, if the highest voltage is imputed.

This is of course complicated and not so simple, than currently. More cabling,more devices.

I introduce midi here. One reason of inventing midi standard was to get rid of all the cabling. For the chest this means that we have only one output. the number of items are like notes with a velocity. The midi standard knows also the concept of channels. Up to 16 channels can be transmitted in one cable. Many devices can be connected to only one cable/bus/network but they hear on different channels.

With this the above example look like this:
- SMART CHEST outputs number of items. By default to channel 1
- SUMARIZER adds all items from channel one and outputs summed number of items to channel 2 (default)
- the CONTROLLER takes the signals from channel 2, filters an item, compares with referents amounts and outputs a signal to channel 3
- SMART INSERTER reads from channel 3 ( again, only one cable!) and works, if there is some output.

Why is this so much better, than current handling? Because of its flexibility! There is nothing against moving the signal from the first controller to a second and sum it again. There are endless possibilities thinkable. This is currently not the case and I mean, this is the reason, why automation isn't used that much...
Other reasons: cabling gets much easier. Instead of handling red and green wires, you handle one network and have one function in one network. And logical consequence: every device in factorio can be connected, because you need to develop the special cable first.

And one more argument. Midi is a well known standard. I didn't say,that it must be implemented! And if, I wouldn't call it midi. I mean, that you can use it as working reference. One crazy idea: why not connecting a real master-keyboard as a device into factorio. When playin c rockets will be produced. :) Pressing K on keyboard lowers cole production

Crazy stuff? Yes. But think to it and try to imagine the limits when you make it like this: there are just none.

Re: Signal processor/router

Posted: Sat Jun 01, 2013 9:14 am
by MF-
It actually makes a lot of sense and I would like to see [s]such[/s]equivalent functionality.

Let me strip that essay from all the real-world and electronic details and propose something equivalent, but easy to read though. ↓↓↓
ssilk TRANSLATED wrote: TL;DR
I propose a new machine - logic signal processor/router.
It would have 2-4 sides capable of connecting to separate circuit networks.
It would be able to
- perform simple operations on the signals (adding, subtracting, multiplying)
- relay particular item signal
- push new item signal OR new logic signal (I suggest calling the new non-item signal A-Z, that should be enough & mnemonic)
The "factory keyboard control" can then be implemented simply by a device that passes your key onto the network

@ssilk (TLDR: Equivalency of the above to the essay)
I hope I didn't insert bad words into your mouth.
Current circuit network is already a lot like MIDI + some improvements (probably current control, not voltage control, allowing summing up signal on the go)
So the only part missing from your scheme is the signal processor.
The MIDI channels 2-4 would be translated to new A-Z logic signal, also serving the purpose - coexistence of unprocessed and processed signals on one circuit network.
Both designs are unable to transmit two "coal" signals at once, they would sum up in both designs (unless I missed something)
- But that should be OK, you don't run into situations where you need to separately monitor quantities of the same item in two too-close locations.

I also see a bonus - In this scheme the previous simple functionality stays possible and allows for better learning curve.

Re: Control voltage

Posted: Sat Jun 01, 2013 6:55 pm
by SilverWarior
I would rather see that Factorio gets similar signal network implemented as Redpower mod for minecraft uses. Each cable is capable of sending upto 8 logical signals (8 bits). So when either sending or recieving theese signals you actually use single bit operations which are verry fast, much faster than doing any mathematical calulations for simulating "voltages".
So if you need to monitor the number of items on certain area you simply connect input and output inserters to some uniqe counter where input inserters would increase that counter and output inserters would lover it. But the problem of such system is that it can compleetly colapse if player interveens (pick a few items of the conveyor belt and your system won't know about this change).

But best thing about this system is that it can be used for about anything. I remember downloading Minecraft map where someone has made full fledged calculator only by using Redpower mod to simulate logic circuit beind it. Yes similar circuit was made by only using Minecraft repower system which also alows creating logical gates but that circuit was soo big that you had to be lucky for minecraft to load all required chunks for it to works, while circuit done using Redpower mod has been shurnken down to the size of larger Minecraft house. Circuit made with repower also worked much faster as it didn't have to use several hindred of repeaters and redstone torches.
And if you combine Redpower mood with Computer mod you can do wonders that you never thought were even posible in Minecraft.

Re: Control voltage

Posted: Sat Jun 01, 2013 8:54 pm
by ssilk
That all sounds too good. Waiting what will happen...

Re: Control voltage

Posted: Sun Jun 02, 2013 12:40 am
by MF-
You don't deal with quantities of millions in minecraft / redpower, though.
The 16bit bundled cable is unfit for that.

That's why I suggested the implementation that builds "logic" on top of the existing and IMO nice and clean circuit network design.

Re: Control voltage

Posted: Sun Jun 02, 2013 8:30 pm
by SilverWarior
The reason why I suggested Redpower mod desing is becouse itcan be used for many more implementation than just monitoring how many items are there.
You can use it for conecting some sensors to it (item detectors, enemie detectors, etc.)
Each machine or structure could have ability to send sugnal on certain conditions. This would alow you to make some central controll area for your whole factory.
I bet that if you would see all those advanced circuit that pepole mad in Minecraft using Redpower mod your would probbably understand why I want this so much.

You can always make encoder/decoder entities which would alows you of sending anything more than simple logical 1s and 0s. You do realize that 8 bits position actually represent Byte value (0..256). Combining two such wires you get Small Integer. Combining four such wires you get 32 bit integer. I doublt you will ever have more than 2,147,483,647 units of something in the game. And if you do there is always ablility to use 8 wires and get 64 bit integer.

Re: Control voltage

Posted: Sun Jun 02, 2013 9:12 pm
by MF-
So.. 4 [s]wires[\s]cables for getting a quantity of one item at one location? :-P

Also I think that in minecraft/Redpower there are many event sources and thus possibilities for event-driven builds.
I don't see such events in factorio.
Well.. except "A train station has enough cargo, time to send a train", which can be done with future circuit network.

Can you please provide a real motivation example? I just don't see one.

Re: Control voltage

Posted: Sun Jun 02, 2013 9:43 pm
by ssilk
The discussion is on the wrong way, because that's not, how machines are build in reality.

I try to explain that.

Having more than 2 billion items: There is really no need for that. In a chest - even a very very big chest, maybe there are 1000 slots and so not more than 250000 items. I think to handle with about 1-10 million items in maximum is really big enough. Because when you say "oh, I want to build a really really, reeeeeeaaalllly realy big factory and when I zoom out I only see chests for the next 2 kilometers", this wouldn't work, even if you take 64 bit integers. :) And not even that. It can't be calculated fast enough.

So I think, when you want to sum something up, which is potentially unlimited, you would not do that Bit by Bit. Because there is no reason for being that exact. Maybe you choose float-numbers for that job, cause when I add a chest with only 1 item in it, it would normally not change any decision.

Or look from a different standpoint: Currently, when you build a network, the inside of all chests are summed up and the result is used to calculate something. This is stupid, because you might not need to sum everything up (ok, I don't think, this is programmed in a way, that everything is calculated - even if not used any time (this is called "lazy initialization" btw))... but ... the pure idea to do that is just crazy, because nobody would do that in reality!

Or think more practical: If you have so much stuff of anything, you begin to handle it by more practical units. For example "one chest of iron plates", instead of "250000 items of irons plates".

Or in other words: Look, how it would be done in real world! It would not be done like "Oh, I measure how many items are inside a chest and give that number forward like other chests to calculate the sums of them all". No! We would measure the weight of a chest. Or the height of level in the chest. Or how good light reflects, when you open it. Or, or, or... you would never, never count single items or handle the exact amount of a 33 tons container in milligram.

Think of noodles: They make dough, then cut it, dry it and then they put the noodles in to boxes. They don't count them, when doing that! They count the boxes!

So, the right way to handle this is to
- have chests, which can be filled only once,
- have filler factories, which can fill stuff into such chests and which
- fill up those chests very, very fast.

Then you need only to count the number of chests you produce to estimate the real amount you store.

You wouldn't make sensors for that. (The RFID-idea is good, but every RFID costs money.)

Conclusion: The real world gives you the direction: For different tasks, different dimension you need different ideas how to handle that. There is no "one size fits all" - just makes no sense.

Re: Control voltage

Posted: Mon Jun 03, 2013 9:55 am
by ssilk
This means in consequence, that there should be a maximum number of how many boxes and inserters can be switched together. I mean 4 are much more than enough, because there is no sense for logistics with more chests - cause when you need more, you will just have so much material, that you don't need to make logistics anymore. :)

As a consequence I mean also that there should be the possibility to make really big storages, where you (as described above) build disposable boxes (such a box has only one stack, which is very big and either full or empty) and fill them very fast (no inserters needed, the material is filled into them with a cone) and store it in some kind of rack. You can count the number of boxes in the rack. This is easy. Or you may place a counter on the inserter/output belt, if we have the item for that.

Re: Control voltage

Posted: Mon Jun 03, 2013 10:30 am
by Lukasecicek
It would be really nice to have containers implemented. Only certain inserters (or something new) could be used to actually extract or input materials into them, then the whole container could be put onto the train to move somewhere...

After introducing some bigger mean of storage, i think chests should be made smaller for storing less items - managing big stuff logistics could be challenge on its own!

Re: Control voltage

Posted: Mon Jun 03, 2013 3:07 pm
by ssilk
This container on trains idea is really good, cause when you can put it on trains, you can put it anywhere (ships, airplanes...).

But my picture was a fully automated high-bay racking. Think of inserters running on rails back and forth, putting containers 20 levels (and more) high on each other.
(You can of course stack only containers with the same items on each other.)

Your second statement is also right: Chests should be made a little bit smaller.
And I think the dimensions should be much bigger. Currently between the smallest and the biggest things I can build is a factor of about 100. I mean, the smallest is for example a wheel and the biggest is for example research of rockets. I think the factor between the smallest and the biggest should be much, much bigger - factor 1,000 or up to 100,000! Think of something, which needs 100,000 wheels to be built... and maybe, you need 100 of those to get the next thing built...