{"id":7146,"date":"2018-02-13T17:21:00","date_gmt":"2018-02-13T22:21:00","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=7146"},"modified":"2018-11-07T12:36:15","modified_gmt":"2018-11-07T17:36:15","slug":"simulating-the-olympic-ski-jump-competition","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2018\/02\/13\/simulating-the-olympic-ski-jump-competition\/","title":{"rendered":"Simulating the Olympic Ski Jump Competition"},"content":{"rendered":"<p>This week I am happy to welcome guest blogger <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/3261408-zack-peters\">Zack Peters<\/a> to describe how he implemented the simulation of a ski jump, similar to the <a href=\"https:\/\/www.olympic.org\/pyeongchang-2018\/results\/en\/ski-jumping\/event-schedule-men-s-large-hill-individual.htm\">Men's large Hill Individual<\/a> event of the <a href=\"https:\/\/www.olympic.org\/\">PyeongChang Winter Olympics<\/a> starting this Friday.<\/p>\n<p><strong>Introduction<\/strong><\/p>\n<p>In case you are not familiar with the Olympic Ski Jump competition, let's start with a video explaining what it involves:<\/p>\n<p><iframe loading=\"lazy\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/6gETvy0clLA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>In order to maintain consistency and safety for the jumpers, there are a set of thorough standards written by the <a href=\"http:\/\/www.fis-ski.com\/\">International Ski Federation (FIS)<\/a> regarding the shape\/profile of the ski jump ramp. Here is a picture taken from the <a href=\"https:\/\/res.cloudinary.com\/fis-production\/image\/upload\/v1536927748\/fis-prod\/assets\/Standards_for_the_Construction_of_Jumping_Hills.pdf\">Standards for the Constructions of Jumping Hills<\/a> document showing all the specifications of the ramp (typically called <strong>In-run<\/strong>) and landing area. In this document, you can find all the numbers and equations defining the shape shown in this picture:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/slopeSpecs.png\" alt=\"Specifications of the ski jump ramp and landing area\" \/><\/p>\n<p><strong>The Implementation<\/strong><\/p>\n<p>As you can imagine, this system could be modeled in many ways. One option would have been to use a conditionally enabled subsystem for each phase of the jump, in a way similar to how we <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2016\/08\/19\/olympic-2016-pole-vault\">simulated the pole vault competition in the previous summer olympics<\/a>. Another option would have been to use the new Simulink States inside Stateflow, like we used to <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2017\/10\/16\/simulink-subsystems-as-stateflow-states\">simulate a box jumping on a table<\/a> a few months ago.<\/p>\n<p>For this post, I decided to implement the ski jump dynamics using the Simscape language. I thought it would be a good application to utilize some of the new features available in R2017b like <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/simscape\/lang\/mode-chart-modeling.html\">modecharts<\/a> and and <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/simscape\/lang\/simscape-functions.html\">Simscape Functions<\/a><\/p>\n<p><strong>Some Symbolic Pre-Work<\/strong><\/p>\n<p>First, let's draw the free body diagram of a body moving along the In-run:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/freeBodyDiagram.png\" alt=\"Free Body Diagram\" \/><\/p>\n<p>As mentioned above, the FIS standard gives a great description of the hill profile (a relationship in the form y=f(x)). From there I need the slope (<tt>theta<\/tt>) and the radius of curvature (<tt>R<\/tt>) to compute the normal force (<tt>Fn<\/tt>). This can be obtained by differentiating the hill profile twice. To help with that, I used the <a href=\"https:\/\/www.mathworks.com\/products\/symbolic.html\">Symbolic Math Toolbox<\/a>. In case you were not aware, the Symbolic Math Toolbox is now well integrated into the MATLAB Desktop through the <a title=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/what-is-a-live-script.html (link no longer works)\">MATLAB live script<\/a> technology.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/symbolicSlope.png\" alt=\"Slope derivations using Symbolic Math Toolbox\" \/><\/p>\n<p>To bring the final result into Simscape language, I used the <a href=\"https:\/\/www.mathworks.com\/help\/symbolic\/simscapeequation.html\">simscapeEquation<\/a> function, also from the Symbolic Math Toolbox.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/simscapeSlope.png\" alt=\"Using simscapeEquation\" \/><\/p>\n<p><strong>Modechart<\/strong><\/p>\n<p>In my Simscape component, I defined a modechart with 3 modes: In-run, airborne and landing:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/modechartJump.png\" alt=\"modechart\" \/><\/p>\n<p>and I defined the conditions at which the system switches from one mode to the next:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/transitionJump.png\" alt=\"transitions\" \/><\/p>\n<p><strong>Simscape Functions<\/strong><\/p>\n<p>When looking at the above code, you might wonder what are those functions like \"jumpPkg.jump.slope\" and other similar. Those are <a href=\"https:\/\/www.mathworks.com\/help\/physmod\/simscape\/lang\/simscape-functions.html\">Simscape Functions<\/a>, introduced in R2017b.<\/p>\n<p>These allow for improved readability of the component and reuse of utility components. I packaged these up in a directory structure that would break up separate equations for the In-run and the landing area, allowing me to give the equations the same name, but a different path. Here is what my package looks like:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/packageJump.png\" alt=\"My Package\" \/><\/p>\n<p>Inside those functions, I used the equations derived using the Symbolic Math Toolbox. Here is an example for the slope of the In-run.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/slopeFcn.png\" alt=\"Slope Simscape Function\" \/><\/p>\n<p>As you can see, the In-run has 3 separate sections implemented using an If\/Else statement in the Simscape Function.<\/p>\n<p>Here is an animation of the simulation results:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/skiJump.gif\" alt=\"Ski Jump Animation\" \/><\/p>\n<p><strong>Now it's your turn<\/strong><\/p>\n<p>Anybody interested in adding more fidelity to our jumper model? Are there other Olympic sports you would be interested to simulate? Let us know in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2018Q1\/skiJump.gif\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>This week I am happy to welcome guest blogger Zack Peters to describe how he implemented the simulation of a ski jump, similar to the Men's large Hill Individual event of the PyeongChang Winter... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2018\/02\/13\/simulating-the-olympic-ski-jump-competition\/\">read more >><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[71,39,16],"tags":[479,105,522],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7146"}],"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=7146"}],"version-history":[{"count":30,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7146\/revisions"}],"predecessor-version":[{"id":8256,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/7146\/revisions\/8256"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=7146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=7146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=7146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}