Dynamical modelling of single-phase and two-phase states in thermodynamic cycles