Documentation

RC Servo

Radio control servomotor with PWM-based angular position tracking and fault modeling

  • Library:
  • Simscape / Electronics / Actuators & Drivers / Rotational Actuators

Description

The RC Servo block represents a small DC motor with a gearbox and control circuitry, commonly used in quadcopters, radio-controlled planes and helicopters, and other mechatronic devices. RC servos provide angular position control of the output shaft over a limited angle range. The angle demand is set by the pulse width of a PWM signal applied to port s.

The RC Servo block models the following effects:

  • Torque-speed behavior based on DC motor equations

  • Position tracking based on the input PWM signal pulse width

  • Internal gear reduction ratio, including associated friction losses

  • Mechanical end stops, to prevent the output shaft being driven out of range by the load

  • Position measurement error

  • Fault modeling

The motor equations are the same as those used by the DC Motor block, except that the inductance is not modeled. The RC Servo block determines the equation parameters using the stall torque and no-load speeds, and makes a correction to take account of the backdrive torque.

Faults

The RC Servo block allows you to model several types of faults:

  • Fail off — No electrical torque.

  • Fail forward — Rotates in a positive direction to hit the upper end stop.

  • Fail reverse — Rotates in a negative direction to hit the lower end stop.

  • Failed winding — Torque is applied only if the motor rotor lines up with one of the two remaining functioning windings.

The block can trigger fault events:

  • At a specific time

  • When a current limit is exceeded for longer than a specific time interval

You can enable or disable these trigger mechanisms separately, or use them together if more than one trigger mechanism is required in a simulation. When more than one mechanism is enabled, the first mechanism to trigger the fault takes precedence. In other words, component fails no more than once per simulation.

You can choose whether to issue an assertion when a fault occurs, by using the Reporting when a fault occurs parameter. The assertion can take the form of a warning or an error. By default, the block does not issue an assertion.

Variables

Use the Variables section of the block interface to set the priority and initial target values for the block variables prior to simulation. For more information, see Set Priority and Initial Target for Block Variables (Simscape).

Basic Assumptions and Limitations

  • This block has no optional thermal port.

  • If you simulate the model with a fixed-step solver, for example, using a local solver, the step size must be small enough to get the required resolution of the input pulse width. MathWorks recommends that you use this block with variable step solvers for fast desktop simulation.

Ports

Conserving

expand all

Electrical conserving port associated with the PWM control signal. The output shaft angle demand is set by the pulse width of the voltage applied to this port.

Electrical conserving port associated with the motor positive terminal.

Electrical conserving port associated with the motor negative terminal.

Mechanical rotational conserving port associated with the rotor.

Mechanical rotational conserving port associated with the stator (casing).

Parameters

expand all

Electrical Torque

Maximum load torque that the RC servo can move without stalling (stopping).

The time for the output shaft to turn 60 degrees when the motor is driving no load.

The DC supply voltage used when measuring stall torque and time to travel 60 degrees.

The output shaft angular range of the RC servo.

The input pulse widths corresponding to the minimum and maximum output angles, as defined by the Rotational range parameter. Pulse widths outside of this range are clipped by the block to stay within this range.

Control

The input pulse is detected as high when the voltage between the s and - ports is above this level.

The electrical impedance measured between the s and - ports.

When the error between the demanded output shaft angle and measured output shaft angle drops below the angle resolution, the motor is powered off. This parameter models the hysteresis usually incorporated into an RC servo controller to prevent chatter around a set point.

This parameter allows you to model an angle measurement error, such as can happen due to a failing potentiometer angle sensor. For example, if you want to model the motor being powered against one of the hard stops, you can set a suitable angle measurement error to achieve this.

Mechanical

Load torque required to backdrive the motor when it is unpowered. The block uses this value to determine the gear friction parameters.

Reduction ratio from the DC motor shaft to the RC servo output shaft. This parameter affects only the impact of rotor inertia on equivalent inertia value at the output shaft. It has no impact on no-load speed. Therefore, the value does not have to be precise.

Inertia of the DC motor, plus inertia of the gearing reflected to the rotor (typically small if the gears are plastic).

Mechanical end stops prevent rotation of the output shaft beyond the specified range. The range specified by the end stop angles must be larger than that specified by the Rotational range parameter.

Stiffness of mechanical end stops.

Damping of mechanical end stops.

Faults

Select Yes to enable faults modeling. The associated parameters in the Faults section become visible to let you select the reporting method and specify the trigger mechanism (temporal or behavioral). You can enable these trigger mechanisms separately or use them together.

Choose whether to issue an assertion when a fault occurs:

  • None — The block does not issue an assertion.

  • Warn — The block issues a warning.

  • Error — Simulation stops with an error.

Dependencies

Enabled when the Enable faults parameter is set to Yes.

Select the type of fault:

  • Fail off — No electrical torque.

  • Fail forward — Rotates in a positive direction to hit the upper end stop.

  • Fail reverse — Rotates in a negative direction to hit the lower end stop.

  • Failed winding — Torque is applied only if the motor rotor lines up with one of the two remaining functioning windings.

Dependencies

Enabled when the Enable faults parameter is set to Yes.

Select Yes to enable time-based fault triggering. You can enable the temporal and behavioral trigger mechanisms separately or use them together.

Dependencies

Enabled when the Enable faults parameter is set to Yes.

Set the simulation time at which you want the block to enter the faulted state.

Dependencies

Enabled when the Enable temporal fault trigger parameter is set to Yes.

Select Yes to enable behavioral fault triggering. You can enable the temporal and behavioral trigger mechanisms separately or use them together.

Dependencies

Enabled when the Enable faults parameter is set to Yes.

Specify the maximum permissible current value. If the current exceeds this value for longer than the Time to fail when exceeding maximum permissible current parameter value, then the block enters the faulted state.

Dependencies

Enabled when the Enable behavioral fault trigger parameter is set to Yes.

Set the maximum length of time that the current can exceed the maximum permissible value without triggering the fault.

Dependencies

Enabled when the Enable behavioral fault trigger parameter is set to Yes.

See Also

Introduced in R2017b

Was this topic helpful?