{"id":2920,"date":"2013-11-07T14:23:54","date_gmt":"2013-11-07T19:23:54","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=2920"},"modified":"2017-01-02T20:40:52","modified_gmt":"2017-01-03T01:40:52","slug":"hyperloop-model-architecture-we-want-your-feedback","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2013\/11\/07\/hyperloop-model-architecture-we-want-your-feedback\/","title":{"rendered":"Hyperloop Model Architecture: We want your feedback!"},"content":{"rendered":"<p>We had some fun in <a href=\"https:\/\/blogs.mathworks.com\/seth\/2013\/10\/30\/dont-engineer-hyperloop-in-a-vaccuum\/\">our last post about the Hyperloop open source transportation system<\/a>, but we didn't get much into the specifics. This week we begin to move things forward.<\/p>\r\n\r\n<p>Before beginning to analyze the feasibility of individual components, we decided to think about how we would architect a Simulink model to simulate the Hyperloop. In my opinion, such a model should include:<\/p>\r\n\r\n<ul>\r\n\t<li><strong>Componentization:<\/strong> It must be possible for a component to be used in isolation in test models, or as part of full system model<\/li>\r\n\t<li><strong>Variants:<\/strong> For each component, it must be easy to switch between different levels of fidelity or content.<\/li>\r\n\t<li><strong>Intuitive:<\/strong> If many engineers are going to participate in this project, it must be easy for them to understand the model.<\/li>\r\n<\/ul>\r\n\r\n<p>With that in mind, <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/4370178-matt-brauer \">Matt<\/a> and I (Guy) built tentative architectures which we describe today. If you have experience creating models for collaborative development involving multiple engineers, we would really like to hear what you think in the <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=2920&#comment\">comments<\/a>.<\/p>\r\n\r\n\r\n<p><strong>Matt: Systems Approach<\/strong><\/p>\r\n\r\n<p>I really liked the way the hyperloop proposal partitioned the different systems. So, I followed their lead in my model architecture. I put six systems at the top level. Where applicable, the controls for that specific system reside with its model. This choice makes componentization more straight forward. I like to put images on a mask for each system to make their content clear. <\/p>\r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/systemArchitecture_full.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/systemArchitecture.png\" alt=\"Top Level of Hyperloop model\" \/><br><em>click to enlarge<\/em><\/a><\/p>\r\n\r\n<p>Each of these systems contains a <a title=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/overview-of-model-referencing.html (link no longer works)\">referenced model<\/a>.  Those models become stand-alone environments for contributors to develop their own solutions for that system. Theoretically, these solutions could even depart from those put forth in the proposal. The developer is also free to utilize the modeling domain of their choice, be it Simulink, Simscape or integration of external tools.<\/p>\r\n\r\n<p>It is possible to integrate different combinations of solutions and see how they work together. Variant selection can be parameterized as shown in the Block Parameter dialog below. Here, the variable <tt>varComp<\/tt> determines the active variant for the Compressor system.\r\n<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/modelVariants.png\" alt=\"Model variants\" \/><\/p>\r\n\r\n<p>The valid combinations could be managed through configuration sets within the Variant Manager. In the example below, there is a configuration for a Simulink version of the hyperloop proposal, a Simscape version of the same and a third configuration that utilizes a more conventional solution with hub motors and an independent suspension.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/variantManager.png\" alt=\"Variant Manager\" \/><\/p>\r\n\r\n<p>Since the interfaces between my components use Simulink signals, any toolbox or third party tool can be used to design the components. We can leverage advanced physical modeling tools and all users can reap the benefits.<\/p>\r\n\r\n<p>From my perspective, the system-based hierarchy, combined with the images, makes an intuitive model. Using Model Reference means that there is a mechanism for variant control. Using Model Referencing with the right elements of the hierarchy provides the final ingredient; componentization. It\u2019s all there.<\/p>\r\n\r\n\r\n<p><strong>Guy: Plant-Controller<\/strong><\/p>\r\n\r\n<p>To begin, I decided to go with an architecture I see often in Model-Based Design projects: a plant and a controller.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/model_top_guy.png\" alt=\"Top Level of Hyperloop model\" \/><\/p>\r\n \r\n<p>If you look inside the plant, you can find a layer where I convert signals between the ideal continuous plant and the discrete fixed-step controllers.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/plant_level_1_small.png\" alt=\"Plant Top\" \/><\/p>\r\n\r\n<p>In the actual plant subsystem, you can see that I make intensive usage of our <a href=\"https:\/\/www.mathworks.com\/solutions\/physical-modeling.html\">physical modeling toolboxes<\/a>. I centered the design around one SimMechanics <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/sm\/ref\/solid.html\">Solid<\/a> block representing the center of mass of the capsule.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/plant_guy_small.png\" alt=\"Plant Model\" \/><\/p>\r\n\r\n<p>I also think we should use the <a href=\"https:\/\/www.mathworks.com\/products\/simscape\/\">Simscape<\/a> electrical and pneumatic domains to model interactions between components.<\/p>\r\n\r\n<p>To help identifying the data flow, I like to use a color code: green for Inports, red for Outports, blue for SimMechanics connections, etc...<\/p>\r\n\r\n<p>Each component is a Variant Subsystem containing multiple versions of the component, with different implementations. The variants are stored in separate <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/libraries.html\">library files<\/a>. By using a \"one file per variant\" approach, individual developers should be able to work in their own library file without modifying the rest of the model. This will also allow them to test their designs in smaller test models if needed.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/variants_guy.png\" alt=\"Plant Model\" \/><\/p>\r\n\r\n<p>With the central <a href=\"https:\/\/www.mathworks.com\/products\/simmechanics\/\">SimMechanics<\/a> connection, each component can connect to the capsule to get information about its dynamics and apply forces or constraints to it. For example, the simplest model of air drag could look like the following, where I use a <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/sm\/ref\/transformsensor.html\">Transform Sensor<\/a> to measure the capsule forward velocity and an <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/sm\/ref\/externalforceandtorque.html\">External Force and Torque<\/a> block to apply the drag.\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/example_drag.png\" alt=\"Simplest Possible Drag Model\" \/><\/p>\r\n\r\n<p>For convenience, I packaged all my files in a <a title=\"https:\/\/www.mathworks.com\/discovery\/simulink-projects.html (link no longer works)\">Simulink Project<\/a>. The <a title=\"https:\/\/www.mathworks.com\/help\/releases\/R2017a\/simulink\/ug\/automate-startup-tasks-with-shortcuts.html (link no longer works)\">startup script<\/a> automatically sets the path and creates necessary variables as you open the project. I also defined <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/ug\/create-shortcuts-to-frequent-tasks.html\">shortcuts<\/a> for common tasks, like opening the main model and plotting the final trajectory.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/sl_proj_guy.png\" alt=\"Simulink Project\" \/><\/p>\r\n\r\n<p><strong>Now it\u2019s your turn<\/strong><\/p>\r\n\r\n<p>As you can see, our architectures are very different. We would really like to hear what you think. Do you prefer one, or the other, or something completely different? Tell us why by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=2920&#comment\">comment here<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q3\/sl_proj_guy.png\" onError=\"this.style.display ='none';\" \/><\/div><p>We had some fun in our last post about the Hyperloop open source transportation system, but we didn't get much into the specifics. This week we begin to move things forward.\r\n\r\nBefore beginning to... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2013\/11\/07\/hyperloop-model-architecture-we-want-your-feedback\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[50,34,71,24,30,39],"tags":[348,349],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2920"}],"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\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=2920"}],"version-history":[{"count":65,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2920\/revisions"}],"predecessor-version":[{"id":6209,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2920\/revisions\/6209"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=2920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=2920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=2920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}