# Motor model#

This chapter describes how the knowledge of motor characteristics is represented in Telega and the related configuration parameters. This information is shared for all commands.

Changes to all parameters in this group, unless specified otherwise, take effect at the next command execution (e.g., if the motor is stopped and started again).

## Motor characteristics#

Register

Type

Unit

Default

Description

motor.mechanical_ratio

natural16

$$\frac{\text{electrical radian}}{\text{radian}}$$ or $$\frac{\text{electrical radian}}{\text{meter}}$$

1

Ratio of electrical angular velocity to mechanical velocity.

motor.current_max

real32

ampere

10

Rated phase current amplitude.

motor.resistance

real32

ohm

0

Phase resistance $$R_s$$.

motor.inductance_dq

real32

henry

0, 0

Phase inductance $$L_{dq}$$, direct and quadrature.

motor.flux_linkage

real32

weber

0

Flux linkage $$\phi$$.

### Mechanical ratio#

The mechanical ratio defines the relation between the electrical angle of the motor and the position of the mechanical load driven by the motor, which may be either rotational (angular) or translational (linear).

For rotary loads, it is the product of the pole pair count and the gear ratio of the gearbox connected to the shaft, if any; the unit is $$\frac{\text{electrical radian}}{\text{radian}}$$. For example, for a 14-pole direct-drive motor (without a gearbox), the mechanical ratio is 7.

For translational loads, the unit is $$\frac{\text{electrical radian}}{\text{meter}}$$. For example, if the load is displaced by 2 mm per (mechanical) radian, the rotor has 10 poles (5 pole pairs), and the motor is equipped with a 2:1 gearbox, the resulting mechanical ratio is $$\frac{10 \,\text{[poles]}}{2} \times \frac21 \times \frac{1 \,\text{[radian]}}{2 \times 10^{-3} \,\text{[meter]}} = 5000$$.

### Automatic parameter identification#

The key motor parameters can be automatically measured by the motor identification command. However, better performance for high-quality motors is achievable by taking the required parameters from the PMSM parameters spreadsheet at https://docs.google.com/spreadsheets/d/1Is3rCVp-Ibe1MELjCmrP3yA8ozJ6n9Sme-N9w2nRsi0/edit (if your motor is not listed, get in touch with Zubax Robotics). Since high-quality motors feature low parameter variability, the values measured from one motor are applicable to any other motor of the same model. Zubax Robotics can perform high-accuracy parameter measurement using special equipment instead of relying on the automatic motor identification feature of Telega, which may be less precise.

## DQ-frame parameters#

Register

Type

Unit

Description

motor.current_ramp

real32

$$\frac{\text{ampere}}{\text{second}}$$

$$\frac{\delta{}i}{\delta{}t}$$ setpoint limit.

motor.voltage_ramp

real32

$$\frac{\text{volt}}{\text{second}}$$

$$\frac{\delta{}u}{\delta{}t}$$ setpoint limit.

motor.current_ctl_bwr

real32

1

Current controller bandwidth ratio.

The current ramp setting is used in all control modes. It limits the slew rate of the $$i_{dq}$$ setpoint, produced by the torque & flux controller, to avoid destabilizing the drive by rapid transients (esp. in sensorless mode). If the torque setpoint is driven by a higher-level controller (e.g., velocity controller), then the current limit should be set to a high value (typ. at least 5 kA/s) to avoid interference with the outer control loop. In the voltage control mode, the $$i_q$$ limit is ignored because the $$u_q$$ voltage setpoint is supplied directly, bypassing the Q-axis current controller.

The voltage ramp setting is used only in the direct $$u_q$$ voltage control mode and ignored in all other modes. In the voltage control mode, the $$i_d$$ current regulator is still active as usual. The direct voltage control mode is not recommended for use in any application except in propulsion drives of multirotor UAVs, although even then it is recommended to use the velocity control mode instead.

The current controller bandwidth ratio (BWR) is the ratio of the $$i_{dq}$$ controller bandwidth to its update frequency (which is determined by the control system). Higher BWR values increase the responsiveness of the drive to load and speed variation but also increase the phase current noise level and the risk of self-induced oscillation. Lower values produce smoother phase voltage and reduced noise but increase the risk of stalling the motor in the face of rapid transients. For most practical applications, the BWR value is typically between 0.01 and 0.2.

Underdamped phase current control loop causes the motor to produce audible high-pitched noise even at standstill and/or zero load. The under-dampening may be caused by the BWR settings being too high or, commonly, the inductance and/or resistance parameters being set incorrectly.

## Demand factor#

The demand factor estimate is computed by Telega in real time. It reflects how close the drive is to depleting the available power reserves, where zero indicates that no power transfer is taking place, one indicates that the reserves are fully depleted while transferring power from the DC link into the load, and negative one indicates that the reserves are fully depleted while transferring power from the load back into the DC link.

