Hi, I'm looking into the control of a PMSM (permanent magnetics synchronous motor) motors using H-briges and PWM (puls width modulation). I'v seen motor controllers that use a PID controller for speed regulation. The output of the PID controls the PMW. This makes sense to me because the PMW controls the voltage of the motor phases and this is proportional to the speed. The speed is measured and feed back into the PID. But now I want to regulate the torque, thus the current. I have seen implementations that use a PID controller with current inputs (reference and sensed phase current) and again the output of the PID controlling the PMW. So essentially the same setup as for speed control. I do not understand this. The output of the PID should control the motor current. But it controls the voltage. The current will increase or decrease because of the voltage and inductance. So there is an extra integration going on. How is it possible such a PID loop works?