How does this block diagram convert input current to per unit value?
Show older comments

This is from
Field-Oriented Control of PMSM Using Hall Sensor
openExample("mcb/FocHallExample")
From Current controller subsystem. I couldn't wrap around how this method converts the input current to per unit value when I don't see a division of a base value, like how we analyze transformer problems. Can someone explain to me how this successfully converts the current to per unit value? Or point me to a resource that I can study, because I can't find anywhere online that explains this.
Answers (2)
Walter Roberson
on 31 May 2026
0 votes
Input values are multiplied by 2^6. Note that Qu<<6 has the same effect as Vu*2^6 for integer-type values, except that the undefinedness of overflow conditions are expressed slightly different ways.
After that, the sfix32_En17 takes the bits and applies an internal division by 2^17 .
175 * 2^6 --> 11200
11200 / 2^16 --> 0.08544921875
So an input of 175 generates an output of 0.08545
MathWorks Motor Control Blockset Team
on 6 Jul 2026
0 votes
This implementation assumes a 12-bit ADC, where the full-scale ADC count is 4095. The measured current is represented in per-unit (pu) form with respect to the neutral-to-peak value of the sinusoidal current. Therefore, the effective ADC count corresponding to 1 pu is 2048 (approximately half of the full-scale range).
To convert the offset-compensated ADC measurement to a per-unit value, the ADC count must be divided by 2048, which is equivalent to a right shift by 11 bits.
The implementation uses a fixed-point data type with 17 fractional bits. When a signal is cast using Data Type Conversion in Stored Integer mode, the underlying integer value is preserved and only the binary-point location is reinterpreted. In other words, the bit pattern remains unchanged while the decimal point is positioned according to the specified fixed-point scaling.
Since the per-unit conversion requires an effective division by 2¹¹, and the output fixed-point format requires 17 fractional bits, the value is first shifted left by 6 bits (17 − 11 = 6). As a result, when the signal is reinterpreted as a fixed-point number with 17 fractional bits, the output directly represents the per-unit current. This approach avoids an explicit division operation and achieves the scaling efficiently using only bit-shift operations.
Categories
Find more on Converters (High Power) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!