PMBMachineRHS:

--------------------------------------------------------------------------
   Permanent magnet brushless machine in DQ coordinates.
   It returns only the motor current derivatives. It assumes
   that the inductances and magnet flux are not functions of time.
--------------------------------------------------------------------------
   Form:
   [xDot, tE, pD] = PMBMachineRHS( x, t, d )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x          (3,1)  States [iD;iQ;omegaM;thetaM]
   t          (1,1)  Time (not used)
   d          (1,1)  Machine data structure
                     .p   (1,1) Number of poles
                     .lMD (1,1) Direct mutual inductance (H)
                     .lMQ (1,1) Quadrature mutual inductance (H)
                     .psi (1,1) Magnet Flux
                     .rS  (1,1) Stator resistance (Ohm)
                     .u   (2,1) Phase voltages [uD;uQ] (V)
                     .inr (1,1) Polar inertia
                     .tM  (1,1) Mechanical torque (Nm)

   -------
   Outputs
   -------
   xDot       (2,1)  State Derivative [iD;iQ;omegaM;thetaM]
   tE         (1,1)  Electrical torque (Nm)
   pD         (1,1)  Power dissipated (W)

--------------------------------------------------------------------------