How to Combine Modeling Styles with Schedulable Components in Simulink
From the series: Run-Time Software Modeling
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.
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します: .
また、以下のリストから Web サイトを選択することもできます。
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
- América Latina (Español)
- Canada (English)
- United States (English)
- 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)
- United Kingdom (English)
- Australia (English)
- India (English)
- New Zealand (English)
- 日本Japanese (日本語)
- 한국Korean (한국어)