Engee documentation
Notebook

Determination of the parameters of a permanent magnet synchronous motor (PMSM) on an experimental stand

When working with real engines, it often happens that not all the necessary parameters are specified in the technical documentation. This example shows how to determine the counter-EMF coefficient and the torque constant of a permanent magnet synchronous motor (PMSM) if its flow coupling is unknown.

Imagine that we have a real motor operating in generator mode, at the terminals of which the voltage can be measured. We will rotate its shaft with angular velocity:

In [ ]:
angular_velocity = 5; # glad/with

The experimental stand is presented in the model PMSMParameterization.engee a masked subsystem.
As with real experimental measurements, the voltage signal is noisy.

PMSMParameterization--1790948367664.png

The following is a model based on the PMSM block (library Physical Modeling/Electricity/Electric machines/With permanent magnets).

We will define the missing parameters of the PMSM block in this example.

image_2.png

In the unit settings, you can select the method ** for Parameterizing the magnetic flux of permanent magnets**. You can ask:

  • Flow coupling (Specify flux linkage),
  • constant torque (Specify torque constant)
  • counter-EMF ratio (Specify back EMF constant).

Choose To Set the counter-EMF coefficient. The counter-EMF coefficient is unknown, so first we'll set it to an arbitrary value.:

In [ ]:
Ke = 0.1;  # B*c/glad.

Launching the model:

In [ ]:
engee.addpath(@__DIR__)
if "PMSMParameterization" in [m.name for m in engee.get_all_models()]
    m = engee.open( "PMSMParameterization" ) # loading the model
else
    m = engee.load( "PMSMParameterization.engee" )
end
results1 = engee.run(m, verbose=true)
Building...
Progress 0%
Progress 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 30%
Progress 35%
Progress 40%
Progress 45%
Progress 50%
Progress 55%
Progress 60%
Progress 65%
Progress 70%
Progress 75%
Progress 80%
Progress 85%
Progress 90%
Progress 95%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    run_id => 1,
    "I_exp" => WorkspaceArray{Float64}("PMSMParameterization/I_exp")
,
    "T_exp" => WorkspaceArray{Float64}("PMSMParameterization/T_exp")
,
    "V_model" => WorkspaceArray{Float64}("PMSMParameterization/V_model")
,
    "V_exp" => WorkspaceArray{Float64}("PMSMParameterization/V_exp")
,
    "I_model" => WorkspaceArray{Float64}("PMSMParameterization/I_model")

)

Reading data from a model:

In [ ]:
t = collect(results1["V_exp"]).time;             # Time
V_model  = collect(results1["V_model"]).value;   # Voltage measured in the PMSM model
V_exp = collect(results1["V_exp"]).value;        # Voltage C of the experimental setup

Let's plot the voltage across the winding * of phase a* of the experimental motor and its model. The voltage amplitudes vary markedly, since the value of the counter-EMF coefficient is set arbitrarily.

In [ ]:
using Plots
plotlyjs();
plot(t, V_exp, title="Experiment", xlabel="Time, c", ylabel="Voltage, V", w = 2, label="Experimental setup")
plot!(t, V_model, title="Model", xlabel="Time, c", ylabel="Voltage, V", w = 2, label="The PMSM model")
Out[0]:

Calculation of the counter-EMF coefficient

Counter-EMF coefficient it can be calculated using the formula:


– the peak value of the voltage on the winding of phase a;
– the angular velocity of rotation of the rotor.

The formula is valid for a negligible current in the stator windings. In the model, each phase is connected to the ground via a resistance Ohms, which brings the measurement conditions closer to the open circuit mode.

Peak voltage value It is estimated as half the difference between the maximum and minimum values of the signal. To reduce the effect of high-frequency noise, we pre-filter the measured voltage.

In [ ]:
# filtering of the measured voltage signal:
using DSP
window_size = 100;
# Calculation of the peak voltage across the phase A winding
V_exp_filt = filt(ones(window_size) / window_size, 1, V_exp);
V_a_peak = (maximum(V_exp_filt)-minimum(V_exp_filt))/2;

Calculate the counter-EMF coefficient:

In [ ]:
Ke = V_a_peak / angular_velocity;
println("Коэффициента противо-ЭДС: $Ke В∙с/рад")
Коэффициента противо-ЭДС: 0.18476486146112153 В∙с/рад

Let's run the model with the calculated value of the counter-EMF coefficient.

