Skip to content

MotorFault Module Documentation

Toolbox: RflySim PHM

MotorFault Module Appearance

Introduction

One-sentence Description: This module injects specified motor efficiency faults into multi-rotor UAV motors, outputting the motor speeds after fault injection, supporting both noise-free and noisy motor fault injection.

This module belongs to the RflySim PHM (Prognostics and Health Management) fault diagnosis and prediction toolchain, primarily designed for simulation test scenarios involving motor faults. It incorporates built-in mathematical modeling of motor principles and fault injection logic. Developers only need to configure fault types and parameters to perform fault injection without building fault models manually. The module can be used in conjunction with PX4 flight controller simulation, CopterSim physical engine simulation, and RflySim3D visualization environment. It receives normal control logic output motor PWM commands, outputs the motor speeds after fault injection to the flight controller or dynamics model, enabling reproduction of various typical motor fault scenarios such as motor stalling, efficiency degradation, and complete shutdown. This provides simulation data support for UAV motor fault diagnosis and fault-tolerant control algorithm development.

Port Descriptions

Input Ports (Inputs)

Port Name Data Type Dimension Description
FaultIn double 1×N Fault input, containing fault type identifier and fault parameter information
PWMIn double 1×M External input of fault-free motor speed; M is the number of motors on the UAV

Output Ports (Outputs)

Port Name Data Type Dimension Description
MotorRads double 1×M Output motor speed after injecting specified faults; M is the number of motors on the UAV

Parameter Configuration (Parameters)

The following parameters can be configured in the Mask dialog box opened by double-clicking the module:

Parameter Name Type Default Value Optional Values/Range Description
MotorFaultID int 123450 123450 Unique identifier ID for motor faults
NoiseMotorFaultID int [To be confirmed] Positive integer Unique identifier ID for noisy motor efficiency faults [To be confirmed]
FaultMotorNum int 1 1~16 Motor number where the fault occurs

Parameter Setting Descriptions

MotorFaultID

A globally unique identifier key for motor fault categories. This module matches the input fault command via this ID to trigger the corresponding motor fault injection.

FaultMotorNum

Specifies the target motor number for fault injection, supporting fault injection configuration for up to 16 motors on multi-rotor UAVs.

Fault Injection Rules

This module supports two types of motor efficiency faults: noise-free motor efficiency faults and noisy motor efficiency faults, distinguished and triggered by fault ID. The fault injection implementation logic is: output speed = input speed × health factor, where the health factor ranges from 0 to 1. A health factor of 0 corresponds to complete motor failure, resulting in a constant output of 0; a health factor of 1 indicates no fault, and the output matches the input.

Module Characteristics (Block Characteristics)

Characteristic Value
Supported Data Types double, single
Direct Feedthrough Yes
Sample Time Inherited
Code Generation Support No

Data Communication Protocol

This module does not involve network communication.

Module Name Description
PropFault Fault simulation module for injecting propeller faults, part of the RflySim PHM library
BattFault Fault simulation module for injecting battery faults, part of the RflySim PHM library
IMUFault Fault simulation module for injecting IMU sensor faults, part of the RflySim PHM library
BaroFault Fault simulation module for injecting barometer sensor faults, part of the RflySim PHM library
GPSFault Fault simulation module for injecting GPS sensor faults, part of the RflySim PHM library
MagFault Fault simulation module for injecting magnetometer sensor faults, part of the RflySim PHM library

Notes and Common Issues

  • Initialization Order: This module depends on the initialization of the RflySim platform’s PHM simulation environment. It must be used within the RflySim Flight Simulation framework. The RflySim kernel must be initialized before starting the simulation; otherwise, fault parameters will fail to parse correctly, causing fault injection to fail.
  • Fault ID Matching Rules: Noise-free and noisy motor efficiency faults correspond to different fault IDs. Fault inputs must be configured strictly according to the designated IDs: the corresponding fault will only be triggered if the input fault ID matches the module’s preset 123450 encoding rule; incorrect ID inputs will prevent fault injection.
  • Fault Parameter Format Requirements: This module accepts a FaultParam floating-point array of length 20, where the first 16 elements store fault parameters—each motor corresponds to one health factor in the range 0~1, calculated as faulty speed = input speed × health factor. If a health factor is set to 0, the corresponding motor’s output speed will be constantly 0. Ensure parameter dimensions and ranges meet requirements; otherwise, dimension mismatch errors may occur during simulation.
  • Multi-rotor Motor Count Matching: The input MotorNum (faulty motor number) must match the total number of motors configured for the simulated UAV. The number must not exceed the total motor count; otherwise, array out-of-bounds errors will occur, causing simulation crashes.
  • Sample Time Matching: The module’s output MotorRads serves as a critical feedback signal for motor speed closed-loop control. Ensure the module’s sample time matches that of the flight controller’s closed-loop modules; mismatched sample times can cause speed closed-loop control divergence and abnormal simulation results.
  • Parameter Meaning Distinction: The input PWMIn to this module is a normalized speed command, not a physical PWM duty cycle value; the output MotorRads is motor speed in physical units of rad/s. Do not confuse signal types to avoid calculation errors in control logic.
  • Motor Model Parameter Configuration: The motor speed-throttle curve parameters motorWb, motorCr, and inertia time constant motorT in the underlying Motor_Fun module must match the parameters of the motor model being used. Incorrect parameters will cause excessive deviation in the motor speed model, rendering the fault simulation results unreliable.

Changelog

  • v4.10 (2024-07-24): Initial release of the MotorFault motor fault injection simulation module, supporting injection of multiple motor efficiency fault types, including a motor principle mathematical modeling sub-module.