System Composer Version Compare of Architectures containing referenced models

8 visualizaciones (últimos 30 días)
Hello together,
we are using System Composer for our architectural description of our system. For better colaboration we divided our architecture in several components which are integrated as referenced models in the top model. All our models are organized in a Matlab Project and under version control in git.
When I want to compare two versions for, e.g. a review and want highlight all the changes in the top level architecture (including the changes in the reference models) I investigated a big issue in this comparison feature.
As far as I understood the compare is only done for the file I am comparing (e.g., the top level architecture file). When I've changes within the referenced models it will not be displayed as both versions uses the same (most actual) version of the referenced models.
My questions are now:
  • Am I doing something wrong that I get this behavior?
  • If not, is there a solution to efficiently compare a complete architecture (including all model references within the model)?
  • If this is not possible in Release 2024b would there be a future release which supports this compare functionality?
Thanks a lot for your answers.
Best regards
Matthias

Respuestas (1)

Nithin
Nithin el 25 de Feb. de 2025
When comparing files, it is expected that the "System Composer Comparision Tool" doesn’t compare the referenced models, especially when dealing with hierarchical models. The comparison is indeed usually done at the file level, which means if you are comparing the top-level architecture file, it will not automatically include changes in the referenced models unless those models are explicitly compared.
One workaround would be to write a custom MATLAB script that recursively compares each referenced model along with the top-level model. This script can use the "visdiff" function to automate the comparison process across multiple files.
Kindly refer following code snippets for understanding.
% Get the previous version from Git
[status, previousVersion] = system(['git show HEAD~1:', modelFile]);
% Save the previous version to a temporary file
tempFile = [tempname, '.slx'];
fid = fopen(tempFile, 'w');
fwrite(fid, previousVersion);
fclose(fid);
"visdiff" funciton opens the "Comparison Tool" and displays the differences between the two files.
% Compare the current model file with the previous version
visdiff(tempFile, modelFile);
Find all the connected models which are references and compare them recursively
% Load the current model to find referenced models
load_system(modelFile);
referencedModels = find_system(modelFile, 'LookUnderMasks', 'all', 'BlockType', 'ModelReference');
% Recursively compare each referenced model
for j = 1:length(referencedModels)
refModelFile = get_param(referencedModels{j}, 'ModelName');
compareModelRecursively([refModelFile, '.slx'], comparedModels); % Recursive function call
end
Kindly refer following documentations for more information about the functions used:
Hope this resolves your issue.

Categorías

Más información sobre System Composer en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by