Flow Modelling and Control in Pipeline Systems - A Formal Systematic Approach