PMSM Parameterization from Datasheet
This example shows two test harnesses that add confidence that a PMSM is correctly parameterized from a datasheet. It also calculates motor efficiency at rated speed and torque.
Model
The rated conditions test harness below uses datasheet values for damping and friction plus it adds an additional linear damper that is sized to reach rated torque when rotating at rated speed. The three current sources deliver rated current. This test harness verifies that the motor is capable of delivering the rated torque at rated speed and also determines the motor efficiency.
The stall conditions test harness replicates a stall event by effectively shorting the mechanical R and C connections via the torque sensor. The torque measured by the torque sensor is checked against the datasheet value for the stall torque. An incorrect stall torque could indicate an incorrect value for the torque constant, perhaps because the measurement convention has not been defined on the datasheet.

Rated Conditions
The plot below is generated from the rated conditions test harness and verifies that the motor is capable of delivering the rated torque at rated speed and also determines the motor efficiency.

Stall Conditions
The plot below confirms that the simulated stall torque is equal to the datasheet stall torque.

Results from Real-Time Simulation
This example has been tested on these platforms:
Speedgoat™ Performance real-time target machine with an Intel® 3.5 GHz i7 multi-core CPU and 4 GB RAM.
dSPACE® SCALEXIO LabBox with Intel® Core XEON E3-1275v3 at 3.5GHz and 4 GB RAM.
You can run this model in real time with a step size of 50 microseconds by using the Simscape local solver. For small sample rates, a task overrun might occur during the initial task execution due to a cold cache. To avoid this overrun, if the selected platform supports these options, relax the start-up behavior by specifying a limited number of task overruns or increasing the sample time of periodic tasks during the start-up phase of the real-time application.