drawdemand function