A Mathematical Model For The Energy Allocation Function Of Sleep