  In this work, we present a switching nonlinear model predictive control
(NMPC) algorithm for a dual-hormone artificial pancreas (AP), and we use
maximum likelihood estimation (MLE) to identify model parameters. A
dual-hormone AP consists of a continuous glucose monitor (CGM), a control
algorithm, an insulin pump, and a glucagon pump. The AP is designed with a
heuristic to switch between insulin and glucagon as well as state-dependent
constraints. We extend an existing glucoregulatory model with glucagon and
exercise for simulation, and we use a simpler model for control. We test the AP
(NMPC and MLE) using in silico numerical simulations on 50 virtual people with
type 1 diabetes. The system is identified for each virtual person based on data
generated with the simulation model. The simulations show a mean of 89.3% time
in range (3.9-10 mmol/L) and no hypoglycemic events.
