MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
  Register to watch video
  • Description
  • Full Transcript
  • Related Resources

How to Combine Modeling Styles with Schedulable Components in Simulink

From the series: Run-Time Software Modeling

Teresa Hubscher-Younger, MathWorks

With Schedulable Components, all types of modeling styles can be partitioned and scheduled, which means conversion to a different modeling style is not needed and different modeling styles can be combined. Rate-based modeling styles can be directly partitioned and scheduled with Export Functions using this feature, allowing you to interleave the triggering of different components at different times. This helps you combine different components into larger systems.

Schedulable components allow you to take two very different modeling styles, rate-based modeling and export function modeling, combine these, and schedule them in the same model, helping you save time by catching problems early when you combine different components.

This modeling style gives you two big benefits. This gives you full control over scheduling model components, rather than letting Simulink schedule the components. And there is no need to deal with data dependency issues between components, because there are only data transfers.

Let me show you an example motivating the need for schedulable components. In this model, we have two different modeling styles. At the top level, we have Simulated Pedal Input, going into a Throttle Sensors and Monitor model block. The sensors data is going to the Throttle Position Controller and Actuator model block. This system is then being simulated by a model of the Throttle Body acting as the plant. Inside the Throttle Position Controller and Actuator model block, there are two Export Function components – one for the Controller and another for the Actuator

Inside, the Throttle Sensors and Monitor model block, there are rate-based subsystems for the sensors and monitor. Three of them are running at 5 milliseconds – the Throttle Position Sensor Primary and Secondary, as well as the Monitor. One of them is running at 10 milliseconds – The Acceleration Pedal Position sensor.

What I want is to schedule the Controller to run before the sensors. I must rearchitect the model to interleave the scheduling of these different modeling styles. To do this, I can configure the Throttle Sensors and Monitor model block to schedule the model’s rate-based components via a periodic event port. Now inside the Throttle Sensors and Monitor model block, all the subsystems are triggered by two events, which come from outside the model block. They are labeled D1 and D2.

With both Export Functions and Schedulable Components, no inherent scheduler is assumed, allowing you to more flexibly integrate to a custom environment.

So, we can use the Schedule Editor to schedule both types of components at the top level. In this case, we are interleaving calls to both the export functions and schedulable components. The ControllerRun5ms and ActuatorRun5ms events control the function calls in the Throttle Position Controller and Actuator model block. The D1 and D2 control the Schedulable Component.

But we want to have the controller be executed first in the Execution Order, so in this case, we simply drag and drop it to the place in which we want it to run.

When you get different IP with different modeling styles from different places, this explicit scheduling and interleaving of compositions is very useful.

Related Products

  • Simulink
  • Embedded Coder

Feedback

Featured Product

Simulink

  • Request Trial
  • Get Pricing

Up Next:

Use Simulink Functions to model software services. A Function Caller block can model and generate code for the client’s call to services, especially I/O services, and a Simulink Function block provides those services.
3:07
How to Model Software Services with Simulink Functions
View full series (5 Videos)

Related Videos:

29:49
Modeling Physical Components, Part 1: Mathematical Models
29:49
Modeling Physical Components, Part 2: Data-Driven Concepts
19:09
Modeling HDL Components for FPGAs in Control Applications
36:42
Simulink: Tips and Tricks
41:49
How to Develop Interactive User Interfaces for Simulink...

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Contact Sales
  • About MathWorks

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

  • Select a Web Site United States
  • Patents
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status
  • Modern Slavery Act Transparency Statement

© 1994-2021 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic.  By continuing to use this website, you consent to our use of cookies.  Please see our Privacy Policy to learn more about cookies and how to change your settings.