A tag contract framework for modeling heterogeneous systems