주요 콘텐츠

Connect to Model-Based Design

R2026b

After developing the high-level architecture in System Composer™, you can link algorithmic behavior to each component of the architecture model. You can define behavior by linking Simulink®, Simscape™, or Stateflow® models. For more information, see Describe Component Behaviors (System Composer).

In this section, you:

  1. Link behavior models to architecture components.

  2. Verify that component interfaces match the architecture port definitions.

  3. Explore the controller and plant component algorithms.

Tip

Open Doc/BMSAlgorithms.m in the project for an interactive exploration of the algorithm of each component.

Link Behavior Models to Architecture Components

To connect a behavior model to an architecture component:

  1. Open the architecture model, BMSAlgorithmArchitecture.slx.

  2. Right-click a component and select Link to Model.

  3. Select the Simulink model that implements the component behavior.

When you link a component to a behavior model, the component inherits the interface definitions through buses. The component ports update to reflect the bus elements defined in the linked model. For more information, see Transmit Signal Data Between Components Linked to Behavior Models (System Composer).

Repeat for each component in the architecture.

BMS Controller Components

The BMS controller, BMSAlgorithmArchitecture.slx, contains three components linked to behavior models:

ComponentBehavior ModelAlgorithmsData Dictionary
StateMachineStateMachine.slx (Stateflow)
  • Supervisory state machine with four operating states (Standby, Driving, Charging, Fault).

  • Manages state transitions and charge control (constant-current mode followed by constant-voltage mode).

StateMachineData.sldd
CellMonitoringAndBalancingCellMonitoringAndBalancing.slx (Simulink)
  • SOC estimation using Coulomb Counting and Extended Kalman Filter.

  • Passive cell balancing using bleed resistors to equalize cell voltages.

CellMonitoringAndBalancingData.sldd
SystemControlAndProtectionSystemControlAndProtection.slx (Simulink)
  • Fault detection with configurable thresholds for voltage, temperature, and current.

  • Contactor management for pre-charge circuit control.

  • Current and power limit calculation using temperature-based derating curves.

SystemControlAndProtectionData.sldd

Each component is a referenced model, enabling independent development, testing, and code generation.

To test the BMS controller, see the Verify and Validate System step of this example, which uses a test harness model, BMSAlgorithmArchitectureHarness.slx. The harness isolates the controller from the plant model so that you can set input signals directly and validate individual algorithms before running closed-loop simulations.

BMS Plant Components

The BMS plant, BatteryPackElectrical.slx, implements the electrical system that the BMS controller monitors and protects. The BatteryModel component of the BMSSystemArchitecture model uses BatteryModel.slx (Simscape) with design data stored in BatteryData.sldd.

The model includes the battery pack with cell monitoring, pre-charge circuit, charger, and drive load. The model supports three fidelity variants (Lumped, Grouped, Detailed). To switch between battery pack fidelity levels, change the value of BattModelResolution in the battery data dictionary (BatteryData.sldd) to 0 for Lumped, 1 for Grouped, or 2 for Detailed. For more information about battery pack fidelity levels, see Define Model Resolution (Simscape Battery).

Interactive Walkthrough

For detailed algorithm exploration, open the live scripts in Doc/:

  • Doc/BMSAlgorithms.m — Overview and links to all three component scripts

  • Doc/BMSStateMachine.m — Operating states and charge management

  • Doc/BMSCellMonitoringAndBalancing.m — SOC estimation and balancing

  • Doc/BMSSystemControlAndProtection.m — Fault detection and current limits

  • Doc/BMSPlantModel.m — Plant model and battery pack variants

See Also

Topics