A Model and Simulation Framework for Studying Implementation Non-Idealities in Quantum Key Distribution Systems