From the drive power transfer equation, we know that in the ideal drivetrain: $$P_\text{electrical} = u_\text{dc} \, i_\text{dc} = \tau \, \omega = F \, v = P_\text{mechanical}$$. The demand factor is $$D = \max \left( \frac{i}{i_\text{max}} , \frac{u}{u_\text{max}} \right)$$. The maximum phase current amplitude $$i_\text{max}$$ is limited by the motor characteristics, and the maximum phase voltage amplitude $$u_\text{max}$$ is limited by the DC link voltage. As torque is a function of current and voltage is a function of velocity, this definition of the demand factor indicates how close the drive is to depleting either its torque or velocity reserves, whichever is closer to the limit.

## Motor temperature sensor#

Register

Type

Default

Unit

Description

motor.thermistor_v2k

real32

0, 0, 0

$$\text{kelvin}, \frac{\text{kelvin}}{\text{volt}}, \frac{\text{kelvin}}{\text{volt}^2}$$

Thermistor polynomial coefficients.

Optionally, a motor temperature sensor can be connected to the auxiliary analog port. Telega measures the voltage at the auxiliary analog port and maps the voltage [volt] to temperature [kelvin] as $$t = c_0 + u\,c_1 + u^2\,c_2$$; where $$c_n$$ is the n-th element of the configuration parameter. It follows that any type of analog temperature sensor is supported as long as its output voltage is a function of temperature and the dynamic range of the output is within the dynamic range of the auxiliary input port. The characteristics of the latter are hardware-specific and should be looked up from the hardware datasheet.

Setting all coefficients to zero disables the motor thermistor interface (this is the default).

One common use case is to connect a thermistor (temperature-sensitive resistor) to the Aux port with a pull-up resistor as shown in the circuit diagram.

Many Telega-powered devices provide an optional built-in pull resistor $$R_\text{pull}$$, which can be used to drive the Aux input high, thereby obviating the need for any external circuitry sans the thermistor itself. Some devices have a relatively high series resistance $$R_\text{io}$$ connected directly to the Aux pin; the equivalent circuit diagram is shown below. Observe that the resistance of $$R_\text{io}$$ is added to that of the thermistor.

One can obtain the polynomial coefficients for an arbitrary thermistor with an arbitrary pull-up resistor by a simple regression from several sample points using the following Python script:

 1import numpy as np  # pip install numpy
2import plotly.express as px  # This is optional, for visualization purposes only.
3
4r_pullup = 1000  # Resistance between Thermistor and v_pullup (external or built-in, consult datasheet).
5v_pullup = 3.30  # Voltage driving the divider at the high side of r_pullup.
6r_io = 200  # The series input resistance (only applies if the built-in pull-up is used).
7# temperature->resistance sample points go below.
8resistance = r_io + np.array([
9    490, 515, 567, 624, 684, 747, 815, 886, 961, 1000, 1040, 1122, 1209, 1299, 1392, 1490, 1591, 1696, 1805, 1915, 1970,
10    2023, 2124, 2211,
11])
12temperature = 273.15 + np.array([
13    -55, -50, -40, -30, -20, -10, 0, 10, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 125,
14    130, 140, 150,
15])
16voltage = resistance * v_pullup / (resistance + r_pullup)
17assert len(resistance) == len(temperature) == len(voltage)
18poly = np.polyfit(voltage, temperature, 2)[::-1]
19print(poly)
20apply = lambda coeff, v: coeff + coeff * v + coeff * v ** 2
21fig = px.scatter(x=voltage, y=temperature)
22fig.add_scatter(x=voltage, y=list(apply(poly, x) for x in voltage))
23fig.show()


### Commonly encountered configurations#

NXP KTY81/110, NXP KTY81/120, NXP KTY81/121, NXP KTY81/122, NXP KTY81/150, Littelfuse 102PS1J, Littelfuse 102PS1G:

Aux port configuration

Coefficients

$$R_\text{pull}=1000, R_\text{io}=0, V_\text{pull}=3.3$$

160.465, 3.092, 48.378

$$R_\text{pull}=1200, R_\text{io}=0, V_\text{pull}=3.3$$

151.242, 36.461, 40.654

NXP KTY83/110, NXP KTY83/120, NXP KTY83/121, NXP KTY83/122, NXP KTY83/150:

Aux port configuration

Coefficients

$$R_\text{pull}=1000, R_\text{io}=0, V_\text{pull}=3.3$$

228.990, -78.707, 72.331

NXP KTY84/130, NXP KTY84/150, NXP KTY84/151:

Aux port configuration

Coefficients

$$R_\text{pull}=1000, R_\text{io}=0, V_\text{pull}=3.3$$

178.739, 20.044, 58.927

$$R_\text{pull}=1000, R_\text{io}=200, V_\text{pull}=3.3$$

136.310, 5.154, 69.914

$$R_\text{pull}=1200, R_\text{io}=200, V_\text{pull}=3.3$$

104.472, 71.427, 54.992