So, Paully...
If I might recap...
You have four tanks...
You have control over the filling of the tanks, but not the draining.
You want to fill the tanks in sequence... regardless of the fill status of the other tanks.
You want to fill 1, 2, 3, 4 then... 1, 2, 3, 4... over and over.
You expect that 400 fill-cycles = 4 x 100 fill-cycles.
That is, you expect fill-cycles to be equally proportional across the four tanks.
And yet, at the same time, you have no control over which tank is being emptied and when that emptying might occur.
You simply want to ensure, somehow, that the filling process follows the same sequence, as much as possible.
This means, if you reach the point where ALL tanks are filled... and Tank-3 is the next tank on the sequence schedule... and then... the operators decide, arbitrarily, to empty Tank-2 (which is the one you just filled)... uhhh...???
Your "sequence-plan" has just gone out the window!
How about this...
Once you start filling the "current tank"... that "current tank" should continue being the "current-tank" until it is infact filled. Once that tank is filled, the program should then "LOOK" at the "fill-status" of the next tank in the scheduled sequence.
If the next tank in the schedule is NOT FULL, then that tank should be selected as the "current tank" until it is full!
On the other-hand, if the next tank in the schedule IS FULL, then the program should skip that tank and then "LOOK" at the "fill-status" of the following tank. If that following tank is NOT full, then that tank should be selected as the next "current tank" for filling. However, if that following tank IS FULL, then... skip that tank and move on to "LOOK" at the "fill-status" of the next tank.
Why should the program "skip" one tank and then go to the next?
This will happen because you have no control over WHEN ANY particular tank might get drained!
The scheme indicated above will indeed follow your "sequence-oriented" scheme. HOWEVER... it WILL NOT necessarily (at least, not very likely, not likely at all) fulfill your stated requirement of 400 fill-cycles meaning that each tank was filled 100 times!!!
This is because you have NO CONTROL over when any particular tank is drained! Draining is completely arbitrary!
If the idea of 400 fill-cycles = 4 x 100 fill-cycles is REALLY important, then you ABSOLUTELY MUST provide some sort of indication to the Operators as to which tank THEY SHOULD drain next! At the very least, you need to provide an indication for the Operators that will allow the drain-sequence to follow behind the fill'ED'-sequence.
This can be accomplished, easily and cheaply, by simply providing a GREEN/RED Indication at the various Drain Valves. Only ONE of the Drain-Valves should have a GREEN Indication.
HOWEVER... if it is the case that NONE of the tanks are currently full... hmmm... that could present a problem.
Is it the case that once a tank is being drained it continues to be drained until it is infact drained?
Or... is it possible that a tank might be only half-drained? How would you know?
If, when a tank is drained, it is ALWAYS drained until it is infact drained, then your job is somewhat easier. Once the particular "FILLED" signal goes OFF then you KNOW that the particular tank is being drained and will indeed be empty!
I gotta stop here... 'cause I'm trying to explore way too many parallel universes!
These "possible parallel universes" exist because... there are too many unanswered questions.
Paully, I've already raised a LOT of questions regardinging YOUR perception of how the process should really proceed.
So... Paully... have you got any answers to those questions (questions stated and implied)?
You REALLY, REALLY, need to CLEARLY state your operative-concerns - from the most important one down to the least important one, all of them, in order.
Paully... THE FOLLOWING IS REALLY, REALLY, IMPORTANT...
It is MUCH more important to determine the question than it is to determine the tool(s) to use to come up with an answer...
I really appreciate your attempt to use a K-Map (believe me, I do)... however, deciding to use a K-Map as an "answer" BEFORE you fully understand the question is... insufficient, to say the least.
Live long and prosper.