RWF has the right idea but I don't know that HEC-RAS would be very efficient. Basically a pipe with an adverse slope has no gravity flow capacity. This means that the pipe must flow under pressure, where capacity is determined by definition. Usually keeping the HGL below ground level to avoid surcharging is sufficient. So, the analysis consists of calculating the HGL lines for different flows until a surcharge condition is encountered, this becomes the max capacity. The EGL/HGL calcs can be programmed into a spreadsheet, but a program like Haestad/Bentley's StormCAD can make it even easier, particularly for large systems.