Tutorial:AE2 Automation
Contents
Automation with AE2[edit]
Using AE2 components gives you a lot of flexibility for automating many kinds of production tasks. Specifically, the ME networks frees you from the need to use chests for input/output or buffering, and to design complicated pipeline layouts to connect chests and machines. You simply can use ME storage as a universal buffer for all kinds of items. You retrieve what you need with an export bus, and send all products back to the network by an import bus. From there the next stage of production can pick them up, or they stay there until used.
Basic Machine Automation[edit]
A simple setup might look like this:
An ME Export Bus to the left side of the machine exports items from ME Network into the machine's input slot, in this case copper ingots. To the right there's an ME Import Bus that extracts the produced items from the output slot and puts them back into the network. The Import Bus doesn't need special configuration, it just will pick up anything in the output slot. Below the machine finally there's the energy input. In the example, the Metal Former will produce copper cables, and it will stop doing so only if the network runs out of copper ingots.
Machines with Multiple Inputs[edit]
There are a few machines that take multiple inputs, and then you have to export more than one kind of items to it. The most comfortable machines for this task with AE2 are those from Thermal Expansion mod, because they're highly configurable where inputs and outputs should be. For example, you could set up an Induction Smelter so that it takes the input for its left slot from its top face, and for the right slot from the left side. Output then will go to the right.
Then put an ME Export Bus at each input face (top and left in the example) and connect them to your ME Network. Configure each bus to export the item you want to process in the machine by opening the busses GUI and pasting an item there. Continuing the example, this might be Sand for the left (first) input and Gold Dust on the top (second) one. Power for the machine comes from the bottom, and at the right there's an ME Import Bus that collects the machine's output and puts it back into ME network. Please note that both outputs of the smelter, the primary and the secondary one (Gold Ingot and 25% Slag), are both routed to one orange output. This is enough, as all items will go into ME storage anyway and there's no need to separate them.
Machines from other mods are not so flexible, unfortunately. In some cases, like Alloy Smelter for example, all input slots are perfectly exchangeable, so input order doesn't matter. An in other cases, there's no perfect solution... For example see this Industrial Electrolyzer from TechReborn mod. The export bus will —with help of a capacity card— put both ingredients into the machine, but it will put it into the next free slot. If you manually put Empty Cans into one slot and Grossular Dust into the other, all will work smoothly for some time, as the slots will simply be filled up to one stack by the export bus. However, if you run out of stock on one of the inputs, the other one will fill up the wrong slot, too, and production will stop. I haven't found a good solution for this problem yet, suggestions welcome!
Molecular Assemblers[edit]
The Molecular Assembler is a bit special machine in the context of AE2 automation. First, it is much like other auto-crafting devices, like Auto Workbench by BuildCraft or the Ender IO Crafter and its purpose is to automatically craft items that you could craft yourself without a machine on a Crafting Table. It better integrates into AE2 as it uses AE2 power and patterns.
If you want to employ an assembler for a specific automatic crafting task (i.e., not as part of Autocrafting, you need to connect it with a export bus and import bus as usual. Additionally you need to put an Encoded Pattern into the assembler that defines the recipe of what you want to craft. This pattern is created in an ME Pattern Terminal, which is covered in the Autocrafting Tutorial.
The export bus must be programmed to export all of the needed items into the assembler, but one of each kind is enough. The trick is that the pattern tells the assembler how many items it needs in which places for the recipe, so this is done without any further manual intervention.
Finally, remember that the Molecular Assembler needs power, too, like other machines. However, it is not powered by RF or EU etc., but directly by the ME Network. So it's sufficient to connect it by any AE2 cable (ME Glass Cable - Fluix, ME Covered Cable - Fluix, ...) to the network. The import or export busses cannot do that, you need a separate cable for energy. Please note that the assembler can act like a cable itself and let AE2 energy flow through it. This way you can connect at most 8 assemblers and save a lot of cabling. Also, these energy-only connections do not use a channel.
Automatic Production with Limits[edit]
With support by Redstone Card and ME Level Emitter it is possible to start or stop production based on how many items of some kind are stored in ME network. This might be useful if you want, f.i., to always keep 100 Glass around which should be produced by a furnace from Sand. (And we assume for now that there's enough sand in the system.) Or, as another example, you want to keep max. 5000 iron ingots and make iron blocks from the surplus.
For that purpose, you will use an ME Level Emitter to emit a redstone signal if your condition is fulfilled, and use the signal to turn on or off the export bus. If the bus is stopped, no more input items will flow into the machine and the process will stop (maybe a bit later after the input slot's contents have been consumed). But as it seems, it's not possible directly to control an export bus by the level emitter, a Redstone Torch is needed in between. So the basic setup is as shown in the screenshot to the right: The level emitter here is programmed to emit a signal if there's above or equal 100 glass in the ME network. As a redstone torch is an inverter, this means that in the end production will stop when those 100 glass are reached.
Ok, the level emitter now sends a signal to the stone block in front of it, and the redstone torch on it will turn off if the emitter is on, and vice versa. In the block directly above the torch is an export bus with a redstone card that sends sand to a Redstone Furnace. With that card, the bus can be set to mode "active with signal" (means active only with a signal). So, again, if there's less than 100 glass, the level emitter will be off, the torch will be on, and therefore the export bus will send items and glass will be produced. Once the 100 glass are reached, the level emitter will turn on, the torch will go off and the export bus will stop. The furnace will still process the sand in its input inventory, but it's easier to live with that glitch than to do it exactly.
For the other possible case, namely you want to start the machine if you have more than a certain number of items in your ME network, you would set the level emitter to mode "emit signal if levels are below". This reverses the logic above (given the export bus is still active with signal only).
Another tweak to system is to use a Crafting Card. Inserting that card into the export bus enables it to order auto-crafting the to-be-exported items if it's out of stock in ME network. In the glass example above, we assumed that there's enough sand stored. (If not, nothing bad will happen, but your glass won't be ready.) If you cannot rely on enough input items, but you have an autocrafting pattern for sand (e.g., by pulverizing cobblestone) then the crafting card will order production of the sand it needs. For more information on autocrafting, please see the next tutorial. Or, as an alternative (and as an exercise), you could automate a Pulverizer the same way to keep at least 200 sand in your network. BTW, this is actually faster than autocrafting, because with automation the items are available instantly, whereas with auto-crafting you have a certain delay until it can be filled into the machine. And the export bus won't order the items in advance, so only one will be crafted at a time.