The purpose of measuring the angle is to identify air flow. A wide open throttle will allow for maximum airflow whereas a closed throttle will allow for engine to idle (using other measures to allow a small amount of airflow necessary for idling).
A TPS sensor is used on both drive-by-wire and drive-by-cable. On drive-by-wire cars, the throttle plate on the throttle body is controlled by an electrical system that will move the throttle plate in proportion to the movement of the gas pedal (which is measured by gas pedal position sensors. On drive-by-cable cars, the throttle plate is directly connected to the gas pedal using a metal cable.
The TPS sensor overlaps with the MAF, MAP and IAT sensor, in the sense that they all measure the amount of air (and air density) that is entering the engine. The ECU combines the data from these sensors to get a very accurate measurement as well as used the data from these sensors to validate the sensor functionality.
The TPS sensor is usually fitted on the shaft of the throttle plate. On drive-by-wire cars, the TPS sensor is fitted to one end of the shaft, and an electrical motor is fitted to the other end of the shaft.
The TPS sensor is a potentiometer, a variable resistance that decreases in proportion to the throttle plate position. So the more open the throttle is, the less resistance is applied in the potentiometer.
The TPS sensor is usually a 3 wire configuration. One wire is used for a +5V reference signal (sent by the ECU – Engine Control Unit) entering the TPS sensor. One wire is used for the output, which is the reference signal going through a variable resistance, decreasing to a new voltage and being sent back to the ECU (so the ECU can identify the throttle position). The last wire is used for ground.
To troubleshoot TPS Sensor error codes, unplug the TPS sensor and measure voltage across reference signal terminal from the ECU and ground terminal. You should see 5V otherwise the problem is elsewhere and not in the sensor.
Check for continuity on the TPS sensor terminals between the reference signal terminal and the output terminal. If the TPS sensor is open (no continuity) it must be replaced.
The TPS sensor can be tested through its resistance range using a volt meter and manually moving the throttle body through its range on drive-by-cable cars (ignition on, engine off). On drive-by-wire, the TPS has to be removed and tested on the bench using a +5V signal. You should see a gradual increase of voltage as the throttle body opens. Move the throttle plate from closed to wide open and back again to closed, slowly to identify any dead spots. The actual resistance values depend on the particular sensor, however expect 0.5V at closed position gradually increasing to 4.5V.
Dead spots will in the TPS sensor, will result in engine hesitation when pressing on the gas pedal, as the ECU will think that the driver got of the gas pedal and therefore reduce fuel delivery. Dead spots in the TPS sensor can more easily be identified using a volt meter with a graphing capability or an oscilloscope. Dead spots will be displayed as a sudden drop/increase of voltage instead of being proportionate to the throttle plate angle.
TPS error codes can also be due to a dirty throttle body, where the accumulated dirt/carbon particles do not allow the throttle plate to close fully allowing air flow through, when it should be closed. In this case the throttle body should be cleaned, however be aware that most modern cars will throw new error codes, with a freshly cleaned throttle body as the ECU will be adapted to a completely different range of voltage. The ECU will have to relearn the position of closed to wide-open. This relearning is done using a bidirectional scan tool that can program the new values into the ECU.