In this simulation Field Orientated Control, FOC, of an Induction motor is implemented.

There are several important aspects of the simulation:

- the power stage, which is characterized by the red traces which includes the DC voltage source
- the 3 phase inverter
- the induction motor model and
- the mechanical constant torque load.

The control stage is characterized by the green traces. There are several main aspects of the control circuit:

- The initial abc-dq0 transformation from the current sensors for the motor

- the generation of theta used by the abc-dq0 and dq0-abc transformations
- the PI controllers for Id, Iq
- the PI controller for speed

The control algorithm has been implemented in the s-domain with analog control blocks.

## Theta and Electrical Speed Calculation

The slip is calculated by commanded Iq/Id multiplied by the inverted rotor time constant (Rr/(Lm+Lr). This is then added to the conversion of the sensed shaft speed converted to the magnetic revolutions per second with the RPM_to_MRS block, (0.1047187*3). First, we convert rpm to rad/s: rpm*2*PI/60 = 0.10471975511966, this is then multiplied by the pole pairs, 3.

Integrating the addition of these will give theta which is used by the dq transformation blocks. In our simulation theta is being allowed to accumulate and if this was to be implemented with a DSP a resetting integral, 0-2*pi, would be needed to prevent memory overflow.

The motor has a very light load in the simulation as a result, the slip, the difference between electrical and mechanical speed, is minimal. At 100 N*m torque load the slip will be ~2%.

## DQ Reference Transformation

In this simulation the abc-dq0 transformation from the feedback sensors is assuming that the q-axis is lagging the d-axis, a flag can be toggled in the transformation block to have the q-axis lead the d-axis.

## Speed Control

The speed of the motor is controlled by controlling Iq. The motor is working in the 1st quadrant with a positive torque and a positive speed. So a positive speed is giving a positive value of Iq; however, Iq from the motor feedback has a negative value in the 1st quadrant so gain block P14, resolves this sign issue.