Contributions which the technology of control engineering can make to the relief of postoperative pain are explored. A human-operated, closed-loop, analgesic drug injection system has been designed to alleviate chronic pain. In this system, a patient presses a button when pain relief is required. A computer interfaces the button to the patient's drug injection pump. A patient pain model has been developed to describe the dynamics of the human physiological and psychological responses to chronic pain. A pharmacokinetic model of analgesia is also included. The pain model has been validated by adjusting its parameters so that its behavior mimics actual button-pressing records of self-administered analgesia. A modified Smith delay compensator (SDC) and IPFM (integral pulse frequency modulation) controller are used to compensate for the inherent nonlinearity of the system and to obtain the high performance required. The results of this simulation study are found to be promising. The control algorithms proposed have shown an improvement in the performance of self administered analgesia systems. The simulated patients obtained good pain relief without excessive button-pressing, and without undesirable high concentrations of opioids being observed. The SDC/IPFM controller architecture has been found to be robust in the presence of pain noise and pharmacokinetic plant parameter changes.