The system functions in times of stress, danger, and pain.
The brain also releases endorphins in response to perceived but not actual external relief, for example, when a toothache sufferer is given a sugar pill placebo instead of aspirin.