Manage Designs Using Source Control
Projects can help you work with configuration management tools for team collaboration. You can use projects to help you manage all the models and associated files for model-based design.
You can control and trace the changes in each component using project source control. Using source control directly from a project provides these benefits:
Engineers do not have to remember to use two separate tools, avoiding the common mistake of beginning work in Simulink® without checking out the required files first.
You can perform analysis within MATLAB® and Simulink to determine the dependencies of files upon each other. Third-party tools are unlikely to understand such dependencies.
You can compare revisions and use tools to merge models.
If each component is a single file, you can achieve efficient parallel development, where different engineers can work on the different components of a larger system in parallel. Using model components allows you to avoid or minimize time-consuming merging. One file per component is not strictly necessary to perform configuration management, but it makes parallel development much easier.
If you break down a model into components, it is easier to reuse those components in different projects. If the components are kept under revision control and configuration management, then you can reuse components in multiple projects simultaneously.
To find out about source control support, see Source Control in Projects.
Determine the Files Used by a Component
You can use a project to determine the set of files you must place under
configuration management. You can analyze the set of files that are required for the
model to run, such as model references, library links, block and model callbacks
init functions, etc.),
S-functions, From Workspace blocks, etc. Any MATLAB code found is also analyzed to determine additional file dependencies.
You can use the Dependency Analyzer to report which toolboxes are required by a
model, which can be a useful artifact to store.
You can also perform a file dependency analysis of a model programmatically from
dependencies.fileDependencyAnalysis to get
a cell array of paths to required files.
For more information, see Dependency Analysis.
Manage Model Versions
Simulink can help you to manage multiple versions of a model.
Use a project to manage your project files, connect to source control, review modified files, and compare revisions. See Project Management.
Simulink notifies you if a model has changed on disk when updating, simulating, editing, or saving the model. Models can change on disk, for example, with source control operations and multiple users. Control this notification with the Model File Change Notification preference. See Model File Change Notification.
As you edit a model, Simulink generates version information about the model, including a version number, who created and last updated the model, and an optional comments history log. Simulink saves these version properties with the model.
Use the Model Properties dialog box to view and edit some of the version information stored in the model and specify history logging.
The Model Info block lets you display version information as an annotation block in a model diagram.
Simulink.MDLInfoto extract information from a model file without loading the block diagram into memory. You can use
MDLInfoto query model version and Simulink version, find the names of referenced models without loading the model into memory, and attach arbitrary metadata to your model file.
You can use a project to work with the revision control parts of the workflow: retrieving files, adding files to source control, checking out files, and committing edited files to source control.
To define configurations of files, you can label several files as a new mutually consistent configuration. Team members can get this set of files from the revision control system.
Configurations are different from revisions. Individual components can have revisions that work together only in particular configurations.
Tools for creating configurations in Simulink:
Variant modeling. See Variant Systems.
Label — Label project files. Use labels to apply metadata to files. You can group and sort by labels, label folders for adding to the path using shortcut functions, or create batch jobs to export files by label, for example, to manage files with the label
Diesel. You cannot retrieve from source control by label, and labels persist across revisions.
Revision Log — Use Revert Project to choose a revision to revert to (SVN source control only).
Branch — Create branches of file versions, and switch to any branch in the repository (Git source control only).
Tag — You can tag all project files (SVN source control only) to identify a particular configuration of a project, and retrieve tagged versions from source control. However, continued development is limited. That is, you cannot tag again, and you must check out from
trunkto apply tags.
Archive — Package all project files in a zip file that you can create a project from. However, this packaging removes all source control information, because archiving is for exporting, sharing, and changing to another source control. You can commit the new zip file to source control.