The function of the throttle position sensor (TPS) is; to supply information to the (ECU), about the position of the engines throttle.
The throttle position sensor (TPS), converts the (throttle valve) position, into a proportional voltage signal. Which is then fed to the engine control unit (ECU). As a result, the information from the throttle position sensor (TPS); is critical for proper start up and smooth throttle response. The (ECU) uses this and other information to calculate the proper amount of; fuel injection timing, ignition timing, camshaft timing, anti-lock braking system and transmission shift points.

There are only, two types of throttle position sensors:

The (TPS) reports the position of the throttle valve, to your engine’s computer. The (TPS) also, relays information to your anti-lock braking system. Furthermore, allowing it to supply, the traction aids your car needs, at a given speed. Most engines, use only one (TPS). But, more complex engines, may have multiple sensors.
The engine’s computer starts, by sending a set amount of voltage to the (TPS). There, the (TPS) applies a certain amount of resistance; depending on how open the throttle valve is. Next, it sends, the altered voltage back to the (ECU). But, as the throttle valve is opened and closed, that voltage changes.
The (ECU) uses this and other information to calculate:
Since the (TPS) contains both, electrical and mechanical parts; the throttle position sensor, can be prone to failure over time. As a result, sending voltage readings to the (ECM); that are out of spec, possibly illuminating the CEL and setting codes.
Warning Signs And Failure Symptoms:

In some cases, these symptoms may come and go, before the sensor fails completely. It may require a few bad readings; before the (ECM) will store a trouble code and illuminate the (CEL).
(TPS) sensor and circuit related (DTC)s:
In some instances, problems with a (TPS) might originate from; a bad electrical connection or corroded contacts on the connector. So, be sure to check this, before going any farther.
Use your multimeter for diagnosis:

Problems from the throttle position sensor (TPS), often trigger a diagnostic fault code. So, before replacing the sensor, the sensor’s wiring; should be inspected for damage or loose connections. The sensor may also become loose, causing the readings to be inaccurate.
The powertrain control module (PCM) supplies, a 5 Volt reference signal, to the (TPS) and usually a ground. A general measurement is: at idle = .5 Volts; full throttle = 4.5 Volts. If the (PCM) detects, that the throttle angle is more or less than it should be for a specific (RPM); it will set a code.
Also, if you have no (TPS) signal, check for 5 Volt reference at the connector. If it’s present, check the ground circuit for open or shorts. Make sure the signal circuit, isn’t 12V. It should never, have battery voltage. If it does, trace circuit for short to voltage and repair. Look for any water, in the connector and replace (TPS) as necessary.
A bad (TPS) can cause, inability to shift up, rough or slow idle and lacking power when accelerating.
Limp Mode – Reduced Engine Power

So, the computer receives a signal from the (TPS); stating that the pedal is all the way to the floor. But, the throttle, is actually closed. It would spot this error, when it compared this status with the vehicle speed sensor. But, would be signaling a low or no speed. As soon as it sees this discrepancy, the computer, will command the transmission to go into, limp mode.
Limp mode is a security function for your engine and transmission. When the engine or transmission control unit; has recognized a serious faulty value from the engine or transmission; the car will go into limp mode. The limp mode does often, reduce the power and limit the (RPM) of the engine. Allowing you to drive your car to a workshop, without damaging the engine.