Connect to Model-Based Design
R2026bAfter 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:
Link behavior models to architecture components.
Verify that component interfaces match the architecture port definitions.
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:
Open the architecture model,
BMSAlgorithmArchitecture.slx.Right-click a component and select Link to Model.
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:
| Component | Behavior Model | Algorithms | Data Dictionary |
|---|---|---|---|
StateMachine | StateMachine.slx (Stateflow) |
| StateMachineData.sldd |
CellMonitoringAndBalancing | CellMonitoringAndBalancing.slx (Simulink) |
| CellMonitoringAndBalancingData.sldd |
SystemControlAndProtection | SystemControlAndProtection.slx (Simulink) |
| 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 scriptsDoc/BMSStateMachine.m— Operating states and charge managementDoc/BMSCellMonitoringAndBalancing.m— SOC estimation and balancingDoc/BMSSystemControlAndProtection.m— Fault detection and current limitsDoc/BMSPlantModel.m— Plant model and battery pack variants
See Also
Topics
- What Is a Data Dictionary?
- Battery Modeling Workflow (Simscape Battery)
- Compose and Analyze Systems Using Architecture Models (System Composer)