Re: 0.13 Count Perfect Chest Item Count
Posted: Thu Jul 21, 2016 8:39 pm
Well, this is exactly the solution that I've already come up withJupiter wrote:What comes to mind is to use buffer boxes near your station. [...] As soon as the chests are full you start loading your wagon. The amount in the chests will obviously decrease but you don't start filling them until the wagon is full and on its way.

There are a few problems with the approach:
- The inserters that load the buffer chests can also get stuck with items in their hand... that basically shifts the problem only from one row of inserters to the next. Even though the buffer inserters stop repleneshing the buffer when a train is present, they will still drop off their remaining items; and these then end up in the loading inserters hands. Back to square one.
So we need to actually put a safety buffer in place, i.e. we don't buffer the full 40 stacks that would theoretically fit, but one stack less per chest (e.g. 36 stacks if you have 4 inserters per wagon/resource).
Which leads us to... - You waste quite a lot of train capacity if you need to limit the train load to 36 stacks per wagon. It's something I could live with but I'd prefer a solution with less overhead.
- My system involves resource bookkeeping. For this to work, the player has to set up how much of an item will get loaded in the outpost. And I want this to be easy -- it is easy for single-product providers, and I want it to remain that way for multi-product providers as well. So ideally you set it to something like "8k" for ore and "16k" for plates etc... if you have to do funny calculations to take the safety buffer into account, that's just ugly and awkward.
The "unlocking inserter" moves about 50 items during the time it takes the wagon to get loaded (from one side, with 4 stack inserters per wagon). That's a lot better than the 50+ items per chest that you need to reserve with the above approach.
You then have to feed the removed items back into the supply, which is ugly but acceptable.
The smart supply train loaders use a similar trick (have an inserter remove items to unfreeze inserters that are stuck).
It's part of my smart train scheduler, which is quite involved (you can check the link in my signature for an older version, and lots of discussion).Btw, how are you detecting what resources a train actually wants to pick up?
My train scheduler has "provider" and "requester" stations. It works like the logistic robot network, only with trains instead of robots. So when a train gets dispatched at the depot (= roboport), it already knows which resource to pick up, and where to drop it off.Another idea popped into my mind, why don't you just mix the resources on a per-wagon basis? So first and second wagon gets iron ore and rest gets coal or whatever. This would also simplify unloading your train at mainbase.
Mixed wagons are not in the picture. A system could be designed that deals with mixed wagons, but it's not what I'm building (it's very complex and does not really help in most cases, so I won't do it).