  We present a general model on the simulation of the measurement-device
independent quantum key distribution (MDI-QKD). It can be used to predict
experimental observations of a MDI-QKD with linear channel loss, simulating
corresponding values for the gains, the error rates in different basis, and
also the final key rates. Our model can be applicable to the MDI-QKDs with
whatever convex source states or using whatever coding schemes. Therefore, it
is useful in characterizing and evaluating the performance of any MDI-QKD
protocols, making it a valuable tool in studying the quantum key distributions.
