When the tank gets empty the valve get close for 30 minutes (this 30 minutes is for cleaning the tank) am using dynamic event for that. as showmen in image below.
Now what I want to do is
what you can do is that on the "on empty" action in the tank, you generate a token, which is an agent called cleaningRequest that goes into a flow that requires a resource (enter-service-sink), and you close all the valves to avoid using that tank.
When the resource is released, or when the token gets to the sink, you open the valves again.
I only answered question 1, but question 2 should follow the same technique