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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다: .
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)