I want to limit the bike to a certain speed (20mph).

You can program the bike so the output is limited, and you can limit the throttle speed, but unfortunately you cannot limit the pedal assist by speed, but only by power, or watt output.In effect though, this would keep you under a certain speed. The best way to avoid trouble on the class 1 and 2 trails I find is simply to keep your speeds under 20mph at all times.