Suggestions for improvement are welcome.
The goal is:
1) Require the station to have at least a Minimum amount ore collected before inviting trains to visit.
2) When the patch is completely dry, allow one more train to pick up the remaining ore before closing "forever".
3) If the patch isn't quite done and the electric drills get reshuffled to extract a wee bit more ore (due to terrain limitations or tree protection), then the system should reset automagically.
Layout:
Top + : Wire up all the ore boxes to the adder. This adds EACH items to get a cumulative O-signal (ore), which means the blueprint works for any ore patch type without modification. Could be removed, if you are willing to do post-configuration or make multiple blueprints.
Upper *> : This is a direction detector which identifies whether the O has increased lately, and will latch a +1 output O if true.
Lower > : This is a secondary latch to latch the above +1 O.
Bottom * : Mulitply O by your minimum required ore (eg 1000), and output as M-signal (minimum required)
Stop : Enabled when raw O > M
Left side &=+ : Clock which outputs a Decrement signal every 1024 ticks. This will unlatch one (and only one) of the latches. If two Decrement pulses arrive before the next increment pulse, then the final latch resets and O goes to zero, setting the station to be open until dry since the latch O = 0.