Skip to content

BatteryFault Module Documentation

Toolbox: RflySim PHM

BatteryFault Module Appearance

Introduction

One-sentence Description: This module integrates a lithium polymer (LiPo) battery simulation model with battery fault injection capabilities, enabling simulation of battery voltage and remaining capacity characteristics under both normal and faulty conditions.

This module belongs to the RflySim PHM (Prognostics and Health Management) toolchain, specifically developed for drone battery fault simulation and PHM algorithm validation scenarios. It incorporates an embedded LiPo battery model that, based on input motor load information, simulates variations in battery voltage, remaining capacity, and efficiency ratio under different operating conditions. Additionally, it supports injection of three common battery fault types: complete battery failure, low-voltage fault, and low-capacity (low-charge) fault, with customizable fault parameters.

This module is typically used in conjunction with the CopterSim drone flight control simulation framework and the RflySim3D visualization environment. It accepts motor PWM signals output by the PX4 flight controller and delivers the simulated battery state information to the flight controller or downstream fault diagnosis and health assessment algorithms. Typical application scenarios include drone battery fault injection simulation, PHM algorithm validation, and fault-tolerant control development.

Port Descriptions

Input Ports (Inputs)

Port Name Data Type Dimension Description
PWMIn double N×1 [To be confirmed] External input motor speed signal
BattHoverMinutes double 1×1 Hover time (standard hover time)
BattHoverThr double 1×1 Hover throttle value
uavMotNumbs int 1×1 Number of drone motors
FaultIn double M×1 [To be confirmed] Fault input bus containing fault type ID and corresponding fault parameters

Output Ports (Outputs)

Port Name Data Type Dimension Description
Battery Model Bus1 Bus 1×1 Output bus encapsulating PWM output, cell voltage (cell_voltage), and remaining capacity (remCapacity) information

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
isUseCustomHovTime boolean false true/false Whether to use custom hover time
CustomHovTime double 10 >0 Custom hover time, unit: minutes
PowOffFaultID int 123452 Any positive integer [To be confirmed] Unique identifier ID for battery failure fault
LowVoltageFaultID int 123453 Any positive integer [To be confirmed] Unique identifier ID for low-voltage fault
LowCapacityFaultID int 123454 Any positive integer [To be confirmed] Unique identifier ID for low-capacity (low-charge) fault

Parameter Configuration Notes

isUseCustomHovTime

When set to true, the module uses the custom hover time specified in the CustomHovTime parameter to compute battery capacity; when set to false, it uses the hover time provided via the input port BattHoverMinutes.

Fault ID Parameters

Each fault type corresponds to a fixed fault ID. By default, this module aligns with the RflySim PHM fault injection protocol: 123452 for battery failure fault, 123453 for low-voltage fault, and 123454 for low-capacity fault. If a custom fault injection protocol is used, these IDs can be modified accordingly. Note that battery failure fault carries no additional parameters, low-voltage fault carries one remaining voltage ratio parameter, and low-capacity fault carries one remaining capacity ratio parameter.

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
BatteryModel Basic lithium polymer battery simulation model for simulating battery voltage and remaining capacity characteristics
FaultParamsExtract Extracts fault identifiers and parameter values for specified faults from the fault input bus
PropellerFault Propeller fault injection module supporting faults such as propeller jamming and efficiency loss
ActuatorFault Actuator (servo/motor) fault injection module supporting faults such as bias, stiction, and efficiency loss

Notes and Frequently Asked Questions

  • Initialization Order: This module relies on the RflySim底层 PHM fault framework for fault injection initialization. The FaultIn port of the BatteryFault module must be connected to the output of the top-level fault management module before simulation starts. Disconnecting the FaultIn port directly will cause fault parameters to fail parsing correctly, resulting in abnormal output.

  • Sample Time Matching: Battery capacity and voltage calculations in this module rely on time-difference integration. Therefore, the module’s sample time must match the PWM input signal’s sample time from the flight controller. Mismatched sample times lead to significant errors in endurance estimation and offset in fault trigger timing.

  • Fault Parameter Format: The fault ID and parameters in the FaultIn bus must conform to the PHM framework’s agreed format. Battery failure fault carries no additional parameters; low-voltage and low-capacity faults each require one corresponding ratio parameter. Incorrect parameter formats prevent the module from correctly identifying fault types, thus no corresponding fault effects will be triggered.

  • Ratio Parameter Range: The valid range for remaining voltage ratio (remainVoltageRatio) and remaining capacity ratio (remainCapacityRatio) is (0, 1]. Passing 0 or negative values causes abnormal battery output voltage, potentially leading to divergence and crash of the drone simulation model. Setting the ratio to 1 produces no fault effect.

  • Multi-Motor Configuration: The input motor count parameter must match the actual number of motors on the current multi-rotor drone. Mismatches cause errors in total discharge current calculation, resulting in remaining capacity decay rates inconsistent with real-world behavior.

  • Custom Hover Time: After enabling isUseCustomHovTime, the module uses the provided CustomHovTime as the baseline for endurance calculation, ignoring the internal standard hover time parameter. Ensure the custom hover time aligns with the actual specifications of the battery being used; otherwise, systematic errors will occur in capacity calculations.

Changelog

  • v4.10 (2024-07-24): Initial release, supporting injection and parameter parsing of three battery fault types: battery failure, low voltage, and low battery level; integrates simulation functions for lithium polymer battery voltage, remaining capacity, and efficiency ratio.