This varies up to injection system characretistics. Firstly you have to measure fuel quantity injected and drained by injector in a time step. After that you have to determine accuracy so you can develop a mathametical equation depending pn engine speed, rail pressure etc.
From experiments, one can estimate the mass of fuel consumed by the engine from the fuel gauge. The useful heat converted to mechanical work from the power developed by the engine, the energy associated with the exhaust gases, and water through accurate measurement of mass flow and temperatures over a period of time can be estimated using relevant equations. Following a suitable method one can determine the power associated with friction. Making a balance between the energy associated with the combustion of fuel and the heat transformations, the quantity of drain fuel can be determined.
For numerical calculations, an iterative approach may be resorted from the quantity of fuel supplied and the energy released by combustion. Alternately, one can assume a a certain percent of fuel to be drained from injector. Depending on the modeling undertaken, suitable approach in numerical modeling may be resorted.