To design current and position scaling subsystem:
Read the current in ADC counts and convert to Per-Unit (PU).
IaOffset and IbOffset are the ADC
offsets for current measurement and they are hardware specific. The default
ADC offset (CtSensAOffset and
CtSensBOffset) is given in the file
mcb_SetInverterParameters.m
for few commercially
available inverters. For details about ADC offset calibration in hardware,
see Run 3-Phase AC Motors in Open-loop Control and Calibrate ADC Offset.
In this subsystem shown in the above figure, the motor phase current
measured in ADC counts is converted to current in Per-Unit (PU).
PU_System.I_base
refers to the base current. For
details, see Per-Unit System. Refer to
mcb_SetPUSystem.m
that computes the Per-unit values
for the system.
Use base values for computing real world values from per-unit. For real
world value or SI unit implementation, refer to the example model
mcb_pmsm_foc_qep_f28379d_SIUnit
.
The data-store memory IaOffset and IbOffset are used for sharing the data between the subsystems.
Read the position from the QEP pulse count.
The Quadrature Decoder block reads the position count from plant model or hardware driver block. The block converts the rotor mechanical position in encoder position counts to rotor mechanical angle in Per-Unit (0-1).
The Mech2Elec Position block adjusted the mechanical angle for QEP offset and converts them to electrical angle. This rotor electrical angle is required for the FOC algorithm to spin the motor. Refer to Quadrature Encoder Offset Calibration for PMSM Motor for calculating the QEP encoder offset.
The Speed Measurement block calculates speed from the rotor position. In Speed Measurement block mask, specify the value of the Delays for speed calculation (number of samples) parameter. We selected the value 20 in this workflow so that the block can measure the maximum speed of the motor that is under test. Speed measurement block outputs speed in PU.
Create subsystems to include the current scaling and position decoding logic, as explained in the above steps.