Technical components are usually well optimized. However, simply combining these optimized components in a technical system does not necessarily lead to optimal systems. Therefore, focusing on a system perspective reveals new potential for optimization. In this context, we examine thermofluid systems which can be interpreted as fluid systems with superimposed heat transfer. The structure of such systems can be abstracted as a graph -more specifically, a flow network. We translate the underlying optimization problem into a mixed-integer linear program which is designed to obey the physical laws of heat transfer. Typically, fluid systems can be considered as quasi-stationary systems since their dynamic effects are usually negligible. However, for thermofluid systems this assumption does not hold because time-dependency is an issue as storage tanks for heated fluid gain importance. In order to handle the dynamic effects induced by the storage tanks, we further introduce a continuous-time representation based on a global event-based formulation.