Design and implementation of a closed-loop blood glucose control system in patients with type 1 diabetes