Engineering smart software that can monitor, predict, and control blood glucose is critical to improving patients' quality of treatments with type 1 Diabetic Mellitus (T1DM). However, ensuring a reasonable glycemic level in diabetic patients is quite challenging, as many methods do not adequately capture the complexities involved in glycemic control. This problem introduces a new level of complexity and uncertainty to the patient's psychological state, thereby making this problem nonlinear and unobservable. In this paper, we formulated a mathematical model using carbohydrate counting, insulin requirements, and the Harris-Benedict energy equations to establish the framework for predicting and controlling blood glucose level regulation in T1DM. We implemented the framework and evaluated its performance using root mean square error (RMSE) and mean absolute error (MAE) on a case study. Our framework had less error rate in terms of RMSE and MAE, which indicates a better fit with reasonable accuracy.