主要内容

Set Up File Management System

R2026b

Use a MATLAB® project to manage files for the battery management system. A project streamlines file sharing across teams, handles dependencies within and across developer groups, integrates with source control, and enables componentization and reuse of design files.

In this section, you:

  1. Create a project.

  2. Set up the file structure.

  3. Add files to the project path.

  4. Create shortcuts to frequently used files.

  5. Check project integrity.

  6. Set up source control.

Create a Project

Create a project to organize all BMS design files in a single location. On the MATLAB Home tab, click New > Project > From Folder. Select the root folder that contains your BMS design files.

Create a project from a folder in MATLAB.

The project file BatteryManagementSystem.prj stores project metadata, including the file structure, path settings, shortcuts, and source control configuration.

Set Up the File Structure

Organize the project into folders that separate design concerns. This structure enables independent development, testing, and code generation for each component.

Folder

Purpose

Key Files

Design/Controller/

BMS controller algorithm models

BMS.slx, StateMachine.slx, CellMonitoringAndBalancing.slx, and SystemControlAndProtection.slx

Design/Plant/

Battery plant model and its subsystems

BatteryModel.slx, Charger.slx, DriveLoad.slx, and PreChargerCircuit.slx

Design/Dictionaries/

Data dictionaries, enumeration types, and shared configuration

17 .sldd files and 3 enumeration .m files

Design/DesignBatteryPack/

Battery pack design script and component libraries

BatteryPackDesignScript.m and fidelity variants (Detailed, Grouped, Lumped)

FunctionalityAndArchitecture/

Architecture models

BMSSystemArchitecture.slx and BMSAlgorithmArchitecture.slx

Requirements/

System requirements

BMSSwRequirements.xlsx and BMSSwRequirements.slreqx

Scripts/

Startup and utility scripts

BatteryManagementSystemStartup.m and excelHierarchyImport.m

SystemIntegrationAndTest/Tests/

Test harnesses, test data, and test files

BMSHarness.slx, BMSAlgorithmArchitectureHarness.slx, and StateMachineHarness.slx

Doc/

In-project live script (.m) documentation

Live scripts covering overview, architecture, algorithms, and verification

This folder structure separates the controller algorithms from the plant model, keeps data dictionaries and interface definitions together, and isolates test artifacts from production design files.

Add Files to the Project Path

Add folders to the project path so that models, scripts, and functions in those folders are available when you open the project.

  1. On the Project tab, click Project Path.

  2. Add these folders to the project path:

    • Design/Controller

    • Design/Plant

    • Design/Dictionaries

    • Design/DesignBatteryPack

    • FunctionalityAndArchitecture

    • Scripts

Project path settings showing folders added to the MATLAB path.

When you open the project, MATLAB adds these folders to the search path. When you close the project, MATLAB removes them. This behavior prevents path conflicts with other projects.

Create Shortcuts

Create shortcuts to files you frequently open or run. Shortcuts appear in the Shortcuts section of the Projects tab and provide one-click access to key entry points.

Project shortcuts gallery on the toolstrip.

To create a shortcut, right-click a file in the project and select Create Shortcut.

BMS project shortcuts configured for key entry points.

Check Project Integrity

Run integrity checks to identify missing files, broken dependencies, or other issues.

  1. On the Project tab, click Project Issues.

  2. Review the results in the Project Issues pane.

  3. Resolve any issues, such as files on the project path that are not in the project or files that reference dependencies outside the project.

Project integrity check results showing all checks passed.

Use the Dependency Analyzer to visualize how files in the project depend on each other. On the Project tab, click Dependency Analyzer to generate the graph.

Set Up Source Control

Connect the project to a source control system to track changes, manage branches, and collaborate with other team members.

  1. On the Project tab, click Use Source Control.

    The Project pane open on the left with the context menu on the right. A red rectangle is highlighting the Source Control option in the context menu.

  2. Select your source control system (for example, Git™).

  3. Configure the repository location and commit the project files.

Source control integration enables you to:

  • Compare file versions and view change history.

  • Merge changes from multiple contributors.

  • Tag releases and manage branches for parallel development.

See Also

Topics