{"id":19,"date":"2008-06-19T16:18:44","date_gmt":"2008-06-19T21:18:44","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/2008\/06\/19\/whats-in-your-model\/"},"modified":"2016-12-20T17:03:58","modified_gmt":"2016-12-20T22:03:58","slug":"whats-in-your-model","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2008\/06\/19\/whats-in-your-model\/","title":{"rendered":"What&#8217;s in your model?"},"content":{"rendered":"<p>This morning I was telling my colleague Rob about the blog\r\npost I was writing on sample time colors.  We talked about models that\r\ndemonstrated the concept, and he dove into his computer to find an example he\r\nhad made a couple years ago.  I liked the model, so I asked him if he would\r\nsend it to me, but here was a problem.  The model was in a directory with about\r\n50 other M-files, MAT-files and MDL files.  How would Rob know which files to\r\nsend me?  Without much thought, Rob was able to identify the two files I would\r\nneed to run that model.  <em>How did he do it?<\/em><\/p>\r\n\r\n<p><strong>Model Dependencies<\/strong><\/p>\r\n\r\n<p>A Simulink model is rarely just a single file.  Simulink\r\nmodels often depend on the entire MATLAB environment to run.  Most models rely\r\non many more files run correctly. You may need MAT-files, M-files, reference\r\nmodels, S-functions, and C code to recreate the working environment. I have\r\nsuffered through this repeatedly when working with models sent in to technical support. \r\nMany times, the models are missing just a couple files. We discover which file\r\nis missing and request it, only to find out there are additional dependencies.\r\nMost engineers have experienced this on some kind of development project and\r\nthen resolve to keep their work more organized.<\/p>\r\n\r\n<p><strong>Model Manifest Tools<\/strong><\/p>\r\n\r\n<p>My colleague quickly identified his model dependencies using\r\nthe model manifest tools in Simulink.  In R2007a the model manifest tools were\r\nadded.  They provide a short cut method for analyzing your model to identify\r\nits dependencies, and then make it simple to package those files into a ZIP\r\nfile.  Take for example, this Lunar_Mission\r\nmodel (download) from the 2007\r\nSimulink World Tour.<\/p>\r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/lunar_mission_small.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/lunar_mission_small.png\" alt=\"Lunar mission model\" border=\"0\"><\/a><br>\r\n(Click <a\r\nhref=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/Lunar_Mission_slwebview.html\"\r\ntarget=\"_blank\">here for Simulink WebView<\/a>)<\/p>\r\n\r\n<p>If I wanted to upload this to the File Exchange and share\r\nthis with the Simulink Community, how would I do that?  The documentation\r\non model dependencies goes over this process step-by-step. Access the <em>Tools-&gt;Model\r\nDependencies-&gt;Generate Manifest\u2026<\/em> menu to generate the XML manifest file.\r\nThe dialog presents you with some options to control the scope of your search\r\nfor dependencies. I started by unchecking the items I did not want to include\r\nin the initial Simulink Manifest File (.smf).<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/generate_manifest_dialog.png\" alt=\"Generate model manifest dialog\"><\/p>\r\n\r\n<p>When you click Okay, it begins analyzing your model and\r\nproduces an HTML report. Here is a snapshot of the output from the\r\nLunar_Mission model.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/manifest_report.png\" alt=\"Lunar Mission manifest report image\"><br>\r\n(<a\r\nhref=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/Lunar_Mission_manifest_report.html\" target=\"_blank\">Click\r\nhere for the full dependency report<\/a>, links in the report won\u2019t work)<\/p>\r\n\r\n<p>The final step to allow me to share this is to export the\r\nfiles in the manifest. I can package these files up in a ZIP file with just a\r\ncouple clicks. This is another menu found at <em>Tools-&gt;Model\r\nDependencies-&gt;Export Files in Manifest\u2026<\/em><\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q2\/export_manifest.png\" alt=\"Export manifest to a zip file\"><\/p>\r\n\r\n<p>Maintaining a manifest for your Simulink project is\r\nextremely helpful. This enhances collaboration between people working on the\r\nsame project. A manifest can also be included in a configuration management\r\nsystem as a way to record all the files needed to run.<\/p>\r\n\r\n<p><strong>Now it\u2019s your turn<\/strong><\/p>\r\n\r\n<p>Do you collaborate in Simulink?  How do you keep your models\r\norganized?  Are there any naming conventions that help you?  Post a <a\r\nhref=\"https:\/\/blogs.mathworks.com\/seth\/?p=19&amp;#comment\">comment here<\/a> and\r\ntell me about it.<\/p>","protected":false},"excerpt":{"rendered":"<p>This morning I was telling my colleague Rob about the blog\r\npost I was writing on sample time colors.  We talked about models that\r\ndemonstrated the concept, and he dove into his computer to find an... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2008\/06\/19\/whats-in-your-model\/\">read more >><\/a><\/p>","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[33],"tags":[41,441],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":6122,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/19\/revisions\/6122"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}