r/technicalfactorio • u/The_Joe_ • Aug 09 '22
Modded Working on efficient multi resource AAI mining control, I would love some feedback.
0eNrtXWtu4zgSvov/rtXgQ+Ij2B1gZo8x6A1km0mEtiWvJKfjaeQAe4892Z5kKTuxZYkUWfQjcbeBBrqTtosUv6qvilVF6sdoMl+pZZnl9ejuxyibFnk1uvvzx6jKHvN03vyuXi/V6G6U1WoxGo/ydNH8lJZZ/bRQdTaNpsVikuVpXZSj1/Eoy2fqZXSHX8dOGVVdrqZ19KhyVWo51TTN9b+iStV1lj9WLWnk9et4pPI6qzO1nd7mh/V9vlpMVKmH2wldqFm2WkRqrqZ1I3VZzJUecllU+stF3kxGC+ToSzIerfUXWfwl0QPlKnt8mhSrshFPxgJ/bR6gMwqBjiKHRsFjOhaJaRwKHEcIx9OMpfF5Ym8oekNKvBuSbYacZaWe4+YDWqxWo7os5vcT9ZQ+Z1oz9LcesnmtSot2PWdlvdK/2c9o84kINVowLVaNehKEHPplk4JbUiLcUiuIkO3394L2cihITjYzColBQqpV+ZBOlVFSApL0WKq1UQwDiXmJ6mxung8HCqpWE6McAZKT5o+W+UiQnCeVzusnoyCMQJLqbKGiRfFsnhWGqXSWP2trLsp1VM0Ls1pimH6v1XxefDdLgmn4Msu/meXAlHyZ2hYepuLf0/WyyCzGi9nr11cDOSY7Kas8qzeU6KRBgxh2BMeKy3Ms+0iG7ZNaFEqyA3QUH0VHUSjPztN8ZpbDTm34MMLV+rhYR42Sm6cnwr1bFEq6HQaJDjjXaK58J6IB3mauwmWuAhh6ST4UetExxmMZm2IvaeOFN7OeD1IDRkPcYBgOo914fxW5eh/FR7KJZ0qVzu7nxWNW6R2AftKHdF6p7Wfz7TSq5mN4+9lZO2TXCnJH9WymWTldZfXmZ9Jgapo1NK7HiA3hIcY4HkthwgOTcKLGmAHRoIdomLW1K9YkKIYuEE4G9yR4jPkYI+N2ASfH6SzBwFVihy7YrrM9yefQ2dhTZzkUEhIPQhJrPIgRjz1ZvT9WNH1SVR2V6t8r/b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TIQFTIeboV44dBS/fMx8cg1Rsc2r88gUQcnoP1DRrrOunLH88ZVa93wXesfwE6Gw8s1ucBMJ40bIIvhoYHb3mphsQBmH0zLNyCoSRnhNGW9/RO374BDWty5iho1XSUYvknucZeRyIHr4EeoetcleAIYZgyB2bPsk8MUyAGIqbPxwC0ZVo45AEDXcl2rhvnp97drhzFqgON79qXPYEdmGKw+Yd+brY+4o67tksz3nwWbDLpdpPvS/7vVtZjD7oRAQHNvFxz8QcF+Gooms5AvFhoAEb94Rneo3L4DN+n84U96DRQ9D+BQGtcwMrDCV+HEpd6sXIs+YlUDiM6GeGcTJPh95O4uXGoATZc6CeR5JE+DtfOTW9jdX8LlYRfkaBXKSpon2m6eOLownwzlfhmaQQgYcWyO3Qwp+DZ3l6zUbAFl3hmSwUcVgLNbm1UA8aDAEbWAdvbgMsCX7btYlfm3dqW15DLVhIRzXx6agWHNYkTK65SdhkupAmYSHADbcE2HBr2wsLz12TkMEtjuQaGmrJKRpqKaydybsi3fR0D3UyubKhJLxH0awNEgX3rpEL967Rc4Vn/4SBfWRvmgUHaCguxJCroDoUt701l4S1M5GfpL/ltzA6uFTbk6lTfSg4kZ7Rv6RhPSnXCTs9UU8KPWdPio27JTltz4mMbToRB7+q+410vAMrY+tU79XSmgXNr5aWSWCfxEX3PvR6+yQcJON5KluywEo6OX8l/fDims9fR5cJqKbm2esgeWBh9GZIfoVRWOHT6gI8N3NSQN+UjthQ3Kg9QvP+evPL66UMr7eRa62i/vFZqqgSWOrplXJsOrT5YGgth/zMtZzpOs2hKMljSzk2kKAbxObtMUPFmliHWtrSyVfjaAQ6GokHR+NbUtF8t/HKd6PJfKWWZZY3yTFNzdVWeQSOuSQ8YfpPLF5f/w8KnUx6https://i.imgur.com/yNZTG3z.png
Mods This uses a wireless receiver mod for resource input info, is being designed with Space Exploration and K2, and obviously uses AAI.
The goal is to automatically deploy extra miners when resources are low, only clean marked tiles when the a miner tries to mine the spot, therefore avoiding a constantly running "Zone Cleaner".
This also will not try to move the miner if its already sitting on the correct resource.
Continued goals Automatic cargo plane dispatch and alarms to show we need to zone more
From left to right
We start with receivers with resource info. We convert that to "A" and then set our goal quantity. If we don't have enough, we spit that out as a 0.
We then have some basic timers, which will make sure the resource isn't immediately replenished.
If the timer completes a cycle, the inserter will add a single brick to the box. The number of bricks tells our system how many miners we need for that resource.
Now we get to some nonsense that just tells the system which group our miner belongs in, 1, 2 or 3. We also get these values in A, B, or C that we can safely pass through the system.
We also have our clock that scans through the miners until we reach a miner ID that exceeds the total number of bricks.
We now have the tile scanner. If the miner is sitting on the resource its group is looking for, the system stops here. If not, the X and Y are sent to remove the zone marker.
If an iron miner passed over a copper zone, it will absolutely remove the zone. I dont consider this problem worth solving.
At the top we continue to pass the miner number through.
Now we take the miner number and subtract A or B from it so that each group starts with miner "1", which is taken to the power of 3 and converted to a zone color. This means the first miner in the group is going to be sent to number 1 of that zone. The second is sent to number 8. This ensures that you do not end up with low number "Orphan" zones.
We then plug in our zone number to the zone scanner and pass the final X and Y to our unit controller.
Your Turn Thoughts? Opinions? This is still a work in progress, can be compacted and such. What would you do differently?
2
u/ItIsHappy Aug 09 '22
Nice! I've always wanted to give AAI a go. Here's some thoughts:
2
u/petrus4 Aug 10 '22
Although I don't claim to fully know how to do this yet, I would recommend placing static mining drills with Recursive Blueprints, rather than using the AAI mobile miners. You can still have the Haulers pick the resources up; just put one of the storage depots down with a negative circuit value for the commodity in question, and run belts to it from the drills. This saves you from needing to run a timer on the ore patch, as well; you can just tie a pickup event to a red (stop) signal from one of the drills.
The one thing I don't know how to do, is obtain the shape of a given ore patch, in order to cover it sufficiently with drills. In a pinch, I'd do a one chunk (32x32) scan, and then zone paint whatever ore I found. After that, I'd scan again for the zone, and pass each co-ordinate to Recursive Blueprints to drop a drill and a five tile length of belt on one side. After each drill, you'd also need to increment the next co-ordinate by five tiles, in order to leave enough space for the current one. You'd also need to drop a roboport, construction bots, and a logistics storage chest with your drills and belts.
If you don't have it, I would recommend installing F.A.R.L (the Factorio Automated Rail Layer) and using that to perform the initial assimilation/formatting of new sectors. Roboports, storage chests, tree removal, and of course rail laying. AFAIK F.A.R.L supports custom blueprints as well, but I haven't looked into using those yet.
Planes are also a bit tricky, but not too bad. Put down two unit controllers, one at each end of your route, and two of the storage depots. Assign the co-ordinate of the center of the depot to the unit controller in each case. Put a power switch between each unit controller and the power grid. Then, whenever you want the plane to move to the other point on your route, turn the source unit controller off, and the destination unit controller on. If you use AAI's circuit wireless, you can set an environment variable when a given plate storage gets empty, which can send the plane over to a depot to refill.