EPANET tracks the change in water quality of discrete parcels of water as they move through pipes and mix in the Junctions between time steps of fixed length. The following actions occur within each of these time steps:
To reduce the number of segments, Step 2.4 is only performed if the quality of the new node differs by a specified tolerance by the user from that of the last packet on the outbound link. If the quality difference is below the tolerance, the size of the last current chunk on the link is simply increased by the volume flowing into the link over time and the new packet quality is a weighted average of node volume and current packet quality.
This process is then repeated for the next water quality time step. At the start of the next hydraulic time step, any link experiencing a flow reversal has the order of its installments inverted and if any flow reversal occurs, the network nodes are topologically reclassified, from upstream to downstream. Sorting the nodes topologically allows the method to conserve mass, even when very short pipes or zero-length pumps and valves are encountered. Initially, each pipe in the network consists of a single segment whose quality is equal to the initial quality assigned to the upstream node.