AC Machine Inverter

This example demonstrates a transient fault simulation with a three phase AC machine supplyed from a battery via a DC/AC inverter. For this use case, it is important to consider the dynamics of the specific machine type, as well as the method of controlling the three phase AC currents between machine and inverter.

This example especially highlights dynamics that are specific to a PMSM (Permanent Magnet Synchronous Machine) operating in the high speed field weakening region.

The fault event in this experiment is initiated when the battery power supply is disconnected from the inverter.

Chain of events

The events in the experiment follow the State Graph steps in the diagram:

  • s_battery_connected: The battery is initially connected to the inverter, supplying it with 1000 V.
  • s_inverter_standby: The machine is initially at rest, with the inverter in disabled control mode.
  • s_inverter_enabled: At 0.1 s, the inverter goes into speed control mode, spinning up the machine up to 800 rad/s.
  • s_battery_disconnected: At 0.3 s, the contactors of the battery pack opens, disconnecting it from the inverter.
  • s_inverter_failure: The inverter is disabled as the voltage of the supply capacitor drops below 100 V.

DC voltage supply

The inverter is supplied by a 1000 V battery pack that can be disconnected via contactors. The contactors are controlled via the external close_contactors signal. Furthermore, the inverter has a DC supply capacitor. When the battery is disconnected, the DC voltage of the inverter is determined by the energy stored in this capacitor.

The voltage supplied to the inverter is monitored in the experiment via the control bus signal v_dc_sns.

Machine and inverter control

The machine is completely controlled from the inverter. The machine is "paired" to the inverter by specifying its' id as a parameter in the inverter controller. This is used for providing sensor signals from the machine to the inverter via the control bus, and for communicating with the machine sub-controller in the inverter.

The machine sub-controller of the inverter is the standard MultiMode controller that is used also for generalized machines. This controller handles the high level control of the machine, including speed control and other modes of operation. The operation mode is controlled via the external signal mode_ref, supplied via the control bus. Note that the machine id is used for addressing signals to this machine sub-controller (not the inverter id).

The reference speed has been parametrized to 800 rad/s in the machine sub-controller. Based on this, a reference torque is generated for a downstream torque sub-controller. A torque controller for this specific machine type (PMSM) has been selected, which includes a simple model based field weakening controller for high speed operation of the PMSM. Parameters for the specific machine used in this example has been provided to the torque controller.

For more information of controller ids and external signals, refer to the section Controllers and signals in the User's guide.



Looking at the simulation results, we can see the speed of the machine rotor accelerating up to the reference of 800 rad/s, where it stays until the fault event ocurrs. When the inverter is disabled, the mechanical load makes the machine slow down.


We note an initial high constant torque, with a reduction as we reach the power limit, and a further reduction as we reach the target speed and only need to provide enough torque to counteract the mechanical load. When the inverter is disabled at 0.3 s, we quickly loose all rotor torque.


We can see that the output power of the machine increase up to a fairly constant limit. We can also note that the output power from the battery is a bit higher, as this also includes the heat losses in the inverter and machine. There is also an initial spike in the power as the inverter charges up current in the phase windings of the machine to generate torque.

Three phase AC currents

The maximum torque comes from the current limit being specified as 100 A in the inverter controller. We can verify this by looking at the peak value of the AC phase currents (machine.summary.i_pk).

The plot below also shows the Park transformed d- and q-components of the current (amplitude invariant peak values). Note how we initially generate torque only with current in the q-direction. It is sufficient to generate a field orthogonal to the field of the rotor magnets because of the non-salient rotor used in this machine (typically surfance mounted magnets). Note how current is being applied in the d-direction for higher speeds. This is to reduce the high back-EMF from the rotating magnets.

Three phase AC voltages

Looking at the three phase AC voltages, we can see that the maximum power is reached as we reach the maximum limit for the voltage amplitude. This happens when we the speed of the machine is so high that the back-EMF from the magnets equals that of the DC supply voltage (half of it, since we need both positive and negative voltages).

Note how the amplitude of the phase voltages suddenly increase a lot when the fault occurs and the inverter stops controlling the machine. Since we are operating at a high speed, we get a very high back-EMF as the currents drop to zero and we stop counteracting the field of the rotating magnets.

DC supply voltage

The DC supply voltage to the inverter is very steady until the battery is disconnected. When the power from the battery is lost, the voltage first drops, as the supply capacitor of the inverter discharges down to the 100 V limit. When the inverter is disabled, the current through the machine windings flow backwards through the inverter free-wheeling diodes. In addition to this, because the machine was running above base speed (voltage limit), the back-EMF is higher than 1000 V, forcing the voltage of the supply capacitor to a much higher voltage.

Active short circuit (alternative operation)

One way to avoid the uncontrolled reverse flow of current into the supply capacitor, and the resulting jump in voltage, is to short circuit the three phase windings of the machine when the inverter is disabled.

This behavior can be enabled in the switching sub-controller of the inverter by setting the parameter inverter.controller.switchControl.active_short = true. If we do this and simulate the experiment again, we can see that the voltage no longer jumps back up when falling to 100 V. Current keeps flowing through the machine, being lost as heat in the resistance of the windings.