{"id":29,"date":"2008-09-07T00:00:58","date_gmt":"2008-09-07T05:00:58","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/2008\/09\/07\/continuous-time-integrator\/"},"modified":"2017-01-04T13:49:20","modified_gmt":"2017-01-04T18:49:20","slug":"continuous-time-integrator","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2008\/09\/07\/continuous-time-integrator\/","title":{"rendered":"Continuous Time Integrator"},"content":{"rendered":"<p>One of the ways I think of Simulink is as a graphical\r\ninterface to the solvers.\u00a0 Moreover, when I think of the solvers, I usually\r\nthink of the continuous time solvers and the integrator block.\u00a0 In this post, I\r\nwill show you some of the capabilities of the continuous time integrator that\r\nyou might not know about.\u00a0 I will also demonstrate how I keep track of the\r\nports on the integrator block.<\/p>\r\n\r\n<p><strong>The Continuous State<\/strong><\/p>\r\n\r\n<p>The continuous time Integrator block is the building block\r\nfor ODEs\/continuous time systems.\u00a0 Labeing the input and output of the\r\nIntegrator block keeps my signals organized when <a\r\nhref=\"https:\/\/blogs.mathworks.com\/seth\/2008\/05\/23\/how-to-draw-odes-in-simulink\/\">drawing\r\nODEs<\/a>.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator1.png\" alt=\"The Integrator block\"><\/p>\r\n\r\n<p>Labeling the signals is also beneficial when adding reset,\r\ninitial condition, saturation, and state ports to the block.<\/p>\r\n\r\n<p><strong>External Reset<\/strong><\/p>\r\n\r\n<p>The <em>External reset<\/em> signal (second inport) triggers the\r\nintegrator state to reset to the initial condition value.\u00a0 External reset can\r\nbe set to <a\r\nhref=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/integrator.html#f7-1513475\">rising,\r\nfalling, either edge, level or level hold<\/a>.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator2_reset.png\" alt=\"Integrator block with rising edge reset\"><\/p>\r\n\r\n<p>The internal initial condition is not always the right value\r\nat the time the state resets.\u00a0 Often, the new state value comes from a\r\ncalculation in the model via the IC port. <\/p>\r\n\r\n<p><strong>External Initial Condition<\/strong><\/p>\r\n\r\n<p>Set the <em>Initial condition source<\/em> as external to\r\nprovide the IC value via signal.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator3_ic.png\" alt=\"Integrator block with external initial condition\"><\/p>\r\n\r\n<p>This state (x) is set to this signal value when the reset\r\nsignal triggers.\u00a0 To provide an initial condition at time Tstart, add an <a\r\nhref=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/ic.html\">IC\r\nblock<\/a> (from the Signal Attributes library) inline with the signal that\r\ncalculates the IC.<\/p>\r\n\r\n<p><strong>Limit Output (state saturation)<\/strong><\/p>\r\n\r\n<p>The <em>Limit output<\/em> check box enables the <em>Upper\r\nsaturation limit<\/em> and <em>Lower saturation limit<\/em> parameters.\u00a0 This also\r\nadds the saturation icon to the block.\u00a0 Note, it is easy to mistake this as an\r\nintegral signal, however, this actually indicates that the state has an upper\r\nand\/or lower limit.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator4_saturation.png\" alt=\"Integrator block with limited output\"><\/p>\r\n\r\n<p><strong>Saturation Port<\/strong><\/p>\r\n\r\n<p>Check the <em>Show saturation port<\/em> parameter to add a\r\nsecond output, the saturation port.\u00a0 The signal from this port is 0 when the\r\nvalue of the state is within the limits, and 1 when the value of the state is\r\nat the limit.\u00a0 This transition from 0 to 1 and 1 to 0 can be used as rising and\r\nfalling edges triggers.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator5_satPort.png\" alt=\"Integrator block with staturation port\"><\/p>\r\n\r\n<p><strong>State port<\/strong><\/p>\r\n\r\n<p>Clicking <em>Show state port<\/em> adds a special port on the\r\ntop of the block.\u00a0 The state port provides a way to model self-resetting integrators\r\nand performing state hand off between enabled subsystems without creating\r\nalgebraic loops.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/integrator6_statePort.png\" alt=\"Integrator with state port\"><\/p>\r\n\r\n<p><strong>Bouncing Ball Demo<\/strong><\/p>\r\n\r\n<p>The bouncing ball demo combines some of these integrator\r\nblock capabilities.<\/p>\r\n\r\n<p><a target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/sldemo_bounce.png\" alt=\"Simulink bouncing ball model\" border=\"0\"><\/a><\/p>\r\n\r\n<p>Click on this image for a web view of the sldemo_bounce model.<\/p>\r\n\r\n<p>Note the use of the IC block to provide an Initial Velocity\r\nand Initial Position for the bouncing ball.\u00a0 The IC block feeds through its\r\ninput when T&#8800;Tstart.\u00a0 This allows the ball to reset the velocity state\r\n(V) to -0.8 * V when the position of the ball hits zero.\u00a0 This use of the state\r\nport prevents the algebraic loop connecting the velocity state to the initial\r\nstate value and reset signals.\u00a0 Here are the simulation results.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2008Q4\/sldemo_bounceScope.png\" alt=\"Bouncing ball demo scope\"><\/p>\r\n\r\n<p><strong>Now it\u2019s your turn<\/strong><\/p>\r\n\r\n<p>I got into the habit of labeling the ports on the integrator\r\nwhile I was a trainer teaching Simulink.\u00a0 It was always helpful in keeping the\r\nmodel organized.\u00a0 Have you used these features of the Integrator block?\u00a0 What\r\ndid your model do?\u00a0 Leave me a <a\r\nhref=\"https:\/\/blogs.mathworks.com\/seth\/?p=29&amp;#comment\">comment here<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>One of the ways I think of Simulink is as a graphical\r\ninterface to the solvers.\u00a0 Moreover, when I think of the solvers, I usually\r\nthink of the continuous time solvers and the integrator block.\u00a0 In... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2008\/09\/07\/continuous-time-integrator\/\">read more >><\/a><\/p>","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[30,29],"tags":[49,446,441],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/29"}],"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=29"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":6223,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/29\/revisions\/6223"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}