Modeling and control of diabetes