How to find the check sum of the model currently built on a target computer?

2 次查看(过去 30 天)
I am working on creating an app that will run a desired Simulink model on a target computer. The target computer controls a number of devices used for some experiments we do. The purpose of this app is to enable people unfamiliar with the Simulink model's structure to alter certain parameters as well as run the model on the target computer.
I would like the app to check whether the target computer already has the model built, and build it if the model is not already built. Something along the lines of:
if app.CntrlMdl == 'Model on the Target PC'
%Do nothing as the app is ready to run
else
slbuild(app.CntrlMdl);
end
app.CntrlMdl is just the name of the model used for controlling the target computer.
The problem is that I don't know how to actually check whether the models are the same. I've found that trying to connect the simulink model to the target PC when the models are different produces the following error:
"The model that you are trying to run in External mode does not match the application running on your target. Checksum test (OPEN_PROTOTCOL) failed. The host model's structural checksum is (a 4×1 uint32 column vector) and the target application's strucural checksum is (a different 4×1 uint32 column vector). Rebuild the model, run it onn your target, and start External mode simulation again."
This error message gave me the idea of comparing the checksum's of the two models. I found a way to get the checksum of the model on the host computer (Simulink.BlockDiagram.getChecksum).
How do I get the checksum of the model on the target computer?
Building the model creates a target object, could that be used?
If you know another way to compare the two models, I'm not picky.
Thank you!
  2 个评论
Liam Vanderschaaf
Forgot to mention this in the original post, but a try/catch system does not catch the error for some reason.
Jon Lobo
Jon Lobo 2022-12-19
Hi Liam,
I'm assuming you are using Simulink Real-Time and there is a checksum mismatch between real-time application on the target and model on the host. Can you tell me which release you are using?
I'm assuming the app you are designing opens the Simulink model for your user and connects/starts the real-time application for them? Is that correct?
-Jon

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by