is it possible to create partitions in a simulink model with command line

1 回表示 (過去 30 日間)
Laurent Dalbies
Laurent Dalbies 2021 年 7 月 16 日
回答済み: Harsh Tamakuwala 2021 年 7 月 21 日
hello,
I want to create partitions in a model programmaticaly as I would do interactively with the schedule editor. Is it possible ?
I've found the simulink.schedule.OrderedSchedule class but it seems it's only possible to update the order of existing partitions. I'd like to create a schedule from scratch.
thanks
Laurent

回答 (1 件)

Harsh Tamakuwala
Harsh Tamakuwala 2021 年 7 月 21 日
A partition needs information about which block/s the partition will consist of. Assuming you have a model block or a subsystem (say "Subsystem1") you want to create a partition from, you can follow these steps:
model = "myModel";
subsystem = "Subsystem1"
set_param([model '/' subsystem],'TreatAsAtomicUnit','on');
% Set the Partition Schedule as (Periodic/Aperiodic) and add a name to the
% partition. If a partition is set as Periodic, it requires the sample
% times value as well
set_param([model '/' subsystem],'ScheduleAs','Periodic','PartitionName','P1','SystemSampleTime', '1');
set_param(model,'SimulationCommand','Update');
Once, the partition is created, you can use schedule APIs to order them
For more information on which parameters were changed here in set_param to create partition, you can refer the documentation here.

カテゴリ

Help Center および File ExchangeSubsystems についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by