Closed loop control of glucose homeostasis via subcutaneous insulin infusion and continuous glucose monitoring system can give better living to a type 1 diabetic patient. This paper deals with the real time implementation of internal model control (IMC) of subcutaneous insulin infusion. The model based control is applied on the nonparametric model of the patient identified in real time from input-output data. Meal simulation model of the glucose-insulin system of type 1 diabetic patient based on the work of Dalla Man et. al. is considered. This model is constructed in hardware platform that acts as the virtual patient. The data-driven nonparametric model of the virtual patient is identified in real time by computing Volterra kernels. The kernels are solved up to second order using recursive least squares (RLS) algorithm with short memory length of M=2. The validation results of the identified model output and the actual output have shown good fit in both simulation and real time environments. The frequency domain kernels are used in internal model control to generate insulin dosage. The control algorithm is developed in simulation and implemented in real time with hardware in loop on dSPACE platform. The closed loop system yields good meal disturbance rejection, less undershoots, settling time and more profoundly smaller requirement of insulin infusion as compared to the earlier reported data. (C) 2016 Elsevier Ltd. All rights reserved.