In [ ]:
results2 = engee.run(m, verbose=true)
Building...
Progress 0%
Progress 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 30%
Progress 35%
Progress 40%
Progress 45%
Progress 50%
Progress 55%
Progress 60%
Progress 65%
Progress 70%
Progress 75%
Progress 80%
Progress 85%
Progress 90%
Progress 95%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    run_id => 2,
    "I_exp" => WorkspaceArray{Float64}("PMSMParameterization/I_exp")
,
    "T_exp" => WorkspaceArray{Float64}("PMSMParameterization/T_exp")
,
    "V_model" => WorkspaceArray{Float64}("PMSMParameterization/V_model")
,
    "V_exp" => WorkspaceArray{Float64}("PMSMParameterization/V_exp")
,
    "I_model" => WorkspaceArray{Float64}("PMSMParameterization/I_model")

)
In [ ]:
if "PMSMParameterization" in [m.name for m in engee.get_all_models()]
    m = engee.open("PMSMParameterization") # loading the model
else
    m = engee.load("PMSMParameterization.engee")
end
results2 = engee.run(m, verbose=true)
Building...
Progress 0%
Progress 5%
Progress 10%
Progress 15%
Progress 20%
Progress 25%
Progress 30%
Progress 35%
Progress 40%
Progress 45%
Progress 50%
Progress 55%
Progress 60%
Progress 65%
Progress 70%
Progress 75%
Progress 80%
Progress 85%
Progress 90%
Progress 95%
Progress 100%
Progress 100%
Out[0]:
SimulationResult(
    run_id => 3,
    "I_exp" => WorkspaceArray{Float64}("PMSMParameterization/I_exp")
,
    "T_exp" => WorkspaceArray{Float64}("PMSMParameterization/T_exp")
,
    "V_model" => WorkspaceArray{Float64}("PMSMParameterization/V_model")
,
    "V_exp" => WorkspaceArray{Float64}("PMSMParameterization/V_exp")
,
    "I_model" => WorkspaceArray{Float64}("PMSMParameterization/I_model")

)

Reading data from a model:

In [ ]:
t = collect(results2["V_exp"]).time;             # Time
V_model  = collect(results2["V_model"]).value;   # Voltage measured in the PMSM model
V_exp = collect(results2["V_exp"]).value;        # Voltage C of the experimental setup
In [ ]:
plot(t, V_exp, title="Experiment", xlabel="Time, c", ylabel="Voltage, V", w = 2, label="Experimental setup")
plot!(t, V_model, title="Model", xlabel="Time, c", ylabel="Voltage, V", w = 2, label="The PMSM model")
Out[0]:

After calculating the counter-EMF coefficient, the voltages on the winding of phase a of the experimental motor and the model are similar in shape and amplitude.

Calculation of the torque constant

Another way to parameterize the flow coupling is to select the torque constant in the PMSM unit settings for *Permanent magnet flux linkage parameterization (Specify torque constant).
In this example, we will not change this setting in the model, but consider the process of calculating the torque constant.:

The torque constant can also be used to parameterize the flow coupling. . To do this, in the parameter Parameterization of the magnetic flux of permanent magnets select an option The torque constant. In this example, we will leave the chosen parameterization method, but calculate based on the measurement results:

— peak current value in the winding phase A ;

—the torque applied to the motor shaft.

Reading data from a model:

In [ ]:
I_model  = collect(results2["I_model"]).value;   # Current measured in the PMSM model
I_exp = collect(results2["I_exp"]).value;        # Current from the experimental setup
T_exp = collect(results2["T_exp"]).value;        # The moment on a real engine
In [ ]:
using Statistics
T = abs(mean(T_exp));
window_size = 1000;
I_exp_filt = filt(ones(window_size) / window_size, 1, I_exp);
I_exp_peak = (maximum(I_exp_filt)-minimum(I_exp_filt))/2;
Kt = 2/3*T/I_exp_peak;
println("Константа крутящего момента: $Kt Н∙м/А")
Константа крутящего момента: 0.1816540795303888 Н∙м/А

Let's compare the currents in the phase a winding of the experimental motor and the model:

In [ ]:
plot(t, I_exp, title="Experiment", xlabel="Time, c", ylabel="Current, A", w = 2, label="Experimental setup")
plot!(t, I_model, title="Model", xlabel="Time, c", ylabel="Current, A", w = 2, label="The PMSM model")
Out[0]:

The calculated counter-EMF coefficient and the torque constant have similar numerical values.: and since they are related to the flux coupling of permanent magnets through the number of pairs of motor poles :